1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- $PBExportHeader$f_ct_msttake.srf
- global type f_ct_msttake from function_object
- end type
- forward prototypes
- global function integer f_ct_msttake (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit)
- end prototypes
- global function integer f_ct_msttake (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit);int rslt = 1
- long ll_takeid,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_msttake"
- 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_takeid = ds.object.takeid[ll_i]
- ls_billcode = ds.object.billcode[ll_i]
-
- w_sys_wait_jdt.st_msg.Text = ls_billcode+" 正在处理..." //进度信息
-
- select count(*) into :cnt
- from u_bmsttakemx
- where takeid = :ll_takeid
- and takedate > :arg_ctdt;
- if sqlca.sqlcode <> 0 then
- arg_msg = '查询单据:'+ls_billcode+'明细资料错误'
- rslt = 0
- goto ext
- end if
-
- if cnt > 0 then continue
-
- update u_bmsttakemx set delflag = 1
- where takeid = :ll_takeid;
- if sqlca.sqlcode <> 0 then
- arg_msg = '更新单据:'+ls_billcode+'明细删除标记错误,'+sqlca.sqlerrtext
- rslt = 0
- goto ext
- end if
-
- update u_bmsttake set delflag = 1
- where takeid = :ll_takeid;
- 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
|