project QadFinancials > class BAPMatching > method AdditionalUpdatesAllLinesPLVarUsageSub2

Description

AdditionalUpdatesAllLinesPLVarUsageSub2; submethod of AdditionalUpdatesAllLinesPLVarUsage that is located in the same segment and that takes care of the creation of a posting-line for the UsageVariance (difference in qty)


Parameters


icAPMatchingPostingRowidIDinputcharacterAPMatchingPostingRowidID
icPostingTextinputcharacterPostingText
icGLCodeinputcharacter
icDivisionCodeinputcharacter
icCostCentreCodeinputcharacter
icProjectCodeinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.AdditionalUpdatesAllLinesPLVarUsage


program code (program6/bapmatching.p)

/* ======================== */
    /* Set default ReturnStatus */
    /* ======================== */
    assign oiReturnStatus = -98.
    
    /* ==================================================================================== */
    /* Create the posting line that covers the usage variances (difference in qty)          */                                                                      
    /* - we use the GL-Div-CC-PRJ as stated above                                           */
    /* - Positive amounts: posted on Debit / - Negative amounts: posted on Credit           */ 
    /* ==================================================================================== */
    assign vdDebitTC  = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or
                           tAPMatching.tcCInvoiceType = {&INVOICETYPE-CREDITNOTE}
                        then if tAPMatchingLn.APMatchingLnVarUsageTC > 0 then tAPMatchingLn.APMatchingLnVarUsageTC       else 0
                        else if tAPMatchingLn.APMatchingLnVarUsageTC < 0 then tAPMatchingLn.APMatchingLnVarUsageTC       else 0
           vdDebitLC  = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or
                           tAPMatching.tcCInvoiceType = {&INVOICETYPE-CREDITNOTE}
                        then if tAPMatchingLn.APMatchingLnVarUsageLC > 0 then tAPMatchingLn.APMatchingLnVarUsageLC       else 0
                        else if tAPMatchingLn.APMatchingLnVarUsageLC < 0 then tAPMatchingLn.APMatchingLnVarUsageLC       else 0
           vdDebitCC  = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or
                           tAPMatching.tcCInvoiceType = {&INVOICETYPE-CREDITNOTE}
                        then if tAPMatchingLn.APMatchingLnVarUsageCC > 0 then tAPMatchingLn.APMatchingLnVarUsageCC       else 0
                        else if tAPMatchingLn.APMatchingLnVarUsageCC < 0 then tAPMatchingLn.APMatchingLnVarUsageCC       else 0
           vdCreditTC = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or
                           tAPMatching.tcCInvoiceType = {&INVOICETYPE-CREDITNOTE}
                        then if tAPMatchingLn.APMatchingLnVarUsageTC < 0 then tAPMatchingLn.APMatchingLnVarUsageTC * -1  else 0
                        else if tAPMatchingLn.APMatchingLnVarUsageTC > 0 then tAPMatchingLn.APMatchingLnVarUsageTC * -1  else 0
           vdCreditLC = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or
                           tAPMatching.tcCInvoiceType = {&INVOICETYPE-CREDITNOTE}
                        then if tAPMatchingLn.APMatchingLnVarUsageLC < 0 then tAPMatchingLn.APMatchingLnVarUsageLC * -1  else 0
                        else if tAPMatchingLn.APMatchingLnVarUsageLC > 0 then tAPMatchingLn.APMatchingLnVarUsageLC * -1  else 0
           vdCreditCC = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or
                           tAPMatching.tcCInvoiceType = {&INVOICETYPE-CREDITNOTE}
                        then if tAPMatchingLn.APMatchingLnVarUsageCC < 0 then tAPMatchingLn.APMatchingLnVarUsageCC * -1  else 0
                        else if tAPMatchingLn.APMatchingLnVarUsageCC > 0 then tAPMatchingLn.APMatchingLnVarUsageCC * -1  else 0.
    <M-60 run AdditionalUpdatesAllLinesPLAddPostingLine
       (input  icAPMatchingPostingRowidID (icAPMatchingPostingRowId), 
        input  icGLCode (icGLCode), 
        input  icDivisionCode (icDivisionCode), 
        input  icCostCentreCode (icCostCentreCode), 
        input  icProjectCode (icProjectCode), 
        input  (if vcGLCode = ? or vcGLCode = '' then tAPMatchingLn.APMatchingLnOpAllocCode else '') (icOpAllocCode), 
        input  vdDebitTC (idDebitTC), 
        input  vdDebitLC (idDebitLC), 
        input  vdDebitCC (idDebitCC), 
        input  vdCreditTC (idCreditTC), 
        input  vdCreditLC (idCreditLC), 
        input  vdCreditCC (idCreditCC), 
        input  icPostingText (icPostingText), 
        input  tAPMatching.tdCInvoiceExchangeRate (idTCLCExchangeRate), 
        input  tAPMatching.tdCinvoiceRateScale (idTCLCExchangeScale), 
        input  ? (idTCCCExchangeRate), 
        input  ? (idTCCCExchangeScale), 
        input  tDefaultSafsOperAPM (tDefaultSafsAPM), 
        output tAPMatchingLn.VarUsagePostingLine_ID (oiPostingLineId), 
        input  true (ilisCallForVarianceOrTax), 
        output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper <  0 then return.
    
    /* ======================== */
    /* Set ReturnStatus = OK    */
    /* ======================== */
    if oiReturnStatus = -98 then assign oiReturnStatus = 0.