From: RL <rl...@ya...> - 2014-12-28 04:47:43
|
Hello you guys, I'm trying to reverse a controlled item, but I just can´t, this is the issue: 1) I create an item, les say controlled01 as a controlled, not serial.2) I made a PO and received 40 of these controlled01, at this moment I have in my stock, 40 with serialno='BBD0344'3) I invoice 30 of those 40, at this moment I have 10 in my stock4) I want to return 4 to my vendor because I just realized that they were broken, so I create a Debit Note5) I try to Reverse an Outstanding GRN and that is where I get this error message:ERROR Message Report : Unfortunately, of the original number (40) that were received on serial number BBD0344 only 10 remain. The GRN can only be reversed if all the original serial number items are still in stock in the location they were received into But I already sold those 30. Code of ReverseGRN.php while ($SerialStockMoves = DB_fetch_array($GetStockMoveResult)){ Line 93 to 109 $SQL = "SELECT stockserialitems.quantity FROM stockserialitems WHERE stockserialitems.stockid='" . $GRN['itemcode'] . "' AND stockserialitems.loccode ='" . $GRN['intostocklocation'] . "' AND stockserialitems.serialno ='" . $SerialStockMoves['serialno'] . "'"; $GetQOHResult = DB_query($SQL,_('Unable to retrieve the quantity on hand of') . ' ' . $GRN['itemcode'] . ' ' . _('for Serial No') . ' ' . $SerialStockMoves['serialno']); $GetQOH = DB_fetch_row($GetQOHResult); if ($GetQOH[0] < $SerialStockMoves['moveqty']){ /*Then some of the original goods received must have been sold or transfered so cannot reverse the GRN */ prnMsg(_('Unfortunately, of the original number') . ' (' . $SerialStockMoves['moveqty'] . ') ' . _('that were received on serial number') . ' ' . $SerialStockMoves['serialno'] . ' ' . _('only') . ' ' . $GetQOH[0] . ' ' . _('remain') . '. ' . _('The GRN can only be reversed if all the original serial number items are still in stock in the location they were received into'),'error'); include ('includes/footer.inc'); exit; } } What is this condition for if ($GetQOH[0] < $SerialStockMoves['moveqty']){ ?? What changes should be made in order to return those 4?Is there something else to take into consideration? Thanks a lot |