ar_enter_nogatherinvoice_d.pas
来自「一个MRPII系统源代码版本」· PAS 代码 · 共 942 行 · 第 1/3 页
PAS
942 行
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;
Edt_ExchRate.Enabled := True;
If AdoQry_Tmp.fieldbyname('IsMaster').AsInteger=1 then
begin
Edt_ExchRate.Text := '1.0';
Edt_ExchRate.Enabled := False;
end {如果是本位币则不用判断是否有外币汇率资料}
else
begin
ExecuteSql(AdoQry_Tmp,' select * from ExchRate '
+ ' where CurrencyCode= '+QuotedStr(Edt_CurrencyCode.Text)
+ ' and ExchMonth= '+QuotedStr(copy(Medt_InvoiceDate.Text,1,7)),0);
if AdoQry_tmp.RecordCount=0 then
begin
If Trim(Edt_ExchRate.Text)='' then
begin
DispInfo('没有该货币'+Copy(Medt_InvoiceDate.Text,1,7)+'月的外币汇率!',3);
If Edt_ExchRate.CanFocus then Edt_ExchRate.SetFocus;
Abort;
end ;
Abort;
end;
Edt_ExchRate.Text := AdoQry_Tmp.fieldbyname('ExchRate').AsString;
end;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.edt_BtCodeButtonClick(Sender: TObject);
begin
inherited;
CommonHint(Sender,AdoQry_Tmp,'BalanceTypeName','结算方式名称','BalanceTypeCode','结算方式代码','BalanceType');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.edt_BtCodeChange(Sender: TObject);
begin
inherited;
btn_ok.Enabled:=True;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.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_Ar_Enter_NoGatherInvoice_D.Edt_WhCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'WhName','仓库名称','WhCode',
'仓库代码',' Warehouse ');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_SaleTypeCodeKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
If key = 120 then
CommOnHint(Sender,AdoQry_Tmp,'SaleTypeName','销售类型名称','SaleTypeCode',
'销售类型代码',' SaleType ');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_SaleTypeCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'SaleTypeName','销售类型名称','SaleTypeCode',
'销售类型代码',' SaleType ');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_SaleTypeCodeExit(
Sender: TObject);
begin
inherited;
ExecuteSql(AdoQry_Tmp,'select * from SaleType where SaleTypeCode='+QuotedStr(Edt_SaleTypeCode.Text),0);
Edt_SaleTypeName.Text := AdoQry_Tmp.fieldbyname('SaleTypeName').AsString;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.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_Ar_Enter_NoGatherInvoice_D.Edt_ShipAddresSCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'ShipAddressName','发货地址名称','ShipAddresSCode',
'发货地址代号',' CustomerShipAddress ',' CustomerCode= '''+Edt_CustomerCode.Text+'''');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.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_Ar_Enter_NoGatherInvoice_D.Edt_PayTermCodeExit(
Sender: TObject);
begin
inherited;
If Trim(Edt_PayTermCode.text)='' then
begin
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_PayTermName.Text :=AdoQry_Tmp.fieldbyname('PayTermName').AsString;
end;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.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_Ar_Enter_NoGatherInvoice_D.Edt_PayTermCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'PayTermName','付款条款名称','PayTermCode',
'付款条款代号',' PayTerm ');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_ShipModeCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'ShipModeName','发货方式名称','ShipModeCode',
'发货方式代号',' ShipMode ');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_EdItEmployeeCodeExit(
Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
if Trim(Edt_EdItEmployeeCode.Text)='' then exit;
with AdoQry_Tmp do
begin
Close;
SQL.clear;
SQL.Add('Select EmployeeCode,EmployeeName From Employee Where EmployeeCode='''+TEdit(Sender).Text+'''');
Open;
if eof then
begin
DispInfo('该人员代码不存在!',1);
if TWinControl(Sender).CanFocus then
TWinControl(Sender).SetFocus;
exit;
end;
edt_EdItEmployeeName.Text:=fieldbyname('EmployeeName').asstring;
end;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.btn_okClick(Sender: TObject);
begin
if Add then
begin
if Trim(Edt_CustomerCode.Text)='' then
begin
DispInfo('销售客户不能为空!',3);
Edt_CustomerCode.SetFocus;
ModalResult := MrNone;
abort;
end;
If Trim(Edt_CurrencyCode.Text)='' then
begin
DispInfo('货币代码不能为空!',3);
Edt_CurrencyCode.SetFocus;
ModalResult := MrNone;
abort;
end;
Edt_CurrencyCode.OnExit(Edt_CurrencyCode);
If Trim(Edt_InvoiceNo.Text)='' then
begin
DispInfo('发票号不能为空!',3);
Edt_InvoiceNo.SetFocus;
ModalResult := MrNone;
abort;
end;
ExecuteSql(AdoQry_Tmp,'select * from sa_SaleInvoice where Invoiceno='+quotedStr(Trim(Edt_InvoiceNo.Text)),0);
if AdoQry_tmp.RecordCount>0 then
begin
DispInfo('发票号重复!',3);
Edt_InvoiceNo.SetFocus;
ModalResult := MrNone;
abort;
end;
end;
If StrToDate(Medt_InvoiceDate.Text)>StrToDate(FormatDateTime('yyyy.mm.dd',StrToDateTime(GetServerDateTime(dbconnect)))) then
begin
DispInfo('发票日期必须小于等于当前日期!',3);
MEdt_InvoiceDate.SetFocus;
abort;
end;
{ if StrtoFloat(Edt_TotalTaxAmount.Text)<=StrToFloat(Edt_CancelAmount.Text) then
begin
DispInfo('发票金额必须大于已核销金额!',3);
Edt_TotalTaxAmount.SetFocus;
ModalResult := MrNone;
abort;
end;
} Edt_TotalTaxAmount.OnExit(Edt_TotalTaxAmount);
inherited;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_TotalTaxAmountExit(
Sender: TObject);
begin
inherited;
FloatCheck(Sender);
If StrToFloat(Trim(Edt_TotalTaxAmount.Text))<=0 then
begin
Edt_CancelAmount.Text := '0';
Edt_CancelAmount.Enabled := False;
end
else Edt_CancelAmount.Enabled := True;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_ExportTypeCodeKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
If Key=Vk_F9 then
CommOnHint(Sender,AdoQry_Tmp,'ExportTradeTypeName','出口贸易类型名称','ExportTradeTypeCode',
'出口贸易类型代码',' Sa_ExportTradeType');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_ExportTypeCodeButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'ExportTradeTypeName','出口贸易类型名称','ExportTradeTypeCode',
'出口贸易类型代码',' Sa_ExportTradeType');
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Edt_ExportTypeCodeExit(
Sender: TObject);
begin
inherited;
if activecontrol.Name='btn_Cancel' then exit;
if Trim(Tlinkedit(sender).text)='' then
begin
Edt_ExportTypeName.Text := '';
exit;
end;
Executesql(AdoQry_tmp,'select * from Sa_ExportTradeType '
+' where ExportTradeTypeCode='+quotedstr(Tlinkedit(sender).text),0);
if AdoQry_tmp.RecordCount=0 then
begin
DispInfo('该出口贸易类型代码不存在!',3);
If TLinkEdit(Sender).CanFocus then TLinkEdit(Sender).SetFocus;
abort;
end;
Edt_ExportTypeName.Text:=AdoQry_tmp.fieldbyname('ExportTradeTypeName').asstring;
end;
procedure TFrm_Ar_Enter_NoGatherInvoice_D.Cmb_InvoiceTypeExit(
Sender: TObject);
begin
inherited;
Edt_ExportTypeCode.Enabled := IIfValue(Cmb_InvoiceType.ItemIndex=2,True,False);
Edt_ExportTypeCode.Text := IIFValue(Cmb_InvoiceType.ItemIndex=2,'',Edt_ExportTypeCode.Text) ;
Edt_ExportTypeName.Text := IIFValue(Cmb_InvoiceType.ItemIndex=2,'',Edt_ExportTypeName.Text);
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?