示例#1
0
 /**
  * Creates a PDF report from the Minutes model given.
  * Returns the PDF as a string that can either be saved to disk
  * or streamed back to the browser.
  *
  * @param Phprojekt_Model_Interface $minutesModel The minutes model object to create the PDF from.
  *
  * @return string The resulting PDF document.
  */
 public static function getPdf(Phprojekt_Model_Interface $minutesModel)
 {
     $phpr = Phprojekt::getInstance();
     $pdf = new Zend_Pdf();
     $page = new Phprojekt_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $pages = array($page);
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 12);
     $page->setBorder(2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 2.0 * Phprojekt_Pdf_Page::PT_PER_CM, 3.0 * Phprojekt_Pdf_Page::PT_PER_CM);
     $page->addFreetext(array('lines' => $minutesModel->title, 'fontSize' => 20));
     $page->addFreetext(array('lines' => array_merge(explode("\n\n", $minutesModel->description), array($phpr->translate('Start') . ': ' . $minutesModel->meetingDatetime, $phpr->translate('End') . ': ' . $minutesModel->endTime, $phpr->translate('Place') . ': ' . $minutesModel->place, $phpr->translate('Moderator') . ': ' . $minutesModel->moderator)), 'fontSize' => 12));
     $invited = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsInvited);
     $attending = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsAttending);
     $excused = Minutes_Helpers_Userlist::expandIdList($minutesModel->participantsExcused);
     $pages += $page->addTable(array('fontSize' => 12, 'rows' => array(array(array('text' => $phpr->translate('Invited'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($invited, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)), array(array('text' => $phpr->translate('Attending'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($attending, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)), array(array('text' => $phpr->translate('Excused'), 'width' => 4.7 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => array_reduce($excused, array('self', '_concat')), 'width' => 12.0 * Phprojekt_Pdf_Page::PT_PER_CM)))));
     $page = end($pages);
     $itemtable = array();
     $items = $minutesModel->items->fetchAll();
     foreach ($items as $item) {
         $itemtable[] = array(array('text' => $item->topicId, 'width' => 1.3 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate($item->information->getTopicType($item->topicType)), 'width' => 3.0 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $item->getDisplay(), 'width' => 12.4 * Phprojekt_Pdf_Page::PT_PER_CM));
     }
     $pages += $page->addTable(array('fontSize' => 12, 'rows' => array_merge(array(array('isHeader' => true, array('text' => $phpr->translate('No.'), 'width' => 1.3 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate('Type'), 'width' => 3.0 * Phprojekt_Pdf_Page::PT_PER_CM), array('text' => $phpr->translate('Item'), 'width' => 12.4 * Phprojekt_Pdf_Page::PT_PER_CM))), $itemtable)));
     $page = end($pages);
     $pdf->pages = $pages;
     $pdf->properties['Title'] = $minutesModel->title;
     $owner = Minutes_Helpers_Userlist::expandIdList($minutesModel->ownerId);
     $pdf->properties['Author'] = $owner[0]['display'];
     $pdf->properties['Producer'] = 'PHProjekt version ' . Phprojekt::getVersion();
     $pdf->properties['CreationDate'] = 'D:' . gmdate('YmdHis');
     $pdf->properties['Keywords'] = $minutesModel->description;
     return $pdf->render();
 }
 /**
  * Print label for one specific shipment
  *
  * @return ResponseInterface|void
  */
 public function execute()
 {
     try {
         $this->shipmentLoader->setOrderId($this->getRequest()->getParam('order_id'));
         $this->shipmentLoader->setShipmentId($this->getRequest()->getParam('shipment_id'));
         $this->shipmentLoader->setShipment($this->getRequest()->getParam('shipment'));
         $this->shipmentLoader->setTracking($this->getRequest()->getParam('tracking'));
         $shipment = $this->shipmentLoader->load();
         $labelContent = $shipment->getShippingLabel();
         if ($labelContent) {
             $pdfContent = null;
             if (stripos($labelContent, '%PDF-') !== false) {
                 $pdfContent = $labelContent;
             } else {
                 $pdf = new \Zend_Pdf();
                 $page = $this->labelGenerator->createPdfPageFromImageString($labelContent);
                 if (!$page) {
                     $this->messageManager->addError(__('We don\'t recognize or support the file extension in this shipment: %1.', $shipment->getIncrementId()));
                 }
                 $pdf->pages[] = $page;
                 $pdfContent = $pdf->render();
             }
             return $this->_fileFactory->create('ShippingLabel(' . $shipment->getIncrementId() . ').pdf', $pdfContent, DirectoryList::VAR_DIR, 'application/pdf');
         }
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->messageManager->addError($e->getMessage());
     } catch (\Exception $e) {
         $this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
         $this->messageManager->addError(__('An error occurred while creating shipping label.'));
     }
     $this->_redirect('adminhtml/order_shipment/view', ['shipment_id' => $this->getRequest()->getParam('shipment_id')]);
 }
示例#3
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);
 }
示例#4
0
文件: Creator.php 项目: sp1ke77/MLM-1
 public function render()
 {
     $page = $this->newPage();
     $this->createHeader($page);
     $this->createContent($page);
     $this->createFooter($page);
     $this->_pdf->pages[] = $page;
     return $this->_pdf->render();
 }
示例#5
0
 public function getPdf()
 {
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $page->setFont($font, 12);
     $width = $page->getWidth();
     $i = 0;
     $this->insertLogo($page);
     $this->insertAddress($page);
     /*$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
       $page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
       $page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
       $page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);*/
     $page->setFont($font, 16);
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->drawRectangle(25, $this->y + 15, 573, $this->y - 57);
     $page->setFillColor(new Zend_Pdf_Color_Html('#ffffff'));
     $headerText = "Report: Net Sales & Tax";
     $page->drawText($headerText, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("From: " . $this->from, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("To: " . $this->to, 30, $this->y, 'UTF-8');
     $page->setFont($font, 14);
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Total Net Sale');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalSale(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Net Sales Texas Only');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasSale(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Net Shipping Costs for Texas only');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasShipping(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Texas Net Sales Tax');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasTax(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $pdf->pages[] = $page;
     return $pdf->render();
 }
示例#6
0
 /**
  * Create Label
  *
  * @return string
  * @throws Zend_Pdf_Exception
  * @throws InvalidArgumentException
  */
 public function render()
 {
     $pdf = new Zend_Pdf();
     $pdfBuilder = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder();
     $template = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $pdfBuilder->setPage($template)->addProductName((string) $this->_info->ProductShortName)->addProductContentCode((string) $this->_info->ProductContentCode)->addSenderInfo($this->_info->Shipper)->addOriginInfo((string) $this->_info->OriginServiceArea->ServiceAreaCode)->addReceiveInfo($this->_info->Consignee)->addDestinationFacilityCode((string) $this->_info->Consignee->CountryCode, (string) $this->_info->DestinationServiceArea->ServiceAreaCode, (string) $this->_info->DestinationServiceArea->FacilityCode)->addServiceFeaturesCodes()->addDeliveryDateCode()->addShipmentInformation($this->_request->getOrderShipment())->addDateInfo($this->_info->ShipmentDate)->addWeightInfo((string) $this->_info->ChargeableWeight, (string) $this->_info->WeightUnit)->addWaybillBarcode((string) $this->_info->AirwayBillNumber, (string) $this->_info->Barcodes->AWBBarCode)->addRoutingBarcode((string) $this->_info->DHLRoutingCode, (string) $this->_info->DHLRoutingDataId, (string) $this->_info->Barcodes->DHLRoutingBarCode)->addBorder();
     $packages = array_values($this->_request->getPackages());
     $i = 0;
     foreach ($this->_info->Pieces->Piece as $piece) {
         $page = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page($template);
         $pdfBuilder->setPage($page)->addPieceNumber((int) $piece->PieceNumber, (int) $this->_info->Piece)->addContentInfo($packages[$i])->addPieceIdBarcode((string) $piece->DataIdentifier, (string) $piece->LicensePlate, (string) $piece->LicensePlateBarCode);
         array_push($pdf->pages, $page);
         $i++;
     }
     return $pdf->render();
 }
示例#7
0
 public function pdfAction()
 {
     $this->view->groupid = $groupid = base64_decode($this->_request->getParam('id'));
     $this->view->groupcode = $groupcode = base64_decode($this->_request->getParam('membercode'));
     $this->view->memberdetails = $memberdetails = $this->view->Dbobj->fetchmembers($groupid);
     $this->view->representative = $this->view->Dbobj->fetchrepresentative($groupid);
     $this->view->groupdetails = $this->view->Dbobj->getMember($groupcode);
     $bankdetails = $this->view->Dbobj->getbankdetails($this->view->groupdetails[0]['branch_id']);
     $this->view->bankdetails = $bankdetails;
     $shgdeclaration = " SHG I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no arrears of any lease amount.\n\nI have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank finance.The crop to be raised is free from the charge/encumbrances.";
     $jlgdeclaration = " JLG I hereby declare and confirm further that I have not committed any default in paying the lease amount to the lesser and have not committed any breach of the terms and conditions of the lease.Moreover,I declare further that there are no arrears of any lease amount.\n\nI have also not resorted to outside borrowing against security of the present crop which is the subject matter of the bank finance.The crop to be raised is free from the charge/encumbrances.";
     $pdf = new Zend_Pdf();
     foreach ($this->view->memberdetails as $memberdetails) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         //Path
         $app = $this->view->baseUrl();
         $word = explode('/', $app);
         $projname = $word[1];
         // Image
         $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
         $image = Zend_Pdf_Image::imageWithPath($image_name);
         $page->drawImage($image, 30, 770, 130, 820);
         $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
         //bottom horizontal
         $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
         //left vertical
         $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
         //right vertical
         $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
         //top horizontal
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
         $title = "";
         if (substr($this->view->groupcode, 4, 1) == 2) {
             $title = "Self Helf Group member";
         } else {
             if (substr($this->view->groupcode, 4, 1) == 3) {
                 $title = "Joint Liability Group member";
             }
         }
         $page->drawText($title, 230, 740);
         $page->drawText($title, 230, 740);
         //set the font
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
         $page->drawText("Date : " . date('d-m-Y'), 500, 800);
         $y1 = 710;
         $y2 = 740;
         $x1 = 60;
         $x2 = 350;
         $x3 = 230;
         $x4 = 400;
         if ($y1 > 45) {
             $page->drawText("To,", $x1, $y1);
             $page->drawText("The Branch manager,", $x1, $y1 = $y1 - 15);
             $page->drawText($this->view->bankdetails[0]['bankname'] . ',', $x1, $y1 = $y1 - 15);
             $page->drawText($this->view->bankdetails[0]['branch'] . '.', $x1, $y1 = $y1 - 15);
             $page->drawText('Respected sir,', $x1, $y1 = $y1 - 35);
             if ($memberdetails['alias']) {
                 $alias = "@ " . $memberdetails['alias'];
             } else {
                 $alias = '';
             }
             $village = $this->view->Dbobj->fetchvillagedetails($memberdetails['village_id']);
             $subject = $memberdetails['membername'] . " " . $alias . " " . $memberdetails['age'] . " Age " . $this->view->groupdetails[0]['group_name'] . " Group " . $village[0]['villagename'] . " Village " . $village[0]['talukname'] . " Taluk " . $village[0]['distname'] . " District.";
             $page->drawText($subject, $x1, $y1 = $y1 - 25);
             $y1 = $y1 - 25;
             $addressline = 0;
             if (substr($this->view->groupcode, 4, 1) == 2) {
                 $newtext = wordwrap($shgdeclaration, 30, "<br />");
                 $pieces = explode("<br />", $newtext);
                 $page->drawText($pieces, $x1, $y1);
             } else {
                 if (substr($this->view->groupcode, 4, 1) == 3) {
                     $newtext = wordwrap($jlgdeclaration, 130, "<br />");
                     $pieces = explode("<br />", $newtext);
                     foreach ($pieces as $pieces1) {
                         $page->drawText(substr($pieces1, 0, 300), $x1, $y1);
                         $y1 -= 15;
                         $addressline++;
                     }
                     $y1 -= $addressline * 15;
                     //         $page->drawText($pieces,$x1, $y1);
                 }
             }
             $y1 = $y1 - 35;
             $page->drawText("Date :" . $this->view->groupdetails[0]['group_created_date'], $x1, $y1);
             $page->drawText("yours obediently,", $x2, $y1);
             $page->drawText("Place :" . $this->view->groupdetails[0]['place'], $x1, $y1 = $y1 - 15);
             $y1 = $y1 - 35;
             $page->drawText($memberdetails['membername'], $x2, $y1);
             $page->drawText("Signature", $x2, $y1 = $y1 - 15);
             $y1 = $y1 - 45;
             $page->drawText("Representative Seal & signature", $x1, $y1);
             $y1 = $y1 - 25;
             $page->drawText("Representative 1", $x1, $y1);
             $page->drawText("Representative 2", $x3, $y1);
             $page->drawText("Representative 3", $x4, $y1);
             $y1 = $y1 - 15;
             foreach ($this->view->representative as $representative) {
                 $page->drawText($representative['membername'], $x1, $y1);
                 $x1 = $x1 + 170;
             }
         }
     }
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/membersdeclaration.pdf');
     $path = '/var/www/' . $projname . '/reports/membersdeclaration.pdf';
     chmod($path, 0777);
 }
 /**
  * Print label for one specific shipment
  *
  */
 public function printLabelAction()
 {
     try {
         $shipment = $this->_initShipment();
         $labelContent = $shipment->getShippingLabel();
         if ($labelContent) {
             $pdfContent = null;
             if (stripos($labelContent, '%PDF-') !== false) {
                 $pdfContent = $labelContent;
             } else {
                 $pdf = new Zend_Pdf();
                 $page = $this->_createPdfPageFromImageString($labelContent);
                 if (!$page) {
                     $this->_getSession()->addError(Mage::helper('sales')->__('File extension not known or unsupported type in the following shipment: %s', $shipment->getIncrementId()));
                 }
                 $pdf->pages[] = $page;
                 $pdfContent = $pdf->render();
             }
             return $this->_prepareDownloadResponse('ShippingLabel(' . $shipment->getIncrementId() . ').pdf', $pdfContent, 'application/pdf');
         }
     } catch (Mage_Core_Exception $e) {
         $this->_getSession()->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::logException($e);
         $this->_getSession()->addError(Mage::helper('sales')->__('An error occurred while creating shipping label.'));
     }
     $this->_redirect('*/sales_order_shipment/view', array('shipment_id' => $this->getRequest()->getParam('shipment_id')));
 }
示例#9
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');
         }
     }
 }
示例#10
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');
 }
 /**
  * Print label for one specific shipment
  */
 public function printLabelAction()
 {
     try {
         $data = Mage::helper('enterprise_rma')->decodeTrackingHash($this->getRequest()->getParam('hash'));
         $rmaIncrementId = '';
         if ($data['key'] == 'rma_id') {
             $this->_loadValidRma($data['id']);
             if (Mage::registry('current_rma')) {
                 $rmaIncrementId = Mage::registry('current_rma')->getIncrementId();
             }
         }
         $model = Mage::getModel('enterprise_rma/shipping_info')->loadPackage($this->getRequest()->getParam('hash'));
         $shipping = Mage::getModel('enterprise_rma/shipping');
         $labelContent = $model->getShippingLabel();
         if ($labelContent) {
             $pdfContent = null;
             if (stripos($labelContent, '%PDF-') !== false) {
                 $pdfContent = $labelContent;
             } else {
                 $pdf = new Zend_Pdf();
                 $page = $shipping->createPdfPageFromImageString($labelContent);
                 if (!$page) {
                     $this->_getSession()->addError(Mage::helper('sales')->__('File extension not known or unsupported type in the following shipment: %s', $shipment->getIncrementId()));
                 }
                 $pdf->pages[] = $page;
                 $pdfContent = $pdf->render();
             }
             return $this->_prepareDownloadResponse('ShippingLabel(' . $rmaIncrementId . ').pdf', $pdfContent, 'application/pdf');
         }
     } catch (Mage_Core_Exception $e) {
         $this->_getSession()->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::logException($e);
         $this->_getSession()->addError(Mage::helper('sales')->__('An error occurred while creating shipping label.'));
     }
     $this->norouteAction();
     return;
 }
示例#12
0
 /**
  * Draw the barcode in the PDF, send headers and the PDF
  * @return mixed
  */
 public function render()
 {
     $this->draw();
     header("Content-Type: application/pdf");
     echo $this->_resource->render();
 }
 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);
 }
 public function createpdfAction()
 {
     $this->render('index');
     $idpdf = $this->getRequest()->getParam('idpdf');
     $objeto_model = new Application_Model_Db();
     if ($this->getRequest()->isPost()) {
         $lab = $this->getRequest()->getPost('infoLab');
         // $this->view->lab = $lab;
     } else {
         $lab = $this->getRequest()->getParam('infoLab');
     }
     try {
         if ($lab) {
             $valor = $objeto_model->selectDados($lab);
         } else {
             $valor = $objeto_model->selectAllDados();
         }
         $this->view->assign('valor', $valor);
     } catch (Zend_Exception $e) {
         echo $e;
     }
     if ($idpdf == 1) {
         $client = new Zend_Http_Client();
         // set some parameters
         $client->setParameterGet('infoLab', 'bi');
         $pdf = new Zend_Pdf();
         $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
         // 595:842 A4
         $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Local', 20, 570, 'UTF-8');
         $pdfPage->drawText('Nome laboratório', 75, 570, 'UTF-8');
         $pdfPage->drawText('Data', 205, 570, 'UTF-8');
         $pdfPage->drawText('Turno visita', 265, 570, 'UTF-8');
         $pdfPage->drawText('Somente aula?', 365, 570, 'UTF-8');
         $pdfPage->drawText('Frequencia aula', 475, 570, 'UTF-8');
         $pdfPage->drawText('Turno Aula', 595, 570, 'UTF-8');
         $pdfPage->drawText('Quantidade gabinete', 695, 570, 'UTF-8');
         $stringpos = 550;
         // posicao x do meu texto
         $stringdif = 12;
         // diferença entre cada quebra de linha.
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->nomeLaboratorio, 75, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->data, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->turnoVisita, 265, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->somenteAula, 365, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->frequenciaAula, 475, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->turnoAula, 595, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->quantGabinete, 695, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
         }
         if ($stringpos < 285) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $stringpos = 580;
         }
         $stringpos -= 4;
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Quantidade tipo gabinete', 20, $stringpos, 'UTF-8');
         $pdfPage->drawText('Sistema operacional', 205, $stringpos, 'UTF-8');
         $pdfPage->drawText('Licença DTI?', 365, $stringpos, 'UTF-8');
         $pdfPage->drawText('OCS instalado?', 475, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ips servidores', 595, $stringpos, 'UTF-8');
         $pdfPage->drawText('Estrutura L.rede', 710, $stringpos, 'UTF-8');
         $stringpos -= 12;
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->sisOperacional, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->licencaDti, 365, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ocsInstalado, 475, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ipsServidores, 595, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->estruturaLRede, 710, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
         }
         if ($stringpos < 198) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $stringpos = 580;
         }
         $stringpos -= 4;
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Roteador', 20, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ip entrada', 205, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ip saída', 365, $stringpos, 'UTF-8');
         $pdfPage->drawText('Nome responsável', 475, $stringpos, 'UTF-8');
         $pdfPage->drawText('Ramal', 595, $stringpos, 'UTF-8');
         $pdfPage->drawText('E-mail', 715, $stringpos, 'UTF-8');
         $stringpos -= 12;
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($stringpos, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ipEntrada, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ipSaida, 365, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->nomeResponsavel, 475, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->ramal, 595, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->email, 715, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
             if ($stringpos < 14) {
             }
         }
         if ($stringpos <= 170) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $stringpos = 580;
         }
         $stringpos -= 4;
         $pdfPage->setFont($font, 12);
         $pdfPage->drawText('Acesso remoto', 20, $stringpos, 'UTF-8');
         $pdfPage->drawText('Backup', 205, $stringpos, 'UTF-8');
         $pdfPage->drawText('Firewall', 375, $stringpos, 'UTF-8');
         $pdfPage->drawText('Observações', 475, $stringpos, 'UTF-8');
         $stringpos -= 12;
         $pdfPage->setFont($font, 9);
         foreach ($valor as $value) {
             $pdfPage->drawText($value->acessoRemoto, 20, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->backup, 205, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->firewall, 375, $stringpos, 'UTF-8');
             $pdfPage->drawText($value->observacoes, 475, $stringpos, 'UTF-8');
             $stringpos = $stringpos - $stringdif;
             // subtrai para que a
             // linha fique embaixo
         }
         if ($stringpos < 14) {
             array_push($pdf->pages, $pdfPage);
             $pdfPage = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
         }
         // if $stringpos = 250 muda a pagina
         //
         // adicionamos nossa página como a 1ª página de nosso documento
         // $pagina=$stringpos/250;
         array_push($pdf->pages, $pdfPage);
         // $pdf->pages[1] = $pdfPage;
         $pdf->save('lab.pdf');
         header('Content-type: application/pdf');
         echo $pdf->render();
     } else {
         return $this->_helper->redirector('select', 'lab');
     }
 }
示例#15
0
 /**
  * Echos the pdf as output with the specified filename.
  *
  * When download is true the file is returned as a download link,
  * otherwise the pdf is shown in the browser.
  *
  * @param \Zend_Pdf $pdf
  * @param string $filename
  * @param boolean $download
  * @param boolean $exit Should the application stop running after output
  */
 protected function echoPdf(\Zend_Pdf $pdf, $filename, $download = false, $exit = true)
 {
     $content = $pdf->render();
     $this->echoPdfContent($content, $filename, $download);
     if ($exit) {
         // No further output
         exit;
     }
 }
示例#16
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);
             }
         }
     }
 }
示例#17
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);
 }
示例#18
0
 /**
  * Label printing action
  */
 public function onepdfAction()
 {
     $orderId = $this->getRequest()->getParam('order_id');
     $shipmentId = $this->getRequest()->getParam('shipment_id');
     $type = $this->getRequest()->getParam('type');
     $customSize = $this->getRequest()->getParam('custom_size');
     $imgPath = Mage::getBaseDir('media') . '/upslabel/label/';
     $message = '';
     $pdf = new Zend_Pdf();
     $i = 0;
     $collections = Mage::getModel('upslabel/upslabel');
     $colls = $collections->getCollection()->addFieldToFilter('order_id', $orderId)->addFieldToFilter('shipment_id', $shipmentId)->addFieldToFilter('type', $type)->addFieldToFilter('status', 0);
     $coll = 0;
     foreach ($colls as $value) {
         $coll = $value['upslabel_id'];
         break;
     }
     $width = strlen(Mage::getStoreConfig('upslabel/printing/dimensionx')) > 0 ? Mage::getStoreConfig('upslabel/printing/dimensionx') : 1400 / 2.6;
     $height = strlen(Mage::getStoreConfig('upslabel/printing/dimensiony')) > 0 ? Mage::getStoreConfig('upslabel/printing/dimensiony') : 800 / 2.6;
     if (Mage::getStoreConfig('alpine_printpdf/qz/label_page_custom_size') && $customSize) {
         $holstSize = Mage::getStoreConfig('alpine_printpdf/qz/label_page_size_x') . ':' . Mage::getStoreConfig('alpine_printpdf/qz/label_page_size_y') . ':';
     } elseif (strlen(Mage::getStoreConfig('upslabel/printing/holstx')) > 0 && strlen(Mage::getStoreConfig('upslabel/printing/holsty')) > 0) {
         $holstSize = Mage::getStoreConfig('upslabel/printing/holstx') . ':' . Mage::getStoreConfig('upslabel/printing/holsty') . ':';
     } else {
         $holstSize = Zend_Pdf_Page::SIZE_A4;
     }
     $collectionOne = Mage::getModel('upslabel/upslabel')->load($coll);
     if ($collectionOne->getOrderId() == $orderId) {
         foreach ($colls as $collection) {
             if (file_exists($imgPath . $collection->getLabelname()) && filesize($imgPath . $collection->getLabelname()) > 1024) {
                 $page = $pdf->newPage($holstSize);
                 $pdf->pages[] = $page;
                 $fileContent = file_get_contents($imgPath . $collection->getLabelname());
                 $img = imagecreatefromstring($fileContent);
                 if (Mage::getStoreConfig('upslabel/printing/verticalprint') == 1) {
                     $fullImageWidth = imagesx($img);
                     $fullImageHeight = imagesy($img);
                     imagecreatetruecolor($fullImageWidth, $fullImageHeight);
                     $col = imagecolorallocate($img, 125, 174, 240);
                     $imgFull = imagerotate($img, -90, $col);
                 } else {
                     $imgFull = $img;
                 }
                 $rnd = rand(10000, 999999);
                 imagejpeg($imgFull, $imgPath . 'lbl' . $rnd . '.jpeg', 100);
                 try {
                     $image = Zend_Pdf_Image::imageWithPath($imgPath . 'lbl' . $rnd . '.jpeg');
                     $page->drawImage($image, 0, 0, $width, $height);
                     $i++;
                 } catch (Zend_Pdf_Exception $e) {
                     Mage::logException($e);
                     $message = $e->getMessage();
                 }
                 unlink($imgPath . 'lbl' . $rnd . '.jpeg');
             }
         }
     }
     if ($i > 0) {
         try {
             $pdfData = $pdf->render();
             $this->getResponse()->setHeader('Content-Disposition', 'inline; filename=result.pdf');
             $this->getResponse()->setHeader('Content-type', 'application/pdf');
             $this->getResponse()->setBody($pdfData);
         } catch (Zend_Pdf_Exception $e) {
             Mage::logException($e);
             $this->getResponse()->setBody($e->getMessage());
         }
     } else {
         $this->getResponse()->setBody($message);
     }
 }
示例#19
0
<?php

require_once 'Zend/Pdf.php';
//create new pdf
$pdf = new Zend_Pdf();
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
//
//set font
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 20);
// Draw text
$page->drawText('Hello world!', 100, 510);
//get pdf document
$pdfData = $pdf->render();
header("Contenr-Dispostion: incline; filename=result.pdf");
header("Content-type: application/x-pdf");
//echo $pdfData;
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo $pdf->render();
echo $pdfData;
示例#20
0
 public function pdftransactionAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     $fromDate = $this->_request->getParam('date');
     $branchid = $this->_request->getParam('office');
     $this->view->field1 = $fromDate;
     $this->view->branchid = $branchid;
     //         $fromDate = $this->_request->getParam('field1');
     //         $this->view->field1 = $fromDate;
     //date format instance
     $dateconvertor = new App_Model_dateConvertor();
     $cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
     $page->drawText("Cash Scroll", 270, 780);
     $page->drawText("Cash Scroll", 270, 780);
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $y1 = 745;
     $page->drawText("Credit", 50, $y1);
     $page->drawText("Debit", 310, $y1);
     $y1 = 745;
     $y2 = 740;
     $page->drawText("As of From " . $fromDate, 465, $y1);
     //For Top Header
     $text = array("", "SL No.", "Particulars", "Amount", "Total", "Particulars", "Opening Cash", "Closing Cash");
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d-m-Y'), 500, 800);
     //date('Y-m-d')
     //         $page->drawText("Date : ".date('d-m-Y'),500, 800);
     $page->drawText($text[0], 240, 780);
     $page->drawText($text[0], 240, 780);
     $x1 = 60;
     $x2 = 120;
     $x3 = 310;
     $x4 = 315;
     $x5 = 390;
     $x6 = 570;
     $page->drawLine(50, 740, 550, 740);
     $page->drawLine(50, 720, 550, 720);
     $page->drawText($text[1], $x1, 725);
     $page->drawText($text[2], $x2, 725);
     $page->drawText($text[3], 250, 725);
     $page->drawText($text[1], $x4, 725);
     $page->drawText($text[5], $x5, 725);
     $page->drawText($text[3], 510, 725);
     $y1 = 710;
     $y2 = 710;
     $transaction = new Cashscroll_Model_Cashscroll();
     $this->view->savings = 10;
     $this->view->savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $this->view->savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     //Credit and Debit
     $savingsCredit = $transaction->totalSavingsCredit($cfromDate, $branchid);
     $savingsDebit = $transaction->totalSavingsDebit($cfromDate, $branchid);
     // Opening Cash
     $openingBalance = 0;
     $osc = $transaction->openingBalance($cfromDate, $branchid);
     foreach ($osc as $osc1) {
         $openingBalance = $osc1->openingBalance;
     }
     $this->view->openingBalance = $openingBalance;
     $amountCredit = "0";
     $amountDebit = "0";
     $i = 0;
     $j = 0;
     foreach ($savingsCredit as $savingsCredit) {
         $i++;
         $page->drawText($i, $x1, $y1);
         $page->drawText($savingsCredit->account_number, $x2, $y1);
         //             $page->drawText($savingsCredit->amount_to_bank,$x3, $y1);
         $pos = position(sprintf("%4.2f", $savingsCredit->amount_to_bank), $x3);
         $page->drawText(sprintf("%4.2f", $savingsCredit->amount_to_bank), $pos + 2, $y1);
         $amountCredit = $amountCredit + $savingsCredit->amount_to_bank;
         $y1 = $y1 - 15;
     }
     foreach ($savingsDebit as $savingsDebit) {
         $j++;
         $page->drawText($j, $x4, $y2);
         $page->drawText($savingsDebit->account_number, $x5, $y2);
         //             $page->drawText($savingsDebit->amount_from_bank,$x6, $y2);
         $pos = position(sprintf("%4.2f", $savingsDebit->amount_from_bank), $x6);
         $page->drawText(sprintf("%4.2f", $savingsDebit->amount_from_bank), $pos + 2, $y2);
         $amountDebit = $amountDebit + $savingsDebit->amount_from_bank;
         $y2 = $y2 - 15;
     }
     $page->drawLine(50, $y1, 550, $y1);
     //opening balnce
     $page->drawText($text[6], $x1, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", $openingBalance), $x3, $y1 -10);
     $pos = position(sprintf("%4.2f", $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $openingBalance), $pos + 2, $y1 - 10);
     //closing Balance
     $page->drawText($text[7], $x4, $y1 - 10);
     //         $page->drawText(sprintf("%4.2f", ( $sum = ($amountCredit + $openingBalance) - $amountDebit)), $x6, $y1 -10);
     $pos = position(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $x6);
     $page->drawText(sprintf("%4.2f", $sum = $amountCredit + $openingBalance - $amountDebit), $pos + 2, $y1 - 10);
     $page->drawLine(50, $y1 = $y1 - 20, 550, $y1);
     $page->drawLine(50, $y1 - 20, 550, $y1 - 20);
     $page->drawText($text[4], $x1, $y1 - 15);
     $page->drawText($text[4], $x1, $y1 - 15);
     $pos = position(sprintf("%4.2f", $amountCredit + $openingBalance), $x3);
     $page->drawText(sprintf("%4.2f", $amountCredit + $openingBalance), $pos + 2, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", ($amountCredit + $openingBalance)), $x3, $y1 -15);
     $page->drawText($text[4], $x4, $y1 - 15);
     $page->drawText($text[4], $x4, $y1 - 15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     //         $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $x6, $y1 -15);
     $pos = position(sprintf("%4.2f", $amountDebit + $sum), $x6);
     $page->drawText(sprintf("%4.2f", $amountDebit + $sum), $pos + 2, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1 - 20, 50, 740);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 740);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(550, $y1 - 20, 550, 740);
     //table rigth vertical
     //$page->drawText("ಭಾವನಾ. ಕೆ. ಎಸ್ ",$x6 + 30, $y1 -15, 'UTF-8');
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/cashscroll.pdf');
     $path = '/var/www/' . $projname . '/reports/cashscroll.pdf';
     chmod($path, 0777);
 }
示例#21
0
文件: Pdf.php 项目: hkhateb/linet3
 /**
  * Renders the PDF document
  *
  * @throws Zend_Pdf_Exception
  */
 public function render($newSegmentOnly = false, $outputStream = NULL)
 {
     //the file with root certificates
     $rootCertificateFile = null;
     $matches = array();
     //render what we have for now
     $pdfDoc = parent::render();
     if (empty($this->_certificate)) {
         return $pdfDoc;
     }
     //set the modification date
     $this->properties['ModDate'] = $this->_currentTime;
     //look for the match line by line
     $pdfLines = explode("\n", $pdfDoc);
     //find the ByteRange and Signature parts that were inserted when we attached the signature object
     foreach ($pdfLines as $line) {
         if (preg_match('/.*<<.+\\/Sig.+\\/Adobe.PPKLite.+\\/ByteRange\\s*\\[(.+)\\].+\\/Contents\\s*(<\\d+>).*/', $line, $matches, PREG_OFFSET_CAPTURE) === 1) {
             break;
         }
     }
     if (count($matches) < 3) {
         throw new Zend_Pdf_Exception('No signature field match was found');
     }
     //offset from the beginning of the document
     $lineOffset = strpos($pdfDoc, $matches[0][0]);
     //[0] - body and [1] - offset
     $byteRangePart = $matches[1];
     $signaturePart = $matches[2];
     //offset where the signature starts
     $signatureStartPosition = $lineOffset + $signaturePart[1];
     //offset where the ByteRange starts
     $byteRangeStartPosition = $lineOffset + $byteRangePart[1];
     //offset where the signature ends
     $signatureEndPosition = $signatureStartPosition + strlen($signaturePart[0]);
     //position of the signature from the end of the PDF
     $signatureFromDocEndPosition = strlen($pdfDoc) - $signatureEndPosition;
     //cut out the signature part
     $pdfDoc = substr($pdfDoc, 0, $signatureStartPosition) . substr($pdfDoc, $signatureEndPosition);
     //replace the ByteRange with the positions of the signature
     $byteRangeLength = strlen($byteRangePart[0]);
     $calculatedByteRange = sprintf('0 %u %u %u', $signatureStartPosition, $signatureEndPosition, $signatureFromDocEndPosition);
     //pad with spaces to put it in the same position
     $calculatedByteRange .= str_repeat(' ', $byteRangeLength - strlen($calculatedByteRange));
     //replace the original ByteRange with the calculated ByteRange
     $pdfDoc = substr_replace($pdfDoc, $calculatedByteRange, $byteRangeStartPosition, $byteRangeLength);
     set_exception_handler('PrintDoc::handle1Exception');
     set_error_handler('PrintDoc::handle1Exception');
     //get the certificate info
     if (!function_exists('openssl_pkcs12_read')) {
         throw new Zend_Pdf_Exception('Please install the OpenSSL support for php');
     }
     $certificateInfo = array();
     $result = openssl_pkcs12_read($this->_certificate, $certificateInfo, $this->_certificatePassword);
     if (!$result) {
         throw new Zend_Pdf_Exception('Unable to open the digital certificate. Check the certificate password: '******'tmppdf');
     $f = fopen($tempDoc, 'wb');
     if (!$f) {
         throw new Zend_Pdf_Exception('Unable to create temporary file: ' . $tempDoc);
     }
     $pdfDocLength = strlen($pdfDoc);
     fwrite($f, $pdfDoc, $pdfDocLength);
     fclose($f);
     // get digital signature via openssl library
     $tempSign = tempnam(sys_get_temp_dir(), 'tmpsig');
     if (!function_exists('openssl_pkcs7_sign')) {
         throw new Zend_Pdf_Exception('Please install the OpenSSL support for php');
     }
     //create a file with extra root certificates
     if (array_key_exists('extracerts', $certificateInfo) && count($certificateInfo['extracerts']) > 0) {
         $rootCertificateFile = tempnam(sys_get_temp_dir(), 'tmproot');
         file_put_contents($rootCertificateFile, implode("\n", $certificateInfo['extracerts']));
     }
     if ($rootCertificateFile) {
         $signResult = openssl_pkcs7_sign($tempDoc, $tempSign, $certificateInfo['cert'], array($certificateInfo['pkey'], $this->_certificatePassword), array(), PKCS7_BINARY | PKCS7_DETACHED, $rootCertificateFile);
         unlink($rootCertificateFile);
     } else {
         $signResult = openssl_pkcs7_sign($tempDoc, $tempSign, $certificateInfo['cert'], array($certificateInfo['pkey'], $this->_certificatePassword), array(), PKCS7_BINARY | PKCS7_DETACHED);
     }
     if (!$signResult) {
         unlink($tempDoc);
         throw new Zend_Pdf_Exception('Cannot sign with pkcs7');
     }
     unlink($tempDoc);
     // read signature
     $signature = file_get_contents($tempSign);
     if ($signature === false) {
         unlink($tempSign);
         throw new Zend_Pdf_Exception('Cannot read the pkcs7 signed document');
     }
     unlink($tempSign);
     // extract signature
     $signature = substr($signature, $pdfDocLength);
     $signature = substr($signature, strpos($signature, "%%EOF\n\n------") + 13);
     $tmpArr = explode("\n\n", $signature);
     $signature = $tmpArr[1];
     unset($tmpArr);
     // decode signature
     $signature = base64_decode(trim($signature));
     // convert signature to hex
     $signature = current(unpack('H*', $signature));
     $signature = str_pad($signature, self::SIGNATURE_MAX_LENGTH, '0');
     // Add signature to the document
     $pdfDoc = substr($pdfDoc, 0, $signatureStartPosition) . '<' . $signature . '>' . substr($pdfDoc, $signatureStartPosition);
     return $pdfDoc;
 }
示例#22
0
 public function xmlAction()
 {
     //AÇÃO PARA GERAR PDF do XML
     $lote_obj = new Application_Model_DbTable_Lote();
     $beneficiario = new Application_Model_DbTable_Beneficiario();
     //RECEBE O ID DO LOTE
     $request = $this->getRequest();
     $lote = $request->getParam('lote');
     $contrato = $request->getParam('contrato');
     $select = $beneficiario->select();
     $select->where('lote = ? ', $lote);
     $tab_beneficiario = $beneficiario->fetchall($select);
     //COMEÇO A MONTAR O MALDITO PDF
     $loader = Zend_Loader_Autoloader::getInstance();
     try {
         //cria pdf
         $pdf = new Zend_Pdf();
         //cria formato A4
         $n = 0;
         $page[$n] = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
         //Define a fonte
         $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
         //buscando imagem
         $imagem = Zend_Pdf_Image::imageWithPath('imagens/pequeno.png');
         //Colocando imagem no PDF
         $page[$n]->drawImage($imagem, 20, 750, $imagem->getPixelWidth() + 20, 750 + $imagem->getPixelHeight());
         //escreve na página
         $page[$n]->setFont($font, 10)->drawText('Relatorios XML ', 160, 730)->setFont($font, 12)->drawText('Contrato: ' . $contrato, 90, 690)->drawText('Empresa: ', 90, 670)->drawText('Numero do lote: ' . $lote, 90, 650)->setFont($font, 11)->drawText('Data: ' . date("d/m/Y"), 90, 630)->drawText('Beneficiarios: ', 90, 600)->setFont($font, 8);
         //CRIANDO LAÇO
         $altura = 585;
         foreach ($tab_beneficiario as $key => $row) {
             if ($altura < 80) {
                 $altura = 780;
                 $n = $n + 1;
                 $page[$n] = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page[$n];
             }
             $page[$n]->setFont($font, 8)->drawText('Nome: ' . $row['Nome'], 90, $altura -= 10)->drawText('CPF: ' . $row['Cnp'], 90, $altura -= 10)->drawText('  ', 90, $altura -= 10);
         }
         $page[$n]->setFont($font, 8)->drawText('Unimed Santos - Av. Dona Ana Costa, 211 - Encruzilhada - Santos - SP', 150, 20)->drawText('Cep: 11.060-001 - Tels.: (13) 2102-8100 / 8300 ', 150, 10);
         //adiciona página ao documento
         //$pdf->pages[] = $page;
         $diretorio = "pdfxml/" . $contrato . "/";
         if (@opendir($diretorio) == false) {
             mkdir($diretorio, 0777);
         }
         //salva PDF
         $pdf->save($diretorio . $lote . '.pdf');
         //Por fim, setamos a header como um PDF, e renderizamos o nosso $pdf;
         header('Content-type: application/pdf');
         echo $pdf->render();
         //$this->_redirect('/xml');
     } catch (Zend_Pdf_Exception $e) {
         die('PDF error: ' . $e->getMessage());
     } catch (Exception $e) {
         die('Application error: ' . $e->getMessage());
     }
     echo $lote;
     exit;
 }
示例#23
0
 function pdftransactionAction()
 {
     $fromdate = $this->_request->getParam('fdate');
     $dateconvertor = new App_Model_dateConvertor();
     $Date = $dateconvertor->mysqlformat($fromdate);
     $this->view->fdate = $Date;
     $asofDate = $dateconvertor->normalformat($fromdate);
     $this->view->asofdate = $asofDate;
     $incomeexpenditure = new Incomeexpenditure_Model_Incomeexpenditure();
     $this->view->income = $income = $incomeexpenditure->incomedetails($Date);
     $this->view->expenditure = $expenditure = $incomeexpenditure->expendituredetails($Date);
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 20, 780, 120, 830);
     $page->setLineWidth(1)->drawLine(20, 20, 580, 20);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(20, 20, 20, 830);
     //left vertical
     $page->setLineWidth(1)->drawLine(580, 25, 580, 830);
     //right vertical
     $page->setLineWidth(1)->drawLine(20, 830, 580, 830);
     //top horizontal
     $x1 = 45;
     $x2 = 250;
     $x3 = 330;
     $x4 = 500;
     $my = 735;
     $y1 = 710;
     $y2 = 710;
     $totalincome = 0;
     $totalexpe = 0;
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array($this->view->translate('Income and Expenditure'), $this->view->translate('Income'), $this->view->translate('Amount'), $this->view->translate('Expenditure'), $this->view->translate('Amount'), $this->view->translate('Grand total'));
     $criteria = $this->view->translate('As of') . " " . $asofDate;
     $currency = "* " . $this->view->translate('Amount in Rs');
     // // // file:///var/www/IDF/application/modules/incomeexpenditure/controllers/IndexController.php
     /*$page->drawText("Date : ".date('d/m/Y'),500, 800); //date('Y-m-d')
       $page->drawText("Date : ".date('d/m/Y'),500, 800);*/
     $page->drawText($text[0], 185, 780);
     $page->drawText($text[0], 185, 780);
     $page->drawText($criteria, 500, 780);
     //Search criteria
     $page->drawText($criteria, 500, 780);
     $page->drawText($currency, 500, 770);
     //Currency
     $page->drawText($currency, 500, 770);
     $page->drawText($text[1], $x1, $my);
     $page->drawText($text[2], $x2, $my);
     $page->drawText($text[3], $x3, $my);
     $page->drawText($text[4], $x4, $my);
     $page->drawLine(30, 750, 570, 750);
     $page->drawLine(30, 730, 570, 730);
     foreach ($income as $income) {
         $page->drawText($income['header'], $x1, $y1);
         $page->drawText($income['credit'], $x2, $y1);
         $totalincome += $income['credit'];
         $y1 = $y1 - 15;
     }
     foreach ($expenditure as $expe) {
         $page->drawText($expe['header'], $x3, $y2);
         $page->drawText($expe['credit'], $x4, $y2);
         $totalexpe += $expe['credit'];
         $y2 = $y2 - 15;
     }
     $page->drawLine(30, $y1, 570, $y1);
     $page->drawLine(30, $y1 - 20, 570, $y1 - 20);
     $page->drawText($text[5], $x1, $y1 - 15);
     $page->drawText(sprintf("%4.2f", $totalincome), $x2, $y1 - 15);
     $page->drawText($text[5], $x3, $y1 - 15);
     $page->drawText(sprintf("%4.2f", $totalexpe), $x4, $y1 - 15);
     // Virtual table
     $page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(300, $y1 - 20, 300, 750);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
     //table rigth vertical
     $pdfData = $pdf->render();
     $account_number = $Date;
     // 		$pdf->save('/var/www/ourbank/reports/incomeexpenditure.pdf');
     //$path = '/var/www/ourbank/reports/incomeexpenditure.pdf';
     $pdf->save('/var/www/' . $projname . '/reports/' . $account_number . 'incomeexpenditure.pdf');
     $path = '/var/www/' . $projname . '/reports/' . $account_number . 'incomeexpenditure.pdf';
     chmod($path, 0777);
 }
示例#24
0
 function pdfgenerationAction()
 {
     //$fetchMeetings=new Meetingreport_Model_Meetingreport();
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // 		 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $image_name = "/var/www" . $app . "/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array("Group name:", "", "Date:", "group code:", "purpose:", "Bank:", "S.no", "Member name", "Survey no", "Loan request amount", "Signature", "Address:");
     $page->drawText($text[0], 60, 725);
     $page->drawText($text[1], 60, 675);
     $page->drawText($text[2], 430, 725);
     $page->drawText($text[3], 410, 710);
     $page->drawText($text[4], 60, 660);
     $page->drawText($text[5], 60, 645);
     $page->drawText($text[6], 74, 625);
     $page->drawText($text[7], 140, 625);
     $page->drawText($text[8], 230, 625);
     $page->drawText($text[9], 330, 625);
     $page->drawText($text[10], 455, 625);
     $page->drawText($text[11], 60, 710);
     $page->setLineWidth(1)->drawLine(70, 640, 500, 640);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(70, 620, 500, 620);
     //bottom horizontal
     $id = $this->_getParam('membercode');
     $groupcommon = new Groupresolution_Model_Groupresolution();
     $group_name = $groupcommon->getgroup($id);
     // get group details
     $getgroupaccount = $groupcommon->getgroupaccount($id);
     // get group details
     $group_location = $groupcommon->getlocation($id);
     // get group Location details - Latitude and longitude
     foreach ($group_location as $location) {
         $this->view->latitude = $location['latitude'];
         $this->view->longitude = $location['longitude'];
     }
     $this->view->getgroupaccount = $getgroupaccount;
     $group_members = $groupcommon->getgroupmembers($id);
     // get group members
     $this->view->groupmembers = $group_members;
     $i = 1;
     foreach ($group_name as $memberdetail) {
         $page->drawText($memberdetail['groupname'], 120, 725);
         $page->drawText($memberdetail['address1'], 120, 710);
         $page->drawText($memberdetail['address2'], 120, 700);
         $page->drawText($memberdetail['address3'], 120, 690);
     }
     $x1 = 140;
     $y1 = 610;
     $x2 = 230;
     $x3 = 330;
     foreach ($group_members as $membergroup) {
         $page->drawText($membergroup['purposename'], 120, 660);
         $page->drawText($membergroup['bank'], 120, 645);
         $page->drawText(date('d-m-Y'), 450, 725);
         $page->drawText($membergroup['groupcode'], 452, 710);
         $page->drawText($membergroup['membername'], $x1, $y1);
         $page->drawText($membergroup['survey_no'], $x2, $y1);
         $page->drawText($membergroup['request_amount'], $x3, $y1);
         $page->setLineWidth(1)->drawLine(70, 640, 70, 500);
         $page->setLineWidth(1)->drawLine(70, 500, 500, 500);
         //bottom horizontal
         $page->setLineWidth(1)->drawLine(500, 640, 500, 500);
         //bottom horizontal
         $page->setLineWidth(1)->drawLine(100, 640, 100, 500);
         $page->setLineWidth(1)->drawLine(210, 640, 210, 500);
         $page->setLineWidth(1)->drawLine(300, 640, 300, 500);
         $page->setLineWidth(1)->drawLine(450, 640, 450, 500);
         $y1 = $y1 - 15;
     }
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/groupresolution' . date('Y-m-d') . '.pdf');
     $path = '/var/www' . $projname . '/reports/groupresolution' . date('Y-m-d') . '.pdf';
     chmod($path, 0777);
 }
示例#25
0
 function pdfgenerationAction()
 {
     //$fetchMeetings=new Meetingreport_Model_Meetingreport();
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // 		 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $image_name = "/var/www" . $app . "/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array("Bank", "Branch", "Thumb Impression Declaration", "I hereby declare that Smt/sri ______________________ has given the thumb impression in the presence of me and his mother tongue", " ___________________________", "Date", "Yours sincerely");
     $x0 = 60;
     $x10 = 450;
     $x11 = 285;
     $page->drawText($text[0], $x0, 725);
     $page->drawText($text[1], $x0, 700);
     $page->drawText($text[2], $x0, 675);
     $page->drawText($text[3], $x0, 650);
     $page->drawText($text[4], $x0, 625);
     $page->drawText($text[5], $x0, 575);
     $page->drawText($text[6], $x10, 575);
     $page->setLineWidth(1)->drawLine(50, 750, 550, 750);
     $page->setLineWidth(1)->drawLine(50, 750, 50, 465);
     $page->setLineWidth(1)->drawLine(50, 750, 50, 465);
     $page->setLineWidth(1)->drawLine(50, 465, 550, 465);
     $page->setLineWidth(1)->drawLine(550, 465, 550, 750);
     $page->setLineWidth(1)->drawLine(50, 690, 550, 690);
     $page->setLineWidth(1)->drawLine(50, 670, 550, 670);
     $y1 = 700;
     $totalAmount = "0";
     $totaldebit = "0";
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/thumbdeclaration' . date('Y-m-d') . '.pdf');
     $path = '/var/www' . $projname . '/reports/thumbdeclaration' . date('Y-m-d') . '.pdf';
     chmod($path, 0777);
 }
示例#26
0
文件: Sale.php 项目: buttasg/cowgirlk
 public function getPdf()
 {
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $page->setFont($font, 12);
     $width = $page->getWidth();
     $i = 0;
     $this->insertLogo($page);
     $this->insertAddress($page);
     /*$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
       $page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
       $page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
       $page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);*/
     $page->setFont($font, 16);
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->drawRectangle(25, $this->y + 15, 573, $this->y - 57);
     $page->setFillColor(new Zend_Pdf_Color_Html('#ffffff'));
     $headerText = "Report: Net Sales & Tax";
     $page->drawText($headerText, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("From: " . $this->from, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("To: " . $this->to, 30, $this->y, 'UTF-8');
     $fontSize = 14;
     $rightMg = 27;
     $page->setFont($font, $fontSize);
     $timeZone = Mage::getStoreConfig('general/locale/timezone');
     //echo $timeZone;
     //date_default_timezone_set('UTC');
     date_default_timezone_set($timeZone);
     $diff = date('Z');
     $diff = $diff * -1;
     //go opposite
     $from = strtotime($this->from . ' ' . $diff . ' seconds');
     $to = strtotime($this->to . ' ' . $diff . ' seconds');
     $this->from = date('Y-m-d H:i:s', $from);
     $this->to = date('Y-m-d H:i:s', $to);
     if (empty($from) || empty($to)) {
         throw new Exception('\'To date\' and \'From date\' are required.');
         return;
     }
     if ($from > $to) {
         throw new Exception('\'To date\' cannot be smaller than \'From date\'');
         return;
     }
     /*if($from==$to)
       {
       	$this->to=date('Y-m-d H:i:s', strtotime($this->to. ' + 1 days'));
       }*/
     $this->to = date('Y-m-d H:i:s', strtotime($this->to . ' + 1 days'));
     //$this->from=date('Y-m-d H:i:s', strtotime($this->from));
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Total Sales');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalSale(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Total Texas Sales');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasSale(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Shipping Costs Texas Only');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasShipping(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Texas Sales Tax');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasTax(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $pdf->pages[] = $page;
     return $pdf->render();
 }
示例#27
0
 public function pdfmeetingAction()
 {
     //rupees right alignment
     function position($amt, $posValue)
     {
         $len = strlen($amt);
         $pos = $posValue - 35 - $len * 4;
         return $pos;
     }
     //view details on pdf page
     $meeting_id = $this->_request->getParam('meeting_name');
     $meetingno = $this->_request->getParam('meetingno');
     $this->view->field1 = $meetingno;
     $this->view->branchid = $meeting_id;
     //for meeting details
     $meetingbook = new Meetingbookreport_Model_Meetingbook();
     // 	$this->view->fetchgroupid=$groupid1=$meetingbook->fetchgroupid($meeting_id);
     // 	$groupid= $groupid1[0]['group_id'];
     $this->view->meeting = $ff = $meetingbook->fetchmeeting($meeting_id);
     //echo '<pre>';print_r($ff);
     //fetch member details
     $this->view->members = $aa = $meetingbook->fetchMembers($meeting_id);
     //echo '<pre>';print_r($aa);
     //fetch attendance details
     $this->view->attendance = $meetingbook->fetchattendance($meeting_id, $meetingno);
     //fetch loan officer
     $loanofficer = $meetingbook->fetchloanofficer($meeting_id);
     if ($loanofficer) {
         $this->view->loanofficer = $loanofficer[0]['loanofficer'];
     }
     //$cfromDate = $dateconvertor->mysqlformat($fromDate);
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     //Path
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = $word[1];
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array();
     $this->view->savings = 10;
     $page->drawText("Date : " . date('d/m/Y'), 500, 800);
     //date('Y-m-d')
     $page->drawText("Meeting Book", 270, 770);
     $page->drawText("Meeting Book", 270, 770);
     $x1 = 50;
     $x2 = 320;
     $y1 = 725;
     $y2 = 710;
     $page->drawText("Meeting Information", $x1, $y1);
     $page->drawText("Meeting Information", $x1, $y1);
     //fetching meeting details
     if ($this->view->meeting) {
         $count = count($this->view->meeting);
         foreach ($this->view->meeting as $meeting) {
         }
         $page->drawText("Group name: " . $meeting['groupname'], $x1, $y1 = $y1 - 20);
         $page->drawText("Week Day: " . $meeting['weekday'], $x2, $y1);
         $page->drawText("Group head: " . $meeting['grouphead_name'], $x1, $y1 = $y1 - 15);
         $page->drawText("Time: " . $meeting['time'], $x2, $y1);
         $page->drawText("Number of members: " . $count, $x1, $y1 = $y1 - 15);
         $page->drawText("Place: " . $meeting['place'], $x2, $y1);
         $page->drawText("Loan Officer: " . $this->view->loanofficer, $x1, $y1 = $y1 - 15);
     }
     //         $this->view->savings = 10;
     $y1 = $y1 - 30;
     $page->drawText("Attendance Information", $x1, $y1);
     $page->drawText("Attendance Information", $x1, $y1);
     //fetching attendance details
     foreach ($this->view->attendance as $attendance) {
     }
     $page->drawText("Meeting name: " . $attendance['meetingname'], $x1, $y1 = $y1 - 20);
     $page->drawText("Held on: " . $this->view->dateconvertor->phpnormalformat($attendance['meeting_date']), $x2, $y1);
     $page->drawText("Meeting Number: " . $attendance['week_no'], $x1, $y1 = $y1 - 15);
     $page->drawText("Time: " . $attendance['time'], $x2, $y1);
     $y1 = $y1 - 30;
     $page->drawText("Member Details", $x1, $y1);
     $page->drawText("Member Details", $x1, $y1);
     $y1 = $y1 - 15;
     $page->drawLine(50, $y1, 550, $y1);
     //table top line
     $y3 = $y1;
     // assign for left and right lines
     $y1 = $y1 - 15;
     $page->drawText("Sl", 55, $y1);
     $page->drawText("Members", 70, $y1);
     $page->drawText("UID", 180, $y1);
     $page->drawText("Attn.", 240, $y1);
     $page->drawText("Late", 265, $y1);
     $page->drawText("Absent", 290, $y1);
     $page->drawText("Balance", 340, $y1);
     $page->drawText("Pay", 395, $y1);
     $page->drawText("Outstanding", 420, $y1);
     $page->drawText("Due", 480, $y1);
     $page->drawText("Total", 525, $y1);
     // $page->drawLine(50, $y1 = $y1 - 20, 550, $y1); //dynamic bottom line - member details table
     $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
     $no = 1;
     $Topay = 0;
     $currentbalance1 = 0;
     $currentbalance2 = 0;
     $currentbalance3 = 0;
     $loandue1 = 0;
     $loandue2 = 0;
     $currentpay = 0;
     $totallatefee = 0;
     $totalabsentfee = 0;
     $total1 = 0;
     $total = 0;
     $currentbalance = new Meetingbookreport_Model_Meetingbook();
     $x3 = 315;
     $x4 = 345;
     $x5 = 400;
     $x6 = 445;
     $x7 = 495;
     $x8 = 530;
     $x9 = 575;
     foreach ($this->view->members as $members) {
         $memberid = $members['memberid'];
         $total = 0;
         $y1 = $y1 - 15;
         $page->drawText($no, 55, $y1);
         $page->drawText($members['membername'], 70, $y1);
         $page->drawText($members['uid'], 180, $y1);
         //$members['uid']
         $memberabsent = $currentbalance->memberabsent($memberid, $attendance['id']);
         $memberlate = $currentbalance->memberlate($memberid, $attendance['id']);
         if ($memberabsent) {
             $absente = 'A';
         } else {
             if ($memberlate) {
                 $absente = 'L';
             } else {
                 $absente = 'P';
             }
         }
         $page->drawText($absente, 245, $y1);
         if ($memberlate) {
             $totallatefee += $latefee = $members['penalty_latecoming'];
             $pos = position(sprintf("%4.2f", $latefee), $x3);
             $page->drawText(sprintf("%4.2f", $latefee), $pos + 2, $y1);
         } else {
             $latefee = 0;
             $pos = position(sprintf("%4.2f", ''), $x3);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         if ($memberabsent) {
             $totalabsentfee += $absentfee = $members['penalty_notcoming'];
             $pos = position(sprintf("%4.2f", $absentfee), $x4);
             $page->drawText(sprintf("%4.2f", $absentfee), $pos + 2, $y1);
         } else {
             $absentfee = 0;
             $pos = position(sprintf("%4.2f", ''), $x4);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         $creditbalance = $currentbalance->creditbalance($memberid);
         $debitbalance = $currentbalance->debitbalance($memberid);
         if ($creditbalance) {
             if ($debitbalance) {
                 $debitbalance1 = $debitbalance;
             } else {
                 $debitbalance1 = 0;
             }
             $currentbalance1 = $creditbalance[0]['currentbalance'] - $debitbalance1[0]['currentbalance'];
             $pos = position(sprintf("%4.2f", $currentbalance1), $x5);
             $page->drawText(sprintf("%4.2f", $currentbalance1), $pos + 2, $y1);
         } else {
             $pos = position(sprintf("%4.2f", ''), $x5);
             $page->drawText(sprintf("%4.2f", ''), $pos + 2, $y1);
         }
         $currentbalance2 += $currentbalance1;
         $perweek = $members['saving_perweek'];
         $pos = position(sprintf("%4.2f", $members['saving_perweek']), $x6);
         $page->drawText(sprintf("%4.2f", $members['saving_perweek']), $pos + 2, $y1);
         $loanoutstanding = $currentbalance->loanoutstanding($memberid);
         if ($loanoutstanding) {
             $loanoutstanding1 = $loanoutstanding[0]['outstanding'];
             $pos = position(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $x7);
             $page->drawText(sprintf("%4.2f", $loanoutstanding[0]['outstanding']), $pos + 2, $y1);
         }
         $currentbalance3 += $loanoutstanding1;
         $loandue = $currentbalance->loandue($memberid);
         if ($loandue) {
             $pos = position(sprintf("%4.2f", $loandue[0]['outstanding']), $x8);
             $page->drawText(sprintf("%4.2f", $loandue[0]['outstanding']), $pos + 2, $y1);
             $loandue1 = $loandue[0]['outstanding'];
         }
         $loandue2 += $loandue1;
         $total = $latefee + $absentfee + $currentbalance1 + $loandue1;
         $pos = position(sprintf("%4.2f", $total), $x9);
         $page->drawText(sprintf("%4.2f", $total), $pos + 2, $y1);
         $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
         $no++;
         $Topay += $members['saving_perweek'];
         $total1 += $total;
     }
     $y1 = $y1 - 15;
     $page->drawText("Total", 180, $y1);
     $pos = position(sprintf("%4.2f", $totallatefee), $x3);
     $page->drawText(sprintf("%4.2f", $totallatefee), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $totalabsentfee), $x4);
     $page->drawText(sprintf("%4.2f", $totalabsentfee), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $currentbalance2), $x5);
     $page->drawText(sprintf("%4.2f", $currentbalance2), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $Topay), $x6);
     $page->drawText(sprintf("%4.2f", $Topay), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $currentbalance3), $x7);
     $page->drawText(sprintf("%4.2f", $currentbalance3), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $loandue2), $x8);
     $page->drawText(sprintf("%4.2f", $loandue2), $pos + 2, $y1);
     $pos = position(sprintf("%4.2f", $total1), $x9);
     $page->drawText(sprintf("%4.2f", $total1), $pos + 2, $y1);
     $page->drawLine(50, $y1 - 10, 550, $y1 = $y1 - 10);
     // Virtual table
     $page->setLineWidth(1)->drawLine(50, $y1, 50, $y3);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(550, $y1, 550, $y3);
     //table rigth vertical
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/meetingbook.pdf');
     $path = '/var/www/' . $projname . '/reports/meetingbook.pdf';
     chmod($path, 0777);
 }
示例#28
0
 function pdftransactionAction()
 {
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     $Dispdate = $this->_request->getParam('field1');
     $this->view->field1 = $Dispdate;
     $dateconvertor = new App_Model_dateConvertor();
     $Date = $dateconvertor->mysqlformat($Dispdate);
     $title1 = $this->view->translate('Loan Supplementary');
     $this->view->pageTitle = $title1;
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $image_name = "/var/www/" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     //$page->drawImage($image, 25, 770, 570, 820);
     $page->drawImage($image, 20, 780, 120, 830);
     $page->setLineWidth(1)->drawLine(20, 20, 580, 20);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(20, 20, 20, 830);
     //left vertical
     $page->setLineWidth(1)->drawLine(580, 25, 580, 830);
     //right vertical
     $page->setLineWidth(1)->drawLine(20, 830, 580, 830);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
     $text = array($this->view->translate('Loan Supplementary'), $this->view->translate('Sl'), $this->view->translate('Particulars'), $this->view->translate('A/C No.'), $this->view->translate('Cash'), $this->view->translate('Transfer'), $this->view->translate('Total'));
     $criteria = $this->view->translate('As of') . $Dispdate;
     $currency = "* " . $this->view->translate('Amount in Rs');
     $this->view->savings = 10;
     //         $page->drawText("Date : ".date('d/m/Y'),500, 800); //date('Y-m-d')
     //         $page->drawText("Date : ".date('d/m/Y'),500, 800);
     $page->drawText($text[0], 200, 780);
     $page->drawText($text[0], 200, 780);
     $page->drawText($criteria, 500, 780);
     //Search criteria
     $page->drawText($criteria, 500, 780);
     $page->drawText($currency, 500, 770);
     //Currency
     $page->drawText($currency, 500, 770);
     $my = 735;
     $x1 = 33;
     $x2 = 45;
     $x3 = 135;
     $x4 = 170;
     $x5 = 210;
     $x6 = 260;
     $x7 = 300;
     $x8 = 312;
     $x9 = 402;
     $x10 = 437;
     $x11 = 477;
     $x12 = 530;
     $page->drawLine(30, 750, 570, 750);
     $page->drawLine(30, 730, 570, 730);
     $page->drawText($text[1], $x1, $my);
     $page->drawText($text[2], $x2, $my);
     $page->drawText($text[3], $x3, $my);
     $page->drawText($text[4], $x4, $my);
     $page->drawText($text[5], $x5, $my);
     $page->drawText($text[6], $x6, $my);
     $page->drawText($text[1], $x7, $my);
     $page->drawText($text[2], $x8, $my);
     $page->drawText($text[3], $x9, $my);
     $page->drawText($text[4], $x10, $my);
     $page->drawText($text[5], $x11, $my);
     $page->drawText($text[6], $x12, $my);
     $y1 = 710;
     $y2 = 710;
     $this->view->loan = 10;
     $transaction = new Loansupplementary_Model_Loansupplementary();
     //                 //Loan Account Credit and Debit
     $loanCredit = $transaction->totalloanCredit($Date);
     $this->view->loanCredit = $loanCredit;
     $loanDebit = $transaction->totalloanDebit($Date);
     $this->view->loanDedit = $loanDebit;
     $totalCredit = "0";
     $totalTransferCredit = "0";
     $totalDebit = "0";
     $totalTransferDebit = "0";
     $i = 0;
     $columntotal1 = 0;
     $columntotal = 0;
     $columntotald = 0;
     $columntotald1 = 0;
     foreach ($loanCredit as $loansCredit) {
         $i++;
         $columntotal = 0;
         if ($loansCredit->paymenttype_id == 1 or $loansCredit->paymenttype_id == 5) {
             $page->drawText($i, $x1, $y1);
             $productname = "To " . $loansCredit->account_number;
             $page->drawText($productname, $x2, $y1);
             $page->drawText($loansCredit->account_id, $x3, $y1);
             if ($loansCredit->paymenttype_id == 1) {
                 $page->drawText($loansCredit->amount_to_bank, $x4, $y1);
                 $totalCredit = $totalCredit + $loansCredit->amount_to_bank;
                 $columntotal += $loansCredit->amount_to_bank;
             } elseif ($loansCredit->paymenttype_id == 5) {
                 $page->drawText($loansCredit->amount_to_bank, $x5, $y1);
                 $totalTransferCredit = $totalTransferCredit + $loansCredit->amount_to_bank;
                 $columntotal += $loansCredit->amount_to_bank;
             }
             $page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
             $page->drawText(sprintf("%4.2f", $columntotal), $x6, $y1);
             $columntotal1 += $columntotal;
             $y1 = $y1 - 15;
         }
     }
     $i = 0;
     foreach ($loanDebit as $loansDebit) {
         $i++;
         $columntotald = 0;
         if ($loansDebit->paymenttype_id == 1 or $loansDebit->paymenttype_id == 5) {
             $page->drawText($i, $x7, $y2);
             $productnamed = "By " . $loansDebit->account_number;
             $page->drawText($productnamed, $x8, $y2);
             $page->drawText($loansDebit->account_id, $x9, $y2);
             if ($loansDebit->paymenttype_id == 1) {
                 $page->drawText($loansDebit->amount_from_bank, $x10, $y2);
                 $totalDebit = $totalCredit + $loansDebit->amount_from_bank;
                 $columntotald += $loansDebit->amount_from_bank;
             } elseif ($loansDebit->paymenttype_id == 5) {
                 $page->drawText($loansDebit->amount_from_bank, $x11, $y2);
                 $totalTransferDebit = $totalTransferDebit + $loansDebit->amount_from_bank;
                 $columntotald += $loansDebit->amount_from_bank;
             }
             $page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
             $page->drawText(sprintf("%4.2f", $columntotald), $x12, $y2);
             $columntotald1 += $columntotald;
             $y2 = $y2 - 15;
         }
     }
     $page->drawLine(30, $y1, 570, $y1);
     $page->drawLine(30, $y1 - 20, 570, $y1 - 20);
     $page->drawText($text[6], $x1, $y1 - 15);
     $page->drawText($text[6], $x1, $y1 - 15);
     if ($totalCredit != "0") {
         $page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalCredit), $x4, $y1 - 15);
     } else {
         $page->drawText("----", $x4, $y1 - 15);
         $page->drawText("----", $x4, $y1 - 15);
     }
     if ($totalTransferCredit != "0") {
         $page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalTransferCredit), $x5, $y1 - 15);
     } else {
         $page->drawText("----", $x5, $y1 - 15);
         $page->drawText("----", $x5, $y1 - 15);
     }
     if ($columntotal1 != "0") {
         $page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $columntotal1), $x6, $y1 - 15);
     } else {
         $page->drawText("----", $x6, $y1 - 15);
         $page->drawText("----", $x6, $y1 - 15);
     }
     if ($totalDebit != "0") {
         $page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalDebit), $x10, $y1 - 15);
     } else {
         $page->drawText("----", $x10, $y1 - 15);
         $page->drawText("----", $x10, $y1 - 15);
     }
     if ($totalTransferDebit != "0") {
         $page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $totalTransferDebit), $x11, $y1 - 15);
     } else {
         $page->drawText("----", $x11, $y1 - 15);
         $page->drawText("----", $x11, $y1 - 15);
     }
     if ($columntotald1 != "0") {
         $page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
         $page->drawText(sprintf("%4.2f", $columntotald1), $x12, $y1 - 15);
     } else {
         $page->drawText("----", $x12, $y1 - 15);
         $page->drawText("----", $x12, $y1 - 15);
     }
     // Virtual table
     $page->setLineWidth(1)->drawLine(30, $y1 - 20, 30, 750);
     //Table left vertical
     $page->setLineWidth(1)->drawLine(298, $y1 - 20, 298, 750);
     //Table center vertical
     $page->setLineWidth(1)->drawLine(570, $y1 - 20, 570, 750);
     //table rigth vertical
     $pdfData = $pdf->render();
     $pdf->save('/var/www/' . $projname . '/reports/loansupplementary.pdf');
     $path = '/var/www/' . $projname . '/reports/loansupplementary.pdf';
     chmod($path, 0777);
 }
示例#29
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;
 }
示例#30
0
 function pdftransactionAction()
 {
     $pdf = new Zend_Pdf();
     $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $pdf->pages[] = $page;
     // Image
     $app = $this->view->baseUrl();
     $word = explode('/', $app);
     $projname = '';
     for ($i = 0; $i < count($word); $i++) {
         if ($i > 0 && $i < count($word) - 1) {
             $projname .= '/' . $word[$i];
         }
     }
     // Image
     $image_name = "/var/www" . $projname . "/public/images/logo.jpg";
     $image = Zend_Pdf_Image::imageWithPath($image_name);
     $page->drawImage($image, 30, 770, 130, 820);
     $page->setLineWidth(1)->drawLine(25, 25, 570, 25);
     //bottom horizontal
     $page->setLineWidth(1)->drawLine(25, 25, 25, 820);
     //left vertical
     $page->setLineWidth(1)->drawLine(570, 25, 570, 820);
     //right vertical
     $page->setLineWidth(1)->drawLine(570, 820, 25, 820);
     //top horizontal
     //set the font
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $text = array($this->view->translate("Deposit Summary"), $this->view->translate("Product"), $this->view->translate('Deposit summary'), $this->view->translate("No. of Savings"), $this->view->translate("Total Savings Amount"));
     function position($amt)
     {
         $len = strlen($amt);
         $pos = 490 - $len * 4;
         return $pos;
     }
     $xx = 50;
     $xy = 550;
     $x1 = 60;
     $x2 = 190;
     $x3 = 330;
     $x4 = 420;
     $page->drawText($text[0], 260, 750);
     $y1 = 725;
     if ($this->_request->getParam('field1')) {
         $officename = new Depositsummary_Model_Depositsummary();
         $OffName = $officename->officeNamefetch($this->_request->getParam('field1'));
         foreach ($OffName as $OffName) {
         }
         $this->view->officeName = $OffName['name'];
         $page->drawText($this->view->translate("Branch Name : "), $x1, $y1);
         $page->drawText($OffName['name'], $x2, $y1);
         $y1 -= 20;
     }
     //point to draw Side line
     $startlinepoint = $y1;
     $page->drawLine($xx, $y1, $xy, $y1);
     $y1 -= 20;
     $page->drawText($text[1], $x1, $y1);
     $page->drawText($text[2], $x2, $y1);
     $page->drawText($text[3], $x3, $y1);
     $page->drawText($text[4], $x4, $y1);
     $y1 -= 5;
     $page->drawLine($xx, $y1, $xy, $y1);
     $y1 -= 20;
     $this->view->depositAmount = 0;
     $this->view->withdrawlAmount = 0;
     $this->view->totalAmount = 0;
     $this->view->deposit = 0;
     $this->view->withdrawl = 0;
     $this->view->sum = 0;
     if ($this->_request->getParam('field1')) {
         $office_id = $this->_request->getParam('field1');
         $this->view->office_id = $office_id;
         $savingsummary = new Depositsummary_Model_Depositsummary();
         $result = $savingsummary->fetchSavingsDetails($office_id);
         $this->view->result = $result;
         $depositAmount = 0;
         $deposit = 0;
         $withdrawlAmount = 0;
         $withdrawl = 0;
         $totalamount = 0;
         $sum = 0;
         foreach ($result as $result) {
             $page->drawText($result['productname'], $x1, $y1);
             $page->drawText($result['prodoffername'], $x2, $y1);
             $page->drawText($result['countvalue'], $x3, $y1);
             $y1 -= 15;
             $accountBalanc = $savingsummary->accountBalanceDetails($office_id);
             $this->view->accountBalanc = $accountBalanc;
             foreach ($accountBalanc as $accountBalanc) {
                 if ($result['id'] == $accountBalanc['offerprodid']) {
                     if ($accountBalanc['transactiontype_id'] == 1) {
                         $depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
                         $deposit = $deposit + $accountBalanc['amount_to_bank'];
                     }
                     if ($accountBalanc['transactiontype_id'] == 2) {
                         $withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
                         $withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
                     }
                     $totalamount = $depositAmount - $withdrawlAmount;
                     $sum = $deposit - $withdrawl;
                 }
             }
             if ($totalamount) {
                 $pos = position(sprintf("%4.2f", $totalamount));
                 $page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
                 $y1 -= 18;
                 $totalamount = 0;
                 $withdrawlAmount = 0;
                 $depositAmount = 0;
             } else {
                 echo "***";
             }
         }
         $page->drawLine($xx, $y1, $xy, $y1);
         $y1 -= 18;
         $page->drawText("Total", $x3, $y1);
         $pos = position(sprintf("%4.2f", $sum));
         $page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
         $y1 -= 10;
         $page->drawLine($xx, $y1, $xy, $y1);
         $page->drawLine($xx, $y1, $xx, $startlinepoint);
         //1st vertical line
         $page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
         //1st vertical line
         $page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($xy, $y1, $xy, $startlinepoint);
         //1st vertical line
         //echo "<pre>";print_r($accountBalanc);echo "<pre>";
         if (!$result && !$accountBalanc) {
             echo "<font color='RED' size = '3'>No Savings Account</font>";
         }
     } else {
         // $office_id = $this->_request->getParam('field1');
         $savingsummary = new Depositsummary_Model_Depositsummary();
         $result = $savingsummary->SavingsDetails();
         $this->view->result = $result;
         $accountBalanc = $savingsummary->accountBalance();
         $this->view->accountBalanc = $accountBalanc;
         $depositAmount = 0;
         $deposit = 0;
         $withdrawlAmount = 0;
         $withdrawl = 0;
         $totalamount = 0;
         $sum = 0;
         foreach ($result as $result) {
             $page->drawText($result['productname'], $x1, $y1);
             $page->drawText($result['prodoffername'], $x2, $y1);
             $page->drawText($result['countvalue'], $x3, $y1);
             $accountBalanc = $savingsummary->accountBalance();
             $this->view->accountBalanc = $accountBalanc;
             foreach ($accountBalanc as $accountBalanc) {
                 if ($result['id'] == $accountBalanc['offerprodid']) {
                     if ($accountBalanc['transactiontype_id'] == 1) {
                         $depositAmount = $depositAmount + $accountBalanc['amount_to_bank'];
                         $deposit = $deposit + $accountBalanc['amount_to_bank'];
                     }
                     if ($accountBalanc['transactiontype_id'] == 2) {
                         $withdrawlAmount = $withdrawlAmount + $accountBalanc['amount_from_bank'];
                         $withdrawl = $withdrawl + $accountBalanc['amount_from_bank'];
                     }
                     $totalamount = $depositAmount - $withdrawlAmount;
                     $sum = $deposit - $withdrawl;
                 }
             }
             if ($totalamount) {
                 $pos = position(sprintf("%4.2f", $totalamount));
                 $page->drawText(sprintf("%4.2f", $totalamount), $pos, $y1);
                 $y1 -= 18;
                 $totalamount = 0;
                 $withdrawlAmount = 0;
                 $depositAmount = 0;
             } else {
                 echo "***";
             }
         }
         $page->drawLine($xx, $y1, $xy, $y1);
         $y1 = 18;
         $page->drawText("Total", $x3, $y1);
         $pos = position(sprintf("%4.2f", $sum));
         $page->drawText(sprintf("%4.2f", $sum), $pos, $y1);
         $y1 = 15;
         $page->drawLine($xx, $y1, $xy, $y1);
         $page->drawLine($xx, $y1, $xx, $startlinepoint);
         //1st vertical line
         $page->drawLine($x2 - 8, $y1, $x2 - 8, $startlinepoint);
         //1st vertical line
         $page->drawLine($x3 - 10, $y1, $x3 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($x4 - 10, $y1, $x4 - 10, $startlinepoint);
         //1st vertical line
         $page->drawLine($xy, $y1, $xy, $startlinepoint);
         //1st vertical line
         if (!$result && !$accountBalanc) {
             echo "<font color='RED' size = '3'>No Savings Account</font>";
         }
     }
     //          $y1-=15;
     $pdfData = $pdf->render();
     $pdf->save('/var/www' . $projname . '/reports/depositsummaryreport.pdf');
     $path = '/var/www' . $projname . '/reports/depositsummaryreport.pdf';
     chmod($path, 0777);
     $this->_redirect('depositsummary/index');
 }