📄 inv_opdiffbillqry.pas
字号:
unit Inv_OpDiffBillQry;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Body, Mask, StdCtrls, ExtPrintReport, Db, ActnList, AdODB,
Grids, DBGridEh, ExtCtrls, ComCtrls, ToolWin, jpeg;
Type
TFrm_Inv_OpDiffBillQry = Class(TFrm_Base_Entry_Body)
Label3: TLabel;
Lbl_PoNo: TLabel;
Label7: TLabel;
Label8: TLabel;
Label4: TLabel;
Lbl_VendorCodeName: TLabel;
Label1: TLabel;
Label2: TLabel;
Lbl_BillNo: TLabel;
Lbl_Date: TLabel;
Lbl_Warehouse: TLabel;
Lbl_Employee: TLabel;
Label5: TLabel;
Lbl_ParentBillNo: TLabel;
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
private
{ Private declarations }
InvBillNo,WHCode: String;
public
{ Public declarations }
procedure Getvar(InvBillNo,WHCode:String);
procedure InitReport; Override;
procedure InitControls; Override;
end;
var
Frm_Inv_OpDiffBillQry: TFrm_Inv_OpDiffBillQry;
implementation
uses Inv_Global,Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_OpDiffBillQry.Getvar(InvBillNo, WHCode: String);
begin
self.InvBillNo:=InvBillNo;
self.WHCode:=WHCode;
end;
procedure TFrm_Inv_OpDiffBillQry.InitControls;
var
Billidstr,ParentBillno:string;
ParentBillid:integer;
begin
inherited;
ParentBillno:='';
Billidstr:='';
ParentBillid:=0;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Select isnull(ParentBillid,0) as ParentBillid From InvInBill'
+' Where InvBillno='''+InvBillNo+''''
+' and whCode='''+WHCode+'''';
AdoQry_Tmp.Open;
ParentBillid:=AdoQry_Tmp.fieldbyname('ParentBillid').Value;
if ParentBillid<>0 then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Select InvBillno From InvInBill'
+' Where InvBillid='+inttostr(ParentBillid);
AdoQry_Tmp.Open;
ParentBillno:=AdoQry_Tmp.fieldbyname('InvBillno').Value;
end;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='Select InvInBill.InvBillDate'
+',InvInBill.InvBillId'
+',InvInBill.InvBillNo'
+',Vendor.VendorCode+'' ''+Vendor.VendorName As VendorName'
+',InvInBill.PoNo'
+',InvInBill.BillTypeCode'
+',InvInBill.WHCode+'' ''+Warehouse.WHName As WHName'
+',InvInBill.EmployeeCode+'' ''+Employee.EmployeeName As EmployeeCodeName'
+' From InvInBill'
+' Join Vendor On InvInBill.VendorCode=Vendor.VendorCode'
+' Join Warehouse On InvInBill.WHCode=Warehouse.WHCode'
+' left Join Employee On InvInBill.EmployeeCode=Employee.EmployeeCode'
//+' Where InvInBill.InvBillno='+quotedstr(AdoQry_Head.fieldbyname('InvBillno').AsString)
//+' and InvInBill.whCode='+quotedstr(AdoQry_Head.fieldbyname('whCode').asstring) ;
+' Where InvInBill.InvBillno='''+InvBillNo+''''
+' and InvInBill.whCode='''+WHCode+'''';
AdoQry_Tmp.Open;
Billidstr:=AdoQry_Tmp.fieldbyname('InvBillId').AsString;
Lbl_Warehouse.Caption:=AdoQry_Tmp.fieldbyname('WHName').AsString;
Lbl_PoNo.Caption:=AdoQry_Tmp.fieldbyname('PoNo').AsString;
Lbl_BillNo.Caption:=AdoQry_Tmp.fieldbyname('InvBillNo').AsString;
Lbl_VendorCodeName.Caption:=AdoQry_Tmp.fieldbyname('VendorName').AsString;
Lbl_Employee.Caption:=AdoQry_Tmp.fieldbyname('EmployeeCodeName').AsString;
Lbl_Date.Caption:=AdoQry_Tmp.fieldbyname('InvBillDate').AsString;
lbl_ParentBillno.Caption:=ParentBillno;
AdoQry_Body.Close;
AdoQry_Body.SQL.Text:='Select InvInBillLine.PoLineNo'
+',InvInBillLine.ItemCode+'' ''+Item.ItemName As ItemCodeName'
+',Uom.UomName'
+',InvInBillLine.InvBillNoTaxAmount'
+' From InvInBillLine'
+' Join Item On InvInBillLine.ItemCode=Item.ItemCode'
+' Join Uom On Item.UomCode=Uom.UomCode'
+' Where InvInBillLine.InvBillId='+Billidstr;
AdoQry_Body.Open;
end;
procedure TFrm_Inv_OpDiffBillQry.InitReport;
var
s1,s2,s3,s4:String;
i:Integer;
begin
for i:=Length(Lbl_Warehouse.Caption) to 35 do
s1:=s1+' ';
for i:=Length(Lbl_PoNo.Caption) to 12 do
s2:=s2+' ';
for i:=Length(Lbl_VendorCodeName.Caption) to 35 do
s3:=s3+' ';
for i:=Length(Lbl_Employee.Caption) to 12 do
s4:=s4+' ';
inherited;
ExtPrintReport.Subtitle2:=' 仓库:'+Lbl_Warehouse.Caption
+s1+'采购订单号:'+Lbl_PoNo.Caption
+s2+'单据号:'+Lbl_BillNo.Caption;
ExtPrintReport.Subtitle3:='供应商:'+Lbl_VendorCodeName.Caption
+s3+' 操作员:'+Lbl_Employee.Caption
+s4+' 日期:'+Lbl_Date.Caption;
end;
procedure TFrm_Inv_OpDiffBillQry.Act_PreviewExecute(Sender: TObject);
begin
// inherited;
BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_Warehouse.Caption),Lbl_BillNo.Caption,AdoQry_tmp.fieldbyname('BillTypeCode').asstring,ModuleCode,True,False,True,'');
end;
procedure TFrm_Inv_OpDiffBillQry.Act_PrintExecute(Sender: TObject);
begin
// inherited;
BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_Warehouse.Caption),Lbl_BillNo.Caption,AdoQry_tmp.fieldbyname('BillTypeCode').asstring,ModuleCode,False,False,True,'');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -