<?php 
session_start();
ob_start(); 
include "header.php";
//$objIms->Semifinisheditem_alter();
?>
<script type="text/javascript">

window.addEventListener("keyup", function(e){ if(e.keyCode == 27) history.back(); }, false);

</script>
<style type="text/css">
    
        tr:hover {background-color:#bcd1cd;}

</style>
      <div class="page-wrapper">
            <!-- Container fluid  -->
            <div class="container-fluid">
                <!-- Start Page Content -->
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body" id="printableArea">
 

<form method="post">
        <div class="panel" >
            <div class="panel-heading" style="font-style: bold"><h3>Group Summary</h3> </div>
                <p>&nbsp;</p>
                
                    <table width="100%" class="table table-bordered">
                     <tr height="32" align="left">
                        <th nowrap="nowrap" width="17%" rowspan="2">Date</th>
                        <th nowrap="nowrap" width="50%" rowspan="2">Particular</th>
                        <th nowrap="nowrap" width="17%" colspan="2" style="text-align: center;">Closing Balance</th>
                    </tr>
                    <tr>
                        
                        <th nowrap="nowrap" width="18%" colspan="1">Debit(Amount)</th>
                        <th nowrap="nowrap" width="50%" colspan="1">Credit(Amount)</th>
                    </tr>
<?php 



// here sum of all purchased item that are purchaed through supplier
 $sql_tri = "SELECT * FROM tbl_account WHERE sales_type='Purchase' and session_login_id = '".$_SESSION['login_id']."'";

$res_tri = mysql_query($sql_tri);
while($row = mysql_fetch_assoc($res_tri)){
$cash3 = $row["Dr_Amt"];
$purchase_mas_id=$row["mas_id"];
$trans_date = $row["trans_date"];
$date= date("d-m-Y",$trans_date);


 $sql_supplier="SELECT  * from view_pur_masdet where session_login_id = '".$_SESSION['login_id']."' and purmas_id='$purchase_mas_id' group by supplier_name";
    $res_supplier=mysql_query($sql_supplier);
    $rows=mysql_fetch_assoc($res_supplier);
    $name=$rows["supplier_name"]; 

?>
                    <tr height="32">
                        <td nowrap="nowrap" width="6%"><?php echo $date; ?></td>
                        <td nowrap="nowrap" width="6%"><?php echo $name; ?></td>
                        <td nowrap="nowrap" width="6%"><?php echo $cash3; $tot+=$cash3; ?></td>
                        <td nowrap="nowrap" width="6%"></td>
                    </tr>


<?php } ?>

</table>
<br><br><br><br>
            <table class="table">
                    <tr height="32">
                        <td nowrap="nowrap" width="10%" style="font-weight: bold">Grand Total</td>
                        <td nowrap="nowrap" width="6%"></td>
                        <td nowrap="nowrap" width="1%"><?php echo $tot; ?></td>
                        <td nowrap="nowrap" width="6%"></td>
                    </tr>
                </table>
</div>
</form>
                                         </div>
                        </div>
                    </div>
                </div>
                <!-- End PAge Content -->
            </div>
            <!-- End Container fluid  -->
      </div>
      
      </div>
 <?php include 'footer.php' ?>
 <script src="../js/lib/datatables/datatables.min.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/buttons.flash.min.js"></script>
    <script src="../js/lib/datatables/cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
    <script src="../js/lib/datatables/cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
    <script src="../js/lib/datatables/cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/buttons.html5.min.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/buttons.print.min.js"></script>
    <script src="../js/lib/datatables/datatables-init.js"></script>