123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- $PBExportHeader$f_cmpl_status_qty.srf
- global type f_cmpl_status_qty from function_object
- end type
- forward prototypes
- global function integer f_cmpl_status_qty (decimal arg_addqty, string arg_status, ref decimal arg_qty, ref string arg_msg)
- end prototypes
- global function integer f_cmpl_status_qty (decimal arg_addqty, string arg_status, ref decimal arg_qty, ref string arg_msg);Int rslt = 1
- String ls_temp[]
- String ls_option
- String ls_getvalue
- Long ll_cnt,i,beg
- String ls_rs
- datastore ds_cmp
- String ls_qty
- String ls_status
- ll_cnt = 0
- ls_status = arg_status
- ls_option = sys_option_cmpl_status_qty
- IF ls_status = '' THEN GOTO ext
- IF ls_option = '' THEN GOTO cmp
- DO WHILE Len(ls_option) <> 1
- ls_option = Replace( ls_option, 1, 1, '' )
- ls_getvalue = Left(ls_option,Pos(ls_option,',',1) - 1)
- ll_cnt++
- ls_temp[ll_cnt] = ls_getvalue
- ls_option = Replace ( ls_option, 1, Pos(ls_option,',',1) - 1, '' )
- LOOP
- IF ll_cnt = 0 THEN
- GOTO ext
- END IF
- FOR i = 1 TO ll_cnt
- beg = 1
- beg = Pos(ls_status,ls_temp[i],beg )
- DO WHILE beg > 0
- ls_status = Replace(ls_status,beg,len(ls_temp[i]),'')
- beg = Pos(ls_status,ls_temp[i],beg + 1)
- LOOP
- NEXT
- long ll_beg
- long ll_end
- ll_beg = 1
- if pos(ls_status,'{',ll_beg) = 0 then GOTO cmp
- if pos(ls_status,'}',ll_beg) = 0 then GOTO cmp
- do while pos(ls_status,'}',ll_beg) > 0
- ll_beg = pos(ls_status,'{',ll_beg)
- ll_end = pos(ls_status,'}',ll_beg)
- ls_status = Replace(ls_status,ll_beg,ll_end - ll_beg + 1,'')
- loop
- cmp:
- Dec ld_temp
- ld_temp = Dec(ls_status)
- IF ld_temp <> 0 THEN
- arg_qty = ld_temp * arg_addqty
- GOTO ext
- END IF
- ds_cmp = CREATE datastore
- ds_cmp.DataObject = "ds_cmp_qty"
- ds_cmp.SetTransObject(sqlca)
- ds_cmp.InsertRow(0)
- ls_rs = ds_cmp.Modify("cmp.Expression='"+ ls_status+"'")
- IF ls_rs = '' THEN
- ds_cmp.AcceptText()
- arg_qty = ds_cmp.Object.cmp[ds_cmp.GetRow()]
- IF Round(arg_qty,0) = arg_qty THEN
- ls_qty = String(arg_qty,'#######')
- ELSE
- ls_qty = String(arg_qty,'#######0.#######')
- END IF
- IF ls_qty = ls_status THEN
- arg_qty = arg_qty * arg_qty
- END IF
- ELSE
- arg_msg = '非法格式,不能计算!'+arg_status
- rslt = 0
- GOTO ext
- END IF
- arg_qty = arg_qty * arg_addqty
- ext:
- RETURN rslt
- end function
|