mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 11:11:31 +00:00
updated streamline-setup v2
This commit is contained in:
+290
@@ -0,0 +1,290 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Add Payroll</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li><a href="{{ route('payroll.index') }}"><i class="fa fa-eye"></i> Payroll</a></li>
|
||||
<li class="active"><i class="fa fa-plus"></i> Create</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="white-box">
|
||||
<!--Flash messages at the top -->
|
||||
@include('flash::message')
|
||||
|
||||
{{ Form::open(['route' => 'payroll.save_payment', 'data-toggle' => 'validator']) }}
|
||||
|
||||
{{ Form::hidden('member_id', $id, ['id' => 'member_id']) }}
|
||||
|
||||
<h3>Staff Member Information</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<table class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th>Member Name</th>
|
||||
<td>{{ $member->first_name }} {{ $member->last_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Member Contact</th>
|
||||
<td>{{ $member->phone }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Member Bank</th>
|
||||
{{ Form::hidden('bank_id', $member->payroll_bank_id) }}
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<table class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th>Member Position</th>
|
||||
<td>{{ $positions[$member->position] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Member Department</th>
|
||||
<td>{{ $departments[$member->department] }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Salary and allowances</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
{{ Form::label('year','Payment Year') }}
|
||||
{{ Form::select('year',$years,'',['class' => 'form-control compulsory','required', 'id' => 'year']) }}
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('basic_pay','Basic Pay') }}
|
||||
{{ Form::number('basic_pay',$basic_pay,['class' => 'form-control compulsory allowance_changes', 'required', 'readonly', 'id' => 'basic_pay']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('allowances','Allowances') }}
|
||||
{{ Form::number('allowances','0',['class' => 'form-control allowance_changes', 'id' => 'allowances', 'readonly']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
{{ Form::label('month','Payment Month') }}
|
||||
{{ Form::select('month',$months,'',['class' => 'form-control compulsory','required', 'id' => 'month']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('gross_pay','Gross Pay') }}
|
||||
{{ Form::number('gross_pay','',['class' => 'form-control compulsory', 'required', 'readonly', 'id' => 'gross_pay']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Deductions</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
{{ Form::label('nssf_payment','NSSF') }}
|
||||
{{ Form::number('nssf_payment','',['class' => 'form-control compulsory deduction_changes', 'required', 'readonly', 'id' => 'nssf_payment']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('deductions','Deductions') }}
|
||||
{{ Form::number('deductions','0',['class' => 'form-control deduction_changes', 'id' => 'deductions', 'readonly']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
{{ Form::label('paye_payment','PAYE') }}
|
||||
{{ Form::number('paye_payment','',['class' => 'form-control compulsory deduction_changes', 'required', 'readonly', 'id' => 'paye_payment']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('total_deductions','Total Deductions') }}
|
||||
{{ Form::number('total_deductions','',['class' => 'form-control compulsory', 'required', 'readonly', 'id' => 'total_deductions']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Totals</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6">
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('net_pay','Net Pay') }}
|
||||
{{ Form::number('net_pay','',['class' => 'form-control compulsory', 'required', 'readonly', 'id' => 'net_pay']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3"></div>
|
||||
</div>
|
||||
|
||||
{{ Form::button('Submit',['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
|
||||
{{ Form::button('Cancel',['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/js/validator.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/js/mask.js') }}"></script>
|
||||
|
||||
<script>
|
||||
let month = '';
|
||||
let year = '';
|
||||
let member_id = <?php echo $id; ?>;
|
||||
|
||||
$(document).ready(function () {
|
||||
// when page has finished loading, set the initial values
|
||||
setInitialValues();
|
||||
|
||||
// check if any value in the allowance section has been changed
|
||||
$(".allowance_changes").change(function(){
|
||||
// call the function which changes allowance total
|
||||
calculateAllowances();
|
||||
});
|
||||
|
||||
$("#year").change(function(){
|
||||
year = this.value;
|
||||
checkAllowancesOrDeductions();
|
||||
});
|
||||
|
||||
$("#month").change(function(){
|
||||
month = this.value;
|
||||
checkAllowancesOrDeductions();
|
||||
});
|
||||
|
||||
// check if any value in the deductions section has been changed
|
||||
$(".deduction_changes").change(function(){
|
||||
// call the function which changes deductions total
|
||||
calculateDeductions();
|
||||
});
|
||||
});
|
||||
|
||||
function checkAllowancesOrDeductions(){
|
||||
if (month !== '' || year !== '') {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/payroll/get_allowance_or_deductions",
|
||||
data: {month: month, year: year, member_id: member_id},
|
||||
cache: false,
|
||||
success: function (result) {
|
||||
let split_result = result.split(",");
|
||||
$('#deductions').val(split_result[1]);
|
||||
$('#allowances').val(split_result[0]);
|
||||
calculateDeductions();
|
||||
calculateAllowances();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// set the initial values for the form
|
||||
function setInitialValues() {
|
||||
// get the basic pay
|
||||
let amount = $('#basic_pay').val();
|
||||
|
||||
// calculate paye and nssf then get totals
|
||||
calculateNssf(amount);
|
||||
calculateAllowances();
|
||||
}
|
||||
|
||||
// calculate the total NSSF value
|
||||
function calculateNssf(amount){
|
||||
let data = 'amount=' + amount;
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/payroll/calculate_nssf",
|
||||
data: data,
|
||||
cache: false,
|
||||
success: function (result) {
|
||||
// set the nssf in the text box
|
||||
$('#nssf_payment').val(result);
|
||||
calculatePaye(amount - result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// calculate the total PAYE value
|
||||
function calculatePaye(amount) {
|
||||
let data = 'amount=' + amount;
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/payroll/calculate_paye",
|
||||
data: data,
|
||||
cache: false,
|
||||
success: function (result) {
|
||||
// set the paye in the text box
|
||||
$('#paye_payment').val(result);
|
||||
calculateDeductions();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// calculate the total deductions value
|
||||
function calculateDeductions() {
|
||||
// loop through all with class of deduction_changes adding the totals
|
||||
let amount = 0;
|
||||
|
||||
$('.deduction_changes').each(function(){
|
||||
amount += +this.value;
|
||||
});
|
||||
|
||||
$('#total_deductions').val(amount);
|
||||
|
||||
// calculate total pay
|
||||
calculateNetpay();
|
||||
}
|
||||
|
||||
// calculate the total allowances value
|
||||
function calculateAllowances() {
|
||||
// loop through all with class of allowance_changes adding the totals
|
||||
let amount = 0;
|
||||
|
||||
$('.allowance_changes').each(function(){
|
||||
amount += +this.value;
|
||||
});
|
||||
|
||||
$('#gross_pay').val(amount);
|
||||
|
||||
// calculate total pay
|
||||
calculateNetpay();
|
||||
}
|
||||
|
||||
// calculate total amount to pay staff
|
||||
function calculateNetpay() {
|
||||
// get the gross pay
|
||||
let gross_pay = $('#gross_pay').val();
|
||||
|
||||
// get the deductions pay
|
||||
let total_deductions = $('#total_deductions').val();
|
||||
|
||||
let net_pay = +gross_pay - +total_deductions;
|
||||
|
||||
$('#net_pay').val(net_pay);
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user