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

Delphi控件源码

开发平台:

Delphi

  1. unit Am_Ajxhs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ComCtrls, ToolWin, Buttons, ExtCtrls, ImgList, Grids, DBGridEh,
  6.   DB, ActnList, XPBarMenu, PrnDbgeh, Menus;
  7. type
  8.   TAm_Ajxh = class(TForm)
  9.     ImageList1: TImageList;
  10.     PageControl1: TPageControl;
  11.     TabSheet1: TTabSheet;
  12.     TabSheet2: TTabSheet;
  13.     DataSource1: TDataSource;
  14.     DBGridEh1: TDBGridEh;
  15.     XPBarMenu1: TXPBarMenu;
  16.     CoolBar1: TCoolBar;
  17.     ToolBar1: TToolBar;
  18.     ToolButton1: TToolButton;
  19.     ToolButton2: TToolButton;
  20.     ToolButton3: TToolButton;
  21.     ToolButton4: TToolButton;
  22.     ToolButton6: TToolButton;
  23.     ToolButton7: TToolButton;
  24.     PrintDBGridEh1: TPrintDBGridEh;
  25.     DBGridEh2: TDBGridEh;
  26.     DataSource2: TDataSource;
  27.     PopupMenu1: TPopupMenu;
  28.     N1: TMenuItem;
  29.     N2: TMenuItem;
  30.     PrintDBGridEh2: TPrintDBGridEh;
  31.     procedure FormCreate(Sender: TObject);
  32.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  33.     procedure ToolButton1Click(Sender: TObject);
  34.     procedure ToolButton7Click(Sender: TObject);
  35.     procedure ToolButton2Click(Sender: TObject);
  36.     procedure ToolButton3Click(Sender: TObject);
  37.     procedure PageControl1Change(Sender: TObject);
  38.     procedure ToolButton6Click(Sender: TObject);
  39.     procedure N1Click(Sender: TObject);
  40.     procedure DBGridEh1CellClick(Column: TColumnEh);
  41.     procedure N2Click(Sender: TObject);
  42.   private
  43.     { Private declarations }
  44.   public
  45.     { Public declarations }
  46.   end;
  47. var
  48.   Am_Ajxh: TAm_Ajxh;
  49. implementation
  50. uses dms,u_public, Am_AJJDs, am_ajxh_xhs, am_ajxh_dxh_ps, Am_Ajxh_yxh_Ps;
  51. {$R *.dfm}
  52. {待销毁案卷:系统自动列出类保管期限过期的;
  53. 已销毁案卷:已经鉴定并且销毁的}
  54. procedure TAm_Ajxh.FormCreate(Sender: TObject);
  55. var Snow:Tdatetime;
  56. begin
  57.   Snow:=strToDatetime(formatdatetime('yyyy-mm-dd',now));
  58.   dm.V_ajgl_gd.Close;
  59.   dm.v_ajgl_gd.CommandText:='P_am_ajxh';
  60.   dm.v_ajgl_gd.Execute;
  61.   //dm.V_ajgl_gd.Close;
  62.   //dm.v_ajgl_gd.CommandText:='P_Ajgl_dxh';
  63.   //dm.v_ajgl_gd.Open;//加载待销毁案卷
  64.   dm.V_ajgl_Dxh.Active:=true;//待销毁案卷
  65.   dm.am_ajxh.Active:=true;//案卷销毁表
  66.   dm.V_ajgl_yxh.Active:=true;//已销毁
  67.   dm.Am_ajgl.Active:=true;
  68. end;
  69. procedure TAm_Ajxh.FormClose(Sender: TObject; var Action: TCloseAction);
  70. begin
  71.  dm.am_ajxh.Active:=false;
  72.  action:=cafree;
  73.  am_ajxh:=nil;
  74. end;
  75. procedure TAm_Ajxh.ToolButton1Click(Sender: TObject);
  76. begin
  77.   if Am_AJJD=nil then
  78.   begin
  79.     am_ajjd:=Tam_ajjd.create(self);
  80.     dm.am_ajxh.Close;
  81.     dm.am_ajxh.CommandText:='select * from am_ajxh where aj_ajxh='+''''+''''+'';
  82.     dm.am_ajxh.Open;
  83.     am_ajjd.showmodal;
  84.   end;
  85. end;
  86. procedure TAm_Ajxh.ToolButton7Click(Sender: TObject);
  87. begin
  88.   close;
  89. end;
  90. procedure TAm_Ajxh.ToolButton2Click(Sender: TObject);
  91. begin
  92.   if dm.am_ajxh.FieldByName('aj_xh').AsString<>'' then
  93.   begin
  94.     if am_ajxh_xh=nil then
  95.     begin
  96.        am_ajxh_xh:=Tam_ajxh_xh.create(self);
  97.        dm.am_ajxh.Edit;//案卷销毁
  98.        am_ajxh_xh.showmodal;
  99.     end;
  100.   end;
  101. end;
  102. procedure TAm_Ajxh.ToolButton3Click(Sender: TObject);
  103. var s:string;
  104. begin
  105.    s:=dm.V_ajgl_yxh.fieldbyname('aj_xh').AsString;
  106.    dm.V_ajgl_gd.Close;
  107.    dm.V_ajgl_gd.CommandText:='update v_ajgl_gd set ajzt_mc=''待销毁案卷'' where aj_xh='+''''+s+''''+'';
  108.    dm.V_ajgl_gd.Execute;
  109.    //dm.V_ajgl_gd.Close;
  110.    //dm.V_ajgl_gd.CommandText:='P_ajgl_dxh';//查找待销毁案卷
  111.    //dm.V_ajgl_gd.Open;
  112.    dm.V_ajgl_yxh.Close;
  113.    dm.V_ajgl_yxh.CommandText:='P_ajgl_yxh';//查找已销毁案卷
  114.    dm.V_ajgl_yxh.Open;
  115.    dm.V_ajgl_dxh.Close;
  116.    dm.V_ajgl_dxh.CommandText:='P_ajgl_dxh';//查找待销毁案卷
  117.    dm.V_ajgl_dxh.Open;
  118. end;
  119. procedure TAm_Ajxh.PageControl1Change(Sender: TObject);
  120. begin
  121.   if pageControl1.ActivePageIndex=0 then
  122.    begin
  123.      if dm.V_ajgl_Dxh.RecordCount=0 then
  124.       begin
  125.         application.MessageBox('没有待销毁案卷','提示',mb_ok+mb_iconinformation);
  126.         toolbutton3.Enabled:=false;
  127.         toolbutton1.Enabled:=false;
  128.         toolbutton2.Enabled:=false;
  129.       end
  130.      else
  131.       begin
  132.         toolbutton3.Enabled:=false;
  133.       end;
  134.    end
  135.   else
  136.    begin
  137.      if dm.V_ajgl_yxh.RecordCount<>0 then
  138.         toolbutton3.Enabled:=true
  139.      else
  140.         toolbutton3.Enabled:=false;
  141.    end;
  142. end;
  143. procedure TAm_Ajxh.ToolButton6Click(Sender: TObject);
  144. begin
  145.    dm.V_ajgl_yxh.Close;
  146.    dm.V_ajgl_yxh.CommandText:='P_ajgl_yxh';//查找已销毁案卷
  147.    dm.V_ajgl_yxh.Open;
  148.    dm.V_ajgl_dxh.Close;
  149.    dm.V_ajgl_dxh.CommandText:='P_ajgl_dxh';//查找待销毁案卷
  150.    dm.V_ajgl_dxh.Open;
  151. end;
  152. procedure TAm_Ajxh.N1Click(Sender: TObject);
  153. begin
  154.   //printdbgrideh1.Preview;
  155.   am_ajxh_dxh_P:=tam_ajxh_dxh_P.create(application);
  156.   am_ajxh_dxh_p.quickrep1.preview;
  157. end;
  158. procedure TAm_Ajxh.DBGridEh1CellClick(Column: TColumnEh);
  159. var s:string;
  160. begin
  161.   s:=dm.V_ajgl_dxh.fieldbyname('aj_xh').AsString;//是否已鉴定
  162.   dm.am_ajxh.Close;
  163.   dm.am_ajxh.CommandText:='select * from am_ajxh where aj_xh='+''''+s+''''+'';
  164.   dm.am_ajxh.Open;
  165.  if dm.am_ajxh.FieldByName('ajxh_JDR').AsString<>'' then
  166.    begin
  167.      ToolButton2.Enabled:=true;
  168.      toolbutton1.Enabled:=false;
  169.    end//已经鉴定则使之处于销毁状态
  170.  else
  171.    begin
  172.      ToolButton2.Enabled:=false;
  173.      toolbutton1.Enabled:=True;
  174.    end;
  175. end;
  176. procedure TAm_Ajxh.N2Click(Sender: TObject);
  177. begin
  178.   //PrintDbGrideh2.Preview;
  179.   am_ajxh_yxh_P:=Tam_ajxh_yxh_P.create(application);
  180.   am_ajxh_yxh_p.quickrep1.preview;
  181. end;
  182. end.