📄 inv_purchaseinbilllistqry.pas
字号:
unit Inv_PurchaseInBillListQry;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBCtrls;
Type
TFrm_Inv_PurchaseInBillListQry = Class(TFrm_Base_Qry)
Label1: TLabel;
DBText1: TDBText;
Label9: TLabel;
procedure Act_LookExecute(Sender: TObject);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
procedure Act_PrintExecute(Sender: TObject);
procedure AdoQueryAfterOpen(DataSet: TDataSet);
private
{ Private declarations }
FShowExtendColumn:Boolean;
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);Override;
end;
var
Frm_Inv_PurchaseInBillListQry: TFrm_Inv_PurchaseInBillListQry;
implementation
uses Inv_PurchaseInBillListQry_C,Sys_Global,Inv_PurchaseInBillQry
,Inv_BillListPrint_C,Inv_Global;
{$R *.DFM}
procedure TFrm_Inv_PurchaseInBillListQry.InitForm(AdOConnection:TAdOConnection;ShowExtendColumn:Boolean);
begin
inherited;
AmountFields:='InvBillnotaxAmount,InvBillnotaxAmountc,';
PriceFields:='InvBillnotaxPrice,InvBillnotaxPricec,';
FShowExtendColumn:=ShowExtendColumn;
if(not ShowExtendColumn)then
begin
DBGridEh.Columns.Delete(14);
DBGridEh.Columns.Delete(13);
DBGridEh.Columns.Delete(12);
DBGridEh.Columns.Delete(11);
DBGridEh.Columns.Delete(10);
end
else if Param1<>'0102' then
begin
DBGridEh.Columns.Delete(12);
DBGridEh.Columns.Delete(11);
DBGridEh.Columns.Delete(10);
end;
SelectFromSQL:='Select InvInBill.InvBillDate'
+',InvInBill.InvBillNo'
+',InvInBill.RealBillFlag'
+',InvInBill.VendorCode+'' ''+Vendor.VendorName As VendorCodeName'
+',InvInBill.PONo'
+',InvInBill.OverPlan'
+',InvInBillLine.POLineNo'
+',InvInBillLine.BilllineremArk'
+',InvInBillLine.ItemCode'
+',Warehouse.WHCode'
+',Warehouse.whCode+'' ''+Warehouse.WHName AS WHName'
+',WhPosition.WhPositionCode+'' ''+WhPosition.WhPositionName as WhPositionName'
+',InvInBillLine.ItemCode+'+''' '''+'+Item.ItemName as ItemCodeName'
+',Uom.UomName'
+',InvInBillLine.InvBillQty'
+',InvInBillLine.InvBillNoTaxPrice'
+',InvInBillLine.InvBillNoTaxAmount'
+',InvInBillLine.Valuation'
+',InvInBill.CurrencyCode+'' ''+Currency.CurrencyName As CurrencyCodeName'
+',InvInBillLine.InvBillNoTaxPriceC'
+',InvInBillLine.InvBillNoTaxAmountC'
+',InvInBillLine.InvBillAmount'
+',InvInBill.wh_EmployeeCode+'' ''+wh.EmployeeName As wh_EmployeeCodeName'
+',InvInBill.Stk_EmployeeCode+'' ''+Stk.EmployeeName As Stk_EmployeeCodeName'
+',InvInBillLine.BatchNo'
+' From InvInBill'
+' left outer join InvInBillLine on InvInBill.InvBillid=InvInBillLine.InvBillid'
+' Left Outer Join Item On InvInBillLine.ItemCode=Item.ItemCode'
+' Left Outer Join Uom On Item.UomCode=Uom.UomCode'
+' Left Outer Join Vendor On InvInBill.VendorCode=Vendor.VendorCode'
+' left outer join Warehouse on InvInBill.WHCode=Warehouse.WhCode'
+' left outer join WhPosition on InvInBill.whCode=WhPosition.whCode'
+' and InvInBill.WhPositionCode=WhPosition.WhPositionCode'
+' Left Outer Join Employee wh On InvInBill.wh_EmployeeCode=wh.EmployeeCode'
+' Left Outer Join Employee Stk On InvInBill.Stk_EmployeeCode=Stk.EmployeeCode'
+' Left Outer Join Currency on Currency.CurrencyCode=InvInBill.CurrencyCode';
if Param1='0103' then
ConditionUserDefine:='InvInBillLine.InvBillId=InvInBill.InvBillId'
+' and InvInBill.BillTypeCode='''+Param1+''''
+' and InvInBill.InvBillWHChck<>0'
else
ConditionUserDefine:='InvInBillLine.InvBillId=InvInBill.InvBillId'
+' and InvInBill.BillTypeCode='''+Param1+'''';
OrderByFields:='InvBillDate,InvBillNo,WHCode';
Frm_Sys_Condition:=TFrm_Inv_PurchaseInBillListQry_C.Create(Self);
if Param1='0101' then
begin
Frm_Inv_PurchaseInBillListQry.Caption:=' 采购入库单列表查询';
Pnl_Title.Caption:=' 采购入库单列表查询';
Frm_Sys_Condition.Caption:=' 筛选条件';
end
else if Param1='0102' then
begin
Frm_Inv_PurchaseInBillListQry.Caption:=' 进口采购入库单列表查询';
Pnl_Title.Caption:=' 进口采购入库单列表查询';
Frm_Sys_Condition.Caption:=' 筛选条件';
end
else if Param1='0103' then
begin
Frm_Inv_PurchaseInBillListQry.Caption:=' 委外加工入库单列表查询';
Pnl_Title.Caption:=' 委外加工入库单列表查询';
Frm_Sys_Condition.Caption:=' 筛选条件';
end
Else
begin
Frm_Inv_PurchaseInBillListQry.Caption:='';
Frm_Sys_Condition.Caption:=' ';
DispInfo('系统传入参数不正确,请与系统管理员联系!',1);
Abort;
end;
TFrm_Inv_PurchaseInBillListQry_C(Frm_Sys_Condition).InitForm(DBConnect,UserCode,ShowExtendColumn);
Act_Filter.Execute;
end;
procedure TFrm_Inv_PurchaseInBillListQry.Act_LookExecute(Sender: TObject);
var
InvBillNo:string;
WHCode:string;
InvBillTypeCode:string;
begin
if AdoQry_Main.eof then
DispInfo('没有可用的单据! ',3)
else
begin
//创建窗体
Application.CreateForm(TFrm_Inv_PurchaseInBillQry,Frm_Inv_PurchaseInBillQry);
//传递变量
InvBillno:=AdoQry_Main.fieldbyname('InvBillNo').ASSTRING; //单据号
WHCode:=AdoQry_Main.fieldbyname('WHCode').ASSTRING; //仓库代码
InvBillTypeCode:=Param1;
Frm_Inv_PurchaseInBillQry.Getvar(InvBillno,WHCode,InvBillTypeCode);
//显示信息
Frm_Inv_PurchaseInBillQry.InitForm(DBConnect,FShowExtendColumn);
end;
end;
procedure TFrm_Inv_PurchaseInBillListQry.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;
procedure TFrm_Inv_PurchaseInBillListQry.Act_PrintExecute(Sender: TObject);
var
WHCode_InvBillNo:String;
begin
with TFrm_Inv_BillListPrint_C.Create(Self) do
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;
if AdoQry_Main.fieldbyname('RealBillFlag').AsString='1' then
BillPrint(DBConnect,AdoQry_Main.fieldbyname('WHCode').AsString
,AdoQry_Main.fieldbyname('InvBillNo').AsString
,Param1,ModuleCode,False,False,True,'');
end;
AdoQry_Main.Next;
end;
end;
end;
Release;
end;
end;
procedure TFrm_Inv_PurchaseInBillListQry.AdoQueryAfterOpen(
DataSet: TDataSet);
var
d1,d2:Double;
begin
inherited;
if (FShowExtendColumn)and(Param1<>'0102') 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)+' 含税金额:'+FloatToStr(d2);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -