mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
resolved conflicts
This commit is contained in:
+590
@@ -0,0 +1,590 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.journals') }}</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> {{ __('finance_reports.dashboard') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('finance.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.journals') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('journals::journals.menu')
|
||||
@include('flash::message')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
|
||||
{{ Form::open(['method'=>'post','route' => 'journals.create']) }}
|
||||
<div class="row">
|
||||
|
||||
<div class='col-md-3'>
|
||||
<div id='journalDate'>
|
||||
<div class='form-group'>
|
||||
{{ Form::label('journal_date', __('finance.journal_date')) }}
|
||||
<div class='input-group'>
|
||||
{{ Form::text('journal_date', '', ['class'=>'form-control required compulsory', 'required', 'readonly', 'id'=>'journal_date']) }}
|
||||
<span class='input-group-addon'><i class='icon-calender'></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='col-md-6'></div>
|
||||
|
||||
<div class='col-md-3'>
|
||||
<div id='journalNumber'>
|
||||
<div class='form-group'>
|
||||
{{ Form::label('journal_number', __('finance.journal_number')) }}
|
||||
{{ Form::text('journal_number', $journal_number, ['class'=>'form-control required compulsory', 'required', 'readonly', 'id'=>'journal_number']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr/>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<div id='payments_items'>
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class='row'>
|
||||
<div class='col-1'>#</div>
|
||||
<div class='col-2'>{{ __('finance.account') }}</div>
|
||||
<div class='col-2'>{{ __('finance.debits') }}</div>
|
||||
<div class='col-2'>{{ __('finance.credit') }}</div>
|
||||
<div class='col-1'>{{ __('finance.description') }}</div>
|
||||
<div class='col-1'>{{ __('finance.type') }}</div>
|
||||
<div class='col-2'>{{ __('finance.name') }}</div>
|
||||
<div class='col-1'></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@php
|
||||
$option_accounts = "<option value=''>-select-</option>";
|
||||
foreach ($accounts as $account) {
|
||||
$option_accounts .= "<option value='$account->id'>$account->name (" . get_name($account->type, 'id', 'name', 'account_types') . ")</option>";
|
||||
}
|
||||
|
||||
$option_types = "<option value=''>-" . __('finance.select') . "-</option>";
|
||||
$option_types .= "<option value='1'>" . __('finance.customer') . "</option>";
|
||||
$option_types .= "<option value='2'>" . __('finance.supplier') . "</option>";
|
||||
$option_types .= "<option value='3'>" . __('finance.employee') . "</option>";
|
||||
$option_types .= "<option value='4'>" . __('finance.patient_categories') . "</option>";
|
||||
$option_types .= "<option value='5'>" . __('finance.payment_items') . "</option>";
|
||||
|
||||
$option_customers = "<option value=''>-" . __('finance.select') . "-</option>";
|
||||
foreach($customers as $customer){
|
||||
$option_customers .= "<option value='$customer->id'>$customer->first_name $customer->last_name</option>";
|
||||
}
|
||||
|
||||
$option_suppliers = "<option value=''>-" . __('finance.select') . "-</option>";
|
||||
foreach ($suppliers as $supplier){
|
||||
$option_suppliers .= "<option value='$supplier->id'>$supplier->name</option>";
|
||||
}
|
||||
|
||||
$option_employees = "<option value=''>-" . __('finance.select') . "-</option>";
|
||||
foreach ($employees as $employee){
|
||||
$option_employees .= "<option value='$employee->id'>$employee->first_name $employee->last_name</option>";
|
||||
}
|
||||
|
||||
$option_patient_categories = "<option value=''>-" . __('finance.select') . "-</option>";
|
||||
foreach ($patient_categories as $category){
|
||||
$option_patient_categories .= "<option value='$category->id'>$category->name</option>";
|
||||
}
|
||||
|
||||
$option_payment_items = "<option value=''>-" . __('finance.select') . "-</option>";
|
||||
foreach ($payment_items as $payment_item){
|
||||
$option_payment_items .= "<option value='$payment_item->id'>$payment_item->name</option>";
|
||||
}
|
||||
$back_date = \Streamline\Models\HospitalInformation::first()->pluck('back_date');
|
||||
@endphp
|
||||
|
||||
<tbody class='input_fields_wrap'>
|
||||
<tr>
|
||||
<td>
|
||||
<div class='row'>
|
||||
|
||||
<div class='col-1'>
|
||||
<label style='margin-top: 10px;'>1.</label>
|
||||
</div>
|
||||
|
||||
<div class='col-2'>
|
||||
<div class='control-group'>
|
||||
<div class='form-group'>
|
||||
<select name='account_id[]' id='account_0' class='form-control compulsory required item_select' required>
|
||||
@php echo $option_accounts; @endphp
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='col-2'>
|
||||
<div class='form-group'>
|
||||
<div class='controls'>
|
||||
<input type='number' name='debit[]' id ='debit_0' class='form-control debit'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='col-2'>
|
||||
<div class='form-group'>
|
||||
<div class='controls'>
|
||||
<input type='number' name='credit[]' id='credit_0' class='form-control credit'/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='col-1'>
|
||||
<div class='form-group'>
|
||||
<div class='controls'>
|
||||
<input type='text' name='description[]' id='description_0' class='form-control compulsory' required/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='col-1'>
|
||||
<div class='control-group'>
|
||||
<div id='type_selected_0' class='form-group'>
|
||||
<select name='type_id[]' id='type_0' class='form-control type_select'>
|
||||
@php echo $option_types; @endphp
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='col-2'>
|
||||
<div class='control-group'>
|
||||
<div id='customer_selected_0' class='form-group name_select'>
|
||||
<select name='customer_id[]' id='customer_0' class='form-control item_select'>
|
||||
@php echo $option_customers; @endphp
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id='supplier_selected_0' class='form-group name_select'>
|
||||
<select name='supplier_id[]' id='supplier_0' class='form-control item_select'>
|
||||
@php echo $option_suppliers; @endphp
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id='employee_selected_0' class='form-group name_select'>
|
||||
<select name='employee_id[]' id='employee_0' class='form-control item_select'>
|
||||
@php echo $option_employees; @endphp
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id='category_selected_0' class='form-group name_select'>
|
||||
<select name='category_id[]' id='category_0' class='form-control item_select'>
|
||||
@php echo $option_patient_categories; @endphp
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id='payment_item_selected_0' class='form-group name_select'>
|
||||
<select name='payment_item_id[]' id='payment_item_0' class='form-control item_select'>
|
||||
@php echo $option_payment_items; @endphp
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<input type='hidden' name='name_id[]' id='name_0' />
|
||||
<input type='hidden' name='invoice_number[]' id='invoice_number_0' placeholder="Invoice Number" />
|
||||
</div>
|
||||
|
||||
{{-- <div class='col-1'>
|
||||
<div class='form-group' style='margin-top: 10px;'>
|
||||
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></button>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<tfoot class='footer_input_fields_wrap'>
|
||||
<tr>
|
||||
<td>
|
||||
<div class='row'>
|
||||
<div class='col-1'></div>
|
||||
<div class='col-2'><strong>{{ __('finance.total') }}</strong></div>
|
||||
<div class='col-2'>
|
||||
<input type="number" name="total_debits" id="total_debits" class="form-control" readonly='true' value='0' />
|
||||
</div>
|
||||
<div class='col-2'>
|
||||
<input type="number" name="total_credits" id="total_credits" class="form-control" readonly='true' value='0' />
|
||||
</div>
|
||||
<div class="col-2"></div>
|
||||
<div class='col-1'>
|
||||
<div class='form-group' style='margin-top: 10px;'>
|
||||
<button class='btn btn-sm btn-rounded btn-success pull-right add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i> Add Row</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-2'></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class='row'>
|
||||
<div class='col-md-9'>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<button class='btn btn-rounded btn-primary pull-right' id='journal_action' name='journal_action' value='save'>{{ __('finance.save_journal') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(".name_select").hide();
|
||||
$(".invoice_number").hide();
|
||||
$("#journal_action").attr('disabled', 'disabled');
|
||||
});
|
||||
let min_days = <?php echo $back_date[0]; ?>;
|
||||
var min_date = new Date();
|
||||
min_date.setDate(min_date.getDate() - min_days);
|
||||
$('#journal_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
endDate: new Date(),
|
||||
startDate: min_date,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
|
||||
var max_rows = 20;
|
||||
var wrapper = $(".input_fields_wrap"); //Fields wrapper
|
||||
var add_button = $(".add_item");
|
||||
|
||||
var x = 1; // initial row count
|
||||
|
||||
add_button.click(function (e) { // on add input button click
|
||||
e.preventDefault();
|
||||
if (x < max_rows) {
|
||||
$(wrapper).append("\
|
||||
\<tr>\
|
||||
<td>\
|
||||
<div class='row'>\
|
||||
\
|
||||
<div class='col-1'>\
|
||||
<label style='margin-top: 10px;'>" + parseInt(x + 1) + ". " + "</label>\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-2'>\
|
||||
<div class='control-group'>\
|
||||
<div class='form-group'>\
|
||||
<select name='account_id[]' id='account_" + x + "' class='form-control compulsory required item_select' required>" +
|
||||
"<?php echo $option_accounts; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-2'>\
|
||||
<div class='form-group'>\
|
||||
<div class='controls'>\
|
||||
<input type='number' name='debit[]' id ='debit_" + x + "' class='form-control debit'>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-2'>\
|
||||
<div class='form-group'>\
|
||||
<div class='controls'>\
|
||||
<input type='number' name='credit[]' id ='credit_" + x + "' class='form-control credit'>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-1'>\
|
||||
<div class='form-group'>\
|
||||
<div class='controls'>\
|
||||
<input type='text' name='description[]' id ='description_" + x + "' class='form-control compulsory' required>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-1'>\
|
||||
<div class='control-group'>\
|
||||
<div id='type_selected_" + x + "' class='form-group'>\
|
||||
<select name='type_id[]' id='type_" + x + "' class='form-control type_select'>" +
|
||||
"<?php echo $option_types; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-2'>\
|
||||
<div class='control-group'>\
|
||||
<div id='customer_selected_" + x + "' class='form-group name_select'>\
|
||||
<select name='customer_id[]' id='customer_" + x + "' class='form-control item_select'>" +
|
||||
"<?php echo $option_customers; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
\
|
||||
<div id='supplier_selected_" + x + "' class='form-group name_select'>\
|
||||
<select name='supplier_id[]' id='supplier_" + x + "' class='form-control item_select'>" +
|
||||
"<?php echo $option_suppliers; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
\
|
||||
<div id='employee_selected_" + x + "' class='form-group name_select'>\
|
||||
<select name='employee_id[]' id='employee_" + x + "' class='form-control item_select'>" +
|
||||
"<?php echo $option_employees; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
\
|
||||
<div id='category_selected_" + x + "' class='form-group name_select'>\
|
||||
<select name='category_id[]' id='category_" + x + "' class='form-control item_select'>" +
|
||||
"<?php echo $option_patient_categories; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
\
|
||||
<div id='payment_item_selected_" + x + "' class='form-group name_select'>\
|
||||
<select name='payment_item_id[]' id='payment_item_" + x + "' class='form-control item_select'>" +
|
||||
"<?php echo $option_payment_items; ?>" +
|
||||
"</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
<input type='hidden' name='name_id[]' id='name_" + x + "' />\
|
||||
<input type='hidden' name='invoice_number[]' id='invoice_number_" + x + "' placeholder='Invoice Number' />\
|
||||
</div>\
|
||||
\
|
||||
<div class='col-1'>\
|
||||
<div class='form-group' style='margin-top: 10px;'>\
|
||||
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>"); // add row
|
||||
|
||||
$("#customer_selected_" + x).hide();
|
||||
$("#supplier_selected_" + x).hide();
|
||||
$("#employee_selected_" + x).hide();
|
||||
$("#category_selected_" + x).hide();
|
||||
$("#payment_item_selected_" + x).hide();
|
||||
|
||||
$("select.type_select").change(function(){
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
var type_selected = $(this).children("option:selected").val();
|
||||
|
||||
if (type_selected == '1') {
|
||||
$("#customer_selected_" + id).show();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '2') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).show();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '3') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).show();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '4') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).show();
|
||||
$("#invoice_number_" + id).attr('type', 'text');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '5') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).show();
|
||||
} else {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
}
|
||||
$("#name_" + id).val('');
|
||||
$("#customer_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#supplier_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#employee_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#category_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#payment_item_selected_" + id + " option[value='']").prop('selected', true);
|
||||
});
|
||||
|
||||
$("select.item_select").change(function(){
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
var name_selected = $(this).children("option:selected").val();
|
||||
$("#name_" + id).val(parseInt(name_selected));
|
||||
});
|
||||
$('#account_'+x).select2();
|
||||
|
||||
x++;
|
||||
}
|
||||
});
|
||||
|
||||
$(wrapper).on("click", ".remove_field", function (e) {
|
||||
e.preventDefault();
|
||||
$(this).parent('div').parent('div').parent('div').parent('td').parent('tr').remove();
|
||||
|
||||
calculateTotalDebits();
|
||||
calculateTotalCredits();
|
||||
|
||||
// x--; // decrementing messes up the id referencing. If you're decrementing in this way, you're probably not submitting some data!!!!!!
|
||||
});
|
||||
|
||||
$('#account_0').select2();
|
||||
|
||||
$("select.type_select").change(function(){
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
var type_selected = $(this).children("option:selected").val();
|
||||
|
||||
if (type_selected == '1') {
|
||||
$("#customer_selected_" + id).show();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '2') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).show();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '3') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).show();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '4') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).show();
|
||||
$("#invoice_number_" + id).attr('type', 'text');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
} else if (type_selected == '5') {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).show();
|
||||
} else {
|
||||
$("#customer_selected_" + id).hide();
|
||||
$("#supplier_selected_" + id).hide();
|
||||
$("#employee_selected_" + id).hide();
|
||||
$("#category_selected_" + id).hide();
|
||||
$("#invoice_number_" + id).attr('type', 'hidden');
|
||||
$("#payment_item_selected_" + id).hide();
|
||||
}
|
||||
$("#name_" + id).val('');
|
||||
$("#customer_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#supplier_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#employee_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#category_selected_" + id + " option[value='']").prop('selected', true);
|
||||
$("#payment_item_selected_" + id + " option[value='']").prop('selected', true);
|
||||
});
|
||||
|
||||
$("select.item_select").change(function(){
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
var name_selected = $(this).children("option:selected").val();
|
||||
$("#name_" + id).val(parseInt(name_selected));
|
||||
});
|
||||
|
||||
$(".input_fields_wrap").on('change', ".debit", function () {
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
|
||||
// empty the adjacent credit field
|
||||
$("#credit_" + id).val(null);
|
||||
|
||||
calculateTotalDebits();
|
||||
calculateTotalCredits();
|
||||
});
|
||||
|
||||
$(".input_fields_wrap").on('change', ".credit", function () {
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
|
||||
// empty the adjacent debit field
|
||||
$("#debit_" + id).val(null);
|
||||
|
||||
calculateTotalDebits();
|
||||
calculateTotalCredits();
|
||||
});
|
||||
|
||||
function calculateTotalDebits() {
|
||||
var total_debits = 0;
|
||||
$("[id^='debit_']").each(function () {
|
||||
if ($(this).val() != null) {
|
||||
total_debits += Number($(this).val());
|
||||
}
|
||||
});
|
||||
$("#total_debits").val(total_debits);
|
||||
}
|
||||
|
||||
function calculateTotalCredits() {
|
||||
var total_credits = 0;
|
||||
$("[id^='credit_']").each(function () {
|
||||
if ($(this).val() != null) {
|
||||
total_credits += Number($(this).val());
|
||||
}
|
||||
});
|
||||
$("#total_credits").val(total_credits);
|
||||
}
|
||||
|
||||
// enable / diable submit button
|
||||
$(".input_fields_wrap").on('change', ".credit, .debit", function () {
|
||||
if ($('#journal_date').val() !== '' && ($('#total_debits').val() === $('#total_credits').val())) {
|
||||
$('#journal_action').removeAttr("disabled");
|
||||
} else {
|
||||
$('#journal_action').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('#journal_date').on('change', function() {
|
||||
// validating the journal_date because the basic `required` rule fails to work on that field
|
||||
if ($('#journal_date').val() !== '' && ($('#total_debits').val() === $('#total_credits').val())) {
|
||||
$('#journal_action').removeAttr("disabled");
|
||||
} else {
|
||||
$('#journal_action').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<a href="{{ route('journals') }}" class="nav-item btn btn-success" style="border-radius: 5px;"><i class="fa fa-plus"></i> <span style="margin-left: 5px">{{ __('finance.journals') }}</span></a>
|
||||
<a href="{{ route('journals.records') }}" class="nav-item btn btn-success" style="border-radius: 5px;"><i class="fa fa-plus"></i> <span style="margin-left: 5px">{{ __('finance.past_records') }}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
+390
@@ -0,0 +1,390 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.journals_records') }}</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> {{ __('finance_reports.dashboard') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('finance.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.journals_records') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('journals::journals.menu')
|
||||
|
||||
<div class="white-box">
|
||||
{{ Form::open(['route' => 'journals.records']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('created_by', __('finance.staff_member')) }}
|
||||
{{ Form::select('created_by', $created_by, null, ['class' => 'form-control compulsory','required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('date_range', __('finance.select_date')) }}
|
||||
<div class="input-group">
|
||||
<select class="form-control compulsory required" id="dates" name="dates" required>
|
||||
<option value="ALL">{{ __('finance.all_dates') }}</option>
|
||||
<option value="today">{{ __('finance.today') }}</option>
|
||||
<option value="yesterday">{{ __('finance.yesterday') }}</option>
|
||||
<option value="week">{{ __('finance.last_7_days') }}</option>
|
||||
<option value="month">{{ __('finance.last_30_days') }}</option>
|
||||
<option value="custom-date">{{ __('finance.custom_date') }}</option>
|
||||
<option value="custom-range">{{ __('finance.date_range') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-3" style="display: none;" id="start-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('start_date', __('finance.date_from')) }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-from']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="end-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('end_date', __('finance.date_to')) }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-to']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-11"></div>
|
||||
<div class="col-md-1">
|
||||
{{ Form::button(__('finance.search'), ['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="white-box">
|
||||
<p class="text-muted m-b-30">{{ __('finance.export_data_to_copy_csv_pdf_print') }}</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('finance.journal_number') }}</th>
|
||||
<th>{{ __('finance.journal_date') }}</th>
|
||||
<th>{{ __('finance.account') }}</th>
|
||||
<th>{{ __('finance.debits') }}</th>
|
||||
<th>{{ __('finance.credit') }}</th>
|
||||
<th>{{ __('finance.description') }}</th>
|
||||
<th>{{ __('finance.type') }}</th>
|
||||
<th>{{ __('finance.name') }}</th>
|
||||
<th>{{ __('finance.created_by') }}</th>
|
||||
<th>{{ __('finance.date_and_time') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(count($journals) > 0)
|
||||
@foreach($journals as $journal)
|
||||
@php
|
||||
$account_ids = explode(",", $journal->account_ids);
|
||||
$accounts_text = "";
|
||||
for ($i = 0; $i < count($account_ids); $i++) {
|
||||
$accounts_text .= ($i + 1) . ". " . get_name($account_ids[$i], 'id' , 'name' , 'chart_of_accounts' ) . ". <br>" ;
|
||||
}
|
||||
|
||||
$debits=explode(",", $journal->debits);
|
||||
$debits_text = "";
|
||||
for ($i = 0; $i < count($debits); $i++) {
|
||||
$debits_text .= ($i + 1) . ". " . (($debits[$i] !=null) ? ugandan_shillings((int)$debits[$i]) : "" ) . ". <br>" ;
|
||||
}
|
||||
|
||||
$credits=explode(",", $journal->credits);
|
||||
$credits_text = "";
|
||||
for ($i = 0; $i < count($credits); $i++) {
|
||||
$credits_text .= ($i + 1) . ". " . (($credits[$i] !=null) ? ugandan_shillings((int)$credits[$i]) : "" ) . ". <br>" ;
|
||||
}
|
||||
|
||||
$descriptions=explode(",", $journal->descriptions);
|
||||
$descriptions_text = "";
|
||||
for ($i = 0; $i < count($descriptions); $i++) {
|
||||
$descriptions_text .= ($i + 1) . ". " . $descriptions[$i] . " <br>" ;
|
||||
}
|
||||
|
||||
$type_ids=explode(",", $journal->type_ids);
|
||||
$name_ids = explode(",", $journal->name_ids);
|
||||
$types_text = "";
|
||||
$names_text = "";
|
||||
for ($i = 0; $i < count($type_ids); $i++) {
|
||||
if ($type_ids[$i]=='1' ) {
|
||||
$types_text .=__('finance.customer') . ". <br>" ;
|
||||
if ($name_ids[$i] !=null) {
|
||||
$names_text .= ($i + 1) . ". " . get_full_name($name_ids[$i], 'id' , 'first_name' , 'last_name' , 'patients' ) . ". <br>" ;
|
||||
} else {
|
||||
$names_text .= ($i + 1) . ". <br>" ;
|
||||
}
|
||||
} else if ($type_ids[$i]=='2' ) {
|
||||
$types_text .=__('finance.supplier') . ". <br>" ;
|
||||
if ($name_ids[$i] !=null) {
|
||||
$names_text .= ($i + 1) . ". " . get_name($name_ids[$i], 'id' , 'name' , 'suppliers' ) . ". <br>" ;
|
||||
} else {
|
||||
$names_text .= ($i + 1) . ". <br>" ;
|
||||
}
|
||||
} else if ($type_ids[$i]=='3' ) {
|
||||
$types_text .=__('finance.employee') . ". <br>" ;
|
||||
if ($name_ids[$i] !=null) {
|
||||
$names_text .=get_full_name($name_ids[$i], 'id' , 'first_name' , 'last_name' , 'users' ) . ". <br>" ;
|
||||
} else {
|
||||
$names_text .= ($i + 1) . ". <br>" ;
|
||||
}
|
||||
} else if ($type_ids[$i]=='4' ) {
|
||||
$types_text .=__('finance.patient_categories') . ". <br>" ;
|
||||
if ($name_ids[$i] !=null) {
|
||||
$names_text .= ($i + 1) . ". " . get_name($name_ids[$i], 'id' , 'name' , 'patient_categories' ) . ". <br>" ;
|
||||
} else {
|
||||
$names_text .= ($i + 1) . ". <br>" ;
|
||||
}
|
||||
} else if ($type_ids[$i]=='5' ) {
|
||||
$types_text .=__('finance.payment_items') . ". <br>" ;
|
||||
if ($name_ids[$i] !=null) {
|
||||
$names_text .= ($i + 1) . ". " . get_name($name_ids[$i], 'id' , 'name' , 'payment_items' ) . ". <br>" ;
|
||||
} else {
|
||||
$names_text .= ($i + 1) . ". <br>" ;
|
||||
}
|
||||
} else {
|
||||
$types_text .= ($i + 1) . ". <br>" ;
|
||||
$names_text .= ($i + 1) . ". <br>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $journal->journal_number }}</td>
|
||||
<td>{{ streamline_date($journal->journal_date) }}</td>
|
||||
<td>
|
||||
{!! read_more($accounts_text, 'short_accounts' . $journal->journal_number, 'long_accounts' . $journal->journal_number) !!}
|
||||
<div id="long_accounts{{ $journal->journal_number }}" style="display: none;">
|
||||
{!! $accounts_text !!}<br />
|
||||
<a class="read_more" style="color : #0099CC;" onclick="hide('long_accounts{{ $journal->journal_number }}');show('short_accounts{{ $journal->journal_number }}');">Read Less</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{!! read_more($debits_text, 'short_debits' . $journal->journal_number, 'long_debits' . $journal->journal_number) !!}
|
||||
<div id="long_debits{{ $journal->journal_number }}" style="display: none;">
|
||||
{!! $debits_text !!}<br />
|
||||
<a class="read_more" style="color : #0099CC;" onclick="hide('long_debits{{ $journal->journal_number }}');show('short_debits{{ $journal->journal_number }}');">Read Less</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{!! read_more($credits_text, 'short_credits' . $journal->journal_number, 'long_credits' . $journal->journal_number) !!}
|
||||
<div id="long_credits{{ $journal->journal_number }}" style="display: none;">
|
||||
{!! $credits_text !!}<br />
|
||||
<a class="read_more" style="color : #0099CC;" onclick="hide('long_credits{{ $journal->journal_number }}');show('short_credits{{ $journal->journal_number }}');">Read Less</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{!! read_more($descriptions_text, 'short_descriptions' . $journal->journal_number, 'long_descriptions' . $journal->journal_number) !!}
|
||||
<div id="long_descriptions{{ $journal->journal_number }}" style="display: none;">
|
||||
{!! $descriptions_text !!}<br />
|
||||
<a class="read_more" style="color : #0099CC;" onclick="hide('long_descriptions{{ $journal->journal_number }}');show('short_descriptions{{ $journal->journal_number }}');">Read Less</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{!! read_more($types_text, 'short_types' . $journal->journal_number, 'long_types' . $journal->journal_number) !!}
|
||||
<div id="long_types{{ $journal->journal_number }}" style="display: none;">
|
||||
{!! $types_text !!}<br />
|
||||
<a class="read_more" style="color : #0099CC;" onclick="hide('long_types{{ $journal->journal_number }}');show('short_types{{ $journal->journal_number }}');">Read Less</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{!! read_more($names_text, 'short_names' . $journal->journal_number, 'long_names' . $journal->journal_number) !!}
|
||||
<div id="long_names{{ $journal->journal_number }}" style="display: none;">
|
||||
{!! $names_text !!}<br />
|
||||
<a class="read_more" style="color : #0099CC;" onclick="hide('long_names{{ $journal->journal_number }}');show('short_names{{ $journal->journal_number }}');">Read Less</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ get_full_name($journal->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
||||
<td>{{ streamline_date_time_short($journal->created_at) }}</td>
|
||||
<td>
|
||||
@if( Auth::user()->can('journals-delete'))
|
||||
@if(!is_null($journal->affected_tables))
|
||||
<button class="btn btn-sm btn-rounded btn-danger"
|
||||
onclick="journalCanBeDeleted('{{ $journal->id }}')" style="color: white"><i class="fa fa-trash"></i> {{ __('finance_reports.delete') }}</button>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Journal No.</th>
|
||||
<th>Journal Date</th>
|
||||
<th>Account</th>
|
||||
<th>Debits</th>
|
||||
<th>Credit</th>
|
||||
<th>Description</th>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Created By</th>
|
||||
<th>Date & Time</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="journalNotDeleteableReason" tabindex="-1" role="dialog" style="margin-top: 10px">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content" style="margin-top: 10px; padding-top: 15px;">
|
||||
<div class="modal-header">
|
||||
<span class="label label-info">Please note</span>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" style="padding: 10px;">
|
||||
<div class="col-sm-12">
|
||||
<h3><span id="reason_why"></span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">{{ __('payments.close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
pageLength: 50,
|
||||
order: [[ 0, "desc" ]]
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display === 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#datepicker-from, #datepicker-to').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy',
|
||||
});
|
||||
|
||||
$('#dates').change(function() {
|
||||
var val = $(this).val();
|
||||
switch (val) {
|
||||
case 'custom-date':
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
case 'custom-range':
|
||||
$('#end-date-div').show();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
default:
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/* check if it some conditions do not allow deletion of this journal*/
|
||||
// $("[id^='delete_journal_']").click(function(e){
|
||||
// //e.preventDefault();
|
||||
// var journal_id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
// console.log("journal_id ======== "+journal_id);
|
||||
|
||||
// $.ajax({
|
||||
// type: "post",
|
||||
// url: '/check_if_journal_can_be_deleted',
|
||||
// data: {'journal_id' : journal_id},
|
||||
// cache: false,
|
||||
|
||||
// success: function (result_array) {
|
||||
// console.log(result_array);
|
||||
// console.log("===returned array is above==");
|
||||
// if (result_array == true) {}
|
||||
// return confirm("Are you sure you want to delete this journal");
|
||||
// window.href.location = "journals_delete/"+journal_id;
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
function journalCanBeDeleted(id) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: '/check_if_journal_can_be_deleted',
|
||||
data: {'journal_id' : id},
|
||||
cache: false,
|
||||
|
||||
success: function (result_array) {
|
||||
console.log(result_array[0]);
|
||||
console.log("========");
|
||||
console.log(result_array[1]);
|
||||
console.log("===returned array is because==");
|
||||
if (result_array[0] == false) {
|
||||
$('#reason_why').text(result_array[1]);
|
||||
$('#journalNotDeleteableReason').modal('show');
|
||||
return false;
|
||||
alert(result_array[1]);//display why you can not delete message
|
||||
}
|
||||
//if the user confirmed then proceed to delete the journal
|
||||
if(confirm("Are you sure you want to delete this journal")){
|
||||
window.location.href = "journals_delete/"+id;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user