📄 sal_enter_backshiporder.pas
字号:
While Not AdoQry_Body.Eof Do
begin
AdoQry_Body.Edit;
AdoQry_Body.fieldbyname('InvBillLineNo').AsInteger:=AdoQry_Body.RecNo;
AdoQry_Body.Post;
AdoQry_Body.Next;
end;
AdoQry_Body.BookmArk:=BookMArk;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Act_PreviewExecute(Sender: TObject);
begin
if Act_Save.Enabled = True then
begin
DispInfo('没有保存数据,不能预览!',1);
Abort;
end;
If AdoQry_Body.RecordCount=0 Then
begin
DispInfo('没有行数据,不能预览!',1);
Abort;
end;
Frm_Sal_Enter_BackShipOrder_P:=TFrm_Sal_Enter_BackShipOrder_P.Create(Application);
Frm_Sal_Enter_BackShipOrder_P.SetDBConnect(DbConnect);
Frm_Sal_Enter_BackShipOrder_P.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
Frm_Sal_Enter_BackShipOrder_P.GetHeadData(AdoQry_Body,Trim(Edt_InvBillNo.Text),'Preview');
Frm_Sal_Enter_BackShipOrder_P:=Nil;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Act_PrintExecute(Sender: TObject);
begin
if Act_Save.Enabled = True then
begin
DispInfo('没有保存数据,不能打印!',1);
Abort;
end;
If AdoQry_Body.RecordCount=0 Then
begin
DispInfo('没有行数据,不能打印!',1);
Abort;
end;
Frm_Sal_Enter_BackShipOrder_P:=TFrm_Sal_Enter_BackShipOrder_P.Create(Application);
Frm_Sal_Enter_BackShipOrder_P.SetDBConnect(DbConnect);
Frm_Sal_Enter_BackShipOrder_P.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
Frm_Sal_Enter_BackShipOrder_P.GetHeadData(AdoQry_Body,Trim(Edt_InvBillNo.Text),'Print');
Frm_Sal_Enter_BackShipOrder_P:=Nil;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Act_NewExecute(Sender: TObject);
begin
{ if Frm_Sal_Enter_ShipOrder_C1<>nil then
Frm_Sal_Enter_ShipOrder_C1:=TFrm_Sal_Enter_ShipOrder_C1.Create(Application);
Frm_Sal_Enter_ShipOrder_C1.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
Frm_Sal_Enter_ShipOrder_C1.InitForm(DbConnect,False);}
inherited;
end;
procedure TFrm_Sal_Enter_BackShipOrder.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
Frm_Sal_Enter_BackShipOrder:=nil;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_CurrencyCodeExit(
Sender: TObject);
begin
inherited;
IF Trim(Edt_CurrencyCode.Text)<>'' Then
CurrencyCodeCheck(Sender);
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select CurrencyCode,CurrencyName,IsMaster from Currency '
+' where CurrencyCode= '''+Edt_CurrencyCode.Text+''' ';
AdoQry_Tmp.Open;
Edt_CurrencyName.Text := AdoQry_Tmp.fieldbyname('CurrencyName').AsString;
If AdoQry_Tmp.fieldbyname('IsMaster').AsInteger=1 then Exit;{如果是本位币则不用判断是否有外币汇率资料}
ExecuteSql(AdoQry_Tmp,' select * from ExchRate '
+ ' where CurrencyCode= '+QuotedStr(Edt_CurrencyCode.Text)
+ ' and ExchMonth= '+QuotedStr(copy(Medt_CreateDate.Text,1,7)),0);
if AdoQry_tmp.RecordCount=0 then
begin
DispInfo('没有该货币'+Copy(Medt_CreateDate.Text,1,7)+'月的外币汇率!',3);
If Edt_CurrencyCode.CanFocus then Edt_CurrencyCode.SetFocus;
Abort;
end;
ExchRate := AdoQry_Tmp.fieldbyname('ExchRate').AsFloat;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_SaleEmployeeCodeExit(
Sender: TObject);
begin
inherited;
if Edt_SaleEmployeeCode.Text <>'' then
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select EmployeeCode,EmployeeName from Employee '
+' where EmployeeCode= '''+Edt_SaleEmployeeCode.Text+''' ';
AdoQry_Tmp.Open;
if not AdoQry_Tmp.Eof then
begin
Edt_SaleEmployeeName.Text := AdoQry_Tmp.fieldbyname('EmployeeName').AsString;
end
else
begin
DispInfo('销售员代码错误,请重新输入',1);
TWinControl(Sender).SetFocus;
Abort;
end;
end
else
Edt_SaleEmployeeName.Text:='';
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_CustomerCodeExit(
Sender: TObject);
begin
inherited;
if Assigned(Activecontrol) then
CustomerCodeCheck(Edt_CustomerCode);
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select CustomerCode,CustomerName from Customer '
+' where CustomerCode= '''+Edt_CustomerCode.Text+''' ';
AdoQry_Tmp.Open;
lab_CustomerName.Text := AdoQry_Tmp.fieldbyname('CustomerName').AsString;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_SaleDeptCodeExit(
Sender: TObject);
begin
inherited;
If Trim(Edt_SaleDeptCode.Text )<>'' then
begin
DeptCodeCheck(sender);
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select DeptCode,DeptName from Dept '
+' where DeptCode= '''+Edt_SaleDeptCode.Text+''' ';
AdoQry_Tmp.Open;
Edt_SaleDeptName.Text := AdoQry_Tmp.fieldbyname('DeptName').AsString;
end
else
Edt_SaleDeptName.Text :='';
end;
procedure TFrm_Sal_Enter_BackShipOrder.Act_InsertLineExecute(
Sender: TObject);
begin
TaxRate_Percent:=Edt_TaxRate_Percent.Text;
CustomerCode:=Edt_CustomerCode.Text;
inherited;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Act_ModifyExecute(Sender: TObject);
begin
TaxRate_Percent:=Edt_TaxRate_Percent.Text;
CustomerCode:=Edt_CustomerCode.Text;
inherited;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_ShipAddresSCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'ShipAddressName','发货地址名称','ShipAddresSCode',
'发货地址代号',' CustomerShipAddress ',' CustomerCode= '''+Edt_CustomerCode.Text+'''');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_PayTermCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'PayTermName','付款条款名称','PayTermCode',
'付款条款代号',' PayTerm ');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_ShipModeCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'ShipModeName','发货方式名称','ShipModeCode',
'发货方式代号',' ShipMode ');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_SaleTypeCodeButtonClick(
Sender: TObject);
begin
inherited;
CommonHint(Sender,AdoQry_Body,'SaleTypeName','销售类型描述','SaleTypeCode','销售类型代码',
'SaleType');
end;
procedure TFrm_Sal_Enter_BackShipOrder.FormActivate(Sender: TObject);
begin
inherited;
act_Save.Enabled:=True;
if not (uppercase(status)='AdD') then
begin
Edt_CustomerCode.Enabled := False;
lab_CustomerName.Enabled :=False;
Edt_WhCode.Enabled := False;
Edt_WhName.Enabled := False;
Edt_WhPositionCode.Enabled := False;
Edt_WhPositionName.Enabled := False;
act_Save.Enabled := False;
end
else
begin
Edt_WhCode.Enabled := True;
Edt_WhPositionCode.Enabled := True;
end;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_WhCodeExit(Sender: TObject);
begin
inherited;
if ActiveControl.Name ='ToolButton4' then exit;
if Trim(Edt_WhCode.Text)='' then exit;
ExecuteSql(AdoQry_Tmp,'Select * from Warehouse '
+' where WhCode='+QuotedStr(Edt_WhCode.Text),0);
if AdoQry_Tmp.RecordCount=0 then
begin
DispInfo('仓库代码错误!',3);
Edt_WhCode.SetFocus;
abort;
end;
Edt_WhName.Text := AdoQry_Tmp.fieldbyname('WhName').AsString;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_WhPositionCodeExit(
Sender: TObject);
begin
inherited;
if ActiveControl.Name ='ToolButton4' then exit;
If ActiveControl.Name ='Edt_WhCode' then exit;
if (Trim(Edt_WhCode.Text)='') and (Trim(Edt_WhPositionCode.Text)='') then exit;
ExecuteSql(AdoQry_Tmp,'Select * from WhPosition '
+' where WhCode='+QuotedStr(Edt_WhCode.Text)
+' and WhPositionCode='+QuotedStr(Edt_WhPositionCode.Text)
+' and WhPositionType=0 '
+' and BackFlushWhP=0 ',0);
if AdoQry_Tmp.RecordCount=0 then
begin
DispInfo('货位代码错误!',3);
Edt_WhPositionCode.SetFocus;
abort;
end;
Edt_WhPositionName.Text := AdoQry_Tmp.fieldbyname('WhPositionName').AsString;
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_WhCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key = 120 then
CommOnHint(Sender,AdoQry_Tmp,'WhName','仓库名称','WhCode',
'仓库代码',' Warehouse ');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_WhCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'WhName','仓库名称','WhCode',
'仓库代码',' Warehouse ');
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_WhPositionCodeKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key<>120 then exit;
if Trim(Edt_WhCode.Text)='' then
begin
DispInfo('请先输入仓库代码!',3);
Edt_WhCode.SetFocus;
Abort;
end
else
CommOnHint(Sender,AdoQry_Tmp,'WhPositionName','货位名称','WhPositionCode',
'货位代码',' WhPosition ',' BackFlushWhP=0 and WhPositionType=0 and WhCode='+Quotedstr(Edt_WhCode.Text));
end;
procedure TFrm_Sal_Enter_BackShipOrder.Edt_WhPositionCodeButtonClick(
Sender: TObject);
begin
inherited;
if Trim(Edt_WhCode.Text)='' then
begin
DispInfo('请先输入仓库代码!',3);
Edt_WhCode.SetFocus;
Abort;
end
else
CommOnHint(Sender,AdoQry_Tmp,'WhPositionName','货位名称','WhPositionCode',
'货位代码',' WhPosition ',' BackFlushWhP=0 and WhPositionType=0 and WhCode='+Quotedstr(Edt_WhCode.Text));
end;
procedure TFrm_Sal_Enter_BackShipOrder.AdoQry_BodyInvBillQtyGetText(
Sender: TField; var Text: String; DisplayText: Boolean);
begin
inherited;
Text := FloatToStr(-AdoQry_Body.fieldbyname('InvBillQty').AsFloat);
end;
procedure TFrm_Sal_Enter_BackShipOrder.AdoQry_BodyInvBillAmountGetText(
Sender: TField; var Text: String; DisplayText: Boolean);
begin
inherited;
Text := FloatToStr(-AdoQry_Body.fieldbyname('InvBillAmount').AsFloat);
end;
procedure TFrm_Sal_Enter_BackShipOrder.AdoQry_BodyInvBillNoTaxAmountGetText(
Sender: TField; var Text: String; DisplayText: Boolean);
begin
inherited;
Text := FloatToStr(-AdoQry_Body.fieldbyname('InvBillNoTaxAmount').AsFloat);
end;
procedure TFrm_Sal_Enter_BackShipOrder.AdoQry_BodyDiSCountAmountGetText(
Sender: TField; var Text: String; DisplayText: Boolean);
begin
inherited;
Text := FloatToStr(-AdoQry_Body.fieldbyname('DiSCountAmount').AsFloat);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -