project QadFinancials > class BOpenItemAdjustment > method OIAdjCommitSubOptimisticLock

Description

OIAdjCommitOptimisticLock


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BOpenItemAdjustment.OIAdjCommitSub


program code (program8/bopenitemadjustment.p)

/* ================================================================= */
    /* Go though all updates on CI/DI and check whether the open-balance */
    /* of the CI/DI that was displayed on the UI is still the same as    */
    /* the current open-balance of the CI/DI that is in the database.    */
    /* ================================================================= */
    for each tOIAdj where 
             tOIAdj.tcInvoiceOrigin = {&INVOICEORIGIN-CREDITOR} and 
             tOIAdj.tlIsNewOpenItem = false
             no-lock :      
        <Q-1 assign vlFcQueryRecordsAvailable = CInvoiceByIDBalanceTCDueDates (Cache)
          (input ?, (CompanyId)
           input tOIAdj.tiInvoiceID, (CInvoiceID)
           input tOIAdj.tdInvoiceBalanceTC, (BalanceTC)
           input ?, (CInvoiceIsSelected)
           input ?, (CInvoiceDueDate)
           input ?, (CInvoiceDiscountDueDate)) in BCInvoice >
        if vlFcQueryRecordsAvailable <> true
        then do :
            assign vcMsgOIAdj     = trim(subst(#T-10'The supplier invoice &1 has been modified since you loaded it. Refresh your client.':255(271)t-10#,tOIAdj.tcInvoiceNumberReference)) + chr(10) + 
                                    trim(subst(#T-11'The open balance of the supplier invoice &1 you want to update has already been updated by another user.':255(272)t-11#,tOIAdj.tcInvoiceNumberReference)) + chr(10) + 
                                    trim(subst(#T-12'Initial open balance of the supplier invoice: &1.':255(273)T-12#,tOIAdj.tdInvoiceBalanceTC))
                   oiReturnStatus = -1.
            <M-4 run SetMessage (input  vcMsgOIAdj (icMessage),
                     input  '':U (icArguments),
                     input  '':U (icFieldName),
                     input  '':U (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  '':U (icRowid),
                     input  'QADFIN-1315':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BOpenItemAdjustment>
        end. /* if vlFcQueryRecordsAvailable <> true */
    end. /* for each tOIAdj where */
    for each tOIAdj where 
             tOIAdj.tcInvoiceOrigin = {&INVOICEORIGIN-DEBTOR} and 
             tOIAdj.tlIsNewOpenItem = false
             no-lock :      
        <Q-8 assign vlFcQueryRecordsAvailable = DInvoiceByIDBalanceTCDueDates (Cache)
          (input ?, (CompanyId)
           input tOIAdj.tiInvoiceID, (DInvoiceID)
           input tOIAdj.tdInvoiceBalanceTC, (BalanceTC)
           input ?, (DInvoiceIsSelected)
           input ?, (DInvoiceDueDate)
           input ?, (DInvoiceDiscountDueDate)) in BDInvoice >
        if vlFcQueryRecordsAvailable <> true
        then do :
            assign vcMsgOIAdj     = trim(subst(#T-13'The customer invoice &1 has been modified since you loaded it. Refresh your client.':255(275)t-13#,tOIAdj.tcInvoiceNumberReference)) + chr(10) + 
                                    trim(subst(#T-14'The open balance of the customer invoice &1 you want to update has already been updated by another user.':255(276)t-14#,tOIAdj.tcInvoiceNumberReference)) + chr(10) + 
                                    trim(subst(#T-15'Initial open balance of the customer invoice: &1.':255(277)T-15#,tOIAdj.tdInvoiceBalanceTC))
                   oiReturnStatus = -1.
            <M-6 run SetMessage (input  vcMsgOIAdj (icMessage),
                     input  '':U (icArguments),
                     input  '':U (icFieldName),
                     input  '':U (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  '':U (icRowid),
                     input  'QADFIN-1316':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BOpenItemAdjustment>
        end. /* if vlFcQueryRecordsAvailable <> true */
    end. /* for each tOIAdj where */