Example #1
0
 public function testCreate()
 {
     $pdf = new Zend_Pdf();
     // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
     $pdf->pages[] = $page1 = $pdf->newPage('A4');
     // Add new page generated by Zend_Pdf_Page object (page is not attached to the document)
     $pdf->pages[] = $page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
     // Create new font
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Apply font and draw text
     $page1->setFont($font, 36);
     $page1->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
     $page1->drawText('Helvetica 36 text string', 60, 500);
     // Use font object for another page
     $page2->setFont($font, 24);
     $page2->drawText('Helvetica 24 text string', 60, 500);
     // Use another font
     $page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32);
     $page2->drawText('Times-Roman 32 text string', 60, 450);
     // Draw rectangle
     $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8));
     $page2->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
     $page2->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
     $page2->drawRectangle(60, 400, 400, 350);
     // Draw circle
     $page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     $page2->drawCircle(85, 375, 25);
     // Draw sectors
     $page2->drawCircle(200, 375, 25, 2 * M_PI / 3, -M_PI / 6);
     $page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
     $page2->drawCircle(200, 375, 25, M_PI / 6, 2 * M_PI / 3);
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
     $page2->drawCircle(200, 375, 25, -M_PI / 6, M_PI / 6);
     // Draw ellipse
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     $page2->drawEllipse(250, 400, 400, 350);
     $page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
     $page2->drawEllipse(250, 400, 400, 350, M_PI / 6, 2 * M_PI / 3);
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
     $page2->drawEllipse(250, 400, 400, 350, -M_PI / 6, M_PI / 6);
     // Draw and fill polygon
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
     $x = array();
     $y = array();
     for ($count = 0; $count < 8; $count++) {
         $x[] = 140 + 25 * cos(3 * M_PI_4 * $count);
         $y[] = 375 + 25 * sin(3 * M_PI_4 * $count);
     }
     $page2->drawPolygon($x, $y, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, Zend_Pdf_Page::FILL_METHOD_EVEN_ODD);
     // Draw line
     $page2->setLineWidth(0.5);
     $page2->drawLine(60, 375, 400, 375);
     $pdf->save(dirname(__FILE__) . '/_files/output.pdf');
     unset($pdf);
     $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
     $this->assertTrue($pdf1 instanceof Zend_Pdf);
     unset($pdf1);
     unlink(dirname(__FILE__) . '/_files/output.pdf');
 }
Example #2
0
 protected function _buildPDFDocuments(Doc_Book $book)
 {
     set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../_vendor/zf');
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $font = Zend_Pdf_Font::fontWithPath('c:\\windows\\fonts\\simkai.ttf');
     $page->setFont($font, 12);
     $pdf->pages[] = $page;
     $page->drawText('中文测试', 100, 430, 'UTF-8');
     $pdf->save('output.pdf');
 }
 public function generateAction()
 {
     // Create new PDF document.
     $pdf = new Zend_Pdf();
     // 421 x 596 = A5 Landscape in pixels @ 72dpi
     $pdf->pages[] = new Zend_Pdf_Page(596, 421);
     $pdf->pages[] = new Zend_Pdf_Page(596, 421);
     $front = $pdf->pages[0];
     $back = $pdf->pages[1];
     // Create new font
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Apply font
     $front->setFont($font, 18);
     // Start at the top
     $y = 590;
     // With a left Margin of 10
     $x = 10;
     $front->drawText($this->recipe->name, $x, $y);
     $y = $y - 30;
     $front->setFont($font, 12);
     $front->drawText('Difficulty: ' . $this->recipe->difficulty, $x, $y);
     $y = $y - 15;
     $front->drawText('Preparation Time: ' . $this->recipe->preparation_time, $x, $y);
     $y = $y - 15;
     $front->drawText('Cooking Time: ' . $this->recipe->preparation_time, $x, $y);
     $y = $y - 15;
     $front->drawText('Serves: ' . $this->recipe->serves, $x, $y);
     $y = $y - 15;
     $front->drawText('Freezable: ' . $this->recipe->freezable, $x, $y);
     $ingredients = $this->recipe->findRecipeIngredient();
     $y = $y - 15;
     foreach ($ingredients as $ingredient) {
         $y = $y - 15;
         $text = '';
         if ($ingredient->quantity > 0) {
             $text .= $ingredient->quantity;
         }
         if ($ingredient->amount > 0) {
             $text .= $ingredient->amount . ' ';
         }
         if (!empty($ingredient->measurement)) {
             $text .= $ingredient->measurement_abbr . ' ';
         }
         $text .= $ingredient->name;
         $front->drawText($text, $x, $y);
     }
     $back->setFont($font, 18);
     $pdf->save('pdf/foo.pdf');
 }
Example #4
0
 public function deploy()
 {
     $this->checkExportRights();
     $this->setRecordsPerPage(0);
     parent::deploy();
     $width = 0;
     $colors = array('title' => '#000000', 'subtitle' => '#111111', 'footer' => '#111111', 'header' => '#AAAAAA', 'row1' => '#EEEEEE', 'row2' => '#FFFFFF', 'sqlexp' => '#BBBBBB', 'lines' => '#111111', 'hrow' => '#E4E4F6', 'text' => '#000000', 'filters' => '#F9EDD2', 'filtersBox' => '#DEDEDE');
     $this->_deploy['colors'] = array_merge($colors, (array) $this->_deploy['colors']);
     $la = '';
     if (!isset($this->_deploy['save'])) {
         $this->_deploy['save'] = false;
     }
     if (!isset($this->_deploy['download'])) {
         $this->_deploy['download'] = false;
     }
     if ($this->_deploy['save'] != 1 && $this->_deploy['download'] != 1) {
         throw new Exception('Nothing to do. Please specify download&&|save options');
     }
     if (empty($this->_deploy['name'])) {
         $this->_deploy['name'] = date('H_m_d_H_i_s');
     }
     if (substr($this->_deploy['name'], -4) == '.xls') {
         $this->_deploy['name'] = substr($this->_deploy['name'], 0, -4);
     }
     if (!isset($this->_deploy['noPagination'])) {
         $this->_deploy['noPagination'] = 0;
     }
     $this->_deploy['dir'] = rtrim($this->_deploy['dir'], '/') . '/';
     if (!isset($this->_deploy['dir']) || !is_dir($this->_deploy['dir'])) {
         throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not a dir');
     }
     if (!is_writable($this->_deploy['dir'])) {
         throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not writable');
     }
     $larg = self::calculateCellSize();
     $lengthTotal = array_sum($larg);
     $cellFontSize = 8;
     //set font
     $titulos = parent::_buildTitles();
     $sql = parent::_buildSqlExp();
     $grid = parent::_BuildGrid();
     if (!$this->getInfo('hRow,field')) {
         $this->_info['hRow']['field'] = '';
     }
     if (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'A4') {
         $totalPaginas = ceil(count($grid) / 26);
     } elseif (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'LETTER') {
         $totalPaginas = ceil(count($grid) / 27);
     } else {
         $totalPaginas = ceil(count($grid) / 37);
     }
     if ($totalPaginas < 1) {
         $totalPaginas = 1;
     }
     $pdf = new Zend_Pdf();
     // Create new Style
     $style = new Zend_Pdf_Style();
     $style->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['lines']));
     $topo = new Zend_Pdf_Style();
     $topo->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['header']));
     $td = new Zend_Pdf_Style();
     $td->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row2']));
     $styleFilters = new Zend_Pdf_Style();
     $styleFilters->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filters']));
     $styleFiltersBox = new Zend_Pdf_Style();
     $styleFiltersBox->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filtersBox']));
     $td2 = new Zend_Pdf_Style();
     $td2->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row1']));
     $hRowStyle = new Zend_Pdf_Style();
     $hRowStyle->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['hrow']));
     $styleSql = new Zend_Pdf_Style();
     $styleSql->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['sqlexp']));
     $styleText = new Zend_Pdf_Style();
     $styleText->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['text']));
     // Add new page to the document
     if (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
     } elseif (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) != 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
     } elseif (strtoupper($this->_deploy['size'] != 'A4') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     } else {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     }
     $page->setStyle($style);
     $pdf->pages[] = $page;
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $page->setFont($font, 14);
     //$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     if (file_exists($this->_deploy['logo'])) {
         $image = Zend_Pdf_Image::imageWithPath($this->_deploy['logo']);
         list($width, $height, $type, $attr) = getimagesize($this->_deploy['logo']);
         $page->drawImage($image, 40, $page->getHeight() - $height - 40, 40 + $width, $page->getHeight() - 40);
     }
     $page->drawText($this->__($this->_deploy['title']), $width + 70, $page->getHeight() - 70, $this->getCharEncoding());
     $page->setFont($font, $cellFontSize);
     $page->drawText($this->__($this->_deploy['subtitle']), $width + 70, $page->getHeight() - 80, $this->getCharEncoding());
     //Iniciar a contagem de páginas
     $pagina = 1;
     $page->drawText($this->_deploy['footer'], 40, 40, $this->getCharEncoding());
     if (@$this->_deploy['noPagination'] != 1) {
         $page->drawText($this->__($this->_deploy['page']) . ' ' . $pagina . '/' . $totalPaginas, $page->getWidth() - strlen($this->__($this->_deploy['page'])) * $cellFontSize - 50, 40, $this->getCharEncoding());
     }
     $page->setFont($font, $cellFontSize);
     $pl = $page->getWidth() - 80;
     $i = 0;
     foreach ($larg as $final) {
         $cell[$i] = round($final * $pl / $lengthTotal);
         $i++;
     }
     $cellsCount = count($titulos);
     if ($this->getInfo('hRow,title') != '') {
         $cellsCount--;
     }
     $largura = ($page->getWidth() - 80) / $cellsCount;
     $altura = $page->getHeight() - 120;
     $i = 0;
     $page->setFont($font, $cellFontSize + 1);
     foreach ($titulos as $value) {
         if ($value['field'] != $this->getInfo('hRow,field') && $this->getInfo('hRow,title') != '' || $this->getInfo('hRow,title') == '') {
             if ((int) $la == 0) {
                 $largura1 = 40;
             } else {
                 $largura1 = $cell[$i - 1] + $largura1;
             }
             $page->setStyle($topo);
             $page->drawRectangle($largura1, $altura - 4, $largura1 + $cell[$i] + 1, $altura + 12);
             $page->setStyle($styleText);
             $page->drawText($value['value'], $largura1 + 2, $altura, $this->getCharEncoding());
             $la = $largura1;
             $i++;
         }
     }
     $page->setFont($font, $cellFontSize);
     $page->setStyle($style);
     if (is_array($grid)) {
         if ($this->getInfo('hRow,title') != '') {
             $bar = $grid;
             $hbar = trim($this->getInfo('hRow,field'));
             $p = 0;
             foreach ($grid[0] as $value) {
                 if ($value['field'] == $hbar) {
                     $hRowIndex = $p;
                 }
                 $p++;
             }
             $aa = 0;
         }
         $ia = 0;
         $aa = 0;
         foreach ($grid as $value) {
             if ($altura <= 80) {
                 // Add new page to the document
                 if (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
                     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
                 } elseif (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) != 'LANDSCAPE') {
                     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
                 } elseif (strtoupper($this->_deploy['size'] != 'A4') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
                     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
                 } else {
                     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 }
                 $page->setStyle($style);
                 $pdf->pages[] = $page;
                 $pagina++;
                 $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
                 $page->setFont($font, 14);
                 //$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
                 if (file_exists($this->_deploy['logo'])) {
                     $image = Zend_Pdf_Image::imageWithPath($this->_deploy['logo']);
                     list($width, $height, $type, $attr) = getimagesize($this->_deploy['logo']);
                     $page->drawImage($image, 40, $page->getHeight() - $height - 40, 40 + $width, $page->getHeight() - 40);
                 }
                 $page->drawText($this->__($this->_deploy['title']), $width + 70, $page->getHeight() - 70, $this->getCharEncoding());
                 $page->setFont($font, $cellFontSize);
                 $page->drawText($this->__($this->_deploy['subtitle']), $width + 70, $page->getHeight() - 80, $this->getCharEncoding());
                 //set font
                 $altura = $page->getHeight() - 120;
                 $page->drawText($this->__($this->_deploy['footer']), 40, 40, $this->getCharEncoding());
                 if ($this->_deploy['noPagination'] != 1) {
                     $page->drawText($this->__($this->_deploy['page']) . ' ' . $pagina . '/' . $totalPaginas, $page->getWidth() - strlen($this->__($this->_deploy['page'])) * $cellFontSize - 50, 40, $this->getCharEncoding());
                 }
                 //
                 reset($titulos);
                 $i = 0;
                 $largura1 = 40;
                 $page->setFont($font, $cellFontSize + 1);
                 foreach ($titulos as $title) {
                     if ($title['field'] != $this->getInfo('hRow,field') && $this->getInfo('hRow,title') != '' || $this->getInfo('hRow,title') == '') {
                         if ((int) $la == 0) {
                             $largura1 = 40;
                         } else {
                             $largura1 = $cell[$i - 1] + $largura1;
                         }
                         $page->setStyle($topo);
                         $page->drawRectangle($largura1, $altura - 4, $largura1 + $cell[$i] + 1, $altura + 12);
                         $page->setStyle($style);
                         $page->drawText($title['value'], $largura1 + 2, $altura, $this->getCharEncoding());
                         $la = $largura1;
                         $i++;
                     }
                 }
                 $page->setFont($font, $cellFontSize);
             }
             $la = 0;
             $altura = $altura - 16;
             $i = 0;
             $tdf = $ia % 2 ? $td : $td2;
             $a = 1;
             //A linha horizontal
             if ($this->getInfo('hRow,title') != '') {
                 if ($bar[$aa][$hRowIndex]['value'] != $bar[$aa - 1][$hRowIndex]['value']) {
                     $centrar = $page->getWidth() - 80;
                     $centrar = round($centrar / 2) + 30;
                     if ((int) $la == 0) {
                         $largura1 = 40;
                     } else {
                         $largura1 = $cell[$i - 1] + $largura1;
                     }
                     $page->setStyle($hRowStyle);
                     $page->drawRectangle($largura1, $altura - 4, $page->getWidth() - 40, $altura + 12);
                     $page->setStyle($styleText);
                     $page->drawText($bar[$aa][$hRowIndex]['value'], $centrar, $altura, $this->getCharEncoding());
                     $la = 0;
                     $altura = $altura - 16;
                 }
             }
             ////////////
             //Vamos saber qauntas linhas tem este registo
             $nlines = array();
             $nl = 0;
             foreach ($value as $lines) {
                 $line = $this->widthForStringUsingFontSize(strip_tags(trim($lines['value'])), $font, 8);
                 $nlines[] = ceil($line / $cell[$nl]);
                 $nl++;
             }
             sort($nlines);
             $totalLines = end($nlines);
             $nl = 0;
             foreach ($value as $value1) {
                 $value1['value'] = strip_tags(trim($value1['value']));
                 if ($value1['field'] != $this->getInfo('hRow,field') && $this->getInfo('hRow,title') != '' || $this->getInfo('hRow,title') == '') {
                     if ((int) $la == 0) {
                         $largura1 = 40;
                     } else {
                         $largura1 = $cell[$i - 1] + $largura1;
                     }
                     $page->setStyle($tdf);
                     $page->drawRectangle($largura1, $altura - 4, $largura1 + $cell[$i] + 1, $altura + 12);
                     $page->setStyle($styleText);
                     $page->drawText($value1['value'], $largura1 + 2, $altura, $this->getCharEncoding());
                     $la = $largura1;
                     $i++;
                     $nl++;
                 }
                 $a++;
             }
             $aa++;
             $ia++;
         }
     }
     $la = 0;
     $altura = $altura - 16;
     $i = 0;
     if (is_array($sql)) {
         foreach ($sql as $value) {
             if ((int) $la == 0) {
                 $largura1 = 40;
             } else {
                 $largura1 = $cell[$i - 1] + $largura1;
             }
             $page->setStyle($styleSql);
             $page->drawRectangle($largura1, $altura - 4, $largura1 + $cell[$i], $altura + 12);
             $page->setStyle($styleText);
             $page->drawText($value['value'], $largura1 + 2, $altura, $this->getCharEncoding());
             $la = $largura1;
             $la = $largura1;
             $i++;
         }
     }
     $la = 0;
     $altura = $altura - 16;
     $i = 0;
     if (is_array($this->_showFiltersInExport) || $this->_showFiltersInExport == true) {
         if (is_array($this->_showFiltersInExport) && is_array($this->_filtersValues)) {
             $this->_showFiltersInExport = array_merge($this->_showFiltersInExport, $this->_filtersValues);
         } elseif (is_array($this->_showFiltersInExport)) {
             $this->_showFiltersInExport = $this->_showFiltersInExport;
         } elseif (is_array($this->_filtersValues)) {
             $this->_showFiltersInExport = $this->_filtersValues;
         }
         if (count($this->_showFiltersInExport) > 0) {
             $page->setStyle($styleFilters);
             $page->drawRectangle(40, $altura - 4, array_sum($cell) + 41, $altura + 12);
             $page->setStyle($styleText);
             $tLarg = $this->widthForStringUsingFontSize($this->__('Filtered by:'), $font);
             $i = 0;
             $page->setStyle($styleFiltersBox);
             $page->drawRectangle(40, $altura - 4, $tLarg + 50, $altura + 12);
             $page->setStyle($styleText);
             $text = '     ' . $this->__('Filtered by:') . '     ';
             foreach ($this->_showFiltersInExport as $key => $value) {
                 if ($keyHelper = $this->getField($key)) {
                     $key = $keyHelper['title'];
                 }
                 if (is_array($value)) {
                     foreach ($value as $newName => $newValue) {
                         $text .= $this->__($key) . ' - ' . $this->__(ucfirst($newName)) . ': ' . $this->__($newValue) . '    |    ';
                     }
                 } else {
                     $text .= $this->__($key) . ': ' . $this->__($value) . '    |    ';
                 }
                 $i++;
             }
             $page->drawText($text, $tLarg + 3, $altura, $this->getCharEncoding());
         }
     }
     $pdf->save($this->_deploy['dir'] . $this->_deploy['name'] . '.pdf');
     if ($this->_deploy['download'] == 1) {
         header('Content-type: application/pdf');
         header('Content-Disposition: attachment; filename="' . $this->_deploy['name'] . '.pdf"');
         readfile($this->_deploy['dir'] . $this->_deploy['name'] . '.pdf');
     }
     if ($this->_deploy['save'] != 1) {
         unlink($this->_deploy['dir'] . $this->_deploy['name'] . '.pdf');
     }
     die;
 }
Example #5
0
 function pdfgenerationAction()
 {
     //$fetchMeetings=new Meetingreport_Model_Meetingreport();
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // 		 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $image_name = "/var/www" . $app . "/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array("Bank", "Branch", "Thumb Impression Declaration", "I hereby declare that Smt/sri ______________________ has given the thumb impression in the presence of me and his mother tongue", " ___________________________", "Date", "Yours sincerely");
     $x0 = 60;
     $x10 = 450;
     $x11 = 285;
     $page->drawText($text[0], $x0, 725);
     $page->drawText($text[1], $x0, 700);
     $page->drawText($text[2], $x0, 675);
     $page->drawText($text[3], $x0, 650);
     $page->drawText($text[4], $x0, 625);
     $page->drawText($text[5], $x0, 575);
     $page->drawText($text[6], $x10, 575);
     $page->setLineWidth(1)->drawLine(50, 750, 550, 750);
     $page->setLineWidth(1)->drawLine(50, 750, 50, 465);
     $page->setLineWidth(1)->drawLine(50, 750, 50, 465);
     $page->setLineWidth(1)->drawLine(50, 465, 550, 465);
     $page->setLineWidth(1)->drawLine(550, 465, 550, 750);
     $page->setLineWidth(1)->drawLine(50, 690, 550, 690);
     $page->setLineWidth(1)->drawLine(50, 670, 550, 670);
     $y1 = 700;
     $totalAmount = "0";
     $totaldebit = "0";
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/thumbdeclaration' . date('Y-m-d') . '.pdf');
     $path = '/var/www' . $projname . '/reports/thumbdeclaration' . date('Y-m-d') . '.pdf';
     chmod($path, 0777);
 }
Example #6
0
 public function pdfdisplayAction()
 {
     $date1 = $this->_request->getParam('date1');
     $date2 = $this->_request->getParam('date2');
     $glsubcode = $this->_request->getParam('ledger');
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     //Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $this->view->search = 10;
     $generalLedger = new Generalledger_Model_Generalledger();
     //Lia
     $this->view->ledegerList = $generalLedger->generalLedger($date1, $date2, $glsubcode);
     $openingCash = $generalLedger->openingBalance($date1, $glsubcode);
     print_r($openingCash);
     //             // Assets
     $this->view->ledegerListAssets = $generalLedger->generalLedgerAssets($date1, $date2, $glsubcode);
     $this->view->openingCashAssets = $generalLedger->openingBalanceAssets($date1, $glsubcode);
     if (!$this->view->ledegerListAssets && !$this->view->openingCashAssets) {
     } else {
         $this->view->search = 0;
         echo "<font color='red'><b> Record not found</b> </font>";
     }
     if (count($openingCash)) {
         foreach ($openingCash as $openingCash) {
             if ($openingCash["glsubcode_id"] == $ledegerList["glsubcode_id"]) {
                 $liabilityCash = $openingCash["openingCash"];
             }
         }
     }
     $text = array("Particular", "debit", "credit", "balance", "Opening balance");
     $x0 = 60;
     $x1 = 200;
     $x2 = 340;
     $x3 = 480;
     $page->drawLine(50, 740, 550, 740);
     $page->drawLine(50, 720, 550, 720);
     $page->drawText($text[0], $x0, 725);
     $page->drawText($text[1], $x1, 725);
     $page->drawText($text[2], $x2, 725);
     $page->drawText($text[3], $x3, 725);
     $page->drawText($text[4], $x0, 700);
     foreach ($openingCash as $openingCash) {
         $page->drawText($openingCash["openingCash"], $x3, 700);
     }
     $y1 = 725;
     //$page->drawText(Opening balance,$x0, $y1);
     $pdf->save('/var/www/' . $projname . '/reports/GL.pdf');
     $path = '/var/www/' . $projname . '/reports/GL.pdf';
     // $pdf->save('/var/www/ourbank/reports/GL.pdf');
     // $path = '/var/www/ourbank/reports/GL.pdf';
     chmod($path, 0777);
 }
Example #7
0
 public function testFontExtracting()
 {
     if (PHP_OS == 'AIX') {
         $this->markTestSkipped('Not supported on AIX');
     }
     $pdf = new Zend_Pdf();
     $fontsList = array(Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC);
     foreach ($fontsList as $fontName) {
         // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
         $pdf->pages[] = $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
         $font = Zend_Pdf_Font::fontWithName($fontName);
         $page->setFont($font, 10)->drawText($font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en') . ':', 100, 400);
         $page->setFont($font, 20)->drawText("'The quick brown fox jumps over the lazy dog'", 100, 360);
         $type = $font->getFontType();
     }
     $TTFFontsList = array('VeraBd.ttf', 'VeraBI.ttf', 'VeraIt.ttf', 'VeraMoBd.ttf', 'VeraMoBI.ttf', 'VeraMoIt.ttf', 'VeraMono.ttf', 'VeraSeBd.ttf', 'VeraSe.ttf', 'Vera.ttf');
     foreach ($TTFFontsList as $fontName) {
         // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
         $pdf->pages[] = $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
         $font = Zend_Pdf_Font::fontWithPath(dirname(__FILE__) . '/_fonts/' . $fontName);
         $page->setFont($font, 10)->drawText($font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'CP1252') . ':', 100, 400);
         $page->setFont($font, 20)->drawText("'The quick brown fox jumps over the lazy dog'", 100, 360);
         $type = $font->getFontType();
     }
     $pdf->save(dirname(__FILE__) . '/_files/output.pdf');
     unset($pdf);
     $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
     $newPages = array();
     $fontList = array();
     $fontNames = array();
     foreach ($pdf1->pages as $page) {
         $pageFonts = $page->extractFonts();
         foreach ($pageFonts as $font) {
             $fontList[] = $font;
             $fontNames[] = $font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8');
         }
     }
     $this->assertEquals(array(Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, 'BitstreamVeraSans-Bold', 'BitstreamVeraSans-BoldOblique', 'BitstreamVeraSans-Oblique', 'BitstreamVeraSansMono-Bold', 'BitstreamVeraSansMono-BoldOb', 'BitstreamVeraSansMono-Oblique', 'BitstreamVeraSansMono-Roman', 'BitstreamVeraSerif-Bold', 'BitstreamVeraSerif-Roman', 'BitstreamVeraSans-Roman'), $fontNames);
     $pdf1->pages[] = $page = $pdf1->newPage(Zend_Pdf_Page::SIZE_A4);
     $yPosition = 700;
     foreach ($fontList as $font) {
         $page->setFont($font, 15)->drawText("The quick brown fox jumps over the lazy dog", 100, $yPosition);
         $yPosition -= 30;
     }
     $fontNames1 = array();
     foreach ($pdf1->extractFonts() as $font) {
         $fontNames1[] = $font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8');
     }
     $this->assertEquals(array(Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, 'BitstreamVeraSans-Bold', 'BitstreamVeraSans-BoldOblique', 'BitstreamVeraSans-Oblique', 'BitstreamVeraSansMono-Bold', 'BitstreamVeraSansMono-BoldOb', 'BitstreamVeraSansMono-Oblique', 'BitstreamVeraSansMono-Roman', 'BitstreamVeraSerif-Bold', 'BitstreamVeraSerif-Roman', 'BitstreamVeraSans-Roman'), $fontNames1);
     $page = reset($pdf1->pages);
     $font = $page->extractFont(Zend_Pdf_Font::FONT_COURIER);
     $this->assertTrue($font instanceof Zend_Pdf_Resource_Font_Extracted);
     $font = $page->extractFont(Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC);
     $this->assertNull($font);
     $font = $pdf1->extractFont(Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC);
     $this->assertTrue($font instanceof Zend_Pdf_Resource_Font_Extracted);
     $font = $pdf1->extractFont(Zend_Pdf_Font::FONT_TIMES_ROMAN);
     $this->assertNull($font);
     $pdf1->save(dirname(__FILE__) . '/_files/output1.pdf');
     unset($pdf1);
     $pdf2 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output1.pdf');
     $this->assertTrue($pdf2 instanceof Zend_Pdf);
     unset($pdf2);
     unlink(dirname(__FILE__) . '/_files/output.pdf');
     unlink(dirname(__FILE__) . '/_files/output1.pdf');
 }
Example #8
0
 public function pdfAction()
 {
     $this->view->groupid = $groupid = base64_decode($this->_request->getParam('id'));
     $this->view->groupcode = $groupcode = base64_decode($this->_request->getParam('membercode'));
     $this->view->memberdetails = $memberdetails = $this->view->Dbobj->fetchmembers($groupid);
     $this->view->representative = $this->view->Dbobj->fetchrepresentative($groupid);
     $this->view->groupdetails = $this->view->Dbobj->getMember($groupcode);
     $bankdetails = $this->view->Dbobj->getbankdetails($this->view->groupdetails[0]['branch_id']);
     $this->view->bankdetails = $bankdetails;
     $shgdeclaration = " SHG I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no arrears of any lease amount.\n\nI have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank finance.The crop to be raised is free from the charge/encumbrances.";
     $jlgdeclaration = " JLG I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no arrears of any lease amount.\n\nI have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank finance.The crop to be raised is free from the charge/encumbrances.";
     $pdf = new Zend_Pdf();
     foreach ($this->view->memberdetails as $memberdetails) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         //Path
         $app = $this->view->baseUrl();
         $word = explode('/', $app);
         $projname = $word[1];
         // Image
         $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
         $image = Zend_Pdf_Image::imageWithPath($image_name);
         $page->drawImage($image, 30, 770, 130, 820);
         $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
         //bottom horizontal
         $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
         //left vertical
         $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
         //right vertical
         $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
         //top horizontal
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
         $title = "";
         if (substr($this->view->groupcode, 4, 1) == 2) {
             $title = "Self Helf Group member";
         } else {
             if (substr($this->view->groupcode, 4, 1) == 3) {
                 $title = "Joint Liability Group member";
             }
         }
         $page->drawText($title, 230, 740);
         $page->drawText($title, 230, 740);
         //set the font
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
         $page->drawText("Date : " . date('d-m-Y'), 500, 800);
         $y1 = 710;
         $y2 = 740;
         $x1 = 60;
         $x2 = 350;
         $x3 = 230;
         $x4 = 400;
         if ($y1 > 45) {
             $page->drawText("To,", $x1, $y1);
             $page->drawText("The Branch manager,", $x1, $y1 = $y1 - 15);
             $page->drawText($this->view->bankdetails[0]['bankname'] . ',', $x1, $y1 = $y1 - 15);
             $page->drawText($this->view->bankdetails[0]['branch'] . '.', $x1, $y1 = $y1 - 15);
             $page->drawText('Respected sir,', $x1, $y1 = $y1 - 35);
             if ($memberdetails['alias']) {
                 $alias = "@ " . $memberdetails['alias'];
             } else {
                 $alias = '';
             }
             $village = $this->view->Dbobj->fetchvillagedetails($memberdetails['village_id']);
             $subject = $memberdetails['membername'] . " " . $alias . " " . $memberdetails['age'] . " Age " . $this->view->groupdetails[0]['group_name'] . " Group " . $village[0]['villagename'] . " Village " . $village[0]['talukname'] . " Taluk " . $village[0]['distname'] . " District.";
             $page->drawText($subject, $x1, $y1 = $y1 - 25);
             $y1 = $y1 - 25;
             $addressline = 0;
             if (substr($this->view->groupcode, 4, 1) == 2) {
                 $newtext = wordwrap($shgdeclaration, 30, "<br />");
                 $pieces = explode("<br />", $newtext);
                 $page->drawText($pieces, $x1, $y1);
             } else {
                 if (substr($this->view->groupcode, 4, 1) == 3) {
                     $newtext = wordwrap($jlgdeclaration, 130, "<br />");
                     $pieces = explode("<br />", $newtext);
                     foreach ($pieces as $pieces1) {
                         $page->drawText(substr($pieces1, 0, 300), $x1, $y1);
                         $y1 -= 15;
                         $addressline++;
                     }
                     $y1 -= $addressline * 15;
                     //         $page->drawText($pieces,$x1, $y1);
                 }
             }
             $y1 = $y1 - 35;
             $page->drawText("Date :" . $this->view->groupdetails[0]['group_created_date'], $x1, $y1);
             $page->drawText("yours obediently,", $x2, $y1);
             $page->drawText("Place :" . $this->view->groupdetails[0]['place'], $x1, $y1 = $y1 - 15);
             $y1 = $y1 - 35;
             $page->drawText($memberdetails['membername'], $x2, $y1);
             $page->drawText("Signature", $x2, $y1 = $y1 - 15);
             $y1 = $y1 - 45;
             $page->drawText("Representative Seal & signature", $x1, $y1);
             $y1 = $y1 - 25;
             $page->drawText("Representative 1", $x1, $y1);
             $page->drawText("Representative 2", $x3, $y1);
             $page->drawText("Representative 3", $x4, $y1);
             $y1 = $y1 - 15;
             foreach ($this->view->representative as $representative) {
                 $page->drawText($representative['membername'], $x1, $y1);
                 $x1 = $x1 + 170;
             }
         }
     }
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/membersdeclaration.pdf');
     $path = '/var/www/' . $projname . '/reports/membersdeclaration.pdf';
     chmod($path, 0777);
 }
Example #9
0
 function pdftransactionAction()
 {
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $Dispdate = $this->_request->getParam('field1');
     $this->view->field1 = $Dispdate;
     $dateconvertor = new App_Model_dateConvertor();
     $Date = $dateconvertor->mysqlformat($Dispdate);
     $title1 = $this->view->translate('Loan Supplementary');
     $this->view->pageTitle = $title1;
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 20, 780, 120, 830);
     $page->setLineWidth(1)->drawLine(20, 20, 580, 20);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(20, 20, 20, 830);
     //left vertical
     $page->setLineWidth(1)->drawLine(580, 25, 580, 830);
     //right vertical
     $page->setLineWidth(1)->drawLine(20, 830, 580, 830);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array($this->view->translate('Loan Supplementary'), $this->view->translate('Sl'), $this->view->translate('Particulars'), $this->view->translate('A/C No.'), $this->view->translate('Cash'), $this->view->translate('Transfer'), $this->view->translate('Total'));
     $criteria = $this->view->translate('As of') . $Dispdate;
     $currency = "* " . $this->view->translate('Amount in Rs');
     $this->view->savings = 10;
     //         $page->drawText("Date : ".date('d/m/Y'),500, 800); //date('Y-m-d')
     //         $page->drawText("Date : ".date('d/m/Y'),500, 800);
     $page->drawText($text[0], 200, 780);
     $page->drawText($text[0], 200, 780);
     $page->drawText($criteria, 500, 780);
     //Search criteria
     $page->drawText($criteria, 500, 780);
     $page->drawText($currency, 500, 770);
     //Currency
     $page->drawText($currency, 500, 770);
     $my = 735;
     $x1 = 33;
     $x2 = 45;
     $x3 = 135;
     $x4 = 170;
     $x5 = 210;
     $x6 = 260;
     $x7 = 300;
     $x8 = 312;
     $x9 = 402;
     $x10 = 437;
     $x11 = 477;
     $x12 = 530;
     $page->drawLine(30, 750, 570, 750);
     $page->drawLine(30, 730, 570, 730);
     $page->drawText($text[1], $x1, $my);
     $page->drawText($text[2], $x2, $my);
     $page->drawText($text[3], $x3, $my);
     $page->drawText($text[4], $x4, $my);
     $page->drawText($text[5], $x5, $my);
     $page->drawText($text[6], $x6, $my);
     $page->drawText($text[1], $x7, $my);
     $page->drawText($text[2], $x8, $my);
     $page->drawText($text[3], $x9, $my);
     $page->drawText($text[4], $x10, $my);
     $page->drawText($text[5], $x11, $my);
     $page->drawText($text[6], $x12, $my);
     $y1 = 710;
     $y2 = 710;
     $this->view->loan = 10;
     $transaction = new Loansupplementary_Model_Loansupplementary();
     //                 //Loan Account Credit and Debit
     $loanCredit = $transaction->totalloanCredit($Date);
     $this->view->loanCredit = $loanCredit;
     $loanDebit = $transaction->totalloanDebit($Date);
     $this->view->loanDedit = $loanDebit;
     $totalCredit = "0";
     $totalTransferCredit = "0";
     $totalDebit = "0";
     $totalTransferDebit = "0";
     $i = 0;
     $columntotal1 = 0;
     $columntotal = 0;
     $columntotald = 0;
     $columntotald1 = 0;
     foreach ($loanCredit as $loansCredit) {
         $i++;
         $columntotal = 0;
         if ($loansCredit->paymenttype_id == 1 or $loansCredit->paymenttype_id == 5) {
             $page->drawText($i, $x1, $y1);
             $productname = "To " . $loansCredit->account_number;
             $page->drawText($productname, $x2, $y1);
             $page->drawText($loansCredit->account_id, $x3, $y1);
             if ($loansCredit->paymenttype_id == 1) {
                 $page->drawText($loansCredit->amount_to_bank, $x4, $y1);
                 $totalCredit = $totalCredit + $loansCredit->amount_to_bank;
                 $columntotal += $loansCredit->amount_to_bank;
             } elseif ($loansCredit->paymenttype_id == 5) {
                 $page->drawText($loansCredit->amount_to_bank, $x5, $y1);
                 $totalTransferCredit = $totalTransferCredit + $loansCredit->amount_to_bank;
                 $columntotal += $loansCredit->amount_to_bank;
             }
             $page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
             $page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
             $columntotal1 += $columntotal;
             $y1 = $y1 - 15;
         }
     }
     $i = 0;
     foreach ($loanDebit as $loansDebit) {
         $i++;
         $columntotald = 0;
         if ($loansDebit->paymenttype_id == 1 or $loansDebit->paymenttype_id == 5) {
             $page->drawText($i, $x7, $y2);
             $productnamed = "By " . $loansDebit->account_number;
             $page->drawText($productnamed, $x8, $y2);
             $page->drawText($loansDebit->account_id, $x9, $y2);
             if ($loansDebit->paymenttype_id == 1) {
                 $page->drawText($loansDebit->amount_from_bank, $x10, $y2);
                 $totalDebit = $totalCredit + $loansDebit->amount_from_bank;
                 $columntotald += $loansDebit->amount_from_bank;
             } elseif ($loansDebit->paymenttype_id == 5) {
                 $page->drawText($loansDebit->amount_from_bank, $x11, $y2);
                 $totalTransferDebit = $totalTransferDebit + $loansDebit->amount_from_bank;
                 $columntotald += $loansDebit->amount_from_bank;
             }
             $page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
             $page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
             $columntotald1 += $columntotald;
             $y2 = $y2 - 15;
         }
     }
     $page->drawLine(30, $y1, 570, $y1);
     $page->drawLine(30, $y1 - 20, 570, $y1 - 20);
     $page->drawText($text[6], $x1, $y1 - 15);
     $page->drawText($text[6], $x1, $y1 - 15);
     if ($totalCredit != "0") {
         $page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
     } else {
         $page->drawText("----", $x4, $y1 - 15);
         $page->drawText("----", $x4, $y1 - 15);
     }
     if ($totalTransferCredit != "0") {
         $page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
     } else {
         $page->drawText("----", $x5, $y1 - 15);
         $page->drawText("----", $x5, $y1 - 15);
     }
     if ($columntotal1 != "0") {
         $page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
     } else {
         $page->drawText("----", $x6, $y1 - 15);
         $page->drawText("----", $x6, $y1 - 15);
     }
     if ($totalDebit != "0") {
         $page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
     } else {
         $page->drawText("----", $x10, $y1 - 15);
         $page->drawText("----", $x10, $y1 - 15);
     }
     if ($totalTransferDebit != "0") {
         $page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
     } else {
         $page->drawText("----", $x11, $y1 - 15);
         $page->drawText("----", $x11, $y1 - 15);
     }
     if ($columntotald1 != "0") {
         $page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
     } else {
         $page->drawText("----", $x12, $y1 - 15);
         $page->drawText("----", $x12, $y1 - 15);
     }
     // Virtual table
     $page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(298, $y1 - 20, 298, 750);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
     //table rigth vertical
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/loansupplementary.pdf');
     $path = '/var/www/' . $projname . '/reports/loansupplementary.pdf';
     chmod($path, 0777);
 }
Example #10
0
 function pdfgenerationAction()
 {
     $declarationform = new Declaration_Form_Account();
     $this->view->form = $declarationform;
     $this->view->membercode = $memcode = $this->_request->getParam('membercode');
     if (substr($memcode, 4, 1) == 2 or substr($memcode, 4, 1) == 3) {
         $this->view->groupresult = $result = $this->view->dbobj->getmembers($memcode);
         //
         if ($result) {
             $declarationform->populate($result[0]);
             $this->view->groupcode = $groupcode = $result[0]['groupcode'];
             $this->view->relation = $result = $this->view->dbobj->getrelations($groupcode);
         }
     } else {
         $this->view->result = $result = $this->view->dbobj->getmember($memcode);
         //
         if ($result) {
             $declarationform->populate($result[0]);
             $this->view->membercode1 = $familyid = $result[0]['family_id'];
             $this->view->relation = $result = $this->view->dbobj->getrelation($familyid);
             $dbobj = new Declaration_Model_Dec();
             $app = $this->view->baseUrl();
             $word = explode('/', $app);
             $projname = $word[1];
             $title1 = "declaration";
             $this->view->pageTitle = $title1;
             $pdf = new Zend_Pdf();
             $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
             $pdf->pages[] = $page;
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             //$page->drawImage($image, 25, 770, 570, 820);
             $page->drawImage($image, 30, 770, 130, 820);
             $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
             //bottom horizontal
             $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
             //left vertical
             $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
             //right vertical
             $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
             //top horizonta
             // define font resource
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             $Declaration = new Declaration_Model_Dec();
             $memcode = $this->_request->getParam('membercode');
             $familyid = $this->_request->getParam('membercode1');
             $showgetmember = $Declaration->getmember($memcode);
             $showgetrelation = $Declaration->getrelation($familyid);
             $dateconvert = new App_Model_dateConvertor();
             foreach ($this->view->result as $result) {
             }
             // write text to page
             $page->setFont($font, 12)->drawText('DECLARATION', 240, 720);
             //                 $page->setLineWidth(1)->drawLine(0, 800, 820, 250);
             $page->setFont($font, 10)->drawText('(TO BE SUBMITTED BY THE BORROWER UNDER SBI JOINT LIABILITY GROUP)', 72, 700);
             $page->setFont($font, 9)->drawText('I,' . $result['name'] . ' (Name of the borrower), Son of ' . $this->view->relation[0]['fathername'] . '', 72, 670);
             $page->setFont($font, 9)->drawText('Aged around ' . $result['age'] . ' years,presently residing at ' . $result['street'] . ' do here by', 72, 655);
             $page->setFont($font, 9)->drawText('Solemnly affirm and sincerely state on Oath as follows:', 72, 625);
             $page->setFont($font, 9)->drawText('i)  I propose to avail a crop loan under SBI JLG scheme against hypothecation of the crop which the loan is to be sanctioned.', 72, 605);
             $page->setFont($font, 9)->drawText('ii) In this connection, I confirm that and declare that I am land less labourer / share cropper /tenant farmer /oral lessee', 72, 585);
             $page->setFont($font, 9)->drawText('( Stricke out which ever not applicable ).', 80, 575);
             $page->setFont($font, 9)->drawText('iii) I hereby declare and confirm furture that the properties mentioned in the schedule to the affidavit is the property which', 72, 555);
             $page->setFont($font, 9)->drawText('is the subject matter of lease (Oral /written) in my favour for year to year or for period of  ' . $dateconvert->normalformat($result['created_date']) . '', 80, 545);
             $page->setFont($font, 9)->drawText('year as mentioned in the document and the lease is presently in force and Sri ' . $result['landowner_name'] . ' is the lesser and ', 80, 535);
             $page->setFont($font, 9)->drawText('the owner of the property (a copy of the lease deed is enclosed).', 80, 525);
             $page->setFont($font, 9)->drawText('iv)I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and', 72, 505);
             $page->setFont($font, 9)->drawText('have not committed any breach of the terms and conditions of the lease.Moreover,I declare further  that there are no', 80, 495);
             $page->setFont($font, 9)->drawText('arrears of any lease amount.', 80, 485);
             $page->setFont($font, 9)->drawText('v) I have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank', 72, 465);
             $page->setFont($font, 9)->drawText('finance.The crop to be raised is free from the charge/encumbrances.', 80, 455);
             // add page to document
             $pdf->pages[] = $page;
             $pdfData = $pdf->render();
             $pdfData = $pdf->render();
             $pdf->save('/var/www/' . $projname . '/reports/declaration.pdf');
             $path = '/var/www/' . $projname . '/reports/declaration.pdf';
             chmod($path, 0777);
             //                 $this->_redirect('/declaration/index');
         }
     }
 }
Example #11
0
 function pdftransactionAction()
 {
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     // Image
     $image_name = "/var/www" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $text = array($this->view->translate("Deposit Summary"), $this->view->translate("Product"), $this->view->translate('Deposit summary'), $this->view->translate("No. of Savings"), $this->view->translate("Total Savings Amount"));
     function position($amt)
     {
         $len = strlen($amt);
         $pos = 490 - $len * 4;
         return $pos;
     }
     $xx = 50;
     $xy = 550;
     $x1 = 60;
     $x2 = 190;
     $x3 = 330;
     $x4 = 420;
     $page->drawText($text[0], 260, 750);
     $y1 = 725;
     if ($this->_request->getParam('field1')) {
         $officename = new Depositsummary_Model_Depositsummary();
         $OffName = $officename->officeNamefetch($this->_request->getParam('field1'));
         foreach ($OffName as $OffName) {
         }
         $this->view->officeName = $OffName['name'];
         $page->drawText($this->view->translate("Branch Name : "), $x1, $y1);
         $page->drawText($OffName['name'], $x2, $y1);
         $y1 -= 20;
     }
     //point to draw Side line
     $startlinepoint = $y1;
     $page->drawLine($xx, $y1, $xy, $y1);
     $y1 -= 20;
     $page->drawText($text[1], $x1, $y1);
     $page->drawText($text[2], $x2, $y1);
     $page->drawText($text[3], $x3, $y1);
     $page->drawText($text[4], $x4, $y1);
     $y1 -= 5;
     $page->drawLine($xx, $y1, $xy, $y1);
     $y1 -= 20;
     $this->view->depositAmount = 0;
     $this->view->withdrawlAmount = 0;
     $this->view->totalAmount = 0;
     $this->view->deposit = 0;
     $this->view->withdrawl = 0;
     $this->view->sum = 0;
     if ($this->_request->getParam('field1')) {
         $office_id = $this->_request->getParam('field1');
         $this->view->office_id = $office_id;
         $savingsummary = new Depositsummary_Model_Depositsummary();
         $result = $savingsummary->fetchSavingsDetails($office_id);
         $this->view->result = $result;
         $depositAmount = 0;
         $deposit = 0;
         $withdrawlAmount = 0;
         $withdrawl = 0;
         $totalamount = 0;
         $sum = 0;
         foreach ($result as $result) {
             $page->drawText($result['productname'], $x1, $y1);
             $page->drawText($result['prodoffername'], $x2, $y1);
             $page->drawText($result['countvalue'], $x3, $y1);
             $y1 -= 15;
             $accountBalanc = $savingsummary->accountBalanceDetails($office_id);
             $this->view->accountBalanc = $accountBalanc;
             foreach ($accountBalanc as $accountBalanc) {
                 if ($result['id'] == $accountBalanc['offerprodid']) {
                     if ($accountBalanc['transactiontype_id'] == 1) {
                         $depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
                         $deposit = $deposit + $accountBalanc['amount_to_bank'];
                     }
                     if ($accountBalanc['transactiontype_id'] == 2) {
                         $withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
                         $withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
                     }
                     $totalamount = $depositAmount - $withdrawlAmount;
                     $sum = $deposit - $withdrawl;
                 }
             }
             if ($totalamount) {
                 $pos = position(sprintf("%4.2f", $totalamount));
                 $page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
                 $y1 -= 18;
                 $totalamount = 0;
                 $withdrawlAmount = 0;
                 $depositAmount = 0;
             } else {
                 echo "***";
             }
         }
         $page->drawLine($xx, $y1, $xy, $y1);
         $y1 -= 18;
         $page->drawText("Total", $x3, $y1);
         $pos = position(sprintf("%4.2f", $sum));
         $page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
         $y1 -= 10;
         $page->drawLine($xx, $y1, $xy, $y1);
         $page->drawLine($xx, $y1, $xx, $startlinepoint);
         //1st vertical line
         $page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
         //1st vertical line
         $page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($xy, $y1, $xy, $startlinepoint);
         //1st vertical line
         //echo "<pre>";print_r($accountBalanc);echo "<pre>";
         if (!$result && !$accountBalanc) {
             echo "<font color='RED' size = '3'>No Savings Account</font>";
         }
     } else {
         // $office_id = $this->_request->getParam('field1');
         $savingsummary = new Depositsummary_Model_Depositsummary();
         $result = $savingsummary->SavingsDetails();
         $this->view->result = $result;
         $accountBalanc = $savingsummary->accountBalance();
         $this->view->accountBalanc = $accountBalanc;
         $depositAmount = 0;
         $deposit = 0;
         $withdrawlAmount = 0;
         $withdrawl = 0;
         $totalamount = 0;
         $sum = 0;
         foreach ($result as $result) {
             $page->drawText($result['productname'], $x1, $y1);
             $page->drawText($result['prodoffername'], $x2, $y1);
             $page->drawText($result['countvalue'], $x3, $y1);
             $accountBalanc = $savingsummary->accountBalance();
             $this->view->accountBalanc = $accountBalanc;
             foreach ($accountBalanc as $accountBalanc) {
                 if ($result['id'] == $accountBalanc['offerprodid']) {
                     if ($accountBalanc['transactiontype_id'] == 1) {
                         $depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
                         $deposit = $deposit + $accountBalanc['amount_to_bank'];
                     }
                     if ($accountBalanc['transactiontype_id'] == 2) {
                         $withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
                         $withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
                     }
                     $totalamount = $depositAmount - $withdrawlAmount;
                     $sum = $deposit - $withdrawl;
                 }
             }
             if ($totalamount) {
                 $pos = position(sprintf("%4.2f", $totalamount));
                 $page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
                 $y1 -= 18;
                 $totalamount = 0;
                 $withdrawlAmount = 0;
                 $depositAmount = 0;
             } else {
                 echo "***";
             }
         }
         $page->drawLine($xx, $y1, $xy, $y1);
         $y1 = 18;
         $page->drawText("Total", $x3, $y1);
         $pos = position(sprintf("%4.2f", $sum));
         $page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
         $y1 = 15;
         $page->drawLine($xx, $y1, $xy, $y1);
         $page->drawLine($xx, $y1, $xx, $startlinepoint);
         //1st vertical line
         $page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
         //1st vertical line
         $page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($xy, $y1, $xy, $startlinepoint);
         //1st vertical line
         if (!$result && !$accountBalanc) {
             echo "<font color='RED' size = '3'>No Savings Account</font>";
         }
     }
     //          $y1-=15;
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/depositsummaryreport.pdf');
     $path = '/var/www' . $projname . '/reports/depositsummaryreport.pdf';
     chmod($path, 0777);
     $this->_redirect('depositsummary/index');
 }
Example #12
0
    /**
	 * This is the default 'index' action that is invoked
	 * when an action is not explicitly requested by users.
	 */
	public function actionZendPdf()
	{
            set_include_path( '/home/asaap/src/protected/extensions/' );

            require_once 'Zend/Pdf.php';
            require_once 'Zend/Pdf/Style.php';
            require_once 'Zend/Pdf/Color/Cmyk.php';
            require_once 'Zend/Pdf/Color/Html.php';
            require_once 'Zend/Pdf/Color/GrayScale.php';
            require_once 'Zend/Pdf/Color/Rgb.php';
            require_once 'Zend/Pdf/Page.php';
            require_once 'Zend/Pdf/Font.php';

            //$argv[1]='/home/asaap/src/protected/data/Pdf/test.pdf';
            $argv[1]='/home/asaap/src/protected/data/Pdf/document1.pdf';
            $argv[2]='/home/asaap/src/protected/data/Pdf/test_new.pdf';

            if (!isset($argv[1])) {
                echo "USAGE: php demo.php <pdf_file> [<output_pdf_file>]\n";
                exit;
            }

            try {
                $pdf = Zend_Pdf::load($argv[1]);
            } catch (Zend_Pdf_Exception $e) {
                if ($e->getMessage() == 'Can not open \'' . $argv[1] . '\' file for reading.') {
                    // Create new PDF if file doesn't exist
                    $pdf = new Zend_Pdf();

                    if (!isset($argv[2])) {
                        // force complete file rewriting (instead of updating)
                        $argv[2] = $argv[1];
                    }
                } else {
                    // Throw an exception if it's not the "Can't open file" exception
                    throw $e;

                }


            }

        //$pdf->pages = array_reverse($pdf->pages);
        // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
        $pdf->pages[] = ($page1 = $pdf->newPage('A4'));

        //saving here

            $pdf->save($argv[2]);

        //    $pdf->save($argv[1], true /* update */);



	}
 public function createpdfAction()
 {
     $this->render('index');
     $idpdf = $this->getRequest()->getParam('idpdf');
     $objeto_model = new Application_Model_Db();
     if ($this->getRequest()->isPost()) {
         $lab = $this->getRequest()->getPost('infoLab');
         // $this->view->lab = $lab;
     } else {
         $lab = $this->getRequest()->getParam('infoLab');
     }
     try {
         if ($lab) {
             $valor = $objeto_model->selectDados($lab);
         } else {
             $valor = $objeto_model->selectAllDados();
         }
         $this->view->assign('valor', $valor);
     } catch (Zend_Exception $e) {
         echo $e;
     }
     if ($idpdf == 1) {
         $client = new Zend_Http_Client();
         // set some parameters
         $client->setParameterGet('infoLab', 'bi');
         $pdf = new Zend_Pdf();
         $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
         // 595:842 A4
         $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Local', 20, 570, 'UTF-8');
         $pdfPage->drawText('Nome laboratório', 75, 570, 'UTF-8');
         $pdfPage->drawText('Data', 205, 570, 'UTF-8');
         $pdfPage->drawText('Turno visita', 265, 570, 'UTF-8');
         $pdfPage->drawText('Somente aula?', 365, 570, 'UTF-8');
         $pdfPage->drawText('Frequencia aula', 475, 570, 'UTF-8');
         $pdfPage->drawText('Turno Aula', 595, 570, 'UTF-8');
         $pdfPage->drawText('Quantidade gabinete', 695, 570, 'UTF-8');
         $stringpos = 550;
         // posicao x do meu texto
         $stringdif = 12;
         // diferença entre cada quebra de linha.
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->nomeLaboratorio, 75, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->data, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->turnoVisita, 265, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->somenteAula, 365, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->frequenciaAula, 475, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->turnoAula, 595, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->quantGabinete, 695, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
         }
         if ($stringpos < 285) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $stringpos = 580;
         }
         $stringpos -= 4;
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Quantidade tipo gabinete', 20, $stringpos, 'UTF-8');
         $pdfPage->drawText('Sistema operacional', 205, $stringpos, 'UTF-8');
         $pdfPage->drawText('Licença DTI?', 365, $stringpos, 'UTF-8');
         $pdfPage->drawText('OCS instalado?', 475, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ips servidores', 595, $stringpos, 'UTF-8');
         $pdfPage->drawText('Estrutura L.rede', 710, $stringpos, 'UTF-8');
         $stringpos -= 12;
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->sisOperacional, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->licencaDti, 365, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ocsInstalado, 475, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ipsServidores, 595, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->estruturaLRede, 710, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
         }
         if ($stringpos < 198) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $stringpos = 580;
         }
         $stringpos -= 4;
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Roteador', 20, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ip entrada', 205, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ip saída', 365, $stringpos, 'UTF-8');
         $pdfPage->drawText('Nome responsável', 475, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ramal', 595, $stringpos, 'UTF-8');
         $pdfPage->drawText('E-mail', 715, $stringpos, 'UTF-8');
         $stringpos -= 12;
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ipEntrada, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ipSaida, 365, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->nomeResponsavel, 475, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ramal, 595, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->email, 715, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
             if ($stringpos < 14) {
             }
         }
         if ($stringpos <= 170) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $stringpos = 580;
         }
         $stringpos -= 4;
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Acesso remoto', 20, $stringpos, 'UTF-8');
         $pdfPage->drawText('Backup', 205, $stringpos, 'UTF-8');
         $pdfPage->drawText('Firewall', 375, $stringpos, 'UTF-8');
         $pdfPage->drawText('Observações', 475, $stringpos, 'UTF-8');
         $stringpos -= 12;
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($value->acessoRemoto, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->backup, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->firewall, 375, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->observacoes, 475, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
         }
         if ($stringpos < 14) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
         }
         // if $stringpos = 250 muda a pagina
         //
         // adicionamos nossa página como a 1ª página de nosso documento
         // $pagina=$stringpos/250;
         array_push($pdf->pages, $pdfPage);
         // $pdf->pages[1] = $pdfPage;
         $pdf->save('lab.pdf');
         header('Content-type: application/pdf');
         echo $pdf->render();
     } else {
         return $this->_helper->redirector('select', 'lab');
     }
 }
Example #14
0
 public function pdfmeetingAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     //view details on pdf page
     $meeting_id = $this->_request->getParam('meeting_name');
     $meetingno = $this->_request->getParam('meetingno');
     $this->view->field1 = $meetingno;
     $this->view->branchid = $meeting_id;
     //for meeting details
     $meetingbook = new Meetingbookreport_Model_Meetingbook();
     // 	$this->view->fetchgroupid=$groupid1=$meetingbook->fetchgroupid($meeting_id);
     // 	$groupid= $groupid1[0]['group_id'];
     $this->view->meeting = $ff = $meetingbook->fetchmeeting($meeting_id);
     //echo '<pre>';print_r($ff);
     //fetch member details
     $this->view->members = $aa = $meetingbook->fetchMembers($meeting_id);
     //echo '<pre>';print_r($aa);
     //fetch attendance details
     $this->view->attendance = $meetingbook->fetchattendance($meeting_id, $meetingno);
     //fetch loan officer
     $loanofficer = $meetingbook->fetchloanofficer($meeting_id);
     if ($loanofficer) {
         $this->view->loanofficer = $loanofficer[0]['loanofficer'];
     }
     //$cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array();
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d/m/Y'), 500, 800);
     //date('Y-m-d')
     $page->drawText("Meeting Book", 270, 770);
     $page->drawText("Meeting Book", 270, 770);
     $x1 = 50;
     $x2 = 320;
     $y1 = 725;
     $y2 = 710;
     $page->drawText("Meeting Information", $x1, $y1);
     $page->drawText("Meeting Information", $x1, $y1);
     //fetching meeting details
     if ($this->view->meeting) {
         $count = count($this->view->meeting);
         foreach ($this->view->meeting as $meeting) {
         }
         $page->drawText("Group name: " . $meeting['groupname'], $x1, $y1 = $y1 - 20);
         $page->drawText("Week Day: " . $meeting['weekday'], $x2, $y1);
         $page->drawText("Group head: " . $meeting['grouphead_name'], $x1, $y1 = $y1 - 15);
         $page->drawText("Time: " . $meeting['time'], $x2, $y1);
         $page->drawText("Number of members: " . $count, $x1, $y1 = $y1 - 15);
         $page->drawText("Place: " . $meeting['place'], $x2, $y1);
         $page->drawText("Loan Officer: " . $this->view->loanofficer, $x1, $y1 = $y1 - 15);
     }
     //         $this->view->savings = 10;
     $y1 = $y1 - 30;
     $page->drawText("Attendance Information", $x1, $y1);
     $page->drawText("Attendance Information", $x1, $y1);
     //fetching attendance details
     foreach ($this->view->attendance as $attendance) {
     }
     $page->drawText("Meeting name: " . $attendance['meetingname'], $x1, $y1 = $y1 - 20);
     $page->drawText("Held on: " . $this->view->dateconvertor->phpnormalformat($attendance['meeting_date']), $x2, $y1);
     $page->drawText("Meeting Number: " . $attendance['week_no'], $x1, $y1 = $y1 - 15);
     $page->drawText("Time: " . $attendance['time'], $x2, $y1);
     $y1 = $y1 - 30;
     $page->drawText("Member Details", $x1, $y1);
     $page->drawText("Member Details", $x1, $y1);
     $y1 = $y1 - 15;
     $page->drawLine(50, $y1, 550, $y1);
     //table top line
     $y3 = $y1;
     // assign for left and right lines
     $y1 = $y1 - 15;
     $page->drawText("Sl", 55, $y1);
     $page->drawText("Members", 70, $y1);
     $page->drawText("UID", 180, $y1);
     $page->drawText("Attn.", 240, $y1);
     $page->drawText("Late", 265, $y1);
     $page->drawText("Absent", 290, $y1);
     $page->drawText("Balance", 340, $y1);
     $page->drawText("Pay", 395, $y1);
     $page->drawText("Outstanding", 420, $y1);
     $page->drawText("Due", 480, $y1);
     $page->drawText("Total", 525, $y1);
     // $page->drawLine(50, $y1 = $y1 - 20, 550, $y1); //dynamic bottom line - member details table
     $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
     $no = 1;
     $Topay = 0;
     $currentbalance1 = 0;
     $currentbalance2 = 0;
     $currentbalance3 = 0;
     $loandue1 = 0;
     $loandue2 = 0;
     $currentpay = 0;
     $totallatefee = 0;
     $totalabsentfee = 0;
     $total1 = 0;
     $total = 0;
     $currentbalance = new Meetingbookreport_Model_Meetingbook();
     $x3 = 315;
     $x4 = 345;
     $x5 = 400;
     $x6 = 445;
     $x7 = 495;
     $x8 = 530;
     $x9 = 575;
     foreach ($this->view->members as $members) {
         $memberid = $members['memberid'];
         $total = 0;
         $y1 = $y1 - 15;
         $page->drawText($no, 55, $y1);
         $page->drawText($members['membername'], 70, $y1);
         $page->drawText($members['uid'], 180, $y1);
         //$members['uid']
         $memberabsent = $currentbalance->memberabsent($memberid, $attendance['id']);
         $memberlate = $currentbalance->memberlate($memberid, $attendance['id']);
         if ($memberabsent) {
             $absente = 'A';
         } else {
             if ($memberlate) {
                 $absente = 'L';
             } else {
                 $absente = 'P';
             }
         }
         $page->drawText($absente, 245, $y1);
         if ($memberlate) {
             $totallatefee += $latefee = $members['penalty_latecoming'];
             $pos = position(sprintf("%4.2f", $latefee), $x3);
             $page->drawText(sprintf("%4.2f", $latefee), $pos + 2, $y1);
         } else {
             $latefee = 0;
             $pos = position(sprintf("%4.2f", ''), $x3);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         if ($memberabsent) {
             $totalabsentfee += $absentfee = $members['penalty_notcoming'];
             $pos = position(sprintf("%4.2f", $absentfee), $x4);
             $page->drawText(sprintf("%4.2f", $absentfee), $pos + 2, $y1);
         } else {
             $absentfee = 0;
             $pos = position(sprintf("%4.2f", ''), $x4);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         $creditbalance = $currentbalance->creditbalance($memberid);
         $debitbalance = $currentbalance->debitbalance($memberid);
         if ($creditbalance) {
             if ($debitbalance) {
                 $debitbalance1 = $debitbalance;
             } else {
                 $debitbalance1 = 0;
             }
             $currentbalance1 = $creditbalance[0]['currentbalance'] - $debitbalance1[0]['currentbalance'];
             $pos = position(sprintf("%4.2f", $currentbalance1), $x5);
             $page->drawText(sprintf("%4.2f", $currentbalance1), $pos + 2, $y1);
         } else {
             $pos = position(sprintf("%4.2f", ''), $x5);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         $currentbalance2 += $currentbalance1;
         $perweek = $members['saving_perweek'];
         $pos = position(sprintf("%4.2f", $members['saving_perweek']), $x6);
         $page->drawText(sprintf("%4.2f", $members['saving_perweek']), $pos + 2, $y1);
         $loanoutstanding = $currentbalance->loanoutstanding($memberid);
         if ($loanoutstanding) {
             $loanoutstanding1 = $loanoutstanding[0]['outstanding'];
             $pos = position(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $x7);
             $page->drawText(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $pos + 2, $y1);
         }
         $currentbalance3 += $loanoutstanding1;
         $loandue = $currentbalance->loandue($memberid);
         if ($loandue) {
             $pos = position(sprintf("%4.2f", $loandue[0]['outstanding']), $x8);
             $page->drawText(sprintf("%4.2f", $loandue[0]['outstanding']), $pos + 2, $y1);
             $loandue1 = $loandue[0]['outstanding'];
         }
         $loandue2 += $loandue1;
         $total = $latefee + $absentfee + $currentbalance1 + $loandue1;
         $pos = position(sprintf("%4.2f", $total), $x9);
         $page->drawText(sprintf("%4.2f", $total), $pos + 2, $y1);
         $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
         $no++;
         $Topay += $members['saving_perweek'];
         $total1 += $total;
     }
     $y1 = $y1 - 15;
     $page->drawText("Total", 180, $y1);
     $pos = position(sprintf("%4.2f", $totallatefee), $x3);
     $page->drawText(sprintf("%4.2f", $totallatefee), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $totalabsentfee), $x4);
     $page->drawText(sprintf("%4.2f", $totalabsentfee), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $currentbalance2), $x5);
     $page->drawText(sprintf("%4.2f", $currentbalance2), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $Topay), $x6);
     $page->drawText(sprintf("%4.2f", $Topay), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $currentbalance3), $x7);
     $page->drawText(sprintf("%4.2f", $currentbalance3), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $loandue2), $x8);
     $page->drawText(sprintf("%4.2f", $loandue2), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $total1), $x9);
     $page->drawText(sprintf("%4.2f", $total1), $pos + 2, $y1);
     $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1, 50, $y3);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(550, $y1, 550, $y3);
     //table rigth vertical
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/meetingbook.pdf');
     $path = '/var/www/' . $projname . '/reports/meetingbook.pdf';
     chmod($path, 0777);
 }
Example #15
0
 /**
  * Generate a review portal pdf.
  *
  * @param integer $portalId
  * @return string The pdf name
  */
 protected function _generatePdf($portalId)
 {
     $portal = new Object_ReviewPortal($portalId);
     if (!$portal->getId()) {
         return false;
     }
     // Get the screenshots of all the portal pages.
     $pages = Repo_ReviewPortalPage::getInstance()->getPortalPages($portalId);
     if (!$pages || $pages->count() == 0) {
         return false;
     }
     $pdf = new Zend_Pdf();
     $pageNumber = 1;
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $fontSize = 10;
     foreach ($pages as $_p) {
         $_images = array();
         $_page = new Object_Page($_p->id);
         // Try get static screenshots if the setting is set.
         if ($_page->screenshot_type == Repo_Page::SCREENSHOT_TYPE_STATIC) {
             $_images = $_page->getStaticScreenshots(true);
         }
         // Get dynamic one.
         if (empty($_images)) {
             $_images[] = Manager_ScreenCapture_Page::getInstance()->getScreenshot($_p->id);
         }
         foreach ($_images as $_image) {
             $_pdfImage = Zend_Pdf_Image::imageWithPath($_image);
             $_pdfPage = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
             $_pdfPage->drawImage($_pdfImage, 20, 36, $_pdfPage->getWidth() - 20, $_pdfPage->getHeight() - 20);
             $_pdfPage->setFont($font, 16);
             $_pdfPage->setFillColor(Zend_Pdf_Color_Html::color('#333333'))->drawText($pageNumber, $_pdfPage->getWidth() / 2, 10);
             $pageNumber++;
             $pdf->pages[] = $_pdfPage;
         }
     }
     $pdfName = $portalId . '_' . time() . '.pdf';
     $path = $this->_rootPath . DS . $pdfName;
     $pdf->save($path);
     return $pdfName;
 }
Example #16
0
 public function testFontDrawing()
 {
     $pdf = new Zend_Pdf();
     // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
     $pdf->pages[] = $page = $pdf->newPage('A4');
     $stampImagePNG = Zend_Pdf_Image::imageWithPath(dirname(__FILE__) . '/_files/stamp.png');
     $this->assertTrue($stampImagePNG instanceof Zend_Pdf_Resource_Image);
     $page->saveGS();
     $page->clipCircle(250, 500, 50);
     $page->drawImage($stampImagePNG, 200, 450, 300, 550);
     $page->restoreGS();
     $stampImageTIFF = Zend_Pdf_Image::imageWithPath(dirname(__FILE__) . '/_files/stamp.tif');
     $this->assertTrue($stampImageTIFF instanceof Zend_Pdf_Resource_Image);
     $page->saveGS();
     $page->clipCircle(325, 500, 50);
     $page->drawImage($stampImagePNG, 275, 450, 375, 550);
     $page->restoreGS();
     if (function_exists('gd_info') && array_key_exists('JPG Support', gd_info())) {
         $stampImageJPG = Zend_Pdf_Image::imageWithPath(dirname(__FILE__) . '/_files/stamp.jpg');
         $this->assertTrue($stampImageJPG instanceof Zend_Pdf_Resource_Image);
         $page->saveGS();
         $page->clipCircle(287.5, 440, 50);
         $page->drawImage($stampImageJPG, 237.5, 390, 337.5, 490);
         $page->restoreGS();
         $page->saveGS();
         $page->clipCircle(250, 500, 50);
         $page->clipCircle(287.5, 440, 50);
         $page->drawImage($stampImagePNG, 200, 450, 300, 550);
         $page->restoreGS();
     }
     $pdf->save(dirname(__FILE__) . '/_files/output.pdf');
     unset($pdf);
     $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
     $this->assertTrue($pdf1 instanceof Zend_Pdf);
     unset($pdf1);
     unlink(dirname(__FILE__) . '/_files/output.pdf');
 }
Example #17
0
 public function testSetAndSaveLoadAndResetAndSaveLoadAndGetJavaScript()
 {
     $tempFile = tempnam(sys_get_temp_dir(), 'PdfUnitFile');
     $javaScript = array('print();', 'alert();');
     $pdf = new Zend_Pdf();
     $pdf->setJavaScript($javaScript);
     $pdf->save($tempFile);
     unset($pdf);
     $pdf = Zend_Pdf::load($tempFile);
     unlink($tempFile);
     $pdf->resetJavaScript();
     $pdf->save($tempFile);
     unset($pdf);
     $pdf = Zend_Pdf::load($tempFile);
     unlink($tempFile);
     $this->assertNull($pdf->getJavaScript());
 }
Example #18
0
 function pdfdisplayAction()
 {
     $convertdate = new App_Model_dateConvertor();
     //  echo '<pre>'; print_r($this->_request->getParam('accNum'));
     $this->view->details = $this->view->loanModel->searchaccounts($this->_request->getParam('accNum'));
     //echo '<pre>'; print_r($this->view->details);
     $this->view->tran = $this->view->loanModel->loanInstalments($this->_request->getParam('accNum'));
     $this->view->paid = $this->view->loanModel->paid($this->_request->getParam('accNum'));
     $this->view->unpaid = $this->view->loanModel->unpaid($this->_request->getParam('accNum'));
     // 		$loansearch = new Loandetailsg_Form_Search();
     // 		$loantransactions = new Loandisbursmentg_Model_loan();
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $page->drawText('( LOAN LEDGER )', 237, 780);
     $text = array("Member details");
     $x0 = 50;
     $x3 = 310;
     $x1 = 150;
     $x2 = 220;
     $page->drawLine(50, 740, 290, 740);
     $page->drawLine(50, 720, 290, 720);
     $page->drawText($text[0], 90, 727);
     $y1 = 700;
     foreach ($this->view->details as $details) {
         $page->drawText('Name  : ' . $details->name, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Branch  : ' . $details->officename, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Code  : ' . $details->code, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Account code  : ' . $details->number, $x0, $y1);
         $text1 = array("Loan details");
         $y1 = $y1 - 25;
         $page->drawLine(50, $y1, 290, $y1);
         $y1 = $y1 - 20;
         $page->drawLine(50, $y1, 290, $y1);
         $y1 = $y1 + 7;
         $page->drawText($text1[0], 90, $y1);
         $y1 = $y1 - 25;
         $page->drawText('Loan name  : ' . $details->loanname, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Loan amount Rs  : ' . $details->amount, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Interest rate %  : ' . $details->interest, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Installments  : ' . $details->installments, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Sanctioned date  : ' . $details->sanctioned, $x0, $y1);
         $y1 = $y1 - 20;
     }
     $y1 = 740;
     $text2 = array("Installment status        No          Amount");
     $page->drawLine(310, $y1, 550, $y1);
     $y1 = $y1 - 20;
     $page->drawLine(310, $y1, 550, $y1);
     $y1 = $y1 + 7;
     $page->drawText($text2[0], $x3, $y1);
     foreach ($this->view->paid as $paid) {
         $y1 = $y1 - 25;
         $page->drawText('Paid' . $paid->paidAmt, 320, $y1);
         $page->drawText($paid->paidCount, 390, $y1);
     }
     foreach ($this->view->unpaid as $unpaid) {
         $y1 = $y1 - 20;
         $page->drawText('Due', 320, $y1);
         $page->drawText($unpaid->unpaidCount, 390, $y1);
         $page->drawText($unpaid->unpaidAmt, 430, $y1);
     }
     $y1 = 480;
     $text3 = array("GL.LF no            Transaction date           Creidt               Debit                      Payment mode              Transacted by ");
     $page->drawLine(50, $y1, 550, $y1);
     $y1 = $y1 - 20;
     $page->drawLine(50, $y1, 550, $y1);
     $y1 = $y1 + 7;
     $page->drawText($text3[0], $x0, $y1);
     foreach ($this->view->tran as $transaction) {
         $y1 = $y1 - 20;
         $page->drawText($transaction->id, 60, $y1);
         $page->drawText($transaction->date, 120, $y1);
         $page->drawText($transaction->cr, 160, $y1);
         $page->drawText($transaction->dt, 250, $y1);
         $page->drawText($transaction->mode, 330, $y1);
         $page->drawText($transaction->name, 420, $y1);
         $y1 = $y1 - 5;
         $page->drawLine(50, $y1, 550, $y1);
     }
     $pdf->pages[] = $page;
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/loanledger.pdf');
     $path = '/var/www/' . $projname . '/reports/loanledger.pdf';
     chmod($path, 0777);
 }
$page2->restoreGS();
// Coordination system movement, skewing and scaling
$page2->saveGS();
$page2->translate(60, 150)->skew(0, 0, 0, -M_PI / 9)->scale(0.9, 0.9);
// Scale coordination system
// Draw rectangle
$page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8))->setLineColor(new Zend_Pdf_Color_GrayScale(0.2))->setLineDashingPattern(array(3, 2, 3, 4), 1.6)->drawRectangle(0, 50, 340, 0);
// Draw circle
$page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID)->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawCircle(25, 25, 25);
// Draw sectors
$page2->drawCircle(140, 25, 25, 2 * M_PI / 3, -M_PI / 6)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawCircle(140, 25, 25, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawCircle(140, 25, 25, -M_PI / 6, M_PI / 6);
// Draw ellipse
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawEllipse(190, 50, 340, 0)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawEllipse(190, 50, 340, 0, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawEllipse(190, 50, 340, 0, -M_PI / 6, M_PI / 6);
// Draw and fill polygon
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
$x = array();
$y = array();
for ($count = 0; $count < 8; $count++) {
    $x[] = 80 + 25 * cos(3 * M_PI_4 * $count);
    $y[] = 25 + 25 * sin(3 * M_PI_4 * $count);
}
$page2->drawPolygon($x, $y, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, Zend_Pdf_Page::FILL_METHOD_EVEN_ODD);
// Draw line
$page2->setLineWidth(0.5)->drawLine(0, 25, 340, 25);
$page2->restoreGS();
//------------------------------------------------------------------------------------
if (isset($argv[2])) {
    $pdf->save($argv[2]);
} else {
    $pdf->save($argv[1], true);
}
Example #20
0
 function pdfdisplayAction()
 {
     $declarationform = new Externalloan_Model_Dec();
     $this->view->form = $declarationform;
     $postdata = $this->_request->getpost();
     //echo '<pre>'; print_r($postdata);
     $this->view->membercode = $memcode = $postdata['membercode'];
     //echo $this->view->membercode.'<br>';
     $this->view->moduleid = $moduleid = $postdata['module_id'];
     $this->view->groupresult = $results = $this->view->dbobj->groupDeatils($memcode, $moduleid);
     $this->view->groupmember = $membername = $this->view->dbobj->getmember($memcode);
     $this->view->represent = $repname = $this->view->dbobj->represent($memcode);
     $this->view->loans = $loans = $this->view->dbobj->getgrouploans($memcode);
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizonta
     // define font resource
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $x1 = 72;
     $x2 = 410;
     $y1 = 670;
     //$y2=;
     $memcode = $this->_request->getParam('membercode');
     $moduleid = $this->_request->getParam('module_id');
     //             echo '<pre>'; print_r($this->view->groupresult);
     $dateconvert = new App_Model_dateConvertor();
     foreach ($this->view->groupresult as $result) {
         foreach ($this->view->represent as $name) {
             foreach ($this->view->groupmember as $memberview) {
                 // write text to page
                 $page->setFont($font, 10)->drawText('( EXTERNAL LOAN REQUEST )', 237, 720);
                 $page->setFont($font, 9)->drawText('Group name :' . $result['name'] . '', $x1, $y1);
                 $page->setFont($font, 9)->drawText('Date :' . date('d-m-Y') . '', $x2, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('Group Address :' . $result['address1'] . '', $x1, $y1);
                 $page->setFont($font, 9)->drawText('Group code :' . $result['groupcode'] . '', $x2, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('' . $result['city'] . '', 137, $y1);
                 $page->setFont($font, 9)->drawText('Savings A/c :' . $result['account_number'] . '', $x2, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('' . $result['state'] . '', 137, $y1);
                 foreach ($this->view->loans as $loan) {
                     $page->setFont($font, 9)->drawText('Loan A/c :' . $loan['loanaccount'] . '', $x2, $y1);
                 }
                 // // 				$y1=$y1-15;
                 // //                 $page->setFont($font, 9)
                 // //                     ->drawText('Communication:phone/mobile :'.$loan['mobile'].'',$x1, $y1);
                 $y1 = $y1 - 10;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 25;
                 $page->setFont($font, 9)->drawText('1...' . $result['purpose'] . '...(PURPOSE)sfjhkjh kjhjhjdhfjn dhfjkasdhfjh..' . $result['bankname'] . '..(BANK)afd/saa/sdb', $x1, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('..' . $result['branchname'] . '..(Branch name) asdbnhhjh saoinm (LOAN AMOUNT)..' . $result['amount'] . '...ajjnsabvcui uwepiyqwne bodaftutguy nhgqwe.', $x1, $y1);
                 $y1 = $y1 - 20;
                 $page->setFont($font, 9)->drawText('2. aujhhjuoer uiuhjn jhsfduio  uyhuasmuiohjos iuiowsmhns8u ujmnasusm sjuhm,asdfiu ', $x1, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('1) ' . $name['memnames'] . '', 150, $y1);
                 $y1 = $y1 - 25;
                 $page->setFont($font, 9)->drawText('aujhhjuoer uiuhjn jhsfduio  uyhuasmuiohjos iuiowsmhns8u ujmnasusm sjuhm,asdfiu ', $x1, $y1);
                 $y1 = $y1 - 15;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('S.No', 80, $y1);
                 $page->setFont($font, 9)->drawText('Member Name', 150, $y1);
                 $page->setFont($font, 9)->drawText('Purpose', 270, $y1);
                 $page->setFont($font, 9)->drawText('Loan request', 360, $y1);
                 $page->setFont($font, 9)->drawText('Signature', 450, $y1);
                 $y1 = $y1 - 10;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('' . $memberview['memname'] . '', 150, $y1);
                 $page->setFont($font, 9)->drawText('' . $memberview['purposename'] . '', 260, $y1);
                 $page->setFont($font, 9)->drawText('' . $memberview['Amount'] . '', 365, $y1);
                 $y1 = $y1 - 10;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 50;
                 $pdf->pages[] = $page;
                 $pdfData = $pdf->render();
                 $pdfData = $pdf->render();
                 $pdf->save('/var/www/' . $projname . '/reports/externalloan.pdf');
                 $path = '/var/www/' . $projname . '/reports/externalloan.pdf';
                 chmod($path, 0777);
             }
         }
     }
 }
Example #21
0
 public function remittanceInvoice($batch_id = 27, $shop_date_remittance = null)
 {
     $user = $this;
     $page_count = 0;
     $footer_added = 0;
     $pdf = new Zend_Pdf();
     $pdf->pages[] = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page = $pdf->pages[$page_count];
     $style = new Zend_Pdf_Style();
     $style->setLineColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $style->setFont($font, 16);
     $page->setStyle($style);
     $page_height = $page->getHeight();
     $page->drawText('RECIPIENT CREATED TAX INVOICE', 150, $page_height - 80);
     $style->setFont($font, 12);
     $page->setStyle($style);
     $company = trim($user->company) != '' ? $user->company : $user->first_name . ' ' . $user->last_name;
     $address1 = !empty($this->delivery_address1) ? $this->delivery_address1 . ' ' : null;
     $address1 .= !empty($this->delivery_address2) ? $this->delivery_address2 . ' ' : null;
     $address1 .= !empty($this->delivery_city) ? $this->delivery_city . ' ' : null;
     $address2 = !empty($this->delivery_state) ? $this->delivery_state . ', ' : null;
     $address2 .= !empty($this->delivery_postcode) ? $this->delivery_postcode : null;
     $page->drawText($company, 50, $page->getHeight() - 120);
     $page->drawText($address1, 50, $page->getHeight() - 133);
     $page->drawText($address2, 50, $page->getHeight() - 147);
     $page->drawText('ABN # ' . $this->abn, 50, $page->getHeight() - 160);
     $remittanceDate = !empty($shop_date_remittance) ? date('d/m/Y') : date('d/m/Y');
     $invoice_number = $this->id . '-' . $batch_id;
     $page->drawText('Remittance Date: ' . $remittanceDate, 400, $page->getHeight() - 120);
     $page->drawText('Invoice number: ' . $invoice_number, 400, $page->getHeight() - 133);
     $style->setFont($font, 10);
     $page->setStyle($style);
     $page->drawText('Note: only items that were sold with GST applicable will appear on this invoice', 100, $page->getHeight() - 188);
     $head_row_height = 20;
     $row_height = 20;
     $line_height_start = $page_height - 200;
     $total_data_row = 30;
     $page_break_row = 25;
     $textline_height = 12;
     $spModel = Base::getModel('Shop_Products');
     $select = $spModel->select()->setIntegrityCheck(false)->from(array('sp' => 'shop_products'));
     //join with common_items
     $select->join(array('ci' => 'common_items'), 'sp.client_product_id = ci.client_product_id', array('sum(ci.copies) as copies, sum(ci.copies*ci.shop_markup) as shop_markup,  ci.registered_gst as gst', 'ci.registered_gst'));
     $select->where('ci.remittance_batch_id = ?', $batch_id);
     if (!empty($shop_date_remittance)) {
         $select->where('ci.shop_date_remittance = ?', $shop_date_remittance);
     }
     $select->where('sp.common_user_id = ?', $user->id);
     $select->where('ci.registered_gst = 1');
     $select->group(array('sp.common_user_id', 'gst'));
     $shop_markup_inc_gst = $shop_markup_exc_gst = '';
     //Zend_Debug::dump((string)$select); die();
     $rows = $spModel->fetchAll($select);
     $total_data_row = $rows->count();
     $i = 1;
     $j = 1;
     $total_copies = 0;
     $total_Ex_GST = $total_Inc_GST = 0.0;
     foreach ($rows as $row) {
         if ($i == 1) {
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
             $style->setFont($font, 10);
             $page->setStyle($style);
             $page->drawLine(60, $line_height_start, 540, $line_height_start)->drawLine(60, $line_height_start, 60, $line_height_start - $head_row_height)->drawLine(300, $line_height_start, 300, $line_height_start - $head_row_height)->drawLine(360, $line_height_start, 360, $line_height_start - $head_row_height)->drawLine(450, $line_height_start, 450, $line_height_start - $head_row_height)->drawLine(60, $line_height_start - $head_row_height, 540, $line_height_start - $head_row_height)->drawLine(540, $line_height_start, 540, $line_height_start - $head_row_height)->drawText('Description', 68, $line_height_start - $textline_height)->drawText('Copies', 308, $line_height_start - $textline_height)->drawText('Ex-GST Amount', 368, $line_height_start - $textline_height)->drawText('Inc-GST Amount', 458, $line_height_start - $textline_height);
             // Table Headers
             $line_height_start = $line_height_start - $head_row_height;
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
             $style->setFont($font, 10);
             $page->setStyle($style);
         }
         $shop_markup = sprintf("%01.2f", $row->shop_markup);
         $shop_markup_len = strlen($shop_markup);
         $num_pad = 5 * ($shop_markup_len - 4);
         $page->drawLine(60, $line_height_start, 540, $line_height_start)->drawLine(60, $line_height_start, 60, $line_height_start - $row_height)->drawLine(300, $line_height_start, 300, $line_height_start - $row_height)->drawLine(360, $line_height_start, 360, $line_height_start - $row_height)->drawLine(450, $line_height_start, 450, $line_height_start - $row_height)->drawLine(60, $line_height_start - $row_height, 540, $line_height_start - $row_height)->drawLine(540, $line_height_start, 540, $line_height_start - $row_height)->drawText($row->title, 68, $line_height_start - $textline_height)->drawText($row->copies, 330, $line_height_start - $textline_height)->drawText($row->gst == 1 ? sprintf("%01.2f", $shop_markup - $shop_markup / 11) : sprintf("%01.2f", $shop_markup), 425 - $num_pad, $line_height_start - $textline_height)->drawText(sprintf("%01.2f", $shop_markup), 515 - $num_pad, $line_height_start - $textline_height);
         // Table Headers
         $line_height_start = $line_height_start - $row_height;
         $total_copies += $row->copies;
         $total_Inc_GST += $shop_markup;
         if ($row->gst == 1) {
             $total_Ex_GST += $shop_markup - $shop_markup / 11;
         } else {
             $total_Ex_GST += $shop_markup;
         }
         $footer_added = 0;
         if ($j == $total_data_row) {
             $total_Ex_GST = sprintf("%01.2f", $total_Ex_GST);
             $total_Inc_GST = sprintf("%01.2f", $total_Inc_GST);
             $len = strlen($total_Ex_GST);
             $ex_gst_num_pad = 5 * ($len - 4);
             $len = strlen($total_Inc_GST);
             $inc_gst_num_pad = 5 * ($len - 4);
             $len = strlen($total_copies);
             $copies_num_pad = 5 * ($len - 1);
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
             $style->setFont($font, 10);
             $page->setStyle($style);
             $page->drawLine(60, $line_height_start, 540, $line_height_start)->drawLine(60, $line_height_start, 60, $line_height_start - $head_row_height)->drawLine(300, $line_height_start, 300, $line_height_start - $head_row_height)->drawLine(360, $line_height_start, 360, $line_height_start - $head_row_height)->drawLine(450, $line_height_start, 450, $line_height_start - $head_row_height)->drawLine(60, $line_height_start - $head_row_height, 540, $line_height_start - $head_row_height)->drawLine(540, $line_height_start, 540, $line_height_start - $head_row_height)->drawText('Total', 68, $line_height_start - $textline_height)->drawText($total_copies, 330 - $copies_num_pad, $line_height_start - $textline_height)->drawText($total_Ex_GST, 425 - $ex_gst_num_pad, $line_height_start - $textline_height)->drawText($total_Inc_GST, 515 - $inc_gst_num_pad, $line_height_start - $textline_height);
             // Table Headers
             $line_height_start = $line_height_start - $head_row_height;
             $footer_added = 1;
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
             $style->setFont($font, 10);
             $page->setStyle($style);
             $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../sites/MOP/htdocs/images/logo.jpg');
             $page->drawImage($image, 65, 40, 250, 80);
             $page->drawText('PO Box 140, Strawberry Hills NSW 2012', 68, 30);
             $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../sites/MOS/htdocs/images/logo.jpg');
             $page->drawImage($image, 400, 40, 550, 80);
         }
         if ($i == $page_break_row) {
             if ($footer_added == 0) {
                 $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../sites/MOP/htdocs/images/logo.jpg');
                 $page->drawImage($image, 65, 40, 250, 80);
                 $page->drawText('PO Box 140, Strawberry Hills NSW 2012', 68, 30);
                 $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../sites/MOS/htdocs/images/logo.jpg');
                 $page->drawImage($image, 400, 40, 550, 80);
                 $page_count++;
                 $pdf->pages[$page_count] = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 $page = $pdf->pages[$page_count];
                 $style = new Zend_Pdf_Style();
                 $style->setLineColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
                 $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
                 $style->setFont($font, 10);
                 $page->setStyle($style);
                 $line_height_start = $page_height - 80;
             }
             $page_break_row = 30;
             $i = 1;
         } else {
             $i++;
         }
         $j++;
     }
     if ($footer_added == 0) {
         $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../sites/MOP/htdocs/images/logo.jpg');
         $page->drawImage($image, 65, 40, 250, 80);
         $page->drawText('PO Box 140, Strawberry Hills NSW 2012', 68, 30);
         $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../sites/MOS/htdocs/images/logo.jpg');
         $page->drawImage($image, 400, 40, 550, 80);
     }
     if ($total_data_row > 0) {
         $pdf->save(APPLICATION_PATH . '/../tmp/remittance_invoice/' . $invoice_number . '.pdf');
     } else {
         return false;
     }
 }
$intY -= 15.2;
$intXArray = array(20, 80, 150, 210, 260, 312, 398, 498);
$objPage->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
$objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
$objPage->drawRectangle($intXArray[0] - 6, $intY, $intXArray[7] + 90, $intY - 10);
$intY -= 7.5;
$objPage->setFillColor(new Zend_Pdf_Color_GrayScale(1));
$objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
$objPage->drawText("Month", $intXArray[0], $intY, 'UTF-8');
$objPage->drawText("Average Gift Size", $intXArray[1], $intY, 'UTF-8');
$objPage->drawText("Total", $intXArray[2], $intY, 'UTF-8');
$objPage->drawText("# Gifts", $intXArray[3], $intY, 'UTF-8');
$objPage->drawText("# Givers", $intXArray[4], $intY, 'UTF-8');
$objPage->drawText("New Givers", $intXArray[5], $intY, 'UTF-8');
$objPage->drawText("# Gifts Over \$1000", $intXArray[6], $intY, 'UTF-8');
$objPage->drawText("# Gifts Over \$10000", $intXArray[7], $intY, 'UTF-8');
$objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0));
$objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
for ($i = 0; $i < 12; $i++) {
    $intY -= 12;
    $objPage->drawText($objDataGridArray[$i][0], $intXArray[0], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][6], $intXArray[1], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][1], $intXArray[2], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][2], $intXArray[3], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][7], $intXArray[4], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][5], $intXArray[5], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][3], $intXArray[6], $intY, 'UTF-8');
    $objPage->drawText($objDataGridArray[$i][4], $intXArray[7], $intY, 'UTF-8');
}
$objStatisticPdf->save(STATISTICS_PDF_PATH . '/StatisticsFor' . $intYear . '.pdf');
chmod(STATISTICS_PDF_PATH . '/StatisticsFor' . $intYear . '.pdf', 0777);
Example #23
0
 public function pdftransactionAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     $fromDate = $this->_request->getParam('date');
     $branchid = $this->_request->getParam('office');
     $this->view->field1 = $fromDate;
     $this->view->branchid = $branchid;
     //         $fromDate = $this->_request->getParam('field1');
     //         $this->view->field1 = $fromDate;
     //date format instance
     $dateconvertor = new App_Model_dateConvertor();
     $cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
     $page->drawText("Cash Scroll", 270, 780);
     $page->drawText("Cash Scroll", 270, 780);
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $y1 = 745;
     $page->drawText("Credit", 50, $y1);
     $page->drawText("Debit", 310, $y1);
     $y1 = 745;
     $y2 = 740;
     $page->drawText("As of From " . $fromDate, 465, $y1);
     //For Top Header
     $text = array("", "SL No.", "Particulars", "Amount", "Total", "Particulars", "Opening Cash", "Closing Cash");
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d-m-Y'), 500, 800);
     //date('Y-m-d')
     //         $page->drawText("Date : ".date('d-m-Y'),500, 800);
     $page->drawText($text[0], 240, 780);
     $page->drawText($text[0], 240, 780);
     $x1 = 60;
     $x2 = 120;
     $x3 = 310;
     $x4 = 315;
     $x5 = 390;
     $x6 = 570;
     $page->drawLine(50, 740, 550, 740);
     $page->drawLine(50, 720, 550, 720);
     $page->drawText($text[1], $x1, 725);
     $page->drawText($text[2], $x2, 725);
     $page->drawText($text[3], 250, 725);
     $page->drawText($text[1], $x4, 725);
     $page->drawText($text[5], $x5, 725);
     $page->drawText($text[3], 510, 725);
     $y1 = 710;
     $y2 = 710;
     $transaction = new Cashscroll_Model_Cashscroll();
     $this->view->savings = 10;
     $this->view->savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $this->view->savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     //Credit and Debit
     $savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     // Opening Cash
     $openingBalance = 0;
     $osc = $transaction->openingBalance($cfromDate, $branchid);
     foreach ($osc as $osc1) {
         $openingBalance = $osc1->openingBalance;
     }
     $this->view->openingBalance = $openingBalance;
     $amountCredit = "0";
     $amountDebit = "0";
     $i = 0;
     $j = 0;
     foreach ($savingsCredit as $savingsCredit) {
         $i++;
         $page->drawText($i, $x1, $y1);
         $page->drawText($savingsCredit->account_number, $x2, $y1);
         //             $page->drawText($savingsCredit->amount_to_bank,$x3, $y1);
         $pos = position(sprintf("%4.2f", $savingsCredit->amount_to_bank), $x3);
         $page->drawText(sprintf("%4.2f", $savingsCredit->amount_to_bank), $pos + 2, $y1);
         $amountCredit = $amountCredit + $savingsCredit->amount_to_bank;
         $y1 = $y1 - 15;
     }
     foreach ($savingsDebit as $savingsDebit) {
         $j++;
         $page->drawText($j, $x4, $y2);
         $page->drawText($savingsDebit->account_number, $x5, $y2);
         //             $page->drawText($savingsDebit->amount_from_bank,$x6, $y2);
         $pos = position(sprintf("%4.2f", $savingsDebit->amount_from_bank), $x6);
         $page->drawText(sprintf("%4.2f", $savingsDebit->amount_from_bank), $pos + 2, $y2);
         $amountDebit = $amountDebit + $savingsDebit->amount_from_bank;
         $y2 = $y2 - 15;
     }
     $page->drawLine(50, $y1, 550, $y1);
     //opening balnce
     $page->drawText($text[6], $x1, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", $openingBalance), $x3, $y1 -10);
     $pos = position(sprintf("%4.2f", $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $openingBalance), $pos + 2, $y1 - 10);
     //closing Balance
     $page->drawText($text[7], $x4, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", ( $sum = ($amountCredit + $openingBalance) - $amountDebit)), $x6, $y1 -10);
     $pos = position(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $x6);
     $page->drawText(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $pos + 2, $y1 - 10);
     $page->drawLine(50, $y1 = $y1 - 20, 550, $y1);
     $page->drawLine(50, $y1 - 20, 550, $y1 - 20);
     $page->drawText($text[4], $x1, $y1 - 15);
     $page->drawText($text[4], $x1, $y1 - 15);
     $pos = position(sprintf("%4.2f", $amountCredit + $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $amountCredit + $openingBalance), $pos + 2, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     $page->drawText($text[4], $x4, $y1 - 15);
     $page->drawText($text[4], $x4, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     $pos = position(sprintf("%4.2f", $amountDebit + $sum), $x6);
     $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $pos + 2, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1 - 20, 50, 740);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 740);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(550, $y1 - 20, 550, 740);
     //table rigth vertical
     //$page->drawText("ಭಾವನಾ. ಕೆ. ಎಸ್ ",$x6 + 30, $y1 -15, 'UTF-8');
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/cashscroll.pdf');
     $path = '/var/www/' . $projname . '/reports/cashscroll.pdf';
     chmod($path, 0777);
 }
Example #24
0
 public function xmlAction()
 {
     //AÇÃO PARA GERAR PDF do XML
     $lote_obj = new Application_Model_DbTable_Lote();
     $beneficiario = new Application_Model_DbTable_Beneficiario();
     //RECEBE O ID DO LOTE
     $request = $this->getRequest();
     $lote = $request->getParam('lote');
     $contrato = $request->getParam('contrato');
     $select = $beneficiario->select();
     $select->where('lote = ? ', $lote);
     $tab_beneficiario = $beneficiario->fetchall($select);
     //COMEÇO A MONTAR O MALDITO PDF
     $loader = Zend_Loader_Autoloader::getInstance();
     try {
         //cria pdf
         $pdf = new Zend_Pdf();
         //cria formato A4
         $n = 0;
         $page[$n] = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
         //Define a fonte
         $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
         //buscando imagem
         $imagem = Zend_Pdf_Image::imageWithPath('imagens/pequeno.png');
         //Colocando imagem no PDF
         $page[$n]->drawImage($imagem, 20, 750, $imagem->getPixelWidth() + 20, 750 + $imagem->getPixelHeight());
         //escreve na página
         $page[$n]->setFont($font, 10)->drawText('Relatorios XML ', 160, 730)->setFont($font, 12)->drawText('Contrato: ' . $contrato, 90, 690)->drawText('Empresa: ', 90, 670)->drawText('Numero do lote: ' . $lote, 90, 650)->setFont($font, 11)->drawText('Data: ' . date("d/m/Y"), 90, 630)->drawText('Beneficiarios: ', 90, 600)->setFont($font, 8);
         //CRIANDO LAÇO
         $altura = 585;
         foreach ($tab_beneficiario as $key => $row) {
             if ($altura < 80) {
                 $altura = 780;
                 $n = $n + 1;
                 $page[$n] = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page[$n];
             }
             $page[$n]->setFont($font, 8)->drawText('Nome: ' . $row['Nome'], 90, $altura -= 10)->drawText('CPF: ' . $row['Cnp'], 90, $altura -= 10)->drawText('  ', 90, $altura -= 10);
         }
         $page[$n]->setFont($font, 8)->drawText('Unimed Santos - Av. Dona Ana Costa, 211 - Encruzilhada - Santos - SP', 150, 20)->drawText('Cep: 11.060-001 - Tels.: (13) 2102-8100 / 8300 ', 150, 10);
         //adiciona página ao documento
         //$pdf->pages[] = $page;
         $diretorio = "pdfxml/" . $contrato . "/";
         if (@opendir($diretorio) == false) {
             mkdir($diretorio, 0777);
         }
         //salva PDF
         $pdf->save($diretorio . $lote . '.pdf');
         //Por fim, setamos a header como um PDF, e renderizamos o nosso $pdf;
         header('Content-type: application/pdf');
         echo $pdf->render();
         //$this->_redirect('/xml');
     } catch (Zend_Pdf_Exception $e) {
         die('PDF error: ' . $e->getMessage());
     } catch (Exception $e) {
         die('Application error: ' . $e->getMessage());
     }
     echo $lote;
     exit;
 }
Example #25
0
      ->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))
      ->drawEllipse(190, 50, 340, 0, M_PI/6, 2*M_PI/3)
      ->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))
      ->drawEllipse(190, 50, 340, 0, -M_PI/6, M_PI/6);

// Draw and fill polygon
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
$x = array();
$y = array();
for ($count = 0; $count < 8; $count++) {
    $x[] = 80 + 25*cos(3*M_PI_4*$count);
    $y[] = 25 + 25*sin(3*M_PI_4*$count);
}
$page2->drawPolygon($x, $y,
                    Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE,
                    Zend_Pdf_Page::FILL_METHOD_EVEN_ODD);

// Draw line
$page2->setLineWidth(0.5)
      ->drawLine(0, 25, 340, 25);

$page2->restoreGS();

//------------------------------------------------------------------------------------

if (isset($argv[2])) {
    $pdf->save($argv[2]);
} else {
    $pdf->save($argv[1], true /* update */);
}
Example #26
0
 public function pdfdisplayAction()
 {
     $shgForm = $this->view->form = new Loanprocess_Form_shgadvances();
     //         if ($this->_request->isPost() && $this->_request->getPost('PDF')) {
     // echo
     $gattendance = $this->_request->getParam('gattendance');
     $gsaving = $this->_request->getParam('gsaving');
     $gmeetdiscipline = $this->_request->getParam('gmeetdiscipline');
     $gparticipation = $this->_request->getParam('gparticipation');
     $gweeklymeet = $this->_request->getParam('gweeklymeet');
     $gchangememb = $this->_request->getParam('gchangememb');
     $gpreparation = $this->_request->getParam('gpreparation');
     $gsigningmemb = $this->_request->getParam('gsigningmemb');
     $ggroupcooperation = $this->_request->getParam('ggroupcooperation');
     $ggroupsustaiable = $this->_request->getParam('ggroupsustaiable');
     $bsavingattend = $this->_request->getParam('bsavingattend');
     $bloandisburse = $this->_request->getParam('bloandisburse');
     $bdiscussion = $this->_request->getParam('bdiscussion');
     $bincomeandexpend = $this->_request->getParam('bincomeandexpend');
     $bindividualsave = $this->_request->getParam('bindividualsave');
     $bindividualloan = $this->_request->getParam('bindividualloan');
     $bgeneralacc = $this->_request->getParam('bgeneralacc');
     $ploanholder = $this->_request->getParam('ploanholder');
     $pusageofsaving = $this->_request->getParam('pusageofsaving');
     $ploanrepayment = $this->_request->getParam('ploanrepayment');
     $pminimumrepay = $this->_request->getParam('pminimumrepay');
     $fparticipation = $this->_request->getParam('fparticipation');
     $ffarmerschool = $this->_request->getParam('ffarmerschool');
     $fweeklyplan = $this->_request->getParam('fweeklyplan');
     $fschoollearning = $this->_request->getParam('fschoollearning');
     // }
     //         $totalmarks = $this->_request->getParam('totalmarks');
     //         $marks = $this->_request->getParam('marks');
     //         $percentage = $this->_request->getParam('percentage');
     //         $grade = $this->_request->getParam('grade');
     //         $observe = $this->_request->getParam('observe');
     $groupid = $this->_request->getParam('groupid');
     $this->view->groupid = $groupid;
     $groupdetails = $this->view->accounts->getgroupName($groupid);
     // Fetch group and village name
     foreach ($groupdetails as $group) {
         $this->view->groupname = $groupname = $group['groupname'];
         $this->view->villagename = $villagename = $group['villagename'];
         $groupcode = $group['groupcode'];
     }
     $grouptype = substr($groupcode, 4, 1);
     $Attendancedetails = $this->view->accounts->getAttendance($groupid);
     //Fetch Absentees list
     foreach ($Attendancedetails as $attendance) {
         $absentees = $attendance['Absentees'];
     }
     $Countmeetings = $this->view->accounts->Countmeetings($groupid);
     //Fetch number of meetings
     foreach ($Countmeetings as $meetings) {
         $numberofmeetings = $meetings['Numberofmeetings'];
     }
     $Countgroupmembers = $this->view->accounts->Countgroupmembers($groupid);
     //Fetch number of members in that group
     foreach ($Countgroupmembers as $groupcount) {
         $totalmembers = $groupcount['Totalmembers'];
     }
     // Attendance percentage calculation
     $Origmeetingstr = $numberofmeetings * $totalmembers;
     $present = $Origmeetingstr - $absentees;
     if ($present > 0) {
         $AttendPercent = $present * 100 / $Origmeetingstr;
         $shgForm->gattendance->setValue(round($AttendPercent, 2));
     }
     if ($present < 0) {
         $shgForm->gattendance->setValue(0);
     }
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     //         //Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //         $page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->drawText("Date : " . date('d-m-Y'), 500, 800);
     //date('Y-m-d')
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $serial = range(1, 10);
     $header = array("SUJEEVANA PROGRAMME", "SHG/JLG QUALITY EVALUATION", "SHG/JLG Group :", "Village :", "Farmer's group :", "Village facilitator", "Area officer", "Date :", "S.No", "Quality indicators", "Maximum marks", "Scored marks");
     $first = array("Group meeting & other information", "Attendance(<50%=0)", "Savings(<50%=0)", "Meeting discipline ?", "Participation of members in discussion ?", "Weekly meeting limit(<80%=0)", "Change of membership(<50%=0)", "Preparation of workplan for the meeting", "Number of signing members", "Group members co operation", "Group sustainability training");
     $second = array("Book Keeping", "Savings-attendance sheet", "Loan disbursement", "Discussion and decisions", "Weekly Income - Expenditure details", "Individual saving account", "Individual loan account", "General account");
     $third = array("Previous loan information", "Loan holders percentage(<50%=0)", "Usage of savings/loans for income generating activities", "Loan repayment percentage(<50%=0)", "Minimum repayment");
     $four = array("Farmers school & information", "Participation(<70%=0)", "Farmer school", "Weekly plan", "School learnings followup percentage(<50%=0)", "Total marks");
     $marks = array("20", "30", "50", "100", "150", "250", "350", "1000");
     $hash = "#";
     $percentage = array("Currently applicable total marks", "Scored marks", "Total marks", "Percentage of marks (%)", "Grade", "Observed - good points", "Observed - need changes in", "Evaluator name & signature");
     $gradepercent = array("> 80%", "70 - 80%", "60 - 70%", "< 60%");
     $grade = array("A", "B", "C", "D");
     $x0 = 190;
     $x1 = 55;
     $x2 = 90;
     $x3 = 310;
     $x4 = 465;
     $y1 = 680;
     // Page heading
     $page->drawText($header[0], $x0, 760);
     $page->drawText($header[1], $x0, 750);
     // Left side titles
     $page->drawText($header[2], 30, 730);
     $page->drawText($groupname, 110, 730);
     // Print group name
     $page->drawText($groupname, 110, 730);
     // Print group name
     $page->drawText($header[3], 30, 720);
     $page->drawText($villagename, 110, 720);
     // Print village name
     $page->drawText($villagename, 110, 720);
     // Print village name
     $page->drawText($header[4], 30, 710);
     // Right side titles
     $page->drawText($header[5], 500, 730);
     $page->drawText($header[6], 500, 720);
     $page->drawText($header[7], 500, 710);
     $page->drawText(date('d/m/Y'), 525, 710);
     // Print the date
     $page->drawText(date('d/m/Y'), 525, 710);
     // Print the date
     // Draw table border
     $page->drawLine(50, 700, 550, 700);
     $page->drawLine(50, 680, 550, 680);
     // Table header's
     $page->drawText($header[8], $x1, 690);
     $page->drawText($header[9], $x2, 690);
     $page->drawText($header[10], $x3, 690);
     $page->drawText($header[11], $x4, 690);
     // Display the First part of table
     $y1 = $y1 - 10;
     $page->drawText($hash, $x1, $y1);
     $page->drawText($hash, $x1, $y1);
     $page->drawText($first[0], $x2, $y1);
     $page->drawText($first[0], $x2, $y1);
     $page->drawText($marks[6], $x3, $y1);
     $page->drawText($marks[6], $x3, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[0], $x1, $y1);
     $page->drawText($first[1], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     $page->drawText($gattendance, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[1], $x1, $y1);
     $page->drawText($first[2], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     $page->drawText($gsaving, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[2], $x1, $y1);
     $page->drawText($first[3], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     $page->drawText($gmeetdiscipline, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[3], $x1, $y1);
     $page->drawText($first[4], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     $page->drawText($gparticipation, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[4], $x1, $y1);
     $page->drawText($first[5], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     $page->drawText($gweeklymeet, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[5], $x1, $y1);
     $page->drawText($first[6], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     $page->drawText($gchangememb, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[6], $x1, $y1);
     $page->drawText($first[7], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     $page->drawText($gpreparation, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[7], $x1, $y1);
     $page->drawText($first[8], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     $page->drawText($gsigningmemb, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[8], $x1, $y1);
     $page->drawText($first[9], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     $page->drawText($gsigningmemb, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[9], $x1, $y1);
     $page->drawText($first[10], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     $page->drawText($ggroupcooperation, $x4, $y1);
     // Display the Second part of table
     $y1 = $y1 - 10;
     $page->drawText($hash, $x1, $y1);
     $page->drawText($hash, $x1, $y1);
     $page->drawText($second[0], $x2, $y1);
     $page->drawText($second[0], $x2, $y1);
     $page->drawText($marks[5], $x3, $y1);
     $page->drawText($marks[5], $x3, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[0], $x1, $y1);
     $page->drawText($second[1], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($bsavingattend, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[1], $x1, $y1);
     $page->drawText($second[2], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     //         $page->drawText($bloandisburse, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[2], $x1, $y1);
     $page->drawText($second[3], $x2, $y1);
     $page->drawText($marks[1], $x3, $y1);
     //         $page->drawText($bdiscussion, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[3], $x1, $y1);
     $page->drawText($second[4], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($bincomeandexpend, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[4], $x1, $y1);
     $page->drawText($second[5], $x2, $y1);
     $page->drawText($marks[1], $x3, $y1);
     //         $page->drawText($bindividualsave, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[5], $x1, $y1);
     $page->drawText($second[6], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     //         $page->drawText($bindividualloan, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[6], $x1, $y1);
     $page->drawText($second[7], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($bgeneralacc, $x4, $y1);
     // Display the Third part of table
     $y1 = $y1 - 10;
     $page->drawText($hash, $x1, $y1);
     $page->drawText($hash, $x1, $y1);
     $page->drawText($third[0], $x2, $y1);
     $page->drawText($third[0], $x2, $y1);
     $page->drawText($marks[5], $x3, $y1);
     $page->drawText($marks[5], $x3, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[0], $x1, $y1);
     $page->drawText($third[1], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($ploanholder, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[1], $x1, $y1);
     $page->drawText($third[2], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($pusageofsaving, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[2], $x1, $y1);
     $page->drawText($third[3], $x2, $y1);
     $page->drawText($marks[3], $x3, $y1);
     //         $page->drawText($ploanrepayment, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[3], $x1, $y1);
     $page->drawText($third[4], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($pminimumrepay, $x4, $y1);
     // Display the Fourth part of table
     $y1 = $y1 - 10;
     $page->drawText($hash, $x1, $y1);
     $page->drawText($hash, $x1, $y1);
     $page->drawText($four[0], $x2, $y1);
     $page->drawText($four[0], $x2, $y1);
     $page->drawText($marks[4], $x3, $y1);
     $page->drawText($marks[4], $x3, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[0], $x1, $y1);
     $page->drawText($four[1], $x2, $y1);
     $page->drawText($marks[1], $x3, $y1);
     //         $page->drawText($fparticipation, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[1], $x1, $y1);
     $page->drawText($four[2], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //          $page->drawText($ffarmerschool, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[2], $x1, $y1);
     $page->drawText($four[3], $x2, $y1);
     $page->drawText($marks[0], $x3, $y1);
     //          $page->drawText($fweeklyplan, $x4, $y1);
     $y1 = $y1 - 10;
     $page->drawText($serial[3], $x1, $y1);
     $page->drawText($four[4], $x2, $y1);
     $page->drawText($marks[2], $x3, $y1);
     //         $page->drawText($fschoollearning, $x4, $y1);
     // Total
     $y1 = $y1 - 10;
     $page->drawText($hash, $x1, $y1);
     $page->drawText($hash, $x1, $y1);
     $page->drawText($four[5], $x2, $y1);
     $page->drawText($four[5], $x2, $y1);
     $page->drawText($marks[7], $x3, $y1);
     $page->drawText($marks[7], $x3, $y1);
     //         $page->drawText($totalmarks, $x4, $y1);
     $page->drawLine(50, $y1 - 5, 50, 700);
     $page->drawLine(80, $y1 - 5, 80, 700);
     $page->drawLine($x3 - 10, $y1 - 5, $x3 - 10, 700);
     $page->drawLine($x4 - 30, $y1 - 5, $x4 - 30, 700);
     $page->drawLine(550, $y1 - 5, 550, 700);
     $page->drawLine(50, $y1 - 5, 550, $y1 - 5);
     // Display percentage calculation
     // Total
     $y1 = $y1 - 15;
     $page->drawText($percentage[0], $x1, $y1);
     //         $page->drawText($marks, $x2+100, $y1);
     $page->drawText($gradepercent[0], $x3, $y1);
     $page->drawText($grade[0], $x3 + 100, $y1);
     $y1 = $y1 - 10;
     $page->drawText($percentage[1], $x1, $y1);
     //         $page->drawText($totalmarks, $x2+100, $y1);
     $page->drawText($gradepercent[1], $x3, $y1);
     $page->drawText($grade[1], $x3 + 100, $y1);
     $y1 = $y1 - 10;
     $page->drawText($percentage[3], $x1, $y1);
     //         $page->drawText($percentage, $x2+100, $y1);
     $page->drawText($gradepercent[2], $x3, $y1);
     $page->drawText($grade[2], $x3 + 100, $y1);
     $y1 = $y1 - 10;
     $page->drawText($percentage[4], $x1, $y1);
     //         $page->drawText($grade, $x2+100, $y1);
     $page->drawText($gradepercent[3], $x3, $y1);
     $page->drawText($grade[3], $x3 + 100, $y1);
     $y1 = $y1 - 40;
     $page->drawText($percentage[5], $x1, $y1);
     //         $page->drawText($observe, $x2+100, $y1);
     $y1 = $y1 - 80;
     $page->drawText($percentage[6], $x1 - 10, $y1);
     $page->drawText($percentage[7], $x4 - 20, $y1);
     //
     //         $y1 = $y1-15;
     //         $page->drawLine(50, $y1, 550, $y1);
     //         $page->drawLine(50, $y1-20, 550, $y1-20);
     //
     //         $page->drawText($secondtable[0], $x1, $y1-10);
     //         $page->drawText($secondtable[1], $x5, $y1-10);
     //         $page->drawText($secondtable[2], $x3, $y1-10);
     //         $y1 = $y1-30;
     //         $j=1;
     //         foreach($groupmembers as $groupmem){
     //             $page->drawText($j, $x1, $y1);
     //             $page->drawText($groupmem['membername'], $x5, $y1);
     //             $page->drawLine(50, $y1-5, 550, $y1-5);
     //         }
     //         $y1 = $y1-20;
     //         $Totalvalue = $secondtable[3].$j;
     //         $page->drawText($Totalvalue, $x5, $y1);
     //         $page->drawLine(50, $y1-5, 550, $y1-5);
     //
     //         $y3 = $y1 + 45 + ($j*5);
     //   // Virtual table
     //         $page->setLineWidth(1)->drawLine(50,$y1-5,50,$y3); //Table left vertical
     //         $page->setLineWidth(1)->drawLine($x1+25,$y1-5,$x1+25,$y3); //Table second left vertical
     // //         $page->setLineWidth(1)->drawLine($x5-5,$y1-5,$x5-5,$y3); //Table center vertical
     //         $page->setLineWidth(1)->drawLine($x3-35,$y1-5,$x3-35,$y3); //Table second center vertical
     //         $page->setLineWidth(1)->drawLine(550,$y1-5 ,550,$y3); //table rigth vertical
     //
     //         $y1 = $y1-35;
     //         $page->drawText($secondtable[4], $x1+25, $y1);
     //         $page->drawText($secondtable[5], $x2-25, $y1);
     //         $page->drawText($secondtable[6], $x3-25, $y1);
     $pdf->save('/var/www/' . $projname . '/reports/shgadvances.pdf');
     $path = '/var/www/' . $projname . '/reports/shgadvances.pdf';
     chmod($path, 0777);
 }
Example #27
0
 function pdftransactionAction()
 {
     $fromdate = $this->_request->getParam('fdate');
     $dateconvertor = new App_Model_dateConvertor();
     $Date = $dateconvertor->mysqlformat($fromdate);
     $this->view->fdate = $Date;
     $asofDate = $dateconvertor->normalformat($fromdate);
     $this->view->asofdate = $asofDate;
     $incomeexpenditure = new Incomeexpenditure_Model_Incomeexpenditure();
     $this->view->income = $income = $incomeexpenditure->incomedetails($Date);
     $this->view->expenditure = $expenditure = $incomeexpenditure->expendituredetails($Date);
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 20, 780, 120, 830);
     $page->setLineWidth(1)->drawLine(20, 20, 580, 20);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(20, 20, 20, 830);
     //left vertical
     $page->setLineWidth(1)->drawLine(580, 25, 580, 830);
     //right vertical
     $page->setLineWidth(1)->drawLine(20, 830, 580, 830);
     //top horizontal
     $x1 = 45;
     $x2 = 250;
     $x3 = 330;
     $x4 = 500;
     $my = 735;
     $y1 = 710;
     $y2 = 710;
     $totalincome = 0;
     $totalexpe = 0;
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array($this->view->translate('Income and Expenditure'), $this->view->translate('Income'), $this->view->translate('Amount'), $this->view->translate('Expenditure'), $this->view->translate('Amount'), $this->view->translate('Grand total'));
     $criteria = $this->view->translate('As of') . " " . $asofDate;
     $currency = "* " . $this->view->translate('Amount in Rs');
     // // // file:///var/www/IDF/application/modules/incomeexpenditure/controllers/IndexController.php
     /*$page->drawText("Date : ".date('d/m/Y'),500, 800); //date('Y-m-d')
       $page->drawText("Date : ".date('d/m/Y'),500, 800);*/
     $page->drawText($text[0], 185, 780);
     $page->drawText($text[0], 185, 780);
     $page->drawText($criteria, 500, 780);
     //Search criteria
     $page->drawText($criteria, 500, 780);
     $page->drawText($currency, 500, 770);
     //Currency
     $page->drawText($currency, 500, 770);
     $page->drawText($text[1], $x1, $my);
     $page->drawText($text[2], $x2, $my);
     $page->drawText($text[3], $x3, $my);
     $page->drawText($text[4], $x4, $my);
     $page->drawLine(30, 750, 570, 750);
     $page->drawLine(30, 730, 570, 730);
     foreach ($income as $income) {
         $page->drawText($income['header'], $x1, $y1);
         $page->drawText($income['credit'], $x2, $y1);
         $totalincome += $income['credit'];
         $y1 = $y1 - 15;
     }
     foreach ($expenditure as $expe) {
         $page->drawText($expe['header'], $x3, $y2);
         $page->drawText($expe['credit'], $x4, $y2);
         $totalexpe += $expe['credit'];
         $y2 = $y2 - 15;
     }
     $page->drawLine(30, $y1, 570, $y1);
     $page->drawLine(30, $y1 - 20, 570, $y1 - 20);
     $page->drawText($text[5], $x1, $y1 - 15);
     $page->drawText(sprintf("%4.2f", $totalincome), $x2, $y1 - 15);
     $page->drawText($text[5], $x3, $y1 - 15);
     $page->drawText(sprintf("%4.2f", $totalexpe), $x4, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 750);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
     //table rigth vertical
     $pdfData = $pdf->render();
     $account_number = $Date;
     // 		$pdf->save('/var/www/ourbank/reports/incomeexpenditure.pdf');
     //$path = '/var/www/ourbank/reports/incomeexpenditure.pdf';
     $pdf->save('/var/www/' . $projname . '/reports/' . $account_number . 'incomeexpenditure.pdf');
     $path = '/var/www/' . $projname . '/reports/' . $account_number . 'incomeexpenditure.pdf';
     chmod($path, 0777);
 }
Example #28
0
 function pdfgenerationAction()
 {
     //$fetchMeetings=new Meetingreport_Model_Meetingreport();
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // 		 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $image_name = "/var/www" . $app . "/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array("Group name:", "", "Date:", "group code:", "purpose:", "Bank:", "S.no", "Member name", "Survey no", "Loan request amount", "Signature", "Address:");
     $page->drawText($text[0], 60, 725);
     $page->drawText($text[1], 60, 675);
     $page->drawText($text[2], 430, 725);
     $page->drawText($text[3], 410, 710);
     $page->drawText($text[4], 60, 660);
     $page->drawText($text[5], 60, 645);
     $page->drawText($text[6], 74, 625);
     $page->drawText($text[7], 140, 625);
     $page->drawText($text[8], 230, 625);
     $page->drawText($text[9], 330, 625);
     $page->drawText($text[10], 455, 625);
     $page->drawText($text[11], 60, 710);
     $page->setLineWidth(1)->drawLine(70, 640, 500, 640);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(70, 620, 500, 620);
     //bottom horizontal
     $id = $this->_getParam('membercode');
     $groupcommon = new Groupresolution_Model_Groupresolution();
     $group_name = $groupcommon->getgroup($id);
     // get group details
     $getgroupaccount = $groupcommon->getgroupaccount($id);
     // get group details
     $group_location = $groupcommon->getlocation($id);
     // get group Location details - Latitude and longitude
     foreach ($group_location as $location) {
         $this->view->latitude = $location['latitude'];
         $this->view->longitude = $location['longitude'];
     }
     $this->view->getgroupaccount = $getgroupaccount;
     $group_members = $groupcommon->getgroupmembers($id);
     // get group members
     $this->view->groupmembers = $group_members;
     $i = 1;
     foreach ($group_name as $memberdetail) {
         $page->drawText($memberdetail['groupname'], 120, 725);
         $page->drawText($memberdetail['address1'], 120, 710);
         $page->drawText($memberdetail['address2'], 120, 700);
         $page->drawText($memberdetail['address3'], 120, 690);
     }
     $x1 = 140;
     $y1 = 610;
     $x2 = 230;
     $x3 = 330;
     foreach ($group_members as $membergroup) {
         $page->drawText($membergroup['purposename'], 120, 660);
         $page->drawText($membergroup['bank'], 120, 645);
         $page->drawText(date('d-m-Y'), 450, 725);
         $page->drawText($membergroup['groupcode'], 452, 710);
         $page->drawText($membergroup['membername'], $x1, $y1);
         $page->drawText($membergroup['survey_no'], $x2, $y1);
         $page->drawText($membergroup['request_amount'], $x3, $y1);
         $page->setLineWidth(1)->drawLine(70, 640, 70, 500);
         $page->setLineWidth(1)->drawLine(70, 500, 500, 500);
         //bottom horizontal
         $page->setLineWidth(1)->drawLine(500, 640, 500, 500);
         //bottom horizontal
         $page->setLineWidth(1)->drawLine(100, 640, 100, 500);
         $page->setLineWidth(1)->drawLine(210, 640, 210, 500);
         $page->setLineWidth(1)->drawLine(300, 640, 300, 500);
         $page->setLineWidth(1)->drawLine(450, 640, 450, 500);
         $y1 = $y1 - 15;
     }
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/groupresolution' . date('Y-m-d') . '.pdf');
     $path = '/var/www' . $projname . '/reports/groupresolution' . date('Y-m-d') . '.pdf';
     chmod($path, 0777);
 }
Example #29
0
 function pdfdisplayAction()
 {
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     // 		$page->setLineWidth(1)->drawLine(25, 640, 25, 500);
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizonta
     // define font resource
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $x1 = 72;
     $x2 = 410;
     $y1 = 690;
     $Declaration = new Declaration_Model_Dec();
     $code = $this->_request->getParam('groupcode');
     $this->view->result = $this->view->loan->groupDeatils($code);
     $this->view->groupmembers = $this->view->loan->getgroupmembers($code);
     $dateconvert = new App_Model_dateConvertor();
     foreach ($this->view->result as $result) {
         //    // write text to page
         $page->setFont($font, 12)->drawText('Group bye law', 240, 720);
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate   ' . $result['dayname'] . 'The vision of Ourbank is to stimulate ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to    ' . $result['place'] . '  stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate  ' . $result['saving_perweek'] . '  pment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimu  ' . $result['rateinterest'] . '  velopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stim  ' . $result['penalty_latecoming'] . '  evelopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stim   ' . $result['penalty_notcoming'] . '  velopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to st   ' . $result['group_created_date'] . '   elopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimu    ' . $result['name'] . '    elopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('Member name', 72, $y1);
         $page->setFont($font, 9)->drawText('UID', 160, $y1);
         $page->setFont($font, 9)->drawText('Father name', 200, $y1);
         $page->setFont($font, 9)->drawText('Nominee', 280, $y1);
         $page->setFont($font, 9)->drawText('Nominee relationship', 350, $y1);
         $page->setFont($font, 9)->drawText('Signature', 460, $y1);
         $y1 = $y1 - 10;
         $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
         foreach ($this->view->groupmembers as $member) {
             $y1 = $y1 - 15;
             $page->setFont($font, 9)->drawText('' . $member['membername'] . '', 72, $y1);
             $page->setFont($font, 9)->drawText('' . $member['uid'] . '', 140, $y1);
             $page->setFont($font, 9)->drawText('' . $member['family_id'] . '', 200, $y1);
             $y1 = $y1 - 10;
             $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
         }
     }
     $pdf->pages[] = $page;
     $pdfData = $pdf->render();
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/grouplaw.pdf');
     $path = '/var/www/' . $projname . '/reports/grouplaw.pdf';
     chmod($path, 0777);
     //                 $this->_redirect('/declaration/index');
 }
Example #30
0
<?php

header('Content-Type: application/x-pdf');
header("Content-Disposition: attachment;filename=invoice.pdf");
header("Cache-Control: no-cache, must-revalidate");
$path = dirname(dirname(__FILE__)) . '/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once "Zend/Pdf.php";
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER);
$pdf->pages[] = $page;
$pdf->pages[] = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
$page->setFont($font, 12);
$page->drawText('wewe', 110, 641);
//echo $page->getHeight();
//echo $page->getWidth();
$pdf->save("report2.pdf");
header('Location: report2.pdf');