am_jygls.pas
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:5k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit am_jygls;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, Grids, DBGridEh, ComCtrls, ToolWin, DB, XPBarMenu, PrnDbgeh,
  6.   StdCtrls, ExtCtrls, DBClient;
  7. type
  8.   Tam_jygl = class(TForm)
  9.     CoolBar1: TCoolBar;
  10.     ToolBar1: TToolBar;
  11.     ToolButton1: TToolButton;
  12.     ToolButton2: TToolButton;
  13.     ToolButton3: TToolButton;
  14.     ToolButton4: TToolButton;
  15.     ToolButton5: TToolButton;
  16.     ToolButton6: TToolButton;
  17.     ToolButton7: TToolButton;
  18.     DBGridEh1: TDBGridEh;
  19.     v_jy: TDataSource;
  20.     XPBarMenu1: TXPBarMenu;
  21.     PrintDBGridEh1: TPrintDBGridEh;
  22.     RadioGroup1: TRadioGroup;
  23.     ClientDataSet1: TClientDataSet;
  24.     procedure ToolButton1Click(Sender: TObject);
  25.     procedure ToolButton2Click(Sender: TObject);
  26.     procedure ToolButton7Click(Sender: TObject);
  27.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  28.     procedure FormCreate(Sender: TObject);
  29.     procedure ToolButton3Click(Sender: TObject);
  30.     procedure ToolButton4Click(Sender: TObject);
  31.     procedure ToolButton6Click(Sender: TObject);
  32.     procedure RadioGroup1Click(Sender: TObject);
  33.     procedure DBGridEh1DblClick(Sender: TObject);
  34.     procedure ToolButton5Click(Sender: TObject);
  35.   private
  36.     { Private declarations }
  37.   public
  38.     { Public declarations }
  39.   end;
  40. var
  41.   am_jygl: Tam_jygl;
  42. implementation
  43. uses dms, am_jygl_bjs, am_jygl_cxs, am_jygl_ps;
  44. {$R *.dfm}
  45. procedure Tam_jygl.ToolButton1Click(Sender: TObject);
  46. begin
  47.    dm.am_jygl.Close;
  48.    dm.am_jygl.CommandText:='select * from am_jygl where dz_dm='+''''+''''+'';
  49.    dm.am_jygl.Open;
  50.    //dm.am_jygl.Append;
  51.    dm.am_jygl.edit;
  52.    am_jygl_bj:=Tam_jygl_bj.create(application);
  53.    am_jygl_bj.showmodal;
  54. end;
  55. procedure Tam_jygl.ToolButton2Click(Sender: TObject);
  56. var s:string;
  57. begin
  58.   s:=Clientdataset1.fieldbyname('dz_dm').AsString;
  59.   dm.am_jygl.Close;
  60.   dm.am_jygl.CommandText:='select * from am_jygl where dz_dm='+''''+s+''''+'';
  61.   dm.am_jygl.Open;
  62.   am_jygl_bj:=Tam_jygl_bj.Create(application);
  63.   {am_jygl_bj.DBEditEh2.Text:=dm.Am_jygl.FieldByName('dz_dm').AsString;
  64.   am_jygl_bj.DbDateTimeEditEh1.Value:=dm.am_jygl.FieldByName('jy_jyrq').AsDateTime;
  65.   am_jygl_bj.dbediteh1.Text:=dm.am_jygl.FieldByName('jy_yhrq').AsString;}
  66.   am_jygl_bj.ShowModal;
  67. end;
  68. procedure Tam_jygl.ToolButton7Click(Sender: TObject);
  69. begin
  70.  close;
  71. end;
  72. procedure Tam_jygl.FormClose(Sender: TObject; var Action: TCloseAction);
  73. begin
  74.  action:=cafree;
  75.  am_jygl:=nil;
  76. end;
  77. procedure Tam_jygl.FormCreate(Sender: TObject);
  78. begin
  79.  dm.am_jygl.Active:=true;//借阅管理
  80.  Clientdataset1.Active:=true;//借阅视图
  81.  dm.sz_jyfs.Active:=true;//借阅方式
  82.  dm.sz_jymd.Active:=true;//借阅目的
  83.  Dm.am_dz.Active:=true;//读者表
  84.  dm.am_jygz.Active:=true;//借阅规则
  85.  DM.sz_zjlb.Active:=true;//证件类别
  86. end;
  87. procedure Tam_jygl.ToolButton3Click(Sender: TObject);
  88. var s:string;
  89. begin
  90.  dm.am_jygl.Close;
  91.  Dm.am_jygl.CommandText:='select * from am_jygl';
  92.  dm.am_jygl.Open;
  93.  s:=Clientdataset1.fieldbyname('jy_xh').AsString;
  94.  if Dm.am_jygl.RecordCount=0 then
  95.  begin
  96.     application.MessageBox('表中没有数据不能删除!','提示',mb_iconinformation+mb_defbutton1);
  97.     Abort;
  98.   end
  99.   else
  100.    if application.MessageBox('你确定删除吗?','警告',mb_okcancel+mb_iconinformation)=idok then
  101.    begin
  102.        dm.am_jygl.Close;
  103.        dm.am_jygl.CommandText:='delete am_jygl where jy_xh='+''''+s+''''+'';
  104.        dm.am_jygl.Execute;
  105.        dm.am_jygl.close;
  106.        dm.am_jygl.commandtext:='select * from am_jygl';
  107.        dm.am_jygl.open;//删除表中数据
  108.        toolbutton4.Click;
  109.     end; 
  110. end;
  111. procedure Tam_jygl.ToolButton4Click(Sender: TObject);
  112. begin
  113.  Clientdataset1.Close;
  114.  Clientdataset1.CommandText:='select * from v_jy';
  115.  Clientdataset1.Open;
  116. end;
  117. procedure Tam_jygl.ToolButton6Click(Sender: TObject);
  118. begin
  119.  //PrintDBGridEh1.Preview;
  120.  am_jygl_P:=Tam_jygl_P.create(self);
  121.  am_JYgl_P.QuickRep1.Preview;
  122. end;
  123. procedure Tam_jygl.RadioGroup1Click(Sender: TObject);
  124. begin
  125.   if radioGroup1.ItemIndex=0 then
  126.    begin
  127.      Clientdataset1.Close;
  128.      Clientdataset1.CommandText:='select * from v_Jy where jy_jyrq=getdate()';
  129.      Clientdataset1.Open;
  130.    end
  131.   else
  132.    begin
  133.      Clientdataset1.Close;
  134.      Clientdataset1.CommandText:='select * from v_Jy where jy_jyrq<>getdate()';
  135.      Clientdataset1.Open;
  136.    end;
  137. end;
  138. procedure Tam_jygl.DBGridEh1DblClick(Sender: TObject);
  139. begin
  140.  Toolbutton2.Click;
  141. end;
  142. procedure Tam_jygl.ToolButton5Click(Sender: TObject);
  143. begin
  144.  if am_jygl_cx= nil then
  145.   begin
  146.     am_jygl_cx:=Tam_jygl_cx.create(self);
  147.     am_jygl_cx.showmodal;
  148.   end;
  149. end;
  150. end.