update marketing
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 5m14s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-14 11:55:22 +07:00
parent f80fcc4c1b
commit 05fd3230b8
448 changed files with 17545 additions and 5128 deletions

View File

@@ -10,13 +10,27 @@ class ExportCurrentStockReport implements FromView
{
public function view(): View
{
return view('business::reports.stocks.excel-csv', [
'stock_reports' => Product::with('stocks')
->where('business_id', auth()->user()->business_id)
->where('product_type', '!=', 'combo')
->withSum('stocks', 'productStock')
->latest()
->get()
]);
$productsQuery = Product::with(['stocks' => function ($q) {
$q->select('id', 'product_id', 'productStock', 'productPurchasePrice', 'productSalePrice');
}])
->where('business_id', auth()->user()->business_id)
->where('product_type', '!=', 'combo');
if (request('search')) {
$productsQuery->where(function ($q) {
$q->where('productName', 'like', '%' . request('search') . '%')
->orWhereHas('stocks', function ($stock) {
$stock->where('productSalePrice', 'like', '%' . request('search') . '%')
->orWhere('productPurchasePrice', 'like', '%' . request('search') . '%');
});
});
}
$stock_reports = $productsQuery
->latest()
->limit($request->per_page ?? 20)
->get();
return view('business::reports.stocks.excel-csv', compact('stock_reports'));
}
}