project QadFinancials > class TSetStatutoryCurrency > method PostingForCrossCompanyCounterPart

Description

This method is used to process posting, that was created as counter-part of the cross company posting.


Parameters


biPostingLineCounterinput-outputinteger
olPostingIsProcessedoutputlogical
ocPostCCBalanceTooutputcharacter
ocErrorMessageoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method TSetStatutoryCurrency.PostingForCDocument
method TSetStatutoryCurrency.PostingForDDocument


program code (program1/tsetstatutorycurrency.p)

/* This routine is called in case of the Invoice movement comming from any type of Payment *
 * but this is the posting in the second entity, where we have only invoice                */
assign oiReturnStatus       = -98
       viLocalReturnStatus  = 0
       olPostingIsProcessed = false.
       
STATCURRBLOCK:
do on error undo, return:   

    /* Assign type of GL account to be used for posting of any SC balances */
    assign ocPostCCBalanceTo = {&GLSYSTEMTYPE-ROUND}
           vdCCRate          = ?
           vdCCScale         = ?.
    
    /* First of all we have to get exchange rate that is used for it, it is taken from the *
     * invoice                                                                             */
    if vdCCRate = ?
    then do:    
        for each PostingLine of Posting no-lock,
            first CInvoiceMovement of PostingLine no-lock,
            first CInvoice of CInvoiceMovement no-lock:
            assign vdCCRate  = CInvoice.CInvoiceCCRate
                   vdCCScale = CInvoice.CInvoiceCCScale.
            leave.
         end.
    end. /* if vdCCRate = ? */

    if vdCCRate = ?
    then do:    
        for each PostingLine of Posting no-lock,
            first DInvoiceMovement of PostingLine no-lock,
            first DInvoice of DInvoiceMovement no-lock:
            assign vdCCRate  = DInvoice.DInvoiceCCRate
                   vdCCScale = DInvoice.DInvoiceCCScale.
            leave.
         end.
    end. /* if vdCCRate = ? */


    /* Go through the posting lines and calculated CC values */
    for each PostingLine of Posting exclusive-lock:

        assign biPostingLineCounter  = biPostingLineCounter + 1.

        <M-18 run PostingLineCCUpdate
           (input  vdCCRate (idCCRate), 
            input  vdCCScale (idCCRateScale), 
            output vcTempErrorMessage (ocErrorMessage), 
            output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
        assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
        if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
        if viFcReturnSuper <  0 then leave STATCURRBLOCK.
    
    end. /* PostingLine */

    assign olPostingIsProcessed = true.

end. /* STATCURRBLOCK */

assign oiReturnStatus = viLocalReturnStatus.