📄 inv_otheroutbillqry.pas
字号:
unit Inv_OtherOutBillQry;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls, Mask, ExtEdit, jpeg;
Type
TFrm_Inv_OtherOutBillQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
Panel1: TPanel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Lbl_OutName: TLabel;
Edt_Memo: TEdit;
Edt_BillNo: TEdit;
Medt_Date: TMaskEdit;
Edt_OutCode: TExtEdit;
Edt_WhCodeName: TExtEdit;
Edt_OutType: TExtEdit;
edt_WhPosition: TExtEdit;
Edt_BillType2CodeName: TExtEdit;
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
InvBillNo,WHCode:string;
InvBillTypeCode:string;
RecTypeCode:string;
ModuleCode:string;
{ Private declarations }
public
{ Public declarations }
procedure Getvar(RInvBillNo,RWHCode,RInvBillTypeCode:string);
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override ;
end;
var
Frm_Inv_OtherOutBillQry: TFrm_Inv_OtherOutBillQry;
implementation
uses Sys_Global,Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_OtherOutBillQry.Getvar(RInvBillNo,RWHCode,
RInvBillTypeCode: string);
begin
InvBillNo:=''''+RInvBillNo+'''';
WHCode:=''''+RWHCode+'''';
InvBillTypeCode:=''''+RInvBillTypeCode+'''';
RecTypeCode:=RInvBillTypeCode;
end;
procedure TFrm_Inv_OtherOutBillQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
ModuleCode:='Stk';
AmountFields:='InvBillnotaxAmount,';
PriceFields:='InvBillnotaxPrice,';
if (not ShowExtendColumn) then
begin
ModuleCode:='Inv';
DBGridEh.Columns.Delete(4);
DBGridEh.Columns.Delete(3);
end;
SelectFromSQL:='select '+
'InvOutBill.InvBilldate,'+
'InvOutBill.InvBillno,'+
'BillType2.BillType2Code+'+''' '''+'+BillType2.BillType2Name as BillType2CodeName, '+
//入库对象
'OutType='+
'case'+
' when InvOutBill.DeptCode is not null then ''部门'' '+
' when InvOutBill.customerCode is not null then ''客户'' '+
'else '+
' '''' '+
' end,'+
//入库对象代码
'OutCode='+
'case'+
' when InvOutBill.DeptCode is not null then InvOutBill.DeptCode '+
' when InvOutBill.customerCode is not null then InvOutBill.customerCode '+
'else '+
' '''' '+
'end,'+
//入库对象描述
'OutName='+
'case'+
' when InvOutBill.DeptCode is not null then Dept.DeptName '+
' when InvOutBill.customerCode is not null then customer.customerName '+
'else '+
' '''' '+
'end, '+
'InvOutBillline.ItemCode,'+
'Item.ItemName,'+
'InvOutBillline.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName,'+
' Warehouse.WhCode+'' ''+Warehouse.WhName as whCodeName ,'+
'WhPosition.WhPositionCode,WhPosition.WhPositionName, '+
'Uom.UomName,'+
'InvOutBillline.InvBillqty,'+
'InvBillNoTaxPrice='+
'case '+
' When (InvOutBillline.InvBillqty<>0) and Warehouse.PriceType=1 then StandardPrice.SPPrice'+
' else InvOutBillLine.InvBillNoTaxPrice '+
'end,'+
'InvBillNoTaxAmount='+
'case '+
'When (InvOutBillline.InvBillqty<>0) and (Warehouse.PriceType=1) then '+
' StandardPrice.SPPrice*InvOutBillLine.InvBillQty'+
' else InvOutBillLine.InvBillNoTaxAmount '+
'end, '+
'Employee.EmployeeCode+'+''' '''+'+Employee.EmployeeName as EmployeeCodeName,'+
'InvOutBillline.BilllineremArk,Batchno,InvOutBill.InvBillremArk '+
'from InvOutBillline '+
'join InvOutBill on InvOutBillLine.InvBillId=InvOutBill.InvBillId '+
' And (InvOutBill.InvBillNo='+InvBillno+')' +
' And (InvOutBill.BillTypeCode='+InvBillTypeCode+') '+
' And (InvOutBill.whCode='+whCode+')'+
'Left join Item On InvOutBillLine.ItemCode=Item.ItemCode '+
'Left join Uom On Item.UomCode=Uom.UomCode '+
'left join StandardPrice on InvOutBill.InvBillMonth=StandardPrice.spstArtMonth and '+
' InvOutBillline.ItemCode=StandardPrice.ItemCode '+
'Left Outer Join Dept On InvOutBill.DeptCode=Dept.DeptCode '+
'left Join Warehouse On InvOutBill.WHCode=Warehouse.WHCode '+
'left outer join WhPosition on InvOutBill.WhPositionCode=WhPosition.WhPositionCode and InvOutBill.whCode=WhPosition.whCode '+
'Left Outer Join Employee On InvOutBill.wh_EmployeeCode=Employee.EmployeeCode '+
'Left Outer Join customer On InvOutBill.customerCode=customer.customerCode '+
'Left Outer Join BillType2 On InvOutBill.BillType2Code=BillType2.BillType2Code ';
Orderbyfields:='';
getdata;
edt_WhCodeName.text:=AdoQry_Main.fieldbyname('whCodeName').ASSTRING;//仓库
edt_WhPosition.text:=AdoQry_Main.fieldbyname('WhPositionCode').asstring+' '+AdoQry_Main.fieldbyname('WhPositionName').asstring; //货位
edt_BillType2CodeName.text:=AdoQry_Main.fieldbyname('BillType2CodeName').asstring; //出库类型
edt_Billno.text:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;//单据号
edt_OutType.text:=AdoQry_Main.fieldbyname('OutType').ASSTRING; //出库对象
edt_OutCode.text:=AdoQry_Main.fieldbyname('OutCode').ASSTRING; //输入代码
lbl_OutName.Caption:=AdoQry_Main.fieldbyname('OutName').ASSTRING; //名称
medt_Date.text:=AdoQry_Main.fieldbyname('InvBilldate').asstring; //日期
edt_memo.text:=AdoQry_Main.fieldbyname('InvBillRemArk').ASSTRING; //备注
end;
procedure TFrm_Inv_OtherOutBillQry.Act_PreviewExecute(Sender: TObject);
begin
// inherited;
BillPrint(AdoQry_Tmp.Connection,GetCode(Edt_WhCodeName.Text),Edt_BillNo.text,RecTypeCode,ModuleCode,True,False,True,'');
end;
procedure TFrm_Inv_OtherOutBillQry.Act_PrintExecute(Sender: TObject);
begin
//inherited;
BillPrint(AdoQry_Tmp.Connection,GetCode(Edt_WhCodeName.Text),Edt_BillNo.text,RecTypeCode,ModuleCode,False,False,True,'');
end;
procedure TFrm_Inv_OtherOutBillQry.FormActivate(Sender: TObject);
begin
inherited;
ToolButton4.left:=ToolButton13.left+ToolButton4.Width;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -