am_ghgls.pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:6k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit am_ghgls;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ComCtrls, ToolWin, Grids, DBGridEh, XPBarMenu, DB, PrnDbgeh,
- StdCtrls, ExtCtrls, DBClient;
- type
- Tam_ghgl = class(TForm)
- CoolBar1: TCoolBar;
- ToolBar1: TToolBar;
- ToolButton1: TToolButton;
- ToolButton4: TToolButton;
- ToolButton5: TToolButton;
- ToolButton6: TToolButton;
- ToolButton2: TToolButton;
- XPBarMenu1: TXPBarMenu;
- DBGridEh1: TDBGridEh;
- jygl: TDataSource;
- DataSource1: TDataSource;
- PrintDBGridEh1: TPrintDBGridEh;
- RadioGroup1: TRadioGroup;
- ClientDataSet1: TClientDataSet;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure ToolButton7Click(Sender: TObject);
- procedure ToolButton1Click(Sender: TObject);
- procedure ToolButton2Click(Sender: TObject);
- procedure ToolButton4Click(Sender: TObject);
- procedure ToolButton6Click(Sender: TObject);
- procedure RadioGroup1Click(Sender: TObject);
- procedure ToolButton5Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- am_ghgl: Tam_ghgl;
- implementation
- uses dms, am_ghgl_cxs, AM_Ghgl_Ps;
- {$R *.dfm}
- procedure Tam_ghgl.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- action:=cafree;
- am_ghgl:=nil;
- end;
- procedure Tam_ghgl.ToolButton7Click(Sender: TObject);
- begin
- close;
- end;
- procedure Tam_ghgl.ToolButton1Click(Sender: TObject);
- var s,DateNOw:string;
- begin
- If dm.v_gh.RecordCount<>0 then
- begin
- if application.MessageBox('您确认归还案卷','提示',mb_okcancel+mb_iconinformation)=idok then
- begin
- s:=dm.v_gh.fieldbyname('jy_xh').AsString;
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from am_jygl where jy_xh='+''''+s+''''+'';
- dm.v_gh.Open;
- dm.am_jygl.FieldByName('jy_jyzt').AsString:='''已归还''';
- dm.am_jygl.fieldbyname('jy_ghrq').AsString:=formatdatetime('Yyyy-mm-dd',NOw);
- dm.am_jygl.ApplyUpdates(0);
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from v_gh where jy_jyzt<>''已归还''';
- dm.v_gh.Open;
- end;
- end
- else
- begin
- application.MessageBox('当前表中没有数据,'+#13#10+'不能归还!','提示',mb_ok+mb_iconinformation);
- ToolButton1.Enabled:=false;
- exit;
- end;
- end;
- procedure Tam_ghgl.ToolButton2Click(Sender: TObject);
- var DateNOw:Tdatetime;
- sql_str:integer;
- S_Dzdm,s_jyzt,s_Jyxh,s_Kfxj,s_sfyq:string;//读者代码,借阅状态,借阅序号,是否逾期
- s_P,s_jyrq:string;//更改数据,借阅日期
- N_Xjts:integer;//限借天数
- begin
- dateNow:=strToDatetime(formatdatetime('yyyy-mm-dd',now));
- sql_str:=dm.v_gh.fieldbyname('jy_xh').AsInteger;
- N_Xjts:=dm.v_gh.fieldbyname('jygz_xjts').AsInteger;
- s_Jyxh:=dm.v_gh.fieldbyname('JY_xh').asstring;
- s_sfyq:='Jy_Yhrq<'+'Getdate()'+' and '+'jy_jyzt<>'+'''已归还'''+' and '+'Jy_xh='+''''+s_Jyxh+''''+'';
- Clientdataset1.Close;
- Clientdataset1.CommandText:='select * from V_gh where '+s_sfyq;
- Clientdataset1.Open;
- s_kfxj:=Clientdataset1.FieldByName('jygz_Xjtj').AsString;
- if s_kfxj='不可以' then
- begin
- application.MessageBox('逾期未还,无法续借','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- s_jyrq:=dm.v_gh.FieldByName('jy_jyrq').AsString;
- if s_Jyrq=datetimetostr(dateNOw) then
- begin
- application.MessageBox('今天刚借,无法续借','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin
- s_jyzt:=trim(dm.v_gh.FieldByName('jy_jyzt').AsString);
- if s_jyzt='续借中' then
- begin
- application.MessageBox('今天刚续借,不能续借','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin
- dm.am_jygl.Close;
- dm.am_jygl.CommandText:='select * from am_jygl where jy_xh='+''''+INtToStr(sql_str)+''''+'';
- dm.am_jygl.Open;//续借
- dm.am_jygl.Edit;
- dm.am_jygl.FieldByName('jy_Jyrq').AsDateTime:=dateNOw;
- dm.am_jygl.FieldByName('jy_Yhrq').AsDateTime:=dateNOw+N_xjts;
- dm.am_jygl.ApplyUpdates(0);
- if dm.am_jygl.RecordCount=0 then
- application.MessageBox('续借成功','提示',mb_ok+mb_iconinformation);
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from v_gh where jy_jyzt<>''已归还''';
- dm.v_gh.Open;
- exit;
- end;//end if
- end;
- end;
- procedure Tam_ghgl.ToolButton4Click(Sender: TObject);
- begin
- RadioGroup1Click(nil);
- end;
- procedure Tam_ghgl.ToolButton6Click(Sender: TObject);
- begin
- //PrintDBGridEh1.Preview;
- Am_Ghgl_P:=TAm_Ghgl_P.create(application);
- Am_Ghgl_P.QuickRep1.Preview;
- end;
- procedure Tam_ghgl.RadioGroup1Click(Sender: TObject);
- var s:string;
- N:integer;
- begin
- case RadioGroup1.ItemIndex of
- 0: begin
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from v_gh where jy_jyzt<>''已归还''';
- dm.v_gh.Open;
- Toolbutton1.Enabled:=true;
- ToolButton2.Enabled:=true;
- end;//未归还
- 1: begin
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from v_gh where jy_jyzt=''已归还''';
- dm.v_gh.Open;
- Toolbutton1.Enabled:=false;
- if dm.v_gh.recordcount<>0 then
- begin
- Toolbutton1.Enabled:=true;
- ToolButton2.Enabled:=true;
- end
- else
- begin
- Toolbutton1.Enabled:=false;
- ToolButton2.Enabled:=false;
- end;
- end;//未还列表
- 2: begin
- S:='Jy_Yhrq>'+'Getdate()'+' and '+'jy_jyzt<>'+'''已归还''';
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from v_gh where '+s;
- dm.v_gh.Open;
- Toolbutton1.Enabled:=true;
- ToolButton2.Enabled:=true;
- end;
- end;
- end;
- //*****************************************************************************
- procedure Tam_ghgl.ToolButton5Click(Sender: TObject);
- begin
- if am_ghgl_cx=nil then
- begin
- am_ghgl_cx:=Tam_ghgl_cx.create(self);
- am_ghgl_cx.showmodal;
- end;
- end;
- procedure Tam_ghgl.FormCreate(Sender: TObject);
- var s,hint:string;
- begin
- S:='Jy_Yhrq>'+'Getdate()'+' and '+'jy_jyzt<>'+'''已归还''';
- dm.v_gh.Close;
- dm.v_gh.CommandText:='select * from v_gh where '+s;
- dm.v_gh.Open;
- if dm.v_gh.RecordCount<>0 then
- begin
- Hint:='有'+INtToStr(dm.v_gh.RecordCount)+'应还纪录!';
- Application.MessageBox(Pchar(Hint),'提示',mb_ok+mb_iconinformation);
- end;
- end;
- end.