project QadFinancials > class BMirroringJournal > method ValidateComponentPost

validation procedure

Description

ValidateComponentPost. Validation after ancestor code of ValidateComponent. Called by ValidateComponent.


Parameters


oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BMirroringJournal.ValidateComponent


program code (program5/bmirroringjournal.p)

assign oiReturnStatus = -98
       viLocalStatus  = 0.
for each t_sMirroringJournal where 
         t_sMirroringJournal.tc_Status <> "":U:
    if t_sMirroringJournal.tc_Status = "N":U or t_sMirroringJournal.tc_Status = "C":U
    then do:
        /* Defect 10249-0181 YIY Begin */
        if t_sMirroringJournal.Domain_ID <> viDomainID 
        then do:
             assign viLocalStatus = -1
             vcMessage            = #T-27'You must specify the current domain.':60(69103)t-27#.
             <M-26 run SetMessage
                (input  vcMessage (icMessage), 
                 input  '':U (icArguments), 
                 input  'tMirroringJournal.tcDomainCode':U (icFieldName), 
                 input  t_sMirroringJournal.tcDomainCode (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  t_sMirroringJournal.tc_Rowid (icRowid), 
                 input  'QadFin-7879':U (icFcMsgNumber), 
                 input  '':U (icFcExplanation), 
                 input  '':U (icFcIdentification), 
                 input  '':U (icFcContext), 
                 output viFcReturnSuper (oiReturnStatus)) in BMirroringJournal>
        end. /* if t_sMirroringJournal.Domain_ID <> viDomainID  */
        /* Defect 10249-0181 YIY End */

        /* Validation of Company should belong the selected domain. */
        if t_sMirroringJournal.Company_ID <> ? or t_sMirroringJournal.Company_ID <> 0
        then do:
            <Q-29 assign vlFcQueryRecordsAvailable = CompanyByDomainActive (NoCache)
               (input t_sMirroringJournal.Company_ID, (CompanyId)
                input viDomainID, (DomainId)
                input true, (CompanyIsActive)) in BCompany >
            if vlFcQueryRecordsAvailable = false 
            then do:
                assign viLocalStatus = -1
                       vcMessage     =  #T-28'The selected entity should belong to the current domain.':120(65888)t-28#.
                <M-30 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  'tMirroringJournal.tcCompanyCode':U (icFieldName), 
                    input  t_sMirroringJournal.tcCompanyCode (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  t_sMirroringJournal.tc_Rowid (icRowid), 
                    input  'QadFin-7880':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BMirroringJournal>
            end. /* if vlFcQueryRecordsAvailable = false  */
        end. /* if t_sMirroringJournal.Company_ID = ? or t_sMirroringJournal.Company_ID = 0 */

        /* Validation of MirrorJournaltype should be same as SourceJournalType */
        if t_sMirroringJournal.tcSourceJournalTypeCode <> t_sMirroringJournal.tcMirrorJournalTypeCode
        then do:
            assign viLocalStatus  = -1
                   vcMessage      = #T-24'The source daybook type and mirror daybook type must be the same.':120(65893)t-24#.
            <M-20 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tMirroringJournal.tcMirrorJournalTypeCode':U (icFieldName), 
                input  t_sMirroringJournal.tcMirrorJournalTypeCode (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sMirroringJournal.tc_Rowid (icRowid), 
                input  'QadFin-7620':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BMirroringJournal>
        end. /* if t_sMirroringJournal.tcSourceJournalTypeCode <> t_sMirroringJournal.tcMirrorJournalTypeCode */
    
        /* Validation of MirrorJournalControl should be same as SourceJournalControl */
        if t_sMirroringJournal.tcSourceJournalControl <> t_sMirroringJournal.tcMirrorJournalControl
        then do:
            assign viLocalStatus  = -1
                   vcMessage      = #T-94'The source daybook control and mirror daybook control must be operational.':150(74170640)T-94#.
            <M-21 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  'tMirroringJournal.tcMirrorJournalControl':U (icFieldName), 
                input  t_sMirroringJournal.tcMirrorJournalControl (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sMirroringJournal.tc_Rowid (icRowid), 
                input  'QadFin-7621':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BMirroringJournal>
        end. /* if t_sMirroringJournal.tcSourceJournalControl <> t_sMirroringJournal.tcMirrorJournalControl */

        /* Validation of allowed combinations of daybooks. */
        assign vlJournalAllowed = false.
        
        /* Inventory transactions */
        if t_sMirroringJournal.tcSourceJournalTypeCode = {&JOURNALTYPE-JOURNALENTRY}
        then assign vcAllosedJournalTypeCodes     = {&JOURNALTYPE-JOURNALENTRY}
                    vcAllowedSourceLayerTypeCodes = {&LAYERTYPECODE-OFFICIAL}   + "," + {&LAYERTYPECODE-MANAGEMENT}
                    vcAllowedMirrorLayerTypeCodes = {&LAYERTYPECODE-OFFICIAL}   + "," + {&LAYERTYPECODE-MANAGEMENT}.
        /* Periodic costing transaction */            
        else if t_sMirroringJournal.tcSourceJournalTypeCode = {&JOURNALTYPE-PERIODICCOSTING}
        then assign vcAllosedJournalTypeCodes     = {&JOURNALTYPE-PERIODICCOSTING}
                    vcAllowedSourceLayerTypeCodes = {&LAYERTYPECODE-TRANSIENT}
                    vcAllowedMirrorLayerTypeCodes = {&LAYERTYPECODE-TRANSIENT}.
            
        if can-do(vcAllosedJournalTypeCodes, t_sMirroringJournal.tcSourceJournalTypeCode) and
           t_sMirroringJournal.tcSourceJournalControl = {&JOURNALCONTROL-LOGISTIC}        and
           can-do(vcAllowedSourceLayerTypeCodes, t_sMirroringJournal.tcSourceLayerTypeCode)     and
           can-do(vcAllosedJournalTypeCodes, t_sMirroringJournal.tcMirrorJournalTypeCode) and
           t_sMirroringJournal.tcMirrorJournalControl = {&JOURNALCONTROL-LOGISTIC}        and
           can-do(vcAllowedMirrorLayerTypeCodes, t_sMirroringJournal.tcMirrorLayerTypeCode)
        then assign vlJournalAllowed = true.
            

        /* check the logic variable vlJournalAlllowed should be true */
        if vlJournalAllowed = false 
        then do:
            assign viLocalStatus  = -1
                   vcMessage      = #T-48'For &1 daybook type, the source layer type and mirror layer type must be &4 or &5. For &2 daybook type, the source layer type and mirror layer type must be &6.':255(574031749)T-48#
                   vcMessage      = trim(substitute(vcMessage,
                                                    {&JOURNALTYPE-JOURNALENTRY-TR},
                                                    {&JOURNALTYPE-PERIODICCOSTING-TR},
                                                    {&JOURNALCONTROL-LOGISTIC-TR},
                                                    {&LAYERTYPECODE-OFFICIAL-TR},
                                                    {&LAYERTYPECODE-MANAGEMENT-TR},
                                                    {&LAYERTYPECODE-TRANSIENT-TR})).
            <M-18 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sMirroringJournal.tc_Rowid (icRowid), 
                input  'QadFin-7618':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BMirroringJournal>
        end. /* if vlJournalAllowed = false  */
       
        /* Validation of at leat one daybook of source and mirror should be in officle layer */
        if t_sMirroringJournal.tcSourceJournalTypeCode   = {&JOURNALTYPE-JOURNALENTRY} and
           not(t_sMirroringJournal.tcSourceLayerTypeCode = {&LAYERTYPECODE-OFFICIAL} or
               t_sMirroringJournal.tcMirrorLayerTypeCode = {&LAYERTYPECODE-OFFICIAL})
        then do:
            assign viLocalStatus  = -1
                   vcMessage      = #T-23'At least one of the source or mirror daybooks should be in official layer':140(65896)t-23#.
            <M-19 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sMirroringJournal.tc_Rowid (icRowid), 
                input  'QadFin-7619':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BMirroringJournal>
        end. /* if t_sMirroringJournal.tcSourceLayerTypeCode <> {&LAYERTYPECODE-OFFICIAL}...  */
    end. /* if t_sMirroringJournal.tc_Status = "N":U or t_sMirroringJournal.tc_Status = "C":U */
end. /* for each t_sMirroringJournal where t_sMirroringJournal.tc_Status <> "":U: */

assign oiReturnStatus = viLocalStatus.