Files
Rootvin-pluginHDCRTN/frmAktSarze.pas
2025-05-21 21:06:33 +02:00

65 lines
1.7 KiB
ObjectPascal

unit frmAktSarze;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, ddPlugin_TLB,
Vcl.StdCtrls, Vcl.Mask;
type
TformAktSarze = class(TForm)
Panel1: TPanel;
edtSmena: TLabeledEdit;
edtVyrDen: TLabeledEdit;
edtSarze: TLabeledEdit;
edtSpotreba: TLabeledEdit;
procedure FormShow(Sender: TObject);
private
public
Helios: IHelios;
vyrDen: TDateTime;
smena: integer;
idKmen: integer;
end;
var
formAktSarze: TformAktSarze;
implementation
uses System.StrUtils, System.Math, System.DateUtils,
helUtils;
{$R *.dfm}
procedure TformAktSarze.FormShow(Sender: TObject);
var zarukaTyp: integer;
zarukaNum: extended;
d: TDateTime;
begin
edtVyrDen.Text:= FormatDateTime('dd.mm.yyyy', vyrDen);
edtSmena.Text:= smena.ToString;
edtSarze.Text:= helUtils.getHeliosStrVal(Helios, '', 'SELECT dbo.ef_Vyroba_VratCisloSarze (default, default, 0)');
edtSpotreba.Text:= '';
if (idKmen>0) then
begin
zarukaNum:= helUtils.getHeliosFloatVal(Helios, 0, 'SELECT ZarukaVystup FROM ' + tblKZ + ' WHERE ID=' + idKmen.ToString);
zarukaTyp:= helUtils.getHeliosIntVal(Helios, 0, 'SELECT TypZarukaVystup FROM ' + tblKZ + ' WHERE ID=' + idKmen.ToString); // 0-Den, 1-Mesic, 2-Rok
d:= vyrDen;
if (zarukaTyp=0) then
d:= IncDay(Now, Floor(zarukaNum));
if (zarukaTyp=1) then
d:= IncMonth(Now, Floor(zarukaNum));
if (zarukaTyp=2) then
d:= IncYear(Now, Floor(zarukaNum));
d:= EndOfTheMonth(d);
edtSpotreba.Text:= FormatDateTime('dd.mm.yyyy', d);
end;
end;
end.