$PBExportHeader$f_ct_mstpay.srf global type f_ct_mstpay from function_object end type forward prototypes global function integer f_ct_mstpay (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit) end prototypes global function integer f_ct_mstpay (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit);int rslt = 1 long ll_payid,ll_rowcnt,ll_i,cnt,del_cnt string ls_billcode datastore ds String char_enter char_enter = Char(13)+Char(10) //换行符 ds = CREATE datastore ds.DataObject = "ds_ct_mstpay" ds.SetTransObject(sqlca) ll_rowcnt = ds.Retrieve(arg_ctdt) ds.accepttext() Open(w_sys_wait_jdt) //初始化进度条 w_sys_wait_jdt.Show() w_sys_wait_jdt.wf_accepttol(ll_rowcnt) for ll_i = 1 to ll_rowcnt cnt = 0 ll_payid = ds.object.payid[ll_i] ls_billcode = ds.object.billcode[ll_i] w_sys_wait_jdt.st_msg.Text = ls_billcode+" 正在处理..." //进度信息 select count(*) into :cnt from u_bmstpaymx where payid = :ll_payid and paydate > :arg_ctdt; if sqlca.sqlcode <> 0 then arg_msg = '查询单据:'+ls_billcode+'明细资料错误' rslt = 0 goto ext end if if cnt > 0 then continue update u_bmstpaymx set delflag = 1 where payid = :ll_payid; if sqlca.sqlcode <> 0 then arg_msg = '更新单据:'+ls_billcode+'明细删除标记错误,'+sqlca.sqlerrtext rslt = 0 goto ext end if update u_bmstpay set delflag = 1 where payid = :ll_payid; if sqlca.sqlcode <> 0 then arg_msg = '更新单据:'+ls_billcode+'删除标记错误,'+sqlca.sqlerrtext rslt = 0 goto ext end if del_cnt++ w_sys_wait_jdt.wf_inc(ll_i) //进度 next arg_log = arg_log + "> "+String(del_cnt)+ " [应付帐] 更新删除标记成功"+char_enter ext: if rslt = 0 then rollback; elseif rslt = 1 and arg_ifcommit then commit; end if close(w_sys_wait_jdt) return rslt end function