project QadFinancials > class BCInvoice > method GetCAJournalCode

Description

Default the CA Journal if only one exists


Parameters


ocCAJournalCodeoutputcharacterCA journal Code
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.DefaultValuesLinkedInvoice
method BCInvoice.DefaultValuesReverseDaybook


program code (program3/bcinvoice.p)

<Q-1 run LookupSharedSetForCompany (all) (Read) (NoCache)
          (input viCompanyId, (CompanyId)
           input {&SHAREDSETTYPECODE-JOURNAL}, (SharedSetType)
           output dataset tqSharedSetForCompany) in BCompany >

find first tqSharedSetForCompany where
           tqSharedSetForCompany.tiCompany_ID        = viCompanyId and
           tqSharedSetForCompany.tcSharedSetTypeCode = {&SHAREDSETTYPECODE-JOURNAL}
           no-error.

assign viJournalSharedSetId = if available tqSharedSetForCompany
                              then tqSharedSetForCompany.tiSharedSet_ID
                              else 0.

<Q-2 run JournalForProfileLinkDef (all) (Read) (NoCache)
   (input viCompanyId, (CompanyId)
    input viJournalSharedSetId, (SharedSetId)
    input {&JOURNALTYPE-CREDITORADJUSTMENT}, (JournalTypeCode)
    input true, (JournalIsActive)
    input ?, (JournalTypeIsCorrection)
    input {&JOURNALCONTROL-FINANCIAL}, (JournalControl)
    output dataset tqJournalForProfileLinkDef) in BJournal >

find first tqJournalForProfileLinkDef where
           tqJournalForProfileLinkDef.tcJournalTypeCode = {&JOURNALTYPE-CREDITORADJUSTMENT} and
           tqJournalForProfileLinkDef.tlJournalIsActive = true                              and
           tqJournalForProfileLinkDef.tcJournalControl  = {&JOURNALCONTROL-FINANCIAL}
           no-error.

if available tqJournalForProfileLinkDef
then do:
    assign ocCAJournalCode = tqJournalForProfileLinkDef.tcJournalCode.

    find next tqJournalForProfileLinkDef where
              tqJournalForProfileLinkDef.tcJournalTypeCode = {&JOURNALTYPE-CREDITORADJUSTMENT} and
              tqJournalForProfileLinkDef.tlJournalIsActive = true                              and
              tqJournalForProfileLinkDef.tcJournalControl  = {&JOURNALCONTROL-FINANCIAL}
              no-error.

    if available tqJournalForProfileLinkDef
    then assign ocCAJournalCode = "":U.
end.