<?php 
session_start();
require_once '../includes/conn.php'; 
?>
<head> 
<title>Training Institute Manager</title>  
<link rel="stylesheet" href="css/table_data_center_with_border_black.css">
<link rel="icon" type="image/x-icon" href="../includes/dim.png"> 
</head>

<body>
    <div class="container-fluid">
<br>

						
			 <center>  <?php 
				  				   $pq=mysqli_query($con,"select * from stuff left join `user` on user.userid=stuff.userid where stuff.userid='".$_SESSION['id']."'");
				   while($pqrow=mysqli_fetch_array($pq)){
				?>
			<span style="font-size:21;font-weight:bold;">
			 <?php echo $pqrow['business_name']; ?>   
			 </span>	
			<?php }?>
			
			</b>
	<br> <span style="font-size:19;">
	Total Assets List - With Price<br>
	
			 
			 Print Date : <?php echo date("M d, Y") ;?> |  Time   : <?php date_default_timezone_set("Asia/Dhaka"); echo  date("h:i:sa");?>
</span>
<br>
<br>
								</center>

                   <?php  

	$sql = "SELECT * FROM assets  
	 left join asset_cat on asset_cat.ast_id=assets.ast_cat
	WHERE assets.user_id='".$_SESSION['id']."' ORDER BY assets.id asc  ";
	$query = $con->query($sql);
	$countProduct = $query->num_rows;
    
	$table = '
	  <table width="100%" class="table table-bordered">
		
		<tr>    
							<th>SL</th>   
							<th>Name</th>
							<th>Details</th>
							<th>Qty</th>
							<th>Price</th>
							<th>Buy From </th>
							<th>Date</th>
							
		</tr>

		<tr>';
		$sl=0;
		$TotalQty = "";
		$TotalPrice = "";
		while ($result = $query->fetch_assoc()) {
			
			$table .= '<tr>									
									<td><center>'.++$sl.'</center></td> 
									<td><center>'.$result['ast_name'].' </center></td>
									<td><center>'.$result['details'].' </center></td> 
									<td><center>'.$result['quantity'].'</center></td>  
									<td><center>'.$result['price'].'</center></td>  
									<td><center>'.$result['buy_from'].'</center></td> 
									<td><center>'.date("d-M-Y", strtotime($result['entry_date'])).'</center></td> 				
			</tr>';	
			
			$TotalQty += $result['quantity'];
			$TotalPrice += $result['price'];
			
		}
		$table .= '
		</tr>
		
		
		<tr>
			<td colspan="3"><b> Total  </b></td>
			<td><b> '.$TotalQty.'  </b></td>
			<td><b> '.$TotalPrice.'  </b></td>
		</tr>
		
		
	</table>
	';	

	echo $table;



?>	
				
	
</body>
</html>