U_htglkp.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:3k
源码类别:

Delphi/CppBuilder

开发平台:

Delphi

  1. unit U_htglkp;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   StdCtrls, Mask, DBCtrls, ExtCtrls, Buttons, Db, DBClient;
  6. type
  7.   TForm60 = class(TForm)
  8.     Panel1: TPanel;
  9.     Panel2: TPanel;
  10.     Label1: TLabel;
  11.     DBEdit1: TDBEdit;
  12.     Label3: TLabel;
  13.     DBEdit3: TDBEdit;
  14.     Label2: TLabel;
  15.     DBEdit2: TDBEdit;
  16.     Label4: TLabel;
  17.     Edit1: TEdit;
  18.     Shape1: TShape;
  19.     SpeedButton1: TSpeedButton;
  20.     SpeedButton2: TSpeedButton;
  21.     BitBtn1: TBitBtn;
  22.     BitBtn2: TBitBtn;
  23.     ClientDataSet1: TClientDataSet;
  24.     ClientDataSet1ID: TIntegerField;
  25.     ClientDataSet1CDSDesigner: TStringField;
  26.     ClientDataSet1CDSDesigner2: TStringField;
  27.     ClientDataSet1CDSDesigner3: TStringField;
  28.     procedure SpeedButton1Click(Sender: TObject);
  29.     procedure SpeedButton2Click(Sender: TObject);
  30.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  31.     procedure BitBtn1Click(Sender: TObject);
  32.     procedure BitBtn2Click(Sender: TObject);
  33.     procedure FormShow(Sender: TObject);
  34.   private
  35.     { Private declarations }
  36.   public
  37.     { Public declarations }
  38.   end;
  39. var
  40.   Form60: TForm60;
  41. implementation
  42. uses U_htgd,  U_mainform;
  43. {$R *.DFM}
  44. procedure TForm60.SpeedButton1Click(Sender: TObject);
  45. begin
  46.   if dbedit1.text = '' then
  47.   begin
  48.     application.messagebox('合同编号不能为空', '合同管理系统', mb_iconinformation + mb_defbutton1);
  49.     dbedit1.SetFocus;
  50.     exit;
  51.   end;
  52.   if dbedit2.text = '' then
  53.   begin
  54.     application.messagebox('归档编号不能为空', '合同管理系统', mb_iconinformation + mb_defbutton1);
  55.     dbedit2.SetFocus;
  56.     exit;
  57.   end;
  58.   form19.ClientDataSet1.Edit;
  59.   form19.clientdataset1.post;
  60.   form19.clientdataset1.ApplyUpdates(0);
  61.   close;
  62. end;
  63. procedure TForm60.SpeedButton2Click(Sender: TObject);
  64. begin
  65.   close;
  66. end;
  67. procedure TForm60.FormClose(Sender: TObject; var Action: TCloseAction);
  68. begin
  69.   form19.ClientDataSet1.Cancel;
  70. end;
  71. procedure TForm60.BitBtn1Click(Sender: TObject);
  72. begin
  73.   application.createform(tform62, form62);
  74.   try
  75.     form62.showmodal;
  76.   finally
  77.     form62.free;
  78.   end;
  79. end;
  80. procedure TForm60.BitBtn2Click(Sender: TObject);
  81. begin
  82.   application.createform(tform61, form61);
  83.   try
  84.     form61.showmodal;
  85.   finally
  86.     if clientdataset1.active = false then
  87.       clientdataset1.open;
  88.     clientdataset1.IndexFieldNames := '归档编号';
  89.     if clientdataset1.FindKey([dbedit2.text]) then
  90.       edit1.text := clientdataset1.fieldbyname('归档标题').asstring
  91.     else
  92.       edit1.text := '';
  93.   end;
  94.   form61.free;
  95. end;
  96. procedure TForm60.FormShow(Sender: TObject);
  97. begin
  98.   if clientdataset1.active = false then
  99.     clientdataset1.open;
  100.   clientdataset1.IndexFieldNames := '归档编号';
  101.   if clientdataset1.FindKey([dbedit2.text]) then
  102.     edit1.text := clientdataset1.fieldbyname('归档标题').asstring
  103.   else
  104.     edit1.text := '';
  105. end;
  106. end.