- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / StockSerialItems.php
blob7bec23ba09b7233dac5691811bfa105a3fdbcd5f
1 <?php
2 /* $Revision: 1.5 $ */
4 $PageSecurity = 2;
6 include('includes/session.inc');
7 $title = _('Stock Of Controlled Items');
8 include('includes/header.inc');
11 if (isset($_GET['StockID'])){
12 $StockID = trim(strtoupper($_GET['StockID']));
13 } else {
14 prnMsg( _('This page must be called with parameters specifying the item to show the serial references and quantities') . '. ' . _('It cannot be displayed without the proper parameters being passed'),'error');
15 include('includes/footer.inc');
16 exit;
19 $result = DB_query("SELECT description,
20 units,
21 mbflag,
22 decimalplaces,
23 serialised,
24 controlled
25 FROM stockmaster
26 WHERE stockid='$StockID'",
27 $db,
28 _('Could not retrieve the requested item because'));
30 $myrow = DB_fetch_row($result);
32 $DecimalPlaces = $myrow[3];
33 $Serialised = $myrow[4];
34 $Controlled = $myrow[5];
36 echo "<BR><FONT COLOR=BLUE SIZE=3><B>$StockID - $myrow[0] </B> (" . _('In units of') . ' ' . $myrow[1] . ')</FONT>';
38 if ($myrow[2]=='K' OR $myrow[2]=='A' OR $myrow[2]=='D'){
40 prnMsg(_('This item is either a kitset or assembly or a dummy part and cannot have a stock holding') . '. ' . _('This page cannot be displayed') . '. ' . _('Only serialised or controlled items can be displayed in this page'),'error');
41 include('includes/footer.inc');
42 exit;
45 if ($Serialised==1){
46 echo '<BR><B>' . _('Serialised items in') . ' ';
47 } else {
48 echo '<BR><B>' . _('Controlled items in') . ' ';
52 $result = DB_query("SELECT locationname
53 FROM locations
54 WHERE loccode='" . $_GET['Location'] . "'",
55 $db,
56 _('Could not retrieve the stock location of the item because'),
57 _('The SQL used to lookup the location was'));
59 $myrow = DB_fetch_row($result);
60 echo $myrow[0];
62 $sql = "SELECT serialno,
63 quantity
64 FROM stockserialitems
65 WHERE loccode='" . $_GET['Location'] . "'
66 AND stockid = '" . $StockID . "'
67 AND quantity <>0";
70 $ErrMsg = _('The serial numbers/batches held cannot be retrieved because');
71 $LocStockResult = DB_query($sql, $db, $ErrMsg);
73 echo '<CENTER><TABLE CELLPADDING=2 BORDER=0>';
75 if ($Serialised == 1){
76 $tableheader = "<TR>
77 <TD class='tableheader'>" . _('Serial Number') . "</TD>
78 <TD class='tableheader'>" . _('Serial Number') . "</TD>
79 <TD class='tableheader'>" . _('Serial Number') . "</TD>
80 </TR>";
81 } else {
82 $tableheader = "<TR>
83 <TD class='tableheader'>" . _('Batch/Bundle Ref') . "</TD>
84 <TD class='tableheader'>" . _('Quantity On Hand') . "</TD>
85 <TD class='tableheader'>" . _('Batch/Bundle Ref') . "</TD>
86 <TD class='tableheader'>" . _('Quantity On Hand') . "</TD>
87 <TD class='tableheader'>" . _('Batch/Bundle Ref') . "</TD>
88 <TD class='tableheader'>" . _('Quantity On Hand') . "</TD>
90 </TR>";
92 echo $tableheader;
93 $TotalQuantity =0;
94 $j = 1;
95 $Col =0;
96 while ($myrow=DB_fetch_array($LocStockResult)) {
98 if ($Col==0 AND $BGColor=='#EEEEEE'){
99 $BGColor ='#CCCCCC';
100 echo "<TR bgcolor=$BGColor>";
101 } elseif ($Col==0){
102 $BGColor ='#EEEEEE';
103 echo "<TR bgcolor=$BGColor>";
106 $TotalQuantity += $myrow['quantity'];
108 if ($Serialised == 1){
109 printf('<td>%s</td>',
110 $myrow['serialno']
112 } else {
113 printf("<td>%s</td>
114 <td ALIGN=RIGHT>%s</td>",
115 $myrow['serialno'],
116 number_format($myrow['quantity'],$DecimalPlaces)
119 $j++;
120 If ($j == 36){
121 $j=1;
122 echo $tableheader;
124 //end of page full new headings if
125 $Col++;
126 if ($Col==3){
127 echo '</TR>';
128 $Col=0;
131 //end of while loop
133 echo '</TABLE><HR>';
134 echo '<BR><B>' . _('Total quantity') . ': ' . number_format($TotalQuantity, $DecimalPlaces) . '<BR>';
136 echo '</form>';
137 include('includes/footer.inc');