📄 inv_opvendorinvqry.pas
字号:
unit Inv_OpVendorInvQry;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg;
Type
TFrm_Inv_OpVendorInvQry = Class(TFrm_Base_Qry)
lbl_SumAmount: TLabel;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure AdoQueryAfterOpen(DataSet: TDataSet);
private
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);Override;
{ Public declarations }
end;
var
Frm_Inv_OpVendorInvQry: TFrm_Inv_OpVendorInvQry;
implementation
uses Sys_Condition,Inv_OpVendorInvQry_C;
{$R *.DFM}
procedure TFrm_Inv_OpVendorInvQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
//这两个参数是回传到基类后控制价格及金额的显示格式
PriceFields:='opAveragePrice,';
AmountFields:='opInv,Amount,';
SelectFromSQL:='select opCurrentInv.VendorCode,'+
'opCurrentInv.VendorCode+'+''' '''+'+Vendor.VendorName as VendorCodeName, '+
'opCurrentInv.ItemCode,'+
'opCurrentInv.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName,'+
'opCurrentInv.opInv,'+
'opAveragePrice.opAveragePrice,'+
'round(opCurrentInv.opInv*opAveragePrice.opAveragePrice,2) as Amount'+
' from opCurrentInv '+
' left join opAveragePrice '+
' on opCurrentInv.VendorCode=opAveragePrice.VendorCode and '+
' opCurrentInv.ItemCode=opAveragePrice.ItemCode '+
' left join Vendor '+
' on opCurrentInv.VendorCode=Vendor.VendorCode '+
' left join Item '+
' on opCurrentInv.ItemCode=Item.ItemCode ';
OrderByFields:='VendorCode,ItemCode';
lbl_Order.Caption:='供应商代码,物料代码';
Frm_Sys_Condition:=TFrm_Inv_OpVendorInvQry_C.Create(Self);
Act_Filter.Execute;
end;
procedure TFrm_Inv_OpVendorInvQry.SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);
begin
inherited;
//把参数从CONDITION窗体中传过来
lbl_SumAmount.Caption:=FrmParam1+' 元';
end;
procedure TFrm_Inv_OpVendorInvQry.Act_PreviewExecute(Sender: TObject);
begin
DBGridEh.Columns[0].Visible:=False;
inherited;
DBGridEh.Columns[0].Visible:=True;
end;
procedure TFrm_Inv_OpVendorInvQry.Act_PrintExecute(Sender: TObject);
begin
DBGridEh.Columns[0].Visible:=False;
inherited;
DBGridEh.Columns[0].Visible:=True;
end;
procedure TFrm_Inv_OpVendorInvQry.AdoQueryAfterOpen(DataSet: TDataSet);
var
sql_txt:string;
i:integer;
sumAmount:real;
begin
inherited;
sumAmount:=0;
//汇总金额
If Not AdoQry_Main.IsEmpty then
begin
AdoQry_Main.First;
for I:=0 to AdoQry_Main.RecordCount-1 do
begin
SumAmount:=SumAmount+AdoQry_Main.fieldbyname('Amount').asFloat;
AdoQry_Main.next;
end;
AdoQry_Main.First;
end;
edit1.text:=FormatFloat('#.##',SumAmount);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -