📄 inv_cancelvaluation.pas
字号:
unit Inv_CancelValuation;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Check, Menus, Db, ActnList, AdODB, Grids, DBGridEh, StdCtrls,
ExtCtrls, ComCtrls, ToolWin, DBCtrls, ExtPrintReport, jpeg;
Type
TFrm_Inv_CancelValuation = Class(TFrm_Base_Check)
Label1: TLabel;
DBText1: TDBText;
AdoQry_HeadInvBillid: TFloatField;
AdoQry_HeadInvBilltmpflag: TIntegerField;
AdoQry_HeadwhCodeName: TStringField;
AdoQry_HeadInvBillno: TStringField;
AdoQry_HeadInvBilldate: TDateTimeField;
AdoQry_HeadInvBillMonth: TStringField;
AdoQry_HeadInvBillremArk: TStringField;
AdoQry_HeadInvBilltaxrate: TFloatField;
AdoQry_HeadInvBillValuation: TIntegerField;
AdoQry_HeadcurrencyCode: TStringField;
AdoQry_HeadBillTypeCode: TStringField;
AdoQry_Headpono: TStringField;
AdoQry_HeadcurrencyName: TStringField;
AdoQry_HeadVendorCode: TStringField;
AdoQry_HeadVendorName: TStringField;
AdoQry_HeadInvBillwhchck: TIntegerField;
AdoQry_HeadInvBillStkchck: TIntegerField;
AdoQry_HeadWhPositionCodeName: TStringField;
AdoQry_HeadwhCode: TStringField;
AdoQry_HeadBillTypeName: TStringField;
procedure Act_CheckExecute(Sender: TObject);
procedure Act_CancelCheckExecute(Sender: TObject);
procedure DBGridEhGetCellParams(Sender: TObject; Column: TColumnEh;
AFont: TFont; var Background: TColor; State: TGridDrawState);
procedure Act_LookExecute(Sender: TObject);
procedure DBGridEhDblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
end;
var
Frm_Inv_CancelValuation: TFrm_Inv_CancelValuation;
implementation
uses Sys_Global,Inv_PriceAudit_B;
{$R *.DFM}
{ TFrm_Pm_Pc_Check }
procedure TFrm_Inv_CancelValuation.InitForm(AdOConnection: TAdOConnection;
ReadOnly: Boolean);
var
CurrentMonth,lastMonth:string;
begin
inherited;
CurrentMonth:=copy(LoginDate,1,7);
lastMonth:=copy(datetostr(incMonth(strtodate(LoginDate),-1)),1,7);
PriceFields:='PcNoTaxPrice,PcTaxPrice,';
SelectFromSQL:=
' select '+
'InvInBill.InvBillid,'+
'InvInBill.InvBilltmpflag,'+
'InvInBill.whCode,'+
'InvInBill.whCode+'+''' '''+'+w.whName as whCodeName, '+
'InvInBill.InvBillno,'+
'InvInBill.InvBilldate,'+
'InvInBill.InvBillMonth,'+
'InvInBill.InvBillremArk,'+
'InvInBill.InvBilltaxrate,'+
'InvInBill.InvBillValuation,'+
'InvInBill.currencyCode,'+
'InvInBill.BillTypeCode,'+
'InvInBill.BillTypeCode+'+''' '''+'+b.BillTypeName as BillTypeName,'+
'InvInBill.pono,'+
'c.currencyName,'+
'InvInBill.VendorCode,'+
'v.VendorName,'+
'InvInBill.InvBillwhchck,'+
'InvInBill.InvBillStkchck,'+
'InvInBill.WhPositionCode+'+''' '''+'+p.WhPositionName as WhPositionCodeName '+
'from InvInBill '+
'left join Vendor V on InvInBill.VendorCode=V.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'') and '+
' InvInBill.InvBillStkchck=1 and '+
' InvInBill.realBillflag=1 and '+
' InvInBill.InvBillFinChck=0 and '+
' InvInBill.InvBillMonth>='''+lastMonth+''' and '+
' InvInBill.InvBillMonth<='''+CurrentMonth+''' 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))';
OrderByFields:='whCodeName,InvBillno';
getdata;
act_Check.Enabled :=False;
act_Check.Visible :=False;
end;
procedure TFrm_Inv_CancelValuation.Act_CheckExecute(Sender: TObject);
var
BookmArk:TBookmArk;
begin
inherited;
end;
procedure TFrm_Inv_CancelValuation.Act_CancelCheckExecute(Sender: TObject);
var
BookmArk:TBookmArk;
begin
inherited;
if AdoQry_Head.RecordCount>0 then
begin
if DispInfo('是否确认将这些单据设置成暂估价单据?',2)='n' then
Exit;
try
AdoQry_Head.Connection.beginTrans;
AdoQry_Head.DisableControls;
BookmArk:=AdoQry_Head.GetBookmArk;
AdoQry_Head.First;
while not AdoQry_Head.Eof do
begin
if (AdoQry_Head.fieldbyname('InvBillTmpFlag').AsString='1') and
(AdoQry_Head.fieldbyname('InvBillValuation').AsString='0') then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:=
'Update InvInBill '+
' Set '+
' InvBillValuation=1, '+
' InvBillStkchck=0, '+
' Stk_EmployeeCode2='''+userCode+''''+
' where InvBillid='+AdoQry_Head.fieldbyname('InvBillid').asstring+
'update InvInBillline '+
' set '+
' Valuation=1 '+
'where InvBillid='+AdoQry_Head.fieldbyname('InvBillid').asstring;
AdoQry_Tmp.ExecSQL;
AdoQry_Head.Edit;
AdoQry_Head.fieldbyname('InvBillTmpFlag').AsString:='0';
AdoQry_Head.fieldbyname('InvBillValuation').asinteger:=1;
AdoQry_Head.Post;
end;
AdoQry_Head.Next;
end;
AdoQry_Head.Connection.CommitTrans;
AdoQry_Head.GotoBookmArk(BookmArk);
AdoQry_Head.FreeBookmArk(BookmArk);
AdoQry_Head.EnableControls;
except
begin
AdoQry_Head.Connection.RollBackTrans;
DispInfo(' 存盘不成功,请稍后再试! ',1);
end;
end;
end;
end;
procedure TFrm_Inv_CancelValuation.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_Head.fieldbyname('InvBillValuation').asinteger=1 then
afont.Color:=clblue
else
AFont.Color:=clBlack;
end;
end;
procedure TFrm_Inv_CancelValuation.Act_LookExecute(Sender: TObject);
begin
inherited;
if AdoQry_Head.RecordCount>0 then
begin
Frm_Inv_PriceAudit_B:=TFrm_Inv_PriceAudit_B.Create(Self);
Frm_Inv_PriceAudit_B.SetUserParam(Param1,Param2,Param3,Param4,Param5,Param6);
Frm_Inv_PriceAudit_B.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
Frm_Inv_PriceAudit_B.InitForm(DBConnect,'ReadOnly',AdoQry_Head);
Frm_Inv_PriceAudit_B.ShowModal;
Frm_Inv_PriceAudit_B.Release;
end;
end;
procedure TFrm_Inv_CancelValuation.DBGridEhDblClick(Sender: TObject);
begin
inherited;
act_look.Execute;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -