Replenishment orders

Hi guys,
I’m not sure weather this is gonna be functional or programmatical problem but has anyone had a following problem with the replenishment orders where for a certain reason there are already processed, fully received and billed purchase orders coming up in Replenishment Orders list.

As per an image below, I took into consideration the very latest PO of this supplier (PO2010-0058) and the one which does NOT seem to appear on list (PO2010-0040):

Afterwards, querying DB has shown me up that the things are roughly the same between the problematic orders and the ones which do not appear and are processed just the same way (see below). Both seem to be same however one does appear another - not. Also PO details and PO dispatch tables in terms of quantities and other obvious data seem to be completely matching.

As I’ve understood from the replenishment.php file, it’s important that the order is like fully processed/fully received and billed in order for it not to appear. See a part of the code below, report is supposed to show the orders which are not in status 6 (All products received) if a certain calculations are false, if I understand correct report is supposed to show up the orders where one or more products are not fully received, other then then it should only consider the ones which are in status less than 5 (products received / partially received).

Over and above that if I change the status to be displayed in this report (in replenishment.php) to status 6 then it says all products are received:

See below:

image

However if I apply the same status (status 6) manually in DB to my problematic POs, then I can see that the POs are now in status “Cancelled” and of course they disappear from the report.

Then I checked my settings and confirmed that the Source PO has to be marked as Billed whenever Vendor Invoice is validated and amounts do match, which in my opinion clearly states that the Purchase Order processing is finished, however the system does not mark it as billed automatically, and whenever PO is marked as billed manually, yes it becomes billed in the list of orders, but it’s status still stays 5 and PO still appears on replenishment list.

So overall my concern was to change the line 124 and do not include processed POs with the status less then 5 as normally we only receive the products in full and our PO’s are not usually waiting any further dispatches whatsoever and are billed immediately, however on the other hand would there be any way to ensure what actually is the status 6 (is it “all products received” or “Cancelled”) and set this status automatically upon full dispatch if it really means to be “All Products Received”?

Thanks a lot in advance!