164 lines
5.0 KiB
ObjectPascal
164 lines
5.0 KiB
ObjectPascal
unit frmUnit11;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Variants, Classes, Controls, Forms, SysUtils, ddPlugin_TLB, StdCtrls, RzEdit, RzBtnEdt, Vcl.Mask;
|
||
|
||
type
|
||
TformStavSklHromZmeny = class(TForm)
|
||
btnOK: TButton;
|
||
btnStorno: TButton;
|
||
GroupBox1: TGroupBox;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
cbJedenRadek: TCheckBox;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
cbMin: TComboBox;
|
||
edtMin: TRzNumericEdit;
|
||
edtMax: TRzNumericEdit;
|
||
cbMax: TComboBox;
|
||
Label6: TLabel;
|
||
cbBlokVal: TComboBox;
|
||
cbBlok: TComboBox;
|
||
cbVCVal: TComboBox;
|
||
cbVC: TComboBox;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
cbKontace: TComboBox;
|
||
selKontace: TRzButtonEdit;
|
||
Label9: TLabel;
|
||
edtPrumer: TRzNumericEdit;
|
||
cbPrumer: TComboBox;
|
||
procedure btnStornoClick(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure selKontaceButtonClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure btnOKClick(Sender: TObject);
|
||
private
|
||
public
|
||
Helios : IHelios;
|
||
arrId: TArray<integer>;
|
||
end;
|
||
|
||
var
|
||
formStSklHrZmen: TformStavSklHromZmeny;
|
||
oVar1, oVar2: OleVariant;
|
||
|
||
implementation
|
||
|
||
uses helUtils;
|
||
|
||
{$R *.dfm}
|
||
procedure TformStavSklHromZmeny.btnOKClick(Sender: TObject);
|
||
var i: integer;
|
||
lSQL: WideString;
|
||
id: ShortString;
|
||
begin
|
||
if Length(arrId)>0 then
|
||
begin
|
||
for i:=Low(arrId) to High(arrId) do
|
||
begin
|
||
id:= IntToStr(arrId[i]);
|
||
lSQL:= '';
|
||
if cbMin.ItemIndex=0 then
|
||
lSQL:= lSQL + 'Minimum=' + StringReplace(FloatToStr(edtMin.Value),'','',[rfReplaceAll]) + ',';
|
||
if cbMax.ItemIndex=0 then
|
||
lSQL:= lSQL + 'Maximum=' + StringReplace(FloatToStr(edtMax.Value),'','',[rfReplaceAll]) + ',';
|
||
if cbPrumer.ItemIndex=0 then
|
||
lSQL:= lSQL + 'PrumerZadany=' + StringReplace(FloatToStr(edtPrumer.Value),'','',[rfReplaceAll]) + ',';
|
||
if cbBlok.ItemIndex=0 then
|
||
lSQL:= lSQL + 'Blokovano=' + IntToStr(cbBlokVal.ItemIndex) + ',';
|
||
if cbVC.ItemIndex=0 then
|
||
begin
|
||
lSQL:= lSQL + 'KontrolaVC=N''';
|
||
case cbVCVal.ItemIndex of
|
||
0: lSQL:= lSQL + 'N';
|
||
1: lSQL:= lSQL + 'A';
|
||
2: lSQL:= lSQL + 'B';
|
||
end;
|
||
lSQL:= lSQL + ''',';
|
||
end;
|
||
if cbKontace.ItemIndex=0 then
|
||
lSQL:= lSQL + 'UKod=' + Trim(selKontace.Text) + ',';
|
||
if (lSQL<>'') then
|
||
SetLength(lSQL,Length(lSQL)-1);
|
||
lSQL:= 'UPDATE ' + tblSS + ' SET ' + lSQL + ' WHERE id=' + id;
|
||
try
|
||
Helios.ExecSQL(lSQL);
|
||
except on E:Exception do
|
||
Helios.ExecSQL('INSERT #TabExtKom VALUES (N' + QuotedStr('Nelze aktualizovat z<>znam id '
|
||
+ id + ' : ' + E.ClassName + ' : ' + E.Message) + ')');
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TformStavSklHromZmeny.btnStornoClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TformStavSklHromZmeny.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:= caFree;
|
||
end;
|
||
|
||
procedure TformStavSklHromZmeny.FormShow(Sender: TObject);
|
||
var lSQL: WideString;
|
||
edtCol, idx: integer;
|
||
begin
|
||
Self.Icon.Handle:= Helios.MainApplicationIconHandle;
|
||
|
||
{$REGION 'Nastav FontSize a edit Col'}
|
||
edtCol:= $FFFF; // clYellow
|
||
with Helios.OpenSQL('SELECT BarvaPodbarveni FROM ' + tblUziv + ' WHERE BarevnePodbarveni=1 AND LoginName=N' + QuotedStr(Helios.LoginName)) do
|
||
if RecordCount>0 then
|
||
edtCol:= StrToInt(VarToStr(FieldValues(0)));
|
||
|
||
Self.Font.Name:= Helios.Font;
|
||
Self.Font.Height:= Helios.FontHeight;
|
||
idx:= 0;
|
||
while idx<Self.ComponentCount-1 do
|
||
begin
|
||
if (Self.Components[idx] is TLabel) then
|
||
begin
|
||
(Self.Components[idx] as TLabel).Font.Name:= Helios.Font;
|
||
(Self.Components[idx] as TLabel).Font.Height:= Helios.FontHeight;
|
||
end;
|
||
if (Self.Components[idx] is TRzEdit) then
|
||
begin
|
||
(Self.Components[idx] as TRzEdit).Font.Name:= Helios.Font;
|
||
(Self.Components[idx] as TRzEdit).Font.Height:= Helios.FontHeight;
|
||
(Self.Components[idx] as TRzEdit).FocusColor:= edtCol;
|
||
end;
|
||
if (Self.Components[idx] is TRzNumericEdit) then
|
||
begin
|
||
(Self.Components[idx] as TRzNumericEdit).Font.Name:= Helios.Font;
|
||
(Self.Components[idx] as TRzNumericEdit).Font.Height:= Helios.FontHeight;
|
||
(Self.Components[idx] as TRzNumericEdit).FocusColor:= edtCol;
|
||
end;
|
||
if (Self.Components[idx] is TButton) then
|
||
begin
|
||
(Self.Components[idx] as TButton).Font.Name:= Helios.Font;
|
||
(Self.Components[idx] as TButton).Font.Height:= Helios.FontHeight;
|
||
end;
|
||
Inc(idx);
|
||
end;
|
||
{$ENDREGION}
|
||
|
||
lSQL:= 'IF OBJECT_ID(N' + QuotedStr('tempdb..#TabExtKom') + ',N' + QuotedStr('U') + ') IS NULL' + CRLF;
|
||
lSQL:= lSQL + 'CREATE TABLE #TabExtKom(Poznamka NVARCHAR(255) NOT NULL)';
|
||
Helios.ExecSQL(lSQL);
|
||
end;
|
||
|
||
procedure TformStavSklHromZmeny.selKontaceButtonClick(Sender: TObject);
|
||
begin
|
||
if Helios.Prenos(bidSUKod,'id',oVar1,'','Skupiny <20><>etn<74>ch k<>d<EFBFBD>',true) then
|
||
selKontace.Text:= VarToStr(oVar1);
|
||
end;
|
||
|
||
end.
|