Skip to main navigation Zum Hauptinhalt springen Skip to page footer
pascal
 1unit DetailForm;
 2
 3interface
 4
 5uses
 6  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls,
 7  Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.DBCtrls, Vcl.DBCGrids, DataModule, Vcl.Mask, Vcl.ExtCtrls, TL.Components,
 8  FlatDesignColorsFull;
 9
10type
11  TfrmDetail = class(TLForm)
12    DBCtrlGrid1: TDBCtrlGrid;
13    DBEdit1: TDBEdit;
14    DBEdit2: TDBEdit;
15    DBEdit3: TDBEdit;
16    DBEdit4: TDBEdit;
17    Panel1: TPanel;
18    DBEdit5: TDBEdit;
19    DBEdit6: TDBEdit;
20    procedure DBCtrlGrid1PaintPanel(
21      DBCtrlGrid: TDBCtrlGrid;
22      Index: Integer);
23    procedure FormCreate(Sender: TObject);
24    procedure FormShow(Sender: TObject);
25    procedure FormClose(
26      Sender: TObject;
27      var Action: TCloseAction);
28  private
29    { Private declarations }
30    FMonth: Integer;
31    FYear: Integer;
32    FCat: Integer;
33    FSubCat: Integer;
34  public
35    { Public declarations }
36    property Maand: Integer read FMonth write FMonth;
37    property Jaar: Integer read FYear write FYear;
38    property Cat: Integer read FCat write FCat;
39    property SubCat: Integer read FSubCat write FSubCat;
40    procedure Refresh;
41  end;
42
43var
44  frmDetail: TfrmDetail;
45
46implementation
47
48{$R *.dfm}
49
50uses
51  MainForm, FinAdmColors;
52
53procedure TfrmDetail.DBCtrlGrid1PaintPanel(
54  DBCtrlGrid: TDBCtrlGrid;
55  Index: Integer);
56begin
57  // if DBCtrlGrid.ShowFocus then exit;
58  if DBCtrlGrid.DataSource.DataSet.FindField('Bedrag').Value > 0 then
59    begin
60      DBEdit4.Color:= FinAdmColors.clPositive;
61      DBEdit4.Font.Color:= FinAdmColors.clPositiveText;
62    end
63  else
64    begin
65      DBEdit4.Color:= FinAdmColors.clNegative;
66      DBEdit4.Font.Color:= FinAdmColors.clNegativeText;
67    end;
68end;
69
70procedure TfrmDetail.FormClose(
71  Sender: TObject;
72  var Action: TCloseAction);
73begin
74  Self.RegVars.Values['DetailsVisible']:= BoolToStr(False);
75  SaveConfig;
76  frmMain.btnToonDetails.Caption:= 'Toon details'
77end;
78
79procedure TfrmDetail.FormCreate(Sender: TObject);
80begin
81  Self.RegVars.Values['DetailsVisible']:= BoolToStr(False);
82
83  Self.LoadConfig;
84
85  if Self.Left + Self.Width > Screen.WorkAreaRect.Width then
86    Self.Left:= Screen.WorkAreaRect.Width - Self.Width;
87  if Self.Top + Self.Height > Screen.WorkAreaRect.Height then
88    Self.Top:= Screen.WorkAreaRect.Height - Self.Height;
89
90  Self.SaveConfig;
91
92  if RegVars.Values['DetailsVisible'] = '0' then
93    begin
94      Hide;
95      frmMain.btnToonDetails.Caption:= 'Toon details'
96    end
97  else
98    begin
99      Show;
100      frmMain.btnToonDetails.Caption:= 'Verberg details'
101    end;
102end;
103
104procedure TfrmDetail.FormShow(Sender: TObject);
105begin
106  Self.RegVars.Values['DetailsVisible']:= BoolToStr(True);
107  SaveConfig;
108end;
109
110procedure TfrmDetail.Refresh;
111var
112  FormatSettings_nl_nl: TFormatSettings;
113begin
114  FormatSettings_nl_nl:= TFormatSettings.Create('nl-nl');
115  Caption:= ' Mutaties - ' + FormatSettings_nl_nl.LongMonthNames[Maand] + ' ' + Jaar.ToString;
116  with dm.DataSetReportDetail do
117    begin
118      Close;
119      Parameters.ParamByName('Cat').Value:= Cat;
120      Parameters.ParamByName('SubCat').Value:= SubCat;
121      Parameters.ParamByName('Jaar').Value:= Jaar;
122      Parameters.ParamByName('Maand').Value:= Maand;
123      Open;
124    end;
125end;
126
127end.
128