<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->
<style>
.m-input{
  border: 1px solid #ebedf2 !important;
  background-color: #f4f5f833 !important;
}
#payment_view_table .dataTables_scrollHeadInner {
  width:100% !important;
  padding: 0 !important;
}

</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">
          Supplier Profile
        </h3>
      </div>
    </div>
  </div>


  <!-- END: Subheader -->
  <div class="m-content">
    <div class="row">
      <div class="col-xl-3 col-lg-4">
        <div class="m-portlet m-portlet--full-height  ">
          <div class="m-portlet__body" style="padding-top: 0px">
            <div class="m-card-profile">
              <div class="m-card-profile__title m--hide">
                Supplier Profile
              </div>
              <div class="m-card-profile__pic">
                <div class="m-card-profile__pic-wrapper">
                  <img src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/app/media/img/users/user.png" alt=""/>
                </div>
              </div>
              <div class="m-card-profile__details">
                <span class="m-card-profile__name">
                  #<?php echo $supplier_data->supplier_id?> - <?php echo $supplier_data->supplier_name?>
                </span>
                <br/>
                <a  id="btn_add_supplier_payment" data-toggle="modal"  href="#supplier_payment_add_modal" class="btn m-btn--gradient-from-success m-btn--gradient-to-info  m-btn  m-btn--icon m-btn--air m-btn--pill">
                  <span>
                    <i class="la la-plus"></i>
                    <span>
                      Add Payment
                    </span>
                  </span>
                </a>
                <br/>
                <a style="margin-top:20px"  href="<?php echo base_url().'accounts/ledger/acchead_'.$supplier_data->acc_head_id.'/supplier' ?>" class="btn m-btn--gradient-from-focus m-btn--gradient-to-primary  m-btn  m-btn--icon m-btn--air m-btn--pill">
                  <span>
                    <i class="la la-th-list"></i>
                    <span>
                      View Ledger
                    </span>
                  </span>
                </a>
              </div>

              <!-- Supplier Script and Modal -->
              <?php $this->view("modules/include_modals/modal_supplier_payment");?>
              <!-- .. -->
              <div class="m-card-profile__details">
                <span class="m-card-profile__name">

                </span>
              </div>
              <br/>
            </div>
            <ul class="m-nav m-nav--hover-bg m-portlet-fit--sides">
              <li class="m-nav__separator m-nav__separator--fit" style="margin-top: 0px"></li>
              <li class="m-nav__section m--hide">
                <span class="m-nav__section-text">
                  Section
                </span>
              </li>
              <li class="m-nav__item profile_nav" id="nav_overview" data-nav="overview" data-table-name=''>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-industry"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Overview
                      </span>
                    </span>
                  </span>
                </a>
              </li>
              <li class="m-nav__item profile_nav" id="nav_info" data-nav="info" data-table-name=''>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-info-circle"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Supplier Info
                      </span>
                    </span>
                  </span>
                </a>
              </li>
              <?php if($this->config->item('app_module_purchase_order')==1){?>
                <li class="m-nav__item profile_nav" id="nav_purchase_orders" data-nav="purchase_orders" data-table-name='purchase_order_view_table'>
                  <a href="javascript:;" class="m-nav__link">
                    <i class="m-nav__link-icon fa fa-shopping-cart"></i>
                    <span class="m-nav__link-title">
                      <span class="m-nav__link-wrap">
                        <span class="m-nav__link-text">
                          Purchase Orders
                        </span>
                      </span>
                    </span>
                  </a>
                </li>
                <li class="m-nav__item profile_nav" id="nav_purchase_order_payments" data-nav="purchase_order_payments" data-table-name='purchase_order_transaction_view_table'>
                  <a href="javascript:;" class="m-nav__link">
                    <i class="m-nav__link-icon fa fa-money-bill-alt"></i>
                    <span class="m-nav__link-title">
                      <span class="m-nav__link-wrap">
                        <span class="m-nav__link-text">
                          Purchase Order Payments
                        </span>
                      </span>
                    </span>
                  </a>
                </li>
              <?php } ?>
              <li class="m-nav__item profile_nav" id="nav_purchases" data-nav="purchases" data-table-name='purchase_bills_view_table'>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-shopping-cart"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Purchase Bills
                      </span>
                    </span>
                  </span>
                </a>
              </li>
              <li class="m-nav__item profile_nav" id="nav_purchase_materials" data-nav="purchase_materials" data-table-name='materials_purchased_view_table'>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-shopping-cart"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Purchased Materials
                      </span>
                    </span>
                  </span>
                </a>
              </li>
              <li class="m-nav__item profile_nav" id="nav_purchase_payments" data-nav="purchase_payments" data-table-name='purchase_bill_transaction_view_table'>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-money-bill-alt"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Purchase Bill Payments
                      </span>
                    </span>
                  </span>
                </a>
              </li>
              <li class="m-nav__item profile_nav" id="nav_advance_payments" data-nav="advance_payments" data-table-name='supplier_advance_view_table'>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-money-bill-alt"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Advance & OP Balance Payments
                      </span>
                    </span>
                  </span>
                </a>
              </li>
              <?php if ($this->config->item('app_module_vehicle_management') == 1) { ?>
              <li class="m-nav__item profile_nav" id="nav_expenses" data-nav="expenses" data-table-name='vehicle_expenses_view_table'>
                <a href="javascript:;" class="m-nav__link">
                  <i class="m-nav__link-icon fa fa-clipboard-list"></i>
                  <span class="m-nav__link-title">
                    <span class="m-nav__link-wrap">
                      <span class="m-nav__link-text">
                        Expense Bills
                      </span>
                    </span>
                  </span>
                </a>
              </li>
            <?php } ?>
            </ul>

          </div>
        </div>
      </div>
      <div class="col-xl-9 col-lg-8">
        <div id="div_overview" class="profile_nav_div">
          <div class="m-portlet">
            <div class="m-portlet__body m-portlet__body--no-padding">
              <div class="row m-row--no-padding m-row--col-separator-xl">
                <div class="col-md-12 col-lg-12 col-xl-3">
                  <!--begin:: Widgets/Stats2-1 -->
                  <div class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Total Purchase Bill
                          </h3>
                        </div>
                        <div class="col m--align-right">
                          <span class="m-widget1__number m--font-brand">
                            <label class="total_purchase_bill_info"></label>
                          </span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!--end:: Widgets/Stats2-1 -->
                </div>
                <?php if ($this->config->item('app_module_vehicle_management') == 1) { ?>
                <div class="col-md-12 col-lg-12 col-xl-3">
                  <!--begin:: Widgets/Stats2-1 -->
                  <div class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Total Expense Bill
                          </h3>
                        </div>
                        <div class="col m--align-right">
                          <span class="m-widget1__number m--font-brand">
                            <label class="total_expense_bill_info"></label>
                          </span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!--end:: Widgets/Stats2-1 -->
                </div>
              <?php } ?>
                <?php if($this->config->item('app_module_purchase_order')==1){?>
                  <div class="col-md-12 col-lg-12 col-xl-2">
                    <!--begin:: Widgets/Stats2-2 -->
                    <div class="m-widget1">
                      <div class="m-widget1__item">
                        <div class="row m-row--no-padding align-items-center">
                          <div class="col">
                            <h3 class="m-widget1__title">
                              Purchase Order Payments
                            </h3>
                          </div>
                          <div class="">
                            <span class="m-widget1__number m--font-accent">
                              <label class="total_order_payments_info"></label>
                            </span>
                          </div>
                        </div>
                      </div>
                    </div>
                    <!--begin:: Widgets/Stats2-2 -->
                  </div>
                <?php } ?>
                <div class="col-md-12 col-lg-12 col-xl-2">
                  <!--begin:: Widgets/Stats2-3 -->
                  <div class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Purchase Bill Payments
                          </h3>
                        </div>
                        <div class="">
                          <span class="m-widget1__number m--font-success">
                            <label class="total_bill_payments_info"></label>
                          </span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!--begin:: Widgets/Stats2-3 -->
                </div>
                <?php if ($this->config->item('app_module_vehicle_management') == 1) { ?>
                <div class="col-md-12 col-lg-12 col-xl-2">
                  <!--begin:: Widgets/Stats2-3 -->
                  <div class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Expense Bill Payments
                          </h3>
                        </div>
                        <div class="">
                          <span class="m-widget1__number m--font-success">
                            <label class="total_expense_bill_payments_info"></label>
                          </span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <!--begin:: Widgets/Stats2-3 -->
                </div>
              <?php } ?>
              </div>
            </div>
          </div>
          <div class="m-portlet">
            <div class="m-portlet__body m-portlet__body--no-padding">
              <div class="row m-row--no-padding m-row--col-separator-xl">
                <div  class="col-md-12 col-lg-12 col-xl-3">
                  <!--begin:: Widgets/Stats2-3 -->
                  <!--                            Display Only for Project Mangement-->
                  <div id="poject_management_commission_amount" class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Total Advance Paid
                          </h3>
                        </div>
                        <div class="col m--align-right">
                          <span class="m-widget1__number m--font-success">
                            <label class="total_advance_paid"></label>
                          </span>
                        </div>
                      </div>
                    </div>

                  </div>
                  <!--begin:: Widgets/Stats2-3 -->
                </div>
                <div  class="col-md-12 col-lg-12 col-xl-3">
                  <!--begin:: Widgets/Stats2-3 -->
                  <!--                            Display Only for Project Mangement-->
                  <div id="poject_management_commission_amount" class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Total Paid (Order+Bill+Advance)
                          </h3>
                        </div>
                        <div class="col m--align-right">
                          <span class="m-widget1__number m--font-success">
                            <label class="total_paid_info"></label>
                          </span>
                        </div>
                      </div>
                    </div>

                  </div>
                  <!--begin:: Widgets/Stats2-3 -->
                </div>

                <div  class="col-md-12 col-lg-12 col-xl-3">
                  <!--begin:: Widgets/Stats2-3 -->
                  <!--                            Display Only for Project Mangement-->
                  <div id="poject_management_commission_amount" class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Total Advance Availabe (To Redeem)
                          </h3>
                        </div>
                        <div class="col m--align-right">
                          <span class="m-widget1__number m--font-success">
                            <label class="advance_available_to_redeem"></label>
                          </span>
                        </div>
                      </div>
                    </div>

                  </div>
                  <!--begin:: Widgets/Stats2-3 -->
                </div>
                <div class="col-md-12 col-lg-12 col-xl-3">
                  <!--begin:: Widgets/Stats2-3 -->
                  <div class="m-widget1">
                    <div class="m-widget1__item">
                      <div class="row m-row--no-padding align-items-center">
                        <div class="col">
                          <h3 class="m-widget1__title">
                            Total Balance (Bill Amount-Paid)
                          </h3>
                        </div>
                        <div class="col m--align-right">
                          <span class="m-widget1__number m--font-success">
                            <label class="total_balance_info"></label>
                          </span>
                        </div>
                      </div>
                    </div>

                  </div>
                  <!--begin:: Widgets/Stats2-3 -->
                </div>
              </div>
            </div>
          </div>
          <div class="m-portlet  m-portlet--rounded m-portlet--bordered">
            <div class="m-portlet__body">
              <h3 class="m-portlet__head-text" style="text-align: center">
                Payment Summary
              </h3>
              <table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="all_payments">
                <thead>
                  <tr class="">
                    <th>Types Of Payments</th>
                    <th>Amount</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>Total Purchase Bill Amount</td>
                    <strong><td class="total_purchase_bill_info"></td></strong>
                  </tr>
                  <tr>
                    <td>Opening Balance (on A/C Creation)</td>
                    <strong><td class="opening_balance_info"></td></strong>
                  </tr>
                  <?php if ($this->config->item('app_module_vehicle_management') == 1) { ?>
                  <tr>
                    <td>Total Expense Bill Amount</td>
                    <strong><td class="total_expense_bill_info"></td></strong>
                  </tr>
                <?php } ?>
                  <?php if($this->config->item('app_module_purchase_order')==1){?>
                    <tr>
                      <td>Purchase Order Payments (Direct PO Advance)</td>
                      <strong><td class="total_order_payments_info"></td></strong>
                    </tr>
                  <?php } ?>
                  <tr>
                    <td>Purchase Bill Payments (Direct PB Payment)</td>
                    <strong><td class="total_bill_payments_info"></td></strong>
                  </tr>
                  <?php if ($this->config->item('app_module_vehicle_management') == 1) { ?>
                  <tr>
                    <td>Expense Bill Payments</td>
                    <strong><td class="total_expense_bill_payments_info"></td></strong>
                  </tr>
                <?php } ?>
                  <tr>
                    <td>Opening Balance Payments</td>
                    <strong><td class="total_op_balance_payments_info"></td></strong>
                  </tr>
                  <tr>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td>Total Advance Paid</td>
                    <strong><td class="total_advance_paid"></td></strong>
                  </tr>
                  <tr>
                    <td>Redeemed from Advance to Bill/Order</td>
                    <strong><td class="total_redeemed"></td></strong>
                  </tr>
                  <tr>
                    <td>Available Advance to Redeem</td>
                    <strong><td class="advance_available_to_redeem"></td></strong>
                  </tr>
                  <tr>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td>Total Paid</td>
                    <strong><td class="total_paid_info"></td></strong>
                  </tr>
                  <tr>
                    <td>Total Balance</td>
                    <strong><td class="total_balance_info"></td></strong>
                  </tr>
                  <tr>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td>Total Purchase Bill Commissions</td>
                    <strong><td class="purchase_bill_commission_info"></td></strong>
                  </tr>

                </tbody>
              </table>
            </div>
          </div>
        </div>
        <div id="div_info" class="profile_nav_div">
          <div class="m-portlet">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Supplier Info
                  </h3>
                </div>
              </div>
            </div>
            <div class="m-portlet__body">
              <form autocomplete="off" class="m-form m-form--fit m-form--label-align-right">
                <div class="m-portlet__body">
                  <div class="form-group m-form__group row">
                    <div class="col-9 ml-auto">
                      <h4 class="m-form__section">
                        1. Supplier Details
                      </h4>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Supplier Name
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-briefcase "></i>
                          </span>
                        </div>
                        <input disabled type="text" name="name" class="form-control m-input m-input--solid" value="<?php echo $supplier_data->supplier_name?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Address
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-map-marker"></i>
                          </span>
                        </div>
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->supplier_address?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Category
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-sitemap"></i>
                          </span>
                        </div>
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->sup_category_name ?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Phone
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-phone"></i>
                          </span>
                        </div>
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->supplier_phone?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Email
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-envelope"></i>
                          </span>
                        </div>
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->supplier_email?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      <?php echo $this->config->item('Tax_tax_name') ?> No
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-edit"></i>
                          </span>
                        </div>
                        <input  disabled type="text"  class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->tax_no?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      <?php echo $this->config->item('Tax_tax_name') ?> Date
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="fa fa-edit"></i>
                          </span>
                        </div>
                        <input disabled type="text"  class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->tax_date?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Contact Person
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->contact_person?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      <?php echo $this->config->item('Tax_tax_name') ?> No
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->tax_no?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      PAN No
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->pan_no?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Aadhar No
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->aadhar_no?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Bank A/C No
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->bank_account_no?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      <?= $this->config->item('bank_ifsc_name')?> Code
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->bank_ifsc?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Bank Name
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->bank_name?>">
                      </div>
                    </div>
                  </div>
                  <div class="form-group m-form__group row">
                    <label class="col-xl-3 col-lg-3 col-form-label">
                      Branch
                    </label>
                    <div class="col-xl-7 col-lg-7">
                      <div class="input-group m-input-group--air date">
                        <input  disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $supplier_data->bank_branch?>">
                      </div>
                    </div>
                  </div>
                </div>

              </form>
            </div>
          </div>

        </div>
        <div id="div_purchase_orders" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Purchase Orders
                  </h3>
                </div>
              </div>
              <div class="m-portlet__head-tools">

              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_purchase_order");?>
              <!--end: Datatable -->
            </div>
          </div>
        </div>
        <div id="div_purchase_order_payments" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Purchase Order Payments (Orders Those Haven't Purchase Bill Created)
                  </h3>
                </div>
              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_purchase_order_payments");?>
              <!--end: Datatable -->
            </div>
          </div>
        </div>
        <div id="div_purchases" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Purchase Blls
                  </h3>
                </div>
              </div>
              <div class="m-portlet__head-tools">

              </div>
            </div>
            <div class="m-portlet__body">
              <?php $this->view("modules/include_tables/table_purchase_bills");?>
              <!--end: Datatable -->
            </div>
          </div>
        </div>
        <div id="div_purchase_materials" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    List of Material Purchased
                  </h3>
                </div>
              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_materials_purchased");?>
              <!--end: Datatable -->
            </div>
          </div>
        </div>
        <div id="div_purchase_payments" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Purchase Bill Payments
                  </h3>
                </div>
              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_purchase_bill_payments");?>
              <!--end: Datatable -->
            </div>
          </div>
        </div>
        <div id="div_advance_payments" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    List of Advance Payments & Payments Toward OP Balance
                  </h3>
                </div>
              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_supplier_advance_payments");?>
              <!--end: Datatable -->
            </div>
          </div>
          <!-- advance returns -->
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Advance Payments Returns
                  </h3>
                </div>
              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_supplier_advance_return_payments");?>
              <!--end: Datatable -->
            </div>
          </div>
        </div>
        <div id="div_expenses" class="profile_nav_div">
          <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    Expense Bills
                  </h3>
                </div>
              </div>
              <div class="m-portlet__head-tools">

              </div>
            </div>
            <div class="m-portlet__body">
              <!--begin: Datatable -->
              <?php $this->view("modules/include_tables/table_vehicle_expenses");?>
            </div>
          </div>
          <!-- <div class="m-portlet m-portlet--mobile m-portlet--info m-portlet--head-solid-bg m-portlet--bordered m-portlet--rounded">
            <div class="m-portlet__head">
              <div class="m-portlet__head-caption">
                <div class="m-portlet__head-title">
                  <h3 class="m-portlet__head-text">
                    List of Expense Bill Transactions
                  </h3>
                </div>
              </div>
              <div class="m-portlet__head-tools">

              </div>
            </div>
            <div class="m-portlet__body">
              <!-- begin: Datatable -->
              <?php //$this->view("modules/include_tables/table_expense_bill_payments");?>
              <!--end: Datatable -->
            <!--</div>
          </div> -->
        </div>
      </div>

    </div>
  </div>
</div>

<?php $this->view("modules/include_modals/modal_bills");?>

<?php $this->view("modules/include_modals/modal_transaction_delete");?>

</div>
</div>
<!-- end:: Body -->
<!-- begin::Footer -->
<?php $this->view("includes/Inc_footer");?>
<!-- end::Footer -->
</div>
<!-- end:: Page -->
<?php $this->view("includes/Inc_sidebar");?>
<?php $this->view("includes/Inc_scripts");?>

<!--begin::Page Snippets -->
<script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/app/js/dashboard.js" type="text/javascript"></script>
<!--end::Page Snippets -->

<script>
function hide_all(){
  $(".profile_nav").removeClass('m-nav__item--active');
  $(".profile_nav_div").hide();
}
function active(menu_name){
  hide_all();
  $("#nav_"+menu_name).addClass('m-nav__item--active');
  $("#div_"+menu_name).show();
  $("#div_"+menu_name).fadeIn("slow");
  $('html, body').animate({
    scrollTop: eval($("#div_"+menu_name).offset().top - 150)
  }, 500);
}
//  Hide All Div and In Active All Menu
hide_all();
//  Active First Menu and Its div
active('overview');
$('body').on('click', '.profile_nav', function() {
  var nav = $(this).attr('data-nav');
  active(nav);
})
</script>
<script>
$("#suppliers_menu").addClass('m-menu__item--active');
select_summary();
function select_summary(){
  var supplier_id = "<?php echo $supplier_data->supplier_id?>";
  $.post("<?php echo base_url().'supplier/select_summary/count' ?>",{
    supplier_id:supplier_id
  },function(data){
    var obj= $.parseJSON(data);
    $(".total_purchase_bill_info").html(obj.total_purchase_bill_amount);
    $(".total_expense_bill_info").html(obj.total_expense_bill_amount);
    $(".total_order_payments_info").html(obj.total_order_payment);
    $(".total_bill_payments_info").html(obj.total_purchase_bill_payment);
    $(".total_expense_bill_payments_info").html(obj.total_expense_bill_payment);
    $(".opening_balance_info").html(obj.opening_balance);
    $(".total_paid_info").html(obj.total_paid);
    $(".advance_available_to_redeem").html(obj.advance_available_to_redeem);
    $(".total_op_balance_payments_info").html(obj.opening_balance_paid);
    $(".total_advance_paid").html(obj.total_advance_paid);
    $(".total_redeemed").html(obj.total_redeemed);
    $(".total_balance_info").html(obj.total_balance);
    $(".purchase_bill_commission_info").html(obj.total_purchase_commission);

  })
}
</script>
<!-- Bill Scripts -->
<?php $this->view("modules/include_scripts/bill_scripts");?>

<!-- Transaction Scripts -->
<?php $this->view("modules/include_scripts/transaction_scripts");?>

<!-- Purchase Order Scripts -->
<?php $this->view("modules/include_scripts/purchase_order_view_scripts");?>

<!-- Purchase Order Payments Scripts -->
<?php $this->view("modules/include_scripts/purchase_order_payments_view_scripts");?>

<!-- Purchase Bill Scripts -->
<?php $this->view("modules/include_scripts/purchase_bill_view_scripts");?>

<!-- Purchase Bill Payments Scripts -->
<?php $this->view("modules/include_scripts/purchase_bill_payments_view_scripts");?>

<!-- Purchased Material Scripts -->
<?php $this->view("modules/include_scripts/materials_purchased_view_scripts");?>

<!-- Expense Scripts -->
<?php $this->view("modules/include_scripts/vehicle_expense_scripts");?>

<?php $this->view("modules/include_scripts/supplier_payment_scripts");?>
<?php $this->view("modules/include_scripts/supplier_advance_payment_view_scripts");?>



<script>
  var supplier_id = "<?php echo $supplier_data->supplier_id?>";

  jQuery(document).ready(function() {
    $('.profile_nav').on('click', function(e){
      var table_name = $(this).attr('data-table-name');
      if(table_name!=''){
        var tables = table_name.split(',');
        $.each(tables, function( index, value ){
          var table_name = value;
          eval(table_name).ajax.reload();
        });
      }
    });
    $(".form_submit_btn").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: {
          paid_amount: {
            number: !0,
            required: !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('');
            $("."+form_id+"_select").val('').trigger("change");
            select_summary();
            supplier_advance_view_table.ajax.reload();
            supplier_advance_return_view_table.ajax.reload();
vehicle_expenses_view_table.ajax.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");
        }
      })
      )
    });
    $($.fn.dataTable.tables(true)).DataTable()
    .columns.adjust()
    .responsive.recalc();

  });
</script>
