webERP Forum
Items Other than those in BOM are not listed in Status of Work Order even if issued - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (http://www.weberp.org/forum/forumdisplay.php?fid=8)
+--- Thread: Items Other than those in BOM are not listed in Status of Work Order even if issued (/showthread.php?tid=2162)



Items Other than those in BOM are not listed in Status of Work Order even if issued - newuser990 - 03-17-2014

Hi,

Say a work order is created for a Manufactured item M made of A + B + C as per BOM.

Now if an extra item D is also issued for this WO, and we check the status, it does not show the extra item D that is issued. Though this is accounted for and shown in the costing screen. It will be good if all the issued items are shown in the status screen / issue screen and not only those that are in the BOM of that manufactured item.

May be this issue is discussed earlier, but I searched and could not find previous posts and hence this post.

Thanks



RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - Forums3 - 03-18-2014

Yes, this looks like a bug. I agree it ought to show.

Tim
(03-18-2014, 10:41 PM)Forums3 Wrote: Yes, this looks like a bug. I agree it ought to show.

Tim

There is almost certainly a better way of doing it but if you remove lines 113 to 132 of WorkOrderStatus.php and replace them with:

$IssuedAlreadyResult = DB_query("SELECT stockid,
SUM(-qty) AS total
FROM stockmoves
WHERE stockmoves.type=28
AND reference='" . $SelectedWO . "'
GROUP BY stockid", $db);

while ($IssuedRow = DB_fetch_array($IssuedAlreadyResult)) {
$IssuedAlreadyRow[$IssuedRow['stockid']] = $IssuedRow['total'];
}

while ($RequirementsRow = DB_fetch_array($RequirmentsResult)) {
if ($RequirementsRow['autoissue'] == 0) {
echo '<tr>
<td>' . _('Manual Issue') . '</td>
<td>' . $RequirementsRow['stockid'] . ' - ' . $RequirementsRow['description'] . '</td>';
} else {
echo '<tr>
<td class="notavailable">' . _('Auto Issue') . '</td>
<td class="notavailable">' . $RequirementsRow['stockid'] . ' - ' . $RequirementsRow['description'] . '</td>';
}
if (isset($IssuedAlreadyRow[$RequirementsRow['stockid']])) {
$Issued = $IssuedAlreadyRow[$RequirementsRow['stockid']];
unset($IssuedAlreadyRow[$RequirementsRow['stockid']]);
} else {
$Issued= 0;
}
echo '<td class="number">' . locale_number_format($WORow['qtyreqd'] * $RequirementsRow['qtypu'], $RequirementsRow['decimalplaces']) . '</td>
<td class="number">' . locale_number_format($Issued, $RequirementsRow['decimalplaces']) . '</td></tr>';
}

/* Now do any additional issues of items not in the BOM */
foreach ($IssuedAlreadyRow as $StockID=>$Issued) {
$RequirementsSQL = "SELECT stockmaster.description,
stockmaster.decimalplaces
FROM stockmaster
WHERE stockid='" . $StockID . "'";
$RequirmentsResult = DB_query($RequirementsSQL, $db);
$RequirementsRow = DB_fetch_array($RequirmentsResult);
echo '<tr>
<td>' . _('Additional Issue') . '</td>
<td>' . $StockID . ' - ' . $RequirementsRow['description'] . '</td>';
echo '<td class="number">0</td>
<td class="number">' . locale_number_format($Issued, $RequirementsRow['decimalplaces']) . '</td>
</tr>';
}

it should work. Let me know if it works for you.

Thanks Tim


RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - Exsonqu_Qu - 03-19-2014

Hi, newuser990 and Tim,

Thank you very much for your report and patch. I've commit it to trunk.

Best regards!

Exson


RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - newuser990 - 03-19-2014

Dear Tim and Exsonqu_qu

Thanks for the commit. Its working Great. Smile

I was thinking a similar change is required to WorkOrderIssue.php since it is important to display all that is already issued while issuing the materials.

Thanks




RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - Exsonqu_Qu - 03-21-2014

Hi, newuser990,

Thank you for your report. Now the problem also fixed in WorkOrderIssue.php in the trunk.

Best regards!

Exson


RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - Uhuru - 03-23-2014

Hi Exson,

Apologies for the delay, I have only just got around to reviewing this commit. There are a couple of errors in the WorkOrderissue.php script. In the sql statement at line 658 you have descrption, which should be description.

On line 629 you have

$IssuedMaterials[$myrow['stockid']]['description'] = $myrow['description'];

but the sql that $myrow refers to only has two fields "SELECT stockid, SUM(-qty) as total FROM stockmoves WHERE stockmoves.type=28AND reference='" . $_POST['WO'] . "' GROUP BY stockid" so no reference to description field.

If you refer to the way I did WorkOrderStatus.php you can see what I mean.

Errors like these can be found more easily if you set error_reporting to be -1 at development time.

Thanks
Tim


RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - Exsonqu_Qu - 03-24-2014

Hi, Tim,

Thank you for your review.

It's fixed now.

Best regards!

Exson


RE: Items Other than those in BOM are not listed in Status of Work Order even if issued - agaluski - 03-28-2014

Conceptually I would think that if we issue something to a W/O that is not in the worequirements table then we should create the worequirements record with qtypu = 0 so that everything required and or issued is in 1 table.
Is there a reason doing this would not be warranted? It would simplify many queries and reports downstream is a company often uses substitute items in their processes.