u_yfdwkp.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:4k
- unit u_yfdwkp;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, DBCtrls, Mask, ComCtrls, Buttons, ExtCtrls, Db, DBClient,
- Grids, DBGrids;
- type
- TForm62 = class(TForm)
- Panel1: TPanel;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- ClientDataSet1: TClientDataSet;
- ClientDataSet1ID: TIntegerField;
- ClientDataSet1CDSDesigner: TStringField;
- ClientDataSet1CDSDesigner2: TStringField;
- Panel2: TPanel;
- PageControl1: TPageControl;
- TabSheet1: TTabSheet;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- Label5: TLabel;
- Label16: TLabel;
- DBEdit1: TDBEdit;
- DBEdit2: TDBEdit;
- DBEdit3: TDBEdit;
- DBEdit4: TDBEdit;
- DBEdit6: TDBEdit;
- DBEdit7: TDBEdit;
- DBCheckBox2: TDBCheckBox;
- DBCheckBox1: TDBCheckBox;
- DBEdit5: TDBEdit;
- BitBtn1: TBitBtn;
- Edit1: TEdit;
- TabSheet2: TTabSheet;
- Label8: TLabel;
- Label9: TLabel;
- Label10: TLabel;
- Label11: TLabel;
- Label12: TLabel;
- Label13: TLabel;
- Label14: TLabel;
- Label15: TLabel;
- DBEdit8: TDBEdit;
- DBEdit9: TDBEdit;
- DBEdit10: TDBEdit;
- DBEdit11: TDBEdit;
- DBEdit12: TDBEdit;
- DBEdit13: TDBEdit;
- DBEdit14: TDBEdit;
- DBEdit15: TDBEdit;
- ClientDataSet_index: TClientDataSet;
- DBGrid1: TDBGrid;
- DataSource1: TDataSource;
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure BitBtn1Click(Sender: TObject);
- procedure FormActivate(Sender: TObject);
- procedure DBEdit5Change(Sender: TObject);
- procedure DBGrid1DblClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form62: TForm62;
- implementation
- uses U_yfdw, U_mainform;
- {$R *.DFM}
- procedure TForm62.SpeedButton1Click(Sender: TObject);
- var
- s_yfdwbh: string;
- begin
- if trim(dbedit1.text) = '' then
- begin
- application.messagebox('乙方单位编号应该输入,请确认!', '物资管理系统', mb_iconinformation + mb_defbutton1);
- dbedit1.SetFocus;
- exit;
- end;
- //重复编号
- s_yfdwbh := dbedit1.Text;
- clientdataset_index.IndexFieldNames := '乙方单位编号';
- clientdataset_index.Refresh;
- if form60.clientdataset1.state = dsinsert then
- begin
- if clientdataset_index.FindKey([s_yfdwbh]) then
- begin
- application.MessageBox('乙方单位编号已重复', '物资管理系统', mb_iconinformation + mb_defbutton1);
- pagecontrol1.ActivePageIndex := 0;
- dbedit1.SetFocus;
- exit;
- end;
- end;
- if trim(dbedit2.text) = '' then
- begin
- application.messagebox('乙方单位名称应该输入,请确认!', '物资管理系统', mb_iconinformation + mb_defbutton1);
- dbedit2.SetFocus;
- exit;
- end;
- form60.clientdataset1.Post;
- form60.clientdataset1.ApplyUpdates(0);
- close;
- end;
- procedure TForm62.SpeedButton2Click(Sender: TObject);
- begin
- close;
- end;
- procedure TForm62.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- form60.clientdataset1.Cancel;
- form60.clientdataset1.cancelupdates;
- end;
- procedure TForm62.BitBtn1Click(Sender: TObject);
- begin
- dbgrid1.Visible:=true;
- {application.createform(Tform14,form14);
- try
- form14.showmodal;
- finally
- form14.free;
- form60.ClientDataSet1.FieldByName('所属地区码').value:=gs_dqbm;
- end;}
- end;
- procedure TForm62.FormActivate(Sender: TObject);
- var
- s_dqdm: string;
- begin
- {s_dqdm:=dbedit5.Text;
- clientdataset1.IndexFieldNames:='类别编码';
- if clientdataset1.FindKey([s_dqdm]) then
- edit1.text:=clientdataset1.fieldbyname('类别名称').asstring
- else
- edit1.text:=''; }
- end;
- procedure TForm62.DBEdit5Change(Sender: TObject);
- var
- s_dqdm: string;
- begin
- {s_dqdm:=dbedit5.Text;
- clientdataset1.IndexFieldNames:='类别编码';
- if clientdataset1.FindKey([s_dqdm]) then
- edit1.text:=clientdataset1.fieldbyname('类别名称').asstring
- else
- edit1.text:='';}
- end;
- procedure TForm62.DBGrid1DblClick(Sender: TObject);
- begin
- form60.ClientDataSet1.FieldByName('所属地区码').value:=ClientDataSet1.FieldByName('类别编码').value;
- edit1.text:=ClientDataSet1.FieldByName('类别名称').value;
- dbgrid1.Visible:=false;
- end;
- end.