0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: stockusage_reports_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; $u_id= @$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $sql="select distinct item_name from stockusage_entry where user_id='$u_id'"; $sql=mysql_query($sql); $i=0; while($row=mysql_fetch_array($sql)) { $item_name_db=$row['item_name']; $i=$i+1; $item_name_array[$i]=$item_name_db; } $error_flag=0; $itemname_restore=@$_POST['cmbitem']; $item_name=$item_name_array[$itemname_restore]; if(isset($_POST['showbtn'])) { $u_id=@$_SESSION['user_id']; if($item_name=="") { $sql="select * from stockusage_entry where user_id='$u_id' ORDER BY date "; Stockusagereport::printStockusageDetails($sql); } else { $sql="select * from stockusage_entry where user_id='$u_id' and item_name='$item_name' and date ORDER BY date"; Stockusagereport::printStockusageDetails($sql); } } class Stockusagereport { //7 public function printStockusageDetails($sql1) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <div align="center"> <p><b>Details of items used(<?php $u_name=@$_SESSION['username']; $u_name_var=strtoupper($u_name); echo $u_name_var;?> Division)</b></p> </div> <table width="473" height="72" border="1" align="center" id="ledgertable"> <tr> <th width="24" height="42"> S No </th> <th width="97">Item name</th> <th width="86">Entry Date</th> <th width="101">Number of items used</th> <th width="131">Description </th> </tr> <?php $itemnumber=0; while($row=mysql_fetch_array($sql)) {//32 ?> <tr> <td height="22"><div align="center"><?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?></div></td> <td><div align="center"><?php $itemname_db=$row['item_name']; echo $itemname_db; ?></div></td> <td><div align="center"><?php $datedb=$row['date']; echo $datedb; ?></div></td> <td><div align="center"><?php $itemnumber_db=$row['itemused']; echo $itemnumber_db; $itemnumber=$itemnumber+$itemnumber_db; ?></div></td> <td><div align="center"><?php echo $row['description']; ?></div></td></tr> <?php }//32 ?> </table> <table width="470" align="center"> <tr> <td width="221"><div align=""><strong>Grand total</strong></div></td> <td width="102"><div align="center"><?php echo $itemnumber;?></div></td> <td width="90"> </td> <td width="37"> </td> </tr> </table> <?php }//14 else {//14 ?><font color="#CC0000"><b><?php echo "No $itemname_db Details to display"; ?></b></font><?php }//14 }//10 }//7 if(isset($_POST['showbtn'])) { ?> </p> <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="stockmanagement.php">Back</a></p> </blockquote> <?php } ?>