📄 sal_enter_saleorder.pas
字号:
+' Edt_SaleEmployeeCode, Edt_CurrencyCode, Edt_TaxRate_Percent,'
+' Edt_ShipModeCode, Edt_ShipAddresSCode, Edt_PayTermCode,'
+' Edt_RemArk,Edt_RemArk1,';
end
Else If Pos('Edit',CurrentStatus)>0 Then
begin
AnswerStatus:='PArtEdit';
EnableControls:='edt_CustomerPmno,edt_referenceno,' ;
end;
end;
procedure TFrm_Sal_Enter_SaleOrder.FormCreate(Sender: TObject);
begin
inherited;
// ExtendCaption:=False;
Frm_Sal_Enter_SaleOrder_D:=TFrm_Sal_Enter_SaleOrder_D.Create(Self);
Frm_Entry_Detail:=Frm_Sal_Enter_SaleOrder_D;
end;
procedure TFrm_Sal_Enter_SaleOrder.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_SaleOrder.Edt_PayTermCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
If key=120 Then
CommOnHint(Sender,AdoQry_Tmp,'PayTermName','付款条款名称','PayTermCode',
'付款条款代号',' PayTerm ');
//Select PayTermCode,SaleTermName from SaleTerm
end;
procedure TFrm_Sal_Enter_SaleOrder.Edt_ShipModeCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
If key=120 Then
CommOnHint(Sender,AdoQry_Tmp,'ShipModeName','发货方式名称','ShipModeCode',
'发货方式代号',' ShipMode ');
//Select ShipModeCode,ShipModeName from ShipMode
end;
procedure TFrm_Sal_Enter_SaleOrder.Edt_CustomerCodeExit(Sender: TObject);
begin
inherited;
If Trim(Edt_CustomerCode.Text)<>'' Then
CustomerCodeCheck(sender);
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text:=' Select CustomerCode,CustomerName from Customer '
+' where CustomerCode= '''+Edt_CustomerCode.Text+''' ';
AdoQry_Tmp.Open;
Edt_CustomerName.Text := AdoQry_Tmp.fieldbyname('CustomerName').AsString;
if Trim(Edt_CustomerCode.Text) <>Enter_CustomerCode then
begin
GetCustomerItem(Edt_CustomerCode.Text);
Enter_CustomerCode:= Trim(Edt_CustomerCode.Text);
end;
end;
procedure TFrm_Sal_Enter_SaleOrder.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_SaleOrder.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;
ExchRate := 1;
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_SaleOrder.Edt_TotalNoTaxAmountExit(
Sender: TObject);
begin
inherited;
{ try
Edt_TotalNoTaxAmount.Text:=FloatToStr(Strtofloat(Edt_TotalNoTaxAmount.Text));
except
DispInfo('金额输入错误!',3);
TWincontrol(Sender).SetFocus;
Abort;
end;
If Strtofloat(Edt_TotalNoTaxAmount.Text)<=0 Then
begin
DispInfo('未税金额总额不能小于或等于0!',3);
TWincontrol(Sender).SetFocus;
Abort;
end;}
end;
procedure TFrm_Sal_Enter_SaleOrder.Edt_TotalTaxAmountExit(Sender: TObject);
begin
inherited;
{try
Edt_TotalTaxAmount.Text:=FloatToStr(Strtofloat(Edt_TotalTaxAmount.Text));
except
DispInfo('金额输入错误!',3);
TWincontrol(Sender).SetFocus;
Abort;
end;
If Strtofloat(Edt_TotalTaxAmount.Text)<=0 Then
begin
DispInfo('含税金额总额不能小于或等于0!',3);
TWincontrol(Sender).SetFocus;
Abort;
end;}
end;
procedure TFrm_Sal_Enter_SaleOrder.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_SaleOrder_P:=TFrm_Sal_Enter_SaleOrder_P.Create(Application);
Frm_Sal_Enter_SaleOrder_P.SetDBConnect(DbConnect);
Frm_Sal_Enter_SaleOrder_P.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
Frm_Sal_Enter_SaleOrder_P.GetHeadData(AdoQry_Body,Trim(Edt_SloNo.Text),'Preview');
Frm_Sal_Enter_SaleOrder_P:=Nil;
end;
procedure TFrm_Sal_Enter_SaleOrder.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_SaleOrder_P:=TFrm_Sal_Enter_SaleOrder_P.Create(Application);
Frm_Sal_Enter_SaleOrder_P.SetDBConnect(DbConnect);
Frm_Sal_Enter_SaleOrder_P.SetSysParam(UserCode,ModuleCode,MenuId,DateTimeToStr(Now));
Frm_Sal_Enter_SaleOrder_P.GetHeadData(AdoQry_Body,Trim(Edt_SloNo.Text),'Print');
Frm_Sal_Enter_SaleOrder_P:=Nil;
end;
procedure TFrm_Sal_Enter_SaleOrder.Act_DeleteLineExecute(Sender: TObject);
var
BookMArk:String;
begin
// inherited;
if (not AdoQry_Body.IsEmpty)and
(DispInfo(' 真的删除当前记录吗? ',2)='y') then
begin
DeletedSloLine := DeletedSloLine+','+QuotedStr(AdoQry_Body.fieldbyname('SloNo').AsString
+':'+AdoQry_Body.fieldbyname('SloLineNo').AsString);
AdoQry_Body.Delete;
end;
If (AdoQry_Body.RecordCount>0) and (Status='Add') Then
begin
BookmArk:=AdoQry_Body.BookmArk;
AdoQry_Body.First;
While Not AdoQry_Body.Eof Do
begin
AdoQry_Body.Edit;
AdoQry_Body.fieldbyname('SloLineNo').AsInteger:=AdoQry_Body.RecNo;
AdoQry_Body.Post;
AdoQry_Body.Next;
end;
AdoQry_Body.BookmArk:=BookMArk;
end;
If AdoQry_Body.RecordCount=0 then
begin
Edt_TaxRate_Percent.Enabled := True;
Edt_CurrencyCode.Enabled:=True;
end;
end;
procedure TFrm_Sal_Enter_SaleOrder.Edt_SloNoExit(Sender: TObject);
begin
inherited;
if Trim(Edt_SloNo.Text)='' then
begin
DispInfo('单号不能为空!',3);
Edt_SloNo.SetFocus;
abort;
end;
end;
procedure TFrm_Sal_Enter_SaleOrder.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_SaleOrder.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_SaleOrder.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 ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -