<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->
<style>
.m-invoice-2 .m-invoice__wrapper .m-invoice__body table thead tr th {
  color: #000000;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__body table tbody tr td {
  color: #404040;
}
.item_table td{
  padding: .75rem !important;
}
.item_table th{
  white-space: nowrap;
  padding: .75rem !important;
}
.table thead th {
  border-top: 2px solid #b7b7b7 !important;
}
.table thead th {
  border: 2px solid #b7b7b7;
}
.table tbody td {
  border: 2px solid #b7b7b7;
}
.payment-table tbody td{
  border-top: 2px solid #b7b7b7 !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
  width: 90%;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__body.m-invoice__body--centered {
  width: 90%;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
  width: 90%;
}
</style>


<style>

@media print {

  .table-bordered td{
    padding: .75rem !important;
  }
  .table-bordered th{
    white-space: nowrap;
    padding: .75rem !important;
  }
  .table-bordered .table thead th {
    border-top: 2px solid #f4f5f8 !important;
  }
  .m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
    width: 97%;
  }
  .m-invoice-2 .m-invoice__wrapper .m-invoice__body.m-invoice__body--centered {
    width: 97%;
  }
  .m-invoice-2 .m-invoice__wrapper .m-invoice__body.m-invoice__body--centered {
    margin-left: 10px !important;
  }

  #print_view {
    margin-top: -20%;
  }
  #print, .print_hide_div
  {
    display: none !important;
  }
  body * {
    visibility: hidden;
  }
  .m-portlet__body * {
    visibility: visible;
    overflow: visible !important;
  }
  .letter_head_img{
    display: block !important;
  }
  body.m-content--skin-light2 {
    background-color: white !important;
  }
  .m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
    width: 97% !important;
  }
  .m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container .m-invoice__items .m-invoice__item {
    display: table-cell;
}
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container .m-invoice__items .m-invoice__item {
  display: table-cell !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%;
}
</style>
<?php $this->view("includes/Inc_navigation");?>
<div class="m-grid__item m-grid__item--fluid m-wrapper">
  <!-- BEGIN: Subheader -->
  <div class="m-subheader ">
    <div class="d-flex align-items-center">
      <div class="mr-auto">
        <h3 class="m-subheader__title m-subheader__title--separator">
          Material Issue Bill
        </h3>
        <ul class="m-subheader__breadcrumbs m-nav m-nav--inline">
          <li class="m-nav__item m-nav__item--home">
            <a href="#" class="m-nav__link m-nav__link--icon">
              <i class="m-nav__link-icon la la-home"></i>
            </a>
          </li>
          <li class="m-nav__separator">
            -
          </li>
          <li class="m-nav__item">
            <a href="<?php echo base_url().'dashboard'?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Home
              </span>
            </a>
          </li>
          <li class="m-nav__separator">
            -
          </li>
          <li class="m-nav__item">
            <a href="<?php echo base_url().'subcontracts/material_issue' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Material Issue Bill
              </span>
            </a>
          </li>


        </ul>
      </div>
      <div>

      </div>
    </div>
  </div>
  <!-- END: Subheader -->
  <div class="m-content">
    <div class="m-portlet m-portlet--full-height">
      <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
          <div class="m-portlet__head-title">
            <h3 class="m-portlet__head-text">

            </h3>
          </div>
        </div>
        <div class="m-portlet__head-tools" >
          <a style="margin-left: 5px;margin-right: 5px" href="<?php echo base_url()?>subcontracts/material_issue/edit/<?php echo $bill_data->bill_id?>"  class="btn m-btn--gradient-from-focus m-btn--gradient-to-warning  m-btn  m-btn--icon m-btn--air m-btn--pill">
            <span>
              <i class="la la-trash"></i>
              <span>
                Edit Bill
              </span>
            </span>
          </a>
          <a style="margin-left: 5px;margin-right: 5px" id="material_issue_bill_delete_btn" href="#material_issue_bill_delete_modal" data-toggle="modal" class="btn m-btn--gradient-from-danger m-btn--gradient-to-info  m-btn  m-btn--icon m-btn--air m-btn--pill">
            <span>
              <i class="la la-trash"></i>
              <span>
                Delete Bill
              </span>
            </span>
          </a>
          <a style="margin-left: 5px;margin-right: 5px"id="btn_print" onclick="window.print()"class="btn m-btn--gradient-from-warning m-btn--gradient-to-danger  m-btn  m-btn--icon m-btn--air m-btn--pill">
            <span>
              <i class="la la-print"></i>
              <span>
                Print
              </span>
            </span>
          </a>
        </div>
      </div>
      <div class="m-portlet__body m-portlet__body--no-padding" id="print_view">
        <?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="m-invoice__logo" style="padding-top: 3rem;">
                  <a href="#">

                  </a>
                </div>
                <div class="row">
                  <div class="col-md-12">
                    <div class="m-invoice__logo" style="padding-top: 0px;">
                      <a href="#" style="text-align:center">
                        <h2>MATERIAL ISSUE/SUPPLY CHALLAN</h2>
                        </a>
                      </div>
                    </div>
                  </div>
                  <div class="m-invoice__items" style="padding: 2rem 0 3rem 0;">
                    <div class="m-invoice__item">
                      <span class="m-invoice__subtitle">CHALLAN NO </span>
                      <span class="m-invoice__text"><strong>#<?php echo $bill_data->bill_id?></strong>
                      </div>
                      <div class="m-invoice__item">
                        <span class="m-invoice__subtitle">PROJECT </span>
                        <span class="m-invoice__text"><strong><?php echo $bill_data->from_loc_name?><br/>
                          <?php if($bill_data->from_work_id!=0){ echo $bill_data->from_loc_address;} ?></strong></span>
                        </div>
                        <div class="m-invoice__item">
                          <span class="m-invoice__subtitle">SUBCONTRACTOR </span>
                          <span class="m-invoice__text"><strong>#<?php echo $bill_data->contractor_id?> - <?php echo $bill_data->contractor_name?>
                            <?php if($bill_data->contractor_phone!=''){ echo "<br/>Phone: ".$bill_data->contractor_phone;}?><?php if($bill_data->contractor_address!=''){ echo "<br/>".$bill_data->contractor_address;}?><br/>Contract ID: #<?php echo $bill_data->subcontract_id?></strong></span>
                          </div>
                        <div class="m-invoice__item" style="text-align:right">
                          <span class="m-invoice__subtitle">ISSUE DATE</span>
                          <span class="m-invoice__text"><strong><?php echo date('d-m-Y',strtotime($bill_data->bill_date))?></strong></span>
                        </div>
                      </div>
                      <div class="m-invoice__items" style="padding: 2rem 0 3rem 0;">

                        <div class="m-invoice__item" style="">
                          <span class="m-invoice__subtitle">SUPERVISOR</span>
                          <span class="m-invoice__text"><strong><?php echo $bill_data->supervisor_name?><?php  echo "<br/>Phone: ".$bill_data->supervisor_phone;?></strong></span>
                        </div>
                        <div class="m-invoice__item" >
                          <span class="m-invoice__subtitle">Vehicle No</span>
                          <span class="m-invoice__text"><strong><?php echo $bill_data->vehicle_no?></strong></span>
                        </div>
                        <div class="m-invoice__item" >
                          <span class="m-invoice__subtitle">Driver Phone</span>
                          <span class="m-invoice__text"><strong><?php echo $bill_data->vehicle_driver_phone?></strong></span>
                        </div>
                        <div class="m-invoice__item" style="text-align: right">
                          <span class="m-invoice__subtitle">Remarks</span>
                          <span class="m-invoice__text"><strong><?php echo $bill_data->bill_remarks?></strong></span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="m-invoice__body m-invoice__body--centered" style="min-height: 200px">
                    <div class="table-responsive">
                      <table class="table m-table table-bordered item_table">
                        <thead>
                          <tr>
                            <th>Sl No</th>
                            <th style="text-align: left">Material Description</th>
                            <th style="text-align: left">Make & Spec</th>
                            <th style="text-align: left">Qty</th>
                            <th style="text-align: left">Unit</th>
                            <th style="text-align: left">Remarks</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php
                          $n = 1;
                          foreach($bill_items as $row):
                            ?>
                            <tr>
                              <td><?php echo $n++?></td>
                              <td style="text-align: left"><?php echo $row->material_name?></td>
                              <td style="text-align: left"><?php echo $row->make_spec?></td>
                              <td style="text-align: left"><?php echo $row->quantity?></td>
                              <td style="text-align: left"><?php echo $row->unit_name?></td>
                              <td style="text-align: left"><?php echo $row->item_remarks?></td>
                            </tr>
                            <?php
                          endforeach;
                          ?>
                        </tbody>
                      </table>
                    </div>
                  </div>
                  <div class="row" style="padding-left:50px">
                    <div class="col-md-6 col-sm-6 col-xs-6">
                      The above materials are received in good condition
                      <br/>Signature of Subcontractor
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          </div>
        </div>
      </div>
      <div class="modal fade" tabindex="-1" id="material_issue_bill_delete_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog " role="document" >
          <form autocomplete="off" data-modal-id="material_issue_bill_delete_modal" method="post" action="<?php echo base_url().'subcontracts/delete_material_issue/redirect'?>" class="form-horizontal">
            <div class="modal-content">
              <div class="alert alert-danger" role="alert" style="margin-bottom: 0px">
                <button type="button" class="close" data-dismiss="modal"></button>
                <br/>
                <h4 class="alert-heading">Warning! Please Confirm Your Action</h4>
                <br/>
                <p> Are You Sure to Delete this Data ?. All the Associated Data will Lost. </p>
                <p>
                  <button class="btn btn-danger form_submit_btn" type="submit" name="submit">Confirm & Delete</button>
                  <button type="button" class="btn btn-primary modal-dismiss" data-dismiss="modal">Cancel</button>
                </p>
                <input type="hidden" name="bill_id" value="<?php echo $bill_data->bill_id?>">
              </div>
            </div>
          </form>
        </div>
      </div>
      <!-- end:: Body -->
      <!-- begin::Footer -->
      <?php $this->view("includes/Inc_footer");?>
      <!-- end::Footer -->

      <!-- end:: Page -->
      <?php $this->view("includes/Inc_sidebar");?>
      <?php $this->view("includes/Inc_scripts");?>
      <!--begin::Page Snippets -->
      <?php $this->view("modules/include_scripts/bill_scripts");?>


      <script>
      //    Toggle Sidebar
      // $("#m_aside_left_minimize_toggle").addClass("m-brand__toggler--active");
      // $("#body").addClass("m-brand--minimize m-aside-left--minimize");

      $("#subcontract_menu").addClass('m-menu__item--active m-menu__item--open');
      $("#subcontract_menu_6").addClass('m-menu__item--active');

      </script>

      <script>

      </script>
