📄 inv_mnoutbilllistqry.pas
字号:
unit Inv_MnOutBillListQry;
//程序员:邓海文
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls, Buttons, jpeg;
Type
TFrm_Inv_MnOutBillListQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
AdOConnection_tmp: TAdOConnection;
Label2: TLabel;
Edit1: TEdit;
procedure Act_LookExecute(Sender: TObject);
procedure DBGridEhDblClick(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure AdoQueryAfterOpen(DataSet: TDataSet);
private
{ Private declarations }
FShowExtendColum:Boolean;
procedure SendDataToForm;
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
end;
var
Frm_Inv_MnOutBillListQry: TFrm_Inv_MnOutBillListQry;
implementation
uses Inv_MnOutBillListQry_C,Inv_MnOutBillQry, Sys_Global,Inv_BillListPrint_C,Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_MnOutBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
//这两个参数是回传到基类后控制价格及金额的显示格式
AmountFields:='InvBillnotaxAmount,';
PriceFields:='InvBillnotaxPrice,';
FShowExtendColum:=ShowExtendColumn;
if(not ShowExtendColumn)then
begin
DBGridEh.Columns.Delete(14);
DBGridEh.Columns.Delete(13);
Label2.Visible:=False;
edit1.Visible:=False;
end;
SelectFromSQL:='Select InvOutBill.InvBillDate,'+
'InvOutBill.InvBillNo,'+
'InvOutBill.DeptCode+'' ''+Dept.DeptName As DeptCodeName,'+
'InvOutBill.shiftType,'+
'case '+
' when InvOutBill.OverPlan=1 then ''是'''+
' when InvOutBill.OverPlan=0 then '' '''+
' else '' '' '+
' end OverPlan, '+
'InvOutBill.MONo,'+
'InvOutBillLine.MoLineNo,'+
'Warehouse.WHCode,'+
'Warehouse.WHCode+'' ''+Warehouse.WHName As WHName ,'+
'WhPosition.WhPositionCode+'' ''+WhPosition.WhPositionName as WhPositionName, '+
'InvOutBillLine.ItemCode,'+
'Item.ItemName,'+
'Item.ItemCode2,'+
'InvOutBillLine.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName,'+
'Uom.UomName,'+
'InvOutBillLine.InvBillSfcQty,'+
'InvOutBillLine.InvBillQty,'+
'InvOutBillLine.InvBillNoTaxPrice,'+
'InvOutBillLine.InvBillNoTaxAmount,'+
'InvOutBillLine.BilllineremArk,'+
'InvOutBill.wh_EmployeeCode+'' ''+wh.EmployeeName As wh_EmployeeCodeName,'+
'InvOutBill.Sfc_EmployeeCode+'' ''+Sfc.EmployeeName As Sfc_EmployeeCodeName,'+
'InvOutBillLine.BatchNo '+
'From InvOutBill '+
'Left Outer Join Warehouse On InvOutBill.WHCode=Warehouse.WHCode '+
'Left Outer Join WhPosition On InvOutBill.WHCode=WhPosition.whCode and InvOutBill.WhPositionCode=WhPosition.WhPositionCode '+
'Left Outer Join Dept On InvOutBill.DeptCode=Dept.DeptCode '+
'Left outer Join Employee wh On InvOutBill.wh_EmployeeCode=wh.EmployeeCode '+
'Left Outer Join Employee Sfc On InvOutBill.Sfc_EmployeeCode=Sfc.EmployeeCode '+
'left Outer join InvOutBillline on InvOutBill.InvBillid=InvOutBillline.InvBillid '+
'Left Outer Join Item On InvOutBillLine.ItemCode=Item.ItemCode '+
'Left Outer Join Uom On Item.UomCode=Uom.UomCode';
ConditionUserDefine:='(InvOutBillLine.InvBillId=InvOutBill.InvBillId)and(InvOutBill.BillTypeCode='''+Param1+''') and InvOutBill.InvBillWHChck=1 ';
OrderByFields:='InvBillDate,InvBillNo';
Frm_Sys_Condition:=TFrm_Inv_MnOutBillListQry_C.Create(Self);
TFrm_Inv_MnOutBillListQry_C(Frm_Sys_Condition).InitForm(DBConnect,UserCode);
Act_Filter.Execute;
end;
procedure TFrm_Inv_MnOutBillListQry.Act_LookExecute(Sender: TObject);
begin
inherited;
SendDataToForm;
end;
procedure TFrm_Inv_MnOutBillListQry.DBGridEhDblClick(Sender: TObject);
begin
inherited;
SendDataToForm;
end;
procedure TFrm_Inv_MnOutBillListQry.SendDataToForm;
var
InvBillNo,WHCode:string;
InvBillTypeCode:string;
begin
//inherited;
if AdoQry_Main.RecordCount<1 then
DispInfo('没有可用的单据! ',3)
else
begin
//创建窗体
Application.CreateForm(TFrm_Inv_MnOutBillQry,Frm_Inv_MnOutBillQry);
//传递变量
InvBillno:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING; //单据号
WHCode:=AdoQry_Main.fieldbyname('WHCode').ASSTRING; //仓库代码
InvBillTypeCode:=Param1;
Frm_Inv_MnOutBillQry.Getvar(InvBillno,WHCode,InvBillTypeCode);
//显示信息
Frm_Inv_MnOutBillQry.InitForm(AdoQry_Main.Connection,FShowExtendColum);
end;
end;
procedure TFrm_Inv_MnOutBillListQry.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_MnOutBillListQry.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('InvBillnotaxAmount').asFloat;
AdoQry_Main.next;
end;
AdoQry_Main.First;
edit1.text:=FormatFloat('#.##',SumAmount);
edit1.Enabled:=False;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -