Exemplo n.º 1
0
 /**
  * Draw Line for page
  *
  * @param Zend_Pdf_Page $page
  * @return void
  */
 protected function _drawLine(Zend_Pdf_Page $page)
 {
     //$this->_setFontRegular($page, 9);
     //$page->setLineColor(new Zend_Pdf_Color_GrayScale(0));
     $page->setLineWidth(1);
     $page->drawLine(25, $this->y - 15, 570, $this->y - 15);
 }
Exemplo n.º 2
0
 public function testDrawing()
 {
     $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');
 }
Exemplo n.º 3
0
 /**
  * Draw header block
  *
  * @param  Zend_Pdf_Page $page
  * @return Mage_Sales_Model_Order_Pdf_Shipment_Packaging
  */
 protected function _drawHeaderBlock(Zend_Pdf_Page $page)
 {
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->setLineWidth(0.5);
     $page->drawRectangle(25, 790, 570, 755);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $page->drawText(Mage::helper('sales')->__('Packages'), 35, 770, 'UTF-8');
     $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
     return $this;
 }
Exemplo n.º 4
0
 protected function createContent(\Zend_Pdf_Page $page)
 {
     $page->setLineWidth(2);
     $page->drawLine(30, 400, 810, 400);
     $em = EntityManager::getInstance();
     $where = "settlement_total_id = " . $this->_settlement->getIdentifier();
     $settlements = $em->findAll("Settlement", $where);
     $lines = count($settlements) + 1;
     $this->setFont($page);
     $page->drawText("Lp.", 40, 383);
     $page->drawText("Nazwisko i imię klienta", 90, 383, "UTF-8");
     $page->drawText("Partner", 270, 383);
     $page->drawText("Produkt", 390, 383);
     $page->drawText("Transza", 520, 383);
     $page->drawText("Kwota", 625, 383);
     $page->drawText("Forma wynagrodzenia", 685, 383);
     $lineHeight = 25;
     for ($i = 0; $i <= $lines; $i++) {
         $page->drawLine(30, 400 - $i * $lineHeight, 810, 400 - $i * $lineHeight);
         if ($i > 0 && $i < $lines) {
             $settlement = $settlements[$i - 1];
             $page->drawText($i, 45, 383 - $i * $lineHeight);
             $customer = $settlement->application->customer->lastname . ' ' . $settlement->application->customer->firstname;
             $page->drawText($customer, 80, 383 - $i * $lineHeight, "UTF-8");
             $page->drawText($settlement->application->partner->name, 240, 383 - $i * $lineHeight, "UTF-8");
             $page->drawText($settlement->application->product->name, 360, 383 - $i * $lineHeight, "UTF-8");
             $page->drawText($settlement->parts, 480, 383 - $i * $lineHeight, 'UTF-8');
             $page->drawText($settlement->amount, 630, 383 - $i * $lineHeight);
             $page->drawText($settlement->application->settlementType->name, 725, 383 - $i * $lineHeight);
         }
     }
     $bottomY = 383 - $i * $lineHeight + $lineHeight;
     $page->drawLine(30, 400, 30, 400 - $lines * $lineHeight);
     $page->drawLine(70, 400, 70, 400 - $lines * $lineHeight);
     $page->drawLine(230, 400, 230, 400 - $lines * $lineHeight);
     $page->drawLine(350, 400, 350, 400 - $lines * $lineHeight);
     $page->drawLine(470, 400, 470, 400 - $lines * $lineHeight);
     $page->drawLine(610, 400, 610, 400 - ($lines + 1) * $lineHeight);
     $page->drawLine(675, 400, 675, 400 - ($lines + 1) * $lineHeight);
     $page->drawLine(810, 400, 810, 400 - $lines * $lineHeight);
     $page->drawLine(470, 400 - $lines * $lineHeight, 470, 400 - ($lines + 1) * $lineHeight);
     $page->drawLine(470, 400 - ($lines + 1) * $lineHeight, 675, 400 - ($lines + 1) * $lineHeight);
     $this->setFont($page);
     $page->drawText("Razem", 520, 383 - $lines * $lineHeight);
     $page->drawText($this->_settlement->total, 630, 383 - $lines * $lineHeight);
 }
Exemplo n.º 5
0
 /**
  * Add Border
  *
  * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page
  * @throws Zend_Pdf_Exception
  */
 public function addBorder()
 {
     $x = $this->_x(0);
     $y = $this->_y(0);
     $image = new Zend_Pdf_Resource_Image_Jpeg(Mage::getBaseDir('media') . DS . 'dhl' . DS . 'logo.jpg');
     $this->_page->drawImage($image, $x + 191, $this->_y(27), $x + 287, $this->_y(1));
     /* Vertical borders */
     $this->_page->drawLine($x, $y, $x, $this->_y(568));
     $this->_page->drawLine($x + 287.5, $y, $x + 287.5, $this->_y(568));
     $this->_page->drawLine($x + 139.5, $y, $x + 139.5, $this->_y(28));
     $this->_page->drawLine($x + 190.5, $y, $x + 190.5, $this->_y(28));
     /* Horisontal borders */
     $this->_page->drawLine($x, $y, $x + 288, $y);
     $this->_page->drawLine($x, $this->_y(28), $x + 288, $this->_y(28));
     $this->_page->drawLine($x, $this->_y(80.5), $x + 288, $this->_y(80.5));
     $this->_page->drawLine($x, $this->_y(164), $x + 288, $this->_y(164));
     $this->_page->drawLine($x, $this->_y(194), $x + 288, $this->_y(194));
     $this->_page->drawLine($x, $this->_y(217.5), $x + 288, $this->_y(217.5));
     $this->_page->drawLine($x, $this->_y(245.5), $x + 288, $this->_y(245.5));
     $this->_page->drawLine($x, $this->_y(568.5), $x + 288, $this->_y(568.5));
     $this->_page->setLineWidth(0.3);
     $x = $this->_x(3);
     $y = $this->_y(83);
     $this->_page->drawLine($x, $y, $x + 10, $y);
     $this->_page->drawLine($x, $y, $x, $y - 10);
     $x = $this->_x(3);
     $y = $this->_y(161);
     $this->_page->drawLine($x, $y, $x + 10, $y);
     $this->_page->drawLine($x, $y, $x, $y + 10);
     $x = $this->_x(285);
     $y = $this->_y(83);
     $this->_page->drawLine($x, $y, $x - 10, $y);
     $this->_page->drawLine($x, $y, $x, $y - 10);
     $x = $this->_x(285);
     $y = $this->_y(161);
     $this->_page->drawLine($x, $y, $x - 10, $y);
     $this->_page->drawLine($x, $y, $x, $y + 10);
     return $this;
 }
Exemplo n.º 6
0
 /**
  * Add Border
  *
  * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page
  */
 public function addBorder()
 {
     $x = $this->_x(0);
     $y = $this->_y(0);
     $image = new Zend_Pdf_Resource_Image_Jpeg(Mage::getDesign()->getViewFile('Mage_Usa::dhl/logo.jpg', array('theme' => false)));
     $this->_page->drawImage($image, $x + 191, $this->_y(27), $x + 287, $this->_y(1));
     /* Vertical borders */
     $this->_page->drawLine($x, $y, $x, $this->_y(568));
     $this->_page->drawLine($x + 287.5, $y, $x + 287.5, $this->_y(568));
     $this->_page->drawLine($x + 139.5, $y, $x + 139.5, $this->_y(28));
     $this->_page->drawLine($x + 190.5, $y, $x + 190.5, $this->_y(28));
     /* Horisontal borders */
     $this->_page->drawLine($x, $y, $x + 288, $y);
     $this->_page->drawLine($x, $this->_y(28), $x + 288, $this->_y(28));
     $this->_page->drawLine($x, $this->_y(80.5), $x + 288, $this->_y(80.5));
     $this->_page->drawLine($x, $this->_y(164), $x + 288, $this->_y(164));
     $this->_page->drawLine($x, $this->_y(194), $x + 288, $this->_y(194));
     $this->_page->drawLine($x, $this->_y(217.5), $x + 288, $this->_y(217.5));
     $this->_page->drawLine($x, $this->_y(245.5), $x + 288, $this->_y(245.5));
     $this->_page->drawLine($x, $this->_y(568.5), $x + 288, $this->_y(568.5));
     $this->_page->setLineWidth(0.3);
     $x = $this->_x(3);
     $y = $this->_y(83);
     $this->_page->drawLine($x, $y, $x + 10, $y);
     $this->_page->drawLine($x, $y, $x, $y - 10);
     $x = $this->_x(3);
     $y = $this->_y(161);
     $this->_page->drawLine($x, $y, $x + 10, $y);
     $this->_page->drawLine($x, $y, $x, $y + 10);
     $x = $this->_x(285);
     $y = $this->_y(83);
     $this->_page->drawLine($x, $y, $x - 10, $y);
     $this->_page->drawLine($x, $y, $x, $y - 10);
     $x = $this->_x(285);
     $y = $this->_y(161);
     $this->_page->drawLine($x, $y, $x - 10, $y);
     $this->_page->drawLine($x, $y, $x, $y + 10);
     return $this;
 }
Exemplo n.º 7
0
$page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID)->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawCircle(25, 25, 25);
// Draw sectors
$page2->drawCircle(140, 25, 25, 2 * M_PI / 3, -M_PI / 6)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawCircle(140, 25, 25, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawCircle(140, 25, 25, -M_PI / 6, M_PI / 6);
// Draw ellipse
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawEllipse(190, 50, 340, 0)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawEllipse(190, 50, 340, 0, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawEllipse(190, 50, 340, 0, -M_PI / 6, M_PI / 6);
// Draw and fill polygon
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
$x = array();
$y = array();
for ($count = 0; $count < 8; $count++) {
    $x[] = 80 + 25 * cos(3 * M_PI_4 * $count);
    $y[] = 25 + 25 * sin(3 * M_PI_4 * $count);
}
$page2->drawPolygon($x, $y, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, Zend_Pdf_Page::FILL_METHOD_EVEN_ODD);
// Draw line
$page2->setLineWidth(0.5)->drawLine(0, 25, 340, 25);
$page2->restoreGS();
// Coordination system movement, skewing and scaling
$page2->saveGS();
$page2->translate(60, 150)->skew(0, 0, 0, -M_PI / 9)->scale(0.9, 0.9);
// Scale coordination system
// Draw rectangle
$page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8))->setLineColor(new Zend_Pdf_Color_GrayScale(0.2))->setLineDashingPattern(array(3, 2, 3, 4), 1.6)->drawRectangle(0, 50, 340, 0);
// Draw circle
$page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID)->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawCircle(25, 25, 25);
// Draw sectors
$page2->drawCircle(140, 25, 25, 2 * M_PI / 3, -M_PI / 6)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawCircle(140, 25, 25, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawCircle(140, 25, 25, -M_PI / 6, M_PI / 6);
// Draw ellipse
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawEllipse(190, 50, 340, 0)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawEllipse(190, 50, 340, 0, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawEllipse(190, 50, 340, 0, -M_PI / 6, M_PI / 6);
// Draw and fill polygon
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
Exemplo n.º 8
0
 /**
  * insert the table header of the shipment
  *
  * @param Zend_Pdf_Page $page page to write on
  */
 protected function insertTableHeader($page)
 {
     $page->setFillColor($this->colors['grey1']);
     $page->setLineColor($this->colors['grey1']);
     $page->setLineWidth(1);
     $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'] - 10, $this->y - 15);
     $page->setFillColor($this->colors['black']);
     $this->_setFontRegular($page, 9);
     $this->y -= 11;
     $page->drawText(Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'], $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 105, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Qty'), $this->margin['left'] + 450, $this->y, $this->encoding);
 }
Exemplo n.º 9
0
 /**
  * Draw table header for product items
  *
  * @param  Zend_Pdf_Page $page page to draw on
  *
  * @return void
  */
 protected function _drawHeader(Zend_Pdf_Page $page)
 {
     $page->setFillColor($this->colors['grey1']);
     $page->setLineColor($this->colors['grey1']);
     $page->setLineWidth(1);
     $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'], $this->y - 15);
     $page->setFillColor($this->colors['black']);
     $font = $this->_setFontRegular($page, 9);
     $this->y -= 11;
     $page->drawText(Mage::helper('firegento_pdf')->__('Pos'), $this->margin['left'] + 3, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'] + 25, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 120, $this->y, $this->encoding);
     $singlePrice = Mage::helper('firegento_pdf')->__('Price (excl. tax)');
     $page->drawText($singlePrice, $this->margin['right'] - 153 - $this->widthForStringUsingFontSize($singlePrice, $font, 9), $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Qty'), $this->margin['left'] + 360, $this->y, $this->encoding);
     $taxLabel = Mage::helper('firegento_pdf')->__('Tax');
     $page->drawText($taxLabel, $this->margin['right'] - 65 - $this->widthForStringUsingFontSize($taxLabel, $font, 9), $this->y, $this->encoding);
     $totalLabel = Mage::helper('firegento_pdf')->__('Total');
     $page->drawText($totalLabel, $this->margin['right'] - 10 - $this->widthForStringUsingFontSize($totalLabel, $font, 10), $this->y, $this->encoding);
 }
Exemplo n.º 10
0
 /**
  * Insert Table Header for Items
  *
  * @param  Zend_Pdf_Page $page current page object of Zend_PDF
  *
  * @return void
  */
 protected function insertTableHeader(&$page)
 {
     $page->setFillColor($this->colors['grey1']);
     $page->setLineColor($this->colors['grey1']);
     $page->setLineWidth(1);
     $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'], $this->y - 15);
     $page->setFillColor($this->colors['black']);
     $font = $this->_setFontRegular($page, 9);
     $this->y -= 11;
     $page->drawText(Mage::helper('firegento_pdf')->__('Pos'), $this->margin['left'] + 3, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'] + 25, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 130, $this->y, $this->encoding);
     $columns = array();
     $columns['price'] = array('label' => Mage::helper('firegento_pdf')->__('Price'), '_width' => 60);
     $columns['price_incl_tax'] = array('label' => Mage::helper('firegento_pdf')->__('Price (incl. tax)'), '_width' => 60);
     $columns['qty'] = array('label' => Mage::helper('firegento_pdf')->__('Qty'), '_width' => 40);
     $columns['tax'] = array('label' => Mage::helper('firegento_pdf')->__('Tax'), '_width' => 50);
     $columns['tax_rate'] = array('label' => Mage::helper('firegento_pdf')->__('Tax rate'), '_width' => 50);
     $columns['subtotal'] = array('label' => Mage::helper('firegento_pdf')->__('Total'), '_width' => 50);
     $columns['subtotal_incl_tax'] = array('label' => Mage::helper('firegento_pdf')->__('Total (incl. tax)'), '_width' => 70);
     // draw price, tax, and subtotal in specified order
     $columnsOrder = explode(',', Mage::getStoreConfig('sales_pdf/invoice/item_price_column_order'));
     // draw starting from right
     $columnsOrder = array_reverse($columnsOrder);
     $columnOffset = 0;
     foreach ($columnsOrder as $columnName) {
         $columnName = trim($columnName);
         if (array_key_exists($columnName, $columns)) {
             $column = $columns[$columnName];
             $labelWidth = $this->widthForStringUsingFontSize($column['label'], $font, 9);
             $page->drawText($column['label'], $this->margin['right'] - $columnOffset - $labelWidth, $this->y, $this->encoding);
             $columnOffset += $column['_width'];
         }
     }
 }
Exemplo n.º 11
0
 function pdfgenerationAction()
 {
     $declarationform = new Declaration_Form_Account();
     $this->view->form = $declarationform;
     $this->view->membercode = $memcode = $this->_request->getParam('membercode');
     if (substr($memcode, 4, 1) == 2 or substr($memcode, 4, 1) == 3) {
         $this->view->groupresult = $result = $this->view->dbobj->getmembers($memcode);
         //
         if ($result) {
             $declarationform->populate($result[0]);
             $this->view->groupcode = $groupcode = $result[0]['groupcode'];
             $this->view->relation = $result = $this->view->dbobj->getrelations($groupcode);
         }
     } else {
         $this->view->result = $result = $this->view->dbobj->getmember($memcode);
         //
         if ($result) {
             $declarationform->populate($result[0]);
             $this->view->membercode1 = $familyid = $result[0]['family_id'];
             $this->view->relation = $result = $this->view->dbobj->getrelation($familyid);
             $dbobj = new Declaration_Model_Dec();
             $app = $this->view->baseUrl();
             $word = explode('/', $app);
             $projname = $word[1];
             $title1 = "declaration";
             $this->view->pageTitle = $title1;
             $pdf = new Zend_Pdf();
             $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
             $pdf->pages[] = $page;
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             //$page->drawImage($image, 25, 770, 570, 820);
             $page->drawImage($image, 30, 770, 130, 820);
             $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
             //bottom horizontal
             $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
             //left vertical
             $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
             //right vertical
             $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
             //top horizonta
             // define font resource
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
             // Image
             $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
             $image = Zend_Pdf_Image::imageWithPath($image_name);
             $Declaration = new Declaration_Model_Dec();
             $memcode = $this->_request->getParam('membercode');
             $familyid = $this->_request->getParam('membercode1');
             $showgetmember = $Declaration->getmember($memcode);
             $showgetrelation = $Declaration->getrelation($familyid);
             $dateconvert = new App_Model_dateConvertor();
             foreach ($this->view->result as $result) {
             }
             // write text to page
             $page->setFont($font, 12)->drawText('DECLARATION', 240, 720);
             //                 $page->setLineWidth(1)->drawLine(0, 800, 820, 250);
             $page->setFont($font, 10)->drawText('(TO BE SUBMITTED BY THE BORROWER UNDER SBI JOINT LIABILITY GROUP)', 72, 700);
             $page->setFont($font, 9)->drawText('I,' . $result['name'] . ' (Name of the borrower), Son of ' . $this->view->relation[0]['fathername'] . '', 72, 670);
             $page->setFont($font, 9)->drawText('Aged around ' . $result['age'] . ' years,presently residing at ' . $result['street'] . ' do here by', 72, 655);
             $page->setFont($font, 9)->drawText('Solemnly affirm and sincerely state on Oath as follows:', 72, 625);
             $page->setFont($font, 9)->drawText('i)  I propose to avail a crop loan under SBI JLG scheme against hypothecation of the crop which the loan is to be sanctioned.', 72, 605);
             $page->setFont($font, 9)->drawText('ii) In this connection, I confirm that and declare that I am land less labourer / share cropper /tenant farmer /oral lessee', 72, 585);
             $page->setFont($font, 9)->drawText('( Stricke out which ever not applicable ).', 80, 575);
             $page->setFont($font, 9)->drawText('iii) I hereby declare and confirm furture that the properties mentioned in the schedule to the affidavit is the property which', 72, 555);
             $page->setFont($font, 9)->drawText('is the subject matter of lease (Oral /written) in my favour for year to year or for period of  ' . $dateconvert->normalformat($result['created_date']) . '', 80, 545);
             $page->setFont($font, 9)->drawText('year as mentioned in the document and the lease is presently in force and Sri ' . $result['landowner_name'] . ' is the lesser and ', 80, 535);
             $page->setFont($font, 9)->drawText('the owner of the property (a copy of the lease deed is enclosed).', 80, 525);
             $page->setFont($font, 9)->drawText('iv)I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and', 72, 505);
             $page->setFont($font, 9)->drawText('have not committed any breach of the terms and conditions of the lease.Moreover,I declare further  that there are no', 80, 495);
             $page->setFont($font, 9)->drawText('arrears of any lease amount.', 80, 485);
             $page->setFont($font, 9)->drawText('v) I have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank', 72, 465);
             $page->setFont($font, 9)->drawText('finance.The crop to be raised is free from the charge/encumbrances.', 80, 455);
             // add page to document
             $pdf->pages[] = $page;
             $pdfData = $pdf->render();
             $pdfData = $pdf->render();
             $pdf->save('/var/www/' . $projname . '/reports/declaration.pdf');
             $path = '/var/www/' . $projname . '/reports/declaration.pdf';
             chmod($path, 0777);
             //                 $this->_redirect('/declaration/index');
         }
     }
 }
Exemplo n.º 12
0
 public function testPageCloning()
 {
     $pdf = Zend_Pdf::load(dirname(__FILE__) . '/_files/pdfarchiving.pdf');
     $srcPageCount = count($pdf->pages);
     try {
         $newPage = clone reset($pdf->pages);
     } catch (Zend_Pdf_Exception $e) {
         if (strpos($e->getMessage(), 'Cloning Zend_Pdf_Page object using \'clone\' keyword is not supported.') !== 0) {
             throw $e;
         }
         // Exception is thrown
     }
     $outputPageSet = array();
     foreach ($pdf->pages as $srcPage) {
         $page = new Zend_Pdf_Page($srcPage);
         $outputPageSet[] = $srcPage;
         $outputPageSet[] = $page;
         $page->saveGS();
         // Create new Style
         $page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0.9));
         $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
         $page->setLineWidth(3);
         $page->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 32);
         $page->rotate(0, 0, M_PI_2 / 3);
         $page->drawText('Modified by Zend Framework!', 150, 0);
         $page->restoreGS();
     }
     // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
     $pdf->pages = $outputPageSet;
     $pdf->save(dirname(__FILE__) . '/_files/output.pdf');
     unset($pdf);
     $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
     $this->assertTrue($pdf1 instanceof Zend_Pdf);
     $this->assertEquals($srcPageCount * 2, count($pdf1->pages));
     unset($pdf1);
     unlink(dirname(__FILE__) . '/_files/output.pdf');
 }
Exemplo n.º 13
0
 /**
  * Insert order to pdf page
  *
  * @param Zend_Pdf_Page $page
  * @param Mage_Sales_Model_Order $obj
  * @param bool $putOrderId
  */
 protected function insertOrder(&$page, $obj, $putOrderId = true)
 {
     if ($obj instanceof Mage_Sales_Model_Order) {
         $shipment = null;
         $order = $obj;
     } elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
         $shipment = $obj;
         $order = $shipment->getOrder();
     }
     $this->y = $this->y ? $this->y : 815;
     $top = $this->y;
     //$theitemm =	Mage::getStoreConfig('system_config_name/groups/estoreiq_logo');
     //$eye_logo_image = Mage::getStoreConfig('estoreiq_options/messages/estoreiq_logo');
     //$theitemm =	 Mage::getBaseDir('media') . '/estoreiq-logo/' . $eye_logo_image;
     //$page->drawText(
     //'img: '.$theitemm,
     //35,
     //($top -= 15),
     // 'UTF-8'
     // );
     $top -= 15;
     $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, $top, 275, ($top - 25));
     //$page->drawRectangle(275, $top, 570, ($top - 25));
     /* Calculate blocks info */
     /* Billing Address */
     /*
             $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
     */
     /* Payment */
     /*
             $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())
                 ->setIsSecureMode(true)
                 ->toPdf();
             $paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
             $payment = explode('{{pdf_row_separator}}', $paymentInfo);
             foreach ($payment as $key=>$value){
                 if (strip_tags(trim($value)) == '') {
                     unset($payment[$key]);
                 }
             }
             reset($payment);
     */
     /* Shipping Address and Method */
     if (!$order->getIsVirtual()) {
         /* Shipping Address */
         $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
         $shippingMethod = $order->getShippingDescription();
     }
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_setFontBold($page, 12);
     //$page->drawText(Mage::helper('sales')->__('Sold to:'), 35, ($top - 15), 'UTF-8');
     if (!$order->getIsVirtual()) {
         //$page->drawText(Mage::helper('sales')->__('Ship to:'), 285, ($top - 15), 'UTF-8');
     } else {
         //$page->drawText(Mage::helper('sales')->__('Payment Method:'), 285, ($top - 15), 'UTF-8');
     }
     $addressesHeight = $this->_calcAddressHeight($billingAddress);
     if (isset($shippingAddress)) {
         $addressesHeight = max($addressesHeight, $this->_calcAddressHeight($shippingAddress));
     }
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     //$page->drawRectangle(25, ($top - 25), 570, $top - 33 - $addressesHeight);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_setFontRegular($page, 10);
     $this->y = $top + 40;
     $addressesStartY = $this->y;
     foreach ($billingAddress as $value) {
         if ($value !== '') {
             $text = array();
             foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
                 $text[] = $_value;
             }
             foreach ($text as $part) {
                 if (strpos($part, "F:") === false) {
                     $page->drawText(strip_tags(ltrim($part)), 35, $this->y, 'UTF-8');
                     $this->y -= 15;
                 }
             }
         }
     }
     $addressesEndY = $this->y;
     if (!$order->getIsVirtual()) {
         $this->y = $addressesStartY;
         foreach ($shippingAddress as $value) {
             if ($value !== '') {
                 $text = array();
                 foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
                     $text[] = $_value;
                 }
                 foreach ($text as $part) {
                     if (strpos($part, "F:") === false) {
                         $page->drawText(strip_tags(ltrim($part)), 235, $this->y, 'UTF-8');
                         $this->y -= 15;
                     }
                 }
             }
         }
         $addressesEndY = min($addressesEndY, $this->y);
         $this->y = $addressesEndY;
         $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
         $page->setLineWidth(0.5);
         //$page->drawRectangle(25, $this->y, 275, $this->y-25);
         //$page->drawRectangle(275, $this->y, 570, $this->y-25);
         $this->y -= 15;
         $this->_setFontBold($page, 12);
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         //$page->drawText(Mage::helper('sales')->__('Payment Method'), 35, $this->y, 'UTF-8');
         //$page->drawText(Mage::helper('sales')->__('Shipping Method:'), 285, $this->y , 'UTF-8');
         $this->y -= 10;
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $this->_setFontRegular($page, 10);
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         $paymentLeft = 35;
         $yPayments = $this->y - 15;
     } else {
         $yPayments = $addressesStartY;
         $paymentLeft = 285;
     }
     /*
             foreach ($payment as $value){
                 if (trim($value) != '') {
                     //Printing "Payment Method" lines
                     $value = preg_replace('/<br[^>]*>/i', "\n", $value);
                     foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
                         $page->drawText(strip_tags(trim($_value)), $paymentLeft, $yPayments, 'UTF-8');
                         $yPayments -= 15;
                     }
                 }
             }
     */
     /*
             if ($order->getIsVirtual()) {
                 // replacement of Shipments-Payments rectangle block
                 $yPayments = min($addressesEndY, $yPayments);
                 //$page->drawLine(25,  ($top - 25), 25,  $yPayments);
                 //$page->drawLine(570, ($top - 25), 570, $yPayments);
                 //$page->drawLine(25,  $yPayments,  570, $yPayments);
     
                 $this->y = $yPayments - 15;
             } else {
                 $topMargin    = 15;
                 $methodStartY = $this->y;
                 $this->y     -= 15;
     
                 foreach (Mage::helper('core/string')->str_split($shippingMethod, 45, true, true) as $_value) {
                     $page->drawText(strip_tags(trim($_value)), 285, $this->y, 'UTF-8');
                     $this->y -= 15;
                 }
     
                 $yShipments = $this->y;
                 $totalShippingChargesText = "(" . Mage::helper('sales')->__('Total Shipping Charges') . " "
                     . $order->formatPriceTxt($order->getShippingAmount()) . ")";
     
                 $page->drawText($totalShippingChargesText, 285, $yShipments - $topMargin, 'UTF-8');
                 $yShipments -= $topMargin + 10;
     
                 $tracks = array();
                 if ($shipment) {
                     $tracks = $shipment->getAllTracks();
                 }
                 if (count($tracks)) {
                     $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
                     $page->setLineWidth(0.5);
                     //$page->drawRectangle(285, $yShipments, 510, $yShipments - 10);
                     //$page->drawLine(400, $yShipments, 400, $yShipments - 10);
                     //$page->drawLine(510, $yShipments, 510, $yShipments - 10);
     
                     $this->_setFontRegular($page, 9);
                     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
                     //$page->drawText(Mage::helper('sales')->__('Carrier'), 290, $yShipments - 7 , 'UTF-8');
                     $page->drawText(Mage::helper('sales')->__('Title'), 290, $yShipments - 7, 'UTF-8');
                     $page->drawText(Mage::helper('sales')->__('Number'), 410, $yShipments - 7, 'UTF-8');
     
                     $yShipments -= 20;
                     $this->_setFontRegular($page, 8);
                     foreach ($tracks as $track) {
     
                         $CarrierCode = $track->getCarrierCode();
                         if ($CarrierCode != 'custom') {
                             $carrier = Mage::getSingleton('shipping/config')->getCarrierInstance($CarrierCode);
                             $carrierTitle = $carrier->getConfigData('title');
                         } else {
                             $carrierTitle = Mage::helper('sales')->__('Custom Value');
                         }
     
                         //$truncatedCarrierTitle = substr($carrierTitle, 0, 35) . (strlen($carrierTitle) > 35 ? '...' : '');
                         $maxTitleLen = 45;
                         $endOfTitle = strlen($track->getTitle()) > $maxTitleLen ? '...' : '';
                         $truncatedTitle = substr($track->getTitle(), 0, $maxTitleLen) . $endOfTitle;
                         //$page->drawText($truncatedCarrierTitle, 285, $yShipments , 'UTF-8');
                         $page->drawText($truncatedTitle, 292, $yShipments , 'UTF-8');
                         $page->drawText($track->getNumber(), 410, $yShipments , 'UTF-8');
                         $yShipments -= $topMargin - 5;
                     }
                 } else {
                     $yShipments -= $topMargin - 5;
                 }
     
                 $currentY = min($yPayments, $yShipments);
     
                 // replacement of Shipments-Payments rectangle block
                 //$page->drawLine(25,  $methodStartY, 25,  $currentY); //left
                 //$page->drawLine(25,  $currentY,     570, $currentY); //bottom
                 //$page->drawLine(570, $currentY,     570, $methodStartY); //right
     
                 $this->y = $currentY;
                 $this->y -= 15;
             }
     */
     if ($putOrderId) {
         $page->drawText(Mage::helper('sales')->__('Order # ') . $order->getRealOrderId(), 35, $top -= 195, 'UTF-8');
     }
     $page->drawText(Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'medium', false), 35, $top -= 15, 'UTF-8');
 }
Exemplo n.º 14
0
 /**
  * Insert footer
  *
  * @param  Zend_Pdf_Page $page Current page object of Zend_Pdf
  *
  * @return void
  */
 protected function _insertFooter(&$page)
 {
     $page->setLineColor($this->colors['black']);
     $page->setLineWidth(0.5);
     $page->drawLine($this->margin['left'] - 20, $this->y - 5, $this->margin['right'] + 30, $this->y - 5);
     $this->Ln(15);
     $this->_insertFooterAddress($page);
     $fields = array('telephone' => Mage::helper('firegento_pdf')->__('Telephone:'), 'fax' => Mage::helper('firegento_pdf')->__('Fax:'), 'email' => Mage::helper('firegento_pdf')->__('E-Mail:'), 'web' => Mage::helper('firegento_pdf')->__('Web:'));
     $this->_insertFooterBlock($page, $fields, 70, 40, 140);
     $fields = array('bank_name' => Mage::helper('firegento_pdf')->__('Bank name:'), 'bank_account' => Mage::helper('firegento_pdf')->__('Account:'), 'bank_code_number' => Mage::helper('firegento_pdf')->__('Bank number:'), 'bank_account_owner' => Mage::helper('firegento_pdf')->__('Account owner:'), 'swift' => Mage::helper('firegento_pdf')->__('SWIFT:'), 'iban' => Mage::helper('firegento_pdf')->__('IBAN:'));
     $this->_insertFooterBlock($page, $fields, 215, 50, 150);
     $fields = array('tax_number' => Mage::helper('firegento_pdf')->__('Tax number:'), 'vat_id' => Mage::helper('firegento_pdf')->__('VAT-ID:'), 'register_number' => Mage::helper('firegento_pdf')->__('Register number:'), 'ceo' => Mage::helper('firegento_pdf')->__('CEO:'));
     $this->_insertFooterBlock($page, $fields, 355, 60, $this->margin['right'] - 365 - 10);
 }
Exemplo n.º 15
0
 function pdfdisplayAction()
 {
     $convertdate = new App_Model_dateConvertor();
     //  echo '<pre>'; print_r($this->_request->getParam('accNum'));
     $this->view->details = $this->view->loanModel->searchaccounts($this->_request->getParam('accNum'));
     //echo '<pre>'; print_r($this->view->details);
     $this->view->tran = $this->view->loanModel->loanInstalments($this->_request->getParam('accNum'));
     $this->view->paid = $this->view->loanModel->paid($this->_request->getParam('accNum'));
     $this->view->unpaid = $this->view->loanModel->unpaid($this->_request->getParam('accNum'));
     // 		$loansearch = new Loandetailsg_Form_Search();
     // 		$loantransactions = new Loandisbursmentg_Model_loan();
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $page->drawText('( LOAN LEDGER )', 237, 780);
     $text = array("Member details");
     $x0 = 50;
     $x3 = 310;
     $x1 = 150;
     $x2 = 220;
     $page->drawLine(50, 740, 290, 740);
     $page->drawLine(50, 720, 290, 720);
     $page->drawText($text[0], 90, 727);
     $y1 = 700;
     foreach ($this->view->details as $details) {
         $page->drawText('Name  : ' . $details->name, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Branch  : ' . $details->officename, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Code  : ' . $details->code, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Account code  : ' . $details->number, $x0, $y1);
         $text1 = array("Loan details");
         $y1 = $y1 - 25;
         $page->drawLine(50, $y1, 290, $y1);
         $y1 = $y1 - 20;
         $page->drawLine(50, $y1, 290, $y1);
         $y1 = $y1 + 7;
         $page->drawText($text1[0], 90, $y1);
         $y1 = $y1 - 25;
         $page->drawText('Loan name  : ' . $details->loanname, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Loan amount Rs  : ' . $details->amount, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Interest rate %  : ' . $details->interest, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Installments  : ' . $details->installments, $x0, $y1);
         $y1 = $y1 - 20;
         $page->drawText('Sanctioned date  : ' . $details->sanctioned, $x0, $y1);
         $y1 = $y1 - 20;
     }
     $y1 = 740;
     $text2 = array("Installment status        No          Amount");
     $page->drawLine(310, $y1, 550, $y1);
     $y1 = $y1 - 20;
     $page->drawLine(310, $y1, 550, $y1);
     $y1 = $y1 + 7;
     $page->drawText($text2[0], $x3, $y1);
     foreach ($this->view->paid as $paid) {
         $y1 = $y1 - 25;
         $page->drawText('Paid' . $paid->paidAmt, 320, $y1);
         $page->drawText($paid->paidCount, 390, $y1);
     }
     foreach ($this->view->unpaid as $unpaid) {
         $y1 = $y1 - 20;
         $page->drawText('Due', 320, $y1);
         $page->drawText($unpaid->unpaidCount, 390, $y1);
         $page->drawText($unpaid->unpaidAmt, 430, $y1);
     }
     $y1 = 480;
     $text3 = array("GL.LF no            Transaction date           Creidt               Debit                      Payment mode              Transacted by ");
     $page->drawLine(50, $y1, 550, $y1);
     $y1 = $y1 - 20;
     $page->drawLine(50, $y1, 550, $y1);
     $y1 = $y1 + 7;
     $page->drawText($text3[0], $x0, $y1);
     foreach ($this->view->tran as $transaction) {
         $y1 = $y1 - 20;
         $page->drawText($transaction->id, 60, $y1);
         $page->drawText($transaction->date, 120, $y1);
         $page->drawText($transaction->cr, 160, $y1);
         $page->drawText($transaction->dt, 250, $y1);
         $page->drawText($transaction->mode, 330, $y1);
         $page->drawText($transaction->name, 420, $y1);
         $y1 = $y1 - 5;
         $page->drawLine(50, $y1, 550, $y1);
     }
     $pdf->pages[] = $page;
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/loanledger.pdf');
     $path = '/var/www/' . $projname . '/reports/loanledger.pdf';
     chmod($path, 0777);
 }
Exemplo n.º 16
0
      ->drawEllipse(190, 50, 340, 0, -M_PI/6, M_PI/6);

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

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

$page2->restoreGS();


// Coordination system movement, skewing and scaling
$page2->saveGS();
$page2->translate(60, 150)     // Shift coordination system
      ->skew(0, 0, 0, -M_PI/9) // Skew coordination system
      ->scale(0.9, 0.9);       // Scale coordination system

// Draw rectangle
$page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8))
      ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2))
      ->setLineDashingPattern(array(3, 2, 3, 4), 1.6)
Exemplo n.º 17
0
 function pdfdisplayAction()
 {
     $declarationform = new Externalloan_Model_Dec();
     $this->view->form = $declarationform;
     $postdata = $this->_request->getpost();
     //echo '<pre>'; print_r($postdata);
     $this->view->membercode = $memcode = $postdata['membercode'];
     //echo $this->view->membercode.'<br>';
     $this->view->moduleid = $moduleid = $postdata['module_id'];
     $this->view->groupresult = $results = $this->view->dbobj->groupDeatils($memcode, $moduleid);
     $this->view->groupmember = $membername = $this->view->dbobj->getmember($memcode);
     $this->view->represent = $repname = $this->view->dbobj->represent($memcode);
     $this->view->loans = $loans = $this->view->dbobj->getgrouploans($memcode);
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizonta
     // define font resource
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $x1 = 72;
     $x2 = 410;
     $y1 = 670;
     //$y2=;
     $memcode = $this->_request->getParam('membercode');
     $moduleid = $this->_request->getParam('module_id');
     //             echo '<pre>'; print_r($this->view->groupresult);
     $dateconvert = new App_Model_dateConvertor();
     foreach ($this->view->groupresult as $result) {
         foreach ($this->view->represent as $name) {
             foreach ($this->view->groupmember as $memberview) {
                 // write text to page
                 $page->setFont($font, 10)->drawText('( EXTERNAL LOAN REQUEST )', 237, 720);
                 $page->setFont($font, 9)->drawText('Group name :' . $result['name'] . '', $x1, $y1);
                 $page->setFont($font, 9)->drawText('Date :' . date('d-m-Y') . '', $x2, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('Group Address :' . $result['address1'] . '', $x1, $y1);
                 $page->setFont($font, 9)->drawText('Group code :' . $result['groupcode'] . '', $x2, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('' . $result['city'] . '', 137, $y1);
                 $page->setFont($font, 9)->drawText('Savings A/c :' . $result['account_number'] . '', $x2, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('' . $result['state'] . '', 137, $y1);
                 foreach ($this->view->loans as $loan) {
                     $page->setFont($font, 9)->drawText('Loan A/c :' . $loan['loanaccount'] . '', $x2, $y1);
                 }
                 // // 				$y1=$y1-15;
                 // //                 $page->setFont($font, 9)
                 // //                     ->drawText('Communication:phone/mobile :'.$loan['mobile'].'',$x1, $y1);
                 $y1 = $y1 - 10;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 25;
                 $page->setFont($font, 9)->drawText('1...' . $result['purpose'] . '...(PURPOSE)sfjhkjh kjhjhjdhfjn dhfjkasdhfjh..' . $result['bankname'] . '..(BANK)afd/saa/sdb', $x1, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('..' . $result['branchname'] . '..(Branch name) asdbnhhjh saoinm (LOAN AMOUNT)..' . $result['amount'] . '...ajjnsabvcui uwepiyqwne bodaftutguy nhgqwe.', $x1, $y1);
                 $y1 = $y1 - 20;
                 $page->setFont($font, 9)->drawText('2. aujhhjuoer uiuhjn jhsfduio  uyhuasmuiohjos iuiowsmhns8u ujmnasusm sjuhm,asdfiu ', $x1, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('1) ' . $name['memnames'] . '', 150, $y1);
                 $y1 = $y1 - 25;
                 $page->setFont($font, 9)->drawText('aujhhjuoer uiuhjn jhsfduio  uyhuasmuiohjos iuiowsmhns8u ujmnasusm sjuhm,asdfiu ', $x1, $y1);
                 $y1 = $y1 - 15;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('S.No', 80, $y1);
                 $page->setFont($font, 9)->drawText('Member Name', 150, $y1);
                 $page->setFont($font, 9)->drawText('Purpose', 270, $y1);
                 $page->setFont($font, 9)->drawText('Loan request', 360, $y1);
                 $page->setFont($font, 9)->drawText('Signature', 450, $y1);
                 $y1 = $y1 - 10;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 15;
                 $page->setFont($font, 9)->drawText('' . $memberview['memname'] . '', 150, $y1);
                 $page->setFont($font, 9)->drawText('' . $memberview['purposename'] . '', 260, $y1);
                 $page->setFont($font, 9)->drawText('' . $memberview['Amount'] . '', 365, $y1);
                 $y1 = $y1 - 10;
                 $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
                 $y1 = $y1 - 50;
                 $pdf->pages[] = $page;
                 $pdfData = $pdf->render();
                 $pdfData = $pdf->render();
                 $pdf->save('/var/www/' . $projname . '/reports/externalloan.pdf');
                 $path = '/var/www/' . $projname . '/reports/externalloan.pdf';
                 chmod($path, 0777);
             }
         }
     }
 }
Exemplo n.º 18
0
 function pdfdisplayAction()
 {
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     // 		$page->setLineWidth(1)->drawLine(25, 640, 25, 500);
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizonta
     // define font resource
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $x1 = 72;
     $x2 = 410;
     $y1 = 690;
     $Declaration = new Declaration_Model_Dec();
     $code = $this->_request->getParam('groupcode');
     $this->view->result = $this->view->loan->groupDeatils($code);
     $this->view->groupmembers = $this->view->loan->getgroupmembers($code);
     $dateconvert = new App_Model_dateConvertor();
     foreach ($this->view->result as $result) {
         //    // write text to page
         $page->setFont($font, 12)->drawText('Group bye law', 240, 720);
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate   ' . $result['dayname'] . 'The vision of Ourbank is to stimulate ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to    ' . $result['place'] . '  stimulate local development by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimulate  ' . $result['saving_perweek'] . '  pment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimu  ' . $result['rateinterest'] . '  velopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stim  ' . $result['penalty_latecoming'] . '  evelopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stim   ' . $result['penalty_notcoming'] . '  velopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to st   ' . $result['group_created_date'] . '   elopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('The vision of Ourbank is to stimu    ' . $result['name'] . '    elopment by offering small and medium ', $x1, $y1);
         $y1 = $y1 - 15;
         $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
         $y1 = $y1 - 15;
         $page->setFont($font, 9)->drawText('Member name', 72, $y1);
         $page->setFont($font, 9)->drawText('UID', 160, $y1);
         $page->setFont($font, 9)->drawText('Father name', 200, $y1);
         $page->setFont($font, 9)->drawText('Nominee', 280, $y1);
         $page->setFont($font, 9)->drawText('Nominee relationship', 350, $y1);
         $page->setFont($font, 9)->drawText('Signature', 460, $y1);
         $y1 = $y1 - 10;
         $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
         foreach ($this->view->groupmembers as $member) {
             $y1 = $y1 - 15;
             $page->setFont($font, 9)->drawText('' . $member['membername'] . '', 72, $y1);
             $page->setFont($font, 9)->drawText('' . $member['uid'] . '', 140, $y1);
             $page->setFont($font, 9)->drawText('' . $member['family_id'] . '', 200, $y1);
             $y1 = $y1 - 10;
             $page->setLineWidth(1)->drawLine(50, $y1, 550, $y1);
         }
     }
     $pdf->pages[] = $page;
     $pdfData = $pdf->render();
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/grouplaw.pdf');
     $path = '/var/www/' . $projname . '/reports/grouplaw.pdf';
     chmod($path, 0777);
     //                 $this->_redirect('/declaration/index');
 }
 public function downloadAction()
 {
     if ($this->_loadValidVoucher()) {
         $voucherCode = $this->getRequest()->getParam('code');
         $text = Mage::helper('voucher');
         $_product = Mage::registry('current_product');
         $pdf = new Zend_Pdf();
         $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER);
         $pageHeight = $page->getHeight();
         $pageWidth = $page->getWidth();
         //$page->rotate(($pageWidth/2), ($pageHeight/2), 1);
         $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
         $logoImage = Zend_Pdf_Image::imageWithPath(Mage::getDesign()->getSkinBaseDir() . '/images/logo_small_en.jpg');
         //$footerImage = Zend_Pdf_Image::imageWithPath(Mage::getDesign()->getSkinBaseDir() . '/images/voucher_footer_en.png'); //VD
         $productImage = Zend_Pdf_Image::imageWithPath(Mage::getBaseDir() . '/media/catalog/product' . $_product->getVoucherImage());
         //$footerImageHeight = $footerImage->getPixelHeight();  //VD
         //$footerImageWidth = $footerImage->getPixelWidth();  //VD
         $logoImageHeight = 75;
         //VDEdit
         $logoImageWidth = 250;
         //VDEdit
         $tableWidth = 568;
         $startPoint = ($pageWidth - $tableWidth) / 2;
         $endPoint = $startPoint + $tableWidth;
         $botPoint = 10;
         $topPoint = $pageHeight - 30;
         $page->setLineWidth('0.3')->setLineDashingPattern(array(3, 3, 3, 3))->drawLine($startPoint, $topPoint, $startPoint, $botPoint)->drawLine($endPoint, $topPoint, $endPoint, $botPoint)->drawLine($startPoint, $topPoint, $endPoint, $topPoint)->drawLine($startPoint, $botPoint, $endPoint, $botPoint)->drawLine($startPoint, $pageHeight - $logoImageHeight - 235, $endPoint, $pageHeight - $logoImageHeight - 235)->drawLine($startPoint, $pageHeight - $logoImageHeight - 235 - 325, $endPoint, $pageHeight - $logoImageHeight - 235 - 325);
         $page->setFillColor(Zend_Pdf_Color_Html::color('#16599D'))->drawRectangle($startPoint + 2, $topPoint - $logoImageHeight - 2, $endPoint, $topPoint);
         $page->drawImage($logoImage, $startPoint, $topPoint - $logoImageHeight - 1, $startPoint + $logoImageWidth, $topPoint);
         //$page->drawImage($footerImage, $startPoint + 2, $botPoint, $startPoint + $footerImageWidth - 20, $botPoint + $footerImageHeight);
         $page->drawImage($productImage, $startPoint + 7, $topPoint - 55 - $productImage->getPixelHeight(), $startPoint + 7 + 246, $topPoint - 55 - $productImage->getPixelHeight() + 165);
         $page->setFillColor(Zend_Pdf_Color_Html::color('#FFFFFF'))->setLineDashingPattern(array(1, 0, 1, 0))->drawRectangle($endPoint - 205, $topPoint - 10, $endPoint - 15, $topPoint + 10)->setLineDashingPattern(array(0, 1000, 0, 1000))->setFillColor(Zend_Pdf_Color_Html::color('#EDF4FA'))->drawRectangle($startPoint + 0.3, $pageHeight - $logoImageHeight - 235, $endPoint, $pageHeight - $logoImageHeight - 235 - 325);
         $style = new Zend_Pdf_Style();
         $style->setFont($font, 15);
         $page->setFont($font, 12)->setFillColor(Zend_Pdf_Color_Html::color('#000000'))->drawText($text->__('Voucher Code: ' . $voucherCode), $endPoint - 193, $topPoint - 4)->setFont($font, 15);
         $lines = explode("\n", $this->getWrappedText($text->__('Voucher for ') . $_product->getName(), $style, 270));
         //var_dump($lines);
         foreach ($lines as $k => $line) {
             $page->drawText($line, $startPoint + $productImage->getPixelWidth() + 20, $topPoint - 70 - $k * 20);
         }
         //
         $pdf->pages[0] = $page;
         $pdf->save(Mage::getBaseDir() . '/media/vouchers/' . $voucherCode . '.pdf');
         $this->getResponse()->clearHeaders()->setHeader('content-type:', 'Application/pdf')->setHeader('Content-Type', 'application/force-download')->setHeader('Content-Disposition', 'attachment; filename="' . $voucherCode . '.pdf"')->setBody($pdf->render());
     }
 }