The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Invoice matching error

Deepanshi1
Mega Guru

i have a purchase order which has po amount as 153.93 and it has 3 invoices 

amounting 62.57,42,27 & 50.09 totaling to 153.93. as per matching mechanism the PO matching should complete. but it's throwing error as below for all the invoices associated with the PO:

"PO Amount: 153.93
INV0050428: amount: 62.57
INV0051781: amount: 41.27
INV0050429: amount: 50.09
Total invoices amount more than PO amount"

 

this is my piece of code which is handling this logic

poSubtotalAmount = parseFloat(poSubtotalAmount).toFixed(2); // for decimal precision
    invoicesTotalAmount = parseFloat(invoicesTotalAmount).toFixed(2);

    if (isNaN(poSubtotalAmount) || isNaN(invoicesTotalAmount)) {
        matchingOk = false;
        invoiceErrMessages.push("Either poSubTotalAmount or invoicesTotalAmount is NaN");
    } else if (invoicesTotalAmount > poSubtotalAmount) {
        // If the total amount of all the associated Invoices is MORE than the PO amount,
        // then matching fails.
        matchingOk = false;
        invoiceErrMessages.push("Total invoices amount more than PO amount");
    }
 
i dont understand why its showing error ? is there something i need to change here? please help me out.
0 REPLIES 0