credit sale collection tfoot
This commit is contained in:
@@ -23,7 +23,18 @@ class DailySalePaymentReportModuleController extends Controller
|
||||
->orderBy('id')
|
||||
->get(['id', 'name']);
|
||||
|
||||
$creditCollections = $this->getCreditSaleCollections($report_date);
|
||||
$creditCollections = $this->getCreditSaleCollections($report_date);
|
||||
|
||||
$creditTotals = [
|
||||
'grand_total' => $creditCollections->sum('grand_total'),
|
||||
'methods' => [],
|
||||
];
|
||||
|
||||
foreach ($paymentOptions as $option) {
|
||||
$creditTotals['methods'][$option->id] = $creditCollections->sum(
|
||||
fn($row) => $row['methods'][$option->id] ?? 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$sales = DB::table('sales')
|
||||
@@ -97,7 +108,13 @@ class DailySalePaymentReportModuleController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
return view('dailysalepaymentreportmodule::index', compact('sales_data', 'report_date', 'paymentOptions', 'creditCollections'));
|
||||
return view('dailysalepaymentreportmodule::index', compact(
|
||||
'sales_data',
|
||||
'report_date',
|
||||
'paymentOptions',
|
||||
'creditCollections',
|
||||
'creditTotals',
|
||||
));
|
||||
}
|
||||
|
||||
private function getCreditSaleCollections($date)
|
||||
|
||||
@@ -174,9 +174,9 @@
|
||||
<tfoot style="background-color: #cdd4da; font-weight: bold;">
|
||||
<tr>
|
||||
<td colspan="4" class="text-right">Total</td>
|
||||
<td>0.00</td>
|
||||
<td>{{ number_format($creditTotals['grand_total'], 2) }}</td>
|
||||
@foreach ($paymentOptions as $option)
|
||||
<td>0.00</td>
|
||||
<td>{{ number_format($creditTotals['methods'][$option->id] ?? 0, 2) }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
Reference in New Issue
Block a user