7 include('includes/session.inc');
8 $title = _('Where Used Inquiry');
9 include('includes/header.inc');
11 if (isset($_GET['StockID'])){
12 $StockID = trim(strtoupper($_GET['StockID']));
13 } elseif (isset($_POST['StockID'])){
14 $StockID = trim(strtoupper($_POST['StockID']));
17 echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID
. "'>" . _('Back to Items') . '</A><BR>';
20 $result = DB_query("SELECT description,
24 WHERE stockid='$StockID'",$db);
25 $myrow = DB_fetch_row($result);
26 if (DB_num_rows($result)==0){
27 prnMsg(_('The item code entered') . ' - ' . $StockID . ' ' . _('is not set up as an item in the system') . '. ' . _('Re-enter a valid item code or select from the Select Item link above'),'error');
28 include('includes/footer.inc');
31 echo "<BR><FONT COLOR=BLUE SIZE=3><B>$StockID - $myrow[0] </B> (" . _('in units of') . ' ' . $myrow[1] . ')</FONT>';
34 echo "<FORM ACTION='" . $_SERVER['PHP_SELF'] . '?'. SID
."' METHOD=POST>";
35 echo _('Enter an Item Code') . ": <input type=text name='StockID' size=21 maxlength=20 value='$StockID' >";
36 echo "<INPUT TYPE=SUBMIT NAME='ShowWhereUsed' VALUE='" . _('Show Where Used') . "'>";
40 if (isset($StockID)) {
43 stockmaster.description
44 FROM bom INNER JOIN stockmaster
45 ON bom.parent = stockmaster.stockid
46 WHERE component='" . $StockID . "'
47 AND bom.effectiveafter<='" . Date('Y-m-d') . "'
48 AND bom.effectiveto >='" . Date('Y-m-d') . "'";
50 $ErrMsg = _('The parents for the selected part could not be retrieved because');;
51 $result = DB_query($SQL,$db,$ErrMsg);
52 if (DB_num_rows($result)==0){
53 prnMsg(_('The selected item') . ' ' . $StockID . ' ' . _('is not used as a component of any other parts'),'error');;
56 echo '<TABLE WIDTH=100%>';
58 $tableheader = "<TR><TD class='tableheader'>" . _('Used By') . "</TD>
59 <TD class='tableheader'>" . _('Work Centre') . "</TD>
60 <TD class='tableheader'>" . _('Location') . "</TD>
61 <TD class='tableheader'>" . _('Quantity Required') . "</TD>
62 <TD class='tableheader'>" . _('Effective After') . "</TD>
63 <TD class='tableheader'>" . _('Effective To') . '</TD></TR>';
66 while ($myrow=DB_fetch_array($result)) {
69 echo "<tr bgcolor='#CCCCCC'>";
72 echo "<tr bgcolor='#EEEEEE'>";
77 echo "<td><A target='_blank' HREF='" . $rootpath . "/BOMInquiry.php?" . SID
. "&StockID=" . $myrow['parent'] . "' ALT='" . _('Show Bill Of Material') . "'>" . $myrow['parent']. ' - ' . $myrow['description']. '</a></td>';
78 echo '<td>' . $myrow['workcentreadded']. '</td>';
79 echo '<td>' . $myrow['loccode']. '</td>';
80 echo '<td>' . $myrow['quantity']. '</td>';
81 echo '<td>' . ConvertSQLDate($myrow['effectiveafter']) . '</td>';
82 echo '<td>' . ConvertSQLDate($myrow['effectiveto']) . '</td>';
89 //end of page full new headings if
98 include('includes/footer.inc');