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

Delphi控件源码

开发平台:

Delphi

  1. unit Am_AJJDs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ExtCtrls, DB, StdCtrls, Mask, DBCtrls, Buttons, DBCtrlsEh;
  6. type
  7.   TAm_AJJD = class(TForm)
  8.     Panel1: TPanel;
  9.     Label1: TLabel;
  10.     DataSource1: TDataSource;
  11.     Label2: TLabel;
  12.     Label3: TLabel;
  13.     Label4: TLabel;
  14.     DBEdit4: TDBEdit;
  15.     DBMemo1: TDBMemo;
  16.     DBMemo2: TDBMemo;
  17.     btn_save: TSpeedButton;
  18.     btn_quit: TSpeedButton;
  19.     DBEditEh1: TDBEditEh;
  20.     procedure btn_quitClick(Sender: TObject);
  21.     procedure btn_saveClick(Sender: TObject);
  22.     procedure FormCreate(Sender: TObject);
  23.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  24.   private
  25.     { Private declarations }
  26.   public
  27.     { Public declarations }
  28.   end;
  29. var
  30.   Am_AJJD: TAm_AJJD;
  31. implementation
  32. uses DMs, Am_Ajxhs, mainfrms;
  33. {$R *.dfm}
  34. procedure TAm_AJJD.btn_quitClick(Sender: TObject);
  35. begin
  36.   close;
  37. end;
  38. procedure TAm_AJJD.btn_saveClick(Sender: TObject);
  39. var i:integer;
  40. begin
  41.    dm.am_ajxh.Edit;
  42.    dm.am_ajxh.FieldByName('ajxh_jdrq').AsString:=dbediteh1.Text;
  43.    dm.am_ajxh.FieldByName('aj_xh').AsString:=dm.V_ajgl_dxh.fieldbyname('aj_xh').AsString;
  44.    dm.am_ajxh.ApplyUpdates(0);
  45.    i:=dm.am_ajxh.ApplyUpdates(0);
  46.    if i=0 then
  47.     begin
  48.        application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
  49.        am_ajxh.toolbutton2.enabled:=true;
  50.        close;
  51.     end
  52.    else
  53.     begin
  54.       application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
  55.       close;
  56.     end
  57. end;
  58. procedure TAm_AJJD.FormCreate(Sender: TObject);
  59. begin
  60.   dbediteh1.Text:=formatdatetime('yyyy-mm-dd',now);
  61. end;
  62. procedure TAm_AJJD.FormClose(Sender: TObject; var Action: TCloseAction);
  63. begin
  64.   action:=cafree;
  65.   am_ajjd:=nil;
  66. end;
  67. end.