$PBExportHeader$f_check_spt_balcamt.srf global type f_check_spt_balcamt from function_object end type forward prototypes global function integer f_check_spt_balcamt (long arg_sptid, ref string arg_msg) end prototypes global function integer f_check_spt_balcamt (long arg_sptid, ref string arg_msg);Int rslt = 1 Decimal ld_balcamt SELECT sum(spt_balcamt) INTO :ld_balcamt FROM v_spt_balcamt Where sptid = :arg_sptid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询供应商是否有结余金额失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF IF ld_balcamt <> 0 THEN arg_msg = '供应商有结余金额' rslt = 0 GOTO ext END IF ext: RETURN rslt end function