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

📄 unit7.~pas

📁 用dephi写的一个银行管理系统
💻 ~PAS
字号:
unit Unit7;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, DB, ADODB, jpeg;

type
  TForm7 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    StaticText1: TStaticText;
    Edit1: TEdit;
    StaticText2: TStaticText;
    ComboBox1: TComboBox;
    StaticText3: TStaticText;
    Edit2: TEdit;
    ComboBox2: TComboBox;
    StaticText4: TStaticText;
    Panel1: TPanel;
    StaticText5: TStaticText;
    Edit3: TEdit;
    StaticText6: TStaticText;
    ComboBox3: TComboBox;
    Panel2: TPanel;
    StaticText7: TStaticText;
    Edit4: TEdit;
    StaticText12: TStaticText;
    Edit7: TEdit;
    StaticText13: TStaticText;
    StaticText14: TStaticText;
    BitBtn1: TBitBtn;
    StaticText15: TStaticText;
    Button1: TButton;
    Panel3: TPanel;
    StaticText8: TStaticText;
    Edit5: TEdit;
    StaticText9: TStaticText;
    StaticText10: TStaticText;
    Edit6: TEdit;
    Edit8: TEdit;
    Button2: TButton;
    ADOQuery1: TADOQuery;
    ADOStoredProc1: TADOStoredProc;
    Button3: TButton;
    StaticText11: TStaticText;
    Edit9: TEdit;
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Image1Click(Sender: TObject);
    procedure Edit3Change(Sender: TObject);
    //procedure ComboBox3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form7: TForm7;
  rate:double;
implementation

uses Unit3, Unit1;

{$R *.dfm}

procedure TForm7.FormCreate(Sender: TObject);
begin
  ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('select * from Bank where Card_type=:a');
    ADOQuery1.Parameters[0].Value:='中国工商银行';
    ADOQuery1.Active:=true;
    ADOQuery1.Open;
    if(ADOQuery1.RecordCount>0)then begin combobox1.Items.Add('中国工商银行');combobox2.Items.Add('中国工商银行');combobox3.Items.Add('中国工商银行');end;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('select * from Bank where Card_type=:a');
    ADOQuery1.Parameters[0].Value:='中国招商银行';
    ADOQuery1.Open;
    if(ADOQuery1.RecordCount>0)then begin combobox1.Items.Add('中国招商银行');combobox2.Items.Add('中国招商银行');combobox3.Items.Add('中国招商银行');end;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('select * from Bank where Card_type=:a');
    ADOQuery1.Parameters[0].Value:='中国农业银行';
    ADOQuery1.Open;
    if(ADOQuery1.RecordCount>0)then begin combobox1.Items.Add('中国农业银行');combobox2.Items.Add('中国农业银行');combobox3.Items.Add('中国农业银行');end;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('select * from Bank where Card_type=:a');
    ADOQuery1.Parameters[0].Value:='中信银行';
    ADOQuery1.Open;
    if(ADOQuery1.RecordCount>0)then begin combobox1.Items.Add('中信银行');combobox2.Items.Add('中信银行');combobox3.Items.Add('中信银行');end;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('select * from Bank where Card_type=:a');
    ADOQuery1.Parameters[0].Value:='中国光大银行';
    ADOQuery1.Open;
    if(ADOQuery1.RecordCount>0)then begin combobox1.Items.Add('中国光大银行');combobox2.Items.Add('中国光大银行');combobox3.Items.Add('中国光大银行');end;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Add('select * from Bank where Card_type=:a');
    ADOQuery1.Parameters[0].Value:='中国建设银行';
    ADOQuery1.Open;
    if(ADOQuery1.RecordCount>0)then begin combobox1.Items.Add('中国建设银行');combobox2.Items.Add('中国建设银行');combobox3.Items.Add('中国建设银行');end;
end;

procedure TForm7.Button1Click(Sender: TObject);
var
   abi:double;
begin
  if(Edit4.Text='')then begin showmessage('密码不能为空');exit;end;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select pay_abi as abi from customer where customer_id=:a');
  adoquery1.Parameters[0].Value:=Edit4.Text;
  adoquery1.Open;
  abi:=adoquery1.FieldByName('abi').Value;
  if(adoquery1.RecordCount<=0) then begin showmessage('该用户不存在');Edit4.SetFocus;Exit;end;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select *  from customer_loan where customer_id=:a');
  adoquery1.Parameters[0].Value:=Edit4.Text;
  adoquery1.Open;
  if(adoquery1.RecordCount>0)then begin
   showmessage('上次贷款未还,不能继续贷款');
   Exit;
  end;


  Edit5.text:=floattostr(abi);
  Edit5.text:=Edit5.text+'RMB';
  panel3.visible:=true;
  Edit6.SetFocus;

end;

procedure TForm7.Button2Click(Sender: TObject);
var
 m,s:string;
 i:integer;
begin
  if(length(trim(Edit6.Text))=0) then
  begin
   showmessage('确保输入信息完整性');
   Exit;
  end;
  if(length(trim(Edit8.Text))=0) then
  begin
   showmessage('确保输入信息完整性');
   Exit;
  end;
  if(strtoint(Edit8.Text)<5)then
  rate:=0.006
  else if strtoint(Edit8.Text)<10 then
  rate:=0.008
  else if strtoint(Edit8.Text)<20 then
  rate:=0.01
  else
  rate:=0.012;
  StaticText14.Caption:=floattostr(rate);
  //-------生成贷款号-----------
   s:='DK'+FormatDateTime('yyyymmdd',Now());
        with adoquery1 do
           begin
           adoquery1.SQL.Clear;
           adoquery1.SQL.Add('select max(loan_pack_no) as ss from loan_pack');
           adoquery1.Open;
           end;
           if(adoquery1.FieldByName('ss').Value=null)then
           s:=s+'001'
           else
           begin
           m:=Trim(adoquery1.fieldByName('ss').Value);
           i:=strToint(Trim(copy(m,11,5)));
                if i<10 then
                    s:=s+'00'+inttostr(i+1)
                    else if i<100 then
                    s:=s+'0'+inttostr(i+1)
                    else
                    s:=s+inttostr(i+1);
           end;

  //-----------end--------------

  Edit7.Text:=s;
  panel2.Visible:=true;

end;

procedure TForm7.BitBtn1Click(Sender: TObject);
begin
   ADOStoredProc1.ProcedureName:='borrow';
   ADOStoredProc1.Parameters.Refresh;
   adostoredProc1.Parameters.ParamByName('@id').Value:=Edit4.Text;
   adostoredProc1.Parameters.ParamByName('@loan_no').Value:=Edit7.Text;
   adostoredProc1.Parameters.ParamByName('@type').Value:=combobox3.Text;
   adostoredProc1.Parameters.ParamByName('@lo_mon').Value:=Edit6.Text;
   adostoredProc1.Parameters.ParamByName('@pay_date').Value:=Edit8.Text;
   adostoredProc1.Parameters.ParamByName('@bor_date').Value:=now();
   adostoredProc1.Parameters.ParamByName('@rate').value:=rate;
   ADOStoredProc1.ExecProc;
   showmessage('贷款成功');
end;



procedure TForm7.Button3Click(Sender: TObject);
var
 amount:double;
 flag:integer;
begin
    flag:=0;//标志是否属于同行转账
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select fortune_amount as ss from fund_bill where (card_type=:a and card_no=:b)');
    adoquery1.Parameters[0].Value:=combobox1.Text;
    adoquery1.Parameters[1].Value:=Edit1.Text;
    adoquery1.Open;
    amount:=adoquery1.fieldbyname('ss').Value;
    if(adoquery1.RecordCount<=0)then
    begin
      showmessage('请确保你输入的转账卡号存在');
      Exit;
    end;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select * from fund_bill where (card_type=:a and card_no=:b and keyword=:c)');
    adoquery1.Parameters[0].Value:=combobox1.Text;
    adoquery1.Parameters[1].Value:=Edit1.Text;
    adoquery1.Parameters[2].Value:=Edit9.Text;
    adoquery1.Open;
    if(adoquery1.RecordCount<=0)then
    begin
      showmessage('请确保你输入的密码正确');
      Edit9.SetFocus;
      Exit;
    end;


    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select * from fund_bill where (card_type=:a and card_no=:b)');
    adoquery1.Parameters[0].Value:=combobox2.Text;
    adoquery1.Parameters[1].Value:=Edit2.Text;
    adoquery1.Open;
    if(combobox1.Text=combobox2.Text)then begin
     flag:=1;
    end;
    if(adoquery1.RecordCount<=0)then
    begin
      showmessage('请确保你输入的被转账卡号存在');
      Exit;
    end;
    if flag=1 then begin
      if(amount-strtofloat(Edit3.Text)*0.02<strtofloat(Edit3.Text))then
      begin
         showmessage('你卡上的金额不足以进行此次转账');
         Edit3.SetFocus;
         Exit;
      end;
    end;
    if flag=0 then begin
      if(amount-strtofloat(Edit3.Text)*0.05<strtofloat(Edit3.Text))then
       begin
        showmessage('你卡上的金额不足以进行此次转账');
        Edit3.SetFocus;
        Exit;
      end;
    end;

    ADOStoredProc1.ProcedureName:='turn';
    ADOStoredProc1.Parameters.Refresh;
    adostoredProc1.Parameters.ParamByName('@type1').Value:=combobox1.Text;
    adostoredProc1.Parameters.ParamByName('@type2').Value:=combobox2.Text;
    adostoredProc1.Parameters.ParamByName('@card_no1').Value:=Edit1.Text;
    adostoredProc1.Parameters.ParamByName('@card_no2').Value:=Edit2.Text;
    adostoredProc1.Parameters.ParamByName('@amount').Value:=strtofloat(Edit3.Text);
    adostoredProc1.Parameters.ParamByName('@flag').Value:=flag;
    ADOStoredProc1.ExecProc;
    panel1.Visible:=true;

end;

procedure TForm7.Image1Click(Sender: TObject);
begin
  form1.Show;
  self.Hide;

end;

procedure TForm7.Edit3Change(Sender: TObject);
begin
   panel1.Visible:=false;
end;

end.

⌨️ 快捷键说明

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