project QadFinancials > class BGrossIncomeAccounting > method ValidateComponentPostAllFlags

Description

Validations depending on the flags "All Sub-Accounts", "All Cost Centers" and "All Projects".


Parameters


ilSalesGLIsDivisioninputlogical
ilSalesGLIsCostCentreinputlogical
ilSalesGLIsProjectinputlogical
ilSalesGLIsSafinputlogical
iiSalesGLDivisionIDinputinteger
iiSalesGLCostCentreIDinputinteger
iiSalesGLProjectIDinputinteger
iiSalesGLSafStructIDinputinteger
ilTaxPayGLIsDivisioninputlogical
iiTaxPayGLDivisionIDinputinteger
ilTaxExpGLIsDivisioninputlogical
ilTaxExpGLIsCostCentreinputlogical
ilTaxExpGLIsProjectinputlogical
ilTaxExpGLIsSafinputlogical
iiTaxExpGLDivisionIDinputinteger
iiTaxExpGLCostCentreIDinputinteger
iiTaxExpGLProjectIDinputinteger
iiTaxExpGLSafStructIDinputinteger
icSalesGLAnalysisLimitinputcharacter
icTaxExpGLAnalysisLimitinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BGrossIncomeAccounting.ValidateComponentPost


program code (program4/bgrossincomeaccounting.p)

/* Note: t_sGrossIncAcc is available because it is available in the calling method ValidateComponentPost, which is in the same segment */ 

    /* ========================================= */
    /* Validations when All Divisions is flagged */
    /* ========================================= */
    /* The division codes for Sales account and Tax Expense account have to be empty */
    if t_sGrossIncAcc.GrossIncAccIsAllDivision = true and
     ((t_sGrossIncAcc.SalesDivision_ID <> 0 and
       t_sGrossIncAcc.SalesDivision_ID <> ?)          or
      (t_sGrossIncAcc.TaxExpenseDivision_ID <> 0 and
       t_sGrossIncAcc.TaxExpenseDivision_ID <> ?)     or
      (t_sGrossIncAcc.TaxPayableDivision_ID <> 0 and
       t_sGrossIncAcc.TaxPayableDivision_ID <> ?))
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-74'When the All Sub-Accounts option is checked, a Sub-Accounts for the Sales Account, Tax Payable and the Tax Expense Account must not be input.':255(265544724)T-74#.
        <M-17 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesDivisionCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesDivisionCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-131172':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllDivision = true and */

    /* The division flag on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllDivision = true and
       ilSalesGLIsDivision <> ilTaxExpGLIsDivision
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-82'When the All Sub-Accounts option is checked, the entered Sales and Tax Expense Accounts must both include or exclude Sub-Accounts in the GL Account Analysis.':255(294494244)T-82#.
        <M-87 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-568398':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllDivision = true and */

    /* The default division on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllDivision = true and
       ilSalesGLIsDivision                     = true and
       ilTaxExpGLIsDivision                    = true and
       iiSalesGLDivisionID                    <> iiTaxExpGLDivisionID
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-4'When the All Sub-Accounts option is checked, the entered Sales and Tax Expense Accounts must have the same Default Sub-Account in the GL Account Analysis.':255(5432995)T-4#.
        <M-40 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-795385':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllDivision = true and */

    /* ============================================ */
    /* Validations when All Cost Centers is flagged */
    /* ============================================ */
    /* The costcentre codes for Sales account and Tax Expense account have to be empty */
    if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and
     ((t_sGrossIncAcc.SalesCostCentre_ID <> 0 and
       t_sGrossIncAcc.SalesCostCentre_ID <> ?)          or
      (t_sGrossIncAcc.TaxExpenseCostCentre_ID <> 0 and
       t_sGrossIncAcc.TaxExpenseCostCentre_ID <> ?))
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-22'When the All Cost Centers option is checked, a Cost Center for the Sales Account and the Tax Expense Account must not be input.':255(692937986)T-22#.
        <M-61 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesCostCentreCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesCostCentreCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-154667':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and */

    /* The cost centre flag on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and
       (ilSalesGLIsCostCentre <> ilTaxExpGLIsCostCentre or
        ilSalesGLIsProject    <> ilTaxExpGLIsProject)
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-7'When the All Cost Centers option is checked, the entered Sales and Tax Expense Accounts must both include or exclude Cost Centers in the GL Account Analysis.':255(659840680)T-7#.
        <M-24 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-512585':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>    
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and */

    /* The saf structure default on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and
       iiSalesGLSafStructID  <> iiTaxExpGLSafStructID
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-51'When the All Cost Centers option is checked, the entered Sales and Tax Expense Accounts must both use the same SAF Structure.':255(839221562)T-51#.
        <M-93 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-806131':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>    
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and */

    /* The default cost centre on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and
       ilSalesGLIsCostCentre                     = true and
       ilTaxExpGLIsCostCentre                    = true and
       iiSalesGLCostCentreID                    <> iiTaxExpGLCostCentreID
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-28'When the All Cost Centers option is checked, the entered Sales and Tax Expense Accounts must have the same Default Cost Center in the GL Account Analysis.':255(533981491)T-28#.
        <M-36 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-881372':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and */

    /* ======================================== */
    /* Validations when All Projects is flagged */
    /* ======================================== */
    /* The project codes for Sales account and Tax Expense account have to be empty */
    if t_sGrossIncAcc.GrossIncAccIsAllProject = true and
     ((t_sGrossIncAcc.SalesProject_ID <> 0 and
       t_sGrossIncAcc.SalesProject_ID <> ?)          or
      (t_sGrossIncAcc.TaxExpenseProject_ID <> 0 and
       t_sGrossIncAcc.TaxExpenseProject_ID <> ?))
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-83'When the All Projects option is checked, a Project for the Sales Account and the Tax Expense Account must not be input.':255(149133109)T-83#.
        <M-97 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesProjectCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesProjectCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-651243':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true and */

    /* The project flag on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllProject = true and
       (ilSalesGLIsProject    <> ilTaxExpGLIsProject    or
        ilSalesGLIsCostCentre <> ilTaxExpGLIsCostCentre)
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-59'When the All Projects option is checked, the entered Sales and Tax Expense Accounts must both include or exclude Projects in the GL Account Analysis.':255(520245083)T-59#.
        <M-63 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-41728':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>    
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllProject = true and */

    /* The project flag on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllProject = true and
        iiSalesGLSafStructID  <> iiTaxExpGLSafStructID
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-73'When the All Projects option is checked, the entered Sales and Tax Expense Accounts must both use the same SAF Structure.':255(517426191)T-73#.
        <M-44 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-612604':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>    
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllProject = true and */

    /* The default project on sales account and tax expense account should be the same */
    if t_sGrossIncAcc.GrossIncAccIsAllProject = true and
       ilSalesGLIsProject                     = true and
       ilTaxExpGLIsProject                    = true and
       iiSalesGLProjectID                    <> iiTaxExpGLProjectID
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-33'When the All Projects option is checked, the entered Sales and Tax Expense Accounts must have the same Default Project in the GL Account Analysis.':255(668411444)T-33#.
        <M-85 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-196173':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if t_sGrossIncAcc.GrossIncAccIsAllProject = true and */

    /* ============================ */
    /* Validate Analysis Limitation */
    /* ============================ */
    if (t_sGrossIncAcc.GrossIncAccIsAllProject    = true or
        t_sGrossIncAcc.GrossIncAccIsAllCostCentre = true) and 
       ilSalesGLIsCostCentre                      = true  and
       ilSalesGLIsProject                         = true  and
       ilTaxExpGLIsCostCentre                     = true  and
       ilTaxExpGLIsProject                        = true  and
       icSalesGLAnalysisLimit                    <> icTaxExpGLAnalysisLimit
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-52'When the All Cost Centers or All Projects options are checked and the entered Sales and Tax Expense Accounts are defined with Cost Center and Project, then they must have the same Analysis Limitation.':255(291131369)T-52#.
        <M-6 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-485509':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if (t_sGrossIncAcc.GrossIncAccIsAllProject    = true or */
    
    /* ====================================================== */
    /* Validate SAF analysis on Sales and Tax Expense Account */
    /* ====================================================== */
    /* accounts should either both be assigned with saf or either both be assigned without saf */
    if ilSalesGLIsSaf <> ilTaxExpGLIsSaf
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-43'The selected Sales Account and Tax Expense Account must be either both be defined with SAF or both be defined without SAF.':255(616918950)T-43#.
        <M-34 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-343069':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if ilSalesGLIsSaf <> ilTaxExpGLIsSaf */

    /* Both default saf structures should be the same */
    if ilSalesGLIsSaf        = true and
       ilTaxExpGLIsSaf       = true and
       iiSalesGLSafStructID <> iiTaxExpGLSafStructID
    then do:
        assign oiReturnStatus = -1
               vcMessage      = #T-94'The selected Sales Account and Tax Expense Account must both be defined with the same SAF Structure.':255(36523645)T-94#.
        <M-75 run SetMessage
           (input  vcMessage (icMessage), 
            input  '' (icArguments), 
            input  'tGrossIncAcc.tcSalesGLCode' (icFieldName), 
            input  t_sGrossIncAcc.tcSalesGLCode (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  t_sGrossIncAcc.tc_Rowid (icRowid), 
            input  'qadfin-407934':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BGrossIncomeAccounting>
    end. /* if ilSalesGLIsSaf = true and */