Receiving the following error:
The credit quantity for the line for <itemnumber> is more than the quantity invoiced. This check is made to ensure that the credit note is not duplicated.
This is coming from this logic:
Code:
foreach ($_SESSION['CreditItems' . $identifier]->LineItems as $CreditLine) {
$SQL = "SELECT count(*) FROM salesorderdetails WHERE orderno = '" . $_SESSION['CreditItems'.$identifier]->OrderNo . "'
AND stkcode = '" . $CreditLine->StockID . "'
[color=#FFD700]AND quantity >=" . $CreditLine->QtyDispatched . " [/color]
AND qtyinvoiced >=" . $CreditLine->QtyDispatched;
$ErrMsg = _('Failed to retrieve salesoderdetails to compare if the order has been invoiced and that it is possible that the credit note may not already have been done');
$DuplicateCreditResult = DB_query($SQL,$db,$ErrMsg);
$myrow1 = DB_fetch_array($DuplicateCreditResult);
if($myrow1[0] == 0){
prnMsg(_('The credit quantity for the line for') . ' ' . $CreditLine->StockID . ' ' . ('is more than the quantity invoiced. This check is made to ensure that the credit note is not duplicated.'),'error');
$OKToProcess = false;
include('includes/footer.inc');
exit;
}
}
The issue is that I had an order for 40,000 LBs and Shipped 40,625. Since I overshipped the highlighted line fails.
Short term fix I can update DB quantity field.
Long term should the fix be to remove this eidt. Make edit more detailed (Link to dispatch quantities using stockmoves and /or stockserialmoves table or Update quantity field on order when overshipping and before closing order?
Thoughts?
Best Regards,
Andrew Galuski