project QadFinancials > class BPosting > method PreSaveAutoBalNotifMailSend

Description

Send notification mail with detauls about postings for which auto-balancing posting was created.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.PreSave


program code (program1/bposting.p)

/* ====================================================================================== *
 * Method       : PreSaveAutoBalNotifMailSend                                             *
 * Description  : This method send notification mail about those postings affected by the *
 *                auto-balancing functionality                                            *
 * -------------------------------------------------------------------------------------- *
 * Parameters   :                                                                         *
 * ====================================================================================== */
 
MAIN_BLOCK:
do on error undo, return:
    for each tAutoBalanceMailNotif where
             tAutoBalanceMailNotif.tcSendTo <> ? and
             tAutoBalanceMailNotif.tcSendTo <> "":U:

        <I-1 {bFcStartAndOpenInstance
             &ADD-TO-TRANSACTION   = "false"
             &CLASS                = "Mail"}>
             
        <M-59 run Send
           (input  ? (icFrom), 
            input  tAutoBalanceMailNotif.tcSendTo (icTo), 
            input  tAutoBalanceMailNotif.tcSubject (icSubject), 
            input  tAutoBalanceMailNotif.tcMailBody (icBody), 
            output viFcReturnSuper (oiReturnStatus)) in Mail>    
        if viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0 
        then do:
            <M-50 run SetMessage
               (input  #T-29'Unable to send e-mail to $1.':100(999890586)T-29# (icMessage), 
                input  tAutoBalanceMailNotif.tcSendTo (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'W':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-682920':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BPosting>   
            if oiReturnStatus = 0 then assign oiReturnStatus = 1.
        end.

        <I-23 {bFcCloseAndStopInstance
             &CLASS           = "Mail"}>
    
    end. /* for each tAutoBalanceMailNotif where */
end. /* MAIN_BLOCK */