📄 inv_batchlist.pas
字号:
unit Inv_BatchList;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls, Base_Qry;
Type
TFrm_Inv_BatchList = Class(TFrm_Base_Qry)
AdoQry_tmp1: TAdoQuery;
Label1: TLabel;
DBText1: TDBText;
AdoQry_MainInvBilldate: TDateTimeField;
AdoQry_MaInvendorCode: TStringField;
AdoQry_MainItemCode: TStringField;
AdoQry_MainInvBillqty: TFloatField;
AdoQry_MainInvOBillqty: TFloatField;
AdoQry_MainBatchName: TStringField;
AdoQry_MainBatchno: TStringField;
Label2: TLabel;
DBText2: TDBText;
procedure Act_FilterExecute(Sender: TObject);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
acondition:string;
aVendorCode:string;
procedure initform(AdOConnection:TAdOConnection;ReadOnly:boolean);Override;
{ Public declarations }
end;
var
Frm_Inv_BatchList: TFrm_Inv_BatchList;
implementation
uses Inv_BatchList_C,Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_BatchList.initform(AdOConnection:TAdOConnection;ReadOnly:boolean);
begin
inherited;
acondition:='';
// PriceFields:='InvLMAmount,InvInAmount,InvOutAmount,InvBlncAmount,InvBillNoTaxAmount';
SelectFromSQL:='';
with AdoQry_tmp do
begin
Close;
sql.Text :='drop table #Billtmp2';
try
execsql;
except
end;
end;
with AdoQry_tmp do
begin
Close;
sql.Text :='create table #Billtmp2 (InvBilldate smalldatetime null,'+
' Batchno varchAr(16) null,'+
' ItemCode varchAr(16) null,'+
' VendorCode varchAr(12) null,'+
' InvBillqty float null,'+
' InvOBillqty float null '+
')';
try
execsql;
except
end;
end;
OrderByFields:='ItemCode';
lbl_Order.Caption:='';
Frm_Sys_Condition:=TFrm_Inv_BatchList_C.Create(Self);
TFrm_Inv_BatchList_C(Frm_Sys_Condition).InitForm(AdoQry_Main.Connection,UserCode,LoginDate);
// getdata;
Act_Filter.Execute;
// lbl_Month.Caption:=TFrm_Inv_OpVendorSum_C(Frm_Sys_Condition).medt_Month.text;
end;
procedure TFrm_Inv_BatchList.Act_FilterExecute(Sender: TObject);
var
date1,date2:string;
begin
if Frm_Sys_Condition.ShowModal=mrOk then
begin
date1:=TFrm_Inv_BatchList_C(Frm_Sys_Condition).medt_Date1.Text ;
date2:=TFrm_Inv_BatchList_C(Frm_Sys_Condition).medt_Date2.Text ;
lbl_Order.Caption :=date1+' - '+date2;
AdoQry_tmp.Close ;
AdoQry_tmp.SQL.Text :='delete from #Billtmp2';
AdoQry_tmp.ExecSQL ;
AdoQry_Main.DisableControls;
AdoQry_Main.Close;
AdoQry_Main.SQL.clear;
SelectFromSQL:='insert #Billtmp2 (InvBilldate,VendorCode,Batchno,InvBillqty,ItemCode)'+
' select InvInBill.InvBilldate,InvInBill.VendorCode,'+
'InvInBillline.Batchno,InvInBillline.InvBillqty,InvInBillline.ItemCode'+
' from InvInBill join InvInBillline'+
' on InvInBill.InvBillid=InvInBillline.InvBillid '+
' where (InvInBillline.Batchno is not null and '+
' InvInBillline.Batchno<>'''+''+''') and InvInBill.InvBillWHCHCK<>0'+
' and InvInBill.InvBilldate>='''+date1+''' and InvInBill.InvBilldate<='''+date2+
'''';
AdoQry_Main.SQL.Text:=SelectFromSQL;
AdoQry_Main.ExecSQL ;
selectfromsql:='insert #Billtmp2 (InvBilldate,VendorCode,Batchno,InvOBillqty,ItemCode) '+
' select InvOutBill.InvBilldate,InvOutBill.VendorCode,'+
' InvOutBillline.Batchno,InvOutBillline.InvBillqty,InvOutBillline.ItemCode'+
' from InvOutBill join InvOutBillline'+
' on InvOutBill.InvBillid=InvOutBillline.InvBillid'+
' where (InvOutBillline.Batchno is not null and'+
' InvOutBillline.Batchno<>'''+''+''') and InvOutBill.InvBillWHCHCK<>0'+
' and InvOutBill.InvBilldate>='''+date1+''' and InvOutBill.InvBilldate<='''+date2+'''';
AdoQry_Main.SQL.Text:=SelectFromSQL;
AdoQry_Main.ExecSQL ;
AdoQry_Main.Close;
AdoQry_Main.SQL.Text:='select a.InvBilldate,a.VendorCode+'''+' '+'''+d.VendorName VendorCode,'+
'a.ItemCode+'''+' '+'''+c.ItemName ItemCode,a.InvBillqty,'+
'a.InvOBillqty,b.BatchName,a.Batchno'+
' from #Billtmp2 a '+
' left join Batchline b on a.Batchno=b.Batchno'+
' left join Item c on a.ItemCode=c.ItemCode'+
' left join Vendor d on a.VendorCode=d.VendorCode Order by a.InvBilldate';
AdoQry_Main.Open;
AdoQry_Main.Sort:=OrderByFields;
AdoQry_Main.EnableControls;
end;
end;
procedure TFrm_Inv_BatchList.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
{if (TDBGridEh(Sender).DataSource.DataSet.fieldbyname('Orderfield').asstring='1') and
(column.FieldName='ItemCode1') then
afont.Color :=clred; }
end;
procedure TFrm_Inv_BatchList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
with AdoQry_tmp do
begin
Close;
sql.Text :='drop table #Billtmp2';
try
execsql;
except
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -