project QadFinancials > class BPeriod > method CheckIfDaybookMaskAllowed

Description

Checks if we can apply a daybook mask code to the period.


Parameters


iiPeriod_IDinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFitnesse
method BPeriod.ApiCheckIfDaybookMaskAllowed


program code (program3/bperiod.p)

/* ====================================================================================== *
 * Method       : CheckIfDaybookMaskAllowed                                               *
 * Description  : Checks if we can apply a daybook mask code to the period.               *
 * -------------------------------------------------------------------------------------- *
 * Parameters   : (i)  Period_ID    Period_ID to check                                    *
 * ====================================================================================== */

assign oiReturnStatus = -98.

if iiPeriod_ID <> ?
then do:
    <M-23 run DataLoad
       (input  ? (icRowids), 
        input  ? (icPkeys), 
        input  string(iiPeriod_ID) (icObjectIds), 
        input  ? (icFreeform), 
        input  true (ilKeepPrevious), 
        output viFcReturnSuper (oiReturnStatus)) in BPeriod>
    
    find tPeriod where
         tPeriod.Period_ID = iiPeriod_ID
         no-error.
    if not available tPeriod
    then assign viFcReturnSuper = -1.     
    if viFcReturnSuper < 0
    then do:
        assign oiReturnStatus = viFcReturnSuper
               vcMessage = trim(#T-63'The system cannot find the selected period (&1).':255(723427172)T-63#)
               vcMessage = substitute(vcMessage, iiPeriod_ID).
        <M-2 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-949542':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        return.
    end. /* if viFcReturnSuper < 0 */
    
    /* check the period status - this should be 'open' */
    if available tPeriod and
                 tPeriod.PeriodStatus <> {&PERIODSTATUS-OPEN}
    then do:
        assign oiReturnStatus = -1
               vcMessage = trim(#T-14'The GL period must be open.':255(39895174)T-14#).
        <M-7 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-365653':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BPeriod>              
        return.
    end. /* if available tPeriod and tPeriod.PeriodStatus <> {&PERIODSTATUS-OPEN} */

    /* check the period type - this should be 'normal' */
    if available tPeriod and
                 tPeriod.PeriodTypeCode = {&PERIODTYPECODE-YEARCLOSING}
    then do:
        assign oiReturnStatus = -1
               vcMessage = trim(#T-66'A daybook mask cannot be entered against a year-end closing period.':255(451949360)T-66#).
        <M-12 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-736623':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        return.
    end. /* if available tPeriod and tPeriod.PeriodTypeCode = {&PERIODTYPECODE-YEARCLOSING} */
    
end. /* if iiPeriod_ID <> ? */

/* ======= */
/* Return  */
/* ======= */
if oiReturnStatus = -98 
then assign oiReturnStatus = 0.