Description
Method to retrieve a default allocation journal. The mechanism was copied from BCInvoice.
Parameters
| ocMFJournalCode | output | character | |
| ocLayerCode | output | character | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program3/bexpensenote.p)
/* Retrieve Journal Code for MF Posting */
<Q-1 run LookupSharedSetForCompany (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input {&SHAREDSETTYPECODE-JOURNAL}, (SharedSetType)
output dataset tqSharedSetForCompany) in BCompany >
find first tqSharedSetForCompany no-error.
<Q-2 run JournalForProfileLinkDef (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input (if available tqSharedSetForCompany then tqSharedSetForCompany.tiSharedSet_ID else 0), (SharedSetId)
input {&JOURNALTYPE-CIREC}, (JournalTypeCode)
input yes, (JournalIsActive)
input ?, (JournalTypeIsCorrection)
input {&JOURNALCONTROL-FINANCIAL}, (JournalControl)
output dataset tqJournalForProfileLinkDef) in BJournal >
find first tqJournalForProfileLinkDef where
tqJournalForProfileLinkDef.tcJournalTypeCode = {&JOURNALTYPE-CIREC} and
tqJournalForProfileLinkDef.tlJournalIsActive = yes and
tqJournalForProfileLinkDef.tcJournalControl = {&JOURNALCONTROL-FINANCIAL}
no-error.
if available tqJournalForProfileLinkDef
then do:
assign vcMFJournalCode = tqJournalForProfileLinkDef.tcJournalCode
vcLayerCode = tqJournalForProfileLinkDef.tcLayerCode.
find next tqJournalForProfileLinkDef where
tqJournalForProfileLinkDef.tcJournalTypeCode = {&JOURNALTYPE-CIREC} and
tqJournalForProfileLinkDef.tlJournalIsActive = yes and
tqJournalForProfileLinkDef.tcJournalControl = {&JOURNALCONTROL-FINANCIAL}
no-error.
if not available tqJournalForProfileLinkDef
then assign ocMFJournalCode = vcMFJournalCode
ocLayerCode = vcLayerCode.
end.
/* If multiple mf layers, then take transient layer, if not found, then take first one */
if ocMFJournalCode = "":U
then do:
find first tqJournalForProfileLinkDef where
tqJournalForProfileLinkDef.tcJournalTypeCode = {&JOURNALTYPE-CIREC} and
tqJournalForProfileLinkDef.tlJournalIsActive = yes and
tqJournalForProfileLinkDef.tcJournalControl = {&JOURNALCONTROL-FINANCIAL} and
tqJournalForProfileLinkDef.tcLayerTypeCode = {&LAYERTYPECODE-TRANSIENT}
no-error.
if not available tqJournalForProfileLinkDef
then find first tqJournalForProfileLinkDef where
tqJournalForProfileLinkDef.tcJournalTypeCode = {&JOURNALTYPE-CIREC} and
tqJournalForProfileLinkDef.tlJournalIsActive = yes and
tqJournalForProfileLinkDef.tcJournalControl = {&JOURNALCONTROL-FINANCIAL}
no-error.
if available tqJournalForProfileLinkDef
then assign ocMFJournalCode = tqJournalForProfileLinkDef.tcJournalCode
ocLayerCode = tqJournalForProfileLinkDef.tcLayerCode.
end.