project QadFinancials > class BDDocument > method AdditionalUpdatesGetDeductionJournalCode

Description

it is used to get the deduction journal code.
the journal profile is defined on the banking gl account.


Parameters


icBankGLAccountinputcharacterBank GL Account.
ocDeductionJournalCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDDocument.AdditionalUpdatesPostingDeduction


program code (program5/bddocument.p)

/*TO-DO: Need add buffer flag, in order not to retrieve several times.*/
assign ocDeductionJournalCode =''.
if not vlIsQStartedGLByBankInfo
then do:
        <Q-97 run GLByBankInfo  (Start) in BGL>
        assign vlIsQStartedGLByBankInfo = true.
end.
/*get the customer deduction daybook profile id*/
<Q-43 run GLByGLForBankInfo (all) (Read) (NoCache)
   (input tDDocument.Company_ID, (CompanyId)
    input ?, (GLID)
    input icBankGLAccount, (GLCode)
    output dataset tqGLByGLForBankInfo) in BGL>

find first tqGLByGLForBankInfo where
               tqGLByGLForBankInfo.tcGLCode = icBankGLAccount
               no-error.
if not available tqGLByGLForBankInfo then
do:

            <M-58 run SetMessage
               (input  trim(#T-72'The bank account $1 is not defined.':255(954939124)T-72#) (icMessage), 
                input  icBankGLAccount (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  tDDocument.tc_Rowid (icRowid), 
                input  'qadfin-435636':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDDocument>

        assign oiReturnStatus = -1.
        return.        
end. 

if tqGLByGLForBankInfo.tiDeductionJournalProfile_ID = 0 
   or tqGLByGLForBankInfo.tiDeductionJournalProfile_ID = ?
then 
do:
        <M-22 run SetMessage
           (input  trim(#T-30'The customer deduction daybook profile for bank account $1 is not defined':255(704925145)T-30#) (icMessage), 
            input  icBankGLAccount (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  tDDocument.tc_Rowid (icRowid), 
            input  'qadfin-373926':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BDDocument>

        assign oiReturnStatus = -1.
        return. 
end.
/*check the profile is active*/
<Q-8 run ProfileById (all) (Read) (NoCache)
   (input tqGLByGLForBankInfo.tiDeductionJournalProfile_ID, (Profile_ID)
    output dataset tqProfileById) in BProfile>

find first tqProfileById no-error.
if not available tqProfileById
then do:

   <M-76 run SetMessage
      (input  trim(#T-57'The customer deduction profile does not exist':255(841783676)T-57#) (icMessage), 
       input  '':U (icArguments), 
       input  '':U (icFieldName), 
       input  '':U (icFieldValue), 
       input  'E':U (icType), 
       input  3 (iiSeverity), 
       input  tDDocument.tc_Rowid (icRowid), 
       input  'qadfin-417420':U (icFcMsgNumber), 
       input  '':U (icFcExplanation), 
       input  '':U (icFcIdentification), 
       input  '':U (icFcContext), 
       output viFcReturnSuper (oiReturnStatus)) in BDDocument> 
    assign oiReturnStatus = -1.
    return.
end.

if tqProfileById.tlProfileIsActive <> true
then do:
   <M-75 run SetMessage
      (input  trim(#T-78'The customer deduction profile is not active':255(316955563)T-78#) (icMessage), 
       input  '':U (icArguments), 
       input  '':U (icFieldName), 
       input  '':U (icFieldValue), 
       input  'E':U (icType), 
       input  3 (iiSeverity), 
       input  tDDocument.tc_Rowid (icRowid), 
       input  'qadfin-441963':U (icFcMsgNumber), 
       input  '':U (icFcExplanation), 
       input  '':U (icFcIdentification), 
       input  '':U (icFcContext), 
       output viFcReturnSuper (oiReturnStatus)) in BDDocument>
    assign oiReturnStatus = -1.
    return.
end.

/*get customer deduction daybook */

<Q-19 run JournalForProfile (all) (Read) (NoCache)
   (input tqGLByGLForBankInfo.tiDeductionJournalProfile_ID, (JournalProfileId)
    input tDDocument.Company_ID, (CompanyId)
    input ?, (JournalControl)
    output dataset tqJournalForProfile) in BProfile>

find first tqJournalForProfile no-error.

if not available tqJournalForProfile then 
do:
  <M-73 run SetMessage
     (input  trim(#T-92'The customer deduction daybook for the bank account $1 is not defined.':255(197473467)T-92#) (icMessage), 
      input  icBankGLAccount (icArguments), 
      input  '':U (icFieldName), 
      input  '':U (icFieldValue), 
      input  'E':U (icType), 
      input  3 (iiSeverity), 
      input  tDDocument.tc_Rowid (icRowid), 
      input  'qadfin-947119':U (icFcMsgNumber), 
      input  '' (icFcExplanation), 
      input  '' (icFcIdentification), 
      input  '' (icFcContext), 
      output viFcReturnSuper (oiReturnStatus)) in BDDocument>

      assign oiReturnStatus = -1.
      return. 
end.
 


assign ocDeductionJournalCode = tqJournalForProfile.tcJournalCode.