project QadFinancials > class BAPMatching > method InitialValues

Description

Add code here to initialize the calculated fields of a 'new' record (= a record that must be created in the application database) in a class temp-table.


Parameters


icTableNameinputcharacterName of the database table of which a record is created in the class temp-table.
oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bapmatching.p)

<ANCESTOR-CODE>

    
    case icTableName:
        when "APMatching":U
        then do:
            assign tAPMatching.APMatchingDate   = today
                   tAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-FINISHED}
                   tAPMatching.Company_ID       = viCompanyId.
            /* Get period using Matching Date */
            <M-11 run DefaultValuesDate
               (input-output tAPMatching.APMatchingDate (btDate), 
                output tAPMatching.tiPeriodYear (oiYear), 
                output tAPMatching.tiPeriodPeriod (oiPeriod), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            /* If only one valid Matching Journal exists, default it */
            <Q-7 run JournalByJournalLayer  (Start) in BJournal >
            <Q-8 assign vlFcQueryRecordsAvailable = JournalByJournalLayer (NoCache)
               (input tAPMatching.Company_ID, (CompanyId)
                input ?, (JournalCode)
                input {&JOURNALTYPE-CIREC}, (CandoJournalTypeCode)
                input ?, (LayerCode)
                input {&LAYERTYPECODE-OFFICIAL}, (CandoLayerTypeCode)
                input ?, (JournalID)
                input true, (JournalIsActive)) in BJournal >
            if vlFcQueryRecordsAvailable
            then do:
                <Q-9 run JournalByJournalLayer (all) (Read) (NoCache)
                   (input tAPMatching.Company_ID, (CompanyId)
                    input ?, (JournalCode)
                    input {&JOURNALTYPE-CIREC}, (CandoJournalTypeCode)
                    input ?, (LayerCode)
                    input {&LAYERTYPECODE-OFFICIAL}, (CandoLayerTypeCode)
                    input ?, (JournalID)
                    input true, (JournalIsActive)
                    output dataset tqJournalByJournalAndLayer) in BJournal >
                find first tqJournalByJournalAndLayer where
                           tqJournalByJournalAndLayer.tcJournalTypeCode = {&JOURNALTYPE-CIREC}      and
                           tqJournalByJournalAndLayer.tcLayerTypeCode   = {&LAYERTYPECODE-OFFICIAL} and
                           tqJournalByJournalAndLayer.tlJournalIsActive = true
                           no-error.
                if available tqJournalByJournalAndLayer
                then assign tAPMatching.tcJournalCode = tqJournalByJournalAndLayer.tcJournalCode.
            end.
            <Q-10 run JournalByJournalLayer  (Stop) in BJournal >
            /* If only one valid Reason Code exists, default it */
            <Q-2 run ReasonByAllocLockPayment  (Start) in BReason >
            <Q-3 assign vlFcQueryRecordsAvailable = ReasonByAllocLockPayment (NoCache)
               (input {&ALLOCSTATUS-ALLOC}, (ReasonAllocationStatus)
                input ?, (ReasonLockPayment)
                input true, (ReasonIsActive)) in BReason >
            if vlFcQueryRecordsAvailable
            then do:
                <Q-4 run ReasonByAllocLockPayment (all) (Read) (NoCache)
                   (input {&ALLOCSTATUS-ALLOC}, (ReasonAllocationStatus)
                    input ?, (ReasonLockPayment)
                    input true, (ReasonIsActive)
                    output dataset tqReasonByAllocLockPayment) in BReason >
                find first tqReasonByAllocLockPayment
                           no-error.
                if available tqReasonByAllocLockPayment
                then assign tAPMatching.tcReasonCode = tqReasonByAllocLockPayment.tcReasonCode.
            end.
            <Q-6 run ReasonByAllocLockPayment  (Stop) in BReason >
        end. /* when "APMatching */
        
        when "APMatchingLn":U
        then assign tAPMatchingLn.APMatchingLnIsVarGLPosting = true.
        
        when "APMatchingLnTax"
        then assign tAPMatchingLnTax.APMatchingLnTaxIsSuspDel = false.
    end. /* case */