Esempio n. 1
0
 /**
  * Insert totals to pdf page
  *
  * @param  Zend_Pdf_Page $page
  * @param  Mage_Sales_Model_Abstract $source
  * @return Zend_Pdf_Page
  */
 protected function insertTotals($page, $source)
 {
     $order = $source->getOrder();
     $totals = $this->_getTotalsList($source);
     $lineBlock = array('lines' => array(), 'height' => 15);
     foreach ($totals as $total) {
         $total->setOrder($order)->setSource($source);
         if ($total->canDisplay()) {
             $total->setFontSize(10);
             foreach ($total->getTotalsForDisplay() as $totalData) {
                 $lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 565, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'));
             }
         }
     }
     $this->y -= 20;
     $page = $this->drawLineBlocks($page, array($lineBlock));
     return $page;
 }
Esempio n. 2
0
 /**
  * Insert totals to pdf page
  *
  * @param  Zend_Pdf_Page $page
  * @param  Mage_Sales_Model_Abstract $source
  * @return Zend_Pdf_Page
  */
 protected function insertTotals($page, $source)
 {
     // remvoeme
     $this->y += 40;
     if ($this->y - 150 < 15) {
         $page = $this->newPage($pageSettings);
     }
     $order = $source->getOrder();
     $totals = $this->_getTotalsList($source);
     $lineBlock = array('lines' => array(), 'height' => 20);
     $this->y -= 30;
     $page->setFillColor(new Zend_Pdf_Color_Html("#58a300"));
     $page->setLineColor(new Zend_Pdf_Color_GrayScale(1));
     $page->setLineWidth(0.5);
     $page->drawRectangle(275, $this->y, 570, $this->y - 30);
     $this->_setFontBold($page, 12);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $page->drawText(Mage::helper('sales')->__('Betrag'), 285, $this->y - 20, 'UTF-8');
     $this->sy = $this->y;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->y -= 30;
     foreach ($totals as $total) {
         $total->setOrder($order)->setSource($source);
         if ($total->canDisplay()) {
             $total->setFontSize(10);
             foreach ($total->getTotalsForDisplay() as $totalData) {
                 $fontSize = 7;
                 if ("Gesamt (inkl. Steuern):" === $totalData["label"]) {
                     $fontSize = 10;
                 }
                 if (false !== strpos($totalData["label"], "Produkte zu 19")) {
                     continue;
                 }
                 if ("Steuer:" === $totalData["label"]) {
                     $totalData["label"] = "19% MwSt.";
                 }
                 $totalData["label"] = str_replace("Steuern", "MwSt.", $totalData["label"]);
                 $lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', "font_size" => 7, 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 525, 'align' => 'right', "font_size" => $fontSize, 'font' => 'bold'));
             }
         }
     }
     $this->y -= 20;
     $page = $this->drawLineBlocks($page, array($lineBlock));
     return $page;
 }
Esempio n. 3
0
 /**
  * Check whether order entity may be saved
  *
  * Invoice, shipment, creditmemo (address & item?)
  *
  * @param Mage_Sales_Model_Abstract $model
  */
 public function salesOrderEntitySaveBefore($model)
 {
     $this->_salesEntitySaveBefore(Mage::app()->getStore($model->getOrder()->getStoreId())->getWebsiteId());
 }
 /**
  * Insert totals to pdf page
  *
  * @param  Zend_Pdf_Page $page
  * @param  Mage_Sales_Model_Abstract $source
  * @return Zend_Pdf_Page
  */
 protected function insertTotals($page, $source)
 {
     $order = $source->getOrder();
     $totals = $this->_getTotalsList($source);
     $lineBlock = array('lines' => array(), 'height' => 15);
     foreach ($totals as $total) {
         $total->setOrder($order)->setSource($source);
         if ($total->canDisplay()) {
             $total->setFontSize(10);
             foreach ($total->getTotalsForDisplay() as $totalData) {
                 if (isset($totalData['title']) && strpos($totalData['title'], '%') !== false) {
                     $origLabel = $totalData['label'];
                     $totalData['label'] = trim(preg_replace('/\\s*\\([^)]*\\)/', '', $origLabel));
                     #echo "<pre/>";print_r($totalData);die;
                 }
                 Mage::log(print_r($totalData, true), NULL, 'developerTotalAfter.log');
                 $lineBlock['lines'][] = array(array('text' => $totalData['label'], 'feed' => 475, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'), array('text' => $totalData['amount'], 'feed' => 565, 'align' => 'right', 'font_size' => $totalData['font_size'], 'font' => 'bold'));
             }
         }
     }
     $this->y -= 20;
     $page = $this->drawLineBlocks($page, array($lineBlock));
     return $page;
 }