Mage_Sales_Model_Order_Pdf_Creditmemo Class Reference

Inheritance diagram for Mage_Sales_Model_Order_Pdf_Creditmemo:

Mage_Sales_Model_Order_Pdf_Abstract Varien_Object

List of all members.

Public Member Functions

 getPdf ($creditmemos=array())
 newPage (array $settings=array())

Protected Member Functions

 _drawHeader (Zend_Pdf_Page $page)


Detailed Description

Definition at line 35 of file Creditmemo.php.


Member Function Documentation

_drawHeader ( Zend_Pdf_Page $  page  )  [protected]

Definition at line 107 of file Creditmemo.php.

00108     {
00109         $font = $page->getFont();
00110         $size = $page->getFontSize();
00111 
00112         $page->drawText(Mage::helper('sales')->__('Products'), $x = 35, $this->y, 'UTF-8');
00113         $x += 220;
00114 
00115         $page->drawText(Mage::helper('sales')->__('SKU'), $x, $this->y, 'UTF-8');
00116         $x += 100;
00117 
00118         $text = Mage::helper('sales')->__('Total(ex)');
00119         $page->drawText($text, $this->getAlignRight($text, $x, 50, $font, $size), $this->y, 'UTF-8');
00120         $x += 50;
00121 
00122         $text = Mage::helper('sales')->__('Discount');
00123         $page->drawText($text, $this->getAlignRight($text, $x, 50, $font, $size), $this->y, 'UTF-8');
00124         $x += 50;
00125 
00126         $text = Mage::helper('sales')->__('QTY');
00127         $page->drawText($text, $this->getAlignCenter($text, $x, 30, $font, $size), $this->y, 'UTF-8');
00128         $x += 30;
00129 
00130         $text = Mage::helper('sales')->__('Tax');
00131         $page->drawText($text, $this->getAlignRight($text, $x, 45, $font, $size, 10), $this->y, 'UTF-8');
00132         $x += 45;
00133 
00134         $text = Mage::helper('sales')->__('Total(inc)');
00135         $page->drawText($text, $this->getAlignRight($text, $x, 570 - $x, $font, $size), $this->y, 'UTF-8');
00136     }

getPdf ( creditmemos = array()  ) 

Definition at line 37 of file Creditmemo.php.

00038     {
00039         $this->_beforeGetPdf();
00040         $this->_initRenderer('creditmemo');
00041 
00042         $pdf = new Zend_Pdf();
00043         $this->_setPdf($pdf);
00044         $style = new Zend_Pdf_Style();
00045         $this->_setFontBold($style, 10);
00046 
00047         foreach ($creditmemos as $creditmemo) {
00048             if ($creditmemo->getStoreId()) {
00049                 Mage::app()->getLocale()->emulate($creditmemo->getStoreId());
00050             }
00051             $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
00052             $pdf->pages[] = $page;
00053 
00054             $order = $creditmemo->getOrder();
00055 
00056             /* Add image */
00057             $this->insertLogo($page, $creditmemo->getStore());
00058 
00059             /* Add address */
00060             $this->insertAddress($page, $creditmemo->getStore());
00061 
00062             /* Add head */
00063             $this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_CREDITMEMO_PUT_ORDER_ID, $order->getStoreId()));
00064 
00065             $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
00066             $this->_setFontRegular($page);
00067             $page->drawText(Mage::helper('sales')->__('Credit Memo # ') . $creditmemo->getIncrementId(), 35, 780, 'UTF-8');
00068 
00069             /* Add table head */
00070             $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
00071             $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
00072             $page->setLineWidth(0.5);
00073             $page->drawRectangle(25, $this->y, 570, $this->y-15);
00074             $this->y -=10;
00075             $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
00076             $this->_drawHeader($page);
00077             $this->y -=15;
00078 
00079             $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
00080 
00081             /* Add body */
00082             foreach ($creditmemo->getAllItems() as $item){
00083                 if ($item->getOrderItem()->getParentItem()) {
00084                     continue;
00085                 }
00086 
00087                 if ($this->y<20) {
00088                     $page = $this->newPage(array('table_header' => true));
00089                 }
00090 
00091                 /* Draw item */
00092                 $page = $this->_drawItem($item, $page, $order);
00093             }
00094 
00095             /* Add totals */
00096             $page = $this->insertTotals($page, $creditmemo);
00097         }
00098 
00099         $this->_afterGetPdf();
00100 
00101         if ($creditmemo->getStoreId()) {
00102             Mage::app()->getLocale()->revert();
00103         }
00104         return $pdf;
00105     }

newPage ( array settings = array()  ) 

Create new page and assign to PDF object

Parameters:
array $settings
Returns:
Zend_Pdf_Page

Reimplemented from Mage_Sales_Model_Order_Pdf_Abstract.

Definition at line 144 of file Creditmemo.php.

00145     {
00146         $page = parent::newPage($settings);
00147 
00148         if (!empty($settings['table_header'])) {
00149             $this->_setFontRegular($page);
00150             $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
00151             $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
00152             $page->setLineWidth(0.5);
00153             $page->drawRectangle(25, $this->y, 570, $this->y-15);
00154             $this->y -=10;
00155             $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
00156             $this->_drawHeader($page);
00157             $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
00158             $this->y -=20;
00159         }
00160 
00161         return $page;
00162     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:47 2009 for Magento by  doxygen 1.5.8