@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | protected $duration_unit; |
34 | 34 | |
35 | - public function __construct(\DateTime $start_date, \DateTime $end_date, Unit $unit, Store $store, \DateInterval $duration_unit){ |
|
35 | + public function __construct(\DateTime $start_date, \DateTime $end_date, Unit $unit, Store $store, \DateInterval $duration_unit) { |
|
36 | 36 | parent::__construct($start_date, $end_date, $unit, $store); |
37 | 37 | $this->duration_unit = $duration_unit; |
38 | 38 | } |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | //var_dump($period); |
54 | 54 | //var_dump($unit); |
55 | 55 | //var_dump($unit_events); |
56 | - foreach ($unit_events as $event){ |
|
57 | - if ($unit == $this->unit->getUnitId()){ |
|
56 | + foreach ($unit_events as $event) { |
|
57 | + if ($unit == $this->unit->getUnitId()) { |
|
58 | 58 | foreach ($period as $dt) { |
59 | 59 | // If event in period involved add value of event |
60 | 60 | // If event is not completely in period involved then add just the percentage that is |
61 | 61 | print_r("Event is: "); |
62 | - print_r($event->getStartDate()->format('Y-m-d H:i:s') ." to "); |
|
63 | - print_r($event->getEndDate()->format('Y-m-d H:i:s') ."\n"); |
|
62 | + print_r($event->getStartDate()->format('Y-m-d H:i:s') . " to "); |
|
63 | + print_r($event->getEndDate()->format('Y-m-d H:i:s') . "\n"); |
|
64 | 64 | print_r("Period is: "); |
65 | - print_r($dt->format('Y-m-d H:i:s') ."\n"); |
|
66 | - if ($event->dateIsInRange($dt)){ |
|
65 | + print_r($dt->format('Y-m-d H:i:s') . "\n"); |
|
66 | + if ($event->dateIsInRange($dt)) { |
|
67 | 67 | print_r("In range adding: " . $event->getValue() . " to event.\n"); |
68 | 68 | $value = $value + $event->getValue(); |
69 | - print_r("Current Value " .$value . "\n"); |
|
69 | + print_r("Current Value " . $value . "\n"); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |