project QadFinancials > class BCMask > method DefaultValuesJournal

Description

This method retrieves additional details needed on UI to display all information about Daybook


Parameters


bcJournalCodeinput-outputcharacter
oiJournal_IDoutputinteger
ocJournalDescriptionoutputcharacter
ocLayerCodeoutputcharacter
ocLayerDescriptionoutputcharacter
ocJournalTypeCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program4/bcmask.p)

define buffer bSharedSet for SharedSet.
define buffer bCompanySharedSet for CompanySharedSet.
define buffer bJournal for Journal.
define buffer bLayer for Layer.

assign oiJournal_ID         = ?
       ocJournalDescription = "":U.
       
/* Input paramters normalization */
if bcJournalCode = "":U then assign bcJournalCode = ?.

/* Precondition */
if bcJournalCode = ?
then return.

/* Get daybook details */
for each bSharedSet fields (SharedSetTypeCode SharedSet_ID) no-lock where
         bSharedSet.SharedSetTypeCode = {&SHAREDSETTYPE-JOURNAL},
   first bCompanySharedSet fields (SharedSet_ID Company_ID) no-lock where
         bCompanySharedSet.SharedSet_ID = bSharedSet.SharedSet_ID and
         bCompanySharedSet.Company_ID = viCompanyId,
   first bJournal fields (SharedSet_ID Journal_ID Layer_ID JournalCode JournalDescription JournalTypeCode) no-lock where
         bJournal.SharedSet_ID = bCompanySharedSet.SharedSet_ID and
         bJournal.JournalCode = bcJournalCode on error undo, throw:

        assign bcJournalCode        = bJournal.JournalCode
               oiJournal_ID         = bJournal.Journal_ID.
        
        if vlObjectTranslationsActive
        then do:
            run GetTranslationForObject /* in componentpool */
               (input bJournal.Journal_ID,
                input current-language,
                input bJournal.JournalDescription,
                input "JournalDescription",
                output ocJournalDescription,
                output viFcReturnSuper).
            if viFcReturnSuper <> 0
            then oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then return.
        end.
        else ocJournalDescription = bJournal.JournalDescription.
    
        if bJournal.Layer_ID <> 0
        then for first bLayer fields (Layer_ID LayerCode LayerDescription) no-lock where
                       bLayer.Layer_ID = bJournal.Layer_ID on error undo, throw:
            assign ocLayerCode          = bLayer.LayerCode.
            if vlObjectTranslationsActive
            then do:
                run GetTranslationForObject /* in componentpool */
                   (input bLayer.Layer_ID,
                    input current-language,
                    input bLayer.LayerDescription,
                    input "LayerDescription",
                    output ocLayerDescription,
                    output viFcReturnSuper).
                if viFcReturnSuper <> 0
                then oiReturnStatus = viFcReturnSuper.
                if viFcReturnSuper < 0
                then return.
            end.
            else ocLayerDescription = bLayer.LayerDescription.
        end.
        
        /* calculate the journal type */
        assign vcJournalTypes = {&JOURNALTYPES}.
        do viCounter = num-entries(vcJournalTypes, chr(2)) to 1 by -2:
            if entry(viCounter, vcJournalTypes, chr(2)) = bJournal.JournalTypeCode
            then do:
                assign ocJournalTypeCode = entry(viCounter - 1, vcJournalTypes, chr(2)) no-error.
                leave.   
            end. /* if entry */
        end. /* do viCounter */

end. /* Get daybook details */