📄 sal_enter_backshiporder.pas
字号:
Edt_ShipModeName.Text:=fieldbyname('ShipModeName').AsString;
Edt_SaleTermName.Text:=fieldbyname('PayTermName').AsString;
Edt_ShipAddressName.Text:=fieldbyname('ShipAddressName').AsString;
SqlText:=' Select InvOutBill.InvBillNo,'
+' InvOutBillLine.InvBillId , '
+' InvOutBillLine.BatchNo, '
+' InvOutBillLine.BillLineRemArk , '
+' InvOutBillLine.InvBillLineNo , '
+' InvOutBillLine.ItemCode,InvOutBillLine.InvBillQty, '
+' InvOutBillLine.InvBillPrice,InvOutBillLine.InvBillPriceC, '
+' InvOutBillLine.InvBillNoTaxPrice,InvOutBillLine.InvBillNoTaxPriceC, '
+' InvOutBillLine.InvBillAmount,InvOutBillLIne.InvBillAmountC, '
+' InvOutBillLine.InvBillNoTaxAmount,InvOutBillLine.InvBillNoTaxAmountC,'
+' InvOutBillLine.DiSCountRate,InvOutBillLine.DiSCountAmount, '
+' InvOutBillLine.SloNo,InvOutBillLine.SloLineNo, '
+' Item.ItemName,Uom.UomName,'
+' Warehouse.WhName,WhPosition.WhPositionName '
+' From InvOutBillLine '
+' Join InvOutBill on InvOutBillLine.InvBillId=InvOutBill.InvBillId '
+' Left Join Item '
+' On InvOutBillLine.ItemCode=Item.ItemCode '
+' Left Join Uom '
+' On Item.UomCode=Uom.UomCode '
+' Left Join Warehouse '
+' On Warehouse.WhCode=InvOutBill.WhCode '
+' left Join WhPosition '
+' On (InvOutBill.WhCode=WhPosition.WhCode '
+' And InvOutBill.WhPositionCode=WhPosition.WhPositionCode) '
+' where InvBillNo= '''+fieldbyname('InvBillNo').AsString+''' ' ;
AdoQry_Body.Close;
AdoQry_Body.SQL.Text:=SqlText;
AdoQry_Body.Open;
end
end
else
begin
If FormStatus='Query' then
begin
CurrentFormStatus:='Query';
With AdoQry_Head do
begin
Edt_SaleDeptName.Text:=fieldbyname('DeptName').AsString;
Edt_SaleEmployeeName.Text:=fieldbyname('EmployeeName').AsString;
Edt_CurrencyName.Text:=fieldbyname('CurrencyName').AsString;
Edt_ShipModeName.Text:=fieldbyname('ShipModeName').AsString;
Edt_SaleTermName.Text:=fieldbyname('PayTermName').AsString;
Edt_ShipAddressName.Text:=fieldbyname('ShipAddressName').AsString;
LAb_CustomerName.Text:=fieldbyname('CustomerName').AsString;
Edt_InvBillNo.Text :=fieldbyname('InvBillNo').AsString;
Edt_WhCode.Text := fieldbyname('WhCode').AsString;
Edt_WhName.Text := fieldbyname('WhName').AsString;
Edt_WhPositionCode.Text := fieldbyname('WhPositionCode').AsString;
Edt_WhPositionName.Text := fieldbyname('WhPositionName').AsString;
Edt_CustomerCode.Text:=fieldbyname('CustomerCode').AsString;
Edt_CustomerName.Caption:=fieldbyname('CustomerName').AsString;
MEdt_CreateDate.Text:=Formatdatetime('yyyy.mm.dd',fieldbyname('InvBillDate').asdatetime);
Edt_SaleDeptCode.Text:=fieldbyname('DeptCode').AsString;
Edt_SaleTypeCode.Text:=fieldbyname('SaleType').AsString;
Edt_SaleTypeName.Text:=fieldbyname('SaleTypeName').AsString;
Edt_SaleEmployeeCode.Text:=fieldbyname('SaleEmployeeCode').AsString;
Edt_CurrencyCode.Text:=fieldbyname('CurrencyCode').AsString;
Edt_TaxRate_Percent.Text:=fieldbyname('InvBillTaxRate').AsString;
Edt_ShipModeCode.Text:=fieldbyname('ShipModeCode').AsString;
Edt_ShipAddresSCode.Text:=fieldbyname('ShipAddresSCode').AsString;
Edt_PayTermCode.Text:=fieldbyname('PayTermCode').AsString;
Edt_RemArk.Text:=fieldbyname('RemArk').AsString;
Edt_RemArk1.Text:=fieldbyname('RemArk1').AsString;
Edt_TotalNoTaxAmount.Text:=fieldbyname('TotalInvBillNoTaxAmount').AsString;
Edt_TotalTaxAmount.Text:=fieldbyname('TotalInvBillAmount').AsString;
Lab_SaleDeptName.Caption:=fieldbyname('DeptName').AsString;
Lab_SaleEmployeeName.Caption:=fieldbyname('EmployeeName').AsString;
Lab_CurrencyName.Caption:=fieldbyname('CurrencyName').AsString;
Lab_ShipModeName.Caption:=fieldbyname('ShipModeName').AsString;
Lab_SaleTermName.Caption:=fieldbyname('PayTermName').AsString;
Lab_ShipAddressName.Caption:=fieldbyname('ShipAddressName').AsString;
SqlText:=' Select InvOutBill.InvBillNo, '
+' InvOutBillLine.InvBillId , '
+' InvOutBillLine.InvBillLineNo , '
+' InvOutBillLine.BatchNo, '
+' InvOutBillLine.BillLineRemArk , '
+' InvOutBillLine.ItemCode,InvOutBillLine.InvBillQty, '
+' InvOutBillLine.InvBillPrice,InvOutBillLine.InvBillPriceC, '
+' InvOutBillLine.InvBillNoTaxPrice,InvOutBillLine.InvBillNoTaxPriceC, '
+' InvOutBillLine.InvBillAmount as InvBillAmount,InvOutBillLIne.InvBillAmountC, '
+' InvOutBillLine.InvBillNoTaxAmount as InvBillNoTAxAmount,InvOutBillLine.InvBillNoTaxAmountC,'
+' InvOutBillLine.DiSCountRate,InvOutBillLine.DiSCountAmount, '
+' InvOutBillLine.SloNo,InvOutBillLine.SloLineNo, '
+' Item.ItemName,Uom.UomName,'
+' Warehouse.WhName,WhPosition.WhPositionName '
+' From InvOutBillLine '
+' Join InvOutBill on InvOutBillLine.InvBillId=InvOutBill.InvBillId '
+' Left Join Item '
+' On InvOutBillLine.ItemCode=Item.ItemCode '
+' Left Join Uom '
+' On Item.UomCode=Uom.UomCode '
+' Left Join Warehouse '
+' On Warehouse.WhCode=InvOutBill.WhCode '
+' left Join WhPosition '
+' On (InvOutBill.WhCode=WhPosition.WhCode '
+' And InvOutBill.WhPositionCode=WhPosition.WhPositionCode) '
+' where InvBillNo= '''+fieldbyname('InvBillNo').AsString+''' ' ;
AdoQry_Body.Close;
AdoQry_Body.SQL.Text:=SqlText;
AdoQry_Body.Open;
end ;
end;
end;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.FormCreate(Sender: TObject);
begin
inherited;
Frm_Sal_Enter_BackShipOrder_D:=TFrm_Sal_Enter_BackShipOrder_D.Create(Self);
Frm_Entry_Detail:=Frm_Sal_Enter_BackShipOrder_D;
end;
procedure TFrm_Sal_Enter_BackShipOrder.InitControls;
begin
If Status<>'Add' then
begin
// CurrentFormStatus:='PArtEdit';
SetFocus_Control:=Edt_CustomerCode;
end
Else
begin
// CurrentFormStatus:='Add';
SetFocus_Control:=Edt_InvBillNo;
end;
inherited;
Edt_ShipAddresSCode.Enabled := False;
Edt_PayTermCode.Enabled := False;
Edt_ShipModeCode.Enabled := False;
Edt_CurrencyCode.Enabled := False;
Edt_SaleTypeCode.Enabled := False;
Edt_SaleDeptCode.Enabled := False;
Edt_SaleDeptName.Enabled :=False;
Edt_WhCode.Enabled := False;
Edt_WhName.Enabled := False;
Edt_WhPositionCode.Enabled := False;
Edt_WhPositionName.Enabled := False;
Edt_ShipAddressName.Enabled :=False;
Edt_SaleEmployeeName.Enabled :=False;
Edt_SaleTermName.Enabled :=False;
Edt_CurrencyName.Enabled :=False;
Edt_SaleTypeName.Enabled :=False;
Edt_ShipModeName.Enabled :=False;
Edt_TotalNoTaxAmount.Enabled :=False;
Edt_TotalTaxAmount.Enabled :=False;
Edt_TaxRate_Percent.Enabled := False;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_SaleTypeCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
If (Key=120) Then
CommonHint(Sender,AdoQry_Body,'SaleTypeName','销售类型描述','SaleTypeCode','销售类型代码',
'SaleType');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_SaleTypeCodeExit(Sender: TObject);
begin
inherited;
If Trim(TExtEdit(Sender).Text)='' Then
begin
{ DispInfo('销售类型代码不能为空!',1);
TWinControl(Sender).SetFocus;
Abort;}
Edt_SaleTypeName.Text :='';
end
else
begin
With AdoQry_Tmp Do
begin
Close;
SQL.clear;
SQL.Add('Select SaleTypeCode,SaleTypeName From SaleType '
+' Where SaleTypeCode='''+TEdit(Sender).Text+'''');
Open;
If Eof Then
begin
DispInfo('销售类型代码错误,请重新输入',1);
TWinControl(Sender).SetFocus;
Abort;
end
else
Edt_SaleTypeName.Text := AdoQry_Tmp.fieldbyname('SaleTypeName').AsString;
end;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_TaxRate_PercentExit(
Sender: TObject);
begin
inherited;
try
Edt_TaxRate_Percent.Text:=FloatToStr(Strtofloat(Edt_TaxRate_Percent.Text));
except
DispInfo('销售税率输入错误!',3);
TWincontrol(Sender).SetFocus;
Abort;
end;
If Strtofloat(Edt_TaxRate_Percent.Text)<=0 Then
begin
DispInfo('销售税率不能小于或等于0!',3);
TWincontrol(Sender).SetFocus;
Abort;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_PayTermCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
If key=120 Then
CommOnHint(Sender,AdoQry_Tmp,'PayTermName','付款条款名称','PayTermCode',
'付款条款代号',' PayTerm ');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_PayTermCodeExit(Sender: TObject);
begin
inherited;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select * from PayTerm where PayTermCode='''+Trim(Edt_PayTermCode.text)+''' ';
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('付款条款输入错误!',3);
Edt_PayTermCode.SetFocus;
Abort;
end
else
Edt_SaleTermName.Text :=AdoQry_Tmp.fieldbyname('PayTermName').AsString;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_ShipModeCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
If key=120 Then
CommOnHint(Sender,AdoQry_Tmp,'ShipModeName','发货方式名称','ShipModeCode',
'发货方式代号',' ShipMode ');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_ShipModeCodeExit(Sender: TObject);
begin
inherited;
If Trim(Edt_ShipModeCode.text)='' then
begin
{ DispInfo('发货方式不能为空!',3);
Edt_ShipModeCode.SetFocus;
Abort;}
Edt_ShipModeName.Text := '';
end
else
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select * From ShipMode '
+' Where ShipModeCode='''+Trim(Edt_ShipModeCode.text)+''' ';
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('发货方式输入错误!',3);
Edt_ShipModeCode.SetFocus;
Abort;
end
else
Edt_ShipModeName.Text:=AdoQry_Tmp.fieldbyname('ShipModeName').AsString ;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_ShipAddresSCodeKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
If key=120 Then
CommOnHint(Sender,AdoQry_Tmp,'ShipAddressName','发货地址名称','ShipAddresSCode',
'发货地址代号',' CustomerShipAddress ',' CustomerCode= '''+Edt_CustomerCode.Text+'''');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_ShipAddresSCodeExit(
Sender: TObject);
begin
inherited;
if Trim(Edt_CustomerCode.Text) <> '' then
begin
If Trim(Edt_ShipAddresSCode.text)='' then
begin
// DispInfo('发货地址不能为空!',3);
// Edt_ShipAddresSCode.SetFocus;
// Abort;
Edt_ShipAddressName.Text := '' ;
end
else
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select * from CustomerShipAddress '
+' where (CustomerCode='''+Trim(Edt_CustomerCode.text)+''') '
+' And (ShipAddresSCode='''+Trim(Edt_ShipAddresSCode.text)+''')' ;
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof then
begin
DispInfo('发货地址与客户不匹配!',3);
Edt_ShipAddresSCode.SetFocus;
Abort;
end;
Edt_ShipAddressName.Text := Lab_ShipAddressName.Caption ;
end;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Act_SaveExecute(Sender: TObject);
var
SqlText:String;
I:integer;
InvBillId : Integer;
begin
Edt_WhCode.OnExit(Edt_WhCode);
Edt_WhPositionCode.OnExit(edt_WhPositionCode);
if (CurrentFormStatus='Add') and (CheckAllTypeOrderNoSet(DbConnect,4)) then
Edt_InvBillNo.Text := GetAllTypeOrderNo(DbConnect,4);
// else
if (CurrentFormStatus='Add') then
begin
if (Edt_InvBillNo.Text<>'') then
begin
SqlText:= 'Select InvBillNo From InvOutBill Where InvBillNo='''+Edt_InvBillNo.Text+'''';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=SqlText;
AdoQry_Tmp.Open;
If not AdoQry_Tmp.Eof then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -