You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
11 KiB
PHP

<!-- Extend area where template is defined -->
<?= $this->extend('templates/adminlte/generalcontent') ?>
<!-- .Extend -->
<!-- Title of the page -->
<?= $this->section('title') ?>Employee Payroll Info<?= $this->endSection() ?>
<!-- .Title -->
<!-- CSS of the page -->
<?= $this->section('css') ?>
<!-- Select2 -->
<link rel="stylesheet" href="/adminlte/plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="/adminlte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<?= $this->endSection() ?>
<!-- .CSS -->
<!-- body attribute - class definition -->
<?= $this->section('bodyclass') ?>sidebar-mini<?= $this->endSection() ?>
<!-- .body attribute -->
<!-- Container title -->
<?= $this->section('containertitle') ?>Employee Payroll Info<?= $this->endSection() ?>
<!-- .Container title -->
<!-- Active breadcrumb -->
<?= $this->section('activebreadcrumb') ?>Employee Payroll Info<?= $this->endSection() ?>
<!-- .Active breadcrumb -->
<!-- Main content -->
<?= $this->section('main') ?>
<!-- Modal Add Branch -->
<div class="modal fade" id="mdlEmpPayInfo">
<div class="modal-dialog">
<div class="modal-content">
<form action="<?= url_to('payroll/addemppayinfo') ?>" method="post">
<div class="modal-header">
<h4 class="modal-title" >New Employee Payroll Information</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<p class="lead">Employee Payroll Information</p>
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Select Employee</label>
<select class="form-control select2" style="width: 100%;" name="employee_id">
<?php foreach($employees as $employee): ?>
<?php $selected = (old('employee_id') == $employee->employee_id) ? 'selected' : ''; ?>
<?= '<option value="'.$employee->employee_id.'" '.$selected.'>'.$employee->last_name.', '.$employee->first_name.'</option>' ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label>Select Payroll Type</label>
<select class="form-control" style="width: 100%;" name="paytype_id">
<?php foreach($paytypes as $paytype): ?>
<?php $selected = (old('paytype_id') == $paytype->paytype_id) ? 'selected' : ''; ?>
<?= '<option value="'.$paytype->paytype_id.'" '.$selected.'>['.$paytype->paytype_code.'] '.$paytype->paytype_name.'</option>' ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="chkIsATM" name="is_ATM">
<label for="chkIsATM" class="custom-control-label">Salary is through ATM.</label>
</div>
</div>
<div class="form-group">
<label for="txtSavingsAccount">Savings Account Number</label>
<input class="form-control" type="text" id="txtSavingsAccount" name="savings_account" value="<?= old('savings_account') ?>">
</div>
<div class="form-group">
<label>Select Work Days</label>
<select class="form-control" style="width: 100%;" name="work_days" id="lstWorkDays">
<option value="261">No work and not paid on Sat and Sun or Rest Day</option>
<option value="313">No work and not paid on Sun or Rest Day</option>
</select>
</div>
<div class="form-group">
<label for="txtMonthlyBasicPay">Monthly Basic Salary</label>
<div class="input-group mb-3">
<input class="form-control rounded-0" type="text" id="txtMonthlyBasicPay" name="basic_monthly_pay" values="<?= old('basic_monthly_pay') ?>">
<span class="input-group-append">
<button type="button" class="btn btn-info btn-flat" onclick="computeBasicPay('fromMonthly')">Compute</button>
</span>
</div>
<p><small><i>Click compute so other salary field will be filled with computed value</i></small></p>
</div>
<div class="form-group">
<label for="txtSemiMonthlyBasicPay">Semi-monthly Basic Salary</label>
<input class="form-control" type="text" id="txtSemiMonthlyBasicPay" name="basic_semi_monthly_pay" value="<?= old('basic_semi_monthly_pay') ?>">
</div>
<div class="form-group">
<label for="txtDailyBasicPay">Daily Basic Salary</label>
<div class="input-group mb-3">
<input class="form-control rounded-0" type="text" id="txtDailyBasicPay" name="basic_daily_pay" values="<?= old('basic_daily_pay') ?>">
<span class="input-group-append">
<button type="button" class="btn btn-info btn-flat" onclick="computeBasicPay('fromDaily')">Compute</button>
</span>
</div>
<p><small><i>Click compute so other salary field will be filled with computed value</i></small></p>
</div>
<div class="form-group">
<label for="txtHourlyBasicPay">Hourly Basic Salary</label>
<input class="form-control" type="text" id="txtHourlyBasicPay" name="basic_hourly_pay" value="<?= old('basic_hourly_pay') ?>">
</div>
<p id="txtSalaryFormula"></p>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="chkHasCola" name="has_cola">
<label for="chkHasCola" class="custom-control-label">Has COLA</label>
</div>
</div>
<h4>Government Required Contributions</h4>
<p>Define statutory deduction below which applies to an employee.</p>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="chkHasPhilhealth" name="has_philhealth">
<label for="chkHasPhilhealth" class="custom-control-label">Has PhilHealth</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="chkHasHDMF" name="has_hdmf">
<label for="chkHasHDMF" class="custom-control-label">Has Pag-IBIG</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="chkHasSSS" name="has_sss">
<label for="chkHasSSS" class="custom-control-label">Has SSS</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="chkHasGSIS" name="has_gsis">
<label for="chkHasGSIS" class="custom-control-label">Has GSIS</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">List of Employee Payroll Information</h3>
</div>
<div class="card-body">
<div class="card-body table-responsive p-0">
<?= $tblEmpPayInfo ?>
</div>
</div>
<div class="card-footer">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mdlEmpPayInfo">Add Employee Payroll Information</button>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<!-- .Main content -->
<!-- Javascript -->
<?= $this->section('js') ?>
<!-- Select2 -->
<script src="/adminlte/plugins/select2/js/select2.full.min.js"></script>
<script>
$(document).ready(function() {
//Initialize Select2 Elements
$('.select2').select2({
dropdownParent: $('#mdlEmpPayInfo')
});
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
});
});
function computeBasicPay(fromSource)
{
var monthlyBasic = 0;
switch(fromSource)
{
case 'fromDaily':
monthlyBasic = Number($("#txtDailyBasicPay").val()) * Number($("#lstWorkDays").val()) / 12;
break;
case 'fromMonthly':
monthlyBasic = Number($("#txtMonthlyBasicPay").val());
break;
}
if(fromSource != 'fromMonthly') $("#txtMonthlyBasicPay").val(monthlyBasic);
$("#txtSemiMonthlyBasicPay").val(monthlyBasic / 2);
if(fromSource != 'fromDaily') $("#txtDailyBasicPay").val(monthlyBasic * 12 / Number($("#lstWorkDays").val()));
$("#txtHourlyBasicPay").val(monthlyBasic * 12 / Number($("#lstWorkDays").val()) / 8);
$("#txtSalaryFormula").html("Formula: Basic Salary x 12 x " + $("#lstWorkDays").val());
}
</script>
<?= $this->endSection() ?>
<!-- .Javascript -->