00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Sales_Model_Order_Pdf_Items_Invoice_Default extends Mage_Sales_Model_Order_Pdf_Items_Abstract
00036 {
00037
00038
00039
00040
00041 public function draw()
00042 {
00043 $order = $this->getOrder();
00044 $item = $this->getItem();
00045 $pdf = $this->getPdf();
00046 $page = $this->getPage();
00047 $lines = array();
00048
00049
00050 $lines[0] = array(array(
00051 'text' => Mage::helper('core/string')->str_split($item->getName(), 60, true, true),
00052 'feed' => 35,
00053 ));
00054
00055
00056 $lines[0][] = array(
00057 'text' => Mage::helper('core/string')->str_split($this->getSku($item), 25),
00058 'feed' => 240
00059 );
00060
00061
00062 $lines[0][] = array(
00063 'text' => $item->getQty()*1,
00064 'feed' => 435
00065 );
00066
00067 if ($options = $this->getItemOptions()) {
00068 foreach ($options as $option) {
00069
00070 $lines[][] = array(
00071 'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 60, false, true),
00072 'font' => 'italic',
00073 'feed' => 35
00074 );
00075
00076 if ($option['value']) {
00077 $_printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
00078 $values = explode(', ', $_printValue);
00079 foreach ($values as $value) {
00080 $lines[][] = array(
00081 'text' => Mage::helper('core/string')->str_split($value, 55, true, true),
00082 'feed' => 40
00083 );
00084 }
00085 }
00086 }
00087 }
00088
00089
00090 $lines[0][] = array(
00091 'text' => $order->formatPriceTxt($item->getPrice()),
00092 'feed' => 395,
00093 'font' => 'bold',
00094 'align' => 'right'
00095 );
00096
00097
00098 $lines[0][] = array(
00099 'text' => $order->formatPriceTxt($item->getTaxAmount()),
00100 'feed' => 495,
00101 'font' => 'bold',
00102 'align' => 'right'
00103 );
00104
00105
00106 $lines[0][] = array(
00107 'text' => $order->formatPriceTxt($item->getRowTotal()),
00108 'feed' => 565,
00109 'font' => 'bold',
00110 'align' => 'right'
00111 );
00112
00113 $lineBlock = array(
00114 'lines' => $lines,
00115 'height' => 10
00116 );
00117
00118 $page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
00119 $this->setPage($page);
00120 }
00121 }