Files
streamline-emr/docker/statistics/Modules/Banking/Resources/views/banking/reconcile/print.blade.php
T
2025-03-31 03:46:05 +03:00

403 lines
25 KiB
PHP
Executable File

<!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>