<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->
<style>
.item_table td{
  padding: .75rem !important;
}
.item_table th{
  white-space: nowrap;
  padding: .75rem !important;
}
.table thead th {
  border-top: 2px solid #f4f5f8 !important;
}
.payment-table tbody td{
  border-top: 2px solid #f4f5f8 !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%;
}
@media print
{
  #print, .print_hide_div
  {
    display: none !important;
  }
}
@media print {
  html, body, div, span, applet, object, iframe, td, tr, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
    font-size: 15pt !important;  }
    h1.entry-title {
      font-size: 15pt !important;
    }
  }
  @media print { tr.bg_S { background-color: rgb(224, 224, 224) !important; -webkit-print-color-adjust: exact; } } @media print { .bg_S th { background-color: rgb(224, 224, 224) !important; } }
  @media print { tr.bg_H { background-color: rgb(224, 224, 224) !important; -webkit-print-color-adjust: exact; } } @media print { .bg_H th { background-color: rgb(224, 224, 224) !important; } }
  @media print { tr.bg_L { background-color: #7f7f7f !important; -webkit-print-color-adjust: exact; } } @media print { .bg_L th { background-color: #7f7f7f !important; } }
  @media print { tr.bg_N { background-color: rgba(94, 94, 94, 0.52) !important; -webkit-print-color-adjust: exact; } } @media print { .bg_N th { background-color: rgba(94, 94, 94, 0.52) !important; } }

  .quotation { font-family:calibri; font-size:15px; text-align:left; font-style:normal; height:60px; text-align:justify; line-height:26px;}
  @font-face {
    font-family: calibri;
    src: url(calibri.ttf);
  }
  form div {
    font-family: calibri;
  }
</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">
          Work Order
        </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().'work_order' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Work Order
              </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">Work Order -  <a href="javascript:;">#<?php echo $order_data->order_id ?></a></h3>
          </div>
        </div>
        <div class="m-portlet__head-tools" >
          <a style="margin-left: 5px;margin-right: 5px" href="<?php echo base_url()."work_order/edit/".$order_data->order_id ?>" class="btn m-btn--gradient-from-info m-btn--gradient-to-success  m-btn  m-btn--icon m-btn--air m-btn--pill">
            <span>
              <i class="la la-edit"></i>
              <span>
                Edit Work Order
              </span>
            </span>
          </a>
          <a style="margin-left: 5px;margin-right: 5px" id="btn_print_work_order" 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 Work Order
              </span>
            </span>
          </a>
        </div>
      </div>

      <div class="m-portlet__body m-portlet__body--no-padding">
        <form autocomplete="off" id="form_work_order_add" data-form-type="invoice_create" method="post" action="<?php echo base_url()?>invoices/update" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
          <div class="row">

          </div>
          <table width="100%" border="0" style="font-weight:600">
            <tr>
              <td><img style="max-width:100%" src="<?php echo base_url()."uploads/quotation_workorder/work_order_header_1.jpg"?>" border="0" /></td>
            </tr>
            <tr>
              <td>
                <table width="85%" border="0" align="center" >
                  <tr>
                    <td colspan="4" align="center" valign="baseline"><span style="font-size:28px;">WORK ORDER</span></td>
                  </tr>
                  <tr>
                    <td width="19%">Customer Name </td>
                    <td width="1%">:</td>
                    <td width="23%">Mr. <?php echo $order_data->customer_name ?></td>
                    <td colspan="3" rowspan="5"><table width="100%" border="0">
                      <tr>
                        <td width="44%">Work Order Number</td>
                        <td width="4%">:</td>
                        <td width="52%">#<?php echo $order_data->order_id ?></td>
                      </tr>
                      <tr>
                        <td>Work Order Date</td>
                        <td>:</td>
                        <td><?php echo date('d-m-Y',strtotime($order_data->order_date)) ?></td>
                      </tr>
                      <tr>
                        <td>District</td>
                        <td>: </td>
                        <td><?php echo nl2br($order_data->customer_district) ?></td>
                      </tr>
                      <tr>
                        <td>Phone</td>
                        <td>: </td>
                        <td><?php echo nl2br($order_data->customer_phone) ?></td>
                      </tr>
                      <tr>
                        <td>Email</td>
                        <td>: </td>
                        <td><?php echo nl2br($order_data->customer_email) ?></td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td>Address</td>
                    <td>: </td>
                    <td><?php echo nl2br($order_data->customer_address) ?></td>
                  </tr>
                  <tr>
                    <td>PIN</td>
                    <td>: </td>
                    <td><?php echo nl2br($order_data->customer_pin) ?></td>
                  </tr>
                  <tr>
                    <td>GST No</td>
                    <td>: </td>
                    <td><?php echo nl2br($order_data->customer_taxno) ?></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td colspan="3">&nbsp;</td>
                  </tr>

                  <tr>
                    <td colspan="7" align="center" valign="middle">&nbsp;</td>
                  </tr>
                  <tr>
                    <td  colspan="7" align="center" valign="middle"><table  bordercolor="#000000" width="100%" border="0" cellpadding="0" cellspacing="1">
                      <tr style="border: 1px solid black;" >
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="8%" align="center" valign="middle" bgcolor="#666666">No<br/></td>
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="15%" align="center" valign="middle" bgcolor="#666666">Item Code</td>
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="18%" align="center" valign="middle" bgcolor="#666666">Size</td>
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="14%" align="center" valign="middle" bgcolor="#666666">Type</td>
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="15%" align="center" valign="middle" bgcolor="#666666">Qty</td>
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="16%" align="center" valign="middle" bgcolor="#666666">Rate</td>
                        <td style="padding: 10px;color:#FFF;border:1px solid #666666 !important" width="19%" align="center" valign="middle" bgcolor="#666666">Amount</td>
                      </tr>
                      <?php foreach ($items_data as $key => $value) { ?>
                        <tr style="border:1px solid #666666 !important">
                          <td style="border:1px solid #666666 !important" height="40" align="center" valign="middle">&nbsp;<?php echo $key+1 ?></td>
                          <td  style="border:1px solid #666666 !important" align="center" valign="middle">&nbsp;<?php echo $value->item_code ?></td>
                          <td  style="border:1px solid #666666 !important" align="center" valign="middle">&nbsp;<?php echo $value->size ?></td>
                          <td  style="border:1px solid #666666 !important" align="center" valign="middle">&nbsp;<?php echo $value->type ?></td>
                          <td  style="border:1px solid #666666 !important" align="center" valign="middle">&nbsp;<?php echo $this->config->item('currency_format')->formatCurrency($value->quantity,$this->config->item('Currency_currency_shortname')) ?></td>
                          <td  style="border:1px solid #666666 !important" align="center" valign="middle">&nbsp;<?php echo $this->config->item('currency_format')->formatCurrency($value->unit_price,$this->config->item('Currency_currency_shortname')) ?></td>
                          <td  style="border:1px solid #666666 !important" align="center" valign="middle">&nbsp;<?php echo $this->config->item('currency_format')->formatCurrency($value->total_price,$this->config->item('Currency_currency_shortname')) ?></td>
                        </tr>
                      <?php } ?>
                      <tr style="border:1px solid #666666 !important">
                        <td style="border:1px solid #666666 !important" height="40" align="center" valign="middle">&nbsp;</td>
                        <td style="border:1px solid #666666 !important" align="center" valign="middle" >&nbsp;</td>
                        <td style="border:1px solid #666666 !important"  align="center" valign="middle" >&nbsp;</td>
                        <td style="border:1px solid #666666 !important"  align="center" valign="middle" >&nbsp;</td>
                        <td style="border:1px solid #666666 !important" align="center" valign="middle" >&nbsp;</td>
                        <td style="border:1px solid #666666 !important"  align="center" valign="middle" >&nbsp;</td>
                        <td style="border:1px solid #666666 !important" align="center" valign="middle" >&nbsp;</td>
                      </tr>
                      <tr style="border:1px solid #666666 !important">
                        <td style="border:1px solid #666666 !important;" height="40" colspan="3" align="center" valign="middle" style="" >Amount in Words: <br/><?php echo ucwords(getIndianCurrency($order_data->total_order_amount));?></td>
                        <td style="border:1px solid #666666 !important;" colspan="4">
                          <table style="width:100%">
                            <tr>
                              <td height="40" style="border:1px solid #666666 !important;text-align:center">Total</td>
                              <td height="40" style="border:1px solid #666666 !important;text-align:right;padding-right:10px"><?php echo $this->config->item('currency_format')->formatCurrency($order_data->grand_total_amount,$this->config->item('Currency_currency_shortname')) ?></td>
                            </tr>
                            <tr>
                              <td height="40" style="border:1px solid #666666 !important;text-align:center">Discount</td>
                              <td height="40" style="border:1px solid #666666 !important;text-align:right;padding-right:10px"><?php echo $this->config->item('currency_format')->formatCurrency($order_data->discount_amount,$this->config->item('Currency_currency_shortname')) ?></td>
                            </tr>
                            <tr>
                              <td height="40" style="border:1px solid #666666 !important;text-align:center">Grand Total</td>
                              <td height="40" style="border:1px solid #666666 !important;text-align:right;padding-right:10px"><?php echo $this->config->item('currency_format')->formatCurrency($order_data->total_order_amount,$this->config->item('Currency_currency_shortname')) ?></td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                    <table style="width:100%;margin-top:20px">
                      <tr>
                        <td>Executive Name:<br/><?php echo $order_data->site_coordinator ?></td>
                        <td style="text-align:right">Customer Sign:</td>
                      </tr>
                    </table>
                  </td>
                </tr>

                <tr>
                  <td colspan="6" align="center" valign="middle">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="6" align="center" valign="middle">&nbsp;</td>
                </tr>
              </table>

            </td>
          </tr>
        </table>
      </form>
    </div>
  </div>
</div>
</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 -->
<script>

$("#work_order_menu").addClass('m-menu__item--active m-menu__item--open');
$("#work_order_menu_2").addClass('m-menu__item--active');
$("#page_title").text("Work Order - #<?php echo $order_data->order_id.' ['.$order_data->customer_name.']'?>");

$('#btn_print_work_order').click(function(e){
  var order_id = "<?php echo $order_data->order_id?>";
  myWindow = window.open('<?php echo base_url().'work_order/profile/print/'?>'+order_id,'newwindow','width=1200,height=700');
  myWindow.document.close();
  myWindow.focus();
  myWindow.print();
});

</script>
<script>

$(".form_submit_btn_4").click(function (e) {

  e.preventDefault();
  var a = $(this),
  l = $(this).closest("form"),
  action = l.attr('action');
  var form_id = l.attr('id');
  l.validate({
    rules: {
      "new_paid_amount": {
        required: !0,
        number: !0
      }
    }, invalidHandler: function (e, r) {
      var i = $("#" + form_id + "_msg");
      i.removeClass("m--hide").show(), mUtil.scrollTo(i, -200)
    }, submitHandler: function (e) {
    }
  }), l.valid() && (a.addClass("m-loader m-loader--right m-loader--light").attr("disabled", !0),
  l.ajaxSubmit({
    url: action,
    success: function (e, t, r, s) {
      var modal_id = l.attr('data-modal-id');
      var form_type = l.attr('data-form-type');
      $("#" + form_id + "_msg").addClass("m--hide");
      // Block UI
      mApp.blockPage({
        overlayColor: "#000000",
        type: "loader",
        state: "success",
        message: "Please wait..."
      }), setTimeout(function () {
        mApp.unblockPage()
      }, 2e3);
      var obj = $.parseJSON(e);
      if (obj.status == 1) {
        a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
        toastr[obj.flashdata_type](obj.flashdata_msg, obj.flashdata_title);
        $("#"+modal_id).modal('toggle');
        $("."+form_id+"_fields").val("");
        location.reload();
      } else {
        a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
        toastr[obj.flashdata_type](obj.flashdata_msg, obj.flashdata_title);
      }
      if (obj == null) {
        setTimeout(function () {
          a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
          toastr["warning"]("Your Attempt is Timed Out. Please Try Again.", "Timed Out");
        }, 2e4)
      }
    },error: function() {
      a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
      toastr["error"]("Sorry. There Has Been Some Error Occurred. Please Try Again.", "Error");
    }
  })
)
});

</script>
