resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,573 @@
@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/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" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
<style>
.row_color {
background: gold;
}
</style>
@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">Bank Reconciliation</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 class="active"><i class="fa fa-bank"></i> Bank Reconciliation</li>
</ol>
</div>
</div>
@php
$balance = 0;
@endphp
<br />
@include('flash::message')
<div class="panel">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
{{ Form::open(['route' => 'banking.reconcile', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>Bank Account :</label>
<select class="form-control compulsory required" name="bank" id="bank" required>
<option value="">-select-</option>
@foreach($banks as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Reconciliation Date :</label>
<div class="input-group">
<input class="center form-control" id="reconciliation_date" readonly style="padding: 2px;border: 1px solid #ddd;" name="reconciliation_date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Opening Bank Balance (Stre@mline):</label>
<div class="input-group">
<input class="center form-control compulsory" required id="opening_balance" type="number" style="padding: 2px;border: 1px solid #ddd;" readonly name="opening_balance">
<span class="input-group-addon">.UGX</span>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Ending Balance (Bank Statement):</label>
<div class="input-group">
<input class="center form-control compulsory" required id="ending_balance_input" type="number" style="padding: 2px;border: 1px solid #ddd;" name="ending_balance_input">
<span class="input-group-addon">.UGX</span>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<button class="btn btn-success btn-block" style="margin-top: 25px;">Submit</button>
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
<hr />
<br />
@if(!empty($request->all()))
{{ Form::open(['route' => 'banking.finish_reconciling', 'data-toggle' => 'validator', 'id'=>'finish_reconciliation_form']) }}
@if(isset($display))
<div class="row">
<div class="col-md-12 text-center">
<h3 class="label label-megna label-rounded"> {!! isset($display) ? $display : '' !!}</h3>
</div>
</div>
@endif
<br />
<div class="row">
<div class="table-bordered col-md-8">
<div class="row">
<div class="col-md-5 text-center">
<h3>Ending Bank Statement Balance: </h3><span id="ending_balance" style="font-size: 3vw; display: none;">{{ $request->ending_balance_input }}</span>
<span id="ending_balance_display" style="font-size: 3vw;">{{ ugandan_shillings($request->ending_balance_input) }}</span>
</div>
<div class="col-md-2 text-center">
<b><span style="font-size: 4vw;"> - </span></b>
</div>
<div class="col-md-5 text-center">
<h3>Opening Stre@mline Bank Balance: </h3> <b style="display: none;"><span id="balance" style="font-size: 3vw;">{{ is_null($request->opening_balance) ? 0 : $request->opening_balance }}</span></b>
<b><span id="balance_display" style="font-size: 3vw;">{{ is_null($request->opening_balance) ? 0 : ugandan_shillings($request->opening_balance) }}</span></b>
</div>
</div>
</div>
<div class="col-md-4 text-center">
<h3>Difference: </h3><b>
<span id="difference" style="font-size: 3vw; display: none">{{ (int)$request->ending_balance_input - (int)$request->opening_balance }}</span>
<span id="difference_display" style="font-size: 3vw;">{{ ugandan_shillings((int)$request->ending_balance_input - (int)$request->opening_balance) }}</span>
</b>
</div>
</div>
<input type="hidden" value="{{ is_null($request->opening_balance) ? 0 : $request->opening_balance }}" id="old_balance">
<input type="hidden" value="{{ (int)$request->ending_balance_input - (int)$request->opening_balance }}" id="old_difference">
<input type="hidden" name="ending_bank_statement_balance" value="{{ $request->ending_balance_input }}">
<input type="hidden" name="opening_streamline_balance" value="{{ $request->opening_balance }}">
<input type="hidden" name="reconciliation_period" value="{{ $reconciliation_end_date }}">
<input type="hidden" name="bank" value="{{ $request->bank }}">
<br />
<hr>
<div class="row">
<div class="col-md-9 b-r">
<div class="row">
<div class="col-md-12">
@php
$sum_balance = 0;
$sum_credit = 0;
$sum_debit = 0;
@endphp
<div class="table-responsive">
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Transaction Date :</th>
<th>Record Date :</th>
<th>Staff In-Charge :</th>
<th>Type</th>
<th>Account</th>
<th>Memo</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@php
$counter = 1;
@endphp
@if(count($banking_records) > 0)
@foreach($banking_records as $record)
@php
$sum_credit += $record->credit;
$sum_debit += $record->debit;
@endphp
<tr id="record_row_{{ $record->id }}">
<td>{{ $counter }}.</td>
<td>{{ streamline_date($record->trans_date) }}</td>
<td>{{ streamline_date($record->created_at) }}</td>
<td>{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ $record->trans_type }}</td>
@php
$banks = explode(',',$record->bank);
$other_accounts = explode(',',$record->other_accounts);
@endphp
<td>
@for($x = 0; $x
< count($other_accounts); $x++) {{ get_name($other_accounts[$x], 'id', 'name', 'chart_of_accounts') }} <br />
@endfor
</td>
<td>{{ $record->memo }}</td>
@if($record->debit != 0)
<td>{{ ugandan_shillings($record->debit) }}</td>
<input id="debit_amount_{{ $record->id }}" value="{{ $record->debit }}" type="hidden">
@else
<td>{{ ugandan_shillings(0) }}</td>
<input id="debit_amount_{{ $record->id }}" value="{{ 0 }}" type="hidden">
@endif
@if($record->credit != 0)
<td>{{ ugandan_shillings($record->credit) }}</td>
<input id="credit_amount_{{ $record->id }}" value="{{ $record->credit }}" type="hidden">
@else
<td>{{ ugandan_shillings(0) }}</td>
<input id="credit_amount_{{ $record->id }}" value="{{ 0 }}" type="hidden">
@endif
<td>{{ ugandan_shillings($record->account_balance) }}</td>
@if($loop->last)
@php $sum_balance = $record->account_balance; @endphp
@endif
<td class="text-center">
@if($record->debit != 0)
<input type="checkbox" name="reconciled_trans_ids[]" value="{{ $record->id }}" id="debit_checkbox_{{ $record->id }}">
@elseif($record->credit != 0)
<input type="checkbox" name="reconciled_trans_ids[]" value="{{ $record->id }}" id="credit_checkbox_{{ $record->id }}">
@elseif($record->debit == 0 && $record->credit == 0)
<input type="checkbox" name="reconciled_trans_ids[]" value="{{ $record->id }}" id="debit_checkbox_{{ $record->id }}">
@endif
<input type="hidden" name="unreconciled_trans_ids[]" value="{{ $record->id }}" id="unreconciled_checkbox_{{ $record->id }}" checked>
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-12">
<hr>
<div class="form-group">
{{ Form::label('memo', 'Reconciliation Memo / Comment (Optional)', ['style' => 'font-size: 18px; font-weight: 400'])}}
{{ Form::textarea('memo','',['class' => 'form-control'])}}
</div>
</div>
<div class="col-md-12 pull-right text-right">
<button class="btn btn-primary btn-rounded" id="finish_reconciliation">Finish Reconciliation</button>
</div>
</div>
</div>
<br>
<div class="col-md-3">
<br />
<h3><strong>Previous Reconciliation Reports</strong></h3>
<ul>
@foreach($reconciliation_reports as $report)
<li>
<a target="_blank" href="{{ route('bank.reconciliation.report', $report->id) }}">
{{ streamline_date_time($report->reconciliation_period) }} by {{ get_full_name($report->created_by, "id", "first_name", "last_name", "users") }}
</a>
</li>
<br />
@endforeach
</ul>
</div>
</div>
{{ Form::close() }}
@else
<div class="row">
<div class="col-md-12 text-center">
<h3 class="label label-warning label-rounded"> Please Be Sure To Fill In All The Necessary Fields And Then Submit. </h3>
</div>
</div>
@endif
</div>
</div>
@include('banking::banking.reconcile.modals.finish_with_discrepancy')
@include('banking::banking.reconcile.modals.finish_reconciliation')
@include('banking::banking.reconcile.modals.perform_adjustment')
<div class="modal" id="complete_reconciliation" tabindex="-1" role="dialog" aria-labelledby="complete_reconciliation_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h5 class="modal-title" id="complete_reconciliation_label"><b>Confirm</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8 b-r">
<h3>
Are you sure you want to complete this reconciliation
</h3>
</div>
<div class="col-md-4">
<a class="btn-block btn btn-warning" id="cancel_the_reconciliation">Cancel</a>
<a class="btn-block btn btn-success" id="complete_the_reconciliation">Complete Reconciliation</a>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.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/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.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>
$('#finish_reconciliation').click(function(e) {
e.preventDefault();
var unreconciled_array = [];
var difference = $('#difference').text();
$("[id^=unreconciled_checkbox_]").each(function() {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var unreconciled = $('#unreconciled_checkbox_' + id).val();
if (unreconciled !== '') {
unreconciled_array.push(id[0]);
}
});
if (unreconciled_array.length === 0) {
if (parseInt(difference) === 0) {
$('#complete_reconciliation').modal('show');
//$('#finish_reconciliation_form').submit();
} else {
alert('It Appears There Is A Discrepancy Of ' + difference)
$('#finish_reconciliation_modal').modal('show');
}
} else {
var _confirm = confirm('You have a difference of ' + difference + ". There are some unreconciled (unticked) transactions. Do you want to continue ?");
if (_confirm) {
if (parseInt(difference) === 0) {
$('#complete_reconciliation').modal('show');
//$('#finish_reconciliation_form').submit();
} else {
$('#finish_reconciliation_modal').modal('show');
}
}
}
});
$('#complete_the_reconciliation').click(function(e) {
e.preventDefault();
$('#finish_reconciliation_form').submit();
});
$('#cancel_the_reconciliation').click(function(e) {
e.preventDefault();
$('#complete_reconciliation').modal('hide');
});
$('#finish_with_balance_btn').click(function(e) {
e.preventDefault();
var adjustment_balance = $('#difference').text();
var ending_balance = $('#ending_balance').text();
$('#__adjustment_difference_balance').val(parseInt(adjustment_balance));
$('#__ending_balance').val(parseInt(ending_balance));
console.log(adjustment_balance)
$('#finish_reconciliation_modal').modal('hide');
$('#finish_with_discrepancy_modal').modal('show');
});
$('#perform_adjustment').click(function(e) {
e.preventDefault();
var adjustment_balance = $('#difference').text();
$('#adjustment_difference_balance').val(parseInt(adjustment_balance));
$('#finish_reconciliation_modal').modal('hide');
$('#perform_adjustment_modal').modal('show');
})
function finish_adjustment() {
$('#performAdjustmentBtn').prop('disabled', true);//disable button to avoid double submission
var bank = $('#bank_id').val();
var account = $('#account').val();
var accountText = $('#account option:selected').text();
var amount = $('#adjustment_difference_balance').val();
var ending_balance = $('#ending_balance').text();//$('#_ending_balance').val();
var reconciliation_period = $('#_reconciliation_period').val();
if ((amount < 0 && accountText.indexOf("(Expense)") > 0) || (amount > 0 && accountText.indexOf("(Income)") > 0)) {
$.ajax({
method: 'post',
url: '/banking/finish_adjustment',
data: {
'account': account,
'bank': bank,
'amount': amount,
'ending_balance': ending_balance,
'reconciliation_period': reconciliation_period,
},
success: function(response) {
if (response == 'success') {
$('#difference').text(0);
$('#finish_reconciliation_form').submit();
} else {
alert("Action failed!")
}
},
error: function(error) {
alert(error);
console.log(error);
}
});
} else {
alert("If the 'Amount To Be Adjusted' is Negative, select an Expense account!\nIf the 'Amount To Be Adjusted' is Positive, select an Income account!");
}
}
function finish_with_discrepancy() {
var bank = $('#__bank_id').val();
var memo = $('#__memo').val();
var amount = $('#__adjustment_difference_balance').val();
var ending_balance = $('#__ending_balance').val();
var reconciliation_period = $('#__reconciliation_period').val();
$.ajax({
method: 'post',
url: '/banking/finish_with_balance',
data: {
'bank': bank,
'memo': memo,
'amount': amount,
'ending_balance': ending_balance,
'reconciliation_period': reconciliation_period,
},
success: function(response) {
if (response == 'success') {
$('#finish_reconciliation_form').submit();
}
},
error: function(error) {
console.log(error)
}
});
}
// when a row:
// - is checked
// - if it has a debit value, opening balance reduces by the debit amount
// - is then unchecked (if was previously checked)
// - if it has a debit value, opening balance increases by the debit amount
$("[id^='debit_checkbox_']").on("change", function() {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var amount = $('#debit_amount_' + id).val();
var balance = $('#balance').text();
var new_balance = parseInt(balance);
if (this.checked) {
new_balance = parseInt(balance) - parseInt(amount);
$('#record_row_' + id).children('td, th').css('background-color', 'gold');
$('#unreconciled_checkbox_' + id).checked = false;
$('#unreconciled_checkbox_' + id).val('');
} else {
new_balance = parseInt(balance) + parseInt(amount);
$('#record_row_' + id).children('td, th').css('background-color', 'white');
$('#unreconciled_checkbox_' + id).checked = true;
$('#unreconciled_checkbox_' + id).val(id);
}
var new_difference = parseInt(<?php echo json_encode((int)$request->ending_balance_input); ?>) - new_balance;
$('#balance').text(new_balance);
$('#difference').text(new_difference);
//display
$('#balance_display').text(numberWithCommas(new_balance));
$('#difference_display').text(numberWithCommas(new_difference));
});
// when a row:
// - is checked
// - if it has a credit value, opening balance increases by the credit amount
// - is then unchecked (if was previously checked)
// - if it has a credit value, opening balance reduces by the credit amount
$("[id^='credit_checkbox_']").on("change", function() {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var amount = $('#credit_amount_' + id).val();
var balance = $('#balance').text();
var new_balance = parseInt(balance);
if (this.checked) {
new_balance = parseInt(balance) + parseInt(amount);
$('#record_row_' + id).children('td, th').css('background-color', 'gold');
$('#unreconciled_checkbox_' + id).checked = false;
$('#unreconciled_checkbox_' + id).val('');
} else {
new_balance = parseInt(balance) - parseInt(amount);
$('#record_row_' + id).children('td, th').css('background-color', 'white');
$('#unreconciled_checkbox_' + id).checked = true;
$('#unreconciled_checkbox_' + id).val(id);
}
let new_difference = parseInt(<?php echo json_encode((int)$request->ending_balance_input); ?>) - new_balance;
$('#balance').text(new_balance);
$('#difference').text(new_difference);
//display
$('#balance_display').text(numberWithCommas(new_balance));
$('#difference_display').text(numberWithCommas(new_difference));
});
$('#reconciliation_date, #bank').change(function() {
let bank = $('#bank').val();
let reconciliation_date = $('#reconciliation_date').val();
let [dd, mm, yyyy] = reconciliation_date.split("-");
let formatted_reconciliation_date = `${yyyy}-${mm}-${dd}`;
if (bank !== '' && reconciliation_date !== '') {
$.ajax({
method: 'POST',
url: '/banking/get_last_reconciliation_balance',
data: {
'bank': bank,
'reconciliation_date': formatted_reconciliation_date
},
success: function(response) {
var record = JSON.parse(response);
if (record != null) {
$('#opening_balance').val(record);
// opening_balance
// if they had a reconciliation the previous month, opening_balance should pick that latest reconciliation balance
// else opening_balance must be the balance as of the end of the previous month
} else {
alert('No Opening Balance Registered As Of The Provided Date, Please Select Another Date.')
$('#reconciliation_date').val('');
}
},
error: function(error) {
console.log(error);
}
});
}
});
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
$('#reconciliation_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#staff_member_cashier').select2({
placeholder: "-- select --"
});
$('#staff_member_accountant').select2({
placeholder: "-- select --"
});
</script>
@endpush
@@ -0,0 +1,55 @@
<div class="modal" id="finish_reconciliation_modal" tabindex="-1" role="dialog" aria-labelledby="finish_reconciliation_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h5 class="modal-title" id="finish_reconciliation_modal_label"><b>Reconciliation</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8 b-r">
<p>
Leave reconciliation process and perform other finance tasks.
</p>
</div>
<div class="col-md-4">
<a class="btn-block btn btn-danger" href="{{ route('finance') }}">Leave Reconciliation</a>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-8 b-r">
<p>
Return to reconciliation page and double check with the transactions and confirm checked transactions.
</p>
</div>
<div class="col-md-4">
<button class="btn-block btn btn-warning" data-dismiss="modal">Return To Reconciliation</button>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-8 b-r">
<p>
{{-- Perform adjustment by transferring the pending balance to an expense account and then finish the reconciliation process. --}}
If the 'Amount To Be Adjusted' is Negative, select an Expense account!<br>If the 'Amount To Be Adjusted' is Positive, select an Income account
</p>
</div>
<div class="col-md-4">
<button class="btn-block btn btn-primary" id="perform_adjustment">Adjustment</button>
</div>
</div>
{{-- <hr/>
<div class="row">
<div class="col-md-8 b-r">
<p>
Finish reconciliation process with the difference and explain reason for the discrepancy.
</p>
</div>
<div class="col-md-4">
<button class="btn-block btn btn-success" id="finish_with_balance_btn">Finish With Discrepancy</button>
</div>
</div> --}}
</div>
</div>
</div>
</div>
@@ -0,0 +1,38 @@
<div class="modal" id="finish_with_discrepancy_modal" tabindex="-1" role="dialog" aria-labelledby="finish_with_discrepancy_modal_label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h5 class="modal-title" id="finish_with_discrepancy_modal_label"><b>Finish With Discrepancy</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Discrepancy</label>
<input id="__adjustment_difference_balance" type="number" class="form-control">
</div>
<div class="form-group">
<label>Bank Account</label>
{{ Form::text('bank_name', get_name($bank, 'id', 'name', 'chart_of_accounts'), ['class'=>'form-control compulsory', 'id'=>'expense_account_name', 'readonly']) }}
{{ Form::hidden('bank_id', $bank, ['id'=>'__bank_id']) }}
{{ Form::hidden('reconciliation_period', $reconciliation_end_date, ['id'=>'__reconciliation_period']) }}
</div>
<div class="form-group">
<label>Memo :</label>
{{ Form::textarea('memo', '', ['class'=>'form-control', 'compulsory', 'rows'=>'5', 'id'=>'__memo']) }}
</div>
<div class="form-group">
<label>Enter Closing Balance :</label>
<input name="ending_balance" id="__ending_balance" type="number" class="form-control compulsory">
</div>
<button class="btn btn-rounded btn-block btn-success" onclick="finish_with_discrepancy()">Proceed</button>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,36 @@
<div class="modal" id="perform_adjustment_modal" tabindex="-1" role="dialog" aria-labelledby="perform_adjustment_modal_label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h5 class="modal-title" id="perform_adjustment_modal_label"><b>Perform Adjustment</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Amount To Be Adjusted</label>
<input id="adjustment_difference_balance" type="number" class="form-control" readonly>
</div>
<div class="form-group">
<label>Bank Account</label>
{{ Form::text('bank_name', get_name($bank, 'id', 'name', 'chart_of_accounts'), ['class'=>'form-control compulsory', 'id'=>'expense_account_name', 'readonly']) }}
{{ Form::hidden('bank_id', $bank, ['id'=>'bank_id']) }}
{{ Form::hidden('_reconciliation_period', $reconciliation_end_date, ['id'=>'_reconciliation_period']) }}
{{ Form::hidden('_ending_balance', $request->ending_balance, ['id'=>'_ending_balance']) }}
</div>
<div class="form-group">
<label>Adjustment Expense/Income Account</label>
<select name='account' id='account' class='form-control compulsory required' required>
@php echo $option_accounts; @endphp
</select>
</div>
<button class="btn btn-rounded btn-block btn-success" onclick="finish_adjustment()" id="performAdjustmentBtn">Perform Adjustment</button>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,403 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style style="text-css">
body{
/*font-size: 1.2em;*/
}
thead {
/*display: table-header-group;*/
}
tfoot {
/*display: table-row-group;*/
}
tr {
page-break-inside: avoid;
}
td{
padding: 2px;
}
th{
padding: 2px;
}
</style>
</head>
@php
$reconciled_transactions = explode(',',$report->reconciled_trans_ids);
$unreconciled_transactions = explode(',',$report->unreconciled_trans_ids);
$total_cleared_credit = $total_cleared_debit = 0;
$total_uncleared_credit = $total_uncleared_debit = 0;
$total_uncleared = $total_cleared = 0;
@endphp
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h6 class="heading" style="text-align: center;"><b><u>BANK RECONCILIATION REPORT</u></b></h6>
<h6 class="heading" style="text-align: center;"><b>{{ $chart_of_accounts[$report->bank] }} as at {{ streamline_date($report->reconciliation_period) }}</b></h6>
<h6 class="heading" style="text-align: center;"><b>{{-- RECONCILED BY: {{ get_full_name($report->created_by, "id", "first_name", "last_name", "users")}} <br> --}}Date: {{ streamline_date($report->created_at) }}</b></h6>
<div class="row">
<div class="col-12">
<div class="panel">
<div class="panel-body" style="font-size: 12px;">
<div class="row">
<div class="col-12 text-left">
<table class="table table-bordered">
<thead>
<tr>
<th colspan="2" style="text-align: center; padding: 3px;">
Reconciliation Summary
</th>
</tr>
</thead>
@php
$beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString();
@endphp
<tbody>
<tr>
<td style="padding: 5px;">
Stre@mline Opening Balance As Of {{ streamline_date($beginning_of_month) }}:
</td>
<td style="padding: 5px;">
<b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b>
</td>
</tr>
<tr>
<td style="padding: 5px;">
Bank Statement Ending Balance As Of {{ streamline_date($report->reconciliation_period) }}:
</td>
<td style="padding: 5px;">
<b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b>
</td>
</tr>
<tr>
<td style="padding: 5px;">
@php
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
$orderByIdIfTransDateIsTheSame = "id DESC";
$last_record_that_month = DB::table('banking')
->whereNull('deleted_at')
->where('bank', '=', $report->bank)
->where('memo', '!=', 'bank reconciliation adjustment')
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($report->reconciliation_period)->toDateString())
->orderBy('trans_date', 'desc')
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
->orderByRaw($orderByIdIfTransDateIsTheSame)
->first();
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
@endphp
Bank Register Closing Balance As Of {{ streamline_date($report->reconciliation_period) }}:
</td>
<td style="padding: 5px;">
<b>{{ ugandan_shillings($last_running_balance_of_month) }}</b>
</td>
</tr>
<tr>
@php
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
@endphp
@if ($last_banking_record->memo == "bank reconciliation adjustment")
<td style="padding: 5px;"> Reconciliation Discrepancy Balance : </td>
<td style="padding: 5px;">
<b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit)) }}</b>
</td>
@else
<td style="padding: 5px;"> Reconciliation Discrepancy Balance :</td>
<td style="padding: 5px;">
<b>{{ ugandan_shillings(0) }}</b>
</td>
@endif
</tr>
@if ($report->memo)
<tr>
<td style="padding: 5px;">Memo :</td>
<td style="padding: 5px;">
{{ $report->memo }}
</td>
</tr>
@endif
</tbody>
</table>
<h6><b>Cleared Transactions</b></h6>
<strong><b>Checks and Payments</b></strong>
@if(count($reconciled_transactions) > 0)
<div>
<table class="table">
<thead>
<tr>
<th>From</th>
<th>To</th>
<th>Memo</th>
<th style="width: 10%">Date</th>
<th>Amount</th>
</tr>
</thead>
@foreach($reconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
<tbody>
<tr>
<td style="padding: 2px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
@php
$other_accounts_array = explode(',',$transaction->other_accounts);
@endphp
<td style="padding: 2px;">
@for($x = 0; $x < count($other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
@else
@php
$item = isset($payment_items[$other_accounts_array[$x]]) ? $payment_items[$other_accounts_array[$x]] : "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td style="padding: 2px;">{{ $transaction->memo }}</td>
<td style="padding: 2px;">{{ streamline_date($transaction->trans_date) }}</td>
@php $total_cleared_debit += (int)$transaction->debit; @endphp
<td style="padding: 2px;"> - {{ ugandan_shillings($transaction->debit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
</table>
</div>
@endif
<strong><b>Deposits and Credits</b></strong>
<table class="table">
<thead>
<tr>
<th>From</th>
<th>To</th>
<th>Memo</th>
<th>Date</th>
<th>Amount</th>
</tr>
</thead>
@if(count($reconciled_transactions) > 0)
@foreach($reconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'DEPOSIT')
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
<tbody>
<tr>
<td style="padding: 3px;">
@for($x = 0; $x < count($other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
@else
@php
$item = isset($payment_items[$other_accounts_array[$x]]) ? $payment_items[$other_accounts_array[$x]] : "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td style="padding: 3px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
<td style="padding: 3px;">{{ $transaction->memo }}</td>
<td style="padding: 3px;">{{ streamline_date($transaction->trans_date) }}</td>
@php $total_cleared_credit += (int)$transaction->credit; @endphp
<td style="padding: 3px;">{{ ugandan_shillings($transaction->credit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
@endif
</table>
<h6><b>Total Cleared Balance : {{ ugandan_shillings($total_cleared = ($total_cleared_credit - $total_cleared_debit)) }}</b></h6>
<br/>
<hr/>
<h6><b>Uncleared Transactions</b></h6>
<strong><b>Checks and Payments</b></strong>
@if(count($unreconciled_transactions) > 0)
<table class="table">
<thead>
<tr>
<th>From</th>
<th>To</th>
<th>Memo</th>
<th>Date</th>
<th>Amount</th>
</tr>
</thead>
@foreach($unreconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
<tbody>
<tr>
<td style="padding: 3px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
<td style="padding: 3px;">
@php
$uncleared_other_accounts_string = $transaction->other_accounts;
$uncleared_other_accounts_array = is_null($uncleared_other_accounts_string) ? [] : explode(",", $uncleared_other_accounts_string);
@endphp
@for($x = 0; $x < count($uncleared_other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$uncleared_other_accounts_array[$x]]))
{{ $chart_of_accounts[$uncleared_other_accounts_array[$x]] }}
@else
@php
$item = $payment_items[$uncleared_other_accounts_array[$x]] ?? "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td style="padding: 3px;">{{ $transaction->memo }}</td>
<td style="padding: 3px;">{{ streamline_date($transaction->trans_date) }}</td>
@php $total_uncleared_debit += (int)$transaction->debit; @endphp
<td style="padding: 3px;">{{ ugandan_shillings($transaction->debit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
</table>
@endif
<strong><b>Deposits and Credits</b></strong>
<table class="table">
<thead><td>
<td>
<td>
<td>
<td>
<td>
<td>
<td>
<td>
<td>
<tr>
<th>From</th>
<th>To</th>
<th>Memo</th>
<th>Date</th>
<th>Amount</th>
</tr>
</thead>
@if(count($unreconciled_transactions) > 0)
@foreach($unreconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id)@endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'DEPOSIT')
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
<tbody>
<tr>
<td style="padding: 3px;">
@for($x = 0; $x < count($other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
@else
@php
$item = isset($payment_items[$other_accounts_array[$x]]) ? $payment_items[$other_accounts_array[$x]] : "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td style="padding: 3px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
<td style="padding: 3px;">{{ $transaction->memo }}</td>
<td style="padding: 3px;">{{ streamline_date($transaction->trans_date) }}</td>
@php $total_uncleared_credit += (int)$transaction->credit; @endphp
<td style="padding: 3px;">{{ ugandan_shillings($transaction->credit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
@endif
</table>
<h6><b> Total Uncleared Balance : {{ ugandan_shillings($total_uncleared = ($total_uncleared_credit - $total_uncleared_debit)) }}</b></h6><br/>
<table class="table table-bordered">
<tbody>
<tr>
<th style="padding: 5px;">Reconciled By: </th>
<td style="padding: 5px;">
{{ get_full_name($report->created_by, "id", "first_name", "last_name", "users")}}
</td>
</tr>
<tr>
<th style="padding: 5px;">Checked By: </th>
<td style="padding: 5px;">.................................</td>
</tr>
<tr>
<th style="padding: 5px;">Approved By: </th>
<td style="padding: 5px;">..................................</td>
</tr>
</tbody>
</table>
{{-- @php
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
@endphp
@if ($last_banking_record->memo == "bank reconciliation adjustment")
<strong> Reconciliation Discrepancy Balance : <b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit))}}</b></strong><br>
@else
<strong> Reconciliation Discrepancy Balance : <b>{{ ugandan_shillings(0) }}</b></strong><br>
@endif
@php $beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString(); @endphp
<strong>Stre@mline Opening Balance ({{ streamline_date($beginning_of_month) }}): <b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b></strong>
<strong>Bank Statement Ending Balance ({{ streamline_date($report->reconciliation_period) }}): <b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b></strong>
@php
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
@endphp
<strong>Register Bank Closing Balance ({{ streamline_date($report->reconciliation_period) }}): <b>{{ ugandan_shillings($bank_balance_that_day) }}</b></strong> --}} <!-- $total_uncleared + $total_cleared -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,462 @@
@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/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" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
<style>
.row_color{
background: gold;
}
</style>
@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">Bank Reconciliation Report</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 class="active"><i class="fa fa-bank"></i> Bank Reconciliation Report</li>
</ol>
</div>
</div>
@php
$reconciled_transactions = explode(',',$report->reconciled_trans_ids);
$unreconciled_transactions = explode(',',$report->unreconciled_trans_ids);
$total_cleared_credit = $total_cleared_debit = 0;
$total_uncleared_credit = $total_uncleared_debit = 0;
$total_uncleared = $total_cleared = 0;
@endphp
<br/>
<div class="row">
<div class="col-md-12">
<div class="col-md-3"></div>
<div class="col-md-3">
<a class="btn btn-rounded"
style="background-color:#03C03C; color: white; margin-bottom: 20px;"
href="{{ route('banking.reconcile') }}">
<i class="fa fa-plus"></i>
Start New Reconciliation
</a>
</div>
<div class="col-md-3">
<a class="btn btn-rounded"
style="background-color:red; color: white; margin-bottom: 20px;"
onclick="return confirm('Are you sure you want to undo this reconciliation?')"
href="{{ route('banking.undo_bank_reconciliation', $report->id) }}">
<i class="fa fa-undo"></i>
Undo Reconciliation
</a>
</div>
<div class="col-md-3">
<a class="btn btn-rounded" target="_blank"
style="background-color:#03C03C; color: white; margin-bottom: 20px;"
href="{{ route('banking.print_bank_reconciliation', $report->id) }}">
<i class="fa fa-print"></i>
Print Reconciliation Report
</a>
</div>
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-body">
<div class="row">
<div class="col-md-10 text-center offset-1">
<h2><b>RECONCILIATION REPORT</b></h2><br/>
<h3><b>{{ $chart_of_accounts[$report->bank] }} AS AT {{ streamline_date($report->reconciliation_period) }}</b></h3>
<h3><b>RECONCILED BY: {{ get_full_name($report->created_by, "id", "first_name", "last_name", "users")}} <br>DATE: {{ streamline_date($report->created_at) }}</b></h3>
</div>
<div class="col-md-10 text-left offset-1">
<table class="table table-bordered">
<thead>
<tr>
<th colspan="2" style="text-align: center">
Reconciliation Summary
</th>
</tr>
</thead>
@php
$beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString();
@endphp
<tbody>
<tr>
<td>
Stre@mline Opening Balance As Of {{ streamline_date($beginning_of_month) }}:
</td>
<td>
<b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b>
</td>
</tr>
<tr>
<td>
Bank Statement Ending Balance As Of {{ streamline_date($report->reconciliation_period) }}:
</td>
<td>
<b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b>
</td>
</tr>
<tr>
<td>
@php
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
$orderByIdIfTransDateIsTheSame = "id DESC";
$last_record_that_month = DB::table('banking')
->whereNull('deleted_at')
->where('bank', '=', $report->bank)
->where('memo', '!=', 'bank reconciliation adjustment')
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($report->reconciliation_period)->toDateString())
->orderBy('trans_date', 'desc')
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
->orderByRaw($orderByIdIfTransDateIsTheSame)
->first();
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
@endphp
Bank Register Closing Balance As Of {{ streamline_date($report->reconciliation_period) }}:
</td>
<td>
<b>{{ ugandan_shillings($last_running_balance_of_month) }}</b>
</td>
</tr>
<tr>
@php
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
@endphp
@if ($last_banking_record->memo == "bank reconciliation adjustment")
<td> Reconciliation Discrepancy Balance : </td>
<td>
<b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit)) }}</b>
</td>
@else
<td> Reconciliation Discrepancy Balance :</td>
<td>
<b>{{ ugandan_shillings(0) }}</b>
</td>
@endif
</tr>
<tr>
<td>Memo :</td>
<td>
{{ $report->memo }}
</td>
</tr>
</tbody>
</table>
<h4><b>Cleared Transactions</b></h4>
<h5><b>Checks and Payments</b></h5>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>From :</th>
<th>To : </th>
<th>Memo : </th>
<th>Date :</th>
<th>Amount :</th>
</tr>
</thead>
@if(count($reconciled_transactions) > 0)
@foreach($reconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
<tbody>
<tr>
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
@php
$other_accounts_array = explode(',',$transaction->other_accounts);
@endphp
<td>
@for($x = 0; $x < count($other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
@else
@php
$item = $payment_items[$other_accounts_array[$x]] ?? "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td>{{ $transaction->memo }}</td>
<td>{{ streamline_date($transaction->trans_date) }}</td>
@php $total_cleared_debit += (int)$transaction->debit; @endphp
<td> - {{ ugandan_shillings($transaction->debit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
@endif
</table>
</div>
<h5><b>Deposits and Credits</b></h5>
<table class="table">
<thead>
<tr>
<td>From : </td>
<td>To :</td>
<td>Memo : </td>
<td>Date :</td>
<td>Amount :</td>
</tr>
</thead>
@if(count($reconciled_transactions) > 0)
@foreach($reconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'DEPOSIT')
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
<tbody>
<tr>
<td>
@for($x = 0; $x < count($other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
@else
@php
$item = $payment_items[$other_accounts_array[$x]] ?? "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
<td>{{ $transaction->memo }}</td>
<td>{{ streamline_date($transaction->trans_date) }}</td>
@php $total_cleared_credit += (int)$transaction->credit; @endphp
<td>{{ ugandan_shillings($transaction->credit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
@endif
</table>
<h4><b>Total Cleared Balance : {{ ugandan_shillings($total_cleared = ($total_cleared_credit - $total_cleared_debit)) }}</b></h4>
<br/>
<hr/>
<h4><b>Uncleared Transactions</b></h4>
<h5><b>Checks and Payments</b></h5>
<table class="table">
<thead>
<tr>
<td>From :</td>
<td>To : </td>
<td>Memo : </td>
<td>Date :</td>
<td>Amount :</td>
</tr>
</thead>
@if(count($unreconciled_transactions) > 0)
@foreach($unreconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
<tbody>
<tr>
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
<td>
@php
$uncleared_other_accounts_string = $transaction->other_accounts;
$uncleared_other_accounts_array = is_null($uncleared_other_accounts_string) ? [] : explode(",", $uncleared_other_accounts_string);
@endphp
@for($x = 0; $x < count($uncleared_other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$uncleared_other_accounts_array[$x]]))
{{ $chart_of_accounts[$uncleared_other_accounts_array[$x]] }}
@else
@php
$item = $payment_items[$uncleared_other_accounts_array[$x]] ?? "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td>{{ $transaction->memo }}</td>
<td>{{ streamline_date($transaction->trans_date) }}</td>
@php $total_uncleared_debit += (int)$transaction->debit; @endphp
<td>{{ ugandan_shillings($transaction->debit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
@endif
</table>
<h5><b>Deposits and Credits</b></h5>
<table class="table">
<thead>
<tr>
<td>From : </td>
<td>To :</td>
<td>Memo : </td>
<td>Date :</td>
<td>Amount :</td>
</tr>
</thead>
@if(count($unreconciled_transactions) > 0)
@foreach($unreconciled_transactions as $trans_id)
@php $transaction = \Streamline\Models\Banking::find($trans_id)@endphp
@if(!is_null($transaction))
@if($transaction->trans_type == 'DEPOSIT')
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
<tbody>
<tr>
<td>
@for($x = 0; $x < count($other_accounts_array); $x ++)
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
@else
@php
$item = $payment_items[$other_accounts_array[$x]] ?? "";
@endphp
{{ $item }}
@endif
@endfor
</td>
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
<td>{{ $transaction->memo }}</td>
<td>{{ streamline_date($transaction->trans_date) }}</td>
@php $total_uncleared_credit += (int)$transaction->credit; @endphp
<td>{{ ugandan_shillings($transaction->credit) }}</td>
</tr>
</tbody>
@endif
@endif
@endforeach
@endif
</table>
<h4><b> Total Uncleared Balance : {{ ugandan_shillings($total_uncleared = ($total_uncleared_credit - $total_uncleared_debit)) }}</b></h4><br/>
<table class="table table-bordered">
<thead>
<tr>
<th colspan="2" style="text-align: center">
<b>Reconciliation Summary</b>
</th>
</tr>
</thead>
@php
$beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString();
@endphp
<tbody>
<tr>
<td>
Stre@mline Opening Balance As Of {{ streamline_date($beginning_of_month) }}:
</td>
<td>
<b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b>
</td>
</tr>
<tr>
<td>
Bank Statement Ending Balance As Of {{ streamline_date($report->reconciliation_period) }}:
</td>
<td>
<b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b>
</td>
</tr>
<tr>
<td>
@php
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
$orderByIdIfTransDateIsTheSame = "id DESC";
$last_record_that_month = DB::table('banking')
->whereNull('deleted_at')
->where('bank', '=', $report->bank)
->where('memo', '!=', 'bank reconciliation adjustment')
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($report->reconciliation_period)->toDateString())
->orderBy('trans_date', 'desc')
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
->orderByRaw($orderByIdIfTransDateIsTheSame)
->first();
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
@endphp
Register Bank Closing Balance As Of {{ streamline_date($report->reconciliation_period) }}:
</td>
<td>
<b>{{ ugandan_shillings($last_running_balance_of_month) }}</b>
</td>
</tr>
<tr>
@php
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
@endphp
@if ($last_banking_record->memo == "bank reconciliation adjustment")
<td> Reconciliation Discrepancy Balance : </td>
<td>
<b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit)) }}</b>
</td>
@else
<td> Reconciliation Discrepancy Balance :</td>
<td>
<b>{{ ugandan_shillings(0) }}</b>
</td>
@endif
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
"bPaginate": false,
"aoColumnDefs": [{
"aTargets": [2,3],
"defaultContent": "",
}]
});
</script>
@endpush
@@ -0,0 +1,263 @@
@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/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" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
<style>
.row_color {
background: gold;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Bank Reconciliation Reports</h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
<li class="active"><i class="fa fa-bank"></i>Bank Reconciliation Reports</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="panel">
<div class="panel-body">
{{ Form::open(['method'=>'post','route' => 'banking.reconcile.reports']) }}
<div class="row">
<div class="col-md-3 b-r">
<div class="form-group">
<label>{{ __('banking.staff_in_charge') }}</label>
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
<option value="">{{ __('banking.select') }}</option>
<option value="ALL STAFF">{{ __('banking.all_staff') }}</option>
@foreach($staff_members as $item)
<option value="{{ $item->id }}">{{ $item->username }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>{{ __('banking.bank') }} :</label>
<select class="form-control compulsory required" name="bank" id="bank" required>
<option value="">{{ __('banking.select') }}</option>
<option value="ALL BANKS">ALL BANKS</option>
@foreach($banks as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>{{ __('banking.select_date') }}</label>
<select class="form-control compulsory required" name="dates" id="dates" required>
<option value="">{{ __('banking.select') }}</option>
<option value="today">{{ __('banking.today') }}</option>
<option value="yesterday">{{ __('banking.yesterday') }}</option>
<option value="custom_date">{{ __('banking.custom_date') }}</option>
<option value="custom_date_range">{{ __('banking.date_range') }}</option>
</select>
</div>
</div>
<div class="col-md-2">
<div id="sDate" style="display: none;">
<div class="form-group">
<label>{{ __('banking.date_on') }}</label>
<div class="input-group">
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div id="eDate" style="display: none;">
<div class="form-group">
<label for="end_date">{{ __('banking.end_date') }}</label>
<div class="input-group">
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
<div class="col-md-1">
<div class="form-group" style="margin-top: 25px;">
{{ Form::submit('Submit', ['class'=>'btn btn-success btn-rounded btn-block pull-right']) }}
</div>
</div>
</div>
{{ Form::close() }}
<hr style="height: 2px" />
<div class="row">
<div class="col-md-12">
@if(isset($display))
<h3 class="label label-info label-rounded"> {!! isset($display) ? $display : '' !!}</h3>
@endif
<br /><br />
<div class="table-responsive">
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Bank Name</th>
<th>Reconciliation Period</th>
<th>Date Submitted</th>
<th>Stre@mline Bank Opening Balance</th>
<th>Bank Statement Ending Balance</th>
<th>Bank Register Closing Balance</th>
<th>Reconciliation Discrepancy</th>
<th>Staff Incharge</th>
<th>{{ __('banking.action') }}</th>
</tr>
</thead>
<tbody>
@if(count($records) > 0)
@foreach($records as $record)
<tr>
<td>{{ get_name($record->bank, 'id', 'name', 'chart_of_accounts') }}</td>
<td>
@php $beginning_of_month = Carbon\Carbon::parse($record->reconciliation_period)->startOfMonth()->toDateString(); @endphp
From {{ streamline_date($beginning_of_month) }} to {{ streamline_date($record->reconciliation_period) }}.
</td>
<td>{{ streamline_date_time_short($record->created_at) }}</td>
<td>{{ ugandan_shillings($record->opening_streamline_balance) }}</td>
<td>{{ ugandan_shillings($record->ending_bank_statement_balance) }}</td>
<td>
@php
$banking_record = get_latest_banking_record($record->bank, $record->reconciliation_period);
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
$orderByIdIfTransDateIsTheSame = "id DESC";
$last_record_that_month = DB::table('banking')
->whereNull('deleted_at')
->where('bank', '=', $record->bank)
->where('memo', '!=', 'bank reconciliation adjustment')
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($record->reconciliation_period)->toDateString())
->orderBy('trans_date', 'desc')
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
->orderByRaw($orderByIdIfTransDateIsTheSame)
->first();
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
@endphp
{{ ugandan_shillings($last_running_balance_of_month) }}
</td>
<td>
@php
$discrepancy_banking_record = \Streamline\Models\Banking::where('reconciled',$record->id)->orderBy('id', 'desc')->first();
@endphp
@if ($discrepancy_banking_record && $discrepancy_banking_record->memo == "bank reconciliation adjustment")
{{ $discrepancy_banking_record->credit ? ugandan_shillings($discrepancy_banking_record->credit) : "-".ugandan_shillings(abs($discrepancy_banking_record->debit))}}
@elseif($discrepancy_banking_record && $discrepancy_banking_record->memo != "bank reconciliation adjustment")
{{ ugandan_shillings(0) }}
@endif
</td>
<td>{{ get_name($record->created_by, 'id', 'username', 'users') }}</td>
<td>
<a class="btn-sm btn btn-success btn-rounded" href="{{ route('bank.reconciliation.report', $record->id) }}">
<i class="fa fa-eye"></i>
View Report
</a>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.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/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'
],
"bPaginate": false,
"aoColumnDefs": [{
"aTargets": [2, 3],
"defaultContent": "",
}]
});
$('#dates').change(function(e) {
if ($(this).val() === "custom_date") {
$("#eDate").hide();
$("#sDate").show();
} else if ($(this).val() === "custom_date_range") {
$("#sDate").show();
$("#eDate").show();
} else {
$("#eDate").hide();
$("#sDate").hide();
}
});
jQuery('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
jQuery('#start_date ,#deposit_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#staff_member').select2({
placeholder: "-- select --"
});
</script>
@endpush