<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="subcontract_bills_view_table">
  <thead>
    <tr class="">
      <th>Sl No</th>
      <th>Branch</th>
      <th>Bill ID</th>
      <th>Bill Date</th>
      <th>Project</th>
      <th>Subwork Name</th>
      <th>Work Type</th>
      <th>Contractor</th>
      <th>Bill No</th>
      <th>Consignee</th>
      <th>Gross Amount</th>
      <th><?php if($this->config->item('Tax_tax_splitting')==1){ echo "Total ";}?><?php echo $this->config->item('Tax_tax_name')?> %</th>
      <th><?php if($this->config->item('Tax_tax_splitting')==1){ echo "Total ";}?><?php echo $this->config->item('Tax_tax_name')?> Amt</th>
      <th><?php echo $this->config->item('Tax_tax1_name')?> %</th>
      <th><?php echo $this->config->item('Tax_tax1_name')?> Amt</th>
      <th><?php echo $this->config->item('Tax_tax2_name')?> %</th>
      <th><?php echo $this->config->item('Tax_tax2_name')?> Amt</th>
      <th><?php echo $this->config->item('Tax_tax3_name')?> %</th>
      <th><?php echo $this->config->item('Tax_tax3_name')?> Amt</th>
      <th>TDS</th>
      <th>Retention %</th>
      <th>Retention Amt</th>
      <th>Other Deductions</th>
      <th>Payable Amount</th>
      <th>Total Paid</th>
      <th>Balance</th>
      <th>Status</th>
      <th>Description</th>
      <th>Attachment</th>
      <th>No of Labours</th>
      <th>Remarks</th>
      <th>Created By</th>
      <th>Created Date</th>
      <th>Actions</th>
      <th>Bill ID</th>
      <th>Contract ID</th>
      <th>Attachment</th>
      <th>Tax Percent</th>
      <th>Approval Status</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
<div class="modal fade" tabindex="-1" id="subcontract_bill_edit_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog " role="document" style="max-width: 900px">
    <div class="modal-content">
      <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
        <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
          Edit Subcontract Bill
        </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">
            &times;
          </span>
        </button>
      </div>
      <!--                                                    ADD EXPENSE DATA start-->
      <form autocomplete="off" data-form-type="subcontract" id="form_subcontract_bill_edit" data-modal-id="subcontract_bill_edit_modal" method="post" action="<?php echo base_url().'bills/update'?>" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
        <div class="modal-body" style="padding-bottom: 0px">
          <div class="m-form__content">
            <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_subcontract_bill_edit_msg">
              <div class="m-alert__icon">
                <i class="la la-warning"></i>
              </div>
              <div class="m-alert__text">
                Oh snap! Change a few things up and try submitting again.
              </div>
              <div class="m-alert__close">
                <button type="button" class="close" data-close="alert" aria-label="Close"></button>
              </div>
            </div>
          </div>
          <div class="row" style="padding-bottom: 15px">
            <div class="col-lg-2" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Contract ID
                </label>
                <input readonly type="text" id="contract_id_bill_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields"  aria-describedby="basic-addon1">
              </div>
            </div>
            <div class="col-lg-10" >
              <div class="row">
                <div class="col-lg-4" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Project
                    </label>
                    <input readonly type="text" id="subcontract_bill_project_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields"  aria-describedby="basic-addon1">
                  </div>
                </div>
                <div class="col-lg-4" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Sub Work Name
                    </label>
                    <input readonly type="text" id="subwork_name_bill_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields"  aria-describedby="basic-addon1">
                  </div>
                </div>
                <div class="col-lg-4" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Sub Work Type
                    </label>
                    <div id="subwork_type_bill_edit" style="border: 1px dashed #ebedf2 !important;"></div>
                  </div>
                </div>
              </div>
            </div>

          </div>
          <div style="background: white;border: 4px solid #f7f7fa;padding: 0px;margin: 0px;padding-bottom: 0px">
            <div class="m-section" style="margin: 0px 0 10px 0;">
              <h3 class="m-section__heading" style="padding: 10px;margin: 0px">Bill Details</h3>

              <div class="row" >
                <div class="col-lg-4" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Bill No
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input type="text" name="bill_no" id="subcontract_bill_no_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields" placeholder="Bill No" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-3">
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Bill Date
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input required  data-date-format="dd-mm-yyyy" id="subcontract_bill_date_edit"  type="text" name="bill_date" class="form_subcontract_bill_edit_fields form-control m-input m-input--pill m-input--air " placeholder="Bill Date" >
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-calendar"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-5" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Bill Gross Amount
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input required type="text" name="bill_gross_amount"  id="subcontract_bill_gross_amount_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit" placeholder="Bill Gross Amount" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-lg-6" >
                  <div class="row">
                    <div class="col-lg-6" >
                      <div class="form-group m-form__group" >
                        <label for="user_name">
                          <?php echo $this->config->item('Tax_tax_name')?> %
                        </label>
                        <div class="m-select2 m-select2--air m-select2--pill ">
                          <select required id="subcontract_bill_tax_percent_edit" name="bill_tax_percent" style="width: 100%" class="form-control m-input form_subcontract_bill_edit_select form_subcontract_bill_amount_fields_edit subcontract_bill_edit_required_fields" aria-describedby="basic-addon1" data-placeholder="Select Tax Percentage">
                            <?php
                            $tax_percent = $this->config->item('Tax_tax_percent');
                            foreach($tax_percent as $row):
                              $selected_tax='';
                              if($row->tax_percentage==0){
                                $selected_tax='selected';
                              }
                              ?>
                              <option <?php echo $selected_tax?> data-tax-percent="<?php echo $row->tax_percentage?>" value="<?php echo $row->tax_id?>"><?php echo $row->tax_name?></option>
                              <?php
                            endforeach;
                            ?>
                          </select>
                        </div>
                        <span class="m-form__help"></span>
                      </div>
                    </div>
                    <div class="col-lg-6" >
                      <div class="form-group m-form__group" >
                        <label for="user_name">
                          Tax Amount
                        </label>
                        <div class="m-input-icon m-input-icon--right">
                          <input readonly type="text" name="bill_tax_amount"  id="subcontract_bill_tax_amount_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit" placeholder="Tax Amount" aria-describedby="basic-addon1">
                          <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                        </div>
                        <span class="m-form__help"></span>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-lg-4" >
                  <div class="row" >
                    <div class="col-lg-5" >
                      <div class="form-group m-form__group" >
                        <label for="user_name">
                          Retention %
                        </label>
                        <div class="m-input-icon m-input-icon--right">
                          <input required value="0" type="text" name="bill_retention_percent"  id="subcontract_bill_retention_percent_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit subcontract_bill_edit_required_fields" placeholder="Retention %" aria-describedby="basic-addon1">
                          <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                        </div>
                        <span class="m-form__help"></span>
                      </div>
                    </div>
                    <div class="col-lg-7" >
                      <div class="form-group m-form__group" >
                        <label for="user_name">
                          Retention Amt
                        </label>
                        <div class="m-input-icon m-input-icon--right">
                          <input readonly type="text" name="bill_retention_amount"  id="subcontract_bill_retention_amount_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit subcontract_bill_edit_required_fields" placeholder="Retention Amount" aria-describedby="basic-addon1">
                          <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                        </div>
                        <span class="m-form__help"></span>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-lg-2" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      TDS Amount
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input required type="text" name="bill_tds_amount"  id="subcontract_bill_tds_amount_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit" placeholder="TDS Amount" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-lg-4" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Consignee
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input type="text" name="consignee" id="subcontract_bill_consignee_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields" placeholder="Consignee Name" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-3" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Bill Description
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input type="text" name="bill_description" id="subcontract_bill_description_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields" placeholder="Bill Description" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-2" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Deduction
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input required type="text" name="bill_deduction_amount"  id="subcontract_bill_deduction_amount_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit" placeholder="Deduction Amount" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-3" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Bill Payable Amount
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input readonly required type="text" name="bill_payable_amount"  id="subcontract_bill_payable_amount_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields form_subcontract_bill_amount_fields_edit" placeholder="Bill Amount" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-lg-6" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Bill Remarks
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input type="text" name="bill_remarks" id="subcontract_bill_remarks_edit" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields" placeholder="Bill Remarks" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <div class="col-lg-6" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Upload Bill Copy
                    </label>
                    <div class="custom-file">
                      <input type="file" class="custom-file-input form_subcontract_bill_edit_fields" name="uploaded_file" id="subcontract_upload_bill_edit">
                      <label class="custom-file-label" for="subcontract_upload_bill_edit">Choose file</label>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-lg-6" >
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      No. of Labours Worked
                    </label>
                    <div class="m-input-icon m-input-icon--right">
                      <input id="subcontract_labours_no_edit" type="text" name="subcontract_labours_no" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields" placeholder="No. of Labours Worked" aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <br/>
          <div class="row">
            <div class="col-lg-6" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Total Paid
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input readonly type="text" id="subcontract_bill_total_paid_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
            <div class="col-lg-6" >
              <div class="form-group m-form__group" >
                <label for="user_name">
                  Total Balance
                </label>
                <div class="m-input-icon m-input-icon--right">
                  <input readonly type="text" id="subcontract_bill_total_balance_edit" value="0" class="form-control m-input m-input--pill m-input--air form_subcontract_bill_edit_fields"  aria-describedby="basic-addon1">
                  <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                </div>
                <span class="m-form__help"></span>
              </div>
            </div>
          </div>
          <br/>
          <input type="hidden" name="bill_id" id="bill_id_edit" >
          <input type="hidden" name="bill_type" value="subcontract" >
          <input type="hidden" name="subcontract_id" id="subcontract_id_bill_edit">
          <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">
            Close
          </button>
          <button type="submit" class="btn btn-primary form_submit_btn">
            Submit
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
