credit sale collection tfoot
This commit is contained in:
@@ -25,6 +25,17 @@ class DailySalePaymentReportModuleController extends Controller
|
|||||||
|
|
||||||
$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')
|
$sales = DB::table('sales')
|
||||||
->leftJoin('users', 'sales.user_id', '=', 'users.id')
|
->leftJoin('users', 'sales.user_id', '=', 'users.id')
|
||||||
@@ -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)
|
private function getCreditSaleCollections($date)
|
||||||
|
|||||||
@@ -174,9 +174,9 @@
|
|||||||
<tfoot style="background-color: #cdd4da; font-weight: bold;">
|
<tfoot style="background-color: #cdd4da; font-weight: bold;">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" class="text-right">Total</td>
|
<td colspan="4" class="text-right">Total</td>
|
||||||
<td>0.00</td>
|
<td>{{ number_format($creditTotals['grand_total'], 2) }}</td>
|
||||||
@foreach ($paymentOptions as $option)
|
@foreach ($paymentOptions as $option)
|
||||||
<td>0.00</td>
|
<td>{{ number_format($creditTotals['methods'][$option->id] ?? 0, 2) }}</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|||||||
Reference in New Issue
Block a user