project QadFinancials > class BBankEntry > 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/bbankentry.p)

<ANCESTOR-CODE>
    
    case icTableName :
        
        /* BANK STATE */
        when "BankState":U
        then do:
            assign vhFcComponent = ?.
            <M-3 run GetDefaultPeriodDate
               (input  ? (iiYearIn), 
                input  ? (iiPeriodIn), 
                input  today (itDateIn), 
                input  ? (ilOpenForPurchase), 
                input  ? (ilOpenForSales), 
                input  ? (ilOpenForInventory), 
                output tBankState.tiPeriodYear (oiYear), 
                output tBankState.tiPeriodPeriod (oiPeriod), 
                output tBankState.BankStatePostingDate (otPostingDate), 
                output viFcReturnSuper (oiReturnStatus)) in BPeriod>

            assign tBankState.Company_ID           = viCompanyId
                   tBankState.BankStateStatus      = {&BANKSTATESTATUS-UNALLOC}
                   tBankState.BankStateYear        = tBankState.tiPeriodYear.
                   tBankState.BankStateTransactionType = {&BANKSTATETRANSTYPE-BANK}.
        end.

        /* BANK STATE LINE */
        when "BankStateLine":U
        then do :   
            assign tBankStateLine.Company_ID                = viCompanyId
                   tBankStateLine.BankStateLineStatus       = {&BANKSTATELINESTATUS-UNALLOC}
                   tBankStateLine.BankStateLineInOut        = {&BANKSTATELINEINOUT-IN}
                   tBankStateLine.BankStateLineNumber       = 1                   
                   tBankStateLine.BankStateLineValueDate    = today
                   tBankStateLine.BankStateLineExtRateScale = 1
                   tBankStateLine.BankStateLineExtBankRate  = 1
                   tBankStateLine.BankStateLineExtRateScale = 1.
                   
            /* ============================================ */
            /* line-number = previouslinenumber + 1         */
            /* value-date = value-date of the previous line */
            /* inout = inout of the previous line           */
            /* ============================================ */
            /* use for last iso find last so you can specify a by clause */
            for last bBankStateLine where 
                     bBankStateLine.tc_Rowid  <> tBankStateLine.tc_Rowid and
                     bBankStateLine.tc_Status <> "D":U
                     no-lock by bBankStateLine.BankStateLineNumber :
                assign tBankStateLine.BankStateLineNumber    = bBankStateLine.BankStateLineNumber + 1
                       tBankStateLine.BankStateLineValueDate = bBankStateLine.BankStateLineValueDate
                       tBankStateLine.BankStateLineInOut     = bBankStateLine.BankStateLineInOut.
            end. /* for last bBankStateLine no-lock by bBankStateLine.BankStateLineNumber */

            /* ========================================================== */
            /* postingdate, year and period are defaulted from the header */
            /* ========================================================== */
            find bBankState where 
                 bBankState.tc_Rowid = tBankStateLine.tc_ParentRowid
                 no-lock no-error.
            if available bBankState
            then assign tBankStateLine.tiPeriodYear             = bBankState.tiPeriodYear
                        tBankStateLine.tiPeriodPeriod           = bBankState.tiPeriodPeriod
                        tBankStateLine.Period_ID                = bBankState.Period_ID
                        tBankStateLine.BankStateLinePostingDate = bBankState.BankStatePostingDate.
        end. /* when "BankStateLine":U */
        
        /* BANK STATE ALLOC */
        when "BankStateAlloc":U
        then assign tBankStateAlloc.Company_ID           = viCompanyId
                    tBankStateAlloc.tcCompanyCode        = vcCompanyCodeBE
                    tBankStateAlloc.BankStateAllocType   = {&INVOICETYPE-INVOICE}
                    tBankStateAlloc.tcLocalCurrencyCode  = vcCompanyLC
                    tBankStateAlloc.tcCurrDifferenceCrDt = {&CREDITDEBITABBREVIATION-DEBIT}
                    tBankStateAlloc.BankStateAllocBankRteScale = 1
                    tBankStateAlloc.tdDocExchangeRateScale      = 1.
        
        /* BANK STATE ALLOC COL*/
        when "BankStateAllocColl":U
        then assign tBankStateAllocColl.BankStateAllocCollRteScale = 1
                    tBankStateAllocColl.tdDocExchangeRateScale      = 1
                    tBankStateAllocColl.Company_ID = viCompanyId
                    tBankStateAllocColl.tcDocAmountCrDt = {&CREDITDEBITABBREVIATION-DEBIT}.

    end case.