6 include('includes/session.inc');
7 $title = _('Work Order Status Inquiry');
8 include('includes/header.inc');
10 $ErrMsg = _('Could not retrieve the details of the selected work order item');
11 $WOResult = DB_query("SELECT workorders.loccode,
12 locations.locationname,
13 workorders.requiredby,
16 stockmaster.description,
17 stockmaster.decimalplaces,
21 FROM workorders INNER JOIN locations
22 ON workorders.loccode=locations.loccode
24 ON workorders.wo=woitems.wo
25 INNER JOIN stockmaster
26 ON woitems.stockid=stockmaster.stockid
27 WHERE woitems.stockid='" . DB_escape_string($_REQUEST['StockID']) . "'
28 AND woitems.wo =" . $_REQUEST['WO'],
32 if (DB_num_rows($WOResult)==0){
33 prnMsg(_('The selected work order item cannot be retrieved from the database'),'info');
34 include('includes/footer.inc');
37 $WORow = DB_fetch_array($WOResult);
39 echo '<A HREF="'. $rootpath . '/SelectWorkOrder.php?' . SID
. '">' . _('Back to Work Orders'). '</A><BR>';
41 echo '<center><table cellpadding=2 border=1>
42 <tr><td class="label">' . _('Issue to work order') . ':</td><td>' . $_REQUEST['WO'] .'</td><td class="label">' . _('Item') . ':</td><td>' . $_REQUEST['StockID'] . ' - ' . $WORow['description'] . '</td></tr>
43 <tr><td class="label">' . _('Manufactured at') . ':</td><td>' . $WORow['locationname'] . '</td><td class="label">' . _('Required By') . ':</td><td>' . ConvertSQLDate($WORow['requiredby']) . '</td></tr>
44 <tr><td class="label">' . _('Quantity Ordered') . ':</td><td align=right>' . number_format($WORow['qtyreqd'],$WORow['decimalplaces']) . '</td><td colspan=2>' . $WORow['units'] . '</td></tr>
45 <tr><td class="label">' . _('Already Received') . ':</td><td align=right>' . number_format($WORow['qtyrecd'],$WORow['decimalplaces']) . '</td><td colspan=2>' . $WORow['units'] . '</td></tr>
46 <tr><td class="label">' . _('Date Material Issued') . ':</td><td>' . Date($_SESSION['DefaultDateFormat']) . '</td>
47 <td class="label">' . _('Issued From') . ':</td><td>';
49 if (!isset($_POST['FromLocation'])){
50 $_POST['FromLocation']=$WORow['loccode'];
52 $LocResult = DB_query("SELECT loccode, locationname
54 WHERE loccode='" . $_POST['FromLocation'] . "'",
56 $LocRow = DB_fetch_array($LocResult);
57 echo $LocRow['locationname'];
58 echo '<tr><td colspan=4><hr></td></tr>';
59 echo '</td></tr></table>';
61 //set up options for selection of the item to be issued to the WO
62 echo '<table border=1><tr><td colspan=5 class="tableheader">' . _('Material Requirements For this Work Order') . '</td></tr>';
63 echo '<tr><td colspan=2 class="tableheader">' . _('Item') . '</td>
64 <td class="tableheader">' . _('Qty Required') . '</td>
65 <td class="tableheader">' . _('Qty Issued') . '</td></tr>';
67 $RequirmentsResult = DB_query("SELECT worequirements.stockid,
68 stockmaster.description,
69 stockmaster.decimalplaces,
72 FROM worequirements INNER JOIN stockmaster
73 ON worequirements.stockid=stockmaster.stockid
74 WHERE wo=" . $_REQUEST['WO'],
77 while ($RequirementsRow = DB_fetch_array($RequirmentsResult)){
78 if ($RequirementsRow['autoissue']==0){
79 echo '<tr><td>' . _('Manual Issue') . '
80 <td>' . $RequirementsRow['stockid'] . ' - ' . $RequirementsRow['description'] . '</td>';
82 echo '<tr><td class="notavailable">' . _('Auto Issue') . '<td class="notavailable">' .$RequirementsRow['stockid'] . ' - ' . $RequirementsRow['description'] .'</td>';
84 $IssuedAlreadyResult = DB_query("SELECT SUM(-qty) FROM stockmoves
85 WHERE stockmoves.type=28
86 AND stockid='" . $RequirementsRow['stockid'] . "'
87 AND reference='" . DB_escape_string($_REQUEST['WO']) . "'",
89 $IssuedAlreadyRow = DB_fetch_row($IssuedAlreadyResult);
91 echo '<td align="right">' . number_format($WORow['qtyreqd']*$RequirementsRow['qtypu'],$RequirementsRow['decimalplaces']) . '</td>
92 <td align="right">' . number_format($IssuedAlreadyRow[0],$RequirementsRow['decimalplaces']) . '</td></tr>';
98 include('includes/footer.inc');