fix sales chart

This commit is contained in:
yuri
2018-02-05 15:42:56 +02:00
parent 058d821a7c
commit 2bdbba0eff
@@ -207,7 +207,14 @@ class Opportunity extends \Espo\Services\Record
$dt = new \DateTime($dateFrom);
$dtTo = new \DateTime($dateTo);
$dtTo->setDate($dtTo->format('Y'), $dtTo->format('m'), 1);
if (intval($dtTo->format('d')) !== 1) {
$dtTo->setDate($dtTo->format('Y'), $dtTo->format('m'), 1);
$dtTo->modify('+ 1 month');
} else {
$dtTo->setDate($dtTo->format('Y'), $dtTo->format('m'), 1);
}
if ($dt && $dtTo) {
$interval = new \DateInterval('P1M');
while ($dt->getTimestamp() <= $dtTo->getTimestamp()) {