U_zgda.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:6k
- unit U_zgda;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Db, DBClient, ImgList, Menus, ComCtrls, ExtCtrls, StdCtrls, Mask, DBCtrls,
- Grids, DBGrids, Buttons;
- type
- TfrmZgda = class(TForm)
- Panel2: TPanel;
- StatusBar1: TStatusBar;
- ImageList1: TImageList;
- DataSource1: TDataSource;
- PopupMenu2: TPopupMenu;
- N1: TMenuItem;
- N2: TMenuItem;
- ImageList2: TImageList;
- N3: TMenuItem;
- N4: TMenuItem;
- Panel1: TPanel;
- Panel3: TPanel;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- SpeedButton3: TSpeedButton;
- SpeedButton4: TSpeedButton;
- SpeedButton5: TSpeedButton;
- DBNavigator1: TDBNavigator;
- N5: TMenuItem;
- N6: TMenuItem;
- PageControl1: TPageControl;
- TabSheet1: TTabSheet;
- DBGrid1: TDBGrid;
- TabSheet2: TTabSheet;
- Panel4: TPanel;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- Label9: TLabel;
- Label5: TLabel;
- Label10: TLabel;
- Label11: TLabel;
- Label12: TLabel;
- DBEdit1: TDBEdit;
- DBEdit2: TDBEdit;
- DBEdit3: TDBEdit;
- DBEdit4: TDBEdit;
- DBEdit6: TDBEdit;
- DBEdit7: TDBEdit;
- DBEdit8: TDBEdit;
- DBMemo1: TDBMemo;
- DBRadioGroup1: TDBRadioGroup;
- DBEdit5: TDBEdit;
- DBEdit9: TDBEdit;
- DataSource2: TDataSource;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure N2Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- procedure N3Click(Sender: TObject);
- procedure N4Click(Sender: TObject);
- procedure N5Click(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure SpeedButton3Click(Sender: TObject);
- procedure SpeedButton4Click(Sender: TObject);
- procedure SpeedButton5Click(Sender: TObject);
- procedure DBGrid1TitleClick(Column: TColumn);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- frmZgda: TfrmZgda;
- gs_bmbm: string;
- gb_pd: bool;
- implementation
- uses U_mainform, U_zgdakp, U_szcx, U_general_print,
- u_public, WzglDB;
- {$R *.DFM}
- procedure TfrmZgda.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- action := cafree;
- frmZgda := nil;
- end;
- procedure TfrmZgda.N2Click(Sender: TObject);
- begin
- try
- application.createform(TfrmZgda_Kp, frmZgda_Kp);
- DM.CDS_ZGDA.edit;
- frmZgda_Kp.showmodal;
- finally
- frmZgda_Kp.free;
- end;
- end;
- procedure TfrmZgda.N1Click(Sender: TObject);
- begin
- if DM.CDS_ZGDA.recordcount <> 0 then
- begin
- if Application.messagebox('请确认是否要删除', '物资管理系统', mb_iconinformation + mb_yesno) = idyes then
- begin
- DM.CDS_ZGDA.delete;
- DM.CDS_ZGDA.applyupdates(0);
- end;
- end
- else
- begin
- Application.messagebox('已没有记录可删除,请确认!', '物资管理系统', mb_iconinformation + mb_defbutton1);
- end;
- end;
- procedure TfrmZgda.N3Click(Sender: TObject);
- var
- vs_value: string;
- vi, i: integer;
- begin
- application.createform(TfrmSzcx, frmSzcx);
- frmSzcx.srclist.items.add('职工编号');
- frmSzcx.srclist.items.add('职工姓名');
- frmSzcx.srclist.items.add('性别');
- frmSzcx.srclist.items.add('出生年月');
- frmSzcx.srclist.items.add('政治面貌');
- frmSzcx.srclist.items.add('职称');
- try
- frmSzcx.showmodal;
- finally
- if Ordered then
- begin
- vi := frmSzcx.DstList.Items.Count;
- if vi > 0 then
- begin
- vs_value := frmSzcx.dstlist.items[0];
- end;
- for i := 2 to vi do
- begin
- vs_value := vs_value + ';' + frmSzcx.dstlist.items[i - 1];
- end;
- DM.CDS_ZGDA.IndexFieldNames := vs_value;
- end;
- frmSzcx.free;
- end;
- end;
- procedure TfrmZgda.N4Click(Sender: TObject);
- begin
- application.createform(TfrmPrint, frmPrint);
- with frmPrint do
- begin
- srclist.items.add('职工编号');
- srclist.items.add('职工姓名');
- srclist.items.add('性别');
- srclist.items.add('出生年月');
- srclist.items.add('政治面貌');
- srclist.items.add('职称');
- srclist.items.add('职务');
- srclist.items.add('职工属性');
- srclist.items.add('备注');
- vps_tablename := 'CL_ZGDA';
- vps_filter := DM.CDS_ZGDA.Filter;
- vps_index := DM.CDS_ZGDA.IndexFieldNames;
- edtPrintTitle.Text := '职工档案';
- try
- showmodal;
- finally
- free;
- end;
- end;
- end;
- procedure TfrmZgda.N5Click(Sender: TObject);
- begin
- application.CreateForm(TfrmZgda_Kp, frmZgda_Kp);
- try
- DM.CDS_ZGDA.insert;
- frmZgda_Kp.showmodal;
- finally
- frmZgda_Kp.free;
- end;
- end;
- procedure TfrmZgda.SpeedButton1Click(Sender: TObject);
- begin
- N5.click;
- end;
- procedure TfrmZgda.SpeedButton2Click(Sender: TObject);
- begin
- N1.click;
- end;
- procedure TfrmZgda.SpeedButton3Click(Sender: TObject);
- begin
- N2.click;
- end;
- procedure TfrmZgda.SpeedButton4Click(Sender: TObject);
- begin
- N4.click;
- end;
- procedure TfrmZgda.SpeedButton5Click(Sender: TObject);
- begin
- N6.click;
- end;
- procedure TfrmZgda.DBGrid1TitleClick(Column: TColumn);
- begin
- DbGridSort(dbgrid1, column);
- end;
- procedure TfrmZgda.FormCreate(Sender: TObject);
- begin
- with DM do
- begin
- CDS_BMDA.Active := True;
- CDS_ZGDA.Active := True;
- CDS_ZGDA_INDEX.Active := True;
- end;
- DM.CDS_ZGDA.FieldByName('出生年月').editmask := '9999/99;1;_';
- DM.CDS_BMDA.close;
- DM.CDS_BMDA.MasterSource := datasource1;
- DM.CDS_BMDA.MasterFields := '所属部门编码';
- DM.CDS_BMDA.IndexFieldNames := '部门编码';
- DM.CDS_BMDA.open;
- end;
- end.