Add the quick sales report
Quick sales of a period by cash day, product, seller and VAT rate, with credits, open cash days flagged, a chart by day or month and CSV. VAT is taken out of each day's total of a rate, as on the cash day balance. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Reports\Presentation\Csv;
|
||||
|
||||
use App\Modules\Reports\Application\UseCases\QuickSalesReport;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Quick sales as CSV: a row per cash day, amounts with VAT in cents.
|
||||
*/
|
||||
class SalesCsv implements ReportCsv
|
||||
{
|
||||
public function __construct(private QuickSalesReport $report) {}
|
||||
|
||||
public function fileName(Request $request): string
|
||||
{
|
||||
$period = CsvFilters::period($request);
|
||||
|
||||
return __('reports.sales.file').'-'.$period->from.'-'.$period->to;
|
||||
}
|
||||
|
||||
public function headers(): array
|
||||
{
|
||||
return array_values(__('reports.sales.csv'));
|
||||
}
|
||||
|
||||
public function rows(Request $request): iterable
|
||||
{
|
||||
foreach ($this->report->execute(CsvFilters::period($request))->days as $day) {
|
||||
yield [
|
||||
$day['day'],
|
||||
$day['count'],
|
||||
$day['cashCents'],
|
||||
$day['cardCents'],
|
||||
$day['totalCents'],
|
||||
__($day['isClosed'] ? 'reports.yes' : 'reports.no'),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user