mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-09-29 21:13:05 -04:00
StaffPayroll Modules Updates
This commit is contained in:
@@ -207,55 +207,13 @@ class InvoiceController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function show(Invoice $invoice)
|
||||
public function details(Invoice $invoice)
|
||||
{
|
||||
$invoice->load(['user.staff']);
|
||||
$invoice->load(['user.staff', 'items']);
|
||||
|
||||
$videpUploadPayout = InvoiceItem::query()
|
||||
//->selectRaw('name, description, SUM(quantity) as quantity, SUM(amount) as amount, issue_date')
|
||||
//->groupBy('name', 'description')
|
||||
->where('invoice_id', $invoice->id)
|
||||
->where(fn ($query) => $query->where('name', 'Video upload payout'))
|
||||
->orderBy('issue_date', 'asc')
|
||||
->get();
|
||||
|
||||
$otherInvoiceItems = InvoiceItem::query()
|
||||
//->selectRaw('name, description, SUM(quantity) as quantity, SUM(amount) as amount, issue_date')
|
||||
//->groupBy('name', 'description')
|
||||
->where('invoice_id', $invoice->id)
|
||||
->where(fn ($query) => $query->where('name', '!=', 'Video upload payout'))
|
||||
->orderBy('issue_date', 'asc')
|
||||
->get();
|
||||
|
||||
$invoiceItems = collect($videpUploadPayout)->merge($otherInvoiceItems);
|
||||
/*$invoiceItems = collect($invoiceItems)->map(function ($item) {
|
||||
$item->issue_date = \Carbon\Carbon::parse($item->issue_date)->format('m-d-Y');
|
||||
|
||||
return $item;
|
||||
});*/
|
||||
|
||||
$totalItemsAmount = $invoiceItems->pluck('amount')->sum();
|
||||
|
||||
$logoSetting = InvoiceSetting::query()
|
||||
->where('name', 'logo')
|
||||
->first();
|
||||
|
||||
$logo = $logoSetting
|
||||
? asset("/public/storage/{$logoSetting->value}")
|
||||
: asset('/Modules/StaffPayroll/Public/icons/wti.png');
|
||||
|
||||
$generalSetting = GeneralSetting::query()->first();
|
||||
|
||||
|
||||
return [
|
||||
'invoice' => $invoice,
|
||||
'user' => $invoice->user,
|
||||
'items' => $invoiceItems,
|
||||
'total' => number_format($totalItemsAmount, 2),
|
||||
'logo' => $logo,
|
||||
'generalSetting' => $generalSetting,
|
||||
'notes' => $invoice->notes,
|
||||
];
|
||||
return response()->json([
|
||||
'invoice' => $invoice
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(InvoiceRequest $request, Invoice $invoice)
|
||||
|
||||
Reference in New Issue
Block a user