📄 sal_enter_othershiporder.pas
字号:
Lab_SaleTermName.Caption:=fieldbyname('SaleTermName').AsString;
Lab_ShipAddressName.Caption:=fieldbyname('ShipAddressName').AsString;
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('SaleTermName').AsString;
Edt_ShipAddressName.Text:=fieldbyname('ShipAddressName').AsString;
Edt_CustomerName.text:=fieldbyname('CustomerName').AsString;
Edt_SaleTypeName.text:=fieldbyname('SaleTypeName').AsString;
Edt_RemArk1.text:=fieldbyname('RemArk1').AsString;
SqlText:=' Select InvOutBill.InvBillId,InvOutBill.InvBillNo,InvOutBillLine.InvBillLineNo,InvOutBillLine.SloNo,'
+' InvOutBillLine.SloLineNo,BatchNo, '
+' InvOutBillLine.ItemCode,ItemName, '
+' UomName, '
+' TmpField, '
+' InvBillQty, InvBillPrice,InvBillAmount,InvBillNoTaxPrice,InvBillNoTaxAmount, '
+' InvOutBillLine.DiSCountRate,InvOutBillLine.DiSCountAmount,BillLineRemArk '
+' From InvOutBillLine '
+' Join InvOutBill on InvOutBillLine.InvBillId=InvOutBill.InvBillId '
+' left Join Item '
+' On Item.ItemCode=InvOutBillLine.ItemCode '
+' left Join Uom '
+' On Item.UomCode=Uom.UomCode'
+' where InvBillNo= '''+AdoQry_Head.fieldbyname('InvBillNo').AsString+''' ' ;
AdoQry_Body.Close;
AdoQry_Body.SQL.Text:=SqlText;
AdoQry_Body.Open;
end ;
end;
end;
end;
end;
procedure TFrm_Sal_Enter_OtherShipOrder.FormCreate(Sender: TObject);
begin
inherited;
Frm_Sal_Enter_OtherShipOrder_D:=TFrm_Sal_Enter_OtherShipOrder_D.Create(Self);
Frm_Entry_Detail:=Frm_Sal_Enter_OtherShipOrder_D;
end;
procedure TFrm_Sal_Enter_OtherShipOrder.InitControls;
begin
inherited;
If Status<>'Add' then
begin
CurrentFormStatus:='PArtEdit';
if Edt_CustomerCode.CanFocus then
Edt_CustomerCode.SetFocus;
end
Else
begin
CurrentFormStatus:='Add';
if Edt_ShipNo.CanFocus then
Edt_ShipNo.SetFocus;
end;
if CurrentFormStatus='Add' then
if CheckAllTypeOrderNoSet(DbConnect,3) then
begin
Edt_ShipNo.Text := GetAllTypeOrderNo(DbConnect,3);
Edt_ShipNo.Enabled := False;
if Edt_CustomerCode.CanFocus then
Edt_CustomerCode.SetFocus;
end
else
begin
Edt_ShipNo.Enabled := True;
if Edt_ShipNo.CanFocus then
Edt_ShipNo.SetFocus;
Edt_ShipNo.Text :='';
end;
Edt_CustomerName.Enabled :=False;
Edt_SaleDeptName.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;
Act_InsertLine.Enabled := True;
Act_DeleteLine.Enabled := True;
end;
procedure TFrm_Sal_Enter_OtherShipOrder.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_OtherShipOrder.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_OtherShipOrder.Edt_TaxRate_PercentExit(
Sender: TObject);
begin
inherited;
IF Trim(Edt_TaxRate_Percent.Text)='' Then
Edt_TaxRate_Percent.Text:='17';
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_OtherShipOrder.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_OtherShipOrder.Edt_PayTermCodeExit(Sender: TObject);
begin
inherited;
If Trim(Edt_PayTermCode.text)='' then
begin
{ DispInfo('付款条款不能为空!',3);
Edt_PayTermCode.SetFocus;
Abort;}
end
else
begin
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;
end;
procedure TFrm_Sal_Enter_OtherShipOrder.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_OtherShipOrder.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_OtherShipOrder.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_OtherShipOrder.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
else
Edt_ShipAddressName.Text:=AdoQry_Tmp.fieldbyname('ShipAddressName').AsString ;
end;
end;
end;
procedure TFrm_Sal_Enter_OtherShipOrder.Act_SaveExecute(Sender: TObject);
var
SqlText:String;
I:integer;
InvBillId : Integer;
begin
if (CurrentFormStatus='Add') and (CheckAllTypeOrderNoSet(DbConnect,3)) then
Edt_ShipNo.Text := GetAllTypeOrderNo(DbConnect,3);
IF Trim(Edt_CustomerCode.Text)='' Then
begin
DispInfo('销售客户不能为空!',3);
Edt_CustomerCode.SetFocus;
Abort;
end;
IF Trim(MEdt_CreateDate.Text)='' Then
begin
DispInfo('发货日期不能为空!',3);
MEdt_CreateDate.SetFocus;
Abort;
end;
if not WHClsPeriodCheck(AdoQry_Tmp,Trim(Edt_WhCode.Text),Copy(MEdt_CreateDate.Text,1,7)) then
begin
If Medt_CreateDate.CanFocus then
MEdt_CreateDate.SetFocus;
Abort;
end;
IF Trim(Edt_TaxRate_Percent.Text)='' Then
begin
DispInfo('销售税率不能为空!',3);
Edt_TaxRate_Percent.SetFocus;
Abort;
end;
IF Trim(Edt_CurrencyCode.Text)='' Then
begin
DispInfo('货币不能为空!',3);
Edt_CurrencyCode.SetFocus;
Abort;
end;
IF Trim(Edt_WhCode.Text)='' Then
begin
DispInfo('仓库代码不能为空!',3);
Edt_WhCode.SetFocus;
Abort;
end;
IF Trim(Edt_WhPositionCode.Text)='' Then
begin
DispInfo('货位代码不能为空!',3);
Edt_WhPositionCode.SetFocus;
Abort;
end;
if (CurrentFormStatus='Add') then
if (Edt_ShipNo.Text<>'') then
begin
SqlText:= 'Select InvBillNo From InvOutBill Where InvBillNo='''+Edt_ShipNo.Text+'''';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -