- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / WhereUsedInquiry.php
blob3e6d429365e14007232e53542c46c665319cd208
1 <?php
3 /* $Revision: 1.9 $ */
5 $PageSecurity = 2;
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>';
19 if (isset($StockID)){
20 $result = DB_query("SELECT description,
21 units,
22 mbflag
23 FROM stockmaster
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');
29 exit;
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') . "'>";
38 echo '<HR>';
40 if (isset($StockID)) {
42 $SQL = "SELECT bom.*,
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');;
54 } else {
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>';
64 echo $tableheader;
65 $k=0;
66 while ($myrow=DB_fetch_array($result)) {
68 if ($k==1){
69 echo "<tr bgcolor='#CCCCCC'>";
70 $k=0;
71 } else {
72 echo "<tr bgcolor='#EEEEEE'>";
73 $k=1;
75 $k++;
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>';
84 $j++;
85 If ($j == 12){
86 $j=1;
87 echo $tableheader;
89 //end of page full new headings if
92 echo '</TABLE>';
94 } // StockID is set
96 echo '</FORM>';
98 include('includes/footer.inc');