<!DOCTYPE html>
<html lang="en">

<head>
    
 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
     <link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.7.1/css/buttons.dataTables.min.css">
     
    <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.print.min.js"></script>

</head>
<body>


                              <table  id="example" class="table table-striped table-bordered"  style="min-width: 1100px;font-size: 11px;">
                                        <thead>
                                            <tr>
                                                <th>Shift</th>
                                                <th>Operator</th>
                                                <th>Machine</th>
                                                <th>Material</th>
                                                <th>Product</th>
                                                <th>Job</th>
                                                <th>W.Weight</th>
                                                <th>M.Material</th>
                                                <th>TP Weight</th> 
                                                <th>Hrs</th>
                                                <th>Cost</th>
                                                <th>Date/Time</th>
                                               
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                                $total_weight = 0;
                                                $m_weight = 0;
                                                $tp_weight = 0;
                                                $hrs = 0;
                                                $cost = 0;
                                             if(!empty($get_summary_reort)){?>
                                            <?php foreach ($get_summary_reort as $value) { ?>
                                            <tr>
                                                <td><?php if(qc_machine_id($value['qc_machine_id'])==1){ ?>
                                                 <img src="<?php echo base_url(); ?>/assets/image/day.png" style="width: 45px;border-radius: 23px;">  
                                             <?php }else if(qc_machine_id($value['qc_machine_id'])==2){ ?>

                                                  <img src="<?php echo base_url(); ?>/assets/image/night.png" style="width: 45px;border-radius: 23px;"> 
                                                  <?php } ?></td>
                                                <td><?php echo fullname($value['emp_id']); ?></td>
                                                <td><?php echo machine_name(@$value['machine_id']); ?></td>
                                                <td><?php echo material_name($value['material_id']); ?></td>
                                                <td><?php echo product_name($value['product_id']); ?></td>
                                                <td><?php echo $value['job']; ?></td>
                                                <td><?php echo $aa = $value['w_weight']; ?></td>
                                                <td><?php echo $value['m_weight']; ?></td>
                                                <td><?php echo $value['tp_weight']; ?></td>
                                                <td><?php echo $value['hrs']; ?></td>
                                                <td><?php echo $value['cost']; ?></td>
                                                <td><?php echo $value['created']; ?></td>
                                            </tr>
                                           <?php
                                                @$total_weight += $value['w_weight'];
                                                @$m_weight += $value['m_weight'];
                                                @$tp_weight += $value['tp_weight'];
                                                @$hrs += $value['hrs'];
                                                @$cost += $value['cost'];
                                            } ?>
                                           
                                           
                                        </tbody>
                                    </table>

                                    <table id="example" border="1" style="min-width: 745px;">
                                        <tr>
                                            <th style="background-color: #D3D3D3;text-align:center;">Total W.Weight</th>
                                            <th style="background-color: #D3D3D3;text-align:center;">Total M.Weight</th>
                                            <th style="background-color: #D3D3D3;text-align:center;">Total TP.Weight</th>
                                            <th style="background-color: #D3D3D3;text-align:center;">Total Hrs</th>
                                            <th style="background-color: #D3D3D3;text-align:center;">Total Cost</th>
                                        </tr>

                                    <tr>
                                               
                                                <td style="text-align:center;"><?php  echo $total_weight; ?></td>
                                                <td style="text-align:center;"><?php echo $m_weight; ?></td>
                                                <td style="text-align:center;"><?php echo $tp_weight; ?></td>
                                                <td style="text-align:center;"><?php echo $hrs; ?></td>
                                                <td style="text-align:center;"><?php echo $cost; ?></td>

                                            </tr>
                                        </table>

                                            <?php } ?>
                                
<script type="text/javascript">
    
    $(document).ready(function() {
    $('#example').DataTable( {

        dom: 'Bfrtip',
        buttons: [{
    extend: 'print',
     title:'<div style="text-align:center;"><h2>Rizwan Associates</h2></div><div style="text-align:center;font-size:15px;"><br />Machine Summary Report</div>'
   
  },
{
    extend: 'pdf',
    title: 'Machine Report'
  },
  ]
    } );

} );
</script>