📄 ar_enter_noinvoiceshiporder.pas
字号:
unit Ar_Enter_NoInvoiceShipOrder;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin, jpeg;
Type
TFrm_Ar_Enter_NoInvoiceShipOrder = Class(TFrm_Base_Outer)
AdoQry_MainInvBillId: TFloatField;
AdoQry_MainInvBillNo: TStringField;
AdoQry_MainWHCode: TStringField;
AdoQry_MainWhPositionCode: TStringField;
AdoQry_MainInvBillDate: TDateTimeField;
AdoQry_MainInvBillMonth: TStringField;
AdoQry_MaInBillTypeCode: TStringField;
AdoQry_MaInBillType2Code: TStringField;
AdoQry_MaInvendorCode: TStringField;
AdoQry_MainEmployeeCode: TStringField;
AdoQry_MainDeptCode: TStringField;
AdoQry_MainCUSTOMERCode: TStringField;
AdoQry_MainCURRENCYCode: TStringField;
AdoQry_MainPONO: TStringField;
AdoQry_MainMONO: TStringField;
AdoQry_MainInvBillValuation: TIntegerField;
AdoQry_MainInvBillWHCHCK: TIntegerField;
AdoQry_MainWH_EmployeeCode: TStringField;
AdoQry_MainInvBillFINCHCK: TIntegerField;
AdoQry_MainFin_EmployeeCode: TStringField;
AdoQry_MainPRINTTIMES: TIntegerField;
AdoQry_MainSaleType: TStringField;
AdoQry_MainShiftType: TStringField;
AdoQry_MainInvBillRemArk: TStringField;
AdoQry_MainInvBillInfo: TStringField;
AdoQry_MainOWhPositionCode: TStringField;
AdoQry_MainInvBillStkChck: TIntegerField;
AdoQry_MainStk_EmployeeCode: TStringField;
AdoQry_MainInvBillTmpFlag: TIntegerField;
AdoQry_MainOverPlan: TIntegerField;
AdoQry_MainPOLineNo: TIntegerField;
AdoQry_MainMoLineNO: TIntegerField;
AdoQry_MainInvBillCreateTime: TDateTimeField;
AdoQry_MainSfc_EmployeeCode: TStringField;
AdoQry_MainSal_EmployeeCode: TStringField;
AdoQry_MainWH_EmployeeCode2: TStringField;
AdoQry_MainInvBilltaxrate: TFloatField;
AdoQry_MainMpsSale: TIntegerField;
AdoQry_MainopBill: TIntegerField;
AdoQry_MainSysBill: TIntegerField;
AdoQry_MainOldInvBillNo: TStringField;
AdoQry_MainPriceAdjustBill: TIntegerField;
AdoQry_MainWipWaster: TIntegerField;
AdoQry_MainAmountAdjust: TIntegerField;
AdoQry_MainShipType: TIntegerField;
AdoQry_MainShipAddresSCode: TStringField;
AdoQry_MainShipModeCode: TStringField;
AdoQry_MainSaleEmployeeCode: TStringField;
AdoQry_MainPayTermCode: TStringField;
AdoQry_MainInvoiceNo: TStringField;
AdoQry_MainRemArk: TStringField;
AdoQry_MainRemArk1: TStringField;
AdoQry_MainTotalInvBillAmount: TFloatField;
AdoQry_MainTotalInvBillNoTaxAmount: TFloatField;
AdoQry_MainTotalInvBillnoTaxAmountc: TFloatField;
AdoQry_MainTotalInvBillAmountc: TFloatField;
AdoQry_MainCustomerName: TStringField;
AdoQry_MainSaleTypeName: TStringField;
AdoQry_MainDeptName: TStringField;
AdoQry_MainWhName: TStringField;
AdoQry_MainWhPositionName: TStringField;
AdoQry_MainEmployeeName: TStringField;
AdoQry_MainCurrencyName: TStringField;
AdoQry_MainShipModeName: TStringField;
AdoQry_MainShipAddressName: TStringField;
AdoQry_MainPayTermName: TStringField;
AdoQry_MainCreateEmployeeName: TStringField;
procedure FormDestroy(Sender: TObject);
procedure Act_DeleteExecute(Sender: TObject);
private
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
function SetDeleteSql:String;Override;
{ Public declarations }
end;
var
Frm_Ar_Enter_NoInvoiceShipOrder: TFrm_Ar_Enter_NoInvoiceShipOrder;
implementation
uses Ar_Enter_NoInvoiceShipOrder_D,Sys_Global;
{$R *.DFM}
{ TFrm_Ar_Enter_Gathering }
procedure TFrm_Ar_Enter_NoInvoiceShipOrder.InitForm(AdOConnection: TAdOConnection;
ReadOnly: Boolean);
var yy,mm : integer;
StartUseAccount : boolean;
begin
Application.ProcessMessages;
extendCaption:=False;
Inherited;
ExecuteSql(AdoQry_tmp,'select * from Ar_Param where ParamCode=''StartUseAr''',0);
If AdoQry_Tmp.RecordCount>0 then
begin
Act_New.Enabled := False;
Act_Modify.Enabled := False;
Act_Delete.Enabled := False;
end;
ExecuteSql(AdoQry_Tmp,'select * from Ar_Param where ParamCode =''StartUseAr'' ',0) ;
StartUseAccount := (AdoQry_Tmp.fieldbyname('ParamValueN').AsInteger=1);
SelectFromSql:=' Select InvOutBill.*,CustomerName,SaleType.SaleTypeName,'
+' InvOutBill.CustomerCode+'' ''+ CustomerName as CustomerFalg,'
// +' RemArk,InvOutBill.ShipAddresSCode,InvOutBill.ShipModeCode, CreateEmployeeCode,InvOutBill.PayTermCode, InvOutBill.CurrencyCode, CreateDate,InvBillNo,SaleType, InvOutBill.SaleDeptCode,SaleEmployeeCode, '
+' DeptName,'
+' InvOutBill.DeptCode+'' ''+DeptName As DeptFalg, '
+' Warehouse.WhName, '
+' WhPosition.WhPositionName, '
+' Employee.EmployeeName, '
+' SaleEmployeeCode+'' ''+Employee.EmployeeName As EmployeeFalg, '
+' CurrencyName,'
+' InvOutBill.CurrencyCode+'' ''+CurrencyName As CurrencyFalg, '
+' InvOutBill.InvBillTaxRate, '
+' PayTerm.PayTermName, '
+' InvOutBill.PayTermCode+'' ''+PayTermName As SaleTermFalg,'
+' tt.EmployeeName as CreateEmployeeName, '
+' Sal_EmployeeCode+'' ''+tt.EmployeeName As EmployeeFalg1, '
+' ShipModeName,'
+' InvOutBill.ShipModeCode+'' ''+ShipModeName As ShipModeFalg,'
+' ShipAddressName, '
+' InvOutBill.ShipAddresSCode+'' ''+ShipAddressName As ShipAddressFalg'
+' From InvOutBill left outer Join Customer '
+' On InvOutBill.CustomerCode=Customer.CustomerCode '
+' left outer Join Dept '
+' On InvOutBill.DeptCode=Dept.DeptCode '
+' left Join Warehouse on InvOutBill.WhCode=Warehouse.WhCode '
+' left Join WhPosition on (InvOutBill.WhCode=WhPosition.WhCode and InvOutBill.WhPositionCode=WhPosition.WhPositionCode) '
+' left Join Employee '
+' On InvOutBill.SaleEmployeeCode=Employee.EmployeeCode '
+' left Join Currency '
+' On InvOutBill.CurrencyCode=Currency.CurrencyCode '
+' left Join PayTerm '
+' On InvOutBill.PayTermCode=PayTerm.PayTermCode '
+' left Join Employee tt '
+' On InvOutBill.Sal_EmployeeCode=tt.EmployeeCode '
+' left Join ShipMode '
+' On InvOutBill.ShipModeCode=ShipMode.ShipModeCode '
+' left Join SaleType On InvOutBill.SaleType=SaleType.SaleTypeCode '
+' Left Join CustomerShipAddress '
+' On (InvOutBill.ShipAddresSCode=CustomerShipAddress.ShipAddresSCode and InvOutBill.CustomerCode=CustomerShipAddress.CustomerCode ) ';
Executesql(AdoQry_tmp,'select * from Gl_AccountParam',0);
yy:=AdoQry_tmp.fieldbyname('AccountuseYear').asinteger;
mm:=AdoQry_tmp.fieldbyname('AccountuseMonth').asinteger;
if StartUseAccount then
ConditionUserDefine := ' not Exists ( select * from InvOutBillLine where InvOutBill.InvBillId=InvOutBillLine.InvBillId ) '
+' and ( (datepArt(yy,InvOutBill.InvBillDate)<'+IntToStr(yy)+' ) '
+' or (DatePArt(yy,InvOutBill.InvBillDate)='+IntToStr(yy)+' and DatePArt(mm,InvOutBill.InvBillDate)<='+IntToStr(mm)+') ) '
+' and Isnull(InvOutBill.InvoiceNo,'''')='''' '
+' and BillTypeCode in (''0205'',''0206'' )'
else
ConditionUserDefine := ' not Exists ( select * from InvOutBillLine where InvOutBill.InvBillId=InvOutBillLine.InvBillId ) '
+' and InvBillDate<=GetDate() '
+' and IsNull(InvOutBill.InvoiceNo,'''')='''' '
+' and BillTypeCode in (''0205'',''0206'') ';
Orderbyfields:='customerCode';
getdata;
Frm_Sys_Detail:=TFrm_Ar_Enter_NoInvoiceShipOrder_D.Create(Application);
end;
procedure TFrm_Ar_Enter_NoInvoiceShipOrder.FormDestroy(Sender: TObject);
begin
inherited;
Frm_Ar_Enter_NoInvoiceShipOrder:=nil;
end;
function TFrm_Ar_Enter_NoInvoiceShipOrder.SetDeleteSql: String;
begin
Result:='delete from InvOutBill '
+' where InvBillNo='+quotedstr(AdoQry_Main.fieldbyname('InvBillNo').asstring);
end;
procedure TFrm_Ar_Enter_NoInvoiceShipOrder.Act_DeleteExecute(Sender: TObject);
begin
if AdoQry_Main.RecordCount=0 then exit;
if DispInfo(' 真的删除当前记录吗? ',2)<>'y' then exit;
try
dbconnect.beginTrans;
// saveGatheringhistory(dbconnect,AdoQry_Main.fieldbyname('Gatheringno').asstring,userCode,2);
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:=SetDeleteSql;
AdoQry_Tmp.ExecSQL;
AdoQry_Main.Delete;
dbconnect.CommitTrans;
except
if dbconnect.InTransaction then dbconnect.RollBackTrans;
DispInfo(' 无法删除当前记录,可能已经被其他数据表引用!',1);
Abort;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -