|
|
|
@@ -12,6 +12,7 @@ use App\Repositories\Custom\HelloTechno\ReceiptIssuingOrderRepositoryData as RDA |
|
|
|
use App\Repositories\Custom\HelloTechno\UseSummaryRepository; |
|
|
|
use App\Util\DateUtil; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
use Illuminate\Support\Str; |
|
|
|
use Symfony\Component\HttpFoundation\BinaryFileResponse; |
|
|
|
|
|
|
|
class UseSummaryCSVController extends HelloTechnoController |
|
|
|
@@ -78,10 +79,12 @@ class UseSummaryCSVController extends HelloTechnoController |
|
|
|
$csv->addLine([]); |
|
|
|
$csv->addLine($this->getSummaryHeaderLabels()); |
|
|
|
$sortDef = array_keys($this->getSummaryHeaderLabels()); |
|
|
|
$customerName = "xx"; |
|
|
|
foreach ($summaryList as $row) { |
|
|
|
$csv->addLine($row->toArray(), $sortDef); |
|
|
|
$customerName = $row->customer_name; |
|
|
|
} |
|
|
|
return $csv->download($this->getDownloadFileName()); |
|
|
|
return $csv->download($this->getDownloadFileName($customerName)); |
|
|
|
} |
|
|
|
private function getReceiptIssuingOrdersLabel(): array |
|
|
|
{ |
|
|
|
@@ -130,12 +133,14 @@ class UseSummaryCSVController extends HelloTechnoController |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
private function getDownloadFileName() |
|
|
|
private function getDownloadFileName(string $customerName) |
|
|
|
{ |
|
|
|
|
|
|
|
$customerName = Str::of($customerName)->remove(" ")->remove(" ")->toString(); |
|
|
|
$param = $this->param; |
|
|
|
return sprintf( |
|
|
|
"利用実績_%s_%s_%s_%s.csv", |
|
|
|
$param->customerCode, |
|
|
|
$customerName, |
|
|
|
$param->dateFrom->format('Ymd'), |
|
|
|
$param->dateTo->format('Ymd'), |
|
|
|
DateUtil::now()->format('YmdHis') |
|
|
|
|