📄 sal_enter_othershiporderh.pas
字号:
unit Sal_Enter_OtherShipOrderH;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Entry_Head, Menus, Db, ActnList, AdODB, Grids, DBGridEh, StdCtrls,
ExtCtrls, ComCtrls, ToolWin, jpeg, ExtPrintReport;
Type
TFrm_Sal_Enter_OtherShipOrderH = Class(TFrm_Base_Entry_Head)
AdoQry_HeadInvBillId: TFloatField;
AdoQry_HeadInvBillNo: TStringField;
AdoQry_HeadWHCode: TStringField;
AdoQry_HeadWhPositionCode: TStringField;
AdoQry_HeadInvBillDate: TDateTimeField;
AdoQry_HeadInvBillMonth: TStringField;
AdoQry_HeadBillTypeCode: TStringField;
AdoQry_HeadBillType2Code: TStringField;
AdoQry_HeadVendorCode: TStringField;
AdoQry_HeadEmployeeCode: TStringField;
AdoQry_HeadDeptCode: TStringField;
AdoQry_HeadCUSTOMERCode: TStringField;
AdoQry_HeadCURRENCYCode: TStringField;
AdoQry_HeadPONO: TStringField;
AdoQry_HeadMONO: TStringField;
AdoQry_HeadInvBillValuation: TIntegerField;
AdoQry_HeadInvBillWHCHCK: TIntegerField;
AdoQry_HeadWH_EmployeeCode: TStringField;
AdoQry_HeadInvBillFINCHCK: TIntegerField;
AdoQry_HeadFin_EmployeeCode: TStringField;
AdoQry_HeadPRINTTIMES: TIntegerField;
AdoQry_HeadSaleType: TStringField;
AdoQry_HeadShiftType: TStringField;
AdoQry_HeadInvBillRemArk: TStringField;
AdoQry_HeadInvBillInfo: TStringField;
AdoQry_HeadOWhPositionCode: TStringField;
AdoQry_HeadInvBillStkChck: TIntegerField;
AdoQry_HeadStk_EmployeeCode: TStringField;
AdoQry_HeadInvBillTmpFlag: TIntegerField;
AdoQry_HeadOverPlan: TIntegerField;
AdoQry_HeadPOLineNo: TIntegerField;
AdoQry_HeadMoLineNO: TIntegerField;
AdoQry_HeadInvBillCreateTime: TDateTimeField;
AdoQry_HeadSfc_EmployeeCode: TStringField;
AdoQry_HeadSal_EmployeeCode: TStringField;
AdoQry_HeadWH_EmployeeCode2: TStringField;
AdoQry_HeadInvBilltaxrate: TFloatField;
AdoQry_HeadMpsSale: TIntegerField;
AdoQry_HeadopBill: TIntegerField;
AdoQry_HeadSysBill: TIntegerField;
AdoQry_HeadOldInvBillNo: TStringField;
AdoQry_HeadPriceAdjustBill: TIntegerField;
AdoQry_HeadWipWaster: TIntegerField;
AdoQry_HeadAmountAdjust: TIntegerField;
AdoQry_HeadShipType: TIntegerField;
AdoQry_HeadShipAddresSCode: TStringField;
AdoQry_HeadShipModeCode: TStringField;
AdoQry_HeadSaleEmployeeCode: TStringField;
AdoQry_HeadPayTermCode: TStringField;
AdoQry_HeadInvoiceNo: TStringField;
AdoQry_HeadRemArk: TStringField;
AdoQry_HeadRemArk1: TStringField;
AdoQry_HeadTotalInvBillAmount: TFloatField;
AdoQry_HeadTotalInvBillNoTaxAmount: TFloatField;
AdoQry_HeadTotalInvBillnoTaxAmountc: TFloatField;
AdoQry_HeadTotalInvBillAmountc: TFloatField;
AdoQry_HeadCustomerName: TStringField;
AdoQry_HeadSaleTypeName: TStringField;
AdoQry_HeadCustomerFalg: TStringField;
AdoQry_HeadDeptName: TStringField;
AdoQry_HeadDeptFalg: TStringField;
AdoQry_HeadWhName: TStringField;
AdoQry_HeadWhPositionName: TStringField;
AdoQry_HeadEmployeeName: TStringField;
AdoQry_HeadEmployeeFalg: TStringField;
AdoQry_HeadCurrencyName: TStringField;
AdoQry_HeadCurrencyFalg: TStringField;
AdoQry_HeadSaleTermName: TStringField;
AdoQry_HeadSaleTermFalg: TStringField;
AdoQry_HeadCreateEmployeeName: TStringField;
AdoQry_HeadEmployeeFalg1: TStringField;
AdoQry_HeadShipModeName: TStringField;
AdoQry_HeadShipModeFalg: TStringField;
AdoQry_HeadShipAddressName: TStringField;
AdoQry_HeadShipAddressFalg: TStringField;
procedure Act_ModifyExecute(Sender: TObject);
procedure Act_DeleteExecute(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Act_LookExecute(Sender: TObject);
private
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
{ Public declarations }
end;
var
Frm_Sal_Enter_OtherShipOrderH: TFrm_Sal_Enter_OtherShipOrderH;
implementation
uses Sal_Enter_OtherShipOrder, Sys_Global;
{$R *.DFM}
{ TFrm_Sal_Enter_ShipOrderH }
procedure TFrm_Sal_Enter_OtherShipOrderH.InitForm(AdOConnection: TAdOConnection;
ReadOnly: Boolean);
begin
Application.ProcessMessages;
inherited;
If (ReadOnly) Then
begin
Act_New.Enabled:=False;
Act_New.Visible:=False;
Act_Modify.Enabled:=False;
Act_Modify.Visible:=False;
Pnl_Title.Caption:='无订单销售发货';
Frm_Sal_Enter_OtherShipOrderH.Caption:='无订单销售发货';
end
Else
begin
Pnl_Title.Caption:='无订单销售发货';
Frm_Sal_Enter_OtherShipOrderH.Caption:='无订单销售发货';
end;
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 as SaleTermName, '
+' 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 ) ';
ConditionUserDefine := ' exists (select * from InvOutBillLine where InvOutBillLIne.InvBillId=InvOutBill.InvBillId ) '
+' and ShipType=1 '
+' and BillTypeCode in (''0205'',''0206'') ';
Condition:=' InvBillWhChCk=0 ';
OrderByFields:=' CustomerCode,InvBillDate,InvBillNo';
GetData;
Frm_Entry_Body:=TFrm_Sal_Enter_OtherShipOrder.Create(Application);
end;
procedure TFrm_Sal_Enter_OtherShipOrderH.Act_ModifyExecute(Sender: TObject);
begin
if AdoQry_Head.RecordCount=0 then exit;
if AdoQry_Head.fieldbyname('InvBillWhChCk').AsInteger=1 then
begin
DispInfo('已审核的销售发货单不可以修改!',3);
Abort;
end;
inherited;
end;
procedure TFrm_Sal_Enter_OtherShipOrderH.Act_DeleteExecute(Sender: TObject);
var
SqlText,BookmArk:String;
begin
if AdoQry_Head.RecordCount=0 then exit;
If (DispInfo('确认真的要删除这张销售发货单吗?',2)='y') Then
begin
if AdoQry_Head.fieldbyname('InvBillWhChCk').AsInteger=1 then
begin
DispInfo('已审核的销售发货单不可以删除!',3);
Abort;
end;
BookmArk:= AdoQry_Head.BookmArk;
try
DbConnect.beginTrans;
// saveShipOrderHistory(dbconnect,AdoQry_Head.fieldbyname('InvBillNo').AsString,userCode,2);
SQlText:='Select * From InvOutBillLine '
+' Join InvOutBill on InvOutBillLine.InvBillId = InvOutBill.InvBillId '
+' and InvBillNo='''+AdoQry_Head.fieldbyname('InvBillNo').AsString+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.Open;
AdoQry_Tmp.First;
While Not AdoQry_Tmp.Eof Do
begin
// saveShipOrderLineHistory(dbconnect,AdoQry_Head.fieldbyname('InvBillNo').AsString,AdoQry_Tmp.fieldbyname('Shiplineno').asinteger,userCode,2);
AdoQry_Tmp.Next;
end;
SqlText:=' Delete InvOutBillLine Where InvBillId ='+AdoQry_Tmp.fieldbyname('InvBillId').AsString
+' Delete InvOutBill Where InvBillNo='''+AdoQry_Head.fieldbyname('InvBillNo').AsString+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := SqlText;
AdoQry_Tmp.ExecSQL;
DbConnect.CommitTrans;
except
DbConnect.RollBackTrans;
Abort;
end;
getdata;
try
if not AdoQry_Head.Eof then
AdoQry_Head.BookmArk:=BookmArk;
except
end;
end;
inherited;
end;
procedure TFrm_Sal_Enter_OtherShipOrderH.FormActivate(Sender: TObject);
begin
inherited;
self.Windowstate :=wsMaximized;
end;
procedure TFrm_Sal_Enter_OtherShipOrderH.Act_LookExecute(Sender: TObject);
begin
if AdoQry_Head.RecordCount=0 then exit;
inherited;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -