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

Delphi控件源码

开发平台:

Delphi

  1. unit AM_dzs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, DB, Grids, DBGridEh, XPBarMenu, ComCtrls, ToolWin, DBClient,
  6.   FR_Class, PrnDbgeh;
  7. type
  8.   Tam_dz = 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.     XPBarMenu1: TXPBarMenu;
  19.     DBGridEh1: TDBGridEh;
  20.     DS_V_DZ: TDataSource;
  21.     PrintDBGridEh1: TPrintDBGridEh;
  22.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  23.     procedure ToolButton7Click(Sender: TObject);
  24.     procedure ToolButton2Click(Sender: TObject);
  25.     procedure ToolButton3Click(Sender: TObject);
  26.     procedure ToolButton4Click(Sender: TObject);
  27.     procedure FormCreate(Sender: TObject);
  28.     procedure DBGridEh1DblClick(Sender: TObject);
  29.     procedure ToolButton1Click(Sender: TObject);
  30.     procedure ToolButton6Click(Sender: TObject);
  31.     procedure ToolButton5Click(Sender: TObject);
  32.   private
  33.     { Private declarations }
  34.   public
  35.     { Public declarations }
  36.   end;
  37. var
  38.   am_dz: Tam_dz;
  39. implementation
  40. uses dms, am_dzbjs, am_dz_cxs, Am_dz_Ps;
  41. {$R *.dfm}
  42. procedure Tam_dz.FormClose(Sender: TObject; var Action: TCloseAction);
  43. begin
  44.   Dm.am_dz.Active:=false;
  45.   dm.am_jygz.Active:=false;
  46.   DM.sz_zjlb.Active:=false;
  47.   dm.V_DZ.Active:=false;
  48.   action:=cafree;
  49.   Am_dz:=nil;
  50. end;
  51. procedure Tam_dz.ToolButton7Click(Sender: TObject);
  52. begin
  53.  close;
  54. end;
  55. procedure Tam_dz.ToolButton2Click(Sender: TObject);
  56. var s:string;
  57. begin
  58.   s:=dm.V_DZ.fieldbyname('dz_dm').AsString;
  59.   am_dzbj:=Tam_dzbj.create(self);
  60.   am_dzbj.Label1.Caption:='修改读者';
  61.   Dm.am_dz.Close;
  62.   dm.am_dz.CommandText:='select * from Am_dz where DZ_dm='+''''+s+''''+'';
  63.   dm.am_dz.Open;
  64.   DM.am_dz.Edit;
  65.   am_dzbj.MaskEdit1.Text:=dm.am_dz.fieldbyname('dz_lxdh').AsString;
  66.   am_dzbj.ShowModal;
  67. end;
  68. procedure Tam_dz.ToolButton3Click(Sender: TObject);
  69. var s:string;
  70. begin
  71.  s:=dm.V_DZ.fieldbyname('dz_dm').AsString;
  72.  if Dm.am_dz.RecordCount=0 then
  73.  begin
  74.     application.MessageBox('表中没有数据不能删除!','提示',mb_iconinformation+mb_defbutton1);
  75.     Abort;
  76.   end
  77.   else
  78.    if application.MessageBox('您确定要删除当前纪录吗?','警告',mb_okcancel+mb_iconquestion)=idok then
  79.    begin
  80.        dm.am_dz.Close;
  81.        dm.am_dz.CommandText:='select * from am_dz where dz_dm='+''''+s+''''+'';
  82.        dm.am_dz.Open;
  83.        Dm.am_dz.Delete;
  84.        Dm.am_dz.ApplyUpdates(0);
  85.        toolbutton4.Click;
  86.     end; 
  87. end;
  88. procedure Tam_dz.ToolButton4Click(Sender: TObject);
  89. begin
  90.  dm.am_dz.Close;
  91.  dm.am_dz.CommandText:='select * from am_dz';
  92.  dm.am_dz.Open;
  93.  //刷新视图
  94.  dm.V_DZ.Close;
  95.  dm.V_DZ.CommandText:='select * from V_DZ';
  96.  dm.V_DZ.Open;
  97. end;
  98. procedure Tam_dz.FormCreate(Sender: TObject);
  99. begin
  100.  Dm.am_dz.Active:=true;
  101.  dm.am_jygz.Active:=true;
  102.  DM.sz_zjlb.Active:=true;
  103.  dm.V_DZ.Active:=true;
  104. end;
  105. procedure Tam_dz.DBGridEh1DblClick(Sender: TObject);
  106. begin
  107.   Toolbutton4.Click;
  108.   Toolbutton2.Click;
  109. end;
  110. procedure Tam_dz.ToolButton1Click(Sender: TObject);
  111. begin
  112.   am_dzbj:=Tam_dzbj.create(application);
  113.   dm.am_dz.Close;
  114.   dm.am_dz.CommandText:='select * from am_dz where dz_dm='+''''+''''+'';
  115.   dm.am_dz.Open;
  116.   am_dzbj.Label1.Caption:='增加读者';
  117.   am_dzbj.showmodal;
  118. end;
  119. procedure Tam_dz.ToolButton6Click(Sender: TObject);
  120. begin
  121. { DbGrideh1.Columns[0].Width:=60;
  122.  DBgrideh1.columns[1].Width:=60;
  123.  printDbGrideh1.Title.Text:='读者管理';
  124.  printdbgrideh1.BeforeGridText.Text:='生产通知单汇总打印';
  125.  printDBGrideh1.AfterGridText.Text:=datetostr(date);
  126.  PrintDBGridEh1.Preview;}
  127.  am_dz_p:=Tam_dz_P.create(application);
  128.  //am_dz_P.QuickRep1.Preview;
  129.  am_dz_p.QuickRep1.Preview;
  130. end;
  131. procedure Tam_dz.ToolButton5Click(Sender: TObject);
  132. begin
  133.  if am_dz_cx=Nil then
  134.   begin
  135.     am_dz_cx:=Tam_dz_cx.create(self);
  136.     am_dz_cx.showmodal;
  137.   end;
  138. end;
  139. end.