<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->

<style>

@media print {
  .print_hide_div
  {
    display: none !important;
  }
  .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: 85%;
  }
  .m-invoice-2 .m-invoice__wrapper .m-invoice__body.m-invoice__body--centered {
    width: 85%;
  }

  body * {
    visibility: hidden;
  }
  body.m-content--skin-light2 {
    background-color: white !important;
  }
  .m-portlet__body * {
    visibility: visible;
    overflow: visible !important;
  }
  .table-bordered td{
    border: 1px solid #34bfa3 !important;
  }
  .table-bordered th{
    border: 1px solid #34bfa3 !important;
  }
  #print_view {
    margin-top: -20%;
  }
  .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%;
  }
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
  width: 85%;
}
</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">
          Salary Details
        </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="<?= 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="<?= base_url().'purchases' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Salary Details
              </span>
            </a>
          </li>


        </ul>
      </div>
      <div>

      </div>
    </div>
  </div>
  <!-- END: Subheader -->
  <div class="m-content" id="salary_slip_print_view">
    <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" >

          <?php if($this->session->userdata('user_role')!='auditor') { ?>

            <?php
            if($salary_slip_data->salary_id != 1){?>
              <a style="margin-left: 5px;margin-right: 5px" data-bill-type="salary_slip" data-bill-id="<?= $salary_slip_data->salary_id?>" id="btn_add_bill_payment" data-toggle="modal"  href="#bill_payment_add_modal" 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-plus"></i>
                  <span>
                    Add Payment
                  </span>
                </span>
              </a>
            <?php } ?>

          <?php } ?>

          <?php if($this->session->userdata('user_id')==$salary_slip_data->ss_created_by){?>

          <?php } ?>

          <a href="javascript:;" onclick="window.print()" id="btn_print_slip" style="margin-left: 5px;margin-right: 5px" 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="fa fa-print"></i>
              <span>
                Print Salary Slip
              </span>
            </span>
          </a>

        </div>
      </div>
      <div class="m-portlet__body m-portlet__body--no-padding" id="print_view">
        <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">
                <?php if($this->config->item('company_letter_head')!=''){ ?>
                  <img style="max-width: 100%" src="<?php echo base_url().'uploads/company/'.$this->config->item('company_letter_head')?>" />
                <?php } ?>
                <div class="row">
                  <div class="col-lg-8 col-sm-8 col-xs-8">
                    <span class="m-invoice__desc" style="text-align: left;padding: 1rem 0 1rem 0 !important;">
                      <span class="m-invoice__subtitle">Employee :</span>
                      <span><strong><?= $salary_slip_data->employee_name?></strong></span>
                      <span><strong><?= $salary_slip_data->user_designation?></strong></span>
                      <?php if($salary_slip_data->civil_id!='') { ?>
                        <span><strong><?= $salary_slip_data->civil_id?></strong></span>
                      <?php } ?>
                      <span><strong><?= $salary_slip_data->phone_no?></strong></span>
                    </span>
                  </div>
                  <div class="col-lg-4 col-sm-4 col-xs-4">
                    <div class="m-invoice__logo" style="padding-top: 1rem;">
                      <a href="#">
                        <h2>SALARY SLIP</h2>
                      </a>
                    </div>
                  </div>
                </div>

                <table class='table table-bordered m-table m-table--border-success mt-3' style="border: 3px solid #34bfa3;">
                  <thead>
                    <tr>
                      <th><strong>SLIP TYPE</strong></th>
                      <th><strong>MONTH</strong></th>
                      <?php if($this->config->item('HR_salary_slip_template')!=4){ ?>
                        <th><strong>BASIC WAGE</strong></th>
                        <th><strong>WORKED <?php if($salary_slip_data->basic_wage_type=='Hourly') { echo " Hours"; } else { echo " Days"; } ?></strong></th>
                      <?php } ?>
                    </tr>
                    <tr>
                      <?php if(isset($salary_slip_data->work_name)) { $project =  ' - '.$salary_slip_data->work_name; } else { $project = ''; } ?>
                      <th><?= $salary_slip_data->slip_type.$project ?></th>
                      <th><?= date('F Y',strtotime($salary_slip_data->month))?></th>
                      <?php if($this->config->item('HR_salary_slip_template')!=4){ ?>
                        <th><?= $salary_slip_data->basic_wage.'/'.$salary_slip_data->basic_wage_type ?></th>
                        <th><?= $salary_slip_data->worked_nos ?> <?php if($salary_slip_data->basic_wage_type=='Hourly') { echo " Hours"; } else { echo " Days"; } ?></th>
                      <?php } ?>
                    </tr>
                  </thead>
                </table>
                <?php if($this->config->item('HR_salary_slip_template')==3){ ?>
                  <table class='table table-bordered m-table m-table--border-success' style="border: 3px solid #34bfa3;">
                    <thead>
                      <tr>
                        <th><strong>Total <br/>Basic Wage</strong></th>
                        <th><strong>Bonus <br/><?php echo $this->config->item('HR_salary_bonus_percent') ?>%</strong></th>
                        <th><strong>Tiffin Allowance<br/><?php echo $this->config->item("Currency_currency_format").$this->config->item('HR_salary_tiffin_allowance_per_day') ?>/Day</strong></th>
                        <th><strong>Overtime<br/>Hours</strong></th>
                        <th><strong>Overtime<br/>Amount</strong></th>
                        <th><strong>HRA<br/><?php echo $this->config->item('HR_salary_hra_percent') ?>%</strong></th>
                        <th><strong>CEB<br/><?php echo $this->config->item('HR_salary_ceb_percent') ?>%</strong></th>
                      </tr>
                      <tr>
                        <th><?= round($salary_slip_data->worked_nos*$salary_slip_data->basic_wage,$this->config->item('Currency_amount_decimals_2')) ?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->bonus_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->tiffin_allowance_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th><?= $salary_slip_data->overtime.' '.$salary_slip_data->overtime_period ?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->overtime_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->hra_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->ceb_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                      </tr>
                    </thead>
                  </table>
                  <table class='table table-bordered m-table m-table--border-success' style="border: 3px solid #34bfa3;">
                    <thead>
                      <tr>
                        <th><strong>EL<br/><?php echo $this->config->item('HR_salary_el_percent') ?>%</strong></th>
                        <th><strong>Total</strong></th>
                        <th>PF<br/><?php echo $this->config->item('HR_salary_pf_percent') ?>%</th>
                        <th>ESI<br/><?php echo $this->config->item('HR_salary_esi_percent') ?>%</th>
                        <th><strong>ALLOWANCE</strong></th>
                        <th><strong>INCENTIVE</strong></th>
                        <th><strong>BONUS</strong></th>
                        <th><strong>OTHER DEDUCTIONS</strong></th>
                      </tr>
                      <tr>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->el_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->total_salary_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->pf_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->esi_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->allowance,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->incentive,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->bonus_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->other_deductions,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                      </tr>
                    </thead>
                  </table>
                <?php }elseif($this->config->item('HR_salary_slip_template')==4){ ?>
                  <table class='table table-bordered m-table m-table--border-success' style="border: 3px solid #34bfa3;font-weight: 600;">
                    <thead>
                      <tr>
                        <th><strong>Earnings</strong></th>
                        <th style="text-align:right"><strong>Amount</strong></th>
                        <th><strong>Deductions</strong></th>
                        <th style="text-align:right"><strong>Amount</strong></th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td style="border-top:none !important;border-bottom:none !important">Basic Salary</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->total_basic_salary_amt,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:none !important;border-bottom:none !important">Salary Advance</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->advance_paid_amount,$this->config->item('Currency_currency_shortname'));?></td>
                      </tr>
                      <tr>
                        <td style="border-top:none !important;border-bottom:none !important">HRA</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->hra_amount,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:none !important;border-bottom:none !important">LWP</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->lwp_amount,$this->config->item('Currency_currency_shortname'));?></td>
                      </tr>
                      <tr>
                        <td style="border-top:none !important;border-bottom:none !important">Conveyance Allowance</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->conveyance_alwnc_amt,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                      </tr>
                      <tr>
                        <td style="border-top:none !important;border-bottom:none !important">Special Allowance</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->special_alwnc_amt,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                      </tr>
                      <tr>
                        <td style="border-top:none !important;border-bottom:none !important">City Compensatory Allowance</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->city_compens_alwnc_amt,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                      </tr>
                      <tr>
                        <td style="border-top:none !important;border-bottom:none !important">Extra Allowance</td>
                        <td style="border-top:none !important;border-bottom:none !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->allowance,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                        <td style="border-top:none !important;border-bottom:none !important"></td>
                      </tr>
                      <tr>
                        <td style="border-top:2px solid #34bfa3 !important">Total Earnings</td>
                        <td style="border-top:2px solid #34bfa3 !important;text-align:right"><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->total_salary_amount,$this->config->item('Currency_currency_shortname'));?></td>
                        <td style="border-top:2px solid #34bfa3 !important">Total Deductions</td>
                        <td style="border-top:2px solid #34bfa3 !important;text-align:right">
                          <?php
                          $total_deductions = $salary_slip_data->lwp_amount+$salary_slip_data->advance_paid_amount;
                          echo $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($total_deductions,$this->config->item('Currency_currency_shortname'));
                          ?>
                        </td>
                      </tr>
                    </tbody>
                  </table>

                <?php }else{ ?>
                  <table class='table table-bordered m-table m-table--border-success' style="border: 3px solid #34bfa3;">
                    <thead>
                      <tr>
                        <th><strong>OVERTIME</strong></th>
                        <th><strong>OVERTIME RATE</strong></th>
                        <th><strong>OVERTIME AMOUNT</strong></th>
                        <th><strong>ALLOWANCE</strong></th>
                        <th><strong>INCENTIVE</strong></th>
                        <th><strong>BONUS</strong></th>
                        <th><strong>TOTAL SALARY</strong></th>
                        <th><strong>OTHER DEDUCTIONS</strong></th>
                      </tr>
                      <tr>
                        <th><?= $salary_slip_data->overtime.' '.$salary_slip_data->overtime_period ?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->overtime_rate,$this->config->item('Currency_currency_shortname'));?></th>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->overtime_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->allowance,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->incentive,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->bonus_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->net_salary_amount+$salary_slip_data->other_deductions,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->other_deductions,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                      </tr>
                    </thead>
                  </table>
                <?php } ?>
                <?php if($this->config->item('HR_salary_slip_template')!=4){ ?>
                  <table class='table table-bordered m-table m-table--border-success' style="border: 3px solid #34bfa3;">
                    <thead>
                      <tr>
                        <th width="20%"><strong>NET SALARY AMOUNT</strong></th>
                        <th width="20%"><strong>TOTAL PAID (Advance)</strong></th>
                        <th width="20%"><strong>TOTAL PAID (Arrear)</strong></th>
                        <th width="20%"><strong>TOTAL PAID</strong></th>
                        <th width="20%"><strong>BALANCE SALARY</strong></th>
                      </tr>
                      <tr>
                        <th><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->net_salary_amount,$this->config->item('Currency_currency_shortname'));?></th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->advance_paid_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->total_paid_amount,$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency(($salary_slip_data->total_paid_amount+$salary_slip_data->advance_paid_amount),$this->config->item('Currency_currency_shortname'));?>
                        </th>
                        <th>
                          <strong class="text-danger">
                            <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->total_balance_amount,$this->config->item('Currency_currency_shortname'));?>
                          </strong>
                        </th>
                      </tr>
                    </thead>
                  </table>
                <?php }else{?>
                  <table class='table table-bordered m-table m-table--border-success' style="border: 3px solid #34bfa3;font-weight:600;font-size:20px">
                    <thead>
                      <tr>
                        <th style="border-right:none !important;border-left:none !important;vertical-align:top"><strong>NET PAY</strong></th>
                        <th style="border-right:none !important;border-left:none !important;vertical-align:top">:</th>
                        <th style="border-right:none !important;border-left:none !important">
                          <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency(($salary_slip_data->net_salary_amount-$salary_slip_data->advance_paid_amount),$this->config->item('Currency_currency_shortname'));?>
                          <br/>
                          <?= $net_pay_in_words ?>
                        </th>
                      </tr>
                    </thead>
                  </table>
                <?php } ?>
                <div style="margin: 0 auto;padding: 2rem 0 0 0;">
                  <div class="" style="margin-bottom: 100px">
                    <table id="payment_view_table"  class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" width="100%">
                      <caption style="caption-side: top;text-align:left"><strong>Salary Payment Transactions</strong></caption>
                      <thead style="font-weight: 500;font-size: 1.1rem;">
                        <tr>
                          <th>Sl No</th>
                          <th>Paid Date</th>
                          <th>Paid Amount</th>
                          <th>Debit Acc</th>
                          <th>TR Mode</th>
                          <th>TR Ref No</th>
                          <th>TR Ref Date</th>
                          <th>Remarks</th>
                          <th class="print_hide_div">Created By</th>
                          <th class="print_hide_div">Created Date</th>
                        </tr>
                      </thead>
                      <tbody style="font-weight: 600;font-size: 1.1rem;">
                        <?php
                        $sl_no=0;
                        foreach($advance_payments as $row):
                          $sl_no++;
                          ?>
                          <tr>
                            <td><?= $sl_no?></td>
                            <td><?= date('d-m-Y',strtotime($row->tr_date))?></td>
                            <td><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($row->tr_amount,$this->config->item('Currency_currency_shortname'));?></td>
                            <td><?= $row->debit_account?></td>
                            <td><?= $row->tr_mode?></td>
                            <td><?= $row->tr_reference_no?></td>
                            <td><?php if($row->tr_reference_date!='0000-00-00'){echo date('d-m-Y',strtotime($row->tr_reference_date));}?></td>
                            <td><?= $row->tr_remarks?></td>
                            <td class="print_hide_div"><?= $row->created_user?></td>
                            <td class="print_hide_div"><?php if ($this->config->item('UI_hide_created_date_field')==0){ echo date('d-m-Y',strtotime($row->created_date));}else{ echo '';}?></td>
                          </tr>
                          <?php
                        endforeach;
                        foreach($salary_payments as $row):
                          $sl_no++;
                          ?>
                          <tr>
                            <td><?= $sl_no?></td>
                            <td><?= date('d-m-Y',strtotime($row->tr_date))?></td>
                            <td><?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($row->tr_amount,$this->config->item('Currency_currency_shortname'));?></td>
                            <td><?= $row->debit_account?></td>
                            <td><?= $row->tr_mode?></td>
                            <td><?= $row->tr_reference_no?></td>
                            <td><?php if($row->tr_reference_date!='0000-00-00'){echo date('d-m-Y',strtotime($row->tr_reference_date));}?></td>
                            <td><?= $row->tr_remarks?></td>
                            <td class="print_hide_div"><?= $row->created_user?></td>
                            <td class="print_hide_div"><?php if ($this->config->item('UI_hide_created_date_field')==0){ echo date('d-m-Y',strtotime($row->created_date));}else{ echo '';}?></td>
                          </tr>
                          <?php
                        endforeach;
                        ?>
                      </tbody>
                    </table>

                  </div>
                  <div class="m-invoice__table  m-invoice__table--centered table-responsive" style="margin-bottom: 100px">
                    <table class="table">
                      <thead>
                        <tr>
                          <th width="40%">PAYMENT STATUS :
                            <label class="m--font-danger">
                              <strong>
                                <?php
                                if($salary_slip_data->total_balance_amount<=0){
                                  echo "PAID";
                                }elseif($salary_slip_data->total_balance_amount>0 && ($salary_slip_data->total_paid_amount+$salary_slip_data->advance_paid_amount)>0) {
                                  echo "PARTIALLY PAID";
                                }else {
                                  echo "NOT PAID";
                                }
                                ?></strong>
                              </label>
                            </th>
                            <th width="30%" style="vertical-align: top">Total Paid : <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency(($salary_slip_data->total_paid_amount+$salary_slip_data->advance_paid_amount),$this->config->item('Currency_currency_shortname'));?></th>
                            <th width="30%" style="vertical-align: top;text-align:right">Balance :
                              <strong class="m--font-danger" >
                                <?= $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($salary_slip_data->total_balance_amount,$this->config->item('Currency_currency_shortname'));?>
                              </strong>
                            </th>
                          </tr>
                          <tr>
                            <th colspan="3" >Remarks : <?= $salary_slip_data->remarks;?>
                            </th>

                          </tr>
                        </thead>

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




            </div>
          </div>
        </div>
      </div>
      <?php $this->view("modules/include_modals/modal_bills");?>
    </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 -->
<?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");

$("#hr_menu").addClass('m-menu__item--active m-menu__item--open');
$("#hr_menu_2").addClass('m-menu__item--active');


</script>
<script>

$(".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: {
      "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>
