unit DetailForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls,
Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.DBCtrls, Vcl.DBCGrids, DataModule, Vcl.Mask, Vcl.ExtCtrls, TL.Components,
FlatDesignColorsFull;
type
TfrmDetail = class(TLForm)
DBCtrlGrid1: TDBCtrlGrid;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
Panel1: TPanel;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
procedure DBCtrlGrid1PaintPanel(
DBCtrlGrid: TDBCtrlGrid;
Index: Integer);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(
Sender: TObject;
var Action: TCloseAction);
private
{ Private declarations }
FMonth: Integer;
FYear: Integer;
FCat: Integer;
FSubCat: Integer;
public
{ Public declarations }
property Maand: Integer read FMonth write FMonth;
property Jaar: Integer read FYear write FYear;
property Cat: Integer read FCat write FCat;
property SubCat: Integer read FSubCat write FSubCat;
procedure Refresh;
end;
var
frmDetail: TfrmDetail;
implementation
{$R *.dfm}
uses
MainForm, FinAdmColors;
procedure TfrmDetail.DBCtrlGrid1PaintPanel(
DBCtrlGrid: TDBCtrlGrid;
Index: Integer);
begin
// if DBCtrlGrid.ShowFocus then exit;
if DBCtrlGrid.DataSource.DataSet.FindField('Bedrag').Value > 0 then
begin
DBEdit4.Color:= FinAdmColors.clPositive;
DBEdit4.Font.Color:= FinAdmColors.clPositiveText;
end
else
begin
DBEdit4.Color:= FinAdmColors.clNegative;
DBEdit4.Font.Color:= FinAdmColors.clNegativeText;
end;
end;
procedure TfrmDetail.FormClose(
Sender: TObject;
var Action: TCloseAction);
begin
Self.RegVars.Values['DetailsVisible']:= BoolToStr(False);
SaveConfig;
frmMain.btnToonDetails.Caption:= 'Toon details'
end;
procedure TfrmDetail.FormCreate(Sender: TObject);
begin
Self.RegVars.Values['DetailsVisible']:= BoolToStr(False);
Self.LoadConfig;
if Self.Left + Self.Width > Screen.WorkAreaRect.Width then
Self.Left:= Screen.WorkAreaRect.Width - Self.Width;
if Self.Top + Self.Height > Screen.WorkAreaRect.Height then
Self.Top:= Screen.WorkAreaRect.Height - Self.Height;
Self.SaveConfig;
if RegVars.Values['DetailsVisible'] = '0' then
begin
Hide;
frmMain.btnToonDetails.Caption:= 'Toon details'
end
else
begin
Show;
frmMain.btnToonDetails.Caption:= 'Verberg details'
end;
end;
procedure TfrmDetail.FormShow(Sender: TObject);
begin
Self.RegVars.Values['DetailsVisible']:= BoolToStr(True);
SaveConfig;
end;
procedure TfrmDetail.Refresh;
var
FormatSettings_nl_nl: TFormatSettings;
begin
FormatSettings_nl_nl:= TFormatSettings.Create('nl-nl');
Caption:= ' Mutaties - ' + FormatSettings_nl_nl.LongMonthNames[Maand] + ' ' + Jaar.ToString;
with dm.DataSetReportDetail do
begin
Close;
Parameters.ParamByName('Cat').Value:= Cat;
Parameters.ParamByName('SubCat').Value:= SubCat;
Parameters.ParamByName('Jaar').Value:= Jaar;
Parameters.ParamByName('Maand').Value:= Maand;
Open;
end;
end;
end.