public function getPdf($creditmemos = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('creditmemo');
     $pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $this->_setFontBold($style, 10);
     foreach ($creditmemos as $creditmemo) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         $order = $creditmemo->getOrder();
         /* Add image */
         $this->insertLogo($page, $creditmemo->getStore());
         /* Add address */
         $this->insertAddress($page, $creditmemo->getStore());
         /* Add head */
         $this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_CREDITMEMO_PUT_ORDER_ID, $order->getStoreId()));
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $this->_setFontRegular($page);
         $page->drawText(Mage::helper('sales')->__('Credit Memo # ') . $creditmemo->getIncrementId(), 35, 780, 'UTF-8');
         /* Add table head */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
         $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
         $page->setLineWidth(0.5);
         $page->drawRectangle(25, $this->y, 570, $this->y - 15);
         $this->y -= 10;
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
         $this->_drawHeader($page);
         $this->y -= 15;
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         /* Add body */
         foreach ($creditmemo->getAllItems() as $item) {
             if ($item->getOrderItem()->getParentItem()) {
                 continue;
             }
             $shift = array();
             if ($this->y < 20) {
                 /* Add new table head */
                 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page;
                 $this->y = 800;
                 $this->_setFontRegular($page);
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
                 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
                 $page->setLineWidth(0.5);
                 $page->drawRectangle(25, $this->y, 570, $this->y - 15);
                 $this->y -= 10;
                 $this->_drawHeader($page);
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
                 $this->y -= 20;
             }
             /* Draw item */
             $this->_drawItem($item, $page, $order);
         }
         /* Add totals */
         $this->insertTotals($page, $creditmemo);
     }
     $this->_afterGetPdf();
     return $pdf;
 }
Beispiel #2
0
 public function testProcessing()
 {
     $pdf = new Zend_Pdf();
     $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // not actually included into pages array
     $pdf->pages[] = $page1;
     $pdf->pages[] = $page2;
     $this->assertTrue(count($pdf->getNamedDestinations()) == 0);
     // require_once 'Zend/Pdf/Destination/Fit.php';
     $destination1 = Zend_Pdf_Destination_Fit::create($page1);
     $destination2 = Zend_Pdf_Destination_Fit::create($page2);
     $action1 = Zend_Pdf_Action_GoTo::create($destination1);
     $pdf->setNamedDestination('GoToPage1', $action1);
     $this->assertTrue($pdf->getNamedDestination('GoToPage1') === $action1);
     $this->assertTrue($pdf->getNamedDestination('GoToPage9') === null);
     $pdf->setNamedDestination('Page2', $destination2);
     $this->assertTrue($pdf->getNamedDestination('Page2') === $destination2);
     $this->assertTrue($pdf->getNamedDestination('Page9') === null);
     $pdf->setNamedDestination('Page1', $destination1);
     $pdf->setNamedDestination('Page1_1', Zend_Pdf_Destination_Fit::create(1));
     $pdf->setNamedDestination('Page9_1', Zend_Pdf_Destination_Fit::create(9));
     // will be egnored
     $action3 = Zend_Pdf_Action_GoTo::create(Zend_Pdf_Destination_Fit::create($page3));
     $pdf->setNamedDestination('GoToPage3', $action3);
     $this->assertTrue(strpos($pdf->render(), '[(GoToPage1) <</Type /Action /S /GoTo /D [3 0 R /Fit ] >> (Page1) [3 0 R /Fit ] (Page1_1) [1 /Fit ] (Page2) [4 0 R /Fit ] ]') !== false);
 }
Beispiel #3
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');
 }
Beispiel #4
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');
 }
Beispiel #5
0
 /**
  *
  * @return Zend_Pdf
  *
  */
 protected function createPdfTemplate()
 {
     if ($this->getDi()->config->get('invoice_custom_template') && ($upload = $this->getDi()->uploadTable->load($this->getDi()->config->get('invoice_custom_template')))) {
         $pdf = Zend_Pdf::load($upload->getFullPath());
         $this->pointer = $this->getPaperHeight() - $this->getDi()->config->get('invoice_skip', 150);
     } else {
         $pdf = new Zend_Pdf();
         $pdf->pages[0] = $pdf->newPage($this->getDi()->config->get('invoice_format', Zend_Pdf_Page::SIZE_LETTER));
         $this->pointer = $this->drawDefaultTemplate($pdf);
     }
     return $pdf;
 }
 public function __construct()
 {
     if (Config::$glsbox_label_beginx != '' && (int) Config::$glsbox_label_beginx >= 0) {
         $startpunktX = (int) Config::$glsbox_label_beginx;
     } else {
         $startpunktX = 0;
     }
     if (Config::$glsbox_label_beginy != '' && (int) Config::$glsbox_label_beginy >= 0) {
         $startpunktY = (int) Config::$glsbox_label_beginy;
     } else {
         $startpunktY = 0;
     }
     $startpunkt = array('x' => $startpunktX, 'y' => $startpunktY);
     //Angabe in Milimeter
     $this->_startpunkt = array('x' => $this->mmToPts($startpunkt['x']), 'y' => $this->mmToPts($startpunkt['y']));
     $this->pdf = new Zend_Pdf();
     // Erstelle eine neue Seite mit Hilfe des Zend_Pdf Objekts
     // (die Seite wird an das angegebene Dokument angehängt)
     if (Config::$glsbox_label_papersize != 'A4' && Config::$glsbox_label_papersize != 'A5') {
         $lettersize = Zend_Pdf_Page::SIZE_A4;
     } else {
         if (Config::$glsbox_label_papersize == 'A4') {
             $lettersize = Zend_Pdf_Page::SIZE_A4;
         }
         if (Config::$glsbox_label_papersize == 'A5') {
             $lettersize = '420.94:595.28';
         }
     }
     $this->pdf->pages[] = $this->page = $this->pdf->newPage($lettersize);
     // Erstelle einen neuen Stil
     $this->defaultStyle = new Zend_Pdf_Style();
     $this->defaultStyle->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
     $this->defaultStyle->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
     $this->defaultStyle->setLineWidth(2);
     //$fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
     //$this->defaultStyle->setFont($fontH, 32);
     $this->page->setStyle($this->defaultStyle);
     $this->drawGeneralLayout();
 }
 /**
  * Format pdf file
  *
  * @param null $shipment
  * @return Zend_Pdf
  */
 public function getPdf($shipment = null)
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('shipment');
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     if ($shipment->getStoreId()) {
         Mage::app()->getLocale()->emulate($shipment->getStoreId());
         Mage::app()->setCurrentStore($shipment->getStoreId());
     }
     $this->_setFontRegular($page);
     $this->_drawHeaderBlock($page);
     $this->y = 740;
     $this->_drawPackageBlock($page);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_afterGetPdf();
     if ($shipment->getStoreId()) {
         Mage::app()->getLocale()->revert();
     }
     return $pdf;
 }
Beispiel #8
0
 private function gerarCertificado($idEncontro, $array = array())
 {
     // include auto-loader class
     require_once 'Zend/Loader/Autoloader.php';
     // register auto-loader
     $loader = Zend_Loader_Autoloader::getInstance();
     $pdf = new Zend_Pdf();
     $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $font = Zend_Pdf_Font::fontWithPath(APPLICATION_PATH . "/../public/font/UbuntuMono-R.ttf");
     $page1->setFont($font, Sige_Pdf_Certificado::TAM_FONTE);
     // configura o plano de fundo
     $this->background($page1, $idEncontro);
     for ($index = 0; $index < count($array); $index++) {
         $page1->drawText($array[$index], Sige_Pdf_Certificado::POS_X_INICIAL, Sige_Pdf_Certificado::POS_Y_INICIAL - $index * Sige_Pdf_Certificado::DES_Y, 'UTF-8');
     }
     // configura a(s) assinatura(s)
     $this->assinaturas($page1, $idEncontro);
     $pdf->pages[] = $page1;
     // salve apenas em modo debug!
     // $pdf->save(APPLICATION_PATH . '/../tmp/certificado-participante.pdf');
     // Get PDF document as a string
     return $pdf->render();
 }
Beispiel #9
0
 public function getPdf($shipments = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('shipment');
     $pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $this->_setFontBold($style, 10);
     foreach ($shipments as $shipment) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         $order = $shipment->getOrder();
         /* Add image */
         $this->insertLogo($page, $shipment->getStore());
         /* Add address */
         $this->insertAddress($page, $shipment->getStore());
         /* Add head */
         $this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, $order->getStoreId()));
         /* Add Barcode (custom: Matt Johnson 2008-06-13)*/
         /* convertToBarcodeString resides in extended abstract.php file*/
         $barcodeString = $this->convertToBarcodeString($order->getRealOrderId());
         $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
         $page->setFont(Zend_Pdf_Font::fontWithPath(dirname(__FILE__) . '/' . 'Code128bWin.ttf'), 18);
         $page->drawText($barcodeString, 250, 800, 'CP1252');
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $this->_setFontRegular($page);
         $page->drawText(Mage::helper('sales')->__('Packingslip # ') . $shipment->getIncrementId(), 35, 780, 'UTF-8');
         /* Add table */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
         $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
         $page->setLineWidth(0.5);
         /* Add table head */
         $page->drawRectangle(25, $this->y, 570, $this->y - 15);
         $this->y -= 10;
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
         $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y, 'UTF-8');
         $this->y -= 15;
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         /* Add body */
         foreach ($shipment->getAllItems() as $item) {
             if ($item->getOrderItem()->getParentItem()) {
                 continue;
             }
             $shift = 10;
             $shift = array();
             if ($this->y < 15) {
                 /* Add new table head */
                 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page;
                 $this->y = 800;
                 $this->_setFontRegular($page);
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
                 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
                 $page->setLineWidth(0.5);
                 $page->drawRectangle(25, $this->y, 570, $this->y - 15);
                 $this->y -= 10;
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
                 $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y, 'UTF-8');
                 $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y, 'UTF-8');
                 $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y, 'UTF-8');
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
                 $this->y -= 20;
             }
             /* Draw item */
             $this->_drawItem($item, $page, $order);
         }
     }
     $this->_afterGetPdf();
     return $pdf;
 }
Beispiel #10
0
         ->setStyle($style)
         ->rotate(0, 0, M_PI_2/3);

    $page->saveGS();
    $page->clipCircle(550, -10, 50);
    if ($stampImage != null) {
        $page->drawImage($stampImage, 500, -60, 600, 40);
    }
    $page->restoreGS();

    $page->drawText('Modified by Zend Framework!', 150, 0)
         ->restoreGS();
}

// 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)
      ->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'))
      ->drawText('Helvetica 36 text string', 60, 500);

// Use font object for another page
$page2->setFont($font, 24)
      ->drawText('Helvetica 24 text string', 60, 500);
 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);
 }
Beispiel #12
0
<?php

/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$pdf = new Zend_Pdf();
$page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
// Page created, but not included into pages list
$pdf->pages[] = $page1;
$pdf->pages[] = $page2;
$destination1 = Zend_Pdf_Destination_Fit::create($page2);
$destination2 = Zend_Pdf_Destination_Fit::create($page3);
// Returns $page2 object
$page = $pdf->resolveDestination($destination1);
// Returns null, page 3 is not included into document yet
$page = $pdf->resolveDestination($destination2);
$pdf->setNamedDestination('Page2', $destination1);
$pdf->setNamedDestination('Page3', $destination2);
// Returns $destination2
$destination = $pdf->getNamedDestination('Page3');
// Returns $destination1
$pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page2'));
// Returns null, page 3 is not included into document yet
$pdf->resolveDestination(Zend_Pdf_Destination_Named::create('Page3'));
Beispiel #13
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');
 }
 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);
 }
Beispiel #15
0
 public function getPdf($shipments = array())
 {
     $pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     foreach ($shipments as $shipment) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         $order = $shipment->getOrder();
         /* Add image */
         $this->insertLogo($page);
         /* Add address */
         $this->insertAddress($page);
         /* Add head */
         $this->insertOrder($page, $order);
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
         $page->drawText(Mage::helper('sales')->__('Packingslip # ') . $shipment->getIncrementId(), 35, 780);
         /* Add table */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
         $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
         $page->setLineWidth(0.5);
         /* Add table head */
         $page->drawRectangle(25, $this->y, 570, $this->y - 15);
         $this->y -= 10;
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
         $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y);
         $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y);
         $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y);
         $this->y -= 15;
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         /* Add body */
         foreach ($shipment->getAllItems() as $item) {
             $shift = 10;
             if ($this->y < 15) {
                 /* Add new table head */
                 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page;
                 $this->y = 800;
                 $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
                 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
                 $page->setLineWidth(0.5);
                 $page->drawRectangle(25, $this->y, 570, $this->y - 15);
                 $this->y -= 10;
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
                 $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y);
                 $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y);
                 $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y);
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
                 $this->y -= 20;
             }
             /* Add products */
             $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
             $page->drawText($item->getQty() * 1, 35, $this->y);
             $page->drawText($item->getName(), 60, $this->y);
             $page->drawText($item->getName(), 60, $this->y);
             foreach (explode('</li>', $item->getDescription()) as $description) {
                 $page->drawText(strip_tags($description), 65, $this->y - $shift);
                 $shift += 10;
             }
             $page->drawText($item->getSku(), 470, $this->y);
             $this->y -= $shift;
         }
     }
     return $pdf;
 }
Beispiel #16
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');
 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);
 }
Beispiel #18
0
 public function testCreate()
 {
     $pdf = new Zend_Pdf();
     $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $destination = Zend_Pdf_Destination_Zoom::create($page2, 0, 842, 0.5);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_Zoom);
     $this->assertEquals($destination->getResource()->toString(), '[4 0 R /XYZ 0 842 0.5 ]');
     $destination = Zend_Pdf_Destination_Fit::create($page2);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_Fit);
     $this->assertEquals($destination->getResource()->toString(), '[4 0 R /Fit ]');
     $destination = Zend_Pdf_Destination_FitHorizontally::create($page2, 842);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_FitHorizontally);
     $this->assertEquals($destination->getResource()->toString(), '[4 0 R /FitH 842 ]');
     $destination = Zend_Pdf_Destination_FitVertically::create(2, 0);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_FitVertically);
     $this->assertEquals($destination->getResource()->toString(), '[2 /FitV 0 ]');
     $destination = Zend_Pdf_Destination_FitRectangle::create($page1, 0, 10, 595, 842);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_FitRectangle);
     $this->assertEquals($destination->getResource()->toString(), '[3 0 R /FitR 0 10 595 842 ]');
     $destination = Zend_Pdf_Destination_FitBoundingBox::create(1);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_FitBoundingBox);
     $this->assertEquals($destination->getResource()->toString(), '[1 /FitB ]');
     $destination = Zend_Pdf_Destination_FitBoundingBoxHorizontally::create($page2, 842);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_FitBoundingBoxHorizontally);
     $this->assertEquals($destination->getResource()->toString(), '[4 0 R /FitBH 842 ]');
     $destination = Zend_Pdf_Destination_FitBoundingBoxVertically::create($page2, 0);
     $this->assertTrue($destination instanceof Zend_Pdf_Destination_FitBoundingBoxVertically);
     $this->assertEquals($destination->getResource()->toString(), '[4 0 R /FitBV 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');
 }
Beispiel #20
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;
     }
 }
Beispiel #21
0
 /**
  * @see Pimcore_Image_Matrixcode_Renderer_Abstract::_renderMatrixcode()
  */
 protected function _renderMatrixcode()
 {
     $padding = $this->_matrixcode->getPadding();
     $this->_matrixcode->draw();
     $matrix_dimension = count($this->_matrixcode->getMatrix());
     $matrix_dim_with_padding_x = $matrix_dimension + $padding[1] + $padding[3];
     $matrix_dim_with_padding_y = $matrix_dimension + $padding[0] + $padding[2];
     // Scaling
     $scale = $this->getScale();
     $output_size_width = $matrix_dim_with_padding_x * $scale;
     $output_size_height = $matrix_dim_with_padding_y * $scale;
     // Set colors/transparency
     $fore_color = $this->_matrixcode->getForeColor();
     $back_color = $this->_matrixcode->getBackgroundColor();
     $pdf = new Zend_Pdf();
     $pdf->pages[] = $page = $pdf->newPage('A4');
     // Add credits
     if (!empty($this->_footnote)) {
         $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
         $page->setFont($font, 10)->setFillColor(Zend_Pdf_Color_Html::color('#000000'))->drawText($this->_footnote, 20, 20);
     }
     $page_width = $page->getWidth();
     $page_height = $page->getHeight();
     // Move center of coordination system (by default the lower left corner)
     $page->translate(floor($page_width - $output_size_width) / 2, ($page_height - $output_size_height) / 2);
     if (!empty($back_color)) {
         $back_color = new Zend_Pdf_Color_HTML('#' . $this->_decimalToHTMLColor($back_color));
         $page->setFillColor($back_color);
         $page->drawRectangle(0, 0, $output_size_width, $output_size_height, Zend_Pdf_Page::SHAPE_DRAW_FILL);
     }
     $page->setFillColor(new Zend_Pdf_Color_HTML('#' . $this->_decimalToHTMLColor($fore_color)));
     // Convert the matrix into pixels
     $matrix = $this->_matrixcode->getMatrix();
     for ($i = 0; $i < $matrix_dimension; $i++) {
         for ($j = 0; $j < $matrix_dimension; $j++) {
             if ($matrix[$i][$j]) {
                 $x = ($i + $padding[3]) * $scale;
                 $y = ($matrix_dimension - 1 - $j + $padding[2]) * $scale;
                 $page->drawRectangle($x, $y, $x + $scale, $y + $scale, Zend_Pdf_Page::SHAPE_DRAW_FILL);
             }
         }
     }
     if ($this->_send_result) {
         $this->_sendOutput($pdf->render());
     } else {
         return $pdf;
     }
     return;
 }
Beispiel #22
0
 public function testGetDestination2()
 {
     $pdf = new Zend_Pdf();
     $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page3 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // Page created, but not included into pages list
     $pdf->pages[] = $page1;
     $pdf->pages[] = $page2;
     require_once 'Zend/Pdf/Destination/Fit.php';
     $action1 = Zend_Pdf_Action_GoTo::create(Zend_Pdf_Destination_Fit::create($page2));
     $action2 = Zend_Pdf_Action_GoTo::create(Zend_Pdf_Destination_Fit::create($page3));
     $this->assertTrue($pdf->resolveDestination($action1->getDestination()) === $page2);
     $this->assertTrue($pdf->resolveDestination($action2->getDestination()) === null);
 }
 public function pdfAction()
 {
     //$oid = $this->getRequest()->getParams('orderid');
     //echo $oid;
     $last_order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
     $pre_order_id = $last_order_id - 1;
     $pre_order = Mage::getModel('sales/order')->load($pre_order_id);
     $pre_deposit_val = $pre_order->getDepositId();
     $current_deposit_value = $pre_deposit_val + 1;
     $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
     $connection->beginTransaction();
     $__fields = array();
     $__fields['deposit_id'] = $current_deposit_value;
     $__where = $connection->quoteInto('entity_id =?', $last_order_id);
     $connection->update('zaybx_sales_flat_order', $__fields, $__where);
     $connection->commit();
     $curr_order = Mage::getModel('sales/order')->load($last_order_id);
     $display_deposit = $curr_order->getDepositId();
     $strlen = strlen($display_deposit);
     if ($strlen == 1) {
         $original_deposit_id = "00000" . $display_deposit;
     } else {
         if ($strlen == 2) {
             $original_deposit_id = "0000" . $display_deposit;
         } else {
             if ($strlen == 3) {
                 $original_deposit_id = "000" . $display_deposit;
             } else {
                 if ($strlen == 4) {
                     $original_deposit_id = "00" . $display_deposit;
                 } else {
                     if ($strlen == 5) {
                         $original_deposit_id = "0" . $display_deposit;
                     } else {
                         $original_deposit_id = $display_deposit;
                     }
                 }
             }
         }
     }
     $order = Mage::getModel('sales/order');
     $order_id = $this->getRequest()->getParams('orderid');
     $order->loadByIncrementId($order_id);
     $payment_method_code = $order->getPayment()->getMethodInstance()->getCode();
     $customername = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
     //$currentdate = Mage::getModel('core/date')->date('Y-m-d H:i:s');
     $currentdate = Mage::getModel('core/date')->date('d-m-Y');
     $depositno = mt_rand(01, 100000);
     //$depositno = '000001';
     $grandtotal = floatval(round($order->getGrandTotal(), 2));
     $total = floatval(round($order->getGrandTotal(), 2));
     $companyname = 'CLEARTHINK SOFTWARE PRIVATE LIMITED.';
     $clientcode = 'CLRTNKSFTW';
     $localchq = $order->getPayment()->getCheqloc();
     if ($localchq == 1) {
         $local = '';
         $out = '';
     } else {
         $local = '';
         $out = '';
     }
     // $localchqdd = $order->getPayment()->getCheqlocdd();
     // if($localchqdd == 1){
     // $local = 'Yes';
     // $out = 'No';
     // }else{
     // $local = 'No';
     // $out = 'Yes';
     // }
     $order_ic_id = $order->getIncrementId();
     $checkno = $order->getPayment()->getCheckNo();
     $chqdate = $order->getPayment()->getCheckDate();
     $draweename = $order->getPayment()->getDraweename();
     $draweebank = $order->getPayment()->getDraweebank();
     $panno = $order->getPayment()->getPanno();
     $dd_no = $order->getPayment()->getDdNo();
     $dd_date = $order->getPayment()->getDdDate();
     $draweenamedd = $order->getPayment()->getDraweenamedd();
     $draweebankdd = $order->getPayment()->getDraweebankdd();
     // Create new PDF
     $pdf = new Zend_Pdf();
     //Mage::log(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/sm_market/default/images/pdf/cheque.jpg');
     // Add new page to the document
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     // define font resource
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // set font for page
     // write text to page
     // $page->setFont($font, 24)
     // ->drawText('That which we call a rose,', 72, 720)
     // ->drawText('By any other name would smell as sweet.', 72, 620);
     $pdf->pages[] = $page;
     if ($payment_method_code == 'paymentmodulepackbankin') {
         $image = Zend_Pdf_Image::imageWithPath('skin/frontend/default/msupply/images/pdf/dd.jpg');
         $page->drawImage($image, 50, 100, 772, 496);
         $page->setFont($font, 10)->drawText($companyname, 142, 418);
         $page->setFont($font, 10)->drawText($clientcode, 120, 355);
         // $page->setFont($font,10)->drawText($local,160,385);
         // $page->setFont($font,10)->drawText($out,380,385);
         $page->setFont($font, 10)->drawText($currentdate, 310, 355);
         $page->setFont($font, 10)->drawText($original_deposit_id, 648, 385);
         $page->setFont($font, 10)->drawText($customername, 140, 323);
         //$page->setFont($font,10)->drawText('HSR Layout, Bangalore',470,267);
         $page->setFont($font, 10)->drawText($dd_no, 97, 276);
         $page->setFont($font, 10)->drawText($dd_date, 220, 276);
         $page->setFont($font, 10)->drawText($draweenamedd, 280, 276);
         $page->setFont($font, 10)->drawText($draweebankdd, 425, 276);
         $page->setFont($font, 10)->drawText($order_ic_id, 570, 276);
         $page->setFont($font, 10)->drawText('Rs. ' . $grandtotal, 685, 276);
         $page->setFont($font, 10)->drawText('Rs. ' . $total, 683, 178);
     }
     if ($payment_method_code == 'cheque_checkout') {
         $image = Zend_Pdf_Image::imageWithPath('skin/frontend/default/msupply/images/pdf/cheque.jpg');
         $page->drawImage($image, 50, 100, 772, 496);
         $page->setFont($font, 10)->drawText($companyname, 152, 418);
         $page->setFont($font, 10)->drawText($clientcode, 135, 353);
         $page->setFont($font, 10)->drawText($local, 125, 385);
         $page->setFont($font, 10)->drawText($out, 368, 385);
         $page->setFont($font, 10)->drawText($currentdate, 322, 353);
         $page->setFont($font, 10)->drawText($original_deposit_id, 630, 385);
         $page->setFont($font, 10)->drawText($customername, 155, 322);
         $page->setFont($font, 10)->drawText($checkno, 110, 276);
         $page->setFont($font, 10)->drawText($chqdate, 230, 276);
         $page->setFont($font, 10)->drawText($draweename, 300, 276);
         $page->setFont($font, 10)->drawText($draweebank, 430, 276);
         $page->setFont($font, 10)->drawText($order_ic_id, 560, 276);
         $page->setFont($font, 10)->drawText('Rs. ' . $grandtotal, 675, 276);
         $page->setFont($font, 10)->drawText('Rs. ' . $total, 675, 178);
     }
     if ($payment_method_code == 'cashin') {
         $image = Zend_Pdf_Image::imageWithPath('skin/frontend/default/msupply/images/pdf/cashin.jpg');
         $page->drawImage($image, 50, 100, 772, 496);
         $page->setFont($font, 10)->drawText($companyname, 165, 418);
         $page->setFont($font, 10)->drawText($clientcode, 148, 355);
         //$page->setFont($font,10)->drawText($localchq,160,368);
         $page->setFont($font, 10)->drawText($currentdate, 326, 355);
         $page->setFont($font, 10)->drawText($original_deposit_id, 580, 386);
         $page->setFont($font, 10)->drawText($customername, 173, 323);
         $page->setFont($font, 10)->drawText($order_ic_id, 645, 276);
         $page->setFont($font, 10)->drawText('Rs. ' . $total, 535, 160);
     }
     $pdfData = $pdf->render();
     $fileName = $order_ic_id . '.pdf';
     $this->_prepareDownloadResponse($fileName, $pdfData);
 }
Beispiel #24
0
 public function testNewPageCreator()
 {
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $this->assertTrue($page instanceof Zend_Pdf_Page);
 }
 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);
 }
Beispiel #26
0
 /**
  * Render PDF page from PNG label image
  *
  * @param Zend_Pdf $pdf
  * @param string $fileName
  */
 protected function _renderPage(Zend_Pdf $pdf, $fileName, $data = null)
 {
     $v = $this->getVendor();
     $image = Zend_Pdf_Image::imageWithPath($fileName);
     $pdfPW = $v->getPdfPageWidth();
     $pdfPH = $v->getPdfPageHeight();
     $page = $pdf->newPage($v->getPdfPageSize());
     $wp = $page->getWidth() / $pdfPW;
     $hp = $page->getHeight() / $pdfPH;
     $r = (int) $v->getPdfLabelRotate();
     $l = (double) $v->getPdfLabelLeft();
     $t = (double) $v->getPdfLabelTop();
     $w = (double) $v->getPdfLabelWidth();
     $h = (double) $v->getPdfLabelHeight();
     if (!is_null($data)) {
         extract($data);
         if (!empty($data['w'])) {
             if ($r == 90 || $r == 270) {
                 $pdfPW = $h + $t * 2;
             } else {
                 $pdfPW = $w + $l * 2;
             }
             $wp = $page->getWidth() / $pdfPW;
         }
         if (!empty($data['h'])) {
             if ($r == 90 || $r == 270) {
                 $pdfPH = $w + $l * 2;
             } else {
                 $pdfPH = $h + $t * 2;
             }
             $hp = $page->getHeight() / $pdfPH;
         }
     }
     if ($r == 90 || $r == 270) {
         $tmp = $w;
         $w = $h;
         $h = $tmp;
     }
     $b = $pdfPH - $t - $h;
     $page->drawImage($image, $l * $wp, $b * $hp, ($l + $w) * $wp, ($b + $h) * $hp);
     return $page;
 }
Beispiel #27
0
 public function getPdf($order)
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('order');
     $pdf = new Zend_Pdf();
     $this->_pdf = $pdf;
     $style = new Zend_Pdf_Style();
     $this->_setFontBold($style, 10);
     $order = Mage::getModel('sales/order')->loadByIncrementId($order['increment_id']);
     if ($this->getStoreId()) {
         Mage::app()->getLocale()->emulate($this->getStoreId());
     }
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Add image
     $this->insertLogo($page, $this->getStoreId());
     // Add address
     $this->insertAddress($page, $this->getStoreId());
     // Add head
     $this->insertOrder($page, $order, false);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $this->_setFontRegular($page);
     $page->drawText(Mage::helper('sales')->__('Order # ') . $order->getIncrementId(), 35, 780, 'UTF-8');
     // Add table
     $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
     $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->setLineWidth(0.5);
     $page->drawRectangle(25, $this->y, 570, $this->y - 15);
     $this->y -= 10;
     // Add table head
     $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
     $page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8');
     $page->drawText(Mage::helper('sales')->__('SKU'), 240, $this->y, 'UTF-8');
     $page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
     $page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8');
     $page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
     $page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8');
     $this->y -= 15;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     // Add body
     foreach ($order->getAllItems() as $item) {
         if ($item->getParentItem()) {
             continue;
         }
         $shift = array();
         if ($this->y < 15) {
             // Add new table head
             $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
             $pdf->pages[] = $page;
             $this->y = 800;
             $this->_setFontRegular($page);
             $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
             $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
             $page->setLineWidth(0.5);
             $page->drawRectangle(25, $this->y, 570, $this->y - 15);
             $this->y -= 10;
             $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
             $page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8');
             $page->drawText(Mage::helper('sales')->__('SKU'), 240, $this->y, 'UTF-8');
             $page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
             $page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8');
             $page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
             $page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8');
             $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
             $this->y -= 20;
         }
         // Draw item
         $this->_drawItem($item, $page, $order);
     }
     // Add totals
     $page = $this->insertTotals($page, $order);
     if ($this->getStoreId()) {
         Mage::app()->getLocale()->revert();
     }
     $this->_afterGetPdf();
     return $pdf;
 }
Beispiel #28
0
 public function getPdf($invoices = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('invoice');
     $selected_font = Mage::getStoreConfig('estoreiq_options/messages/estoreiq_font_selected');
     if ($selected_font == 'courier') {
         $the_font = Zend_Pdf_font::fontWithName(Zend_pdf_font::FONT_COURIER);
     } else {
         if ($selected_font == 'times') {
             $the_font = Zend_Pdf_font::fontWithName(Zend_pdf_font::FONT_TIMES);
         } else {
             $the_font = Zend_Pdf_font::fontWithName(Zend_pdf_font::FONT_HELVETICA);
         }
     }
     $pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     //$this->_setFontBold($style, 10);
     foreach ($invoices as $invoice) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         $order = $invoice->getOrder();
         $page->setFont($the_font, 10);
         /* Add image */
         $this->insertLogo($page, $invoice->getStore());
         /* Add address */
         $this->insertAddress($page, $invoice->getStore());
         /* Add head */
         $this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId()));
         /* Add image 2 */
         $this->insertLogo2($page, $invoice->getStore());
         $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
         //$this->_setFontBold($style, 26);
         $page->setFont($the_font, 24);
         $page->drawText('TAX INVOICE (regular invoice)', 335, 580, 'UTF-8');
         /* Add Barcode (custom: Matt Johnson 2008-06-13)*/
         /* convertToBarcodeString resides in extended abstract.php file*/
         $barcodeString = $this->convertToBarcodeString($order->getRealOrderId());
         $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
         $page->setFont(Zend_Pdf_Font::fontWithPath(dirname(__FILE__) . '/' . 'Code128bWin.ttf'), 22);
         $qr_code_activated = Mage::getStoreConfig('estoreiq_options/messages/estoreiq_qr_detection_code_enabled');
         if ($qr_code_activated == '1') {
             $page->drawText($barcodeString, 420, 755, 'CP1252');
         }
         $this->y -= 50;
         $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
         $this->_setFontRegular($page);
         //$page->drawText(Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId(), 35, 780, 'UTF-8');
         /* Add table */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
         $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
         $page->setLineWidth(0.5);
         //$page->drawRectangle(25, $this->y, 570, $this->y -15);
         $this->y -= 10;
         /* Add table head */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
         $page->drawText(Mage::helper('sales')->__('Product') . $qr_code_activated, 35, $this->y, 'UTF-8');
         //$page->drawText(Mage::helper('sales')->__('SKU'), 240, $this->y, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8');
         $this->y -= 15;
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         /* Add body */
         foreach ($invoice->getAllItems() as $item) {
             if ($item->getOrderItem()->getParentItem()) {
                 continue;
             }
             $shift = array();
             if ($this->y < 15) {
                 /* Add new table head */
                 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page;
                 $this->y = 800;
                 $this->_setFontRegular($page);
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
                 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
                 $page->setLineWidth(0.5);
                 //$page->drawRectangle(25, $this->y, 570, $this->y-15);
                 $this->y -= 10;
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
                 $page->drawText(Mage::helper('sales')->__('Product'), 35, $this->y, 'UTF-8');
                 //$page->drawText(Mage::helper('sales')->__('SKU'), 240, $this->y, 'UTF-8');
                 $page->drawText(Mage::helper('sales')->__('Price'), 380, $this->y, 'UTF-8');
                 $page->drawText(Mage::helper('sales')->__('QTY'), 430, $this->y, 'UTF-8');
                 $page->drawText(Mage::helper('sales')->__('Tax'), 480, $this->y, 'UTF-8');
                 $page->drawText(Mage::helper('sales')->__('Subtotal'), 535, $this->y, 'UTF-8');
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
                 $this->y -= 20;
             }
             /* Draw item */
             $this->_drawItem($item, $page, $order);
         }
         /* Add totals */
         $this->insertTotals($page, $invoice);
     }
     $this->_afterGetPdf();
     return $pdf;
 }
 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);
 }
 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);
 }