update marketing
All checks were successful
All checks were successful
This commit is contained in:
@@ -54,7 +54,7 @@ public function index(Request $request)
|
||||
return view('business::party-reports.customer-ledger.index', compact('customers', 'totalAmount', 'totalPaid', 'totalDue'));
|
||||
}
|
||||
|
||||
public function show(Request $request, $partyId, PartyLedgerService $service)
|
||||
public function show(Request $request, string $partyId, PartyLedgerService $service)
|
||||
{
|
||||
$party = Party::find($partyId);
|
||||
$ledger = $service->list($request, $partyId);
|
||||
@@ -78,18 +78,30 @@ public function exportCsv()
|
||||
return Excel::download(new ExportCustomerLedger, 'customer-ledger.csv');
|
||||
}
|
||||
|
||||
public function exportPdf()
|
||||
public function exportPdf(Request $request)
|
||||
{
|
||||
$customers = Party::with('sales')
|
||||
->where('business_id', auth()->user()->business_id)
|
||||
->where('type', '!=', 'Supplier')
|
||||
->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%')
|
||||
->orWhere('phone', 'like', '%' . $request->search . '%')
|
||||
->orWhere('type', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
})
|
||||
->when(request('type'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->where('type', $request->type);
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->get();
|
||||
->limit($request->per_page ?? 20)->get();
|
||||
|
||||
return PdfService::render('business::party-reports.customer-ledger.pdf', compact('customers'),'customer-ledger-report.pdf');
|
||||
}
|
||||
|
||||
public function exportLedgerExcel(Request $request, $partyId, PartyLedgerService $service)
|
||||
public function exportLedgerExcel(Request $request, string $partyId, PartyLedgerService $service)
|
||||
{
|
||||
$party = Party::findOrFail($partyId);
|
||||
|
||||
@@ -98,7 +110,7 @@ public function exportLedgerExcel(Request $request, $partyId, PartyLedgerService
|
||||
return Excel::download(new ExportSingleCustomerLedger($ledger, $party), 'single-customer-ledger.xlsx');
|
||||
}
|
||||
|
||||
public function exportLedgerCsv(Request $request, $partyId, PartyLedgerService $service)
|
||||
public function exportLedgerCsv(Request $request, string $partyId, PartyLedgerService $service)
|
||||
{
|
||||
$party = Party::findOrFail($partyId);
|
||||
|
||||
@@ -107,15 +119,18 @@ public function exportLedgerCsv(Request $request, $partyId, PartyLedgerService $
|
||||
return Excel::download(new ExportSingleCustomerLedger($ledger, $party), 'single-customer-ledger.csv');
|
||||
}
|
||||
|
||||
public function exportLedgerPdf(Request $request, $partyId, PartyLedgerService $service)
|
||||
public function exportLedgerPdf(Request $request, string $partyId, PartyLedgerService $service)
|
||||
{
|
||||
$party = Party::findOrFail($partyId);
|
||||
|
||||
$ledger = $service->list($request, $partyId);
|
||||
|
||||
return PdfService::render(
|
||||
'business::party-reports.customer-ledger.show-details.pdf',
|
||||
compact('ledger', 'party'),
|
||||
$duration = $request->custom_days ?: $request->duration ?: 'today';
|
||||
|
||||
[$fromDate, $toDate] = app(PartyLedgerService::class)->applyDateRange($duration, $request->from_date, $request->to_date);
|
||||
|
||||
return PdfService::render('business::party-reports.customer-ledger.show-details.pdf',
|
||||
compact('ledger', 'party', 'duration', 'fromDate', 'toDate'),
|
||||
strtolower($party->name).'-ledger.pdf'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user