U_htgd.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:5k
源码类别:

Delphi/CppBuilder

开发平台:

Delphi

  1. unit U_htgd;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   ExtCtrls, ComCtrls, Db, DBClient, Grids, DBGrids, Buttons, Menus,
  6.   ImgList, ToolWin;
  7. type
  8.   TForm51 = class(TForm)
  9.     Panel1: TPanel;
  10.     Panel2: TPanel;
  11.     StatusBar1: TStatusBar;
  12.     Splitter1: TSplitter;
  13.     DBGrid1: TDBGrid;
  14.     ClientDataSet1: TClientDataSet;
  15.     DataSource1: TDataSource;
  16.     DBGrid2: TDBGrid;
  17.     ToolBar1: TToolBar;
  18.     ToolButton1: TToolButton;
  19.     ToolButton2: TToolButton;
  20.     ToolButton3: TToolButton;
  21.     ImageList1: TImageList;
  22.     PopupMenu3: TPopupMenu;
  23.     N2: TMenuItem;
  24.     N1: TMenuItem;
  25.     A1: TMenuItem;
  26.     ClientDataSet1ID: TIntegerField;
  27.     ClientDataSet1CDSDesigner: TStringField;
  28.     ClientDataSet1CDSDesigner2: TStringField;
  29.     ClientDataSet1CDSDesigner3: TStringField;
  30.     ClientDataSet1CDSDesigner4: TStringField;
  31.     ClientDataSet1CDSDesigner5: TDateTimeField;
  32.     ClientDataSet1Z2: TStringField;
  33.     ClientDataSet1z3: TStringField;
  34.     ClientDataSet1z4: TStringField;
  35.     ClientDataSet1z5: TStringField;
  36.     ClientDataSet1z6: TStringField;
  37.     ClientDataSet1z7: TStringField;
  38.     ClientDataSet1z8: TStringField;
  39.     ClientDataSet1z9: TStringField;
  40.     ClientDataSet1z10: TStringField;
  41.     ClientDataSet1z11: TStringField;
  42.     ClientDataSet1z12: TStringField;
  43.     ClientDataSet1z13: TStringField;
  44.     ClientDataSet1CDSDesigner6: TStringField;
  45.     ClientDataSet1CDSDesigner7: TStringField;
  46.     ClientDataSet1CDSDesigner8: TStringField;
  47.     ClientDataSet1CDSDesigner9: TStringField;
  48.     ClientDataSet1CDSDesigner10: TStringField;
  49.     ClientDataSet1CDSDesigner11: TStringField;
  50.     ClientDataSet1CDSDesigner12: TStringField;
  51.     ClientDataSet1CDSDesigner13: TStringField;
  52.     ClientDataSet1CDSDesigner14: TStringField;
  53.     ClientDataSet1CDSDesigner15: TStringField;
  54.     ClientDataSet1CDSDesigner16: TStringField;
  55.     ClientDataSet1CDSDesigner17: TStringField;
  56.     ClientDataSet1CDSDesigner18: TStringField;
  57.     ClientDataSet1CDSDesigner19: TStringField;
  58.     ClientDataSet1CDSDesigner20: TStringField;
  59.     ClientDataSet1CDSDesigner21: TStringField;
  60.     ClientDataSet1CDSDesigner22: TStringField;
  61.     ClientDataSet1CDSDesigner23: TStringField;
  62.     ClientDataSet1CDSDesigner24: TStringField;
  63.     ClientDataSet1CDSDesigner25: TStringField;
  64.     ClientDataSet1CDSDesigner26: TStringField;
  65.     ClientDataSet1CDSDesigner27: TDateTimeField;
  66.     ClientDataSet1CDSDesigner28: TBooleanField;
  67.     ClientDataSet1CDSDesigner29: TStringField;
  68.     ClientDataSet1CDSDesigner30: TDateTimeField;
  69.     ClientDataSet1Q_CGHT_JTCL: TDataSetField;
  70.     procedure ToolButton1Click(Sender: TObject);
  71.     procedure N2Click(Sender: TObject);
  72.     procedure N1Click(Sender: TObject);
  73.     procedure A1Click(Sender: TObject);
  74.     procedure FormShow(Sender: TObject);
  75.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  76.     procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  77.       DataCol: Integer; Column: TColumn; State: TGridDrawState);
  78.     procedure DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
  79.       DataCol: Integer; Column: TColumn; State: TGridDrawState);
  80.   private
  81.     { Private declarations }
  82.   public
  83.     { Public declarations }
  84.   end;
  85. var
  86.   Form51: TForm51;
  87. implementation
  88. uses U_mainform, U_htgdxx;
  89. {$R *.DFM}
  90. procedure TForm51.ToolButton1Click(Sender: TObject);
  91. begin
  92. if clientdataset1.RecordCount=0 then
  93. begin
  94. application.messagebox('请选择具体合同','物资管理系统',mb_iconinformation+mb_defbutton1);
  95. exit;
  96. end;
  97. if clientdataset1.FieldByName('是否归档').value=true then
  98. begin
  99. application.messagebox('此合同已归档','物资管理系统',mb_iconinformation+mb_defbutton1);
  100. exit;
  101. end;
  102. if application.messagebox('请确认是否归档','物资管理系统',mb_iconinformation+mb_yesno)=idyes then
  103. begin
  104.   application.CreateForm(Tform52,form52);
  105. try
  106.   form52.showmodal;
  107. finally
  108.   form52.free;
  109. end;
  110. end;
  111. end;
  112. procedure TForm51.N2Click(Sender: TObject);
  113. begin
  114. clientdataset1.filter:='是否归档=0 or 是否归档=null';
  115. clientdataset1.filtered:=true;
  116. statusbar1.Panels[1].text:='显示未归档';
  117. statusbar1.refresh;
  118. end;
  119. procedure TForm51.N1Click(Sender: TObject);
  120. begin
  121. clientdataset1.filter:='是否归档=1';
  122. clientdataset1.filtered:=true;
  123. statusbar1.Panels[1].text:='显示已归档';
  124. statusbar1.refresh;
  125. end;
  126. procedure TForm51.A1Click(Sender: TObject);
  127. begin
  128. clientdataset1.filtered:=false;
  129. statusbar1.Panels[1].text:='显示全部';
  130. statusbar1.refresh;
  131. end;
  132. procedure TForm51.FormShow(Sender: TObject);
  133. begin
  134. clientdataset1.filter:='是否归档=0 or 是否归档=null';
  135. clientdataset1.filtered:=true;
  136. statusbar1.panels[1].text:='显示未归档';
  137. statusbar1.Refresh;
  138. end;
  139. procedure TForm51.FormClose(Sender: TObject; var Action: TCloseAction);
  140. begin
  141. action:=cafree;
  142. end;
  143. procedure TForm51.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  144.   DataCol: Integer; Column: TColumn; State: TGridDrawState);
  145. begin
  146. if clientdataset1.FieldByName('是否归档').value=1 then
  147. dbgrid1.Canvas.Font.Color:=clsilver;
  148. dbgrid1.DefaultDrawDataCell(rect,column.field,state);
  149. end;
  150. procedure TForm51.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
  151.   DataCol: Integer; Column: TColumn; State: TGridDrawState);
  152. begin
  153. if clientdataset1.FieldByName('是否归档').value=1 then
  154. dbgrid2.Canvas.Font.Color:=clsilver;
  155. dbgrid2.DefaultDrawDataCell(rect,column.field,state);
  156. end;
  157. end.