Ejemplo n.º 1
0
 /** @return Am_Report_Result */
 public function getReport(Am_Report_Result $result = null, Am_Report_Shift $shift = null)
 {
     $needPropagation = true;
     if ($result === null) {
         $needPropagation = false;
         $result = new Am_Report_Result();
         $result->setTitle($this->getTitle());
     }
     $result->setQuantity($this->getQuantity());
     foreach ($this->getLines() as $line) {
         $result->addLine($line, $shift);
     }
     $this->runQuery();
     while ($r = $this->fetchNextRow()) {
         $k = $r[self::POINT_FLD];
         unset($r[self::POINT_FLD]);
         $result->addValues($k, $this->getQuantity()->getLabel($k), $r, $shift);
     }
     if ($needPropagation) {
         $lines = $result->getLines();
         foreach ($result->getPoints() as $point) {
             foreach ($lines as $line) {
                 if (is_null($point->getValue($line->getkey()))) {
                     $point->addValue($line->getkey(), '');
                 }
             }
         }
     }
     $result->sortPoints();
     return $result;
 }
Ejemplo n.º 2
0
 /** @return Am_Report_Result */
 public function getReport(Am_Report_Result $result = null)
 {
     if ($result === null) {
         $result = new Am_Report_Result();
         $result->setTitle($this->getTitle());
     }
     $result->setQuantity($this->getQuantity());
     foreach ($this->getLines() as $line) {
         $result->addLine($line);
     }
     $this->runQuery();
     while ($r = $this->fetchNextRow()) {
         $k = $r[self::POINT_FLD];
         unset($r[self::POINT_FLD]);
         $result->addValues($k, $this->getQuantity()->getLabel($k), $r);
     }
     return $result;
 }