0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: stocksummary_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 stockitem 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 stockitem where user_id='$u_id' order by category_name"; Stocksummaryreport::printsummaryreportDetails($sql); } else { $sql="select * from stockitem where user_id='$u_id' and item_name='$item_name' order by category_name"; Stocksummaryreport::printsummaryreportDetails($sql); } } class Stocksummaryreport { //7 public function printsummaryreportDetails($sql1) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <div align="center"> <p><b>Summary report of stock of <?php $u_name=@$_SESSION['username']; $u_id=@$_SESSION['user_id']; $u_name_var=strtoupper($u_name); echo $u_name_var;?> division</b></p> </div> <table width="670" height="76" border="1" align="center" id="ledgertable"> <tr> <th width="54" height="42"> S No </th> <th width="222">Item name</th> <th width="170">Category</th> <th width="95">Number of items in stock</th> <th width="95">Number of items used</th> </tr> <?php $instock=0; $used=0; while($row=mysql_fetch_array($sql)) {//32 ?> <tr> <td><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 echo $row['category_name']; ?> </div></td> <td><div align="center"> <?php $sqlentry="select * from stockentry where item_name='$itemname_db' and user_id='$u_id'"; mysql_query($sqlentry); if(mysql_affected_rows()>0) { $sql1=mysql_query($sqlentry); while($row1=mysql_fetch_array($sql1)) { $instock_db=$row1['itemsinstock']; $instock=$instock+$instock_db; } echo $instock_db; } else { echo "No Stock is added"; } ?> </div></td> <td><div align="center"> <?php $sqlused="select * from stockusage_entry where item_name='$itemname_db' and user_id='$u_id'"; $sql2=mysql_query($sqlused); if(mysql_affected_rows()>0) { while($row2=mysql_fetch_array($sql2)) { $used_db=$row2['itemused']; $used=$used+$used_db; } echo $used_db; } else { echo "This item is not used"; } ?> </div></td></tr> <?php }//32 ?></table> <table width="723" align="center"> <tr> <td width="182"><div align="center"><strong>Grand total</strong></div></td> <td width="303"><div align="center"></div></td> <td width="98"><div align="center"><strong><font color="#853008"><?php echo $instock;?></font></strong></div></td> <td width="95"><div align="center"><strong><font color="#853008"><?php echo $used;?></font></strong></div></td> <td width="21"><div align="center"></div></td> </tr> </table> <?php }//14 else {//14 ?> <font color="#CC0000"><b><?php echo "No 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 } ?>