IPC rango y sort

This commit is contained in:
2023-11-30 00:24:08 -03:00
parent d0a85b2149
commit f2efb41977
3 changed files with 16 additions and 10 deletions

View File

@ -17,16 +17,20 @@ class IPC extends Command
$lastMonth = (new DateTimeImmutable())->sub(new DateInterval('P1M'));
$endLastYear = (new DateTimeImmutable())->sub(new DateInterval('P1Y'));
$uri = '/api/money/ipc';
$data = [
'start' => $endLastYear->format('Y-12-1'),
'end' => $lastMonth->format('Y-m-1')
];
$output->writeln("POST {$uri}");
$response = $this->client->post($uri, [
'body' => http_build_query($data),
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
$output->writeln("Response Code: {$response->getStatusCode()}");
$current = new DateTimeImmutable($lastMonth->format('Y-m-d'));
while ($current->diff($endLastYear)->days > 30) {
$data = [
'start' => $endLastYear->format('Y-12-1'),
'end' => $current->format('Y-m-1')
];
$output->writeln("POST {$uri}");
$response = $this->client->post($uri, [
'body' => http_build_query($data),
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
$output->writeln("Response Code: {$response->getStatusCode()}");
$current = $current->sub(new DateInterval('P1M'));
}
return Console\Command\Command::SUCCESS;
}
}