unit workflow; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, dxCntner, dxTL, dxDBCtrl,dxGrClms, dxDBGrid, DB, ADODB, dxDBTLCl, Mask, wwdbedit, Wwdotdot, Wwdbcomb, StdCtrls, wwdblook, Grids, Wwdbigrd, Wwdbgrid, bsSkinCtrls; type Tfrm_workflow = class(TForm) t_workflow1: TDataSource; t_workflow: TADOQuery; t_workflow_step1: TDataSource; t_workflow_step: TADOQuery; t_workflow_step_emp: TADOQuery; t_workflow_step_emp1: TDataSource; dxDBGrid2: TdxDBGrid; dxDBGrid3: TdxDBGrid; dxDBGrid2Column1: TdxDBGridColumn; dxDBGrid2Column2: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridCheckColumn; dxDBGrid3Column1: TdxDBGridColumn; wwDBGrid1: TwwDBGrid; wwDBLookupCombo1: TwwDBLookupCombo; wwDBComboBox1: TwwDBComboBox; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinButton14: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure t_workflow_step_empAfterInsert(DataSet: TDataSet); procedure t_workflow_stepAfterInsert(DataSet: TDataSet); procedure t_workflowAfterInsert(DataSet: TDataSet); procedure t_workflowBeforeDelete(DataSet: TDataSet); procedure t_workflow_stepBeforeDelete(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton14Click(Sender: TObject); procedure t_workflow_step_empBeforePost(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var frm_workflow: Tfrm_workflow; implementation uses u_main, my_sys_function,u_data_share; {$R *.dfm} procedure Tfrm_workflow.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_workflow.Hide; frm_workflow.ManualFloat(frm_workflow.BoundsRect ); frm_main.freeTabs('frm_workflow'); action:=cafree; frm_workflow:=nil; end; procedure Tfrm_workflow.FormShow(Sender: TObject); begin // t_workflow.Close; t_workflow.Open; t_workflow_step.Close; t_workflow_step.Open; t_workflow_step_emp.Close; t_workflow_step_emp.Open; end; procedure Tfrm_workflow.t_workflow_step_empAfterInsert(DataSet: TDataSet); begin DataSet['录入人']:=employee; DataSet['录入日期']:=Date; t_workflow_step_emp['W_ID']:=t_workflow_step['W_ID']; t_workflow_step_emp['WI_ID']:=t_workflow_step['WI_ID']; end; procedure Tfrm_workflow.t_workflow_stepAfterInsert(DataSet: TDataSet); begin DataSet['录入人']:=employee; DataSet['录入日期']:=Date; end; procedure Tfrm_workflow.t_workflowAfterInsert(DataSet: TDataSet); begin DataSet['录入人']:=employee; DataSet['录入日期']:=Date; DataSet['路径名称']:=''; DataSet['业务方式']:='普通'; DataSet['付费方式']:=''; DataSet['有无杂费']:=0; DataSet['利润']:=0; DataSet['利润止']:=50; DataSet['利润条件']:='<='; end; procedure Tfrm_workflow.t_workflowBeforeDelete(DataSet: TDataSet); begin if (t_workflow_step.RecordCount>=1) or (t_workflow_step_emp.RecordCount>=1) then begin ShowMessage('存在明细不能删除,请先删除步骤明细'); abort; end; end; procedure Tfrm_workflow.t_workflow_stepBeforeDelete(DataSet: TDataSet); begin if (t_workflow_step_emp.RecordCount>=1) then begin ShowMessage('存在明细不能删除,请先删除审核人明细'); abort; end; end; procedure Tfrm_workflow.bsSkinButton1Click(Sender: TObject); begin t_workflow_step.Append; end; procedure Tfrm_workflow.bsSkinButton8Click(Sender: TObject); begin t_workflow_step_emp.Append; end; procedure Tfrm_workflow.bsSkinButton2Click(Sender: TObject); begin if t_workflow_step.IsEmpty then exit; table_post(t_workflow_step); end; procedure Tfrm_workflow.bsSkinButton12Click(Sender: TObject); begin if t_workflow_step_emp.IsEmpty then exit; table_post(t_workflow_step_emp); end; procedure Tfrm_workflow.bsSkinButton3Click(Sender: TObject); begin t_workflow_step.delete; end; procedure Tfrm_workflow.bsSkinButton13Click(Sender: TObject); begin t_workflow_step_emp.delete; end; procedure Tfrm_workflow.bsSkinButton4Click(Sender: TObject); begin table_cancel(t_workflow_step); end; procedure Tfrm_workflow.bsSkinButton14Click(Sender: TObject); begin table_cancel(t_workflow_step_emp); end; procedure Tfrm_workflow.t_workflow_step_empBeforePost(DataSet: TDataSet); begin table_before_post(t_workflow_step_emp,'姓名'); if not frm_data_share.t_sys_employee.Locate('姓名',trim(t_workflow_step_emp.fieldbyname('姓名').asstring),[]) then begin showmessage('系统中不存在该'+t_workflow_step_emp.fieldbyname('姓名').asstring+',请核对'); abort; end; end; end.