$PBExportHeader$f_billmsg.srf global type f_billmsg from function_object end type forward prototypes global function integer f_billmsg (long arg_scid, string arg_billcode, string arg_msgtitle, string arg_s_msg, transaction arg_transaction, ref string arg_msg, boolean arg_ifcommit) end prototypes global function integer f_billmsg (long arg_scid, string arg_billcode, string arg_msgtitle, string arg_s_msg, transaction arg_transaction, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String empname Long i = 1,it_mxbt String ls_billcode,ls_r_billcode,ls_sccode String arg_objdpm uo_transmsg uo_msg arg_billcode = Upper(arg_billcode) SELECT sccode INTO :ls_sccode FROM u_scdef Where scid = :arg_scid USING arg_transaction; ls_billcode = Mid(Trim(arg_billcode),Len(ls_sccode) + 1,2) SELECT billstyle INTO :ls_r_billcode FROM u_billcode Where firststr = :ls_billcode; IF sqlca.SQLCode = 1 THEN ls_billcode = ls_r_billcode DECLARE cur_empmx CURSOR FOR SELECT u_rs_empinfo.empname FROM u_billemp INNER JOIN u_rs_empinfo ON u_billemp.empid = u_rs_empinfo.empid WHERE billcode = :ls_billcode USING arg_transaction; OPEN cur_empmx; FETCH cur_empmx INTO :empname; DO WHILE arg_transaction.SQLCode = 0 i++ arg_objdpm = empname+';'+arg_objdpm FETCH cur_empmx INTO :empname; LOOP CLOSE cur_empmx; it_mxbt = i - 1 IF it_mxbt > 0 THEN IF uo_msg.f_create_admsg(sys_empid,publ_operator,arg_objdpm,arg_msgtitle,arg_s_msg,arg_msg,arg_scid,arg_billcode,FALSE) = 0 THEN arg_msg = '消息发送失败{'+arg_msg+'}' rslt = 0 GOTO ext END IF END IF ext: IF rslt = 0 THEN ROLLBACK USING arg_transaction; ELSEIF rslt = 1 AND arg_ifcommit THEN COMMIT USING arg_transaction; END IF RETURN rslt end function