project QadFinancials > class BDebtor > method GetBankEntryAndAdjustment

Description

Get BankingEntry or CashEntry ID by input journal type code for the drill down of dashboard.


Parameters


icJournalTypeCodeinputcharacter
iiPostingIDinputinteger
oiBankingEntryIDoutputinteger
oiOpenAdjustIDoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program5/bdebtor.p)

/* Get Bank Entry ID/Cash Entry ID / Open Adjustment ID from input posting id and journal type  */            
if icJournalTypeCode <> ? and icJournalTypeCode <> ""
then do:
    if icJournalTypeCode = {&JOURNALTYPE-BANKINGENTRY} or icJournalTypeCode = {&JOURNALTYPE-CASHENTRY} 
    then do:

        <Q-1 run BankStateLineByPosting (all) (Read) (NoCache)
           (input viCompanyId, (CompanyId)
            input iiPostingID, (PostingID)
            output dataset tqBankStateLineByPosting) in BBankEntry >
        find first tqBankStateLineByPosting 
            where tqBankStateLineByPosting.tiPosting_ID = iiPostingID no-error.
        if available tqBankStateLineByPosting
            then oiBankingEntryID = tqBankStateLineByPosting.tiBankState_ID.
        assign oiOpenAdjustID = 0.
    end.

    if icJournalTypeCode = {&JOURNALTYPE-DEBTORADJUSTMENT} 
    then do:
        <Q-2 run OIAdjustByPosting (all) (Read) (NoCache)
           (input viCompanyId, (CompanyId)
            input iiPostingID, (PostingID)
            output dataset tqOIAdjustByPosting) in BOpenItemAdjustment >
        find first tqOIAdjustByPosting 
            where tqOIAdjustByPosting.tiPosting_ID = iiPostingID no-error.
        if available tqOIAdjustByPosting
            then oiOpenAdjustID = tqOIAdjustByPosting.tiOIAdjust_ID.
        assign oiBankingEntryID = 0.
    end.
end.