120 lines
4.0 KiB
ObjectPascal
120 lines
4.0 KiB
ObjectPascal
unit ProdCarrInven;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||
wItem,
|
||
FireDAC.Stan.Intf,
|
||
FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf,
|
||
FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys,
|
||
FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
|
||
FireDAC.Phys.PGDef, FireDAC.VCLUI.Wait, FireDAC.Comp.UI, FireDAC.Phys.PG,
|
||
Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client;
|
||
|
||
type
|
||
TProdCarrInven = class(TwItem)
|
||
private
|
||
{ Private declarations }
|
||
FCarrDate: string;
|
||
FProdCode: string;
|
||
FMatKind: string;
|
||
FManufact: string;
|
||
FModel: string;
|
||
FProdSpec: string;
|
||
FUnitPrice: string;
|
||
FQty: string;
|
||
FUnitt: string;
|
||
FAmount: string;
|
||
FDescriptions: string;
|
||
FAveAmount: string;
|
||
protected
|
||
{ Protected declarations }
|
||
public
|
||
{ Public declarations }
|
||
class function xGetObjsProdCarrInven(AQuery: TFDQuery): TList;
|
||
class function xAddSqlMark(velStr: string): string;
|
||
class function LoadFromSingleQuery(AQuery: TFDQuery): TList;
|
||
published
|
||
{ Published declarations }
|
||
property CarrDate: string read FCarrDate write FCarrDate;
|
||
property ProdCode: string read FProdCode write FProdCode;
|
||
property MatKind: string read FMatKind write FMatKind;
|
||
property Manufact: string read FManufact write FManufact;
|
||
property Model: string read FModel write FModel;
|
||
property ProdSpec: string read FProdSpec write FProdSpec;
|
||
property UnitPrice: string read FUnitPrice write FUnitPrice;
|
||
property Qty: string read FQty write FQty;
|
||
property Unitt: string read FUnitt write FUnitt;
|
||
property Amount: string read FAmount write FAmount;
|
||
property Descriptions: string read FDescriptions write FDescriptions;
|
||
property AveAmount: string read FAveAmount write FAveAmount;
|
||
end;
|
||
|
||
implementation
|
||
|
||
{ TProdCarrInven }
|
||
|
||
class function TProdCarrInven.LoadFromSingleQuery(AQuery: TFDQuery): TList;
|
||
var
|
||
curInv: TProdCarrInven;
|
||
begin
|
||
Result := TList.Create;
|
||
while not AQuery.Eof do begin
|
||
curInv := TProdCarrInven.Create(nil);
|
||
curInv.OBID := AQuery.FieldByName('OBID').AsString;
|
||
curInv.Name := AQuery.FieldByName('Name').AsString;
|
||
curInv.wClassName := AQuery.FieldByName('wClassName').AsString;
|
||
curInv.CreateDate := AQuery.FieldByName('CreateDate').AsString;
|
||
curInv.CreateTime := FormatDateTime('hh:nn:ss', AQuery.FieldByName('CreateTime').AsDateTime);
|
||
curInv.CreatorID := AQuery.FieldByName('CreatorID').AsString;
|
||
curInv.IsValid := AQuery.FieldByName('IsValid').AsString;
|
||
curInv.LcStatus := AQuery.FieldByName('LcStatus').AsString;
|
||
|
||
curInv.CarrDate := AQuery.FieldByName('CarrDate').AsString;
|
||
curInv.ProdCode := AQuery.FieldByName('ProdCode').AsString;
|
||
curInv.MatKind := AQuery.FieldByName('MatKind').AsString;
|
||
curInv.Manufact := AQuery.FieldByName('Manufact').AsString;
|
||
curInv.Model := AQuery.FieldByName('Model').AsString;
|
||
curInv.ProdSpec := AQuery.FieldByName('ProdSpec').AsString;
|
||
curInv.UnitPrice := AQuery.FieldByName('UnitPrice').AsString;
|
||
curInv.Qty := AQuery.FieldByName('Qty').AsString;
|
||
curInv.Unitt := AQuery.FieldByName('Unitt').AsString;
|
||
curInv.Amount := AQuery.FieldByName('Amount').AsString;
|
||
curInv.Descriptions := AQuery.FieldByName('Descriptions').AsString;
|
||
curInv.AveAmount := AQuery.FieldByName('AveAmount').AsString;
|
||
|
||
Result.Add(curInv);
|
||
AQuery.Next;
|
||
end;
|
||
end;
|
||
|
||
class function TProdCarrInven.xAddSqlMark(velStr: string): string;
|
||
begin
|
||
Result := '';
|
||
Result := '''' + velStr + '''';
|
||
end;
|
||
|
||
class function TProdCarrInven.xGetObjsProdCarrInven(AQuery: TFDQuery): TList;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT * FROM "ProdCarrInven"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' ORDER BY "Amount" DESC';
|
||
// sql := sql + ' ORDER BY "Qty" DESC';
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetObjsProdCarrInven <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromSingleQuery(AQuery);
|
||
end;
|
||
|
||
end.
|
||
|