92 lines
2.1 KiB
ObjectPascal
92 lines
2.1 KiB
ObjectPascal
unit frmPLZakazky;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ddPlugin_TLB, Vcl.ExtCtrls,
|
|
Vcl.StdCtrls, Vcl.Mask, Data.DB, Vcl.Grids, Vcl.DBGrids;
|
|
|
|
type
|
|
TformPLZakazky = class(TForm)
|
|
Panel1: TPanel;
|
|
edtROZakazka: TLabeledEdit;
|
|
edtROSZ: TLabeledEdit;
|
|
edtRORegCis: TLabeledEdit;
|
|
Panel2: TPanel;
|
|
Label1: TLabel;
|
|
edtRONazev1: TEdit;
|
|
DBGrid1: TDBGrid;
|
|
procedure FormShow(Sender: TObject);
|
|
private
|
|
procedure NactiPL;
|
|
public
|
|
Helios: IHelios;
|
|
zakazka: string;
|
|
idKmen: integer;
|
|
end;
|
|
|
|
var
|
|
formPLZakazky: TformPLZakazky;
|
|
|
|
implementation
|
|
uses System.StrUtils, Json,
|
|
datMod,
|
|
helUtils, helTabsBIDs;
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure TformPLZakazky.NactiPL;
|
|
var apiResp, cisloPL: string;
|
|
vJson: TJsonValue;
|
|
oJson, oJson2, oJson3: TJSONObject;
|
|
vContent: TJSONArray;
|
|
vContentRow: TJSONObject;
|
|
i: integer;
|
|
begin
|
|
apiResp:= dm.apiVratPaletoveListy (idKmen);
|
|
if (apiResp<>'') then
|
|
begin
|
|
vJson:= TJSONObject.ParseJSONValue(apiResp);
|
|
if (Assigned(vJson)) then
|
|
try
|
|
oJson:= vJson as TJSONObject;
|
|
vContent:= oJson.GetValue<TJsonArray>('Content');
|
|
for i:=0 to vContent.Count-1 do
|
|
begin
|
|
oJson2:= vContent.Items[I] as TJsonObject; // Element
|
|
oJson3:= oJson2.GetValue<TJSONObject>('CisloPL');
|
|
cisloPL:= oJson3.GetValue<string>('cislo');
|
|
end;
|
|
finally
|
|
vJson.Free;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TformPLZakazky.FormShow(Sender: TObject);
|
|
begin
|
|
// self.Font.Height:= Helios.FontHeight;
|
|
// self.Font.Name:= Helios.Font;
|
|
|
|
edtROZakazka.Text:= zakazka;
|
|
if (idKmen>0) then
|
|
begin
|
|
with Helios.OpenSQL('SELECT SkupZbo, RegCis, Nazev1 FROM ' + tblKZ + ' WHERE ID=' + idKmen.ToString) do
|
|
begin
|
|
edtROSZ.Text:= VarToStr(FieldByNameValues('SkupZbo'));
|
|
edtRORegCis.Text:= VarToStr(FieldByNameValues('RegCis'));
|
|
edtRONazev1.Text:= VarToStr(FieldByNameValues('Nazev1'));
|
|
end;
|
|
|
|
NactiPL;
|
|
end;
|
|
|
|
end;
|
|
|
|
end.
|