📄 inv_priceaudit_h.pas
字号:
unit Inv_PriceAudit_H;
//暂估价与核价合二为一个程序
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Head, Menus, Db, ActnList, AdODB, Grids, DBGridEh, StdCtrls,
ExtCtrls, ComCtrls, ToolWin, ExtPrintReport, jpeg;
Type
TFrm_Inv_PriceAudit_H = Class(TFrm_Base_Entry_Head)
AdoQry_HeadInvBillid: TBCDField;
AdoQry_HeadwhCodeName: TStringField;
AdoQry_HeadInvBillno: TStringField;
AdoQry_HeadInvBilldate: TDateTimeField;
AdoQry_HeadInvBillremArk: TStringField;
AdoQry_HeadVendorCode: TStringField;
AdoQry_HeadVendorName: TStringField;
AdoQry_HeadInvBillwhchck: TIntegerField;
AdoQry_HeadWhPositionCodeName: TStringField;
AdoQry_HeadInvBilltaxrate: TFloatField;
AdoQry_Headpono: TStringField;
AdoQry_HeadInvBillValuation: TIntegerField;
AdoQry_HeadcurrencyCode: TStringField;
AdoQry_HeadcurrencyName: TStringField;
AdoQry_HeadBillTypeCode: TStringField;
AdoQry_HeadBillTypeCodeName: TStringField;
AdoQry_HeadInvBillStkchck: TIntegerField;
AdoQry_HeadInvBillMonth: TStringField;
AdoQry_HeadwhCode: TStringField;
AdoQry_HeadPriceAuditTimes: TIntegerField;
AdoQry_HeadBillTypeName: TStringField;
AdoQry_HeadrealBillflag: TIntegerField;
AdoQry_Headbluered: TStringField;
AdoQry_HeadSourceno: TStringField;
AdoQry_HeadVendorBillno: TStringField;
AdoQry_HeadBillType2Code: TStringField;
AdoQry_HeadopBill: TIntegerField;
procedure Act_ModifyExecute(Sender: TObject);
private
modal:string;
{ Private declarations }
public
lct_WhCodeName,lct_InvBillno:string;
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
{ Public declarations }
end;
var
Frm_Inv_PriceAudit_H: TFrm_Inv_PriceAudit_H;
implementation
uses Inv_PriceAudit_B,Sys_Global;
{$R *.DFM}
procedure TFrm_Inv_PriceAudit_H.InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);
var
CurrentMonth,lastMonth:string;
begin
inherited;
//是核价还是暂估价处理
modal:=Param1;
CurrentMonth:=copy(LoginDate,1,7);
lastMonth:=copy(datetostr(incMonth(strtodate(LoginDate),-1)),1,7);
//显示窗体Caption
if modal='暂估价' then
begin
SelectFromSQL:=
'select '+
'InvInBill.InvBillid,'+
'InvInBill.whCode,'+
'InvInBill.whCode+'+''' '''+'+w.whName as whCodeName, '+
'InvInBill.InvBillno,'+
'InvInBill.InvBilldate,'+
'InvInBill.InvBillMonth,'+
'InvInBill.InvBillremArk,'+
'InvInBill.InvBilltaxrate,'+
'InvInBill.BillType2Code,'+
'InvInBill.opBill,'+
'InvInBill.InvBillValuation,'+
'InvInBill.currencyCode,'+
'InvInBill.BillTypeCode,'+
'b.BillTypeName,'+
'InvInBill.BillTypeCode+'+''' '''+'+b.BillTypeName as BillTypeCodeName,'+
'InvInBill.pono,'+
'InvInBill.bluered,'+
'InvInBill.Sourceno,'+
'InvInBill.PriceAuditTimes,'+
'c.currencyName,'+
'InvInBill.VendorCode,'+
'Vendor.VendorName,'+
'InvInBill.InvBillwhchck,'+
'InvInBill.InvBillStkchck,'+
'InvInBill.RealBillFlag,'+
'InvInBill.WhPositionCode+'+''' '''+'+p.WhPositionName as WhPositionCodeName, '+
'InvInBill.VendorBillno '+
'from InvInBill '+
'left join Vendor on InvInBill.VendorCode=Vendor.VendorCode '+
'left join Warehouse w on InvInBill.whCode=w.whCode '+
'left join BillType b on InvInBill.BillTypeCode=b.BillTypeCode '+
'left join WhPosition p on InvInBill.whCode=p.whCode and InvInBill.WhPositionCode=p.WhPositionCode '+
'left join currency c on InvInBill.currencyCode=c.currencyCode ';
//单据类型是普通采购入库,进口采购入库,委外采购入库
// InvBillValuation=1 暂估价标志
// InvBillFinChck=0 未开发票
//InvBillwhchck=1 仓库己审核
//RealBillFlag=1 实际单据标志
//InvBillStkchck=0 未核价标志
ConditionUserDefine:=' (InvInBill.BillTypeCode in (''0101'',''0102'',''0103'') and '+
' InvInBill.InvBillValuation=1 and '+
' InvInBill.InvBillFinChck=0 and '+
' InvInBill.InvBillwhchck=1 and '+
' InvInBill.RealBillFlag=1 and '+
' InvInBill.whCode in (select w.whCode '+
' from whAccessCtrl a,Warehouse w '+
' where a.EmployeeCode='''+userCode+''' and '+
' a.whCode=w.whCode and w.PriceType=0))';
condition:=' InvInBill.InvBillMonth>='''+lastMonth+''' and '+
' InvInBill.InvBillMonth<='''+CurrentMonth+''' and '+
' InvInBill.InvBillStkchck=0 '
end
else
begin
//核价处理
SelectFromSQL:=
'select '+
'InvInBill.InvBillid,'+
'InvInBill.whCode,'+
'InvInBill.whCode+'+''' '''+'+w.whName as whCodeName, '+
'InvInBill.InvBillno,'+
'InvInBill.InvBilldate,'+
'InvInBill.InvBillMonth,'+
'InvInBill.InvBillremArk,'+
'InvInBill.InvBilltaxrate,'+
'InvInBill.InvBillValuation,'+
'InvInBill.BillType2Code,'+
'InvInBill.opBill,'+
'InvInBill.currencyCode,'+
'InvInBill.BillTypeCode,InvInBill.InvBillremArk,'+
'b.BillTypeName,'+
'InvInBill.BillTypeCode+'+''' '''+'+b.BillTypeName as BillTypeCodeName,'+
'InvInBill.pono,'+
'InvInBill.bluered,'+
'InvInBill.Sourceno,'+
'InvInBill.PriceAuditTimes,'+
'c.currencyName,'+
'InvInBill.VendorCode,'+
'Vendor.VendorName,'+
'InvInBill.InvBillwhchck,'+
'InvInBill.InvBillStkchck,'+
'InvInBill.RealBillFlag,'+
'InvInBill.WhPositionCode+'+''' '''+'+p.WhPositionName as WhPositionCodeName, '+
'InvInBill.VendorBillno '+
'from InvInBill '+
'left join Vendor on InvInBill.VendorCode=Vendor.VendorCode '+
'left join Warehouse w on InvInBill.whCode=w.whCode '+
'left join BillType b on InvInBill.BillTypeCode=b.BillTypeCode '+
'left join WhPosition p on InvInBill.whCode=p.whCode and InvInBill.WhPositionCode=p.WhPositionCode '+
'left join currency c on InvInBill.currencyCode=c.currencyCode ';
ConditionUserDefine:=' (InvInBill.BillTypeCode in (''0101'',''0102'',''0103'',''0199'') and '+
' InvInBill.RealBillFlag=1 and '+
' InvInBill.InvBillwhchck=1 and '+
' InvInBill.InvBillFinChck=0 and '+
' InvInBill.InvBillValuation=0 and '+
' InvInBill.whCode in (select w.whCode '+
' from whAccessCtrl a,Warehouse w '+
' where a.EmployeeCode='''+userCode+''' and '+
' a.whCode=w.whCode and w.PriceType=0))';
condition:=' InvInBill.InvBillMonth>='''+lastMonth+''' and '+
' InvInBill.InvBillMonth<='''+CurrentMonth+''' and '+
' InvInBill.InvBillStkchck=0 '
end;
OrderByFields:='whCodeName,InvBillno';
getdata;
Frm_Entry_Body:=TFrm_Inv_PriceAudit_B.Create(Self);
if modal='暂估价' then
begin
Caption:='采购入库暂估价单据处理';
pnl_title.Caption:='采购入库暂估价单据处理';
end
else
begin
Caption:='采购入库单据核价';
pnl_title.Caption:='采购入库单据核价';
end;
end;
procedure TFrm_Inv_PriceAudit_H.Act_ModifyExecute(Sender: TObject);
begin
inherited;
//重新刷新Head中DBGRID中的数据,然后由BODY还回的变量lct_WhCodeName,lct_InvBillno定位
// getdata;
// if lct_InvBillno<>'' then
// begin
// AdoQry_Head.First;
// AdoQry_Head.Locate('whCodeName;InvBillno', varArrayOf([lct_WhCodeName,lct_InvBillno]),[]);
// end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -