am_jygl_bjs.pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:4k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit am_jygl_bjs;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, DB, Mask, DBCtrls, Buttons, DBCtrlsEh,
- DBLookupEh;
- type
- Tam_jygl_bj = class(TForm)
- Image1: TImage;
- Label1: TLabel;
- Panel1: TPanel;
- Label2: TLabel;
- Label3: TLabel;
- DBEdit2: TDBEdit;
- Label5: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- Label9: TLabel;
- Label10: TLabel;
- Label11: TLabel;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- Label4: TLabel;
- Label8: TLabel;
- Label12: TLabel;
- SpeedButton3: TSpeedButton;
- SpeedButton4: TSpeedButton;
- DBLookupComboboxEh1: TDBLookupComboboxEh;
- DBLookupComboboxEh2: TDBLookupComboboxEh;
- DBEditEh1: TDBEditEh;
- DBEditEh2: TDBEditEh;
- Ds_Jygl: TDataSource;
- Ds_Jyfs: TDataSource;
- Ds_Jymd: TDataSource;
- DBEditEh3: TDBEditEh;
- DBEditEh4: TDBEditEh;
- Label13: TLabel;
- DBEditEh5: TDBEditEh;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure SpeedButton2Click(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure FormKeyPress(Sender: TObject; var Key: Char);
- procedure SpeedButton3Click(Sender: TObject);
- procedure SpeedButton4Click(Sender: TObject);
- procedure DBEditEh2Change(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- am_jygl_bj: Tam_jygl_bj;
- implementation
- uses DMs,am_jygls, am_dz_xzs, am_dzbjs, am_dz_ajxzs;
- {$R *.dfm}
- procedure Tam_jygl_bj.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- dm.am_jygl.Close;
- dm.am_jygl.CommandText:='select * from am_jygl';
- dm.am_jygl.Open;
- am_jygl.ToolButton4.Click;
- action:=cafree;
- am_jygl_bj:=nil;
- end;
- procedure Tam_jygl_bj.SpeedButton2Click(Sender: TObject);
- begin
- close;
- end;
- procedure Tam_jygl_bj.SpeedButton1Click(Sender: TObject);
- var i:integer;
- begin
- if DBEditEh2.Text='' then
- begin
- application.MessageBox('读者代码不能为空!','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if dbedit2.Text='' then
- begin
- application.MessageBox('案卷序号不能为空!','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if DBLookupComboboxEh1.Text='' then
- begin
- application.MessageBox('借阅方式代码不能为空!','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if DBLookupComboboxEh2.Text='' then
- begin
- application.MessageBox('借阅目的不能为空!','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- dm.am_jygl.edit;
- {dm.Am_jygl.FieldByName('dz_dm').AsString:=DBEditEh2.Text;
- dm.am_jygl.FieldByName('jy_jyrq').AsDateTime:=DbDateTimeEditEh1.Value;
- dm.am_jygl.FieldByName('jy_yhrq').AsDateTime:=StrToDatetime(dbediteh1.Text);}
- //showmessage(datetimeTostr(Dbediteh));
- dm.am_jygl.FieldByName('jy_jyzt').AsString:='借阅中';
- i:=Dm.am_jygl.ApplyUpdates(0);
- if i=0 then
- begin
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- am_jygl.ToolButton4.Click;
- close;
- end
- else
- begin
- application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- end;
- procedure Tam_jygl_bj.FormKeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- begin
- key:=#0;
- perform(WM_NEXTDLGCTL,0,0);
- end;
- end;
- procedure Tam_jygl_bj.SpeedButton3Click(Sender: TObject);
- begin
- if am_dz_xz=nil then
- begin
- am_dz_xz:=Tam_dz_xz.Create(self);
- am_dz_xz.ShowModal;
- end;
- end;
- procedure Tam_jygl_bj.SpeedButton4Click(Sender: TObject);
- begin
- if am_dz_ajxz=nil then
- begin
- am_dz_ajxz:=Tam_dz_ajxz.create(self);
- am_dz_ajxz.showmodal;
- end;
- end;
- procedure Tam_jygl_bj.DBEditEh2Change(Sender: TObject);
- var S_jyts:integer;//借阅天数
- S_Dzdm:String;//分别是读者代码,借阅规则序号
- begin
- if trim(DBEditEh2.Text)<>'' then
- begin
- DBEditEh5.Text:=formatdatetime('yyyy-mm-dd',now);
- S_Dzdm:=DBEditEh2.Text;
- dm.V_DZ.Close;
- dm.V_DZ.CommandText:='select Jygz_Xjts from v_dz where dz_dm='+''''+S_Dzdm+''''+'';
- dm.v_dz.Open;
- S_jyts:=dm.V_DZ.fieldbyname('jygz_Xjts').AsInteger;
- dbediteh1.Text:=datetostr(StrToDate(DBEditEh5.Text)+S_jyts);
- end;
- end;
- end.