Compare commits
2 Commits
f8e6dbb81e
...
26273d92c2
| Author | SHA1 | Date | |
|---|---|---|---|
| 26273d92c2 | |||
| d849bd41ff |
@@ -108,12 +108,47 @@ class DailySalePaymentReportModuleController extends Controller
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// --- Table 3: Payment Method Summary Calculation ---
|
||||||
|
$summaryData = [];
|
||||||
|
|
||||||
|
// මුලින්ම හැම Payment Option එකටම බින්දුව දාලා Array එකක් හදාගන්නවා
|
||||||
|
foreach ($paymentOptions as $option) {
|
||||||
|
$summaryData[$option->id] = [
|
||||||
|
'name' => $option->name,
|
||||||
|
'sale_amount' => 0,
|
||||||
|
'received_amount' => 0,
|
||||||
|
'total_amount' => 0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table 1 (Daily Sales) වල සල්ලි ටික එකතු කරනවා
|
||||||
|
foreach ($sales_data as $sale) {
|
||||||
|
foreach ($paymentOptions as $option) {
|
||||||
|
$amount = $sale->methods[$option->id] ?? 0;
|
||||||
|
$summaryData[$option->id]['sale_amount'] += $amount;
|
||||||
|
$summaryData[$option->id]['total_amount'] += $amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table 2 (Credit Collections) වල සල්ලි ටික එකතු කරනවා
|
||||||
|
foreach ($creditCollections as $credit) {
|
||||||
|
foreach ($paymentOptions as $option) {
|
||||||
|
$amount = $credit['methods'][$option->id] ?? 0;
|
||||||
|
$summaryData[$option->id]['received_amount'] += $amount;
|
||||||
|
$summaryData[$option->id]['total_amount'] += $amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view('dailysalepaymentreportmodule::index', compact(
|
return view('dailysalepaymentreportmodule::index', compact(
|
||||||
'sales_data',
|
'sales_data',
|
||||||
'report_date',
|
'report_date',
|
||||||
'paymentOptions',
|
'paymentOptions',
|
||||||
'creditCollections',
|
'creditCollections',
|
||||||
'creditTotals',
|
'creditTotals',
|
||||||
|
'summaryData'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
@extends('backend.layout.main')
|
@extends('backend.layout.main')
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
@if ($errors->has('title'))
|
@if ($errors->has('title'))
|
||||||
<div class="alert alert-danger alert-dismissible text-center">
|
<div class="alert alert-danger alert-dismissible text-center">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
|
||||||
aria-hidden="true">×</span></button>{{ $errors->first('title') }}
|
aria-hidden="true">×</span></button>{{ $errors->first('title') }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if (session()->has('message'))
|
@if (session()->has('message'))
|
||||||
<div class="alert alert-success alert-dismissible text-center">
|
<div class="alert alert-success alert-dismissible text-center">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>{{ session()->get('message') }}
|
</button>{{ session()->get('message') }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if (session()->has('not_permitted'))
|
@if (session()->has('not_permitted'))
|
||||||
<div class="alert alert-danger alert-dismissible text-center">
|
<div class="alert alert-danger alert-dismissible text-center">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>{{ session()->get('not_permitted') }}
|
</button>{{ session()->get('not_permitted') }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div style="border-radius: 30px;" class="card pb-4 ">
|
<div style="border-radius: 30px;" class="card pb-4 ">
|
||||||
<link rel="stylesheet" href="{{ asset('public/css/cloudma.css') }}">
|
<link rel="stylesheet" href="{{ asset('public/css/cloudma.css') }}">
|
||||||
@@ -62,9 +62,9 @@
|
|||||||
<button class="btn btn-info" onclick="exportFullReport('csv')" style="border-radius: 10px;">
|
<button class="btn btn-info" onclick="exportFullReport('csv')" style="border-radius: 10px;">
|
||||||
<i class="fa fa-file-text-o"></i> Export CSV
|
<i class="fa fa-file-text-o"></i> Export CSV
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-secondary" onclick="window.print()" style="border-radius: 10px;">
|
<!-- <button class="btn btn-secondary" onclick="window.print()" style="border-radius: 10px;">
|
||||||
<i class="fa fa-print"></i> Print Report
|
<i class="fa fa-print"></i> Print Report
|
||||||
</button>
|
</button> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -182,7 +182,6 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container-fluid mt-5 mb-5">
|
<div class="container-fluid mt-5 mb-5">
|
||||||
<!-- Payment Method Summary Table -->
|
<!-- Payment Method Summary Table -->
|
||||||
@@ -200,57 +199,41 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@php
|
||||||
|
$grand_sale = 0;
|
||||||
|
$grand_received = 0;
|
||||||
|
$grand_total = 0;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@foreach ($summaryData as $summary)
|
||||||
<tr>
|
<tr>
|
||||||
<td>Cash</td>
|
<td>{{ $summary['name'] }}</td>
|
||||||
<td>0.00</td>
|
<td class="text-right">{{ number_format($summary['sale_amount'], 2) }}</td>
|
||||||
<td>0.00</td>
|
<td class="text-right">{{ number_format($summary['received_amount'], 2) }}</td>
|
||||||
<td>0.00</td>
|
<td class="text-right">{{ number_format($summary['total_amount'], 2) }}</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Card 1</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Card 2</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Card 3</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Online Transfer</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Link Pay</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
<td>0.00</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
@php
|
||||||
|
$grand_sale += $summary['sale_amount'];
|
||||||
|
$grand_received += $summary['received_amount'];
|
||||||
|
$grand_total += $summary['total_amount'];
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot style="background-color: #cdd4da; font-weight: bold;">
|
<tfoot style="background-color: #cdd4da; font-weight: bold;">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-right">Grand Total</td>
|
<td class="text-right">Grand Total</td>
|
||||||
<td>0.00</td>
|
<td class="text-right">{{ number_format($grand_sale, 2) }}</td>
|
||||||
<td>0.00</td>
|
<td class="text-right">{{ number_format($grand_received, 2) }}</td>
|
||||||
<td>0.00</td>
|
<td class="text-right">{{ number_format($grand_total, 2) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.bootstrap-select.form-control,
|
.bootstrap-select.form-control,
|
||||||
.form-control,
|
.form-control,
|
||||||
.input-group-text {
|
.input-group-text {
|
||||||
@@ -273,12 +256,12 @@
|
|||||||
table {
|
table {
|
||||||
border-collapse: collapse !important;
|
border-collapse: collapse !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
@@ -295,5 +278,5 @@
|
|||||||
|
|
||||||
window.location.href = exportUrl;
|
window.location.href = exportUrl;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
Reference in New Issue
Block a user