Public Member Functions | |
getPdf ($shipments=array()) | |
newPage (array $settings=array()) |
Definition at line 35 of file Shipment.php.
getPdf | ( | $ | shipments = array() |
) |
Definition at line 37 of file Shipment.php.
00038 { 00039 $this->_beforeGetPdf(); 00040 $this->_initRenderer('shipment'); 00041 00042 $pdf = new Zend_Pdf(); 00043 $this->_setPdf($pdf); 00044 $style = new Zend_Pdf_Style(); 00045 $this->_setFontBold($style, 10); 00046 foreach ($shipments as $shipment) { 00047 if ($shipment->getStoreId()) { 00048 Mage::app()->getLocale()->emulate($shipment->getStoreId()); 00049 } 00050 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); 00051 $pdf->pages[] = $page; 00052 00053 $order = $shipment->getOrder(); 00054 00055 /* Add image */ 00056 $this->insertLogo($page, $shipment->getStore()); 00057 00058 /* Add address */ 00059 $this->insertAddress($page, $shipment->getStore()); 00060 00061 /* Add head */ 00062 $this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, $order->getStoreId())); 00063 00064 $page->setFillColor(new Zend_Pdf_Color_GrayScale(1)); 00065 $this->_setFontRegular($page); 00066 $page->drawText(Mage::helper('sales')->__('Packingslip # ') . $shipment->getIncrementId(), 35, 780, 'UTF-8'); 00067 00068 /* Add table */ 00069 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92)); 00070 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5)); 00071 $page->setLineWidth(0.5); 00072 00073 00074 /* Add table head */ 00075 $page->drawRectangle(25, $this->y, 570, $this->y-15); 00076 $this->y -=10; 00077 $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4)); 00078 $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y, 'UTF-8'); 00079 $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y, 'UTF-8'); 00080 $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y, 'UTF-8'); 00081 00082 $this->y -=15; 00083 00084 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0)); 00085 00086 /* Add body */ 00087 foreach ($shipment->getAllItems() as $item){ 00088 if ($item->getOrderItem()->getParentItem()) { 00089 continue; 00090 } 00091 00092 if ($this->y<15) { 00093 $page = $this->newPage(array('table_header' => true)); 00094 } 00095 00096 /* Draw item */ 00097 $page = $this->_drawItem($item, $page, $order); 00098 } 00099 } 00100 00101 $this->_afterGetPdf(); 00102 00103 if ($shipment->getStoreId()) { 00104 Mage::app()->getLocale()->revert(); 00105 } 00106 return $pdf; 00107 }
Create new page and assign to PDF object
array | $settings |
Reimplemented from Mage_Sales_Model_Order_Pdf_Abstract.
Definition at line 115 of file Shipment.php.
00116 { 00117 /* Add new table head */ 00118 $page = $this->_getPdf()->newPage(Zend_Pdf_Page::SIZE_A4); 00119 $this->_getPdf()->pages[] = $page; 00120 $this->y = 800; 00121 00122 if (!empty($settings['table_header'])) { 00123 $this->_setFontRegular($page); 00124 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92)); 00125 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5)); 00126 $page->setLineWidth(0.5); 00127 $page->drawRectangle(25, $this->y, 570, $this->y-15); 00128 $this->y -=10; 00129 00130 $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4)); 00131 $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y, 'UTF-8'); 00132 $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y, 'UTF-8'); 00133 $page->drawText(Mage::helper('sales')->__('SKU'), 470, $this->y, 'UTF-8'); 00134 00135 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0)); 00136 $this->y -=20; 00137 } 00138 00139 return $page; 00140 }