$PBExportHeader$f_cmpl_qty_son.srf global type f_cmpl_qty_son from function_object end type forward prototypes global function integer f_cmpl_qty_son (string arg_status, ref decimal arg_qty, ref string arg_msg) end prototypes global function integer f_cmpl_qty_son (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 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()] ELSE arg_msg = '非法格式,不能计算!'+arg_status rslt = 0 GOTO ext END IF ext: RETURN rslt end function