project QadFinancials > class BDebtor > method ValDeductionCtrlGLProfile


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDebtor.PostValidateComponent


program code (program1/bdebtor.p)

if t_sDebtor.DeductionCtrlGLProfile_ID <> 0 and 
   t_sDebtor.DeductionCtrlGLProfile_ID <> ? and 
   (t_sDebtor.tc_Status = "N":U or 
    (t_sDebtor.tc_Status = "C":U and 
     can-find (t_iDebtor where 
               t_iDebtor.tc_Rowid                  = t_sDebtor.tc_Rowid and 
               t_iDebtor.DeductionCtrlGLProfile_ID <> t_sDebtor.DeductionCtrlGLProfile_ID )))
then do:
    <Q-5 run ProfileById (all) (Read) (Cache)
       (input t_sDebtor.DeductionCtrlGLProfile_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-25'The Deduction Profile &1 is not of type &2 for customer &3.':200(39171907)T-25#,
                                               trim(tqProfileById.tcProfileCode),
                                               trim({&PROFILETYPECODE-DEBTORACCOUNT-TR}),
                                               trim(t_sDebtor.DebtorCode))) + chr(10) + 
                               program-name(1)
                   oiReturnStatus = -1.
        
                    <M-29 run SetMessage
                       (input  vcMessage (icMessage), 
                        input  '':U (icArguments), 
                        input  'tDebtor.tcDeductionCtrlGLProfileCode':U (icFieldName), 
                        input  t_sDebtor.tcDeductionCtrlGLProfileCode (icFieldValue), 
                        input  'E':U (icType), 
                        input  3 (iiSeverity), 
                        input  t_sDebtor.tc_Rowid (icRowid), 
                        input  'qadfin-630000':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-76'The Deduction Profile &1 is not active for customer &2.':200(565506990)T-76#,
                                                    trim(tqProfileById.tcProfileCode),
                                                    trim(t_sDebtor.DebtorCode))) + chr(10) + 
                                    program-name(1)
                   oiReturnStatus = -1.

             <M-16 run SetMessage
                (input  vcMessage (icMessage), 
                 input  '':U (icArguments), 
                 input  'tDebtor.tcDeductionCtrlGLProfileCode':U (icFieldName), 
                 input  t_sDebtor.tcDeductionCtrlGLProfileCode (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  t_sDebtor.tc_Rowid (icRowid), 
                 input  'qadfin-928849':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.DeductionCtrlGLProfile_ID > 0 */