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

医药行业

开发平台:

Delphi

  1. unit Uypzdk;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs,udm, StdCtrls, Buttons, Grids, DBGridEh,uypzdk2, PrnDbgeh, Mask,
  6.   DBCtrlsEh, DBLookupEh, ComCtrls;
  7. type
  8.   Tfypzdk = class(TForm)
  9.     Label1: TLabel;
  10.     dbshow: TDBGridEh;
  11.     PrintDBGridEh1: TPrintDBGridEh;
  12.     search: TDBLookupComboboxEh;
  13.     SpeedButton1: TSpeedButton;
  14.     TabControl1: TTabControl;
  15.     BitBtn2: TBitBtn;
  16.     BitBtn3: TBitBtn;
  17.     BitBtn8: TBitBtn;
  18.     BitBtn9: TBitBtn;
  19.     BitBtn10: TBitBtn;
  20.     procedure BitBtn1Click(Sender: TObject);
  21.     procedure BitBtn6Click(Sender: TObject);
  22.     procedure BitBtn7Click(Sender: TObject);
  23.     procedure BitBtn5Click(Sender: TObject);
  24.     procedure BitBtn4Click(Sender: TObject);
  25.     procedure searchChange(Sender: TObject);
  26.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  27.     procedure searchExit(Sender: TObject);
  28.   private
  29.     { Private declarations }
  30.   public
  31.     { Public declarations }
  32.   end;
  33. implementation
  34. {$R *.dfm}
  35. procedure Tfypzdk.BitBtn1Click(Sender: TObject);
  36. begin
  37.   dbshow.DataSource.DataSet.Append;
  38.   fypzdk2.btadd.Show;
  39.   fypzdk2.ShowModal;
  40. end;
  41. procedure Tfypzdk.BitBtn6Click(Sender: TObject);
  42. begin
  43.   printdbgrideh1.AfterGridText.Text:=datetostr(date);
  44.   printdbgrideh1.Preview;
  45. end;
  46. procedure Tfypzdk.BitBtn7Click(Sender: TObject);
  47. begin
  48.   close;
  49. end;
  50. procedure Tfypzdk.BitBtn5Click(Sender: TObject);
  51. begin
  52.  if messagedlg('专家建议不要删除此数据,是否真要删除此条数据?',mtwarning,[mbyes,mbcancel],0)=mryes then
  53.   try
  54.   dbshow.DataSource.DataSet.Delete;
  55.   except
  56.   messagedlg('删除数据时出错!',mterror,[mbok],0);
  57.   end;
  58. end;
  59. procedure Tfypzdk.BitBtn4Click(Sender: TObject);
  60. begin
  61.  fypzdk2.btadd.Visible:=false;
  62.  dbshow.DataSource.DataSet.edit;
  63.  fypzdk2.pf.Enabled:=false;
  64.  fypzdk2.ls.Enabled:=false;
  65.  fypzdk2.look1.Visible:=true;
  66.  fypzdk2.ShowModal;
  67.  
  68. end;
  69. procedure Tfypzdk.searchChange(Sender: TObject);
  70. begin
  71. if trim(search.Text)<>'' then
  72.  begin
  73.   adodm.typzdk.DisableControls;
  74.   adodm.typzdk.filtered:=false;
  75.   adodm.typzdk.Filter:=' 编号 like '''+trim(search.text)+'%'' or '+'简码 like '''+trim(search.text)+'%'' or '+'名称 like '''+trim(search.text)+'%''' ;
  76.   //showmessage(adodm.typzdk.Filter);
  77.   adodm.typzdk.Filtered:=true;
  78.   adodm.typzdk.EnableControls;
  79.  end
  80. else
  81.   adodm.typzdk.Filtered:=false;
  82. end;
  83. procedure Tfypzdk.FormClose(Sender: TObject; var Action: TCloseAction);
  84. begin
  85. adodm.typzdk.Filtered:=false;
  86. action:=cafree;
  87. end;
  88. procedure Tfypzdk.searchExit(Sender: TObject);
  89. begin
  90.   if adodm.typzdk.Filtered then
  91.   postmessage(search.Handle,wm_keydown,vk_down,0);
  92. end;
  93. end.