Exemplo n.º 1
0
 function display($parent)
 {
     $pdf = $parent->getPDF();
     $footerFrame = $parent->getFooterFrame();
     if ($this->model) {
         try {
             $template = new Aste_Template($this->template);
             $footer = $template->getBlock('footer');
             $content = $footer->fetch();
             $pdf->writeHTMLCell($footerFrame->w, $footerFrame->h, $footerFrame->x, $footerFrame->y, $content);
         } catch (Aste_Exception $e) {
         }
     }
 }
 function display($parent)
 {
     $pdf = $parent->getPDF();
     $headerFrame = $parent->getHeaderFrame();
     if ($this->model) {
         try {
             $template = new Aste_Template($this->template);
             $header = $template->getBlock('header');
             foreach ($this->model->keys() as $key) {
                 $header->setVar($key, $this->model->get($key));
             }
             $content = $header->fetch();
             $pdf->writeHTMLCell($headerFrame->w, $headerFrame->h, $headerFrame->x, $headerFrame->y, $content);
         } catch (Aste_Exception $e) {
         }
         // Add the border cell at the end
         // This is required to reset Y position for next write
         $pdf->MultiCell($headerFrame->w, $headerFrame->h - $headerFrame->y, "", 0, 'L', 0, 1, $headerFrame->x, $headerFrame->y);
     }
 }
 function display($parent)
 {
     $pdf = $parent->getPDF();
     $pdf->setPageOrientation($this->orientation);
     $pdf->SetAutoPageBreak(true, 10);
     $parent->createPage();
     $contentFrame = $parent->getContentFrame();
     if ($this->documentModel) {
         try {
             $template = new Aste_Template($this->template);
             $header = $template->getBlock('content');
             foreach ($this->documentModel->keys() as $key) {
                 $header->setVar($key, $this->documentModel->get($key));
             }
             $content = $header->fetch();
             $pdf->writeHTMLCell($contentFrame->w, $contentFrame->h, $contentFrame->x, $contentFrame->y, $content);
         } catch (Aste_Exception $e) {
         }
         // Add the border cell at the end
         // This is required to reset Y position for next write
         $pdf->MultiCell($contentFrame->w, $contentFrame->h - $contentFrame->y, "", 0, 'L', 0, 1, $contentFrame->x, $contentFrame->y);
     }
 }
 function display($parent)
 {
     $models = $this->contentModels;
     $totalModels = count($models);
     $totalGoods = 0;
     $totalServices = 0;
     $pdf = $parent->getPDF();
     $pdf->setPageOrientation($this->orientation);
     $pdf->SetAutoPageBreak(true, 10);
     $parent->createPage();
     $contentFrame = $parent->getContentFrame();
     try {
         $template = new Aste_Template($this->template);
         $table_head = $template->getBlock('table_head');
         $content = $table_head->fetch();
         for ($index = 0; $index < $totalModels; ++$index) {
             $model = $models[$index];
             $contentHeight = 1;
             try {
                 $table_row = $template->getBlock('table_row', true);
                 foreach ($this->documentModel->keys() as $key) {
                     $table_row->setVar($key, $this->documentModel->get($key));
                 }
                 foreach ($model->keys() as $key) {
                     $table_row->setVar($key, $model->get($key));
                 }
                 $content .= $table_row->fetch();
             } catch (Aste_Exception $e) {
             }
             try {
                 if ($model->get('entityType') == 'Products') {
                     $table_row = $template->getBlock('goods_row', true);
                     foreach ($this->documentModel->keys() as $key) {
                         $table_row->setVar($key, $this->documentModel->get($key));
                     }
                     foreach ($model->keys() as $key) {
                         $table_row->setVar($key, $model->get($key));
                     }
                     $content .= $table_row->fetch();
                     $totalGoods++;
                 }
             } catch (Aste_Exception $e) {
             }
             try {
                 if ($model->get('entityType') == 'Services') {
                     $table_row = $template->getBlock('services_row', true);
                     foreach ($this->documentModel->keys() as $key) {
                         $table_row->setVar($key, $this->documentModel->get($key));
                     }
                     foreach ($model->keys() as $key) {
                         $table_row->setVar($key, $model->get($key));
                     }
                     $content .= $table_row->fetch();
                     $totalServices++;
                 }
             } catch (Aste_Exception $e) {
             }
         }
         $summary = $template->getBlock('summary');
         foreach ($this->documentModel->keys() as $key) {
             $summary->setVar($key, $this->documentModel->get($key));
         }
         foreach ($this->contentSummaryModel->keys() as $key) {
             $summary->setVar($key, $this->contentSummaryModel->get($key));
         }
         $summary->setVar('summaryTotalItems', $totalModels);
         $summary->setVar('summaryTotalGoods', $totalGoods);
         $summary->setVar('summaryTotalServices', $totalServices);
         $content .= $summary->fetch();
         $ending = $template->getBlock('ending');
         foreach ($this->documentModel->keys() as $key) {
             $ending->setVar($key, $this->documentModel->get($key));
         }
         $content .= $ending->fetch();
         $pdf->writeHTMLCell(0, 0, $contentFrame->x, $contentFrame->y, $content);
     } catch (Aste_Exception $e) {
     }
 }