project QadFinancials > class BDebtor > method ValPrePayControlGLProfile


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDebtor.PostValidateComponent


program code (program1/bdebtor.p)

if t_sDebtor.PrePayControlGLProfile_ID <> 0 and t_sDebtor.PrePayControlGLProfile_ID <> ? and 
   (t_sDebtor.tc_Status = "N":U or 
    (t_sDebtor.tc_Status = "C" and 
     can-find (t_iDebtor where 
               t_iDebtor.tc_Rowid                  = t_sDebtor.tc_Rowid and 
               t_iDebtor.PrePayControlGLProfile_ID <> t_sDebtor.PrePayControlGLProfile_ID )))
then do:
    <Q-1 run ProfileById (all) (Read) (Cache)
       (input t_sDebtor.PrePayControlGLProfile_ID, (Profile_ID)
        output dataset tqProfileById) in BProfile>

    find first tqProfileById no-error.
    /* Profile type must be DebtorAccount */
    if available tqProfileById 
    then do:
        if tqProfileById.tcProfileTypeCode <> {&PROFILETYPECODE-DEBTORACCOUNT}
        then do:
            assign vcMessage = trim(substitute( #T-2'The Prepayment Profile &1 is not of type &2 for customer &3.':200(65221)t-2#,
                                               trim(tqProfileById.tcProfileCode),
                                               trim({&PROFILETYPECODE-DEBTORACCOUNT-TR}),
                                               trim(t_sDebtor.DebtorCode))) + chr(10) + 
                               program-name(1)
                   oiReturnStatus = -1.
        
                    <M-3 run SetMessage
                       (input  vcMessage (icMessage), 
                        input  '':U (icArguments), 
                        input  'tDebtor.tcPrePayControlGLProfileCode':U (icFieldName), 
                        input  t_sDebtor.tcPrePayControlGLProfileCode (icFieldValue), 
                        input  'E':U (icType), 
                        input  3 (iiSeverity), 
                        input  t_sDebtor.tc_Rowid (icRowid), 
                        input  'QadFin-6977':U (icFcMsgNumber), 
                        input  '':U (icFcExplanation), 
                        input  '':U (icFcIdentification), 
                        input  '':U (icFcContext), 
                        output viFcReturnSuper (oiReturnStatus)) in BDebtor>
        end.
        if tqProfileById.tcProfileTypeCode = {&PROFILETYPECODE-DEBTORACCOUNT} and
           not tqProfileById.tlProfileIsActive
        then do:
            assign vcMessage      = trim(substitute(  #T-4'The Prepayment Profile &1 is not active for customer &2.':200(65222)t-4#,
                                                    trim(tqProfileById.tcProfileCode),
                                                    trim(t_sDebtor.DebtorCode))) + chr(10) + 
                                    program-name(1)
                   oiReturnStatus = -1.

             <M-5 run SetMessage
                (input  vcMessage (icMessage), 
                 input  '':U (icArguments), 
                 input  'tDebtor.tcPrePayControlGLProfileCode':U (icFieldName), 
                 input  t_sDebtor.tcPrePayControlGLProfileCode (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  t_sDebtor.tc_Rowid (icRowid), 
                 input  'QadFin-6978':U (icFcMsgNumber), 
                 input  '':U (icFcExplanation), 
                 input  '':U (icFcIdentification), 
                 input  '':U (icFcContext), 
                 output viFcReturnSuper (oiReturnStatus)) in BDebtor>
        end.
    end.  /* if available tqProfileById */
end.  /* if t_sDebtor.PrePayControlGLProfile_ID > 0 */