⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addbankform.~pas

📁 家庭理财系统.rar
💻 ~PAS
字号:
unit AddBankForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB;

type
  TAddBank = class(TForm)
    GroupBox1: TGroupBox;
    ComboBox1: TComboBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    GroupBox2: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Button1: TButton;
    GroupBox3: TGroupBox;
    ComboBox2: TComboBox;
    Button2: TButton;
    GroupBox4: TGroupBox;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  AddBank: TAddBank;

implementation

uses DMForm;

{$R *.dfm}

procedure TAddBank.FormCreate(Sender: TObject);
begin
  with dm.ADOQuery4 do
    begin
      dm.adoquery4.Close ;
      dm.adoquery4.Open ;
      while not dm.adoquery4.Eof do
      begin
        ComboBox2.Items.Add(dm.adoquery4.FieldByName('银行帐号').AsString);
        dm.adoquery4.Next
      end;
    end;
  with dm.ADOQuery3 do
    begin
      dm.adoquery3.Close ;
      dm.adoquery3.Open ;
      while not dm.adoquery3.Eof do
      begin
        ComboBox1.Items.Add(dm.adoquery3.FieldByName('成员姓名').AsString);
        dm.adoquery3.Next
      end;
    end;
end;

procedure TAddBank.Button1Click(Sender: TObject);
var
  tmptype : boolean;
begin
  if ComboBox1.Text = '开户人' then
    messagebox(getactivewindow(),'请选择开户人的姓名!','错误!' ,MB_OK + MB_ICONINFORMATION)
  else if (radiobutton1.Checked = false) and (radiobutton2.Checked = false) then
    messagebox(getactivewindow(),'请选择存款类型!','错误' ,MB_OK + MB_ICONINFORMATION)
  else if edit1.Text = '' then
    messagebox(getactivewindow(),'请填写开户人的身份证号!','错误' ,MB_OK + MB_ICONINFORMATION)
  else if edit2.Text = '' then
    messagebox(getactivewindow(),'请填写存开户的银行!','错误' ,MB_OK + MB_ICONINFORMATION)
  else if edit3.Text = '' then
    messagebox(getactivewindow(),'请填写存款的金额数量!','错误' ,MB_OK + MB_ICONINFORMATION)
  else if edit4.Text = '' then
    messagebox(getactivewindow(),'请天写银行的帐号!','错误' ,MB_OK + MB_ICONINFORMATION)
  else
    begin
      if radiobutton1.Checked then  //是否为活期
        tmptype := false
      else
        tmptype := true;
      DM.User.Close;
      DM.User.SQL.Clear;
      DM.User.SQL.Add('INSERT INTO bank (银行帐号,开户银行,是否定期,存款金额,开户人,开户人身份证) VALUES (:no1,:no2,:no3,:no4,:no5,:no6)');
      DM.User.Parameters.ParamByName('no1').Value := edit4.Text;
      DM.User.Parameters.ParamByName('no2').Value := edit2.Text;
      DM.User.Parameters.ParamByName('no3').Value := tmptype;
      DM.User.Parameters.ParamByName('no4').Value := edit3.Text;
      DM.User.Parameters.ParamByName('no5').Value := ComboBox1.Text;
      DM.User.Parameters.ParamByName('no6').Value := edit1.Text;
      DM.User.Prepared;
      DM.User.ExecSql;
      messagebox(getactivewindow(),'添加银行帐户成功,单击确定返回!','成功添加' ,MB_OK + MB_ICONINFORMATION);
      dm.adotable4.active:=false;
      dm.adotable4.active:=true;
      edit1.Text := '' ;
      edit2.Text := '' ;
      edit3.Text := '' ;
      edit4.Text := '' ;
      ComboBox1.Text := '开户人' ;
      Combobox2.Items.Clear;
      with dm.ADOQuery4 do
        begin
          dm.adoquery4.Close ;
          dm.adoquery4.Open ;
          while not dm.adoquery4.Eof do
          begin
           ComboBox2.Items.Add(dm.adoquery4.FieldByName('银行帐号').AsString);
           dm.adoquery4.Next
          end;
        end;
    end;
end;

procedure TAddBank.Button2Click(Sender: TObject);
begin
  if combobox2.Text = '请选择要删除的银行帐号' then
    messagebox(getactivewindow(),'您没有选择任何帐号,请选择!','请重新选择' ,MB_OK + MB_ICONINFORMATION)
  else
    begin
      dm.User.Close;
      dm.User.SQL.Clear;
      dm.User.SQL.Add('DELETE * FROM bank WHERE 银行帐号 = :user');
      dm.User.Parameters.ParamByName('user').Value := combobox2.Text;
      dm.User.Prepared;
      dm.User.ExecSql;
      messagebox(getactivewindow(),'删除帐号成功,单击确定返回!','成功删除' ,MB_OK + MB_ICONINFORMATION);
      combobox2.Text := '请选择要删除的银行帐号';
      dm.adotable4.active:=false;
      dm.adotable4.active:=true;
      combobox2.Items.Clear;
      with dm.ADOQuery4 do
        begin
          dm.adoquery4.Close ;
          dm.adoquery4.Open ;
          while not dm.adoquery4.Eof do
          begin
           ComboBox2.Items.Add(dm.adoquery4.FieldByName('银行帐号').AsString);
           dm.adoquery4.Next
          end;
        end;
    end;
end;

end.

⌨️ 快捷键说明

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