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,5 @@
<?php
return [
'name' => 'Banking'
];
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,240 @@
<?php
namespace Modules\Banking\Http\Controllers;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Streamline\Models\BankDeposit;
use Streamline\Models\BankingRecord;
use Illuminate\Http\Request;
use Streamline\Models\BankTransfer;
use Streamline\Models\ChartOfAccount;
use Streamline\Models\Payment;
use Streamline\Models\User;
class BankingRecordController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index(Request $request)
{
$records = [];
$bank = $request->bank;
$staff_members = User::get();
$display = bank_register_label_setter($request);
$today = Carbon::today()->toDateString();
$banks = ChartOfAccount::where('type', 4)->where('id', '!=', 10)->get();
$yesterday = Carbon::yesterday()->toDateString();
$end = Carbon::parse($request->end_date)->endOfDay()->toDateTimeString();
$start = Carbon::parse($request->start_date)->startOfDay()->toDateTimeString();
if($request->staff_member == "ALL STAFF"){
switch ($request->dates){
case 'today':
$records = BankingRecord::whereDate('record_date', $today)->where('bank', $request->bank)
->get();
break;
case 'yesterday':
$records = BankingRecord::whereDate('record_date', $yesterday)->where('bank', $request->bank)
->get();
break;
case 'custom_date':
$records = BankingRecord::whereDate('record_date', $start)->where('bank', $request->bank)
->get();
break;
case 'custom_date_range':
$records = BankingRecord::whereBetween('record_date', [$start, $end])->where('bank', $request->bank)
->get();
break;
}
}
else{
switch ($request->dates){
case 'today':
$records = BankingRecord::where('created_by', $request->staff_member)->whereDate('record_date', $today)
->where('bank', $request->bank)->get();
break;
case 'yesterday':
$records = BankingRecord::where('created_by', $request->staff_member)->whereDate('record_date', $yesterday)
->where('bank', $request->bank)->get();
break;
case 'custom_date':
$records = BankingRecord::where('created_by', $request->staff_member)->whereDate('record_date', $start)
->where('bank', $request->bank)->get();
break;
case 'custom_date_range':
$records = BankingRecord::where('created_by', $request->staff_member)->whereBetween('record_date', [$start, $end])
->where('bank', $request->bank)->get();
break;
}
}
return view('banking::banking_records.index', compact('records', 'display', 'staff_members', 'banks', 'bank'));
}
public function reverse($trans_id){
// update account balances on banking records
$deposits = BankDeposit::where('trans_id', $trans_id)->get();
$transfers = BankTransfer::where('trans_id', $trans_id)->get();
$payments = Payment::where('transaction_id', $trans_id)->get();
$records = BankingRecord::where('trans_id', $trans_id)->get();
if(count($deposits) > 0){
foreach ($deposits as $deposit){
$deposit_amount = (int)$deposit->amount;
$current_deposit_to_balance = ChartOfAccount::where('id', $deposit->deposit_to)->pluck('balance')->first();
$current_deposit_from_balance = ChartOfAccount::where('id', $deposit->from_account)->pluck('balance')->first();
ChartOfAccount::where('id', $deposit->deposit_to)->update(['balance' => ((int)$current_deposit_to_balance) - (int)$deposit_amount]);
ChartOfAccount::where('id', $deposit->from_account)->update(['balance' => ((int)$current_deposit_from_balance) + (int)$deposit_amount]);
$proceeding_deposits = BankDeposit::where('created_at', '>', $deposit->created_at)->get();
foreach ($proceeding_deposits as $proceeding_deposit){
BankDeposit::where('id', $proceeding_deposit->id)->update(['previous_from_account_balance' => ((int)$proceeding_deposit->previous_from_account_balance + (int)$deposit_amount)]);
BankDeposit::where('id', $proceeding_deposit->id)->update(['previous_to_account_balance' => ((int)$proceeding_deposit->previous_to_account_balance - (int)$deposit_amount)]);
}
$deposit->delete();
foreach ($records as $record){
$proceeding_records = BankingRecord::where('created_at', '>', $record->created_at)->get();
foreach ($proceeding_records as $proceeding_record){
BankingRecord::where('id', $proceeding_record->id)->update(['account_balance' => ((int)$proceeding_record->account_balance - (int)$deposit_amount)]);
}
$record->delete();
}
// update chart of account balances
flash('Bank Transaction successfully reversed.')->success();
return redirect('/banking/register');
}
}elseif(count($transfers) > 0){
foreach ($transfers as $transfer){
$transfer_amount = (int)$transfer->balance;
$current_transfer_to_balance = ChartOfAccount::where('id', $transfer->to_account)->pluck('balance')->first();
$current_transfer_from_balance = ChartOfAccount::where('id', $transfer->from_account)->pluck('balance')->first();
ChartOfAccount::where('id', $transfer->to_account)->update(['balance' => ((int)$current_transfer_to_balance) - (int)$transfer_amount]);
ChartOfAccount::where('id', $transfer->from_account)->update(['balance' => ((int)$current_transfer_from_balance) + (int)$transfer_amount]);
$proceeding_transfers = BankDeposit::where('created_at', '>', $transfer->created_at)->get();
foreach ($proceeding_transfers as $proceeding_transfer){
BankTransfer::where('id', $proceeding_transfer->id)->update(['previous_from_account_balance' => ((int)$proceeding_transfer->previous_from_account_balance + (int)$transfer_amount)]);
BankTransfer::where('id', $proceeding_transfer->id)->update(['previous_to_account_balance' => ((int)$proceeding_transfer->previous_to_account_balance - (int)$transfer_amount)]);
}
$transfer->delete();
foreach ($records as $record){
$proceeding_records = BankingRecord::where('created_at', '>', $record->created_at)->get();
foreach ($proceeding_records as $proceeding_record){
BankingRecord::where('id', $proceeding_record->id)->update(['account_balance' => ((int)$proceeding_record->account_balance - (int)$transfer_amount)]);
}
$record->delete();
}
// update chart of account balances
flash('Bank Transaction successfully reversed.')->success();
return redirect('/banking/register');
}
}elseif(count($payments) > 0){
foreach ($payments as $payment){
$bank_account = $payment->account_id;
$payment_item_account = get_name($payment->item_id, 'id', 'account_id', 'payment_items');
$payment_amount = (int)$payment->amount;
$current_transfer_to_balance = ChartOfAccount::where('id', $payment_item_account)->pluck('balance')->first();
$current_transfer_from_balance = ChartOfAccount::where('id', $bank_account)->pluck('balance')->first();
ChartOfAccount::where('id', $payment_item_account)->update(['balance' => ((int)$current_transfer_to_balance) - (int)$payment_amount]);
ChartOfAccount::where('id', $bank_account)->update(['balance' => ((int)$current_transfer_from_balance) + (int)$payment_amount]);
$proceeding_payments = Payment::where('created_at', '>', $payment->created_at)->get();
foreach ($proceeding_payments as $proceeding_payment){
Payment::where('id', $proceeding_payment->id)->update(['account_balance' => ((int)$proceeding_payment->account_balance + (int)$payment_amount)]);
}
$payment->delete();
foreach ($records as $record){
$proceeding_records = BankingRecord::where('created_at', '>', $record->created_at)->get();
foreach ($proceeding_records as $proceeding_record){
BankingRecord::where('id', $proceeding_record->id)->update(['account_balance' => ((int)$proceeding_record->account_balance + (int)$payment_amount)]);
}
$record->delete();
}
// update chart of account balances
flash('Bank Transaction successfully reversed.')->success();
return redirect('/banking/register');
}
}
// update chart of account balances
flash('Bank Transaction Reversal Failed.')->error();
return redirect('/banking/register');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
*/
public function show(BankingRecord $bankingRecord)
{
//
}
/**
* Show the form for editing the specified resource.
*
*/
public function edit(BankingRecord $bankingRecord)
{
//
}
/**
* Update the specified resource in storage.
*
*/
public function update(Request $request, BankingRecord $bankingRecord)
{
//
}
/**
* Remove the specified resource from storage.
*
*/
public function destroy(BankingRecord $bankingRecord)
{
//
}
}
@@ -0,0 +1,13 @@
<?php
namespace Modules\Banking\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
@@ -0,0 +1,113 @@
<?php
namespace Modules\Banking\Providers;
use Illuminate\Support\ServiceProvider;
use Modules\Banking\Providers\RouteServiceProvider;
class BankingServiceProvider extends ServiceProvider {
/**
* @var string $moduleName
*/
protected $moduleName = 'Banking';
/**
* @var string $moduleNameLower
*/
protected $moduleNameLower = 'banking';
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->register(RouteServiceProvider::class);
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
], 'config');
$this->mergeConfigFrom(
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'Resources/views');
$this->publishes([
$sourcePath => $viewPath
], ['views', $this->moduleNameLower . '-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (\Config::get('view.paths') as $path) {
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}
return $paths;
}
}
@@ -0,0 +1,68 @@
<?php
namespace Modules\Banking\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'Modules\Banking\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(module_path('Banking', '/Routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(module_path('Banking', '/Routes/api.php'));
}
}
@@ -0,0 +1,132 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</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 Slip</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="/finance">Finance</a></li>
<li><a href="/banking/deposit">Bank Deposits</a></li>
<li class="active">Bank Slip</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> Print</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<img style="max-width: 300px; max-height: 140px;" src="{{ asset(isset($hospital_information->logo) ? $hospital_information->logo : 'uploads/logo/logo-sm.png') }}" class="mx-auto d-block mx-3" alt="Responsive image">
<p class="h6 text-center mt-0 font-weight-bold">
<?php echo $hospital_information->name . ' | ' . $hospital_information->phone_number . ' | ' . $hospital_information->email . ' | ' . $hospital_information->address . ' ' . $hospital_information->country ?>
</p><br>
<p class="h5 text-center mt-0 font-weight-bold">Bank Slip</p>
<div>
<table class="table" id="receipt_table">
<thead>
<tr>
<th style="width: 60%"><b>#</b></th>
<th style="width: 20%"><b>Amount</b></th>
</tr>
</thead>
<tbody>
@php $total_banked = 0; @endphp
@for ($x = 0; $x < count($banks_array); $x++)
<tr>
<td>{{ get_name($banks_array[$x], "id", "name", "chart_of_accounts") }}</td>
<td>{{ ugandan_shillings($amounts_array[$x]) }}</td>
</tr>
@php $total_banked += is_numeric($amounts_array[$x]) ? $amounts_array[$x] : 0; @endphp
@endfor
<tr>
<td>Memo</td>
<td>{{ $deposit_memo }}</td>
</tr>
<tr>
<td><strong>&nbsp;Total Banked</strong></td>
<td><strong>&nbsp;{{ ugandan_shillings($total_banked) }}</strong></td>
</tr>
<tr>
<td><strong>&nbsp;Deposite Date</strong></td>
<td><strong>&nbsp;{{ streamline_date($deposit_date) }}</strong></td>
</tr>
<tr>
<td><strong>&nbsp;Banked By</strong></td>
<td><strong>&nbsp;{{ get_full_name($banked_by, 'id', 'first_name', 'last_name', 'users') }}</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3"></div>
<i style="font-size: 0.8em; margin-left: 50%;">{{ __('family_accounts.streamline') }}</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,426 @@
@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" />
@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">{{ __('banking.bank_deposits') }}</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> {{ __('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> {{ __('banking.new_bank_deposit') }}</li>
</ol>
</div>
</div>
@php
$balance = 0;
@endphp
@include('flash::message')
<div class="row">
<div class="col-md-12">
<div class="panel full-wrapper">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="pull-left">
<a href="javascript:void(0)" class="text-center db">
@php $hospital_information = \Streamline\Models\HospitalInformation::first(); @endphp
<img src="{{ asset($hospital_information->logo) }}" style="max-height: 160px; margin: auto; max-width: 260px;" alt="Home" /><br />
</a>
<address>
<h3> &nbsp;<b class="text-danger">{{ $hospital_information->name }}</b></h3>
<p class="text-muted m-l-5">{{ $hospital_information->phone_number }}, {{ $hospital_information->email }},
<br /> {{ get_name($hospital_information->sub_county,'id', 'name', 'subcounties') }}, {{ get_name($hospital_information->district,'id', 'name', 'districts') }},
<br /> {{ $hospital_information->country }}.
</p>
</address>
</div>
<div class="pull-right text-right">
<address>
<p class="m-t-30"><b>{{ __('banking.deposit_date') }}</b> <i class="fa fa-calendar"></i> {{ streamline_date_time(\Carbon\Carbon::now()->toDateTimeString()) }}</p>
</address>
</div>
</div>
</div>
<br />
{{ Form::open(['route' => 'banking.process_deposit', 'data-toggle' => 'validator']) }}
<h2><strong>{{ __('banking.details') }}</strong></h2>
<h5>{{ __('banking.deposit_to_account') }}</h5>
<br />
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('banking.select_account') }}</th>
<th>{{ __('banking.deposit_date') }}</th>
<th>{{ __('banking.current_balance') }}</th>
<th>{{ __('banking.memo') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="form-group">
<select class="form-control compulsory required" name="deposit_to" id="deposit_to" required>
<option value="">-select-</option>
@foreach($bank_accounts as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
</td>
<td>
<div class="form-group">
<div class="input-group">
{{ Form::text('deposit_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'deposit_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</td>
<td>
<input class="form-control" id="current_balance" readonly name="current_account_balance" type="text">
</td>
<td>
<div class="form-group">
<div class="input-group">
{{ Form::text('deposit_memo', '', ['class'=>'form-control required compulsory', 'id'=>'memo']) }}
</div>
</div>
</td>
</tr>
</tbody>
</table>
<hr />
<h2><strong>{{ __('banking.deposit_details') }}</strong></h2>
<h5>{{ __('banking.deposit_from_account') }}</h5>
<br />
@php
$options = "<option value=''>--select--</option>";
foreach ($income_accounts as $item){
$options .= "<option value='$item->id'>$item->name</option>";
}
@endphp
<div class="input_fields_wrap">
<div class="row">
<div class="span1"></div>
<div class="col-3">
<div class=" control-group">
<label class="control-label" for="item">{{ __('banking.from_account') }}</label>
<div class="form-group">
<select name='account[]' id='account_0' class="form-control select">
<option value=''>-Select An Income Account-</option>
@foreach($income_accounts as $item)
<option style='color: orange;' value='{{ $item->id }}'>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
</div><!-- From Account -->
@php
$options = "<option value=''>-Select An Income Account-</option>";
foreach ($income_accounts as $item){
$options .= "<option value='$item->id'>$item->name</option>";
}
$payment_method_options = "<select class='form-control' name='payment_method[]'>";
$payment_method_options .= "<option value=''>-Select-</option>";
foreach ($payment_methods as $key => $method):
$payment_method_options .= "<option value='$method->id'>$method->name</option>";
endforeach;
$payment_method_options .= "</select>";
@endphp
<div class='col-2'>
<div class="form-group">
<label class='control-label' class=''>Amount to Deposit</label>
<div class=''>
<input type='number' value='0' name='amount[]' id='amount_0' class='form-control compulsory'>
</div>
</div>
</div>
<!-- <div class='col-2'>
<div class="form-group">
<label class='control-label' class=''>{{ __('banking.balance') }}</label>
<div class=''>
<input type='number' name='balance[]' id='balance_0' class='form-control compulsory' readonly>
</div>
</div>
</div> -->
<div class="col-2">
<div class="form-group">
<label class="control-label">{{ __('banking.payment_method') }}</label>
<div class=''>
@php echo $payment_method_options; @endphp
</div>
</div>
</div><!-- Payment Method -->
<div class='col-4'>
<div class="form-group">
<label class='control-label' class=''>{{ __('banking.memo') }}</label>
<div class=''>
<textarea name='memo[]' id='memo_0' class='form-control' rows="3" cols="4"></textarea>
</div>
</div>
</div><!-- Memo -->
<div class="col-1">
<div class="form-group" style="margin-top: 22px; margin-left: 3px;">
<a class="btn btn-success add_item" style="color: white"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
</div>
<div class="row">
<div class='col-7'></div>
<div class='col-5'>
<div class="form-group-group">
<label class="control-label" for="tot">{{ __('banking.total') }}</label>
<div class="controls">
<input type="number" name="total_amount" value="0" id="total_amount" class="form-control compulsory" readonly />
</div>
</div>
</div>
</div><!-- Total -->
<br />
<div class="row">
<div class='col-9'></div>
<div class='col-3'>
<div style="display: block">
<button type="submit" id="make_deposit" class="btn btn-block btn-success float-right">{{ __('banking.deposit') }}</button>
</div>
</div>
</div><!-- Total -->
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript" src="{{ asset('elite/bower_components/html5-editor/wysihtml5-0.3.0.js') }}"></script>
<script type="text/javascript" src="{{ asset('elite/bower_components/html5-editor/bootstrap-wysihtml5.js') }}"></script>
<script type="text/javascript" src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
$('#register_donation_btn').click(function(e) {
e.preventDefault();
$('.register_donation').modal('show');
});
$('#save_new_donation').click(function(e) {
e.preventDefault();
let income_account = $('#income_account').val();
let donation_date = $('#new_donation_date').val();
let donation_amount = $('#new_donation_amount').val();
let donation_memo = $('#new_donation_memo').val();
$.ajax({
method: 'POST',
url: '/banking/store_other_income_deposit',
data: {
'income_account': income_account,
'donation_date' : donation_date,
'donation_amount' : donation_amount,
'donation_memo' : donation_memo,
},
success: function(response) {
$('.register_donation').modal('hide');
},
error: function(error) {
console.log(error);
}
});
});
$('#deposit_date').change(function (){
let bank = $('#deposit_to').val();
let date = this.value;
if(bank === ""){
alert('Please select a bank account.')
}
else{
$.ajax({
method: 'POST',
url: '/banking/get_current_account_balance_per_date',
data: {
'bank': bank,
'date' : date
},
success: function(response) {
var acc_bal = 0;
if (response != "null") {
var bank_record = JSON.parse(response);
acc_bal = bank_record.account_balance;
}
$('#current_balance').val(numberWithCommas(acc_bal));
},
error: function(error) {
console.log(error);
}
});
}
});
</script>
<script type="text/javascript">
jQuery('#deposit_date, #new_donation_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$(".input_fields_wrap").on('change', '.select', function() {
var i = parseInt(this.id.substr(this.id.indexOf("_") + 1));
var income_account = $("#account_" + i).val();
var total_field = $("#total_amount");
if (income_account === "") {
alert("Please select an account please...!");
return false;
}
var final_total = 0;
$("[id^='amount_']").each(function() {
final_total += Number($(this).val());
});
$('#total_amount').val(final_total);
// $.ajax({
// method: 'POST',
// url: '/banking/get_other_income_account_balance',
// data: {
// 'date': date,
// 'income_account': income_account
// },
//
// success: function(response) {
//
// if(response != "null"){ // if response is not null
// let data = JSON.parse(response);
// balance.val(data['account_balance'])
// }else{
// balance.val(0)
// $('#amount_'+ i).val(0)
// $('#amount_'+ i).prop('disabled', true)
// $('#account_'+ i).prop('disabled', true)
// $('#memo_'+ i).prop('disabled', true)
// }
// var final_total = 0;
// $("[id^='amount_']").each(function() {
// final_total += Number($(this).val());
// });
// total_field.val(final_total);
// },
// error: function(error) {
// console.log(error);
// }
// });
});
$(".full-wrapper").on('click', function () {
var total_field = $("#total_amount");
var final_total = 0;
$("[id^='amount_']").each(function() {
final_total += Number($(this).val());
});
$('#total_amount').val(final_total);
});
var max_fields = 20; //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_item"); //Add button ID
var x = 1; //initlal text box count
$(add_button).click(function(e) { //on add input button click
e.preventDefault();
if (x < max_fields) { //max input box allowed
x++; //text box increment
$(wrapper).append("\
<div class='row'>\n\
<div class='span1'></div>\n\
\n\
<div class='col-3'>\n\
<div class='form-group'>\n\
<div class='form-group'>\n\
<select name='account[]' id='account_" + x + "' class='form-control select'>\n\
<?php echo $options; ?>\n\
</select>\n\
</div>\n\
</div>\n\
</div>\n\
\n\
<div class='col-2'>\n\
<div class='form-group'>\n\
<input type='number' min=0 value=0 name='amount[]' id='amount_" + x + "' class='form-control compulsory'>\n\
</div>\n\
</div>\n\
\n\
<div class='col-2'>\n\
<div class='form-group'>\n\
<div class='form-group'>\n\
<?php echo $payment_method_options; ?>\n\
</div>\n\
</div>\n\
</div>\n\
\n\
<div class='col-4'>\n\
<div>\n\
<div class='form-group'>\n\
<textarea name='memo[]'" + x + "' class='form-control' rows='3' cols='4'></textarea>\n\
</div>\n\
</div>\n\
</div>\n\
\n\
<div class='col-1'>\n\
<div class=''>\n\
<div class='form-group' style='margin-top: 5 px;'>\n\
&nbsp;<a href='# ' class='remove_field btn btn-danger' style='margin-top: 5 px;'><i class='fa fa-times'></i></a>\n\
</div>\n\
</div>\n\
</div>\n\
</div>\n\
"); //add input box
}
});
$(wrapper).on("click", ".remove_field", function(e) { //user click on remove text
e.preventDefault();
$(this).parent('div').parent('div').parent('div').parent('div').remove();
var final_total = 0;
var total_field = $("#total_amount");
$("[id^='amount_']").each(function() {
final_total += Number($(this).val());
});
total_field.val(final_total);
x--;
});
</script>
@endpush
@@ -0,0 +1,280 @@
@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" />
@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">{{ __('banking.bank_deposit_history') }}</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> {{ __('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> {{ __('banking.bank_deposit_history') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-body">
{{ Form::open(['method'=>'post','route' => 'banking.deposit_history']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>{{ __('banking.deposit_by') }}</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-3">
<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>{{ __('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-2">
<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">
<h2><strong>{{ __('banking.deposit_history') }}</strong></h2>
<br/>
@if(isset($display))
<h3 class="label label-info"> {!! isset($display) ? $display : '' !!}</h3>
@endif
<br/>
<br/>
@php
$amount_total = 0;
$account_balance_total = 0;
@endphp
<div class="table-responsive">
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('banking.staff_in_charge') }}</th>
<th>{{ __('banking.deposit_from') }}</th>
<th>{{ __('banking.deposit_to') }}</th>
<th>{{ __('banking.date') }}</th>
<th>{{ __('banking.amount') }}</th>
<th>{{ __('banking.account_balance') }}</th>
</tr>
</thead>
<tbody>
@if(count($deposits) > 0)
@foreach($deposits as $item)
<tr>
<td>{{ get_full_name($item->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ isset($chart_of_accounts[$item->other_accounts]) ? $chart_of_accounts[$item->other_accounts] : ("N/A") }}</td>
<td>{{ get_name($item->bank, 'id', 'name', 'chart_of_accounts') }}</td>
<td>{{ streamline_date($item->trans_date) }}</td>
<td>{{ ugandan_shillings($item->credit) }}</td>
<td>{{ ugandan_shillings($item->account_balance) }}</td>
</tr>
@php
$amount_total += $item->credit;
$account_balance_total += $item->account_balance;
@endphp
@endforeach
@endif
</tbody>
@if(count($deposits) > 0)
<tr>
<td colspan="3"></td>
<td>
<strong>{{ __('banking.total') }}</strong>
</td>
<td>
{{ ugandan_shillings($amount_total) }}
</td>
<td>
{{ ugandan_shillings($account_balance_total) }}
</td>
</tr>
@endif
</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>
$('#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();
}
});
function bank_deposit(cashier_income_id, amount) {
$('#deposit_amount').val(amount);
$('#cashier_income_id').val(cashier_income_id);
$('#banking_modal').modal('show');
}
$('#confirm_deposit').click(function () {
var cashier_income_id = $('#cashier_income_id').val();
var deposit_amount = $('#deposit_amount').val();
var deposit_account = $('#deposit_account').val();
var deposit_date = $('#deposit_date').val();
$.ajax({
method: 'POST',
url: '/banking/quick_bank_deposit',
data: {
'cashier_income_id' : cashier_income_id,
'deposit_amount' : deposit_amount,
'deposit_account' : deposit_account,
'deposit_date' : deposit_date,
},
success: function(response){
console.log(response);
$('#banking_modal').modal('hide');
$('#bank_' + cashier_income_id).hide();
$('#div_' + cashier_income_id).append("<label class='label label-success'>BANKED</label>");
},
error: function (error) {
console.log(error);
}
});
});
function get_acc_bal(bank_id) {
$.ajax({
method: 'POST',
url: '/banking/get_current_account_balance',
data: {'bank_id' : bank_id},
success: function(response){
var acc_bal = response[0].balance;
var amount = $('#deposit_amount').val();
$('#current_account_balance').val(acc_bal);
$('#new_account_balance').val(acc_bal + parseInt(amount));
},
error: function (error) {
console.log(error);
}
});
}
</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 type="text/javascript">
jQuery('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script type="text/javascript">
jQuery('#start_date ,#deposit_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"aoColumnDefs": [{
"aTargets": [2,3],
"defaultContent": "",
}]
});
</script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#staff_member').select2({
placeholder: "-- select --"
});
</script>
@endpush
@@ -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
@@ -0,0 +1,343 @@
@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" />
@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">{{ __('banking.bank_register_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> {{ __('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>{{ __('banking.bank_register_report') }}</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.register']) }}
<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/>
@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>Transaction ID</th>
<th>{{ __('banking.transaction_date') }}</th>
<th>{{ __('banking.record_date') }}</th>
<th>{{ __('banking.staff_in_charge') }}</th>
<th>{{ __('banking.type') }}</th>
<th>{{ __('banking.account') }}</th>
<th>{{ __('banking.memo') }}</th>
<th>{{ __('banking.decrease') }}</th>
<th>{{ __('banking.increase') }}</th>
<th>{{ __('banking.balance') }}</th>
{{--
@if(Auth::user()->can('banking-reverse'))
<th>{{ __('banking.action') }}</th>
@endif
--}}
</tr>
</thead>
<tbody>
@if(count($records) > 0)
@foreach($records as $record)
@php
$sum_credit += $record->credit;
$sum_debit += $record->debit;
@endphp
<tr>
<td>{{ $record->trans_id }}</td>
<td>{{ streamline_date($record->trans_date) }}</td>
<td>{{ streamline_date_time_short($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> @else <td> - </td> @endif
@if($record->credit != 0) <td>{{ ugandan_shillings($record->credit) }}</td> @else <td> - </td> @endif
<td>{{ ugandan_shillings($record->account_balance) }}</td>
@if($loop->last)
@php $sum_balance = $record->account_balance; @endphp
@endif
{{--
@if(Auth::user()->can('banking-reverse'))
<td>
<a class="btn-sm btn btn-danger btn-rounded"
onclick="return confirm('Are you sure you want to reverse this transaction ?')"
href="{{ route('banking.reverse', $record->trans_id) }}">
<i class="fa fa-trash"></i>
Reverse
</a>
</td>
@endif
--}}
</tr>
@endforeach
@endif
</tbody>
@if(count($records) > 0)
<tr>
<td colspan="8"></td>
<td>
<strong>{{ __('banking.current_running_balance') }}</strong>
</td>
<td>
{{ ugandan_shillings($sum_balance) }}
</td>
{{--
@if(Auth::user()->can('banking-reverse'))
<td></td>
@endif
--}}
</tr>
@endif
</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>
$('#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();
}
});
function bank_deposit(cashier_income_id, amount) {
$('#deposit_amount').val(amount);
$('#cashier_income_id').val(cashier_income_id);
$('#banking_modal').modal('show');
}
$('#confirm_deposit').click(function () {
var cashier_income_id = $('#cashier_income_id').val();
var deposit_amount = $('#deposit_amount').val();
var deposit_account = $('#deposit_account').val();
var deposit_date = $('#deposit_date').val();
$.ajax({
method: 'POST',
url: '/banking/quick_bank_deposit',
data: {
'cashier_income_id' : cashier_income_id,
'deposit_amount' : deposit_amount,
'deposit_account' : deposit_account,
'deposit_date' : deposit_date,
},
success: function(response){
console.log(response);
$('#banking_modal').modal('hide');
$('#bank_' + cashier_income_id).hide();
$('#div_' + cashier_income_id).append("<label class='label label-success'>BANKED</label>");
},
error: function (error) {
console.log(error);
}
});
});
function get_acc_bal(bank_id) {
$.ajax({
method: 'POST',
url: '/banking/get_current_account_balance',
data: {'bank_id' : bank_id},
success: function(response){
var acc_bal = response[0].balance;
var amount = $('#deposit_amount').val();
$('#current_account_balance').val(acc_bal);
$('#new_account_balance').val(acc_bal + parseInt(amount));
},
error: function (error) {
console.log(error);
}
});
}
</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 type="text/javascript">
jQuery('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script type="text/javascript">
jQuery('#start_date ,#deposit_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"aoColumnDefs": [{
"aTargets": [2,3],
"defaultContent": "",
}],
ordering: false,
pageLength : 100,
});
</script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#staff_member').select2({
placeholder: "-- select --"
});
</script>
@endpush
@@ -0,0 +1,311 @@
@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" />
@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">{{ __('banking.bank_transfer') }}</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> {{ __('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> {{ __('banking.new_bank_transfer') }}</li>
</ol>
</div>
</div>
@php
$balance = 0;
@endphp
@include('flash::message')
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-body">
{{ Form::open(['route' => 'banking.process_transfer', 'data-toggle' => 'validator', 'id'=>'bank_transfer_form']) }}
<h2 class="text-center"><strong>{{ __('banking.transfer_funds') }}</strong></h2>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>{{ __('banking.transfer_from') }}</label>
<select class="form-control compulsory required" name="transfer_from" id="transfer_from" required>
<option value="">{{ __('banking.select') }}</option>
@foreach($banks as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label>{{ __('banking.transfer_to') }}</label>
<select class="form-control compulsory required" name="transfer_to" id="transfer_to" required>
<option value="">{{ __('banking.select') }}</option>
@foreach($banks as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label>{{ __('banking.date') }} :</label>
<div class="input-group">
<input class="center form-control" id="transfer_date" readonly style="padding: 2px;border: 1px solid #ddd;" name="transfer_date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>{{ __('banking.account_balance_from_account') }}</label>
<div class="input-group">
<input class="center form-control" id="from_account_balance" type="number" value="0" readonly style="padding: 2px;border: 1px solid #ddd;" name="from_account_balance">
<span class="input-group-addon">{{ __('banking.ugx') }}</span>
</div>
</div>
<div class="form-group">
<label>{{ __('banking.account_balance_to_account') }}</label>
<div class="input-group">
<input class="center form-control" id="to_account_balance" value="0" type="number" readonly style="padding: 2px;border: 1px solid #ddd;" name="to_account_balance">
<span class="input-group-addon">{{ __('banking.ugx') }}</span>
</div>
</div>
<div class="form-group">
<label>{{ __('banking.amount') }} :</label>
<div class="input-group">
<input class="center form-control compulsory" required id="transfer_amount" type="number" style="padding: 2px;border: 1px solid #ddd;" name="transfer_amount">
<span class="input-group-addon">{{ __('banking.ugx') }}</span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>{{ __('banking.memo') }} :</label>
<div class="input-group">
{{ Form::textarea('transfer_memo', '', ['class'=>'form-control compulsory required', 'id'=>'transfer_memo']) }}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-10"></div>
<div class="col-md-2">
<button type="submit" class="btn btn-success btn-block btn-rounded float-right" style="display: none;" id="confirm_deposit">{{ __('banking.transfer') }}</button>
</div>
</div>
{{ Form::close() }}
</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>
$('#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();
}
});
function bank_deposit(cashier_income_id, amount) {
$('#deposit_amount').val(amount);
$('#cashier_income_id').val(cashier_income_id);
$('#banking_modal').modal('show');
}
$('#transfer_date').on('change', function() {
var transfer_to = $('#transfer_to').val();
var transfer_from = $('#transfer_from').val();
var transfer_date = this.value;
console.log(transfer_date)
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); // January is 0!
var yyyy = today.getFullYear();
var today_formatted = dd + '-' + mm + '-' + yyyy;
$.ajax({
method: 'POST',
url: '/banking/get_latest_bank_balance',
data: {
'to': transfer_to,
'from': transfer_from,
'date': today_formatted, // transfer_date,
},
success: function(response) {
$('#to_account_balance').val(parseInt(response[0]));
$('#from_account_balance').val(parseInt(response[1]));
},
error: function(error) {
console.log(error);
}
});
});
// $('#transfer_from').on('change', function () {
// var account = this.value;
// if(account != ""){
// $.ajax({
// method: 'POST',
// url: '/banking/get_current_account_balance',
// data: {'bank_id' : account},
//
// success: function(response){ console.log(response);
// var acc_bal = response['account_balance'];
// $('#from_account_balance').val(acc_bal);
// },
// error: function (error) {
// console.log(error);
// }
// });
// }else{
// alert('Please an account that you wish to transfer funds from..!');
// $('#from_account_balance').val(0);
// }
// });
//
// $('#transfer_to').on('change', function () {
// var account = this.value;
// if(account != ""){
// $.ajax({
// method: 'POST',
// url: '/banking/get_current_account_balance',
// data: {'bank_id' : account},
//
// success: function(response){ console.log(response)
// var acc_bal = response['account_balance'];
// $('#to_account_balance').val(acc_bal);
// },
// error: function (error) {
// console.log(error);
// }
// });
// }else{
// alert('Please an account that you wish to transfer funds To..!');
// $('#from_account_balance').val(0);
// }
// });
$('#transfer_amount').on('change', function() {
var amount = parseInt(this.value);
var from_account_balance = $('#from_account_balance').val();
var from_account = $('#transfer_from').val();
var to_account = $('#transfer_to').val();
if (from_account != "" && to_account != "") {
if (amount <= from_account_balance) {
$.ajax({
method: 'POST',
url: '/banking/transfer/compute_transfer',
data: {
'amount': amount,
'from_account': from_account,
'to_account': to_account,
},
success: function(response) {
// $('#to_account_balance').val(parseInt(response.new_to_acc_bal));
// $('#from_account_balance').val(parseInt(response.new_from_acc_bal));
$('#confirm_deposit').show();
},
error: function(error) {
console.log(error);
}
});
} else {
var isConfirmed = confirm('You are trying to transfer funds that are more than the balance on the account');
if (isConfirmed == true) {
$('#confirm_deposit').show();
} else {
$('#transfer_amount').val(0);
$('#confirm_deposit').hide();
}
}
} else {
alert('Please be sure to the select the accounts that you with to transfer to and from.');
$('#transfer_amount').val(0);
$('#confirm_deposit').hide();
}
});
$('#confirm_deposit').click(function() {
$('#bank_transfer_form').submit();
$(this).attr("disabled", true);
});
</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 type="text/javascript">
jQuery('#transfer_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"aoColumnDefs": [{
"aTargets": [2, 3],
"defaultContent": "",
}]
});
</script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#staff_member_cashier').select2({
placeholder: "-- select --"
});
$('#staff_member_accountant').select2({
placeholder: "-- select --"
});
</script>
@endpush
@@ -0,0 +1,276 @@
@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" />
@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">{{ __('banking.bank_transfer_history') }}</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> {{ __('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> {{ __('banking.bank_transfer_history') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-body">
{{ Form::open(['method'=>'post','route' => 'banking.transfer_history']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>{{ __('banking.transfer_by') }}</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-3">
<div class="form-group">
<label>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 for="start_date">{{ __('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-2">
<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"/>
<h2><strong>{{ __('banking.transfer_history') }}</strong></h2>
<br/>
@if(isset($display))
<h3 class="label label-info"> {!! isset($display) ? $display : '' !!}</h3>
@endif
@php
$sum_total = 0;
@endphp
<br/>
<br/>
<div class="table-responsive">
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('banking.staff_in_charge') }}</th>
<th>{{ __('banking.deposit_from') }}</th>
<th>{{ __('banking.deposit_to') }}</th>
<th>{{ __('banking.date') }}</th>
{{-- <th>{{ __('banking.previous_balance_from_account') }}</th>--}}
<th>{{ __('banking.account_balance') }}</th>
<th>{{ __('banking.amount') }}</th>
</tr>
</thead>
<tbody>
@if(count($transfers) > 0)
@foreach($transfers as $item)
<tr>
<td>{{ get_full_name($item->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ get_name($item->bank, 'id', 'name', 'chart_of_accounts') }}</td>
<td>{{ isset($chart_of_accounts[$item->other_accounts]) ? $chart_of_accounts[$item->other_accounts] : ("N/A") }}</td>
<td>{{ streamline_date($item->trans_date) }}</td>
{{-- <td>{{ ugandan_shillings($item->previous_from_account_balance) }}</td>--}}
<td>{{ ugandan_shillings($item->account_balance) }}</td>
<td>{{ ugandan_shillings($item->debit) }}</td>
</tr>
@php
$sum_total += $item->credit;
@endphp
@endforeach
@endif
</tbody>
@if(count($transfers) > 0)
<tr>
<td colspan="4"></td>
<td>
<strong>{{ __('banking.total') }}</strong>
</td>
<td>
{{ ugandan_shillings($sum_total) }}
</td>
</tr>
@endif
</table>
</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>
$('#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();
}
});
function bank_deposit(cashier_income_id, amount) {
$('#deposit_amount').val(amount);
$('#cashier_income_id').val(cashier_income_id);
$('#banking_modal').modal('show');
}
$('#confirm_deposit').click(function () {
var cashier_income_id = $('#cashier_income_id').val();
var deposit_amount = $('#deposit_amount').val();
var deposit_account = $('#deposit_account').val();
var deposit_date = $('#deposit_date').val();
$.ajax({
method: 'POST',
url: '/banking/quick_bank_deposit',
data: {
'cashier_income_id' : cashier_income_id,
'deposit_amount' : deposit_amount,
'deposit_account' : deposit_account,
'deposit_date' : deposit_date,
},
success: function(response){
console.log(response);
$('#banking_modal').modal('hide');
$('#bank_' + cashier_income_id).hide();
$('#div_' + cashier_income_id).append("<label class='label label-success'>BANKED</label>");
},
error: function (error) {
console.log(error);
}
});
});
function get_acc_bal(bank_id) {
$.ajax({
method: 'POST',
url: '/banking/get_current_account_balance',
data: {'bank_id' : bank_id},
success: function(response){
var acc_bal = response[0].balance;
var amount = $('#deposit_amount').val();
$('#current_account_balance').val(acc_bal);
$('#new_account_balance').val(acc_bal + parseInt(amount));
},
error: function (error) {
console.log(error);
}
});
}
</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 type="text/javascript">
jQuery('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script type="text/javascript">
jQuery('#start_date ,#deposit_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"aoColumnDefs": [{
"aTargets": [2,3],
"defaultContent": "",
}]
});
</script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#staff_member').select2({
placeholder: "-- select --"
});
</script>
@endpush
@@ -0,0 +1,18 @@
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/banking', function () {
return "Banking";
});
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale','subscription-tracking']], function () {
/* Banking */
Route::any('/banking/deposit', 'BankingController@deposit')->name('banking.deposit');
Route::any('/banking/bank_deposit_slip/{trans_id}', 'BankingController@bank_deposit_slip')->name('banking.bank_deposit_slip');
Route::any('/banking/quick_bank_deposit', 'BankingController@quick_bank_deposit')->name('banking.quick_bank_deposit');
Route::any('/banking/transfer', 'BankingController@transfer')->name('banking.transfer');
Route::any('/banking/transfer/compute_transfer', 'BankingController@compute_transfer')->name('banking.transfer.compute_transfer');
Route::any('/banking/transfer_history', 'BankingController@transfer_history')->name('banking.transfer_history');
Route::any('/banking/deposit_history', 'BankingController@deposit_history')->name('banking.deposit_history');
Route::any('/banking/process_deposit', 'BankingController@process_deposit')->name('banking.process_deposit');
Route::any('/banking/process_transfer', 'BankingController@process_transfer')->name('banking.process_transfer');
Route::any('/banking/get_current_account_balance', 'BankingController@get_current_account_balance')->name('banking.get_current_account_balance');
Route::any('/banking/get_current_account_balance_per_date', 'BankingController@get_current_account_balance_per_date')->name('banking.get_current_account_balance_per_date');
Route::any('/banking/get_opening_account_balance', 'BankingController@get_opening_account_balance')->name('banking.get_opening_account_balance');
Route::any('/banking/get_latest_bank_balance', 'BankingController@get_latest_bank_balance')->name('banking.get_latest_bank_balance');
Route::any('/banking/get_last_reconciliation_balance', 'BankingController@get_last_reconciliation_balance')->name('banking.get_last_reconciliation_balance');
Route::any('/banking/get_other_income_account_balance', 'BankingController@get_other_income_account_balance')->name('banking.get_other_income_account_balance');
Route::any('/banking/store_other_income_deposit', 'BankingController@store_other_income_deposit')->name('banking.store_other_income_deposit');
/* Banking Records */
Route::any('/banking/reverse/{trans_id}', 'BankingController@reverse')->name('banking.reverse');
Route::any('/banking/register', 'BankingController@register')->name('banking.register');
Route::any('/banking/write_off_balance', 'BankingController@write_off_balance')->name('banking.write_off_balance');
Route::any('/banking/reconcile', 'BankingController@reconcile')->name('banking.reconcile');
Route::any('/banking/reconcile/reports', 'BankingController@reconciliation_reports')->name('banking.reconcile.reports');
Route::any('/banking/finish_adjustment', 'BankingController@finish_adjustment')->name('banking.finish_adjustment');
Route::any('/banking/finish_with_balance', 'BankingController@finish_with_balance')->name('banking.finish_with_balance');
Route::any('/banking/finish_reconciling', 'BankingController@finish_reconciling')->name('banking.finish_reconciling');
Route::any('/bank/reconciliation/report/{id}', 'BankingController@bank_reconciliation_report')->name('bank.reconciliation.report');
Route::any('/banking/print_bank_reconciliation/{id}', 'BankingController@print_bank_reconciliation')->name('banking.print_bank_reconciliation');
Route::any('/banking/undo_bank_reconciliation/{id}', 'BankingController@undo_bank_reconciliation')->name('banking.undo_bank_reconciliation');
});
@@ -0,0 +1,19 @@
image: alpine/git:latest
pipelines:
branches:
main:
- step:
name: Merge To Beta
script:
- git remote set-url origin https://Kabricks:${APP_SECRET}@bitbucket.org/dcsammi/${BITBUCKET_REPO_SLUG}
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch
- git checkout beta
- git merge main
- git commit --amend -m "[skip ci] Merge changes from main"
- git push
- step:
name: Deploy To Test
script:
- echo "Ready to deploy to demo or production!"
@@ -0,0 +1,11 @@
{
"name": "Banking",
"alias": "banking",
"description": "Banking module",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Banking\\Providers\\BankingServiceProvider"
],
"files": []
}