📄 inv_otherinbilllistqry.pas
字号:
unit Inv_OtherInBillListQry;
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_Inv_OtherInBillListQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
Label9: TLabel;
procedure Act_LookExecute(Sender: TObject);
procedure DBGridEhDblClick(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure AdoQueryAfterOpen(DataSet: TDataSet);
private
BillTypeCode:string;
FShowExtendColumn:Boolean;
procedure SendDataToForm;
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
{ Public declarations }
end;
var
Frm_Inv_OtherInBillListQry: TFrm_Inv_OtherInBillListQry;
implementation
uses Inv_OtherInBillListQty_C,Sys_Global, Inv_OtherInBillQry,Inv_BillListPrint_C,Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_OtherInBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
//这两个参数是回传到基类后控制价格及金额的显示格式
AmountFields:='InvBillnotaxAmount,InvBillAmount,InvBillAmount,';
PriceFields:='InvBillnotaxPrice,InvBillPrice,';
BillTypeCode:=Param1;
//Stk模块显示单价,金额两列
FShowExtendColumn:=True;
if ModuleCode='Inv' then
begin
DBGridEh.Columns.Delete(11);
DBGridEh.Columns.Delete(10);
FShowExtendColumn:=False;
end;
SelectFromSQL:='select '+
'InvInBill.InvBilldate,'+
'InvInBill.InvBillno,'+
'InvInBill.whCode+'' ''+Warehouse.whName as whName,'+
'InvInBill.WhPositionCode+'' ''+WhPosition.WhPositionName as WhPositionName,'+
'InvInBill.currencyCode+'+''' '''+'+currency.currencyName as currencyName,'+
'InvInBillLine.BilllineremArk,'+
'BillType2.BillType2Code+'+''' '''+'+BillType2.BillType2Name as BillType2CodeName, '+
//入库对象
'OutType='+
'case'+
' when InvInBill.DeptCode is not null then ''部门'' '+
' when InvInBill.VendorCode is not null then ''供应商'' '+
'else '+
' '''' '+
' end,'+
//入库对象标识
'OutName='+
'case'+
' when InvInBill.DeptCode is not null then InvInBill.DeptCode+'+''' '''+'+Dept.DeptName '+
' when InvInBill.VendorCode is not null then InvInBill.VendorCode+'+''' '''+'+Vendor.VendorName '+
'else '+
' '''' '+
'end, '+
'InvInBillline.ItemCode,'+
'InvInBillline.ItemCode+'+''' '''+'+Item.ItemName as ItemName,'+
'Uom.UomName,'+
'InvInBillline.InvBillqty,'+
'InvBillnotaxPrice='+
'case '+
' when InvInBill.currencyCode=''00'' then InvInBillline.InvBillNoTaxPrice '+
' else InvInBillline.InvBillNoTaxPricec end, '+
'InvBillnotaxAmount='+
' case '+
' when InvInBill.currencyCode=''00'' then InvInBillline.InvBillNoTaxAmount '+
' else InvInBillline.InvBillNoTaxAmountc end, '+
'InvBillAmount='+
' case '+
' when InvInBill.currencyCode=''00'' then InvInBillline.InvBillAmount '+
' else InvInBillline.InvBillAmountc end, '+
'Employee.EmployeeCode+'+''' '''+'+Employee.EmployeeName as EmployeeCodeName,'+
'InvInBillline.Batchno ,Warehouse.WHCode '+
'from InvInBill '+
'left join InvInBillline on InvInBill.InvBillId=InvInBillLine.InvBillId '+
'Left join Item On InvInBillLine.ItemCode=Item.ItemCode '+
'Left join Uom On Item.UomCode=Uom.UomCode '+
'Left Outer Join Dept On InvInBill.DeptCode=Dept.DeptCode '+
'Left join currency on InvInBill.currencyCode=currency.currencyCode '+
'left Join Warehouse On InvInBill.WHCode=Warehouse.WHCode '+
'left join WhPosition on InvInBill.whCode=WhPosition.whCode and InvInBill.WhPositionCode=WhPosition.WhPositionCode '+
'Left Outer Join Employee On InvInBill.Stk_EmployeeCode=Employee.EmployeeCode '+
'Left Outer Join Vendor On InvInBill.VendorCode=Vendor.VendorCode '+
'Left Join BillType2 On InvInBill.BillType2Code=BillType2.BillType2Code ';
conditionuserDefine:=' InvInBill.BillTypeCode='''+BillTypeCode+'''';
OrderByFields:='InvBillDate,InvBillNo,WHCode';
Frm_Sys_Condition:=TFrm_Inv_OtherInBillListQty_C.Create(Self);
TFrm_Inv_OtherInBillListQty_C(Frm_Sys_Condition).InitForm(DBConnect,UserCode);
Act_Filter.Execute;
end;
procedure TFrm_Inv_OtherInBillListQry.Act_LookExecute(Sender: TObject);
begin
inherited;
SendDataToForm;
end;
procedure TFrm_Inv_OtherInBillListQry.SendDataToForm;
var
InvBillNo:string;
WHCode:string;
InvBillTypeCode:string;
InvBilldate:string;
begin
if AdoQry_Main.recordCount<1 then
DispInfo('没有可用的单据! ',3)
else
begin
//创建窗体
Application.CreateForm(TFrm_Inv_OtherInBillQry,Frm_Inv_OtherInBillQry);
//传递变量
InvBillno:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;
WHCode:=AdoQry_Main.fieldbyname('WHCode').ASSTRING;
InvBilldate:=AdoQry_Main.fieldbyname('InvBilldate').ASSTRING;
InvBillTypeCode:=Param1;
Frm_Inv_OtherInBillQry.Getvar(InvBillno,WHCode,InvBillTypeCode,InvBilldate);
//显示信息
Frm_Inv_OtherInBillQry.InitForm(AdoQry_Main.Connection,FShowExtendColumn);
end;
end;
procedure TFrm_Inv_OtherInBillListQry.DBGridEhDblClick(Sender: TObject);
begin
inherited;
SendDataToForm;
end;
procedure TFrm_Inv_OtherInBillListQry.Act_PrintExecute(Sender: TObject);
var
WHCode_InvBillNo:String;
begin
with TFrm_Inv_BillListPrint_C.Create(Self) do //新建的Form
begin
if ShowModal=mrOk then
begin
if RdBtn_PrintList.Checked then //打印列表时,用基类提供的打印功能
inherited
else //否则打印当前列表中的所有单据
begin
AdoQry_Main.First;
while not AdoQry_Main.Eof do
begin
if WHCode_InvBillNo<>AdoQry_Main.fieldbyname('WHCode').AsString
+AdoQry_Main.fieldbyname('InvBillNo').AsString then //列表中列出的不是单据头,而是单据行
begin
WHCode_InvBillNo:=AdoQry_Main.fieldbyname('WHCode').AsString
+AdoQry_Main.fieldbyname('InvBillNo').AsString;
BillPrint(DBConnect,AdoQry_Main.fieldbyname('WHCode').AsString
,AdoQry_Main.fieldbyname('InvBillNo').AsString
,Param1,ModuleCode,False,False,True,'');
//注意Param1是当前查询的单据类型,我们不要用参数,直接书写单据类型代码,例如“其它出库单据列表查询”,就是 0299
end;
AdoQry_Main.Next;
end;
end;
end;
Release;
end;
end;
procedure TFrm_Inv_OtherInBillListQry.AdoQueryAfterOpen(DataSet: TDataSet);
var
d1,d2:Double;
begin
inherited;
if (FShowExtendColumn) then
begin
d1:=0;
d2:=0;
AdoQry_Main.First;
while not AdoQry_Main.Eof do
begin
d1:=d1+AdoQry_Main.fieldbyname('InvBillNoTaxAmount').AsFloat;
d2:=d2+AdoQry_Main.fieldbyname('InvBillAmount').AsFloat;
AdoQry_Main.Next;
end;
Label9.Caption:='未税金额:'+FloatToStr(d1)+' 含税金额:'+FormatFloat('#0.00',d2);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -