📄 pm_qry_pc.pas
字号:
unit Pm_Qry_Pc;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls, jpeg;
Type
TFrm_Pm_Qry_Pc = Class(TFrm_Base_Qry)
AdoQry_MainPcNo: TStringField;
AdoQry_MainPcLineId: TAutoIncField;
AdoQry_MainItemCode: TStringField;
AdoQry_MainPcTaxPrice: TFloatField;
AdoQry_MainPcNoTaxPrice: TFloatField;
AdoQry_MainPcStArtDate: TDateTimeField;
AdoQry_MainPcendDate: TDateTimeField;
AdoQry_MainPcStArtQty: TFloatField;
AdoQry_MainPcendQty: TFloatField;
AdoQry_MainPcPriceType: TIntegerField;
AdoQry_MainPCReferencedPrice: TIntegerField;
AdoQry_MaInvendorCode: TStringField;
AdoQry_MainItemName: TStringField;
AdoQry_MainUomName: TStringField;
AdoQry_MaInvendorName: TStringField;
AdoQry_MainPCTaxRate_Percent: TIntegerField;
AdoQry_MainPCStatus: TIntegerField;
AdoQry_MaincurrencyName: TStringField;
AdoQry_Mainpcdate: TDateTimeField;
AdoQry_MaInvendorflag: TStringField;
AdoQry_MainItemflag: TStringField;
dbtxtVendorflag: TDBText;
dbtxtItemflag: TDBText;
Label1: TLabel;
Label2: TLabel;
AdoQry_Mainpclinestatus: TIntegerField;
AdoQry_Maintmpflag: TIntegerField;
AdoQry_MainPCTaxPrice_Formal: TFloatField;
AdoQry_MainPCNoTaxPrice_Formal: TFloatField;
AdoQry_MainReferencePricePass: TIntegerField;
AdoQry_MainformalPricePass: TIntegerField;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
private
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
{ Public declarations }
end;
var
Frm_Pm_Qry_Pc: TFrm_Pm_Qry_Pc;
implementation
uses Sys_Global;
{$R *.DFM}
{ TFrm_Pm_Qry_Pc }
procedure TFrm_Pm_Qry_Pc.InitForm(AdOConnection: TAdOConnection;
ShowExtendColumn: Boolean);
var sqltext:string;
begin
inherited;
Pricefields:='pcnotaxPrice,pctaxPrice,';
lbl_Condition.Caption:='下单日期从'+datetimetostr(date-30)+'到'+datetimetostr(date);
sqltext:=' Select PcLine.*,pc.pcdate,Pc.VendorCode,Item.ItemName,Uom.UomName,Vendor.VendorName, '+
' Pc.PCTaxRate_Percent,currency.currencyName,Pc.PCStatus, '+
' Vendorflag=pc.VendorCode+'' ''+Vendor.VendorName,'+
' Itemflag=pcline.ItemCode+'' ''+Item.ItemName'+
' into #tmppcline'+
' From PcLine '+
' Join Item On PcLine.ItemCode=Item.ItemCode '+
' Join Pc On PcLine.PcNo=Pc.PcNo '+
' Left Join Vendor On Pc.VendorCode=Vendor.VendorCode '+
' Left Outer Join Uom On Item.UomCode=Uom.UomCode '+
' left outer join currency on pc.currencyCode=currency.currencyCode '+
//' where pc.pcdate between '''+datetimetostr(date-30)+''''+' and '''+datetimetostr(date)+''''+
' Order by Pc.VendorCode,PcLine.PcNo,PcLine.PcLineId,PcLine.ItemCode ';
selectfromsql:='select * from #tmppcline';
//condition:='pc.pcdate between '+quotedstr(datetimetostr(date-30))+' and '+quotedstr(datetimetostr(date));
with AdoQry_Main do
begin
Close;
sql.clear;
sql.Add(sqltext);
Prepared;
try
execsql;
except
end;
Close;
sql.clear;
sql.Add('select * from #tmppcline'+
' where pcdate between '''+datetimetostr(date-30)+''''+' and '''+datetimetostr(date)+'''');
Prepared;
try
open;
except
end;
end;
end;
procedure TFrm_Pm_Qry_Pc.FormDestroy(Sender: TObject);
begin
inherited;
Frm_Pm_Qry_Pc:=nil;
end;
procedure TFrm_Pm_Qry_Pc.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
Executesql(AdoQry_tmp,'drop table #tmppcline',1);
end;
procedure TFrm_Pm_Qry_Pc.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
if AdoQry_Main.fieldbyname('FormalPricePass').asinteger = 0 then
begin
//Background:=$00F9D1C6;
afont.Color:=clblue;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -