$PBExportHeader$f_check_cust_balcamt.srf global type f_check_cust_balcamt from function_object end type forward prototypes global function integer f_check_cust_balcamt (long arg_cusid, ref string arg_msg) end prototypes global function integer f_check_cust_balcamt (long arg_cusid, ref string arg_msg);Int rslt = 1 Decimal ld_balcamt SELECT sum(cus_balcamt) INTO :ld_balcamt FROM v_cus_balcamt Where cusid = :arg_cusid; 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