project QadFinancials > class BBankNumber > method UpdateBankNumberAndPayCode

Description

Updates the following tables:
- BankNumber
- BankNumberPayCode


Parameters


t_sBankNumberRefinputtemp-table
t_sBankNumberPayCodeRefinputtemp-table
t_sBankNumberSectionRefinputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCreditor.AdditionalUpdates
method BDebtor.AdditionalUpdates


program code (program1/bbanknumber.p)

/*load or create tBankNumber records based on Ref table*/
<M-1 run SetBankNumber
   (input  t_sBankNumberRef (t_sBankNumberRef), 
    input  t_sBankNumberSectionRef (t_sBankNumberSectionRef), 
    output viFcReturnSuper (oiReturnStatus)) in BBankNumber>   
if viFcReturnSuper <> 0
then do:
    assign oiReturnStatus = -1.
    return.
end.

/*load or create tBankNumberPayCode records based on Ref table*/
<M-4 run SetBankNumberPayCode (input  t_sBankNumberPayCodeRef (t_sBankNumberPayCodeRef), 
                               output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper <> 0
then do:
    assign oiReturnStatus = -1.
    return.
end.
/*validations*/                        
/* Give a warning when data on referenced banking record is changed */
find first t_sBankNumberRef
    where t_sBankNumberRef.tc_Status = "C":U and
          t_sBankNumberRef.tlBankNumberIsReferenced
no-error.
if available t_sBankNumberRef 
then do:
    assign oiReturnStatus = 1.
    vcMessage = trim(#T-5'Bank data that is already referenced in the system is being changed.':255(733740885)T-5#).
     <M-6 run SetMessage
        (input  vcMessage (icMessage), 
         input  '':U (icArguments), 
         input  '':U (icFieldName), 
         input  '':U (icFieldValue), 
         input  'W':U (icType), 
         input  3 (iiSeverity), 
         input  '':U (icRowid), 
         input  'QadFin-9458':U (icFcMsgNumber), 
         input  '':U (icFcExplanation), 
         input  '':U (icFcIdentification), 
         input  '':U (icFcContext), 
         output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. 

/* Give an error if Bank record already exists */
for each t_sBankNumberRef where 
              t_sBankNumberRef.tc_Status <> "D":U no-lock:
    for each bt_sBankNumberRef where 
                  (bt_sBankNumberRef.tc_Status  = "N":U or 
                   bt_sBankNumberRef.tc_Status  = "C":U ) and
                  bt_sBankNumberRef.tc_Rowid   <> t_sBankNumberRef.tc_Rowid no-lock:

        if bt_sBankNumberRef.BankNumber                 =    t_sBankNumberRef.BankNumber and
           bt_sBankNumberRef.BankNumberExtension =    t_sBankNumberRef.BankNumberExtension and
           bt_sBankNumberRef.BankNumberValidation =    t_sBankNumberRef.BankNumberValidation and
           bt_sBankNumberRef.BankPayFormat_ID      =    t_sBankNumberRef.BankPayFormat_ID 
        then do:
            assign oiReturnStatus = -1.
            <M-95 run SetMessage
               (input  #T-32'This GL account appears at least twice.  Please check your input for duplicate GL accounts.':255(742970880)T-32# (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-906712':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
            return.
        end.
    end.
end.
     
<M-2 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                            viFcReturnSuper = 0) or 
                            oiReturnStatus  < 0
                        then oiReturnStatus
                        else viFcReturnSuper.

<M-3 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                            viFcReturnSuper = 0) or 
                            oiReturnStatus  < 0
                        then oiReturnStatus
                        else viFcReturnSuper.