<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title></title>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js"></script>
<script>
WebFont.load({
  google: {"families":["Poppins:300,400,500,600,700","Roboto:300,400,500,600,700"]},
  active: function() {
    sessionStorage.fonts = true;
  }
});
</script>
<style>
.table-bordered th, .table-bordered td {
  border: 1px solid #858585 !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__body table thead tr th {
  color: #000000 !important;
}
.table thead th {
  border-top: 2px solid #858585 !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__body table tbody tr td {
  color: #000000 !important;
}
.table thead th {
  vertical-align: bottom !important;
  border-bottom: 2px solid #858585 !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container .m-invoice__items .m-invoice__item {
  display: table-cell !important;
}
.item_table td{
  padding: .75rem !important;
}
.item_table th{
  white-space: nowrap;
  padding: .75rem !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
  width: 100% !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__body.m-invoice__body--centered {
  width: 100% !important;
}
@media print
{
  .no-print, .no-print *
  {
    display: none !important;
  }
  .col-sm-4 {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 33.33333%;
    flex: 0 0 33.33333%;
    max-width: 33.33333%;
  }
  .col-sm-8 {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 66.66667%;
    flex: 0 0 66.66667%;
    max-width: 66.66667%;
  }
  @page {
    size: auto !important;
  }
}
</style>
<body>
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
  <!--end::Web font -->
  <!--begin::Base Styles -->
  <link href="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/base/vendors.bundle.css" rel="stylesheet" type="text/css" />
  <link href="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/demo/default/base/style.bundle.css" rel="stylesheet" type="text/css" />
  <!--end::Base Styles -->
  <!--<link rel="shortcut icon" href="<?php //echo base_url()?>template/assets/app/media/img/logos/logo.png" style="width: 50px;"/>-->

  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.20/b-1.6.1/b-colvis-1.6.1/b-flash-1.6.1/b-html5-1.6.1/b-print-1.6.1/fc-3.3.0/fh-3.1.6/kt-2.5.1/r-2.2.3/rg-1.1.1/sc-2.0.1/sp-1.0.1/datatables.min.css"/>

  <body>
    <div class="m-portlet m-portlet--full-height">
      <div class="m-portlet__body m-portlet__body--no-padding">
        <?php if($this->config->item('company_letter_head')!=''){ ?>
          <img style="max-width: 1000px" src="<?php echo base_url().'uploads/company/'.$this->config->item('company_letter_head')?>" />
        <?php } ?>
        <div class="m-invoice-2" style="padding-bottom: 20px">
          <div  class="m-invoice__wrapper">
            <div class="m-invoice__head" >
              <div class="m-invoice__container m-invoice__container--centered">
                <div class="row">
                  <div class="col-md-12">
                    <div class="m-invoice__logo" style="padding-top: 0px;">
                      <a href="#" style="text-align: center;">
                        <h2>DAILY PROJECT REPORT SUMMARY (<?php  echo strtoupper($project_data->project_section); ?>) </h2>
                      </a>
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-12 col-sm-12">
                    <table class="table m-table table-bordered item_table" style="margin-bottom:0px !important">
                      <thead>
                        <tr>
                          <th><strong>Project Name</strong></th>
                          <th><strong>#<?php echo $project_data->work_id." ".$project_data->work_name ?><br/><?php echo $project_data->work_location ?></strong></th>
                        </tr>
                      </thead>
                    </table>
                  </div>
                </div>
              </div>
            </div>
            <?php
            $common_consumable_material = 0;
            foreach ($stock_materials as $key22 => $value22) {
              $value22->total_qty_used = 0;
              if($value22->consumable_type=='common'){
                $common_consumable_material++;
              }
            }
            ?>
            <div class="m-invoice__body m-invoice__body--centered" style="min-height: 50px">
              <div class="table-responsive">
                <table class="table m-table table-bordered item_table" style="margin-bottom:0px !important">
                  <thead>
                    <tr>
                      <th style="text-align:center;font-weight:700">MEASUREMENT DETAILS</th>
                    </tr>
                  </thead>
                </table>
                <table class="table m-table table-bordered item_table">
                  <thead>
                    <tr>
                      <th style="width:5%;text-align:left;color:white" rowspan="2">Sl No</th>
                      <!-- <th style="width:10%;text-align:left;color:white" rowspan="2">Date</th> -->
                      <?php if($project_data->project_section=='Road Marking'){?>
                        <th style="width:25%;text-align:left;color:white" rowspan="2">Details</th>
                      <?php }elseif($project_data->project_section=='Sign Boards'){?>
                        <th style="width:10%;text-align:left;color:white" rowspan="2">Location</th>
                      <?php }else{?>
                        <th style="text-align:center;border:white 1px solid;color:white" colspan="2">Chainage</th>
                      <?php } ?>
                      <?php if($project_data->project_section=='Sign Boards'){?>
                        <th style="width:15%;text-align:left;color:white" rowspan="2">Board</th>
                      <?php } ?>
                      <th style="width:10%;text-align:left;color:white" rowspan="2">Side</th>
                      <?php if($project_data->project_section=='Road Marking' || $project_data->project_section=='Sign Boards'){?>
                        <th style="text-align:left;color:white" rowspan="2">No</th>
                      <?php } ?>
                      <?php if($project_data->project_section=='Road Studs'){?>
                        <th style="text-align:left;color:white" rowspan="2">Spacing</th>
                      <?php }elseif($project_data->project_section=='Crash Barriers' || $project_data->project_section=='Road Marking'){?>
                        <th style="text-align:left;color:white" rowspan="2">Length (Mtr)</th>
                      <?php } ?>
                      <?php if($project_data->project_section=='Road Marking'){?>
                        <th style="text-align:left;color:white" rowspan="2">Width (Mtr)</th>
                      <?php } ?>
                      <?php if($project_data->project_section=='Road Marking'){?>
                        <th style="text-align:left;color:white" rowspan="2">Total (SQMtr)</th>
                      <?php } ?>
                      <?php if(sizeof($stock_materials)>0 && $project_data->project_section!='Road Marking'){ ?>
                        <th style="text-align:center;border:white 1px solid;color:white" colspan="<?php echo sizeof($stock_materials)-$common_consumable_material?>">Material Usage</th>
                      <?php } ?>
                      <?php if($project_data->project_section=='Sign Boards'){?>
                        <th style="text-align:left;color:white" rowspan="2">Ref No</th>
                      <?php } ?>
                      <th style="text-align:left;color:white" rowspan="2">Remarks</th>
                    </tr>
                    <?php if($project_data->project_section!='Road Marking'){?>
                      <tr>
                        <?php if($project_data->project_section!='Sign Boards'){?>
                          <th style="text-align:left;color:white">From</th>
                          <th style="text-align:left;color:white">To</th>
                        <?php } ?>
                        <?php foreach ($stock_materials as $key => $value) {
                          if($value->consumable_type!='common'){?>
                            <th style="text-align:left;color:white" rowspan="2"><?php echo $value->material_name?></th>
                          <?php }
                        } ?>
                      </tr>
                    <?php } ?>
                  </thead>
                  <tbody>
                    <?php
                    $total_chainage = 0;
                    $total_colspan = 5;
                    if($project_data->project_section=='Sign Boards'){
                      $total_colspan = 5;
                    }elseif($project_data->project_section=='Road Marking'){
                      $total_colspan = 6;
                    }elseif($project_data->project_section=='Road Studs'){
                      $total_colspan = 5;
                    }elseif($project_data->project_section=='Crash Barriers'){
                      $total_colspan = 5;
                    }
                    $slno=0;
                    foreach($dpr as $key66=>$value66){?>
                      <tr>
                        <td></td>
                        <td style="text-align:left" colspan="<?php echo $total_colspan+sizeof($stock_materials)-$common_consumable_material ?>"><strong><?php echo date('d-m-Y',strtotime($value66->work_date)) ?></strong></td>
                      </tr>
                      <?php
                      foreach($value66->dpr_items as $key=>$value){
                        $slno++
                        ?>
                        <tr>
                          <td><?php echo $slno ?></td>
                          <!-- <td style="width:10%;"><?php //echo date('d-m-Y',strtotime($value66->work_date)) ?></td> -->
                          <td style="text-align:left"><?php echo $value->chainage_from ?></td>
                          <?php if($project_data->project_section!='Road Marking' && $project_data->project_section!='Sign Boards'){?>
                            <td style="text-align:left"><?php echo $value->chainage_to ?></td>
                          <?php } ?>
                          <?php if($project_data->project_section=='Sign Boards'){?>
                            <td style="text-align:left"><?php echo $value->material_name ?></td>
                          <?php } ?>
                          <td style="text-align:left"><?php echo $value->side ?></td>
                          <?php if($project_data->project_section=='Road Marking' || $project_data->project_section=='Sign Boards'){?>
                            <td><?php echo number_format($value->quantity,$this->config->item('Currency_amount_decimals_2'), '.', '') ?></td>
                          <?php } ?>
                          <?php if($project_data->project_section!='Sign Boards'  && $project_data->project_section!='Road Marking'){?>
                            <td style="text-align:left"><?php echo $value->spacing ?></td>
                          <?php } ?>
                          <?php if($project_data->project_section=='Crash Barriers' || $project_data->project_section=='Road Marking'){?>
                            <td><?php echo number_format($value->chainage_length,$this->config->item('Currency_amount_decimals_2'), '.', '') ?></td>
                          <?php } ?>
                          <?php if($project_data->project_section=='Road Marking'){?>
                            <td><?php echo number_format($value->chainage_width,$this->config->item('Currency_amount_decimals_2'), '.', '') ?></td>
                            <td><?php echo number_format($value->chainage_total,$this->config->item('Currency_amount_decimals_2'), '.', '') ?></td>
                            <?php
                            $total_chainage += $value->chainage_total;
                          } ?>
                          <?php if($project_data->project_section!='Road Marking'){?>
                            <?php
                            $materials_details = $value->item_materials;
                            foreach ($stock_materials as $key22 => $value22) {
                              if($value22->consumable_type!='common'){
                                $material_qty_used = 0;
                                foreach ($materials_details as $key33 => $value33) {
                                  if($value22->material_id==$value33->material_id){
                                    $material_qty_used = $value33->quantity;
                                  }
                                }
                                $value22->total_qty_used += $material_qty_used;
                                echo "<td>".$material_qty_used."</td>";
                              }
                            }?>
                          <?php } ?>
                          <?php if($project_data->project_section=='Sign Boards'){?>
                            <td><?php echo $value->reference_no ?></td>
                          <?php } ?>
                          <td style="text-align:left"><?php echo $value->remarks ?></td>
                        </tr>
                        <?php
                      }
                    }
                    ?>
                    <tr>
                      <td colspan="<?php echo $total_colspan ?>"><strong>TOTAL</strong></td>
                      <?php if($project_data->project_section!='Road Marking'){?>
                        <?php
                        foreach ($stock_materials as $key22 => $value22) {
                          if($value22->consumable_type!='common'){
                            echo "<td><strong>".$value22->total_qty_used."</strong></td>";
                          }
                        } ?>
                      <?php }else{ ?>
                        <td><strong><?php echo number_format($total_chainage,$this->config->item('Currency_amount_decimals_2'), '.', '') ?></strong></td>
                      <?php } ?>
                      <td></td>
                      <?php if($project_data->project_section=='Sign Boards'){?>
                        <td></td>
                      <?php } ?>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </div>

          <script type="text/javascript">
          $("#page_title").text("DPR Summary #<?php echo $project_data->work_id." ".$project_data->work_name ?>");
          $(function() {
            window.print();
          });
          </script>

        </body>
        </html>
