commit
415b41b246
7 changed files with 503 additions and 0 deletions
After Width: | Height: | Size: 134 KiB |
@ -0,0 +1,75 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<CONFIG> |
||||||
|
<ProjectOptions> |
||||||
|
<Version Value="10"/> |
||||||
|
<General> |
||||||
|
<SessionStorage Value="InProjectDir"/> |
||||||
|
<MainUnit Value="0"/> |
||||||
|
<Title Value="Belegscanner"/> |
||||||
|
<ResourceType Value="res"/> |
||||||
|
<UseXPManifest Value="True"/> |
||||||
|
<Icon Value="0"/> |
||||||
|
</General> |
||||||
|
<VersionInfo> |
||||||
|
<StringTable ProductVersion=""/> |
||||||
|
</VersionInfo> |
||||||
|
<BuildModes Count="1"> |
||||||
|
<Item1 Name="Default" Default="True"/> |
||||||
|
</BuildModes> |
||||||
|
<PublishOptions> |
||||||
|
<Version Value="2"/> |
||||||
|
</PublishOptions> |
||||||
|
<RunParams> |
||||||
|
<local> |
||||||
|
<FormatVersion Value="1"/> |
||||||
|
</local> |
||||||
|
</RunParams> |
||||||
|
<RequiredPackages Count="1"> |
||||||
|
<Item1> |
||||||
|
<PackageName Value="LCL"/> |
||||||
|
</Item1> |
||||||
|
</RequiredPackages> |
||||||
|
<Units Count="2"> |
||||||
|
<Unit0> |
||||||
|
<Filename Value="Belegscanner.lpr"/> |
||||||
|
<IsPartOfProject Value="True"/> |
||||||
|
</Unit0> |
||||||
|
<Unit1> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<IsPartOfProject Value="True"/> |
||||||
|
<ComponentName Value="Form1"/> |
||||||
|
<ResourceBaseClass Value="Form"/> |
||||||
|
</Unit1> |
||||||
|
</Units> |
||||||
|
</ProjectOptions> |
||||||
|
<CompilerOptions> |
||||||
|
<Version Value="11"/> |
||||||
|
<Target> |
||||||
|
<Filename Value="Belegscanner"/> |
||||||
|
</Target> |
||||||
|
<SearchPaths> |
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/> |
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> |
||||||
|
</SearchPaths> |
||||||
|
<Linking> |
||||||
|
<Options> |
||||||
|
<Win32> |
||||||
|
<GraphicApplication Value="True"/> |
||||||
|
</Win32> |
||||||
|
</Options> |
||||||
|
</Linking> |
||||||
|
</CompilerOptions> |
||||||
|
<Debugging> |
||||||
|
<Exceptions Count="3"> |
||||||
|
<Item1> |
||||||
|
<Name Value="EAbort"/> |
||||||
|
</Item1> |
||||||
|
<Item2> |
||||||
|
<Name Value="ECodetoolError"/> |
||||||
|
</Item2> |
||||||
|
<Item3> |
||||||
|
<Name Value="EFOpenError"/> |
||||||
|
</Item3> |
||||||
|
</Exceptions> |
||||||
|
</Debugging> |
||||||
|
</CONFIG> |
@ -0,0 +1,21 @@ |
|||||||
|
program Belegscanner; |
||||||
|
|
||||||
|
{$mode objfpc}{$H+} |
||||||
|
|
||||||
|
uses |
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads} |
||||||
|
cthreads, |
||||||
|
{$ENDIF}{$ENDIF} |
||||||
|
Interfaces, // this includes the LCL widgetset |
||||||
|
Forms, scanner |
||||||
|
{ you can add units after this }; |
||||||
|
|
||||||
|
{$R *.res} |
||||||
|
|
||||||
|
begin |
||||||
|
RequireDerivedFormResource:=True; |
||||||
|
Application.Initialize; |
||||||
|
Application.CreateForm(TForm1, Form1); |
||||||
|
Application.Run; |
||||||
|
end. |
||||||
|
|
@ -0,0 +1,178 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<CONFIG> |
||||||
|
<ProjectSession> |
||||||
|
<Version Value="10"/> |
||||||
|
<BuildModes Active="Default"/> |
||||||
|
<Units Count="4"> |
||||||
|
<Unit0> |
||||||
|
<Filename Value="Belegscanner.lpr"/> |
||||||
|
<IsPartOfProject Value="True"/> |
||||||
|
<EditorIndex Value="-1"/> |
||||||
|
<WindowIndex Value="-1"/> |
||||||
|
<TopLine Value="-1"/> |
||||||
|
<CursorPos X="-1" Y="-1"/> |
||||||
|
<UsageCount Value="20"/> |
||||||
|
</Unit0> |
||||||
|
<Unit1> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<IsPartOfProject Value="True"/> |
||||||
|
<ComponentName Value="Form1"/> |
||||||
|
<ResourceBaseClass Value="Form"/> |
||||||
|
<IsVisibleTab Value="True"/> |
||||||
|
<TopLine Value="51"/> |
||||||
|
<CursorPos X="51" Y="86"/> |
||||||
|
<UsageCount Value="20"/> |
||||||
|
<Loaded Value="True"/> |
||||||
|
<LoadedDesigner Value="True"/> |
||||||
|
</Unit1> |
||||||
|
<Unit2> |
||||||
|
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/syshelph.inc"/> |
||||||
|
<EditorIndex Value="-1"/> |
||||||
|
<TopLine Value="252"/> |
||||||
|
<CursorPos X="14" Y="292"/> |
||||||
|
<UsageCount Value="10"/> |
||||||
|
</Unit2> |
||||||
|
<Unit3> |
||||||
|
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/extdlgs.pas"/> |
||||||
|
<UnitName Value="ExtDlgs"/> |
||||||
|
<EditorIndex Value="-1"/> |
||||||
|
<TopLine Value="175"/> |
||||||
|
<CursorPos X="29" Y="215"/> |
||||||
|
<UsageCount Value="10"/> |
||||||
|
</Unit3> |
||||||
|
</Units> |
||||||
|
<JumpHistory Count="30" HistoryIndex="29"> |
||||||
|
<Position1> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="64" Column="35"/> |
||||||
|
</Position1> |
||||||
|
<Position2> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="59" Column="26" TopLine="3"/> |
||||||
|
</Position2> |
||||||
|
<Position3> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="71" Column="42" TopLine="10"/> |
||||||
|
</Position3> |
||||||
|
<Position4> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="49" Column="3" TopLine="8"/> |
||||||
|
</Position4> |
||||||
|
<Position5> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="56" Column="3" TopLine="8"/> |
||||||
|
</Position5> |
||||||
|
<Position6> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="46" TopLine="6"/> |
||||||
|
</Position6> |
||||||
|
<Position7> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="25" Column="15"/> |
||||||
|
</Position7> |
||||||
|
<Position8> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="68" Column="27" TopLine="11"/> |
||||||
|
</Position8> |
||||||
|
<Position9> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="65" Column="3" TopLine="14"/> |
||||||
|
</Position9> |
||||||
|
<Position10> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="70" Column="6" TopLine="14"/> |
||||||
|
</Position10> |
||||||
|
<Position11> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="49" Column="33" TopLine="17"/> |
||||||
|
</Position11> |
||||||
|
<Position12> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="47" Column="26" TopLine="13"/> |
||||||
|
</Position12> |
||||||
|
<Position13> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="81" Column="61" TopLine="28"/> |
||||||
|
</Position13> |
||||||
|
<Position14> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="68" Column="3" TopLine="28"/> |
||||||
|
</Position14> |
||||||
|
<Position15> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="67" Column="19" TopLine="28"/> |
||||||
|
</Position15> |
||||||
|
<Position16> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="49" Column="29" TopLine="27"/> |
||||||
|
</Position16> |
||||||
|
<Position17> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="47" Column="3" TopLine="14"/> |
||||||
|
</Position17> |
||||||
|
<Position18> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="48" TopLine="13"/> |
||||||
|
</Position18> |
||||||
|
<Position19> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="49" Column="10" TopLine="16"/> |
||||||
|
</Position19> |
||||||
|
<Position20> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="81" Column="26" TopLine="28"/> |
||||||
|
</Position20> |
||||||
|
<Position21> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="64" Column="85" TopLine="4"/> |
||||||
|
</Position21> |
||||||
|
<Position22> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="66" Column="85" TopLine="4"/> |
||||||
|
</Position22> |
||||||
|
<Position23> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="84" Column="21" TopLine="38"/> |
||||||
|
</Position23> |
||||||
|
<Position24> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="95" Column="81" TopLine="38"/> |
||||||
|
</Position24> |
||||||
|
<Position25> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="96" Column="25" TopLine="42"/> |
||||||
|
</Position25> |
||||||
|
<Position26> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="95" Column="67" TopLine="42"/> |
||||||
|
</Position26> |
||||||
|
<Position27> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="79" Column="16" TopLine="42"/> |
||||||
|
</Position27> |
||||||
|
<Position28> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="101" Column="62" TopLine="44"/> |
||||||
|
</Position28> |
||||||
|
<Position29> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="84" Column="17" TopLine="51"/> |
||||||
|
</Position29> |
||||||
|
<Position30> |
||||||
|
<Filename Value="scanner.pas"/> |
||||||
|
<Caret Line="83" Column="76" TopLine="51"/> |
||||||
|
</Position30> |
||||||
|
</JumpHistory> |
||||||
|
</ProjectSession> |
||||||
|
<Debugging> |
||||||
|
<BreakPoints Count="1"> |
||||||
|
<Item1> |
||||||
|
<Kind Value="bpkSource"/> |
||||||
|
<WatchScope Value="wpsLocal"/> |
||||||
|
<WatchKind Value="wpkWrite"/> |
||||||
|
<Source Value="scanner.pas"/> |
||||||
|
<Line Value="127"/> |
||||||
|
</Item1> |
||||||
|
</BreakPoints> |
||||||
|
</Debugging> |
||||||
|
</CONFIG> |
Binary file not shown.
@ -0,0 +1,102 @@ |
|||||||
|
object Form1: TForm1 |
||||||
|
Left = 2207 |
||||||
|
Height = 95 |
||||||
|
Top = 221 |
||||||
|
Width = 664 |
||||||
|
Caption = 'Form1' |
||||||
|
ClientHeight = 95 |
||||||
|
ClientWidth = 664 |
||||||
|
LCLVersion = '1.8.2.0' |
||||||
|
object DateView: TLabel |
||||||
|
Left = 8 |
||||||
|
Height = 19 |
||||||
|
Top = 8 |
||||||
|
Width = 150 |
||||||
|
Caption = 'Datum auswählen!' |
||||||
|
Font.Height = -16 |
||||||
|
Font.Name = 'Sans' |
||||||
|
ParentColor = False |
||||||
|
ParentFont = False |
||||||
|
end |
||||||
|
object dateButton: TButton |
||||||
|
Left = 232 |
||||||
|
Height = 25 |
||||||
|
Top = 8 |
||||||
|
Width = 75 |
||||||
|
Caption = 'ändern' |
||||||
|
OnClick = dateButtonClick |
||||||
|
TabOrder = 0 |
||||||
|
end |
||||||
|
object TypeSelector: TComboBox |
||||||
|
Left = 8 |
||||||
|
Height = 29 |
||||||
|
Top = 32 |
||||||
|
Width = 216 |
||||||
|
Enabled = False |
||||||
|
ItemHeight = 0 |
||||||
|
OnChange = TypeSelectorChange |
||||||
|
TabOrder = 1 |
||||||
|
Text = 'Select Type' |
||||||
|
end |
||||||
|
object Origin: TComboBox |
||||||
|
Left = 232 |
||||||
|
Height = 29 |
||||||
|
Top = 32 |
||||||
|
Width = 184 |
||||||
|
Enabled = False |
||||||
|
ItemHeight = 0 |
||||||
|
OnChange = OriginChange |
||||||
|
TabOrder = 2 |
||||||
|
Text = 'Start' |
||||||
|
end |
||||||
|
object Destination: TComboBox |
||||||
|
Left = 424 |
||||||
|
Height = 29 |
||||||
|
Top = 32 |
||||||
|
Width = 196 |
||||||
|
Enabled = False |
||||||
|
ItemHeight = 0 |
||||||
|
OnChange = DestinationChange |
||||||
|
TabOrder = 3 |
||||||
|
Text = 'Ziel' |
||||||
|
end |
||||||
|
object FolderName: TLabel |
||||||
|
Left = 8 |
||||||
|
Height = 19 |
||||||
|
Top = 64 |
||||||
|
Width = 103 |
||||||
|
Caption = 'Ordnername' |
||||||
|
Font.Height = -16 |
||||||
|
Font.Name = 'Sans' |
||||||
|
ParentColor = False |
||||||
|
ParentFont = False |
||||||
|
end |
||||||
|
object Product: TComboBox |
||||||
|
Left = 232 |
||||||
|
Height = 29 |
||||||
|
Top = 32 |
||||||
|
Width = 184 |
||||||
|
Enabled = False |
||||||
|
ItemHeight = 0 |
||||||
|
OnChange = ProductChange |
||||||
|
TabOrder = 4 |
||||||
|
Text = 'Produkt' |
||||||
|
Visible = False |
||||||
|
end |
||||||
|
object ScnaButton: TButton |
||||||
|
Left = 320 |
||||||
|
Height = 25 |
||||||
|
Top = 8 |
||||||
|
Width = 75 |
||||||
|
Caption = 'scannen!' |
||||||
|
OnClick = ScnaButtonClick |
||||||
|
TabOrder = 5 |
||||||
|
end |
||||||
|
object DateSelector: TCalendarDialog |
||||||
|
Date = 43775 |
||||||
|
OKCaption = '&Ok' |
||||||
|
CancelCaption = 'Abbrechen' |
||||||
|
left = 472 |
||||||
|
top = 8 |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,127 @@ |
|||||||
|
unit scanner; |
||||||
|
|
||||||
|
{$mode objfpc}{$H+} |
||||||
|
|
||||||
|
interface |
||||||
|
|
||||||
|
uses |
||||||
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtDlgs, |
||||||
|
StdCtrls; |
||||||
|
|
||||||
|
type |
||||||
|
|
||||||
|
{ TForm1 } |
||||||
|
|
||||||
|
TForm1 = class(TForm) |
||||||
|
ScnaButton: TButton; |
||||||
|
Product: TComboBox; |
||||||
|
Destination: TComboBox; |
||||||
|
FolderName: TLabel; |
||||||
|
Origin: TComboBox; |
||||||
|
TypeSelector: TComboBox; |
||||||
|
dateButton: TButton; |
||||||
|
DateSelector: TCalendarDialog; |
||||||
|
DateView: TLabel; |
||||||
|
procedure ProductChange(Sender: TObject); |
||||||
|
procedure DestinationChange(Sender: TObject); |
||||||
|
procedure dateButtonClick(Sender: TObject); |
||||||
|
procedure OriginChange(Sender: TObject); |
||||||
|
procedure ScnaButtonClick(Sender: TObject); |
||||||
|
procedure TypeSelectorChange(Sender: TObject); |
||||||
|
procedure UpdateTypes(); |
||||||
|
procedure UpdateFolder(); |
||||||
|
private |
||||||
|
date: TDateTime; |
||||||
|
public |
||||||
|
|
||||||
|
end; |
||||||
|
|
||||||
|
var |
||||||
|
Form1: TForm1; |
||||||
|
|
||||||
|
implementation |
||||||
|
|
||||||
|
{$R *.lfm} |
||||||
|
|
||||||
|
{ TForm1 } |
||||||
|
|
||||||
|
procedure TForm1.TypeSelectorChange(Sender: TObject); |
||||||
|
var |
||||||
|
state: boolean; |
||||||
|
begin |
||||||
|
TypeSelector.Tag:=1; |
||||||
|
state := TypeSelector.Text = 'Ticket'; |
||||||
|
Origin.Enabled:=state; |
||||||
|
Origin.Visible:=state; |
||||||
|
Destination.Enabled:=state; |
||||||
|
Product.Enabled:=not state; |
||||||
|
Product.Visible:=not state; |
||||||
|
UpdateFolder(); |
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.dateButtonClick(Sender: TObject); |
||||||
|
begin |
||||||
|
DateSelector.Execute; |
||||||
|
date := DateSelector.Date; |
||||||
|
DateView.Caption:=FormatDateTime('YYYY-MM-DD',date); |
||||||
|
UpdateTypes(); |
||||||
|
TypeSelector.enabled := true; |
||||||
|
UpdateFolder(); |
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.OriginChange(Sender: TObject); |
||||||
|
begin |
||||||
|
Origin.Tag := 1; |
||||||
|
UpdateFolder(); |
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.ScnaButtonClick(Sender: TObject); |
||||||
|
var |
||||||
|
config: TFileStream; |
||||||
|
filename: String; |
||||||
|
begin |
||||||
|
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf'; |
||||||
|
FolderName.Caption:=filename; |
||||||
|
try |
||||||
|
config :=TFilestream.Create(filename, fmCreate); |
||||||
|
config.Write(filename[1],filename.Length); |
||||||
|
finally |
||||||
|
config.Free; |
||||||
|
end; |
||||||
|
|
||||||
|
|
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.DestinationChange(Sender: TObject); |
||||||
|
begin |
||||||
|
Destination.Tag := 1; |
||||||
|
UpdateFolder(); |
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.ProductChange(Sender: TObject); |
||||||
|
begin |
||||||
|
Product.Tag := 1; |
||||||
|
UpdateFolder(); |
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.UpdateFolder(); |
||||||
|
var |
||||||
|
tx: String; |
||||||
|
begin |
||||||
|
tx := FormatDateTime('YYYY-MM-DD',date); |
||||||
|
if (TypeSelector.Tag > 0) then tx := tx + ' - ' + TypeSelector.Text; |
||||||
|
if (Origin.Enabled AND (Origin.Tag > 0)) then tx := tx + ': ' + Origin.Text; |
||||||
|
if (Destination.Enabled AND (Destination.Tag > 0)) then tx := tx + ' - ' + Destination.Text; |
||||||
|
if (Product.Enabled AND (Product.Tag > 0)) then tx := tx + ' von ' + Product.Text; |
||||||
|
FolderName.Caption:=tx; |
||||||
|
end; |
||||||
|
|
||||||
|
procedure TForm1.UpdateTypes(); |
||||||
|
begin |
||||||
|
WriteLn('Test'); |
||||||
|
TypeSelector.Items.Clear; |
||||||
|
TypeSelector.Items.Add('Ticket'); |
||||||
|
end; |
||||||
|
|
||||||
|
end. |
||||||
|
|
Loading…
Reference in new issue