uyg.pas
上传用户:jiete_yjc
上传日期:2010-02-11
资源大小:422k
文件大小:3k
源码类别:

医药行业

开发平台:

Delphi

  1. unit uyg;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, Mask, DBCtrls, ComCtrls, DBCtrlsEh, DBLookupEh,
  6.   DBGridEh, Buttons, Grids, XPMenu, PrnDbgeh;
  7. type
  8.   Tfyg = class(TForm)
  9.     PageControl1: TPageControl;
  10.     TabSheet1: TTabSheet;
  11.     TabSheet2: TTabSheet;
  12.     TabSheet3: TTabSheet;
  13.     DBGridEh1: TDBGridEh;
  14.     DBGridEh2: TDBGridEh;
  15.     DBGridEh3: TDBGridEh;
  16.     BitBtn6: TBitBtn;
  17.     BitBtn7: TBitBtn;
  18.     PrintDBGridEh1: TPrintDBGridEh;
  19.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  20.     procedure BitBtn7Click(Sender: TObject);
  21.     procedure TabSheet1Show(Sender: TObject);
  22.     procedure TabSheet2Show(Sender: TObject);
  23.     procedure TabSheet3Show(Sender: TObject);
  24.     procedure BitBtn6Click(Sender: TObject);
  25.     procedure DBGridEh1KeyDown(Sender: TObject; var Key: Word;
  26.       Shift: TShiftState);
  27.     procedure DBGridEh2KeyDown(Sender: TObject; var Key: Word;
  28.       Shift: TShiftState);
  29.     procedure DBGridEh3KeyDown(Sender: TObject; var Key: Word;
  30.       Shift: TShiftState);
  31.   private
  32.     { Private declarations }
  33.   public
  34.     { Public declarations }
  35.   end;
  36. implementation
  37. uses Udm;
  38. {$R *.dfm}
  39. procedure Tfyg.FormClose(Sender: TObject; var Action: TCloseAction);
  40. begin
  41. action:=cafree;
  42. end;
  43. procedure Tfyg.BitBtn7Click(Sender: TObject);
  44. begin
  45. close;
  46. end;
  47. procedure Tfyg.TabSheet1Show(Sender: TObject);
  48. begin
  49.  adodm.tyg.Filtered:=false;
  50. end;
  51. procedure Tfyg.TabSheet2Show(Sender: TObject);
  52. begin
  53. adodm.tbm.Filtered:=false;
  54. end;
  55. procedure Tfyg.TabSheet3Show(Sender: TObject);
  56. begin
  57. adodm.tdw.Filter:='clientid >0';
  58. adodm.tdw.Filtered:=true;
  59. end;
  60. procedure Tfyg.BitBtn6Click(Sender: TObject);
  61. begin
  62.  printdbgrideh1.DBGridEh:=( pagecontrol1.ActivePage.Controls[0]) as tdbgrideh ;
  63.   printdbgrideh1.BeforeGridText.Text:=pagecontrol1.ActivePage.Caption+'一览表';
  64.   printdbgrideh1.AfterGridText.Text:=datetostr(date);
  65.   printdbgrideh1.Preview;
  66. end;
  67. procedure Tfyg.DBGridEh1KeyDown(Sender: TObject; var Key: Word;
  68.   Shift: TShiftState);
  69. begin
  70. if (key=vk_down) and adodm.tyg.Eof   then
  71. begin
  72. adodm.tyg.Append;
  73. dbgrideh1.Col:=1;
  74. end;
  75. end;
  76. procedure Tfyg.DBGridEh2KeyDown(Sender: TObject; var Key: Word;
  77.   Shift: TShiftState);
  78. begin
  79. if (key=vk_down) and adodm.tbm.Eof   then
  80. begin
  81. adodm.tbm.Append;
  82. dbgrideh2.Col:=1;
  83. end;
  84. end;
  85. procedure Tfyg.DBGridEh3KeyDown(Sender: TObject; var Key: Word;
  86.   Shift: TShiftState);
  87. begin
  88. if (key=vk_down) and adodm.tdw.Eof   then
  89. begin
  90. adodm.tdw.Append;
  91. dbgrideh3.Col:=1;
  92. end;
  93. end;
  94. end.