📄 inv_purchaseinbillqry.pas
字号:
unit Inv_PurchaseInBillQry;
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;
Type
TFrm_Inv_PurchaseInBillQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
Panel1: TPanel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label7: TLabel;
Label8: TLabel;
lbl_VendorCodeName: TLabel;
Label5: TLabel;
Label6: TLabel;
Edt_BillNo: TEdit;
MEdt_Date: TMaskEdit;
Edt_RemArk: TEdit;
lable9: TLabel;
Lbl_InvBillrate: TLabel;
Lbl_WhPosition: TLabel;
Lbl_Pono: TLabel;
Label12: TLabel;
Chb_InvBillValuation: TCheckBox;
Lbl_WhName: TLabel;
procedure Act_PreviewExecute(Sender: TObject);
procedure Act_PrintExecute(Sender: TObject);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
private
ModuleCode:string;
InvBillNo,WHCode:string;
InvBillTypeCode,RecTypeCode:string;
{ Private declarations }
public
{ Public declarations }
procedure Getvar(RInvBillNo,RWHCode,RInvBillTypeCode:string);
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override ;
end;
var
Frm_Inv_PurchaseInBillQry: TFrm_Inv_PurchaseInBillQry;
implementation
uses Sys_Global,Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_PurchaseInBillQry.Getvar(RInvBillNo,RWHCode,RInvBillTypeCode:string);
begin
InvBillNo:=''''+RInvBillNo+'''';
WHCode:=''''+RWHCode+'''';
InvBillTypeCode:=''''+RInvBillTypeCode+'''';
RecTypeCode:=RInvBillTypeCode;
end;
procedure TFrm_Inv_PurchaseInBillQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
//这两个参数是回传到基类后控制价格及金额的显示格式
AmountFields:='InvBillnotaxAmount,InvBillAmount,';
PriceFields:='InvBillnotaxPrice,InvBillPrice,';
ModuleCode:='Stk';
if(not ShowExtendColumn)then
begin
ModuleCode:='Inv';
DBGridEh.Columns.Delete(8);
DBGridEh.Columns.Delete(7);
DBGridEh.Columns.Delete(6);
DBGridEh.Columns.Delete(5);
DBGridEh.Columns.Delete(4);
end
else
begin
if RecTypeCode<>'0102' then
begin
DBGridEh.Columns.Delete(4);
end
else
begin
DBGridEh.Columns[7].Title.Caption:='外币价';
DBGridEh.Columns[8].Title.Caption:='外币金额';
end;
end;
SelectFromSQL:=' Select '
+' InvInBill.InvBillDate, '
+' InvInBill.InvBillNo, '
+' Vendor.VendorCode+'' ''+Vendor.VendorName as VendorName ,'
+' InvInBill.PONo,'
+' InvInBillLine.POLineNo,'
+' InvInBillLine.BilllineremArk,'
+' InvInBillLine.Batchno,'
+' InvInBillLine.ItemCode,'
+' InvInBillline.Valuation,'
+' InvInBillLine.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName,'
+' Item.ItemName, '
+' Uom.UomName,'
+' InvInBillLine.InvBillQty,'
+' Warehouse.whCode+'' ''+Warehouse.whName as whName, '
+' WhPosition.WhPositionCode,WhPosition.WhPositionName ,'
+' InvInBill.InvBillRemArk, '
+' InvInBill.InvBillTaxRate ,' //税率
+' InvInBill.InvBillValuation,'//是否暂估价
+' InvInBill.CurrencyCode+'' ''+Currency.CurrencyName As CurrencyCodeName, '
+' case when InvInBill.BillTypeCode=''0102'' then '
+' InvInBillLine.InvBillNoTaxPriceC '
+' else '
+' InvInBillLine.InvBillNoTaxPriceC end as InvBillNoTaxPrice, '
+' case when InvInBill.BillTypeCode=''0102'' then '
+' InvInBillLine.InvBillNoTaxAmountC '
+' else '
+' InvInBillLine.InvBillNoTaxAmount end as InvBillNoTaxAmount, '
+' InvInBillLine.InvBillPrice,InvInBillLine.InvBillAmount '
+' From InvInBillLine '
+' Left Outer Join Item On InvInBillLine.ItemCode=Item.ItemCode '
+' Left Outer Join Uom On Item.UomCode=Uom.UomCode, '
+' InvInBill '
+' Left Outer Join Dept On InvInBill.DeptCode=Dept.DeptCode '
+' Left Outer Join Vendor On InvInBill.VendorCode=Vendor.VendorCode '
+' left outer join Warehouse on InvInBill.whCode=Warehouse.whCode '
+' Left outer join WhPosition on InvInBill.WhPositionCode=WhPosition.WhPositionCode and InvInBill.whCode=WhPosition.whCode '
+' Left Outer Join Currency on Currency.CurrencyCode=InvInBill.CurrencyCode '
+' where '
+' InvInBillLine.InvBillId=InvInBill.InvBillId '
+' and InvInBill.InvBillNo='+InvBillNo
+' and Warehouse.WHCode='+WHCode
+' and InvInBill.BillTypeCode='+InvBillTypeCode;
Orderbyfields:='';
getdata;
lbl_WhName.Caption:=AdoQry_Main.fieldbyname('whName').ASSTRING; // 仓库
lbl_WhPosition.Caption:=AdoQry_Main.fieldbyname('WhPositionCode').asstring+' '+AdoQry_Main.fieldbyname('WhPositionName').asstring; //货位
edt_Billno.text:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING;//单据号
lbl_VendorCodeName.Caption:=AdoQry_Main.fieldbyname('VendorName').ASSTRING; //供应商
lbl_Pono.Caption:=AdoQry_Main.fieldbyname('Pono').ASSTRING; //采购订单号
MEdt_Date.text:=AdoQry_Main.fieldbyname('InvBilldate').asstring;//日期
Edt_RemArk.text:=AdoQry_Main.fieldbyname('InvBillRemArk').ASSTRING; //备注
lbl_InvBillrate.Caption:=AdoQry_Main.fieldbyname('InvBillTaxRate').asstring+' %';//税率
if AdoQry_Main.fieldbyname('InvBillValuation').asstring='1' then
Chb_InvBillValuation.checked:=True
else
Chb_InvBillValuation.checked:=False;
if(not ShowExtendColumn)then
begin
lable9.Visible:=False;
Label12.Visible:=False;
lbl_InvBillrate.Visible:=False ;
Chb_InvBillValuation.Visible:=False;
end ;
if RecTypeCode='0101' then
begin
Frm_Inv_PurchaseInBillQry.Caption:=' 采购入库单查询';
Pnl_Title.Caption:=' 采购入库单查询';
end
else if RecTypeCode='0102' then
begin
Frm_Inv_PurchaseInBillQry.Caption:=' 进口采购入库单查询';
Pnl_Title.Caption:=' 进口采购入库单查询';
end
else if RecTypeCode='0103' then
begin
Frm_Inv_PurchaseInBillQry.Caption:=' 委外加工入库单查询';
Pnl_Title.Caption:=' 委外加工入库单查询';
end
end;
procedure TFrm_Inv_PurchaseInBillQry.Act_PreviewExecute(Sender: TObject);
begin
//inherited;
BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_WhName.Caption),Edt_BillNo.text,RecTypeCode,ModuleCode,True,False,True,'');
end;
procedure TFrm_Inv_PurchaseInBillQry.Act_PrintExecute(Sender: TObject);
begin
//inherited;
BillPrint(AdoQry_Tmp.Connection,GetCode(Lbl_WhName.Caption),Edt_BillNo.text,RecTypeCode,ModuleCode,False,False,True,'');
end;
procedure TFrm_Inv_PurchaseInBillQry.DBGridEhGetCellParams(Sender: TObject;
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
inherited;
if (gdSelected in State)or(gdFocused in State) then
begin
Background:=clNavy;
AFont.Color:=clWindow;
end
else
begin
if AdoQry_Main.fieldbyname('Valuation').asinteger=1 then
afont.Color:=clblue
else
AFont.Color:=clBlack;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -