f_ct_mstpay.srf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. $PBExportHeader$f_ct_mstpay.srf
  2. global type f_ct_mstpay from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_ct_mstpay (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit)
  6. end prototypes
  7. global function integer f_ct_mstpay (datetime arg_ctdt, ref string arg_msg, ref string arg_log, boolean arg_ifcommit);int rslt = 1
  8. long ll_payid,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_mstpay"
  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_payid = ds.object.payid[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_bmstpaymx
  28. where payid = :ll_payid
  29. and paydate > :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_bmstpaymx set delflag = 1
  37. where payid = :ll_payid;
  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_bmstpay set delflag = 1
  44. where payid = :ll_payid;
  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