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

📄 money.pas

📁 老年人大学的学籍管理,主要是学费收取
💻 PAS
字号:
unit money;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, base, ExtCtrls, SUIForm, SUIButton, StdCtrls, SUIComboBox,
  SUIEdit;

type
  Tfrmmoney = class(Tbaseform)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    edtname: TsuiEdit;
    cbxdep: TsuiComboBox;
    cbxmajor: TsuiComboBox;
    cbxgrade: TsuiComboBox;
    cbxclass: TsuiComboBox;
    Label6: TLabel;
    edtying: TsuiEdit;
    Label7: TLabel;
    edtshi: TsuiEdit;
    suiButton1: TsuiButton;
    suiButton2: TsuiButton;
    suiButton3: TsuiButton;
    suiButton4: TsuiButton;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    procedure suiButton2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure cbxdepChange(Sender: TObject);
    procedure edtyingKeyPress(Sender: TObject; var Key: Char);
    procedure edtshiKeyPress(Sender: TObject; var Key: Char);
    procedure cbxgradeChange(Sender: TObject);
    procedure suiButton1Click(Sender: TObject);
    procedure suiButton3Click(Sender: TObject);
    procedure suiButton4Click(Sender: TObject);
  private
    { Private declarations }
  public
    money:string;
    id:integer;
    { Public declarations }
  end;

var
  frmmoney: Tfrmmoney;

implementation

uses dm, pub, umain, newstu, adodb, rptnew, rptstu;

{$R *.dfm}

procedure Tfrmmoney.suiButton2Click(Sender: TObject);
begin
  inherited;
  close;
end;



procedure Tfrmmoney.FormShow(Sender: TObject);
begin
  inherited;
  edtname.Text:=frmnewstu.stuname;
end;

procedure Tfrmmoney.FormCreate(Sender: TObject);
var tmp:tadoquery;
begin
  inherited;
  tmp:=tadoquery.Create(nil);
  tmp.ConnectionString :=frmmain.adc.ConnectionString;
  try
    pub.showrecord(tmp,'*','dep','id');
    while not tmp.Eof do
      begin
      cbxdep.Items.Add(tmp.fieldbyname('dep').AsString);
      tmp.Next;
      end;
    pub.showrecord(tmp,'*','grade','id');
    while not tmp.Eof do
      begin
      cbxgrade.Items.Add(tmp.fieldbyname('grade').AsString);
      tmp.Next;
      end;
  finally
    tmp.Free;
  end;
end;

procedure Tfrmmoney.cbxdepChange(Sender: TObject);
var tmp:tadoquery;
begin
  inherited;
  cbxmajor.Clear;
  tmp:=tadoquery.Create(nil);
  tmp.ConnectionString:=frmmain.adc.ConnectionString;
  try
    pub.showrecord(tmp,'*','major where dep='+''''+cbxdep.Text+'''','id');
    while not tmp.Eof do
      begin
      cbxmajor.Items.Add(tmp.fieldbyname('major').AsString);
      tmp.Next;
      end;
  finally
    tmp.Free;
  end;
end;

procedure Tfrmmoney.edtyingKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if not ( key in ['0'..'9',#23,#8]) then
    key:=#0;
end;

procedure Tfrmmoney.edtshiKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if not ( key in ['0'..'9',#23,#8]) then
    key:=#0;
end;

procedure Tfrmmoney.cbxgradeChange(Sender: TObject);
var tmp:tadoquery;
begin
  inherited;
  cbxclass.Clear;
  tmp:=tadoquery.Create(nil);
  tmp.ConnectionString:=frmmain.adc.ConnectionString;
  try
    pub.showrecord(tmp,'*','class where grade='+''''+cbxgrade.Text+'''','id');
    while not tmp.Eof do
      begin
      cbxclass.Items.Add(tmp.fieldbyname('class').AsString);
      tmp.Next;
      end;
  finally
    tmp.Free;
  end;
end;

procedure Tfrmmoney.suiButton1Click(Sender: TObject);
var i:integer;
    tmp:tadoquery;
begin
  inherited;
  for i:=0 to suiform1.ControlCount-1 do
    if suiform1.Controls[i] is tsuiedit then
      if tsuiedit(suiform1.Controls[i]).Text='' then
        begin
        application.MessageBox('所填信息不完整!','提示',mb_ok+mb_iconinformation);
        exit;
        end;
  for i:=0 to suiform1.ControlCount-1 do
    if suiform1.Controls[i] is tsuicombobox then
      if tsuicombobox(suiform1.Controls[i]).Text='' then
        begin
        application.MessageBox('所填信息不完整!','提示',mb_ok+mb_iconinformation);
        exit;
        end;
  tmp:=tadoquery.Create(nil);
  tmp.ConnectionString:=frmmain.adc.ConnectionString;
  frmmain.adc.BeginTrans;
  try
    with tmp do
      begin
      sql.Clear;
      sql.Add('insert into money (stuid,stuname,yingjiaomoney,shijiaomoney,status,datetime,type) values (:v1,:v2,:v3,:v4,:v5,:v6,:v7)');
      //showmessage(sql.Text);
      parameters.ParamByName('v1').Value := frmnewstu.stuid;
      parameters.ParamByName('v2').Value := edtname.Text;
      parameters.ParamByName('v3').Value := strtoint(edtying.Text);
      parameters.ParamByName('v4').Value := strtoint(edtshi.Text);
      parameters.ParamByName('v5').Value := 1;
      parameters.ParamByName('v6').Value := formatdatetime('yyyy-mm-dd',now());
      parameters.ParamByName('v7').Value := 'newstu'; 
      execsql;
      end;
    with tmp do
      begin
      sql.Clear;
      sql.Add('update newstu set dep=:v1,major=:v2,grade=:v3,class=:v4,status=:v5 where id=:v6');
      parameters.ParamByName('v1').Value :=cbxdep.Text;
      parameters.ParamByName('v2').Value :=cbxmajor.Text;
      parameters.ParamByName('v3').Value :=cbxgrade.Text;
      parameters.ParamByName('v4').Value :=cbxclass.Text;
      parameters.ParamByName('v5').Value :=1;
      parameters.ParamByName('v6').Value :=frmnewstu.id;
      execsql;
      end;             
    frmmain.adc.CommitTrans;
    application.MessageBox('交费成功!','提示',mb_ok+mb_iconinformation);
    tmp.Free;
    //close;
  except
    frmmain.adc.RollbackTrans;
    raise;
    application.MessageBox('交费失败!','警告',mb_ok+mb_iconwarning);
    tmp.Free;
  end;
end;

procedure Tfrmmoney.suiButton3Click(Sender: TObject);
begin
  inherited;
  id:=frmnewstu.id;
  money:=edtshi.Text;
  frmrptnew:=tfrmrptnew.Create(nil);
  with frmrptnew.QuickRep1 do
    begin
    previewheight:=screen.Height;
    previewwidth:=screen.Width;
    preview;
    end;
end;

procedure Tfrmmoney.suiButton4Click(Sender: TObject);
begin
  inherited;
  id:=frmnewstu.id;
  frmrptstu:=tfrmrptstu.Create(nil);
  with frmrptstu.QuickRep1 do
    begin
    previewwidth:=screen.Width;
    previewheight:=screen.Height;
    preview;
    end;
end;

end.

⌨️ 快捷键说明

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