创建新业务单据,并关闭旧单据
procedure OpenCRKbills(aActID,aEntityID : Integer); var wfPkg_Bill: TWorkflowPackage; begin wfPkg_Bill.AppHandle:=Application.Handle; wfPkg_Bill.FormHandle:=0; wfPkg_Bill.ParentWindow:=0; wfPkg_Bill.PreSender:=0; wfPkg_Bill.PreSenderID:=0; wfPkg_Bill.Sender:=0; wfPkg_Bill.ProcID:=0; wfPkg_Bill.ActivityID:=aActID; wfPkg_Bill.TaskID:=0; wfPkg_Bill.TaskStatus:=wftsFinished; wfPkg_Bill.EntityID:=aEntityID; wfPkg_Bill.SQLCmdName:=''; wfPkg_Bill.ReportIdent:=''; ExecWorkflowPackage(wfPkg_Bill, Proc_ProcessTask); end; procedure BitBtnNewBillClick(Sender:Tobject); var AEntityID,ABillDeptID,i:Integer; Abn: TBillNo; Awfp:TWorkflowPackage; begin Awfp:=GetCurrentWorkflowPackage; ActivityCreateTasks(Awfp.Activityid,AEntityID); if AEntityid>0 then begin HostForm.Close; OpenCRKbills(Awfp.Activityid,AEntityID); end; end;