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

📄 oldstumoney.pas

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

interface

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

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

var
  frmoldstumoney: Tfrmoldstumoney;

implementation

uses oldstu,adodb, umain, pub, rptold;

{$R *.dfm}

procedure Tfrmoldstumoney.FormCreate(Sender: TObject);
var tmp:tadoquery;
begin
  inherited;
  tmp:=tadoquery.Create(nil);
  tmp.ConnectionString:=frmmain.adc.ConnectionString;
  try
    pub.showrecord(tmp,'*','oldstu where id='+frmoldstu.id,'id');
    stuid:=tmp.fieldbyname('stuid').AsString;
    edtname.Text:=tmp.fieldbyname('stuname').AsString;
    cbxdep.Text:=tmp.fieldbyname('dep').AsString;
    cbxmajor.Text:=tmp.fieldbyname('major').AsString;
    cbxgrade.Text:=tmp.fieldbyname('grade').AsString;
    cbxclass.Text:=tmp.fieldbyname('class').AsString;
  finally
    tmp.Free;
  end;
end;

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

procedure Tfrmoldstumoney.suiButton1Click(Sender: TObject);
var tmp:tadoquery;
begin
  inherited;
  if (trim(edtying.Text)='')or(trim(edtshi.Text)='') then
    begin
    application.MessageBox('信息不完整!','提示',mb_ok+mb_iconinformation);
    exit;
    end;
  if (strtoint(edtying.Text))<>(strtoint(edtshi.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,datetime,type) values (:v1,:v2,:v3,:v4,:v5,:v6)');
      parameters.ParamByName('v1').Value :=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 :=now();
      parameters.ParamByName('v6').Value :='oldstu';
      execsql;
      end;
    with tmp do
      begin
      sql.Clear;
      sql.Add('update oldstu set status=1 where id='+frmoldstu.id);
      showmessage(sql.Text);
      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 Tfrmoldstumoney.edtyingKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if not ( key in ['0'..'9',#23,#8]) then
    key:=#0;
end;

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

procedure Tfrmoldstumoney.suiButton3Click(Sender: TObject);
begin
  inherited;
  money:=edtshi.Text;
  id:=frmoldstu.id;
  frmrptold:=tfrmrptold.Create(nil);
  with rptold.frmrptold.QuickRep1 do
    begin
    previewwidth:=screen.Width;
    previewheight:=screen.Height;
    preview;
    end;
end;

end.

⌨️ 快捷键说明

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