<?php if($page_name!='data_entry_approval' && $page_name!='data_entry_approval_2_level' && $page_name!='work_summary'){ ?>
<div class="m-form m-form--label-align-right m--margin-bottom-10">
  <div class="row">
    <div class="col-xl-12 order-2 order-xl-1">
      <div class="form-group m-form__group row ">
        <div class="col-md-4">
          <?php if(!isset($list_type) || $list_type!="payable"){?>
            <div class="m-form__label">
              <label class="m-label m-label--single">
                Date:
              </label>
            </div>
            <div class="row">
              <div class="col-md-6">
                <div class="m-form__control">
                  <input value="<?php if($page_name=='purchase_view'){ echo date('d-m-Y');}?>" data-date-format="dd-mm-yyyy" id="table_filter_purchase_bill_start_date" type="text"  class="form-control m-input table_filter  m-input--pill m-input--air" placeholder="Start Date" >
                </div>
              </div>
              <div class="col-md-6">
                <div class="m-form__control">
                  <input value="<?php if($page_name=='purchase_view'){ echo date('d-m-Y');}?>" data-date-format="dd-mm-yyyy" id="table_filter_purchase_bill_end_date" type="text"  class="form-control m-input table_filter  m-input--pill m-input--air" placeholder="End Date" >
                </div>
              </div>
            </div>
          <?php } ?>
        </div>
        <?php if($page_name!='work_profile'){ ?>
        <div class="col-md-3">
          <div class="form-group m-form__group">
            <label>
              Purchase to:
            </label>
            <div class="m-select2 m-select2--air m-select2--pill">
              <select style="width: 100%" class="form-control m-select2 table_filter" id="table_filter_purchase_bill_location"   data-placeholder="Select Work">
                <option value="all">All Location</option>
                <?php
                foreach($stock_locations as $row):
                  $location_name = $row->location_name;
                  if($this->config->item('app_module_stock_management')==1){
                    if($row->location_type=='work_site'){
                      $location_name .= " [Work Site]";
                    }elseif($row->location_type=='ware_house'){
                      $location_name .= " [Warehouse]";
                    }
                  }
                  ?>
                  <option data-work-status="<?php echo $row->work_status?>" value="<?php echo $row->location_id?>"><?php echo $location_name?></option>
                  <?php
                endforeach;
                ?>
              </select>
            </div>
            <span class="m-form__help"></span>
          </div>
        </div>
      <?php } ?>
      <?php if($page_name!='supplier_profile'){ ?>
        <div class="col-md-3">
          <div class="form-group m-form__group">
            <label>
              Supplier:
            </label>
            <div class="m-select2 m-select2--air m-select2--pill">
              <select style="width: 100%" class="form-control m-select2 table_filter" id="table_filter_purchase_bill_supplier"  name="supplier" data-placeholder="Select Supplier">
                <option value="all">All Suppliers</option>
                <?php
                foreach($suppliers_list as $row): ?>
                <option value="<?php echo $row->supplier_id?>"><?php echo $row->supplier_name?></option>
                <?php
              endforeach;
              ?>
            </select>
          </div>
          <span class="m-form__help"></span>
        </div>
      </div>
    <?php } ?>
    <?php if($page_name=='purchase_view'){ ?>
      <div class="col-md-2">
      <?php }else{ ?>
        <div class="col-md-3">
      <?php } ?>
        <div class="form-group m-form__group">
          <label>
            Payment Status:
          </label>
          <div class="m-select2 m-select2--air m-select2--pill">
            <select style="width: 100%" class="form-control m-select2 table_filter" id="table_filter_purchase_bill_payment_status"  name="payment_status" data-placeholder="Select Supplier">
              <?php if(isset($list_type) && $list_type=="payable"){?>
                <option selected value="0">Not Paid</option>
              <?php }else{?>
                <option selected value="all">All Bills</option>
                <option value="1">Paid</option>
                <option value="0">Not Paid</option>
              <?php } ?>
            </select>
          </div>
          <span class="m-form__help"></span>
        </div>
      </div>

    </div>
  </div>
</div>
</div>
<?php } ?>
<table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="purchase_bills_view_table">
  <thead>
    <tr class="">
      <th>Sl No</th>
      <th>Purchase ID</th>
      <th>Bill Date</th>
      <th>Bill No</th>
      <th>Supplier Name</th>
      <th>Purchased to</th>
      <th>Taxable Amount</th>
      <th><?php echo $this->config->item('Tax_tax_name')?> %</th>
      <th><?php echo $this->config->item('Tax_tax_name')?> Amt</th>
      <th>Payable Amount</th>
      <th>Total Paid</th>
      <th>Balance Amount</th>
      <th>Payment Status</th>
      <th>Other Charges</th>
      <th>Other Details</th>
      <th>Creation</th>
      <th>Actions</th>
      <th>ID</th>
      <th>Approval Status</th>
      <th>Approval Status 2</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
