working on selectors
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="ScanForm"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ uses
|
|||||||
begin
|
begin
|
||||||
RequireDerivedFormResource:=True;
|
RequireDerivedFormResource:=True;
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
Application.CreateForm(TForm1, Form1);
|
Application.CreateForm(TScanForm, ScanForm);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@@ -3,24 +3,22 @@
|
|||||||
<ProjectSession>
|
<ProjectSession>
|
||||||
<Version Value="10"/>
|
<Version Value="10"/>
|
||||||
<BuildModes Active="Default"/>
|
<BuildModes Active="Default"/>
|
||||||
<Units Count="4">
|
<Units Count="5">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="Belegscanner.lpr"/>
|
<Filename Value="Belegscanner.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<EditorIndex Value="-1"/>
|
<EditorIndex Value="-1"/>
|
||||||
<WindowIndex Value="-1"/>
|
<CursorPos X="17" Y="10"/>
|
||||||
<TopLine Value="-1"/>
|
|
||||||
<CursorPos X="-1" Y="-1"/>
|
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="20"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="ScanForm"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<TopLine Value="51"/>
|
<TopLine Value="136"/>
|
||||||
<CursorPos X="51" Y="86"/>
|
<CursorPos X="22" Y="183"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="20"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
@@ -28,8 +26,8 @@
|
|||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/syshelph.inc"/>
|
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/syshelph.inc"/>
|
||||||
<EditorIndex Value="-1"/>
|
<EditorIndex Value="-1"/>
|
||||||
<TopLine Value="252"/>
|
<TopLine Value="119"/>
|
||||||
<CursorPos X="14" Y="292"/>
|
<CursorPos X="14" Y="151"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
@@ -40,139 +38,136 @@
|
|||||||
<CursorPos X="29" Y="215"/>
|
<CursorPos X="29" Y="215"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
|
<Unit4>
|
||||||
|
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/stdctrls.pp"/>
|
||||||
|
<UnitName Value="StdCtrls"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<TopLine Value="389"/>
|
||||||
|
<CursorPos X="14" Y="437"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit4>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="64" Column="35"/>
|
<Caret Line="55" Column="16"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="59" Column="26" TopLine="3"/>
|
<Caret Line="51" Column="38" TopLine="2"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="71" Column="42" TopLine="10"/>
|
<Caret Line="56" Column="19" TopLine="25"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="49" Column="3" TopLine="8"/>
|
<Caret Line="51" Column="54"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="56" Column="3" TopLine="8"/>
|
<Caret Line="117" Column="77" TopLine="112"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="46" TopLine="6"/>
|
<Caret Line="141" Column="148" TopLine="114"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="25" Column="15"/>
|
<Caret Line="13" Column="140"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="68" Column="27" TopLine="11"/>
|
<Caret Column="13"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="65" Column="3" TopLine="14"/>
|
<Caret Line="19" Column="53" TopLine="38"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="70" Column="6" TopLine="14"/>
|
<Caret Line="165" Column="35" TopLine="120"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="49" Column="33" TopLine="17"/>
|
<Caret Line="145" Column="74" TopLine="128"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="47" Column="26" TopLine="13"/>
|
<Caret Line="71" Column="52" TopLine="31"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="81" Column="61" TopLine="28"/>
|
<Caret Line="161" Column="117" TopLine="127"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="68" Column="3" TopLine="28"/>
|
<Caret Line="151" Column="70" TopLine="118"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="67" Column="19" TopLine="28"/>
|
<Caret Line="34" Column="160" TopLine="26"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="49" Column="29" TopLine="27"/>
|
<Caret Line="100" Column="100" TopLine="76"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="47" Column="3" TopLine="14"/>
|
<Caret Line="163" Column="12" TopLine="126"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="48" TopLine="13"/>
|
<Caret Line="158" Column="14" TopLine="126"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="49" Column="10" TopLine="16"/>
|
<Caret Line="164" Column="3" TopLine="125"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="81" Column="26" TopLine="28"/>
|
<Caret Line="158" Column="13" TopLine="125"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="64" Column="85" TopLine="4"/>
|
<Caret Line="166" Column="5" TopLine="125"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="66" Column="85" TopLine="4"/>
|
<Caret Line="164" Column="38" TopLine="130"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="84" Column="21" TopLine="38"/>
|
<Caret Line="166" Column="46" TopLine="130"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="95" Column="81" TopLine="38"/>
|
<Caret Line="171" TopLine="130"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="96" Column="25" TopLine="42"/>
|
<Caret Line="172" Column="11" TopLine="71"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="95" Column="67" TopLine="42"/>
|
<Caret Line="173" Column="45" TopLine="120"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="79" Column="16" TopLine="42"/>
|
<Caret Line="179" TopLine="139"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="101" Column="62" TopLine="44"/>
|
<Caret Line="175" TopLine="138"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="84" Column="17" TopLine="51"/>
|
<Caret Line="154" Column="5" TopLine="138"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="scanner.pas"/>
|
<Filename Value="scanner.pas"/>
|
||||||
<Caret Line="83" Column="76" TopLine="51"/>
|
<Caret Line="30" Column="73"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectSession>
|
</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>
|
</CONFIG>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
object Form1: TForm1
|
object ScanForm: TScanForm
|
||||||
Left = 2207
|
Left = 2207
|
||||||
Height = 95
|
Height = 95
|
||||||
Top = 221
|
Top = 221
|
||||||
Width = 664
|
Width = 664
|
||||||
Caption = 'Form1'
|
Caption = 'Belegscanner'
|
||||||
ClientHeight = 95
|
ClientHeight = 95
|
||||||
ClientWidth = 664
|
ClientWidth = 664
|
||||||
|
OnCreate = FormCreate
|
||||||
LCLVersion = '1.8.2.0'
|
LCLVersion = '1.8.2.0'
|
||||||
object DateView: TLabel
|
object DateView: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
|
|||||||
157
scanner.pas
157
scanner.pas
@@ -10,9 +10,9 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TForm1 }
|
{ TScanForm }
|
||||||
|
|
||||||
TForm1 = class(TForm)
|
TScanForm = class(TForm)
|
||||||
ScnaButton: TButton;
|
ScnaButton: TButton;
|
||||||
Product: TComboBox;
|
Product: TComboBox;
|
||||||
Destination: TComboBox;
|
Destination: TComboBox;
|
||||||
@@ -22,14 +22,19 @@ type
|
|||||||
dateButton: TButton;
|
dateButton: TButton;
|
||||||
DateSelector: TCalendarDialog;
|
DateSelector: TCalendarDialog;
|
||||||
DateView: TLabel;
|
DateView: TLabel;
|
||||||
|
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure ProductChange(Sender: TObject);
|
procedure ProductChange(Sender: TObject);
|
||||||
procedure DestinationChange(Sender: TObject);
|
procedure DestinationChange(Sender: TObject);
|
||||||
procedure dateButtonClick(Sender: TObject);
|
procedure dateButtonClick(Sender: TObject);
|
||||||
procedure OriginChange(Sender: TObject);
|
procedure OriginChange(Sender: TObject);
|
||||||
procedure ScnaButtonClick(Sender: TObject);
|
procedure ScnaButtonClick(Sender: TObject);
|
||||||
procedure TypeSelectorChange(Sender: TObject);
|
procedure TypeSelectorChange(Sender: TObject);
|
||||||
|
function ExportConfig(): string;
|
||||||
|
function ExportOptions(dropDown: TComboBox): string;
|
||||||
procedure UpdateTypes();
|
procedure UpdateTypes();
|
||||||
procedure UpdateFolder();
|
procedure UpdateFolder();
|
||||||
|
procedure MixLocations(d1: TComboBox; d2: TComboBox);
|
||||||
private
|
private
|
||||||
date: TDateTime;
|
date: TDateTime;
|
||||||
public
|
public
|
||||||
@@ -37,91 +42,171 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
Form1: TForm1;
|
ScanForm: TScanForm;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
{ TForm1 }
|
{ TScanForm }
|
||||||
|
|
||||||
procedure TForm1.TypeSelectorChange(Sender: TObject);
|
procedure TScanForm.MixLocations(d1: TComboBox; d2: TComboBox);
|
||||||
|
var
|
||||||
|
list: TStringList;
|
||||||
|
begin
|
||||||
|
list := TStringList.Create;
|
||||||
|
list.Sorted := True;
|
||||||
|
d1.Items.Add(d1.Text);
|
||||||
|
d2.Items.Add(d2.Text);
|
||||||
|
list.Assign(d1.Items);
|
||||||
|
list.AddStrings(d2.Items);
|
||||||
|
d1.Items.Assign(list);
|
||||||
|
d2.Items.Assign(list);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TScanForm.ExportConfig(): string;
|
||||||
|
begin
|
||||||
|
Result := 'types:' + ExportOptions(TypeSelector) + #13;
|
||||||
|
Result := Result + 'items:' + ExportOptions(Product) + #13;
|
||||||
|
MixLocations(Origin, Destination);
|
||||||
|
Result := Result + 'locations:' + ExportOPtions(Origin) + #13;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TScanForm.ExportOptions(dropDown: TComboBox): string;
|
||||||
|
var
|
||||||
|
list: TStringList;
|
||||||
|
begin
|
||||||
|
// make sure the current text appears in future lists
|
||||||
|
dropDown.Items.Add(dropDown.Text);
|
||||||
|
// create a StringList to sort and concatenate
|
||||||
|
list := TStringList.Create;
|
||||||
|
list.StrictDelimiter := True;
|
||||||
|
list.Sorted := True;
|
||||||
|
|
||||||
|
// put all items in the list, will sort and remove duplicates
|
||||||
|
list.Assign(dropDown.Items);
|
||||||
|
|
||||||
|
// update dropdown
|
||||||
|
dropDown.Items.Assign(list);
|
||||||
|
|
||||||
|
// return json array
|
||||||
|
Result := list.DelimitedText
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TScanForm.TypeSelectorChange(Sender: TObject);
|
||||||
var
|
var
|
||||||
state: boolean;
|
state: boolean;
|
||||||
begin
|
begin
|
||||||
TypeSelector.Tag:=1;
|
TypeSelector.Tag := 1;
|
||||||
state := TypeSelector.Text = 'Ticket';
|
state := TypeSelector.Text = 'Ticket';
|
||||||
Origin.Enabled:=state;
|
Origin.Enabled := state;
|
||||||
Origin.Visible:=state;
|
Origin.Visible := state;
|
||||||
Destination.Enabled:=state;
|
Destination.Enabled := state;
|
||||||
Product.Enabled:=not state;
|
Product.Enabled := not state;
|
||||||
Product.Visible:=not state;
|
Product.Visible := not state;
|
||||||
UpdateFolder();
|
UpdateFolder();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.dateButtonClick(Sender: TObject);
|
procedure TScanForm.dateButtonClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DateSelector.Execute;
|
DateSelector.Execute;
|
||||||
date := DateSelector.Date;
|
date := DateSelector.Date;
|
||||||
DateView.Caption:=FormatDateTime('YYYY-MM-DD',date);
|
DateView.Caption := FormatDateTime('YYYY-MM-DD', date);
|
||||||
UpdateTypes();
|
UpdateTypes();
|
||||||
TypeSelector.enabled := true;
|
TypeSelector.Enabled := True;
|
||||||
UpdateFolder();
|
UpdateFolder();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.OriginChange(Sender: TObject);
|
procedure TScanForm.OriginChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Origin.Tag := 1;
|
Origin.Tag := 1;
|
||||||
UpdateFolder();
|
UpdateFolder();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ScnaButtonClick(Sender: TObject);
|
procedure TScanForm.ScnaButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
config: TFileStream;
|
config: TFileStream;
|
||||||
filename: String;
|
filename: string;
|
||||||
|
json: string;
|
||||||
begin
|
begin
|
||||||
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
|
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
|
||||||
FolderName.Caption:=filename;
|
json := ExportConfig();
|
||||||
try
|
try
|
||||||
config :=TFilestream.Create(filename, fmCreate);
|
config := TFilestream.Create(filename, fmCreate);
|
||||||
config.Write(filename[1],filename.Length);
|
config.Write(json[1], json.Length);
|
||||||
finally
|
finally
|
||||||
config.Free;
|
config.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.DestinationChange(Sender: TObject);
|
procedure TScanForm.DestinationChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Destination.Tag := 1;
|
Destination.Tag := 1;
|
||||||
UpdateFolder();
|
UpdateFolder();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ProductChange(Sender: TObject);
|
procedure TScanForm.ProductChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Product.Tag := 1;
|
Product.Tag := 1;
|
||||||
UpdateFolder();
|
UpdateFolder();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.UpdateFolder();
|
procedure TScanForm.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
tx: String;
|
filename: String;
|
||||||
|
lines: TStringList;
|
||||||
|
line: String;
|
||||||
|
index: integer;
|
||||||
begin
|
begin
|
||||||
tx := FormatDateTime('YYYY-MM-DD',date);
|
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
|
||||||
if (TypeSelector.Tag > 0) then tx := tx + ' - ' + TypeSelector.Text;
|
lines := TStringList.Create;
|
||||||
if (Origin.Enabled AND (Origin.Tag > 0)) then tx := tx + ': ' + Origin.Text;
|
try
|
||||||
if (Destination.Enabled AND (Destination.Tag > 0)) then tx := tx + ' - ' + Destination.Text;
|
lines.LoadFromFile(filename);
|
||||||
if (Product.Enabled AND (Product.Tag > 0)) then tx := tx + ' von ' + Product.Text;
|
for index := 0 to lines.Count-1 do
|
||||||
FolderName.Caption:=tx;
|
begin
|
||||||
|
line:=lines.Strings[index];
|
||||||
|
if line.StartsWith('types:') then
|
||||||
|
begin
|
||||||
|
line := line.Substring(6);
|
||||||
|
TypeSelector.Items.AddStrings(line.Split(','));
|
||||||
|
end;
|
||||||
|
if line.StartsWith('items:') then
|
||||||
|
begin
|
||||||
|
line := line.Substring(6);
|
||||||
|
Product.Items.AddStrings(line.Split(','));
|
||||||
|
end;
|
||||||
|
if line.StartsWith('locations:') then
|
||||||
|
begin
|
||||||
|
line := line.Substring(10);
|
||||||
|
Origin.Items.AddStrings(line.Split(','));
|
||||||
|
Destination.Items.AddStrings(line.Split(','));
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
finally
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.UpdateTypes();
|
|
||||||
|
procedure TScanForm.UpdateFolder();
|
||||||
|
var
|
||||||
|
tx: string;
|
||||||
begin
|
begin
|
||||||
WriteLn('Test');
|
tx := FormatDateTime('YYYY-MM-DD', date) + ' - ';
|
||||||
TypeSelector.Items.Clear;
|
if (Product.Enabled and (Product.Tag > 0)) then
|
||||||
TypeSelector.Items.Add('Ticket');
|
tx := tx + Product.Text + ' von ';
|
||||||
|
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;
|
||||||
|
FolderName.Caption := tx;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TScanForm.UpdateTypes();
|
||||||
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user