f_ct_msttake.srf 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. $PBExportHeader$f_ct_msttake.srf
  2. global type f_ct_msttake from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_ct_msttake (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit)
  6. end prototypes
  7. global function integer f_ct_msttake (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit);int rslt = 1
  8. long ll_takeid,ll_rowcnt,ll_i,cnt,del_cnt
  9. string ls_billcode
  10. datastore ds
  11. String char_enter
  12. char_enter = Char(13)+Char(10) //换行符
  13. ds = CREATE datastore
  14. ds.DataObject = "ds_ct_msttake"
  15. ds.SetTransObject(sqlca)
  16. ll_rowcnt = ds.Retrieve(arg_ctdt)
  17. ds.accepttext()
  18. Open(w_sys_wait_jdt) //初始化进度条
  19. w_sys_wait_jdt.Show()
  20. w_sys_wait_jdt.wf_accepttol(ll_rowcnt)
  21. for ll_i = 1 to ll_rowcnt
  22. cnt = 0
  23. ll_takeid = ds.object.takeid[ll_i]
  24. ls_billcode = ds.object.billcode[ll_i]
  25. w_sys_wait_jdt.st_msg.Text = ls_billcode+" 正在处理..." //进度信息
  26. select count(*) into :cnt
  27. from u_bmsttakemx
  28. where takeid = :ll_takeid
  29. and takedate > :arg_ctdt;
  30. if sqlca.sqlcode <> 0 then
  31. arg_msg = '查询单据:'+ls_billcode+'明细资料错误'
  32. rslt = 0
  33. goto ext
  34. end if
  35. if cnt > 0 then continue
  36. update u_bmsttakemx set delflag = 1
  37. where takeid = :ll_takeid;
  38. if sqlca.sqlcode <> 0 then
  39. arg_msg = '更新单据:'+ls_billcode+'明细删除标记错误,'+sqlca.sqlerrtext
  40. rslt = 0
  41. goto ext
  42. end if
  43. update u_bmsttake set delflag = 1
  44. where takeid = :ll_takeid;
  45. if sqlca.sqlcode <> 0 then
  46. arg_msg = '更新单据:'+ls_billcode+'删除标记错误,'+sqlca.sqlerrtext
  47. rslt = 0
  48. goto ext
  49. end if
  50. del_cnt++
  51. w_sys_wait_jdt.wf_inc(ll_i) //进度
  52. next
  53. arg_log = arg_log + "> "+String(del_cnt)+ " [应收帐] 更新删除标记成功"+char_enter
  54. ext:
  55. if rslt = 0 then
  56. rollback;
  57. elseif rslt = 1 and arg_ifcommit then
  58. commit;
  59. end if
  60. close(w_sys_wait_jdt)
  61. return rslt
  62. end function