mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
376 lines
18 KiB
PHP
376 lines
18 KiB
PHP
@extends('layouts.main')
|
|
|
|
@push('styles')
|
|
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
|
|
@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">{{ __('payroll.payroll_schedules') }}</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> {{ __('payroll.home') }}</a></li>
|
|
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('payroll.finance_home') }}</a></li>
|
|
<li class="active"><i class="fa fa-eye"></i> {{ __('payroll.payroll_schedules') }}</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
@include('payroll::payroll.menu')
|
|
|
|
<div class="white-box">
|
|
@include('flash::message')
|
|
|
|
{{ Form::open(['route' => 'payroll_schedules.create']) }}
|
|
|
|
<h3>{{ __('payroll.filter_by_category') }}</h3>
|
|
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<div class="form-group">
|
|
{{ Form::label('payroll_category',__('payroll.payroll_category')) }}
|
|
{{ Form::select('payroll_category',$payroll_categories,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<div class="form-group" style="margin-top: 25px;">
|
|
{{ Form::submit(__('investigations.search'), ['class'=>'btn btn-success']) }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{ Form::close() }}
|
|
|
|
@if(count($employees) > 0)
|
|
<hr>
|
|
|
|
<h3>{{ __('payroll.payroll_schedule_details') }}</h3>
|
|
|
|
{{ Form::open(['route' => 'payroll_schedules.save_schedule', 'data-toggle' => 'validator']) }}
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('name', __('payroll.payroll_schedule_name')) }}
|
|
{{ Form::text('name','',['class' => 'form-control compulsory', 'required']) }}
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="form-group">
|
|
{{ Form::label('pay_year',__('payroll.payment_year')) }}
|
|
{{ Form::select('pay_year',$years,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('salaries_expense_account',__('payroll.salaries_expenses_account')) }}
|
|
{{ Form::select('salaries_expense_account',$expense_accounts,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('salaries_payable_account',__('payroll.salaries_payable_account')) }}
|
|
{{ Form::select('salaries_payable_account',$payable_accounts,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="form-group">
|
|
{{ Form::label('pay_month',__('payroll.payment_month')) }}
|
|
{{ Form::select('pay_month',$months,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('tax_expense_account',__('payroll.tax_expense_account')) }}
|
|
{{ Form::select('tax_expense_account',$expense_accounts,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('tax_payable_account',__('payroll.tax_payable_account')) }}
|
|
{{ Form::select('tax_payable_account',$payable_accounts,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="form-group">
|
|
{{ Form::label('due_date', __('payroll.due_date')) }}
|
|
{{ Form::text('due_date','',['class' => 'form-control compulsory', 'readonly', 'required', 'id'=>'due_date']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('social_security_expense_account',__('payroll.social_security_expense_account')) }}
|
|
{{ Form::select('social_security_expense_account',$expense_accounts,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('social_security_payable_account',__('payroll.social_security_payable_account')) }}
|
|
{{ Form::select('social_security_payable_account',$payable_accounts,'',['class' => 'form-control compulsory','required']) }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('memo', __('payroll.memo')) }}
|
|
<textarea name="memo" placeholder="Memo" class="form-control compulsory" required rows="5"></textarea>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>{{ __('payroll.employee_name') }}</th>
|
|
<th>{{ __('payroll.payroll_category') }}</th>
|
|
<th>{{ __('payroll.basic_pay') }}</th>
|
|
<th>{{ __('payroll.allowances') }}</th>
|
|
<th>{{ __('payroll.gross_pay') }}</th>
|
|
<th>{{ __('payroll.tax_amount') }}</th>
|
|
<th>{{ __('payroll.social_security_amount') }}</th>
|
|
<th>{{ __('payroll.deductions') }}</th>
|
|
<th>{{ __('payroll.total_deductions') }}</th>
|
|
<th>{{ __('payroll.net_pay') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($employees as $employee)
|
|
<tr id="row_{{ $employee->id }}" class="to_remove">
|
|
<td>
|
|
<input type="checkbox" id="chk" class="employee_check" value="{{ $employee->id }}" />
|
|
{{ Form::hidden('employee_id[]', $employee->id) }}
|
|
</td>
|
|
<td>{{ $employee->first_name . ' ' . $employee->last_name }} ({{ $employee->number }})</td>
|
|
<td>{{ $payroll_categories[$employee->payroll_category] }}</td>
|
|
{{ Form::hidden('payroll_category[]', $employee->payroll_category) }}
|
|
@php
|
|
$deductions = 0;
|
|
$allowances = 0;
|
|
$deductions_arr = [];
|
|
$allowances_arr = [];
|
|
|
|
$allow_deducts = \Illuminate\Support\Facades\DB::table('payroll_allowances_or_deductions')->where('billed', 0)->where('member_id', $employee->id)->whereNull('deleted_at')->get();
|
|
|
|
foreach ($allow_deducts as $allow_deduct) {
|
|
if ($allow_deduct->type == 0) {
|
|
$allowances += $allow_deduct->amount;
|
|
$allowances_arr[] = $allow_deduct->id;
|
|
} else {
|
|
$deductions += $allow_deduct->amount;
|
|
$deductions_arr[] = $allow_deduct->id;
|
|
}
|
|
}
|
|
|
|
$gross_pay = $employee->basic_pay + $allowances;
|
|
$total_deductions = $employee->tax_amount + $employee->social_security_amount + $deductions;
|
|
@endphp
|
|
{{ Form::hidden('allowances_arr[]', implode(',', $allowances_arr), ['id' => 'allowances_arr_' . $employee->id]) }}
|
|
{{ Form::hidden('deductions_arr[]', implode(',', $deductions_arr), ['id' => 'deductions_arr_' . $employee->id]) }}
|
|
|
|
<td>{{ Form::number('basic_pay[]', $employee->basic_pay, ['class' => 'form-control compulsory basic_pay_field', 'required', 'id' => 'basic_pay_' . $employee->id]) }}</td>
|
|
<td>
|
|
{{ Form::number('allowance[]', $allowances, ['class' => 'form-control compulsory allowance_field', 'readonly', 'required', 'id' => 'allowance_' . $employee->id]) }}
|
|
|
|
<a href="#row_{{ $employee->id }}" onclick="view_allowances({{ $employee->id }})">View Allowances</a>
|
|
</td>
|
|
<td>{{ Form::number('gross_pay[]', $gross_pay, ['class' => 'form-control compulsory gross_pay_field', 'readonly', 'required', 'id' => 'gross_pay_' . $employee->id]) }}</td>
|
|
<td>{{ Form::number('tax[]', $employee->tax_amount, ['class' => 'form-control compulsory tax_field', 'required', 'id' => 'tax_' . $employee->id]) }}</td>
|
|
<td>{{ Form::number('social_security[]', $employee->social_security_amount, ['class' => 'form-control compulsory social_security_field', 'required', 'id' => 'social_security_' . $employee->id]) }}</td>
|
|
<td>
|
|
{{ Form::number('deductions[]', $deductions, ['class' => 'form-control compulsory deductions_field', 'readonly', 'required', 'id' => 'deductions_' . $employee->id]) }}
|
|
|
|
<a href="#row_{{ $employee->id }}" onclick="view_deductions({{ $employee->id }})">View Deductions</a>
|
|
</td>
|
|
<td>{{ Form::number('total_deductions[]', $total_deductions, ['class' => 'form-control compulsory total_deductions_field', 'readonly', 'required', 'id' => 'total_deductions_' . $employee->id]) }}</td>
|
|
<td>{{ Form::number('net_pay[]', ($gross_pay - $total_deductions), ['class' => 'form-control compulsory net_pay_field', 'readonly', 'required', 'id' => 'net_pay_' . $employee->id]) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
|
|
<tr>
|
|
<td><b>TOTALS</b></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td id="basic_pay_total"></td>
|
|
<td id="allowance_total"></td>
|
|
<td id="gross_pay_total"></td>
|
|
<td id="tax_total"></td>
|
|
<td id="social_security_total"></td>
|
|
<td id="deductions_total"></td>
|
|
<td id="total_deductions_total"></td>
|
|
<td id="net_pay_total"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<input type="button" id="confirm_selection_btn" class="btn btn-success btn-rounded pull-right" value="{{ __('payroll.confirm_selection') }}" />
|
|
<button class="btn btn-success btn-rounded pull-right" style="display: none;" id="submit_selection_btn">{{ __('payroll.submit') }}</button>
|
|
|
|
<br><br>
|
|
|
|
{{ Form::close() }}
|
|
@endif
|
|
</div>
|
|
|
|
<div class="modal" id="modal_allowance_details" tabindex="-1" role="dialog" aria-labelledby="debt_plan_modal_label" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">Allowance/Deduction Details</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('payroll.type') }}</th>
|
|
<th>{{ __('payroll.amount') }}</th>
|
|
<th>{{ __('payroll.is_recurring') }}</th>
|
|
<th>{{ __('payroll.recurring_final_date') }}</th>
|
|
<th>{{ __('payroll.reason') }}</th>
|
|
<th>{{ __('payroll.created_by') }}</th>
|
|
<th>{{ __('payroll.created_on') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="allowance_deductions_details_body"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
|
|
|
<script>
|
|
$(document).ready(function (){
|
|
calculate_totals();
|
|
});
|
|
|
|
function view_allowances(id) {
|
|
let ids = $('#allowances_arr_' + id).val();
|
|
|
|
if (ids !== '') {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "/payroll_schedules/get_allowance_deductions_details",
|
|
data: {'ids':ids},
|
|
cache: false,
|
|
success: function (result) {
|
|
$('#allowance_deductions_details_body').html(result);
|
|
$('#modal_allowance_details').modal('show')
|
|
}
|
|
});
|
|
} else {
|
|
alert('No allowances available');
|
|
}
|
|
}
|
|
|
|
function view_deductions(id) {
|
|
let ids = $('#deductions_arr_' + id).val();
|
|
|
|
if (ids !== '') {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "/payroll_schedules/get_allowance_deductions_details",
|
|
data: {'ids':ids},
|
|
cache: false,
|
|
success: function (result) {
|
|
$('#allowance_deductions_details_body').html(result);
|
|
$('#modal_allowance_details').modal('show')
|
|
}
|
|
});
|
|
} else {
|
|
alert('No allowances available');
|
|
}
|
|
}
|
|
|
|
function calculate_totals() {
|
|
let basic_pay_total = 0;
|
|
let allowance_total = 0;
|
|
let gross_pay_total = 0;
|
|
let tax_total = 0;
|
|
let social_security_total = 0;
|
|
let deductions_total = 0;
|
|
let total_deductions_total = 0;
|
|
let net_pay_total = 0;
|
|
|
|
$(".basic_pay_field").each(function(){
|
|
basic_pay_total += +$(this).val();
|
|
});
|
|
|
|
$(".allowance_field").each(function(){
|
|
allowance_total += +$(this).val();
|
|
});
|
|
|
|
$(".gross_pay_field").each(function(){
|
|
gross_pay_total += +$(this).val();
|
|
});
|
|
|
|
$(".tax_field").each(function(){
|
|
tax_total += +$(this).val();
|
|
});
|
|
|
|
$(".social_security_field").each(function(){
|
|
social_security_total += +$(this).val();
|
|
});
|
|
|
|
$(".deductions_field").each(function(){
|
|
deductions_total += +$(this).val();
|
|
});
|
|
|
|
$(".total_deductions_field").each(function(){
|
|
total_deductions_total += +$(this).val();
|
|
});
|
|
|
|
$(".net_pay_field").each(function(){
|
|
net_pay_total += +$(this).val();
|
|
});
|
|
|
|
$('#basic_pay_total').text(numberWithCommas(basic_pay_total));
|
|
$('#allowance_total').text(numberWithCommas(allowance_total));
|
|
$('#gross_pay_total').text(numberWithCommas(gross_pay_total));
|
|
$('#tax_total').text(numberWithCommas(tax_total));
|
|
$('#social_security_total').text(numberWithCommas(social_security_total));
|
|
$('#deductions_total').text(numberWithCommas(deductions_total));
|
|
$('#total_deductions_total').text(numberWithCommas(total_deductions_total));
|
|
$('#net_pay_total').text(numberWithCommas(net_pay_total));
|
|
}
|
|
|
|
function numberWithCommas(x) {
|
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
|
|
$('#due_date').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd/mm/yyyy'
|
|
});
|
|
|
|
$('.employee_check').click(function() {
|
|
if($(this).is(':checked')){
|
|
$(this).parent().parent().css({'background-color': '#FFFF99'});
|
|
$('#row_' + $(this).val()).removeClass('to_remove');
|
|
} else{
|
|
$(this).parent().parent().css({'background-color': '#fff'});
|
|
$('#row_' + $(this).val()).addClass('to_remove');
|
|
}
|
|
});
|
|
|
|
$("#confirm_selection_btn").click(function (e) {
|
|
let is_employee_selected = $('input:checkbox').is(':checked');
|
|
|
|
if (is_employee_selected) {
|
|
$(".to_remove").remove();
|
|
$(".employee_check").attr("disabled", "disabled");
|
|
|
|
$('#submit_selection_btn').show();
|
|
$('#confirm_selection_btn').hide();
|
|
calculate_totals();
|
|
} else {
|
|
e.preventDefault();
|
|
alert("Please select an employee before continuing");
|
|
return false;
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|