update marketing
All checks were successful
All checks were successful
This commit is contained in:
@@ -13,20 +13,27 @@ public function view(): View
|
||||
$suppliers = Party::with('purchases')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('type', '=', 'Supplier')
|
||||
->when(request('search'), function ($q) {
|
||||
$q->where(function ($q) {
|
||||
$q->where('name', 'like', '%' . request('search') . '%')
|
||||
->orWhere('phone', 'like', '%' . request('search') . '%')
|
||||
->orWhere('type', 'like', '%' . request('search') . '%');
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->get();
|
||||
->limit(request('per_page') ?? 20)->get();
|
||||
|
||||
$totalAmount = $suppliers->sum(function ($customer) {
|
||||
$totalAmount = $suppliers->sum(function ($customer) {
|
||||
return $customer->purchases?->sum('totalAmount') ?? 0;
|
||||
});
|
||||
});
|
||||
|
||||
$totalPaid = $suppliers->sum(function ($customer) {
|
||||
return $customer->purchases?->sum('paidAmount') ?? 0;
|
||||
});
|
||||
$totalPaid = $suppliers->sum(function ($customer) {
|
||||
return $customer->purchases?->sum('paidAmount') ?? 0;
|
||||
});
|
||||
|
||||
$totalDue = $suppliers->sum(function ($customer) {
|
||||
return $customer->purchases?->sum('dueAmount') ?? 0;
|
||||
});
|
||||
$totalDue = $suppliers->sum(function ($customer) {
|
||||
return $customer->purchases?->sum('dueAmount') ?? 0;
|
||||
});
|
||||
|
||||
return view('business::party-reports.supplier-ledger.excel-csv', compact('suppliers', 'totalAmount', 'totalPaid', 'totalDue'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user