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

Delphi控件源码

开发平台:

Delphi

  1. unit am_ajyjs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, DB, ImgList, DBCtrlsEh, StdCtrls, DBCtrls, DBLookupEh, Mask,
  6.   Buttons, ExtCtrls;
  7. type
  8.   Tam_ajyj = class(TForm)
  9.     Panel2: TPanel;
  10.     Panel1: TPanel;
  11.     Label1: TLabel;
  12.     Label2: TLabel;
  13.     Label3: TLabel;
  14.     Label4: TLabel;
  15.     Label5: TLabel;
  16.     Label6: TLabel;
  17.     Label7: TLabel;
  18.     Label8: TLabel;
  19.     Label9: TLabel;
  20.     Label10: TLabel;
  21.     Label11: TLabel;
  22.     Label12: TLabel;
  23.     Label13: TLabel;
  24.     Label14: TLabel;
  25.     Label15: TLabel;
  26.     Label16: TLabel;
  27.     Label17: TLabel;
  28.     Label18: TLabel;
  29.     Label19: TLabel;
  30.     Label20: TLabel;
  31.     Label21: TLabel;
  32.     Label22: TLabel;
  33.     Label23: TLabel;
  34.     Label24: TLabel;
  35.     Label25: TLabel;
  36.     DBEdit3: TDBEdit;
  37.     DBEdit4: TDBEdit;
  38.     DBEdit5: TDBEdit;
  39.     DBEdit6: TDBEdit;
  40.     DBEdit9: TDBEdit;
  41.     DBEdit11: TDBEdit;
  42.     DBEdit14: TDBEdit;
  43.     DBEdit16: TDBEdit;
  44.     DBEdit17: TDBEdit;
  45.     DBLookupComboboxEh1: TDBLookupComboboxEh;
  46.     DBLookupComboboxEh2: TDBLookupComboboxEh;
  47.     DBLookupComboboxEh3: TDBLookupComboboxEh;
  48.     DBMemo1: TDBMemo;
  49.     DBMemo2: TDBMemo;
  50.     DBMemo3: TDBMemo;
  51.     DBEditEh1: TDBEditEh;
  52.     DBEditEh3: TDBEditEh;
  53.     DBEditEh4: TDBEditEh;
  54.     DBEditEh5: TDBEditEh;
  55.     DBEditEh6: TDBEditEh;
  56.     DBLookupComboboxEh4: TDBLookupComboboxEh;
  57.     DBLookupComboboxEh5: TDBLookupComboboxEh;
  58.     ImageList1: TImageList;
  59.     ds_ajgl: TDataSource;
  60.     Panel3: TPanel;
  61.     Label27: TLabel;
  62.     Label29: TLabel;
  63.     Label28: TLabel;
  64.     DBEdit8: TDBEdit;
  65.     Label30: TLabel;
  66.     DBEdit10: TDBEdit;
  67.     Label31: TLabel;
  68.     DBEdit12: TDBEdit;
  69.     DBMemo4: TDBMemo;
  70.     Ds_Ajyj: TDataSource;
  71.     Label26: TLabel;
  72.     Label32: TLabel;
  73.     Label33: TLabel;
  74.     DBEditEh2: TDBEditEh;
  75.     SpeedButton1: TSpeedButton;
  76.     SpeedButton4: TSpeedButton;
  77.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  78.     procedure FormCreate(Sender: TObject);
  79.     procedure SpeedButton4Click(Sender: TObject);
  80.     procedure SpeedButton1Click(Sender: TObject);
  81.   private
  82.     { Private declarations }
  83.   public
  84.     { Public declarations }
  85.   end;
  86. var
  87.   am_ajyj: Tam_ajyj;
  88. implementation
  89. uses dms,u_public,am_gdajs;
  90. {$R *.dfm}
  91. procedure Tam_ajyj.FormClose(Sender: TObject; var Action: TCloseAction);
  92. begin
  93.   action:=cafree;
  94.   am_ajyj:=Nil;
  95. end;
  96. //******************************************************************************
  97. procedure Tam_ajyj.FormCreate(Sender: TObject);
  98. begin
  99.   dbediteh2.Text:=formatdatetime('yyyy-mm-dd',now);
  100. end;
  101. procedure Tam_ajyj.SpeedButton4Click(Sender: TObject);
  102. begin
  103.  Close;
  104. end;
  105. procedure Tam_ajyj.SpeedButton1Click(Sender: TObject);
  106. var i,j:integer;
  107.     s:string;
  108. begin
  109.   if dbedit8.Text='' then
  110.    begin
  111.      application.MessageBox('接收单位不能为空','提示',mb_ok+mb_iconinformation);
  112.    end;
  113.     if dbedit10.Text='' then
  114.    begin
  115.      application.MessageBox('移交单位不能为空','提示',mb_ok+mb_iconinformation);
  116.    end;
  117.    if dbedit12.Text='' then
  118.    begin
  119.      application.MessageBox('移交人不能为空','提示',mb_ok+mb_iconinformation);
  120.    end;
  121.    dm.Am_Ajyj.FieldByName('ajyj_yjrq').AsString:=dbediteh2.Text;
  122.    dm.Am_Ajyj.FieldByName('aj_xh').AsString:=dm.V_ajgd.fieldbyname('aj_xh').AsString;
  123.    i:=dm.Am_Ajyj.ApplyUpdates(0);
  124.   if i=0 then
  125.    begin
  126.      application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
  127.      close;
  128.    end
  129.    else
  130.    begin
  131.      application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
  132.      exit;
  133.    end;
  134.  //----------将案卷状态改变
  135.   s:=dm.v_ajgd.fieldbyname('aj_xh').AsString;
  136.   dm.V_ajgd.Close;
  137.   dm.V_ajgd.CommandText:='update v_ajgd set ajzt_mc=''移出案卷'',kw_dm=Null where aj_xh='+''''+s+''''+'';
  138.   dm.V_ajgd.Execute;
  139.   dm.V_AJGD.Close;
  140.   dm.v_ajgd.CommandText:='select * from v_Ajgd where ajlb_dm='+''''+gdaj_s2+''''+'';
  141.   dm.v_ajgd.Open;//案卷归档管理  
  142. end;
  143. end.