currencyform.pas

来自「功能全面的商业财会系统源码,清晰,很有参考价值.扩展性强.」· PAS 代码 · 共 451 行 · 第 1/2 页

PAS
451
字号
  var Key: Word; Shift: TShiftState);
begin
  if key = VK_Delete then begin
    tblCurrency.Edit;
    tblCurrencyAPGLAccount.AsVariant := null;
  end;
end;

procedure TfrmCurrency.cboGainLossExchangeGLAccountKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key = VK_Delete then begin
    tblCurrency.Edit;
    tblCurrencyGainLossExchangeGLAccount.AsVariant := null;
  end;
end;

procedure TfrmCurrency.cboARGLAccountKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key = VK_Delete then begin
    tblCurrency.Edit;
    tblCurrencyARGLAccount.AsVariant := null;
  end;
end;

procedure TfrmCurrency.btnAPGLAccountClick(Sender: TObject);
var
  aComponent: TComponent;
begin
  screen.cursor := crHourglass;
  aComponent := Application.FindComponent('frmGLAccounts');
  if not Assigned (aComponent) then frmGLAccounts := TfrmGLAccounts.Create(Application);

  aComponent := Application.FindComponent('frmGLAccountsFilter');
  if Assigned (aComponent) then try frmGLAccountsFilter.btnResetClick(sender); except; end;
  frmGLAccounts.mnuFilter.Checked := false;
  frmGLAccounts.qryGLAccnt.Filtered := false;
  frmGLAccounts.tblGLAccnt.Filtered := false;

  if frmGLAccounts.WindowState = wsMinimized then frmGLAccounts.WindowState := wsNormal;
  if frmGLAccounts.visible = true then frmGLAccounts.FormShow(sender)
  else frmGLAccounts.Show;
  if not frmGLAccounts.qryGLAccnt.Locate('GLAccount', tblCurrencyAPGLAccount.value, []) then frmGLAccounts.qryGLAccnt.First;
  screen.cursor := crDefault;
end;

procedure TfrmCurrency.btnARGLAccountClick(Sender: TObject);
var
  aComponent: TComponent;
begin
  screen.cursor := crHourglass;
  aComponent := Application.FindComponent('frmGLAccounts');
  if not Assigned (aComponent) then frmGLAccounts := TfrmGLAccounts.Create(Application);

  aComponent := Application.FindComponent('frmGLAccountsFilter');
  if Assigned (aComponent) then try frmGLAccountsFilter.btnResetClick(sender); except; end;
  frmGLAccounts.mnuFilter.Checked := false;
  frmGLAccounts.qryGLAccnt.Filtered := false;
  frmGLAccounts.tblGLAccnt.Filtered := false;

  if frmGLAccounts.WindowState = wsMinimized then frmGLAccounts.WindowState := wsNormal;
  if frmGLAccounts.visible = true then frmGLAccounts.FormShow(sender)
  else frmGLAccounts.Show;
  if not frmGLAccounts.qryGLAccnt.Locate('GLAccount', tblCurrencyARGLAccount.value, []) then frmGLAccounts.qryGLAccnt.First;
  screen.cursor := crDefault;
end;

procedure TfrmCurrency.btnGainLossExchangeGLAccountClick(Sender: TObject);
var
  aComponent: TComponent;
begin
  screen.cursor := crHourglass;
  aComponent := Application.FindComponent('frmGLAccounts');
  if not Assigned (aComponent) then frmGLAccounts := TfrmGLAccounts.Create(Application);

  aComponent := Application.FindComponent('frmGLAccountsFilter');
  if Assigned (aComponent) then try frmGLAccountsFilter.btnResetClick(sender); except; end;
  frmGLAccounts.mnuFilter.Checked := false;
  frmGLAccounts.qryGLAccnt.Filtered := false;
  frmGLAccounts.tblGLAccnt.Filtered := false;

  if frmGLAccounts.WindowState = wsMinimized then frmGLAccounts.WindowState := wsNormal;
  if frmGLAccounts.visible = true then frmGLAccounts.FormShow(sender)
  else frmGLAccounts.Show;
  if not frmGLAccounts.qryGLAccnt.Locate('GLAccount', tblCurrencyGainLossExchangeGLAccount.value, []) then frmGLAccounts.qryGLAccnt.First;
  screen.cursor := crDefault;
end;

procedure TfrmCurrency.cboAPDiscGLAccountKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key = VK_Delete then begin
    tblCurrency.Edit;
    tblCurrencyAPDiscGLAccount.AsVariant := null;
  end;
end;

procedure TfrmCurrency.cboARDiscGLAccountKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key = VK_Delete then begin
    tblCurrency.Edit;
    tblCurrencyARDiscGLAccount.AsVariant := null;
  end;
end;

procedure TfrmCurrency.btnAPDiscGLAccountClick(Sender: TObject);
var
  aComponent: TComponent;
begin
  screen.cursor := crHourglass;
  aComponent := Application.FindComponent('frmGLAccounts');
  if not Assigned (aComponent) then frmGLAccounts := TfrmGLAccounts.Create(Application);

  aComponent := Application.FindComponent('frmGLAccountsFilter');
  if Assigned (aComponent) then try frmGLAccountsFilter.btnResetClick(sender); except; end;
  frmGLAccounts.mnuFilter.Checked := false;
  frmGLAccounts.qryGLAccnt.Filtered := false;
  frmGLAccounts.tblGLAccnt.Filtered := false;

  if frmGLAccounts.WindowState = wsMinimized then frmGLAccounts.WindowState := wsNormal;
  if frmGLAccounts.visible = true then frmGLAccounts.FormShow(sender)
  else frmGLAccounts.Show;
  if not frmGLAccounts.qryGLAccnt.Locate('GLAccount', tblCurrencyAPDiscGLAccount.value, []) then frmGLAccounts.qryGLAccnt.First;
  screen.cursor := crDefault;
end;

procedure TfrmCurrency.btnARDiscGLAccountClick(Sender: TObject);
var
  aComponent: TComponent;
begin
  screen.cursor := crHourglass;
  aComponent := Application.FindComponent('frmGLAccounts');
  if not Assigned (aComponent) then frmGLAccounts := TfrmGLAccounts.Create(Application);

  aComponent := Application.FindComponent('frmGLAccountsFilter');
  if Assigned (aComponent) then try frmGLAccountsFilter.btnResetClick(sender); except; end;
  frmGLAccounts.mnuFilter.Checked := false;
  frmGLAccounts.qryGLAccnt.Filtered := false;
  frmGLAccounts.tblGLAccnt.Filtered := false;

  if frmGLAccounts.WindowState = wsMinimized then frmGLAccounts.WindowState := wsNormal;
  if frmGLAccounts.visible = true then frmGLAccounts.FormShow(sender)
  else frmGLAccounts.Show;
  if not frmGLAccounts.qryGLAccnt.Locate('GLAccount', tblCurrencyARDiscGLAccount.value, []) then frmGLAccounts.qryGLAccnt.First;
  screen.cursor := crDefault;
end;

procedure TfrmCurrency.cboDfltWriteOffGLAccountKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key = VK_Delete then begin
    tblCurrency.Edit;
    tblCurrencyDfltWriteOffGLAccount.AsVariant := null;
  end;
end;

procedure TfrmCurrency.btnDfltWriteOffGLAccountClick(Sender: TObject);
var
  aComponent: TComponent;
begin
  screen.cursor := crHourglass;
  aComponent := Application.FindComponent('frmGLAccounts');
  if not Assigned (aComponent) then frmGLAccounts := TfrmGLAccounts.Create(Application);

  aComponent := Application.FindComponent('frmGLAccountsFilter');
  if Assigned (aComponent) then try frmGLAccountsFilter.btnResetClick(sender); except; end;
  frmGLAccounts.mnuFilter.Checked := false;
  frmGLAccounts.qryGLAccnt.Filtered := false;
  frmGLAccounts.tblGLAccnt.Filtered := false;

  if frmGLAccounts.WindowState = wsMinimized then frmGLAccounts.WindowState := wsNormal;
  if frmGLAccounts.visible = true then frmGLAccounts.FormShow(sender)
  else frmGLAccounts.Show;
  if not frmGLAccounts.qryGLAccnt.Locate('GLAccount', tblCurrencyDfltWriteOffGLAccount.value, []) then frmGLAccounts.qryGLAccnt.First;
  screen.cursor := crDefault;
end;

procedure TfrmCurrency.tblCurrencyAPGLAccountValidate(Sender: TField);
begin
  if (editAPGLAccount.text <> '') and (dmLookUps.tblGLAccnt.Locate('GLAccount', editAPGLAccount.Text, []) <> true) then raise(Exception.Create('GL Account ' + '''' + editAPGLAccount.Text + '''' + ' not found'));
end;

procedure TfrmCurrency.tblCurrencyGainLossExchangeGLAccountValidate(
  Sender: TField);
begin
  if (editGainLossExchangeGLAccount.text <> '') and (dmLookUps.tblGLAccnt.Locate('GLAccount', editGainLossExchangeGLAccount.Text, []) <> true) then raise(Exception.Create('GL Account ' + '''' + editGainLossExchangeGLAccount.Text + '''' + ' not found'));
end;

procedure TfrmCurrency.tblCurrencyAPDiscGLAccountValidate(Sender: TField);
begin
  if (editAPDiscGLAccount.text <> '') and (dmLookUps.tblGLAccnt.Locate('GLAccount', editAPDiscGLAccount.Text, []) <> true) then raise(Exception.Create('GL Account ' + '''' + editAPDiscGLAccount.Text + '''' + ' not found'));
end;

procedure TfrmCurrency.tblCurrencyARGLAccountValidate(Sender: TField);
begin
  if (editARGLAccount.text <> '') and (dmLookUps.tblGLAccnt.Locate('GLAccount', editARGLAccount.Text, []) <> true) then raise(Exception.Create('GL Account ' + '''' + editARGLAccount.Text + '''' + ' not found'));
end;

procedure TfrmCurrency.tblCurrencyARDiscGLAccountValidate(Sender: TField);
begin
  if (editARDiscGLAccount.text <> '') and (dmLookUps.tblGLAccnt.Locate('GLAccount', editARDiscGLAccount.Text, []) <> true) then raise(Exception.Create('GL Account ' + '''' + editARDiscGLAccount.Text + '''' + ' not found'));
end;

procedure TfrmCurrency.tblCurrencyDfltWriteOffGLAccountValidate(
  Sender: TField);
begin
  if (editDfltWriteOffGLAccount.text <> '') and (dmLookUps.tblGLAccnt.Locate('GLAccount', editDfltWriteOffGLAccount.Text, []) <> true) then raise(Exception.Create('GL Account ' + '''' + editDfltWriteOffGLAccount.Text + '''' + ' not found'));
end;

procedure TfrmCurrency.tblCurrencyBeforePost(DataSet: TDataSet);
begin
  if tblCurrency.state = dsInsert then begin
    qryLastID.close;
    qryLastID.open;
    with qryLastID.Fields[0] do
      if IsNull then tblCurrencyCurrencyID.value := 1
      else tblCurrencyCurrencyID.value := AsInteger + 1;
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?