-
Notifications
You must be signed in to change notification settings - Fork 9
/
editpurringerform.pas
88 lines (78 loc) · 2.31 KB
/
editpurringerform.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
unit editpurringerform;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
RzSpnEdt, RzDBSpin, StdCtrls, RzLabel, RzDlgBtn, ExtCtrls, RzPanel, data,
ActnList, db, globalvalues;
type TfrmEditPurringer = class(TForm)
RzGroupBox1: TRzGroupBox;
RzDialogButtons1: TRzDialogButtons;
lbKunde: TRzLabel;
RzLabel1: TRzLabel;
RzDBSpinner1: TRzDBSpinner;
RzDBSpinner2: TRzDBSpinner;
ActionList1: TActionList;
DoOK: TAction;
DoCancel: TAction;
Label1: TLabel;
procedure DoOKExecute(Sender: TObject);
procedure DoCancelExecute(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.DFM}
procedure TfrmEditPurringer.DoOKExecute(Sender: TObject);
begin
If (Appdata.faktura.readonly=false) then
Begin
if (Appdata.Faktura.State=dsEdit)
or (Appdata.Faktura.State=dsInsert) then
Begin
try
AppData.Faktura.Post;
AppData.Faktura.ApplyUpdates;
AppData.Faktura.CommitUpdates;
except
on e: exception do
ErrorDialog(ClassName,'DoOKExecute()',e.message);
end;
end;
end;
end;
procedure TfrmEditPurringer.DoCancelExecute(Sender: TObject);
begin
If (Appdata.faktura.readonly=false) then
Begin
if (Appdata.Faktura.State=dsEdit)
or (Appdata.Faktura.State=dsInsert) then
Begin
try
AppData.Faktura.Cancel;
AppData.faktura.CommitUpdates;
Appdata.Faktura.ApplyUpdates;
except
on e: exception do
ErrorDialog(ClassName,'DoCancelExecute()',e.message);
end;
end;
end;
end;
procedure TfrmEditPurringer.FormShow(Sender: TObject);
begin
If (Appdata.faktura.readonly=false) then
If AppData.Faktura.state<>dsEdit then
AppData.Faktura.Edit;
end;
procedure TfrmEditPurringer.FormClose(Sender: TObject;var Action: TCloseAction);
begin
(* user closed the window rather than pressing Cancel button? *)
If (Appdata.faktura.readonly=false) then
If (Appdata.Faktura.State=dsEdit)
or (Appdata.Faktura.State=dsInsert) then
DoCancel.Execute;
end;
end.