<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="stylesheet" href="datatable/data.css"> -->
<script src="datatable/data.js" type="text/javascript"></script>
<!-- <script src="datatable/table.js" type="text/javascript"></script> -->
<!-- <script src="datatable/datatable.js"></script> -->
<!-- <link rel="stylesheet" href="datatable/data-boot.css"> -->
<style>
    #navbar
    {
        flex:15%;
      
        flex-direction:row;
        overflow:auto;
          
        
    }
    #content
    {
        flex:90%;
        overflow:auto;
    }
    #fullbody
    {
        display:flex;
        
         height:100%;         
    }
    @media (max-width: 800px) {
        #fullbody
    {
        display:flex;
        flex-wrap: wrap;
                 
    }
        #navbar,#content {
    flex: 100%;
  }
}
</style>
</head>
<body>
<div id="navbar" class="bg-info"><?php include "navbar.php"?></div>
    <div id="fullbody"> 

<div id="content">
    <!-- charts -->
    
    <div class="row">
     <div class="col-sm-1">
    &nbsp;
    </div>
    <div class="col-sm-5">
    <h3 align="center">Sales</h3>
    <table class="tbl table table-bordered ">
    <tbody>
    <?php
	
	$date=date("Y-m-d");
	 echo "Date:".date("d-m-Y");
//echo date_format($date,"Y/m/d H:i:s");
	
	$sql_sales=mysqli_query($connect,"select modeof,sum(totalamount) as totalamt from second_transaction where status='' and date='$date' group by modeof");
	$totalsales=0;
	while($row_sales=mysqli_fetch_array($sql_sales))
	{
	?>
    <tr><th class="table-primary"><?php echo $row_sales['modeof'];?></th><td align="right" class="table-Warning"><?php echo number_format($row_sales['totalamt'],2,'.','');?></td></tr>
    <?php
	$totalsales=$totalsales+$row_sales['totalamt'];
	}
	?>
    <tr><th class="table-primary">Total Sales</th><td align="right" class="table-Success"><?php echo number_format($totalsales,2,'.','');?></td></tr>
    <?php
	//$sql_driver=mysqli_query($connect,"select sum(driver_amount) as driver_amount from second_transaction where status='' and date='$date' ");
	
	//while($row_bata=mysqli_fetch_array($sql_driver))
	//{
	?>
   <!-- <tr><th>Driver Amount</th><td align="right"><?php echo number_format($row_bata['driver_amount'],2,'.','');?></td></tr>-->
    <?php
	
	//}
	?>
    </tbody></table>
    </div>
    
    <div class="col-sm-5">
    
    <h3 align="center">Collection</h3>
    <?php echo "Date:".date("d-m-Y");?>
    <table class="tbl table table-bordered">
    <tbody>
    
    <?php
	
	$sql_collection=mysqli_query($connect,"select sum(amount) as cash,sum(otheramount) as Bank from creditdetails where status='' and date='$date' ");
	while($row_collection=mysqli_fetch_array($sql_collection))
	{
	?>
    <tr><th class="table-Danger">CASH</th><td align="right" class="table-Success"><?php echo number_format($row_collection['cash'],2,'.','');?></td></tr>
    <tr><th class="table-Danger">To BANK</th><td align="right" class="table-Warning"><?php echo number_format($row_collection['Bank'],2,'.','');?></td></tr>
    <?php
	}
	?>
    
    </tbody></table>
    </div>
    
    </div>
    
    <div>&nbsp;</div>
    
    <div class="row">
     <div class="col-sm-1">
    &nbsp;
    </div>
    <div class="col-sm-5">
    <h3 align="center">SUM OF SALES</h3>
    <table class="tbl table table-bordered ">
           <tr>
           <th class="table-Success">Product</th>
           <th class="table-Danger">No.OF.LOADS</th>
           <th class="table-Warning">TOTAL UNITS</th>
           <th class="table-Primary">TOTAL VALUE</th>
           </tr>
           <?php
		   $sql_product=mysqli_query($connect,"select productname,count(product) as pcount,sum(netqty) as qty,sum(totalamount) as tamount from second_transaction where status='' and  date='$date' group by product");
		   $tload=0;
		   $tqty=0;
		   $tamount=0;
		   while($row_product=mysqli_fetch_array($sql_product))
			 {
		   ?>
           <tr>
           <td class="table-Success"><?php echo $row_product['productname'];?></td>
		   <td align="right" class="table-Danger"><?php echo number_format($row_product['pcount'],2,'.','');?></td>
           <td align="right" class="table-Warning"><?php echo number_format($row_product['qty'],2,'.','');?></td>
           <td align="right" class="table-Primary"><?php echo number_format($row_product['tamount'],2,'.','');?></td>
          
           </tr>
           <?php
		   $tload+=$row_product['pcount'];
		   $tqty+=$row_product['qty'];
		   $tamount+=$row_product['tamount'];
		   }
		   ?>
           <tr>
           <td><strong>TOTAL</strong></td>
		   <td align="right" class="table-Danger"><strong><?php echo number_format($tload,2,'.','');?></strong></td>
           <td align="right" class="table-Warning"><strong><?php echo number_format($tqty,2,'.','');?></strong></td>
           <td align="right" class="table-Primary"><strong><?php echo number_format($tamount,2,'.','');?></strong></td>
          
           </tr>
           </table>
    </div>
    
    <div class="col-sm-5">
    <h3 align="center">DRIVER AMOUNT</h3>
    <table class="tbl table table-bordered ">
           <tr>
           
           
           </tr>
           <?php
		   $sql_bata=mysqli_query($connect,"select sum(driver_amount) as tamount from second_transaction where status='' and  date='$date' ");
		   $tbata=0;
		   
		   while($row_bata=mysqli_fetch_array($sql_bata))
			 {
		   ?>
           <tr>
		   <td class="table-Success"><strong>Total Driver Bata</strong></td>
           <td class="table-danger" align="right"><strong><?php echo number_format($row_bata['tamount'],2,'.','');?></strong></td>
		  
          
           </tr>
           <?php
		  // $tload+=$row_product['pcount'];
		   
		   }
		   ?>
           
           </table>
    </div>
    
    </div>
    
    <!--<div class="row">
<div class="col-sm-5"> <?php include "chartsphp/flowchart.php" ?> </div>
<div class="col-sm-1"></div>
<div class="col-sm-5"> <?php include "chartsphp/monthlyproduct.php" ?> </div>
    </div>-->

</div></div>


</body>
</html>
