36 lines
1008 B
PHP
36 lines
1008 B
PHP
<?php
|
|
|
|
use Carbon\Carbon;
|
|
use Dipper\Excel\Excel;
|
|
use Dipper\Excel\Reader;
|
|
use Dipper\Excel\Writer;
|
|
use Dipper\Excel\QueuedWriter;
|
|
use App\Domains\Export\Services\ExportService;
|
|
use App\Domains\Stats\Exports\CompanyReportExport;
|
|
|
|
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
|
|
|
$conditions = [
|
|
'type' => [0, 1],
|
|
'company_name' => '福建车媒通网络科技有限公司',
|
|
'month' => '2016-01'
|
|
];
|
|
|
|
$start = Carbon::parse('2016-01')->startOfMonth();
|
|
$end = Carbon::parse('2019-07')->endOfMonth();
|
|
|
|
for ($i = 0; $i <= $end->diffInMonths($start); $i++) {
|
|
$month = $start->copy()->addMonths($i)->format('Y-m');
|
|
$conditions['month'] = $month;
|
|
echo $month . PHP_EOL;
|
|
$export = new CompanyReportExport($conditions);
|
|
$excel = new Excel(
|
|
app()->make(Writer::class),
|
|
app()->make(QueuedWriter::class),
|
|
app()->make(Reader::class),
|
|
app()->make('filesystem')
|
|
);
|
|
$excel->store($export, $export->filename, 'public');
|
|
unset($export);
|
|
}
|