📄 inv_batchjournal.pas
字号:
unit Inv_BatchJournal;
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_BatchJournal = Class(TFrm_Base_Qry)
AdoQry_tmp1: TAdoQuery;
Label1: TLabel;
DBText1: TDBText;
AdoQry_MainItemCode: TStringField;
AdoQry_MainBatchno: TStringField;
AdoQry_MainBatchName: TStringField;
AdoQry_MainUomName: TStringField;
AdoQry_MainBatchstatus: TIntegerField;
AdoQry_MaInvendorCode: TStringField;
AdoQry_MaInvendorBatchno: TStringField;
AdoQry_MainFirstindate: TDateTimeField;
AdoQry_MainCurrentindate: TDateTimeField;
AdoQry_MainFirstoutdate: TDateTimeField;
AdoQry_MainCurrentoutdate: TDateTimeField;
AdoQry_MainInvQty: TFloatField;
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
procedure Act_FilterExecute(Sender: TObject);
procedure Act_LookExecute(Sender: TObject);
private
{ Private declarations }
public
acondition:string;
aVendorCode:string;
procedure initform(AdOConnection:TAdOConnection;ReadOnly:boolean);Override;
{ Public declarations }
end;
var
Frm_Inv_BatchJournal: TFrm_Inv_BatchJournal;
implementation
uses Inv_BatchJournal_Detail,Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_BatchJournal.initform(AdOConnection:TAdOConnection;ReadOnly:boolean);
var
dateC:string;
begin
inherited;
dateC:=copy(datetostr(incMonth(now,-1)),1,7)+'.01';
acondition:='';
act_look.Enabled :=True;
tlbtn_look.Enabled :=True;
// PriceFields:='InvLMAmount,InvInAmount,InvOutAmount,InvBlncAmount,InvBillNoTaxAmount';
SelectFromSQL:='select Batch.ItemCode+'''+' '+'''+Uom.ItemName ItemCode,Batchline.Batchno'+
',Batchline.BatchName,Uom.UomName,'+
'Batchline.Batchstatus,'+
'Batchline.VendorCode+'''+' '+'''+Vendor.VendorName VendorCode,'+
'Batchline.VendorBatchno,Batchline.BatchlineremArk,'+
'Batchline.Firstindate,Currentindate,Firstoutdate,'+
'Currentoutdate,BatchCurrentInv.InvQty '+
'from Batch join Batchline on Batch.Batchid=Batchline.Batchid '+
'left join (select Batchno,sum(InvQty) InvQty from BatchCurrentInv group by Batchno) BatchCurrentInv'+
' on BatchCurrentInv.Batchno=Batchline.Batchno '+
'join Vendor on Batchline.VendorCode=Vendor.VendorCode '+
'join (select Item.*,Uom.UomName from Item join Uom on '+
'Item.UomCode=Uom.UomCode) Uom on Uom.ItemCode=Batch.ItemCode '+
' where Batchline.Firstindate>='''+dateC+'''';
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_BatchJournal.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_BatchJournal.Act_FilterExecute(Sender: TObject);
var
i:integer;
begin
for i:=0 to dbgrideh.Columns.Count-1 do
begin
if dbgrideh.Columns[i].FieldName='UomName' then
dbgrideh.Columns[i].Field.Origin:='Uom'
else if dbgrideh.Columns[i].FieldName='ItemCode' then
dbgrideh.Columns[i].Field.Origin:='Batch'
else if dbgrideh.Columns[i].FieldName='InvQty' then
dbgrideh.Columns[i].Field.Origin:='BatchCurrentInv'
else
dbgrideh.Columns[i].Field.Origin:='Batchline'
end;
SelectFromSQL:='select Batch.ItemCode+'''+' '+'''+Uom.ItemName ItemCode,Batchline.Batchno'+
',Batchline.BatchName,Uom.UomName,'+
'Batchline.Batchstatus,'+
'Batchline.VendorCode+'''+' '+'''+Vendor.VendorName VendorCode,'+
'Batchline.VendorBatchno,Batchline.BatchlineremArk,'+
'Batchline.Firstindate,Currentindate,Firstoutdate,'+
'Currentoutdate,BatchCurrentInv.InvQty '+
'from Batch join Batchline on Batch.Batchid=Batchline.Batchid '+
'left join (select Batchno,sum(InvQty) InvQty from BatchCurrentInv group by Batchno) BatchCurrentInv'+
' on BatchCurrentInv.Batchno=Batchline.Batchno '+
'join Vendor on Batchline.VendorCode=Vendor.VendorCode '+
'join (select Item.*,Uom.UomName from Item join Uom on '+
'Item.UomCode=Uom.UomCode) Uom on Uom.ItemCode=Batch.ItemCode ';
inherited;
end;
procedure TFrm_Inv_BatchJournal.Act_LookExecute(Sender: TObject);
begin
inherited;
// if Frm_Inv_BatchJournal_Detail=nil then
Application.CreateForm(TFrm_Inv_BatchJournal_Detail,Frm_Inv_BatchJournal_Detail);
Frm_Inv_BatchJournal_Detail.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
Frm_Inv_BatchJournal_Detail.SetUserParam('0203','','','','','');
Frm_Inv_BatchJournal_Detail.InitForm(AdoQry_Main.Connection,False);
Frm_Inv_BatchJournal_Detail.ShowModal ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -