Version Notes
- [FEATURE] 1.8 compatibility
- [FEATURE] added possibility to print order ID barcodes on shipment PDFs
- [FEATURE] added possibility to print shipment type on shipment PDFs
- [FEATURE] added universal event, so that developers can add custom stuff anywhere they want via observers
- [FEATURE] added possibility to use a full-width logo
- [FEATURE] configuration option whether to print the customer number
- [FEATURE] possibility to add invoice comments on invoice PDF
- [FEATURE] dutch translation
- [BUGFIX] fixed error when there is no country in the imprint
- [BUGFIX] print shipping address instead of invoice address on shipment PDF
- [MISC] respect FireGento coding guidelines
Download this release
Release Info
Developer | FireGento Team |
Extension | FireGento_Pdf |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
- app/code/community/FireGento/Pdf/Block/Adminhtml/ColumnOrder.php +52 -12
- app/code/community/FireGento/Pdf/Helper/Data.php +63 -14
- app/code/community/FireGento/Pdf/Model/Creditmemo.php +15 -3
- app/code/community/FireGento/Pdf/Model/Engine/Abstract.php +426 -150
- app/code/community/FireGento/Pdf/Model/Engine/Creditmemo/Default.php +65 -42
- app/code/community/FireGento/Pdf/Model/Engine/Invoice/Default.php +27 -34
- app/code/community/FireGento/Pdf/Model/Engine/Shipment/Default.php +73 -38
- app/code/community/FireGento/Pdf/Model/Invoice.php +16 -3
- app/code/community/FireGento/Pdf/Model/Items/Bundle.php +39 -39
- app/code/community/FireGento/Pdf/Model/Items/Default.php +48 -53
- app/code/community/FireGento/Pdf/Model/Items/Grouped.php +5 -4
- app/code/community/FireGento/Pdf/Model/Items/Shipment/Bundle.php +5 -8
- app/code/community/FireGento/Pdf/Model/Items/Shipment/Default.php +7 -7
- app/code/community/FireGento/Pdf/Model/Observer.php +125 -13
- app/code/community/FireGento/Pdf/Model/Shipment.php +16 -3
- app/code/community/FireGento/Pdf/Model/System/Config/Source/Creditmemo/Engine.php +5 -5
- app/code/community/FireGento/Pdf/Model/System/Config/Source/Invoice/Engine.php +5 -5
- app/code/community/FireGento/Pdf/Model/System/Config/Source/Logo.php +13 -7
- app/code/community/FireGento/Pdf/Model/System/Config/Source/Payment.php +3 -3
- app/code/community/FireGento/Pdf/Model/System/Config/Source/Shipment/Engine.php +5 -5
- app/code/community/FireGento/Pdf/Model/System/Config/Source/Shipping.php +3 -3
- app/code/community/FireGento/Pdf/Model/Tax/Sales/Pdf/Grandtotal.php +6 -5
- app/code/community/FireGento/Pdf/controllers/Sales/OrderController.php +8 -9
- app/code/community/FireGento/Pdf/etc/config.xml +34 -4
- app/code/community/FireGento/Pdf/etc/system.xml +82 -15
- app/code/community/FireGento/Pdf/sql/firegento_pdf_setup/upgrade-1.0.0-1.1.0.php +2 -16
- app/locale/de_AT/FireGento_Pdf.csv +2 -0
- app/locale/de_DE/FireGento_Pdf.csv +10 -1
- app/locale/nl_NL/FireGento_Pdf.csv +88 -0
- package.xml +15 -5
app/code/community/FireGento/Pdf/Block/Adminhtml/ColumnOrder.php
CHANGED
@@ -1,18 +1,44 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* Firegento
|
4 |
*
|
5 |
-
* @category
|
6 |
* @package FireGento_Pdf
|
7 |
* @author FireGento Team <team@firegento.com>
|
8 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
9 |
-
* @license http://opensource.org/licenses/
|
10 |
*/
|
11 |
class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
12 |
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
13 |
{
|
14 |
-
protected $
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
17 |
{
|
18 |
return '
|
@@ -21,7 +47,8 @@ class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
|
21 |
<ul id="' . $element->getHtmlId() . '_list" class="orderable_config">
|
22 |
' . $this->_getSortableListHtml($element) . '
|
23 |
</ul>
|
24 |
-
<input type="hidden" value="' . $element->getValue() . '" name="' . $element->getName() .
|
|
|
25 |
<script type="text/javascript">
|
26 |
Sortable.create("' . $element->getHtmlId() . '_list", {
|
27 |
onUpdate: function() {
|
@@ -46,15 +73,14 @@ class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
|
46 |
});
|
47 |
validateSortableWidth = function () {
|
48 |
var newWidth=0;
|
49 |
-
console.log("Calculation columns width");
|
50 |
$A($("' . $element->getHtmlId() . '_list").children).each(function(item){
|
51 |
var current = $(item).attributes["data-column"].value;
|
52 |
if ($(item.attributes["data-width"])) {
|
53 |
newWidth += parseInt($(item).attributes["data-width"].value);
|
54 |
} else if ("disabled" == current) {
|
55 |
-
console.log(newWidth);
|
56 |
if (240 < newWidth) {
|
57 |
-
$("' . $element->getHtmlId() . '_warning").innerHTML = "'
|
|
|
58 |
$("' . $element->getHtmlId() . '_warning").show();
|
59 |
} else {
|
60 |
$("' . $element->getHtmlId() . '_warning").hide();
|
@@ -67,6 +93,13 @@ class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
|
67 |
';
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
protected function _getSortableListHtml(Varien_Data_Form_Element_Abstract $element)
|
71 |
{
|
72 |
$availableItems = array(
|
@@ -88,20 +121,27 @@ class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
|
88 |
}
|
89 |
|
90 |
$this->_addListItems($activeItems);
|
91 |
-
$this->
|
92 |
<div id="' . $element->getHtmlId() . '_warning" style="display:none" class="validation-advice"></div>
|
93 |
<br />
|
94 |
' . $this->__('not to be listed') . '
|
95 |
</li>';
|
96 |
$this->_addListItems($availableItems);
|
97 |
|
98 |
-
return $this->
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
protected function _addListItems($items)
|
102 |
{
|
103 |
foreach ($items as $name=>$item) {
|
104 |
-
$this->
|
105 |
'<li id="pdf-column-%s" data-column="%s" data-width="%s">%s</li>',
|
106 |
$name,
|
107 |
$name,
|
@@ -111,4 +151,4 @@ class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
|
111 |
}
|
112 |
return $this;
|
113 |
}
|
114 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of a FireGento e.V. module.
|
4 |
+
*
|
5 |
+
* This FireGento e.V. module is free software; you can redistribute it and/or
|
6 |
+
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
+
* published by the Free Software Foundation.
|
8 |
+
*
|
9 |
+
* This script is distributed in the hope that it will be useful, but WITHOUT
|
10 |
+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11 |
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
12 |
+
*
|
13 |
+
* PHP version 5
|
14 |
+
*
|
15 |
+
* @category FireGento
|
16 |
+
* @package FireGento_Pdf
|
17 |
+
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
+
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
+
*/
|
21 |
/**
|
22 |
* Firegento
|
23 |
*
|
24 |
+
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
28 |
+
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
*/
|
30 |
class Firegento_Pdf_Block_Adminhtml_ColumnOrder
|
31 |
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
32 |
{
|
33 |
+
protected $_sortableListHtml = '';
|
34 |
|
35 |
+
/**
|
36 |
+
* generate html for orderable list
|
37 |
+
*
|
38 |
+
* @param Varien_Data_Form_Element_Abstract $element form element to render
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
43 |
{
|
44 |
return '
|
47 |
<ul id="' . $element->getHtmlId() . '_list" class="orderable_config">
|
48 |
' . $this->_getSortableListHtml($element) . '
|
49 |
</ul>
|
50 |
+
<input type="hidden" value="' . $element->getValue() . '" name="' . $element->getName() .
|
51 |
+
'" id="' . $element->getHtmlId() . '">
|
52 |
<script type="text/javascript">
|
53 |
Sortable.create("' . $element->getHtmlId() . '_list", {
|
54 |
onUpdate: function() {
|
73 |
});
|
74 |
validateSortableWidth = function () {
|
75 |
var newWidth=0;
|
|
|
76 |
$A($("' . $element->getHtmlId() . '_list").children).each(function(item){
|
77 |
var current = $(item).attributes["data-column"].value;
|
78 |
if ($(item.attributes["data-width"])) {
|
79 |
newWidth += parseInt($(item).attributes["data-width"].value);
|
80 |
} else if ("disabled" == current) {
|
|
|
81 |
if (240 < newWidth) {
|
82 |
+
$("' . $element->getHtmlId() . '_warning").innerHTML = "'
|
83 |
+
. $this->__('Caution: Your columns may overlap!') . '";
|
84 |
$("' . $element->getHtmlId() . '_warning").show();
|
85 |
} else {
|
86 |
$("' . $element->getHtmlId() . '_warning").hide();
|
93 |
';
|
94 |
}
|
95 |
|
96 |
+
/**
|
97 |
+
* get html for list
|
98 |
+
*
|
99 |
+
* @param Varien_Data_Form_Element_Abstract $element form element to render
|
100 |
+
*
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
protected function _getSortableListHtml(Varien_Data_Form_Element_Abstract $element)
|
104 |
{
|
105 |
$availableItems = array(
|
121 |
}
|
122 |
|
123 |
$this->_addListItems($activeItems);
|
124 |
+
$this->_sortableListHtml .= '<li id="pdf-column-disabled" data-column="disabled" style="list-style:none">
|
125 |
<div id="' . $element->getHtmlId() . '_warning" style="display:none" class="validation-advice"></div>
|
126 |
<br />
|
127 |
' . $this->__('not to be listed') . '
|
128 |
</li>';
|
129 |
$this->_addListItems($availableItems);
|
130 |
|
131 |
+
return $this->_sortableListHtml;
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* add items to list
|
136 |
+
*
|
137 |
+
* @param array $items items to add
|
138 |
+
*
|
139 |
+
* @return $this
|
140 |
+
*/
|
141 |
protected function _addListItems($items)
|
142 |
{
|
143 |
foreach ($items as $name=>$item) {
|
144 |
+
$this->_sortableListHtml .= sprintf(
|
145 |
'<li id="pdf-column-%s" data-column="%s" data-width="%s">%s</li>',
|
146 |
$name,
|
147 |
$name,
|
151 |
}
|
152 |
return $this;
|
153 |
}
|
154 |
+
}
|
app/code/community/FireGento/Pdf/Helper/Data.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,37 +26,55 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
33 |
*/
|
34 |
class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Return the order id or false if order id should not be displayed on document.
|
38 |
*
|
39 |
-
* @param
|
40 |
-
* @param
|
|
|
41 |
* @return mixed
|
42 |
*/
|
43 |
public function putOrderId(Mage_Sales_Model_Order $order, $mode = 'invoice')
|
44 |
{
|
45 |
switch ($mode) {
|
46 |
case 'invoice':
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
return $order->getRealOrderId();
|
49 |
}
|
50 |
break;
|
51 |
|
52 |
case 'shipment':
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
return $order->getRealOrderId();
|
55 |
}
|
56 |
break;
|
57 |
|
58 |
case 'creditmemo':
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
return $order->getRealOrderId();
|
61 |
}
|
62 |
break;
|
@@ -64,13 +82,44 @@ class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
|
|
64 |
return false;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
/**
|
68 |
* Return scaled image sizes based on an path to an image file.
|
69 |
*
|
70 |
-
* @param
|
71 |
-
* @param
|
72 |
-
* @param
|
73 |
-
*
|
|
|
74 |
*/
|
75 |
public function getScaledImageSize($image, $maxWidth, $maxHeight)
|
76 |
{
|
@@ -90,9 +139,9 @@ class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
|
|
90 |
|
91 |
// Calculate new dimensions.
|
92 |
$height = round($height * $scale);
|
93 |
-
$width
|
94 |
}
|
95 |
|
96 |
return array($width, $height);
|
97 |
}
|
98 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
33 |
*/
|
34 |
class FireGento_Pdf_Helper_Data extends Mage_Core_Helper_Abstract
|
35 |
{
|
36 |
+
const XML_PATH_FIREGENTO_PDF_LOGO_POSITION = 'sales_pdf/firegento_pdf/logo_position';
|
37 |
+
const XML_PATH_SALES_PDF_INVOICE_SHOW_CUSTOMER_NUMBER = 'sales_pdf/invoice/show_customer_number';
|
38 |
+
const XML_PATH_SALES_PDF_SHIPMENT_SHOW_CUSTOMER_NUMBER = 'sales_pdf/shipment/show_customer_number';
|
39 |
+
const XML_PATH_SALES_PDF_CREDITMEMO_SHOW_CUSTOMER_NUMBER = 'sales_pdf/creditmemo/show_customer_number';
|
40 |
+
|
41 |
/**
|
42 |
* Return the order id or false if order id should not be displayed on document.
|
43 |
*
|
44 |
+
* @param Mage_Sales_Model_Order $order order to get id from
|
45 |
+
* @param string $mode differ between creditmemo, invoice, etc.
|
46 |
+
*
|
47 |
* @return mixed
|
48 |
*/
|
49 |
public function putOrderId(Mage_Sales_Model_Order $order, $mode = 'invoice')
|
50 |
{
|
51 |
switch ($mode) {
|
52 |
case 'invoice':
|
53 |
+
$putOrderIdOnInvoice = Mage::getStoreConfigFlag(
|
54 |
+
Mage_Sales_Model_Order_Pdf_Abstract::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID,
|
55 |
+
$order->getStoreId()
|
56 |
+
);
|
57 |
+
if ($putOrderIdOnInvoice) {
|
58 |
return $order->getRealOrderId();
|
59 |
}
|
60 |
break;
|
61 |
|
62 |
case 'shipment':
|
63 |
+
$putOrderIdOnShipment = Mage::getStoreConfigFlag(
|
64 |
+
Mage_Sales_Model_Order_Pdf_Abstract::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID,
|
65 |
+
$order->getStoreId()
|
66 |
+
);
|
67 |
+
if ($putOrderIdOnShipment) {
|
68 |
return $order->getRealOrderId();
|
69 |
}
|
70 |
break;
|
71 |
|
72 |
case 'creditmemo':
|
73 |
+
$putOrderIdOnCreditmemo = Mage::getStoreConfigFlag(
|
74 |
+
Mage_Sales_Model_Order_Pdf_Abstract::XML_PATH_SALES_PDF_CREDITMEMO_PUT_ORDER_ID,
|
75 |
+
$order->getStoreId()
|
76 |
+
);
|
77 |
+
if ($putOrderIdOnCreditmemo) {
|
78 |
return $order->getRealOrderId();
|
79 |
}
|
80 |
break;
|
82 |
return false;
|
83 |
}
|
84 |
|
85 |
+
/**
|
86 |
+
* @param mixed $store
|
87 |
+
*
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
public function isLogoFullWidth($store)
|
91 |
+
{
|
92 |
+
$configSetting = Mage::getStoreConfig(self::XML_PATH_FIREGENTO_PDF_LOGO_POSITION, $store);
|
93 |
+
return $configSetting == FireGento_Pdf_Model_System_Config_Source_Logo::FULL_WIDTH;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @param string $mode
|
98 |
+
* @param mixed $store
|
99 |
+
*
|
100 |
+
* @return bool
|
101 |
+
*/
|
102 |
+
public function showCustomerNumber($mode = 'invoice', $store)
|
103 |
+
{
|
104 |
+
switch ($mode) {
|
105 |
+
case 'invoice':
|
106 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_SHOW_CUSTOMER_NUMBER, $store);
|
107 |
+
case 'shipment':
|
108 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_SHIPMENT_SHOW_CUSTOMER_NUMBER, $store);
|
109 |
+
case 'creditmemo':
|
110 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_CREDITMEMO_SHOW_CUSTOMER_NUMBER, $store);
|
111 |
+
}
|
112 |
+
return true; // backwards compatibility
|
113 |
+
}
|
114 |
+
|
115 |
/**
|
116 |
* Return scaled image sizes based on an path to an image file.
|
117 |
*
|
118 |
+
* @param string $image Url to image file.
|
119 |
+
* @param int $maxWidth max width the image can have
|
120 |
+
* @param int $maxHeight max height the image can have
|
121 |
+
*
|
122 |
+
* @return array with 2 elements - width and height.
|
123 |
*/
|
124 |
public function getScaledImageSize($image, $maxWidth, $maxHeight)
|
125 |
{
|
139 |
|
140 |
// Calculate new dimensions.
|
141 |
$height = round($height * $scale);
|
142 |
+
$width = round($width * $scale);
|
143 |
}
|
144 |
|
145 |
return array($width, $height);
|
146 |
}
|
147 |
+
}
|
app/code/community/FireGento/Pdf/Model/Creditmemo.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -40,6 +40,11 @@ class FireGento_Pdf_Model_Creditmemo
|
|
40 |
*/
|
41 |
private $_engine;
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
protected function getEngine()
|
44 |
{
|
45 |
if (!$this->_engine) {
|
@@ -57,6 +62,13 @@ class FireGento_Pdf_Model_Creditmemo
|
|
57 |
return $this->_engine;
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function getPdf($creditmemos = array())
|
61 |
{
|
62 |
return $this->getEngine()->getPdf($creditmemos);
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
40 |
*/
|
41 |
private $_engine;
|
42 |
|
43 |
+
/**
|
44 |
+
* get pdf renderer engine
|
45 |
+
*
|
46 |
+
* @return Mage_Sales_Model_Order_Pdf_Abstract|Mage_Sales_Model_Order_Pdf_Creditmemo
|
47 |
+
*/
|
48 |
protected function getEngine()
|
49 |
{
|
50 |
if (!$this->_engine) {
|
62 |
return $this->_engine;
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* get pdf object
|
67 |
+
*
|
68 |
+
* @param array $creditmemos creditmemos to render
|
69 |
+
*
|
70 |
+
* @return Zend_Pdf
|
71 |
+
*/
|
72 |
public function getPdf($creditmemos = array())
|
73 |
{
|
74 |
return $this->getEngine()->getPdf($creditmemos);
|
app/code/community/FireGento/Pdf/Model/Engine/Abstract.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -39,8 +39,16 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
39 |
public $encoding;
|
40 |
public $pagecounter;
|
41 |
|
42 |
-
protected $
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
public function __construct()
|
45 |
{
|
46 |
parent::__construct();
|
@@ -51,15 +59,16 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
51 |
$this->colors['grey1'] = new Zend_Pdf_Color_GrayScale(0.9);
|
52 |
|
53 |
// get the default imprint
|
54 |
-
$this->
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
*
|
|
|
|
|
|
|
|
|
59 |
*
|
60 |
-
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
61 |
-
* @param array $draw
|
62 |
-
* @param array $pageSettings
|
63 |
* @return Zend_Pdf_Page
|
64 |
*/
|
65 |
public function drawLineBlocks(Zend_Pdf_Page $page, array $draw, array $pageSettings = array())
|
@@ -82,7 +91,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
82 |
}
|
83 |
$top = 0;
|
84 |
foreach ($column['text'] as $part) {
|
85 |
-
$top += $lineSpacing;
|
86 |
}
|
87 |
|
88 |
$maxHeight = $top > $maxHeight ? $top : $maxHeight;
|
@@ -92,7 +101,10 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
92 |
$itemsProp['shift'] = $shift;
|
93 |
}
|
94 |
|
95 |
-
if ($this->y - $itemsProp['shift'] < 50
|
|
|
|
|
|
|
96 |
$page = $this->newPage($pageSettings);
|
97 |
}
|
98 |
|
@@ -158,8 +170,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
158 |
/**
|
159 |
* Set pdf mode.
|
160 |
*
|
161 |
-
* @param
|
162 |
-
*
|
|
|
163 |
*/
|
164 |
public function setMode($mode)
|
165 |
{
|
@@ -180,7 +193,8 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
180 |
/**
|
181 |
* Set next line position
|
182 |
*
|
183 |
-
* @param
|
|
|
184 |
* @return void
|
185 |
*/
|
186 |
protected function Ln($height = 15)
|
@@ -189,27 +203,59 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
189 |
}
|
190 |
|
191 |
/**
|
192 |
-
* Insert sender address bar
|
|
|
|
|
193 |
*
|
194 |
-
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
195 |
* @return void
|
196 |
*/
|
197 |
protected function _insertSenderAddessBar(&$page)
|
198 |
{
|
199 |
if (Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar') != '') {
|
200 |
$this->_setFontRegular($page, 6);
|
201 |
-
$page->drawText(
|
|
|
|
|
|
|
202 |
}
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
* Insert logo
|
207 |
*
|
208 |
-
* @param
|
209 |
-
* @param
|
|
|
210 |
* @return void
|
211 |
*/
|
212 |
protected function insertLogo(&$page, $store = null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
{
|
214 |
$maxwidth = ($this->margin['right'] - $this->margin['left']);
|
215 |
$maxheight = 100;
|
@@ -227,7 +273,9 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
227 |
|
228 |
switch ($logoPosition) {
|
229 |
case 'center':
|
230 |
-
$startLogoAt
|
|
|
|
|
231 |
break;
|
232 |
case 'right':
|
233 |
$startLogoAt = $this->margin['right'] - $width;
|
@@ -247,13 +295,89 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
247 |
}
|
248 |
|
249 |
/**
|
250 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
*
|
252 |
-
* @param object $page Current page object of Zend_Pdf
|
253 |
-
* @param object $order Order object
|
254 |
* @return void
|
255 |
*/
|
256 |
-
protected function
|
257 |
{
|
258 |
$this->_setFontRegular($page, 9);
|
259 |
$billing = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
|
@@ -266,9 +390,10 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
266 |
/**
|
267 |
* Insert Header
|
268 |
*
|
269 |
-
* @param
|
270 |
-
* @param
|
271 |
-
* @param
|
|
|
272 |
* @return void
|
273 |
*/
|
274 |
protected function insertHeader(&$page, $order, $document)
|
@@ -281,7 +406,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
281 |
|
282 |
if ($mode == 'invoice') {
|
283 |
$title = 'Invoice';
|
284 |
-
}
|
285 |
$title = 'Shipment';
|
286 |
} else {
|
287 |
$title = 'Creditmemo';
|
@@ -302,73 +427,114 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
302 |
// Invoice/shipment/creditmemo Number
|
303 |
if ($mode == 'invoice') {
|
304 |
$numberTitle = 'Invoice number:';
|
305 |
-
}
|
306 |
$numberTitle = 'Shipment number:';
|
307 |
} else {
|
308 |
$numberTitle = 'Creditmemo number:';
|
309 |
}
|
310 |
-
$page->drawText(
|
|
|
|
|
|
|
311 |
|
312 |
$incrementId = $document->getIncrementId();
|
313 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
314 |
$this->Ln();
|
315 |
$numberOfLines++;
|
316 |
|
317 |
// Order Number
|
318 |
$putOrderId = $this->_putOrderId($order);
|
319 |
if ($putOrderId) {
|
320 |
-
$page->drawText(
|
321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
$this->Ln();
|
323 |
$numberOfLines++;
|
324 |
}
|
325 |
|
326 |
// Customer Number
|
327 |
-
$
|
328 |
-
|
|
|
|
|
329 |
|
330 |
-
|
331 |
|
332 |
-
|
333 |
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
} else {
|
337 |
-
$
|
|
|
|
|
338 |
}
|
339 |
-
|
340 |
-
$page->drawText($customerid, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($customerid, $font, 10)), $this->y, $this->encoding);
|
341 |
-
$this->Ln();
|
342 |
-
$numberOfLines++;
|
343 |
-
} else {
|
344 |
-
$page->drawText('-', ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize('-', $font, 10)), $this->y, $this->encoding);
|
345 |
-
$this->Ln();
|
346 |
-
$numberOfLines++;
|
347 |
}
|
348 |
|
349 |
// Customer IP
|
350 |
if (!Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $order->getStoreId())) {
|
351 |
-
$page->drawText(
|
|
|
|
|
|
|
352 |
$customerIP = $order->getData('remote_ip');
|
353 |
$font = $this->_setFontRegular($page, 10);
|
354 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
355 |
$this->Ln();
|
356 |
$numberOfLines++;
|
357 |
}
|
358 |
|
359 |
-
$page->drawText(
|
|
|
|
|
|
|
360 |
$documentDate = Mage::helper('core')->formatDate($document->getCreatedAtDate(), 'medium', false);
|
361 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
362 |
$this->Ln();
|
363 |
$numberOfLines++;
|
364 |
|
365 |
|
366 |
// Payment method.
|
367 |
-
$putPaymentMethod = ($mode == 'invoice'
|
|
|
|
|
368 |
if ($putPaymentMethod) {
|
369 |
-
$page->drawText(
|
370 |
-
|
371 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
$this->Ln();
|
373 |
$numberOfLines++;
|
374 |
$paymentMethodArray = $this->_prepareText(implode(" ", $paymentMethodArray), $page, $font, 10, 2 * $width);
|
@@ -381,14 +547,27 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
381 |
}
|
382 |
|
383 |
// Shipping method.
|
384 |
-
$putShippingMethod = ($mode == 'invoice'
|
|
|
|
|
|
|
|
|
|
|
385 |
if ($putShippingMethod) {
|
386 |
-
$page->drawText(
|
|
|
|
|
|
|
387 |
$shippingMethodArray = $this->_prepareText($order->getShippingDescription(), $page, $font, 10, $width);
|
388 |
-
$page->drawText(
|
|
|
|
|
|
|
389 |
$this->Ln();
|
390 |
$numberOfLines++;
|
391 |
-
$shippingMethodArray = $this->_prepareText(
|
|
|
|
|
392 |
foreach ($shippingMethodArray as $methodString) {
|
393 |
$page->drawText($methodString, $this->margin['right'] - $labelRightOffset, $this->y, $this->encoding);
|
394 |
$this->Ln();
|
@@ -396,24 +575,36 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
396 |
}
|
397 |
|
398 |
}
|
399 |
-
$this->y -= ($numberOfLines*2);
|
400 |
}
|
401 |
|
402 |
/**
|
403 |
* Return the order id or false if order id should not be displayed on document.
|
404 |
*
|
405 |
-
* @param $order
|
406 |
-
*
|
|
|
407 |
*/
|
408 |
protected function _putOrderId($order)
|
409 |
{
|
410 |
return Mage::helper('firegento_pdf')->putOrderId($order, $this->mode);
|
411 |
}
|
412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
/**
|
414 |
* Generate new PDF page.
|
415 |
*
|
416 |
-
* @param
|
|
|
417 |
* @return Zend_Pdf_Page
|
418 |
*/
|
419 |
public function newPage(array $settings = array())
|
@@ -426,6 +617,12 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
426 |
|
427 |
$this->_addFooter($page, Mage::app()->getStore());
|
428 |
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
$this->y = 800;
|
430 |
$this->_setFontRegular($page, 9);
|
431 |
|
@@ -433,12 +630,13 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
433 |
}
|
434 |
|
435 |
/**
|
436 |
-
*
|
|
|
|
|
|
|
|
|
|
|
437 |
*
|
438 |
-
* @param Varien_Object $item
|
439 |
-
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
440 |
-
* @param Mage_Sales_Model_Order $order
|
441 |
-
* @param int $position
|
442 |
* @return Zend_Pdf_Page
|
443 |
*/
|
444 |
protected function _drawItem(Varien_Object $item, Zend_Pdf_Page $page, Mage_Sales_Model_Order $order, $position = 1)
|
@@ -459,9 +657,10 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
459 |
/**
|
460 |
* Insert Totals Block
|
461 |
*
|
462 |
-
* @param
|
463 |
-
* @param
|
464 |
-
*
|
|
|
465 |
*/
|
466 |
protected function insertTotals($page, $source)
|
467 |
{
|
@@ -469,12 +668,14 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
469 |
|
470 |
$order = $source->getOrder();
|
471 |
|
472 |
-
$
|
473 |
$shippingTaxRate = 0;
|
474 |
$shippingTaxAmount = $order->getShippingTaxAmount();
|
475 |
|
476 |
if ($shippingTaxAmount > 0) {
|
477 |
-
$shippingTaxRate
|
|
|
|
|
478 |
}
|
479 |
|
480 |
$groupedTax = array();
|
@@ -487,24 +688,34 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
487 |
$items['items'][] = $item->getOrderItem()->toArray();
|
488 |
}
|
489 |
|
490 |
-
array_push(
|
491 |
-
'
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
|
|
|
|
496 |
|
497 |
foreach ($items['items'] as $item) {
|
498 |
$_percent = null;
|
499 |
-
if (!isset($item['tax_amount']))
|
500 |
-
|
501 |
-
|
502 |
-
if (!isset($item['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
if (((float)$item['tax_amount'] > 0) && ((float)$item['row_invoiced'] > 0)) {
|
504 |
$_percent = round($item["tax_percent"], 0);
|
505 |
}
|
506 |
if (!array_key_exists('tax_inc_subtotal', $item) || $item['tax_inc_subtotal']) {
|
507 |
-
$
|
508 |
}
|
509 |
if (($item['tax_amount']) && $_percent) {
|
510 |
if (!array_key_exists((int)$_percent, $groupedTax)) {
|
@@ -518,7 +729,7 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
518 |
$totals = $this->_getTotalsList($source);
|
519 |
|
520 |
$lineBlock = array(
|
521 |
-
'lines'
|
522 |
'height' => 20
|
523 |
);
|
524 |
|
@@ -527,7 +738,10 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
527 |
|
528 |
if ($total->canDisplay()) {
|
529 |
$total->setFontSize(10);
|
530 |
-
|
|
|
|
|
|
|
531 |
$lineBlock['lines'][] = array(
|
532 |
array(
|
533 |
'text' => $totalData['label'],
|
@@ -552,10 +766,11 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
552 |
/**
|
553 |
* Insert Notes
|
554 |
*
|
555 |
-
* @param
|
556 |
-
* @param
|
557 |
-
* @param
|
558 |
-
*
|
|
|
559 |
*/
|
560 |
protected function _insertNote($page, &$order, &$model)
|
561 |
{
|
@@ -564,16 +779,14 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
564 |
$this->y = $this->y - 60;
|
565 |
|
566 |
$notes = array();
|
567 |
-
|
568 |
$result = new Varien_Object();
|
569 |
$result->setNotes($notes);
|
570 |
-
Mage::dispatchEvent(
|
|
|
|
|
|
|
571 |
$notes = array_merge($notes, $result->getNotes());
|
572 |
|
573 |
-
if ($this->getMode() === 'invoice') {
|
574 |
-
$notes[] = Mage::helper('firegento_pdf')->__('Invoice date is equal to delivery date.');
|
575 |
-
}
|
576 |
-
|
577 |
// Get free text notes.
|
578 |
$note = Mage::getStoreConfig('sales_pdf/' . $this->getMode() . '/note');
|
579 |
if (!empty($note)) {
|
@@ -586,7 +799,10 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
586 |
// prepare the text so that it fits to the paper
|
587 |
foreach ($this->_prepareText($note, $page, $font, 10) as $tmpNote) {
|
588 |
// create a new page if necessary
|
589 |
-
if ($this->y < 50
|
|
|
|
|
|
|
590 |
$page = $this->newPage(array());
|
591 |
$this->y = $this->y - 60;
|
592 |
$font = $this->_setFontRegular($page, $fontSize);
|
@@ -598,15 +814,21 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
598 |
return $page;
|
599 |
}
|
600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
protected function _addFooter(&$page, $store = null)
|
602 |
{
|
603 |
// get the imprint of the store if a store is set
|
604 |
if (!empty($store)) {
|
605 |
-
$this->
|
606 |
}
|
607 |
|
608 |
// Add footer if GermanSetup is installed.
|
609 |
-
if ($this->
|
610 |
$this->y = 110;
|
611 |
$this->_insertFooter($page);
|
612 |
|
@@ -619,7 +841,8 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
619 |
/**
|
620 |
* Insert footer
|
621 |
*
|
622 |
-
* @param
|
|
|
623 |
* @return void
|
624 |
*/
|
625 |
protected function _insertFooter(&$page)
|
@@ -633,39 +856,41 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
633 |
|
634 |
$fields = array(
|
635 |
'telephone' => Mage::helper('firegento_pdf')->__('Telephone:'),
|
636 |
-
'fax'
|
637 |
-
'email'
|
638 |
-
'web'
|
639 |
);
|
640 |
$this->_insertFooterBlock($page, $fields, 70, 40, 140);
|
641 |
|
642 |
$fields = array(
|
643 |
-
'bank_name'
|
644 |
-
'bank_account'
|
645 |
-
'bank_code_number'
|
646 |
'bank_account_owner' => Mage::helper('firegento_pdf')->__('Account owner:'),
|
647 |
-
'swift'
|
648 |
-
'iban'
|
649 |
);
|
650 |
-
$this->_insertFooterBlock($page, $fields, 215, 50,
|
651 |
|
652 |
$fields = array(
|
653 |
-
'tax_number'
|
654 |
-
'vat_id'
|
655 |
'register_number' => Mage::helper('firegento_pdf')->__('Register number:'),
|
656 |
-
'ceo'
|
657 |
);
|
658 |
-
$this->_insertFooterBlock($page, $fields, 355, 60, $this->margin['right'] -
|
659 |
}
|
660 |
|
661 |
/**
|
662 |
* Insert footer block
|
663 |
*
|
664 |
-
* @param
|
665 |
-
* @param
|
666 |
-
* @param
|
667 |
-
* @param
|
668 |
-
* @param
|
|
|
|
|
669 |
* @return void
|
670 |
*/
|
671 |
protected function _insertFooterBlock(&$page, $fields, $colposition = 0, $valadjust = 30, $colwidth = null)
|
@@ -678,13 +903,13 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
678 |
|
679 |
if (is_array($fields)) {
|
680 |
foreach ($fields as $field => $label) {
|
681 |
-
if (empty($this->
|
682 |
continue;
|
683 |
}
|
684 |
// draw the label
|
685 |
$page->drawText($label, $this->margin['left'] + $colposition, $y, $this->encoding);
|
686 |
// prepare the value: wrap it if necessary
|
687 |
-
$val = $this->
|
688 |
$width = $colwidth;
|
689 |
if (!empty($colwidth)) {
|
690 |
// calculate the maximum width for the value
|
@@ -701,24 +926,37 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
701 |
/**
|
702 |
* Insert addess of store owner
|
703 |
*
|
704 |
-
* @param
|
705 |
-
* @param
|
|
|
706 |
* @return void
|
707 |
*/
|
708 |
protected function _insertFooterAddress(&$page, $store = null)
|
709 |
{
|
710 |
-
$
|
|
|
|
|
|
|
711 |
|
712 |
-
|
713 |
-
$address .= $
|
714 |
}
|
715 |
|
716 |
-
|
717 |
-
|
718 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
|
720 |
-
$this->_setFontRegular($page, 7);
|
721 |
-
$y = $this->y;
|
722 |
foreach (explode("\n", $address) as $value) {
|
723 |
if ($value !== '') {
|
724 |
$page->drawText(trim(strip_tags($value)), $this->margin['left'] - 20, $y, $this->encoding);
|
@@ -730,53 +968,91 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
730 |
/**
|
731 |
* Insert page counter
|
732 |
*
|
733 |
-
* @param
|
|
|
734 |
* @return void
|
735 |
*/
|
736 |
protected function _insertPageCounter(&$page)
|
737 |
{
|
738 |
$font = $this->_setFontRegular($page, 9);
|
739 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
740 |
}
|
741 |
|
742 |
/**
|
743 |
* Set default font
|
744 |
*
|
745 |
-
* @param
|
746 |
-
* @param
|
|
|
747 |
* @return Zend_Pdf_Resource_Font
|
748 |
*/
|
749 |
protected function _setFontRegular($object, $size = 10)
|
750 |
{
|
751 |
-
$font =
|
752 |
$object->setFont($font, $size);
|
753 |
return $font;
|
754 |
}
|
755 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
756 |
/**
|
757 |
* Set bold font
|
758 |
*
|
759 |
-
* @param
|
760 |
-
* @param
|
|
|
761 |
* @return Zend_Pdf_Resource_Font
|
762 |
*/
|
763 |
protected function _setFontBold($object, $size = 10)
|
764 |
{
|
765 |
-
$font =
|
766 |
$object->setFont($font, $size);
|
767 |
return $font;
|
768 |
}
|
769 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
/**
|
771 |
* Set italic font
|
772 |
*
|
773 |
-
* @param
|
774 |
-
* @param
|
|
|
775 |
* @return Zend_Pdf_Resource_Font
|
776 |
*/
|
777 |
protected function _setFontItalic($object, $size = 10)
|
778 |
{
|
779 |
-
$font =
|
780 |
$object->setFont($font, $size);
|
781 |
return $font;
|
782 |
}
|
@@ -784,15 +1060,15 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
784 |
/**
|
785 |
* Prepares the text so that it fits to the given page's width.
|
786 |
*
|
787 |
-
* @param
|
788 |
-
* @param
|
789 |
-
* @param $font
|
790 |
-
* @param
|
791 |
-
* @param
|
792 |
*
|
793 |
-
* @return
|
794 |
*/
|
795 |
-
|
796 |
{
|
797 |
if (empty($text)) {
|
798 |
return array();
|
@@ -821,4 +1097,4 @@ abstract class FireGento_Pdf_Model_Engine_Abstract extends Mage_Sales_Model_Orde
|
|
821 |
$lines .= $currentLine;
|
822 |
return explode("\n", $lines);
|
823 |
}
|
824 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
39 |
public $encoding;
|
40 |
public $pagecounter;
|
41 |
|
42 |
+
protected $_imprint;
|
43 |
|
44 |
+
/**
|
45 |
+
* @var int correct all y values if the logo is full width and bigger than normal
|
46 |
+
*/
|
47 |
+
protected $_marginTop = 0;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* constructor to init settings
|
51 |
+
*/
|
52 |
public function __construct()
|
53 |
{
|
54 |
parent::__construct();
|
59 |
$this->colors['grey1'] = new Zend_Pdf_Color_GrayScale(0.9);
|
60 |
|
61 |
// get the default imprint
|
62 |
+
$this->_imprint = Mage::getStoreConfig('general/imprint');
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
+
* Draw one line
|
67 |
+
*
|
68 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
69 |
+
* @param array $draw items to draw
|
70 |
+
* @param array $pageSettings page settings to use for new pages
|
71 |
*
|
|
|
|
|
|
|
72 |
* @return Zend_Pdf_Page
|
73 |
*/
|
74 |
public function drawLineBlocks(Zend_Pdf_Page $page, array $draw, array $pageSettings = array())
|
91 |
}
|
92 |
$top = 0;
|
93 |
foreach ($column['text'] as $part) {
|
94 |
+
$top += $lineSpacing; // TODO what about count($column['text']) * $lineSpacing
|
95 |
}
|
96 |
|
97 |
$maxHeight = $top > $maxHeight ? $top : $maxHeight;
|
101 |
$itemsProp['shift'] = $shift;
|
102 |
}
|
103 |
|
104 |
+
if ($this->y - $itemsProp['shift'] < 50
|
105 |
+
|| (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
|
106 |
+
&& $this->y - $itemsProp['shift'] < 100)
|
107 |
+
) {
|
108 |
$page = $this->newPage($pageSettings);
|
109 |
}
|
110 |
|
170 |
/**
|
171 |
* Set pdf mode.
|
172 |
*
|
173 |
+
* @param string $mode set mode to differ between creditmemo, invoice, etc.
|
174 |
+
*
|
175 |
+
* @return FireGento_Pdf_Model_Engine_Abstract
|
176 |
*/
|
177 |
public function setMode($mode)
|
178 |
{
|
193 |
/**
|
194 |
* Set next line position
|
195 |
*
|
196 |
+
* @param int $height Line-Height
|
197 |
+
*
|
198 |
* @return void
|
199 |
*/
|
200 |
protected function Ln($height = 15)
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
+
* Insert sender address bar
|
207 |
+
*
|
208 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
209 |
*
|
|
|
210 |
* @return void
|
211 |
*/
|
212 |
protected function _insertSenderAddessBar(&$page)
|
213 |
{
|
214 |
if (Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar') != '') {
|
215 |
$this->_setFontRegular($page, 6);
|
216 |
+
$page->drawText(
|
217 |
+
trim(Mage::getStoreConfig('sales_pdf/firegento_pdf/sender_address_bar')), $this->margin['left'],
|
218 |
+
$this->y, $this->encoding
|
219 |
+
);
|
220 |
}
|
221 |
}
|
222 |
|
223 |
/**
|
224 |
* Insert logo
|
225 |
*
|
226 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
227 |
+
* @param mixed $store store to get data from
|
228 |
+
*
|
229 |
* @return void
|
230 |
*/
|
231 |
protected function insertLogo(&$page, $store = null)
|
232 |
+
{
|
233 |
+
if ($this->_isLogoFullWidth($store)) {
|
234 |
+
$this->_insertLogoFullWidth($page, $store);
|
235 |
+
} else {
|
236 |
+
$this->_insertLogoPositioned($page, $store);
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @param mixed $store
|
242 |
+
*
|
243 |
+
* @return bool
|
244 |
+
*/
|
245 |
+
protected function _isLogoFullWidth($store)
|
246 |
+
{
|
247 |
+
return Mage::helper('firegento_pdf')->isLogoFullWidth($store);
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Inserts the logo if it is positioned left, center or right.
|
252 |
+
*
|
253 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
254 |
+
* @param mixed $store store to get data from
|
255 |
+
*
|
256 |
+
* @return void
|
257 |
+
*/
|
258 |
+
protected function _insertLogoPositioned(&$page, $store = null)
|
259 |
{
|
260 |
$maxwidth = ($this->margin['right'] - $this->margin['left']);
|
261 |
$maxheight = 100;
|
273 |
|
274 |
switch ($logoPosition) {
|
275 |
case 'center':
|
276 |
+
$startLogoAt
|
277 |
+
=
|
278 |
+
$this->margin['left'] + (($this->margin['right'] - $this->margin['left']) / 2) - $width / 2;
|
279 |
break;
|
280 |
case 'right':
|
281 |
$startLogoAt = $this->margin['right'] - $width;
|
295 |
}
|
296 |
|
297 |
/**
|
298 |
+
* inserts the logo from complete left to right
|
299 |
+
*
|
300 |
+
* @param Zend_Pdf_Page $page
|
301 |
+
* @param mixed $store
|
302 |
+
*
|
303 |
+
* @todo merge _insertLogoPositioned and _insertLogoFullWidth
|
304 |
+
*/
|
305 |
+
protected function _insertLogoFullWidth(&$page, $store = null)
|
306 |
+
{
|
307 |
+
$maxwidth = 594;
|
308 |
+
$maxheight = 300;
|
309 |
+
|
310 |
+
$image = Mage::getStoreConfig('sales/identity/logo', $store);
|
311 |
+
if ($image and file_exists(Mage::getBaseDir('media', $store) . '/sales/store/logo/' . $image)) {
|
312 |
+
$image = Mage::getBaseDir('media', $store) . '/sales/store/logo/' . $image;
|
313 |
+
|
314 |
+
list ($width, $height) = Mage::helper('firegento_pdf')->getScaledImageSize($image, $maxwidth, $maxheight);
|
315 |
+
|
316 |
+
if (is_file($image)) {
|
317 |
+
$image = Zend_Pdf_Image::imageWithPath($image);
|
318 |
+
|
319 |
+
$logoPosition = Mage::getStoreConfig('sales_pdf/firegento_pdf/logo_position', $store);
|
320 |
+
|
321 |
+
switch ($logoPosition) {
|
322 |
+
case 'center':
|
323 |
+
$startLogoAt = $this->margin['left'] + (($this->margin['right'] - $this->margin['left']) / 2) - $width / 2;
|
324 |
+
break;
|
325 |
+
case 'right':
|
326 |
+
$startLogoAt = $this->margin['right'] - $width;
|
327 |
+
break;
|
328 |
+
default:
|
329 |
+
$startLogoAt = 0;
|
330 |
+
}
|
331 |
+
|
332 |
+
$position['x1'] = $startLogoAt;
|
333 |
+
$position['y1'] = 663;
|
334 |
+
$position['x2'] = $position['x1'] + $width;
|
335 |
+
$position['y2'] = $position['y1'] + $height;
|
336 |
+
|
337 |
+
$page->drawImage($image, $position['x1'], $position['y1'], $position['x2'], $position['y2']);
|
338 |
+
$this->_marginTop = $height - 130;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* @param Zend_Pdf_Page $page
|
345 |
+
* @param Mage_Sales_Model_Abstract $source
|
346 |
+
* @param Mage_Sales_Model_Order $order
|
347 |
+
*/
|
348 |
+
protected function insertAddressesAndHeader(Zend_Pdf_Page $page, Mage_Sales_Model_Abstract $source, Mage_Sales_Model_Order $order)
|
349 |
+
{
|
350 |
+
// Add logo
|
351 |
+
$this->insertLogo($page, $source->getStore());
|
352 |
+
|
353 |
+
// Add billing address
|
354 |
+
$this->y = 692 - $this->_marginTop;
|
355 |
+
$this->_insertCustomerAddress($page, $order);
|
356 |
+
|
357 |
+
// Add sender address
|
358 |
+
$this->y = 705 - $this->_marginTop;
|
359 |
+
$this->_insertSenderAddessBar($page);
|
360 |
+
|
361 |
+
// Add head
|
362 |
+
$this->y = 592 - $this->_marginTop;
|
363 |
+
$this->insertHeader($page, $order, $source);
|
364 |
+
|
365 |
+
/* Add table head */
|
366 |
+
// make sure that item table does not overlap heading
|
367 |
+
if ($this->y > 575 - $this->_marginTop) {
|
368 |
+
$this->y = 575 - $this->_marginTop;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Inserts the customer address. The default address is the billing address.
|
374 |
+
*
|
375 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
376 |
+
* @param Mage_Sales_Model_Order $order Order object
|
377 |
*
|
|
|
|
|
378 |
* @return void
|
379 |
*/
|
380 |
+
protected function _insertCustomerAddress(&$page, $order)
|
381 |
{
|
382 |
$this->_setFontRegular($page, 9);
|
383 |
$billing = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
|
390 |
/**
|
391 |
* Insert Header
|
392 |
*
|
393 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
394 |
+
* @param Mage_Sales_Model_Order $order Order object
|
395 |
+
* @param object $document Document object
|
396 |
+
*
|
397 |
* @return void
|
398 |
*/
|
399 |
protected function insertHeader(&$page, $order, $document)
|
406 |
|
407 |
if ($mode == 'invoice') {
|
408 |
$title = 'Invoice';
|
409 |
+
} elseif ($mode == 'shipment') {
|
410 |
$title = 'Shipment';
|
411 |
} else {
|
412 |
$title = 'Creditmemo';
|
427 |
// Invoice/shipment/creditmemo Number
|
428 |
if ($mode == 'invoice') {
|
429 |
$numberTitle = 'Invoice number:';
|
430 |
+
} elseif ($mode == 'shipment') {
|
431 |
$numberTitle = 'Shipment number:';
|
432 |
} else {
|
433 |
$numberTitle = 'Creditmemo number:';
|
434 |
}
|
435 |
+
$page->drawText(
|
436 |
+
Mage::helper('firegento_pdf')->__($numberTitle), ($this->margin['right'] - $labelRightOffset), $this->y,
|
437 |
+
$this->encoding
|
438 |
+
);
|
439 |
|
440 |
$incrementId = $document->getIncrementId();
|
441 |
+
$page->drawText(
|
442 |
+
$incrementId,
|
443 |
+
($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($incrementId, $font, 10)),
|
444 |
+
$this->y, $this->encoding
|
445 |
+
);
|
446 |
$this->Ln();
|
447 |
$numberOfLines++;
|
448 |
|
449 |
// Order Number
|
450 |
$putOrderId = $this->_putOrderId($order);
|
451 |
if ($putOrderId) {
|
452 |
+
$page->drawText(
|
453 |
+
Mage::helper('firegento_pdf')->__('Order number:'), ($this->margin['right'] - $labelRightOffset),
|
454 |
+
$this->y, $this->encoding
|
455 |
+
);
|
456 |
+
$page->drawText(
|
457 |
+
$putOrderId, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize(
|
458 |
+
$putOrderId, $font, 10
|
459 |
+
)), $this->y, $this->encoding
|
460 |
+
);
|
461 |
$this->Ln();
|
462 |
$numberOfLines++;
|
463 |
}
|
464 |
|
465 |
// Customer Number
|
466 |
+
if($this->_showCustomerNumber($order->getStore())) {
|
467 |
+
$page->drawText(
|
468 |
+
Mage::helper('firegento_pdf')->__('Customer number:'), ($this->margin['right'] - $labelRightOffset), $this->y, $this->encoding);
|
469 |
+
$numberOfLines++;
|
470 |
|
471 |
+
if ($order->getCustomerId() != '') {
|
472 |
|
473 |
+
$prefix = Mage::getStoreConfig('sales_pdf/invoice/customeridprefix');
|
474 |
|
475 |
+
if (!empty($prefix)) {
|
476 |
+
$customerid = $prefix . $order->getCustomerId();
|
477 |
+
} else {
|
478 |
+
$customerid = $order->getCustomerId();
|
479 |
+
}
|
480 |
+
|
481 |
+
$page->drawText($customerid, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($customerid, $font, 10)), $this->y, $this->encoding);
|
482 |
+
$this->Ln();
|
483 |
+
$numberOfLines++;
|
484 |
} else {
|
485 |
+
$page->drawText('-', ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize('-', $font, 10)), $this->y, $this->encoding);
|
486 |
+
$this->Ln();
|
487 |
+
$numberOfLines++;
|
488 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
490 |
|
491 |
// Customer IP
|
492 |
if (!Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $order->getStoreId())) {
|
493 |
+
$page->drawText(
|
494 |
+
Mage::helper('firegento_pdf')->__('Customer IP:'), ($this->margin['right'] - $labelRightOffset),
|
495 |
+
$this->y, $this->encoding
|
496 |
+
);
|
497 |
$customerIP = $order->getData('remote_ip');
|
498 |
$font = $this->_setFontRegular($page, 10);
|
499 |
+
$page->drawText(
|
500 |
+
$customerIP, ($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize(
|
501 |
+
$customerIP, $font, 10
|
502 |
+
)), $this->y, $this->encoding
|
503 |
+
);
|
504 |
$this->Ln();
|
505 |
$numberOfLines++;
|
506 |
}
|
507 |
|
508 |
+
$page->drawText(
|
509 |
+
Mage::helper('firegento_pdf')->__(($mode == 'invoice') ? 'Invoice date:' : 'Date:'),
|
510 |
+
($this->margin['right'] - $labelRightOffset), $this->y, $this->encoding
|
511 |
+
);
|
512 |
$documentDate = Mage::helper('core')->formatDate($document->getCreatedAtDate(), 'medium', false);
|
513 |
+
$page->drawText(
|
514 |
+
$documentDate,
|
515 |
+
($this->margin['right'] - $valueRightOffset - $this->widthForStringUsingFontSize($documentDate, $font, 10)),
|
516 |
+
$this->y, $this->encoding
|
517 |
+
);
|
518 |
$this->Ln();
|
519 |
$numberOfLines++;
|
520 |
|
521 |
|
522 |
// Payment method.
|
523 |
+
$putPaymentMethod = ($mode == 'invoice'
|
524 |
+
&& Mage::getStoreConfig('sales_pdf/invoice/payment_method_position')
|
525 |
+
== FireGento_Pdf_Model_System_Config_Source_Payment::POSITION_HEADER);
|
526 |
if ($putPaymentMethod) {
|
527 |
+
$page->drawText(
|
528 |
+
Mage::helper('firegento_pdf')->__('Payment method:'), ($this->margin['right'] - $labelRightOffset),
|
529 |
+
$this->y, $this->encoding
|
530 |
+
);
|
531 |
+
$paymentMethodArray = $this->_prepareText(
|
532 |
+
$order->getPayment()->getMethodInstance()->getTitle(), $page, $font, 10, $width
|
533 |
+
);
|
534 |
+
$page->drawText(
|
535 |
+
array_shift($paymentMethodArray), ($this->margin['right'] - $valueRightOffset - $width), $this->y,
|
536 |
+
$this->encoding
|
537 |
+
);
|
538 |
$this->Ln();
|
539 |
$numberOfLines++;
|
540 |
$paymentMethodArray = $this->_prepareText(implode(" ", $paymentMethodArray), $page, $font, 10, 2 * $width);
|
547 |
}
|
548 |
|
549 |
// Shipping method.
|
550 |
+
$putShippingMethod = ($mode == 'invoice'
|
551 |
+
&& Mage::getStoreConfig('sales_pdf/invoice/shipping_method_position')
|
552 |
+
== FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER
|
553 |
+
|| $mode == 'shipment'
|
554 |
+
&& Mage::getStoreConfig('sales_pdf/shipment/shipping_method_position')
|
555 |
+
== FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_HEADER);
|
556 |
if ($putShippingMethod) {
|
557 |
+
$page->drawText(
|
558 |
+
Mage::helper('firegento_pdf')->__('Shipping method:'), ($this->margin['right'] - $labelRightOffset),
|
559 |
+
$this->y, $this->encoding
|
560 |
+
);
|
561 |
$shippingMethodArray = $this->_prepareText($order->getShippingDescription(), $page, $font, 10, $width);
|
562 |
+
$page->drawText(
|
563 |
+
array_shift($shippingMethodArray), ($this->margin['right'] - $valueRightOffset - $width), $this->y,
|
564 |
+
$this->encoding
|
565 |
+
);
|
566 |
$this->Ln();
|
567 |
$numberOfLines++;
|
568 |
+
$shippingMethodArray = $this->_prepareText(
|
569 |
+
implode(" ", $shippingMethodArray), $page, $font, 10, 2 * $width
|
570 |
+
);
|
571 |
foreach ($shippingMethodArray as $methodString) {
|
572 |
$page->drawText($methodString, $this->margin['right'] - $labelRightOffset, $this->y, $this->encoding);
|
573 |
$this->Ln();
|
575 |
}
|
576 |
|
577 |
}
|
578 |
+
$this->y -= ($numberOfLines * 2);
|
579 |
}
|
580 |
|
581 |
/**
|
582 |
* Return the order id or false if order id should not be displayed on document.
|
583 |
*
|
584 |
+
* @param Mage_Sales_Model_Order $order order to get id from
|
585 |
+
*
|
586 |
+
* @return int|false
|
587 |
*/
|
588 |
protected function _putOrderId($order)
|
589 |
{
|
590 |
return Mage::helper('firegento_pdf')->putOrderId($order, $this->mode);
|
591 |
}
|
592 |
|
593 |
+
/**
|
594 |
+
* @param mixed $store
|
595 |
+
*
|
596 |
+
* @return bool
|
597 |
+
*/
|
598 |
+
protected function _showCustomerNumber($store)
|
599 |
+
{
|
600 |
+
return Mage::helper('firegento_pdf')->showCustomerNumber($this->mode, $store);
|
601 |
+
}
|
602 |
+
|
603 |
/**
|
604 |
* Generate new PDF page.
|
605 |
*
|
606 |
+
* @param array $settings Page settings
|
607 |
+
*
|
608 |
* @return Zend_Pdf_Page
|
609 |
*/
|
610 |
public function newPage(array $settings = array())
|
617 |
|
618 |
$this->_addFooter($page, Mage::app()->getStore());
|
619 |
|
620 |
+
// provide the possibility to add random stuff to the page
|
621 |
+
Mage::dispatchEvent(
|
622 |
+
'firegento_pdf_' . $this->getMode() . '_edit_page',
|
623 |
+
array('page' => $page, 'order' => $this->getOrder())
|
624 |
+
);
|
625 |
+
|
626 |
$this->y = 800;
|
627 |
$this->_setFontRegular($page, 9);
|
628 |
|
630 |
}
|
631 |
|
632 |
/**
|
633 |
+
* Draw
|
634 |
+
*
|
635 |
+
* @param Varien_Object $item creditmemo/shipping/invoice to draw
|
636 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
637 |
+
* @param Mage_Sales_Model_Order $order order to get infos from
|
638 |
+
* @param int $position position in table
|
639 |
*
|
|
|
|
|
|
|
|
|
640 |
* @return Zend_Pdf_Page
|
641 |
*/
|
642 |
protected function _drawItem(Varien_Object $item, Zend_Pdf_Page $page, Mage_Sales_Model_Order $order, $position = 1)
|
657 |
/**
|
658 |
* Insert Totals Block
|
659 |
*
|
660 |
+
* @param object $page Current page object of Zend_Pdf
|
661 |
+
* @param object $source Fields of footer
|
662 |
+
*
|
663 |
+
* @return Zend_Pdf_Page
|
664 |
*/
|
665 |
protected function insertTotals($page, $source)
|
666 |
{
|
668 |
|
669 |
$order = $source->getOrder();
|
670 |
|
671 |
+
$totalTax = 0;
|
672 |
$shippingTaxRate = 0;
|
673 |
$shippingTaxAmount = $order->getShippingTaxAmount();
|
674 |
|
675 |
if ($shippingTaxAmount > 0) {
|
676 |
+
$shippingTaxRate
|
677 |
+
=
|
678 |
+
$order->getShippingTaxAmount() * 100 / ($order->getShippingInclTax() - $order->getShippingTaxAmount());
|
679 |
}
|
680 |
|
681 |
$groupedTax = array();
|
688 |
$items['items'][] = $item->getOrderItem()->toArray();
|
689 |
}
|
690 |
|
691 |
+
array_push(
|
692 |
+
$items['items'], array(
|
693 |
+
'row_invoiced' => $order->getShippingInvoiced(),
|
694 |
+
'tax_inc_subtotal' => false,
|
695 |
+
'tax_percent' => $shippingTaxRate,
|
696 |
+
'tax_amount' => $shippingTaxAmount
|
697 |
+
)
|
698 |
+
);
|
699 |
|
700 |
foreach ($items['items'] as $item) {
|
701 |
$_percent = null;
|
702 |
+
if (!isset($item['tax_amount'])) {
|
703 |
+
$item['tax_amount'] = 0;
|
704 |
+
}
|
705 |
+
if (!isset($item['row_invoiced'])) {
|
706 |
+
$item['row_invoiced'] = 0;
|
707 |
+
}
|
708 |
+
if (!isset($item['price'])) {
|
709 |
+
$item['price'] = 0;
|
710 |
+
}
|
711 |
+
if (!isset($item['tax_inc_subtotal'])) {
|
712 |
+
$item['tax_inc_subtotal'] = 0;
|
713 |
+
}
|
714 |
if (((float)$item['tax_amount'] > 0) && ((float)$item['row_invoiced'] > 0)) {
|
715 |
$_percent = round($item["tax_percent"], 0);
|
716 |
}
|
717 |
if (!array_key_exists('tax_inc_subtotal', $item) || $item['tax_inc_subtotal']) {
|
718 |
+
$totalTax += $item['tax_amount'];
|
719 |
}
|
720 |
if (($item['tax_amount']) && $_percent) {
|
721 |
if (!array_key_exists((int)$_percent, $groupedTax)) {
|
729 |
$totals = $this->_getTotalsList($source);
|
730 |
|
731 |
$lineBlock = array(
|
732 |
+
'lines' => array(),
|
733 |
'height' => 20
|
734 |
);
|
735 |
|
738 |
|
739 |
if ($total->canDisplay()) {
|
740 |
$total->setFontSize(10);
|
741 |
+
// fix Magento 1.8 bug, so that taxes for shipping do not appear twice
|
742 |
+
// see https://github.com/firegento/firegento-pdf/issues/106
|
743 |
+
$uniqueTotalsForDisplay = array_map('unserialize', array_unique(array_map('serialize', $total->getTotalsForDisplay())));
|
744 |
+
foreach ($uniqueTotalsForDisplay as $totalData) {
|
745 |
$lineBlock['lines'][] = array(
|
746 |
array(
|
747 |
'text' => $totalData['label'],
|
766 |
/**
|
767 |
* Insert Notes
|
768 |
*
|
769 |
+
* @param Zend_Pdf_Page $page Current Page Object of Zend_PDF
|
770 |
+
* @param Mage_Sales_Model_Order $order order to get note from
|
771 |
+
* @param Mage_Sales_Model_Abstract $model invoice/shipment/creditmemo
|
772 |
+
*
|
773 |
+
* @return \Zend_Pdf_Page
|
774 |
*/
|
775 |
protected function _insertNote($page, &$order, &$model)
|
776 |
{
|
779 |
$this->y = $this->y - 60;
|
780 |
|
781 |
$notes = array();
|
|
|
782 |
$result = new Varien_Object();
|
783 |
$result->setNotes($notes);
|
784 |
+
Mage::dispatchEvent(
|
785 |
+
'firegento_pdf_' . $this->getMode() . '_insert_note',
|
786 |
+
array('order' => $order, $this->getMode() => $model, 'result' => $result)
|
787 |
+
);
|
788 |
$notes = array_merge($notes, $result->getNotes());
|
789 |
|
|
|
|
|
|
|
|
|
790 |
// Get free text notes.
|
791 |
$note = Mage::getStoreConfig('sales_pdf/' . $this->getMode() . '/note');
|
792 |
if (!empty($note)) {
|
799 |
// prepare the text so that it fits to the paper
|
800 |
foreach ($this->_prepareText($note, $page, $font, 10) as $tmpNote) {
|
801 |
// create a new page if necessary
|
802 |
+
if ($this->y < 50
|
803 |
+
|| (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
|
804 |
+
&& $this->y < 100)
|
805 |
+
) {
|
806 |
$page = $this->newPage(array());
|
807 |
$this->y = $this->y - 60;
|
808 |
$font = $this->_setFontRegular($page, $fontSize);
|
814 |
return $page;
|
815 |
}
|
816 |
|
817 |
+
/**
|
818 |
+
* draw footer on pdf
|
819 |
+
*
|
820 |
+
* @param Zend_Pdf_Page $page page to draw on
|
821 |
+
* @param mixed $store store to get infos from
|
822 |
+
*/
|
823 |
protected function _addFooter(&$page, $store = null)
|
824 |
{
|
825 |
// get the imprint of the store if a store is set
|
826 |
if (!empty($store)) {
|
827 |
+
$this->_imprint = Mage::getStoreConfig('general/imprint', $store);
|
828 |
}
|
829 |
|
830 |
// Add footer if GermanSetup is installed.
|
831 |
+
if ($this->_imprint && Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1) {
|
832 |
$this->y = 110;
|
833 |
$this->_insertFooter($page);
|
834 |
|
841 |
/**
|
842 |
* Insert footer
|
843 |
*
|
844 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
845 |
+
*
|
846 |
* @return void
|
847 |
*/
|
848 |
protected function _insertFooter(&$page)
|
856 |
|
857 |
$fields = array(
|
858 |
'telephone' => Mage::helper('firegento_pdf')->__('Telephone:'),
|
859 |
+
'fax' => Mage::helper('firegento_pdf')->__('Fax:'),
|
860 |
+
'email' => Mage::helper('firegento_pdf')->__('E-Mail:'),
|
861 |
+
'web' => Mage::helper('firegento_pdf')->__('Web:')
|
862 |
);
|
863 |
$this->_insertFooterBlock($page, $fields, 70, 40, 140);
|
864 |
|
865 |
$fields = array(
|
866 |
+
'bank_name' => Mage::helper('firegento_pdf')->__('Bank name:'),
|
867 |
+
'bank_account' => Mage::helper('firegento_pdf')->__('Account:'),
|
868 |
+
'bank_code_number' => Mage::helper('firegento_pdf')->__('Bank number:'),
|
869 |
'bank_account_owner' => Mage::helper('firegento_pdf')->__('Account owner:'),
|
870 |
+
'swift' => Mage::helper('firegento_pdf')->__('SWIFT:'),
|
871 |
+
'iban' => Mage::helper('firegento_pdf')->__('IBAN:')
|
872 |
);
|
873 |
+
$this->_insertFooterBlock($page, $fields, 215, 50, 150);
|
874 |
|
875 |
$fields = array(
|
876 |
+
'tax_number' => Mage::helper('firegento_pdf')->__('Tax number:'),
|
877 |
+
'vat_id' => Mage::helper('firegento_pdf')->__('VAT-ID:'),
|
878 |
'register_number' => Mage::helper('firegento_pdf')->__('Register number:'),
|
879 |
+
'ceo' => Mage::helper('firegento_pdf')->__('CEO:')
|
880 |
);
|
881 |
+
$this->_insertFooterBlock($page, $fields, 355, 60, $this->margin['right'] - 365 - 10);
|
882 |
}
|
883 |
|
884 |
/**
|
885 |
* Insert footer block
|
886 |
*
|
887 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
888 |
+
* @param array $fields Fields of footer
|
889 |
+
* @param int $colposition Starting colposition
|
890 |
+
* @param int $valadjust Margin between label and value
|
891 |
+
* @param int $colwidth the width of this footer block - text will be wrapped if it is broader
|
892 |
+
* than this width
|
893 |
+
*
|
894 |
* @return void
|
895 |
*/
|
896 |
protected function _insertFooterBlock(&$page, $fields, $colposition = 0, $valadjust = 30, $colwidth = null)
|
903 |
|
904 |
if (is_array($fields)) {
|
905 |
foreach ($fields as $field => $label) {
|
906 |
+
if (empty($this->_imprint[$field])) {
|
907 |
continue;
|
908 |
}
|
909 |
// draw the label
|
910 |
$page->drawText($label, $this->margin['left'] + $colposition, $y, $this->encoding);
|
911 |
// prepare the value: wrap it if necessary
|
912 |
+
$val = $this->_imprint[$field];
|
913 |
$width = $colwidth;
|
914 |
if (!empty($colwidth)) {
|
915 |
// calculate the maximum width for the value
|
926 |
/**
|
927 |
* Insert addess of store owner
|
928 |
*
|
929 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
930 |
+
* @param mixed $store store to get infos from
|
931 |
+
*
|
932 |
* @return void
|
933 |
*/
|
934 |
protected function _insertFooterAddress(&$page, $store = null)
|
935 |
{
|
936 |
+
$fontSize = 7;
|
937 |
+
$font = $this->_setFontRegular($page, $fontSize);
|
938 |
+
$y = $this->y;
|
939 |
+
$address = '';
|
940 |
|
941 |
+
foreach ($this->_prepareText($this->_imprint['company_first'], $page, $font, $fontSize, 90) as $companyFirst) {
|
942 |
+
$address .= $companyFirst . "\n";
|
943 |
}
|
944 |
|
945 |
+
if (array_key_exists('company_second', $this->_imprint)) {
|
946 |
+
foreach ($this->_prepareText($this->_imprint['company_second'], $page, $font, $fontSize, 90) as $companySecond) {
|
947 |
+
$address .= $companySecond . "\n";
|
948 |
+
}
|
949 |
+
}
|
950 |
+
|
951 |
+
$address .= $this->_imprint['street'] . "\n";
|
952 |
+
$address .= $this->_imprint['zip'] . " ";
|
953 |
+
$address .= $this->_imprint['city'] . "\n";
|
954 |
+
|
955 |
+
if (array_key_exists('country', $this->_imprint)) {
|
956 |
+
$countryName = Mage::getModel('directory/country')->loadByCode($this->_imprint['country'])->getName();
|
957 |
+
$address .= Mage::helper('core')->__($countryName);
|
958 |
+
}
|
959 |
|
|
|
|
|
960 |
foreach (explode("\n", $address) as $value) {
|
961 |
if ($value !== '') {
|
962 |
$page->drawText(trim(strip_tags($value)), $this->margin['left'] - 20, $y, $this->encoding);
|
968 |
/**
|
969 |
* Insert page counter
|
970 |
*
|
971 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
972 |
+
*
|
973 |
* @return void
|
974 |
*/
|
975 |
protected function _insertPageCounter(&$page)
|
976 |
{
|
977 |
$font = $this->_setFontRegular($page, 9);
|
978 |
+
$page->drawText(
|
979 |
+
Mage::helper('firegento_pdf')->__('Page') . ' ' . $this->pagecounter,
|
980 |
+
$this->margin['right'] - 23 - $this->widthForStringUsingFontSize($this->pagecounter, $font, 9), $this->y,
|
981 |
+
$this->encoding
|
982 |
+
);
|
983 |
+
}
|
984 |
+
|
985 |
+
/**
|
986 |
+
* get stanard font
|
987 |
+
*
|
988 |
+
* @return Zend_Pdf_Resource_Font the regular font
|
989 |
+
*/
|
990 |
+
public function getFontRegular()
|
991 |
+
{
|
992 |
+
return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
|
993 |
}
|
994 |
|
995 |
/**
|
996 |
* Set default font
|
997 |
*
|
998 |
+
* @param Zend_Pdf_Page $object Current page object of Zend_Pdf
|
999 |
+
* @param string|int $size Font size
|
1000 |
+
*
|
1001 |
* @return Zend_Pdf_Resource_Font
|
1002 |
*/
|
1003 |
protected function _setFontRegular($object, $size = 10)
|
1004 |
{
|
1005 |
+
$font = $this->getFontRegular();
|
1006 |
$object->setFont($font, $size);
|
1007 |
return $font;
|
1008 |
}
|
1009 |
|
1010 |
+
/**
|
1011 |
+
* get default bold font
|
1012 |
+
*
|
1013 |
+
* @return Zend_Pdf_Resource_Font the bold font
|
1014 |
+
*/
|
1015 |
+
public function getFontBold()
|
1016 |
+
{
|
1017 |
+
return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
|
1018 |
+
}
|
1019 |
+
|
1020 |
/**
|
1021 |
* Set bold font
|
1022 |
*
|
1023 |
+
* @param Zend_Pdf_Page $object Current page object of Zend_Pdf
|
1024 |
+
* @param string|int $size Font size
|
1025 |
+
*
|
1026 |
* @return Zend_Pdf_Resource_Font
|
1027 |
*/
|
1028 |
protected function _setFontBold($object, $size = 10)
|
1029 |
{
|
1030 |
+
$font = $this->getFontBold();
|
1031 |
$object->setFont($font, $size);
|
1032 |
return $font;
|
1033 |
}
|
1034 |
|
1035 |
+
/**
|
1036 |
+
* get italic font
|
1037 |
+
*
|
1038 |
+
* @return Zend_Pdf_Resource_Font
|
1039 |
+
*/
|
1040 |
+
public function getFontItalic()
|
1041 |
+
{
|
1042 |
+
return Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC);
|
1043 |
+
}
|
1044 |
+
|
1045 |
/**
|
1046 |
* Set italic font
|
1047 |
*
|
1048 |
+
* @param Zend_Pdf_Page $object Current page object of Zend_Pdf
|
1049 |
+
* @param string|int $size Font size
|
1050 |
+
*
|
1051 |
* @return Zend_Pdf_Resource_Font
|
1052 |
*/
|
1053 |
protected function _setFontItalic($object, $size = 10)
|
1054 |
{
|
1055 |
+
$font = $this->getFontItalic();
|
1056 |
$object->setFont($font, $size);
|
1057 |
return $font;
|
1058 |
}
|
1060 |
/**
|
1061 |
* Prepares the text so that it fits to the given page's width.
|
1062 |
*
|
1063 |
+
* @param string $text the text which should be prepared
|
1064 |
+
* @param Zend_Pdf_Page $page the page on which the text will be rendered
|
1065 |
+
* @param Zend_Pdf_Resource_Font $font the font with which the text will be rendered
|
1066 |
+
* @param int $fontSize the font size with which the text will be rendered
|
1067 |
+
* @param int $width [optional] the width for the given text, defaults to the page width
|
1068 |
*
|
1069 |
+
* @return array the given text in an array where each item represents a new line
|
1070 |
*/
|
1071 |
+
public function _prepareText($text, $page, $font, $fontSize, $width = null)
|
1072 |
{
|
1073 |
if (empty($text)) {
|
1074 |
return array();
|
1097 |
$lines .= $currentLine;
|
1098 |
return explode("\n", $lines);
|
1099 |
}
|
1100 |
+
}
|
app/code/community/FireGento/Pdf/Model/Engine/Creditmemo/Default.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -34,6 +34,9 @@
|
|
34 |
class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_Engine_Abstract
|
35 |
{
|
36 |
|
|
|
|
|
|
|
37 |
public function __construct()
|
38 |
{
|
39 |
parent::__construct();
|
@@ -43,7 +46,8 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
43 |
/**
|
44 |
* Return PDF document
|
45 |
*
|
46 |
-
* @param array $creditmemos
|
|
|
47 |
* @return Zend_Pdf
|
48 |
*/
|
49 |
public function getPdf($creditmemos = array())
|
@@ -54,9 +58,6 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
54 |
$pdf = new Zend_Pdf();
|
55 |
$this->_setPdf($pdf);
|
56 |
|
57 |
-
$style = new Zend_Pdf_Style();
|
58 |
-
$this->_setFontBold($style, 10);
|
59 |
-
|
60 |
// pagecounter is 0 at the beginning, because it is incremented in newPage()
|
61 |
$this->pagecounter = 0;
|
62 |
|
@@ -65,39 +66,21 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
65 |
Mage::app()->getLocale()->emulate($creditmemo->getStoreId());
|
66 |
Mage::app()->setCurrentStore($creditmemo->getStoreId());
|
67 |
}
|
68 |
-
$page = $this->newPage();
|
69 |
-
|
70 |
$order = $creditmemo->getOrder();
|
|
|
71 |
|
72 |
-
|
73 |
-
$this->insertLogo($page, $creditmemo->getStore());
|
74 |
-
|
75 |
-
// Add billing address
|
76 |
-
$this->y = 692;
|
77 |
-
$this->insertBillingAddress($page, $order);
|
78 |
|
79 |
-
|
80 |
-
$this->y = 705;
|
81 |
-
$this->_insertSenderAddessBar($page);
|
82 |
|
83 |
-
// Add head
|
84 |
-
$this->y = 592;
|
85 |
-
$this->insertHeader($page, $order, $creditmemo);
|
86 |
-
|
87 |
-
// Add footer
|
88 |
-
$this->_addFooter($page, $creditmemo->getStore());
|
89 |
-
|
90 |
-
/* Add table head */
|
91 |
$this->_setFontRegular($page, 9);
|
92 |
-
$this->y = 562;
|
93 |
$this->_drawHeader($page);
|
94 |
|
95 |
-
$this->y -=20;
|
96 |
|
97 |
$position = 0;
|
98 |
|
99 |
-
|
100 |
-
foreach ($creditmemo->getAllItems() as $item){
|
101 |
if ($item->getOrderItem()->getParentItem()) {
|
102 |
continue;
|
103 |
}
|
@@ -115,6 +98,9 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
115 |
|
116 |
/* add note */
|
117 |
$page = $this->_insertNote($page, $order, $creditmemo);
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
$this->_afterGetPdf();
|
@@ -128,7 +114,8 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
128 |
/**
|
129 |
* Draw table header for product items
|
130 |
*
|
131 |
-
* @param
|
|
|
132 |
* @return void
|
133 |
*/
|
134 |
protected function _drawHeader(Zend_Pdf_Page $page)
|
@@ -142,26 +129,62 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
142 |
$font = $this->_setFontRegular($page, 9);
|
143 |
|
144 |
$this->y -= 11;
|
145 |
-
$page->drawText(
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
$singlePrice = Mage::helper('firegento_pdf')->__('Price (excl. tax)');
|
150 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
$taxLabel = Mage::helper('firegento_pdf')->__('Tax');
|
155 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
$totalLabel = Mage::helper('firegento_pdf')->__('Total');
|
158 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
* Initialize renderer process.
|
163 |
*
|
164 |
-
* @param
|
|
|
165 |
* @return void
|
166 |
*/
|
167 |
protected function _initRenderer($type)
|
@@ -169,15 +192,15 @@ class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_
|
|
169 |
parent::_initRenderer($type);
|
170 |
|
171 |
$this->_renderers['default'] = array(
|
172 |
-
'model'
|
173 |
'renderer' => null
|
174 |
);
|
175 |
$this->_renderers['grouped'] = array(
|
176 |
-
'model'
|
177 |
'renderer' => null
|
178 |
);
|
179 |
$this->_renderers['bundle'] = array(
|
180 |
-
'model'
|
181 |
'renderer' => null
|
182 |
);
|
183 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
34 |
class FireGento_Pdf_Model_Engine_Creditmemo_Default extends FireGento_Pdf_Model_Engine_Abstract
|
35 |
{
|
36 |
|
37 |
+
/**
|
38 |
+
* constructor to set mode to creditmemo
|
39 |
+
*/
|
40 |
public function __construct()
|
41 |
{
|
42 |
parent::__construct();
|
46 |
/**
|
47 |
* Return PDF document
|
48 |
*
|
49 |
+
* @param array $creditmemos creditmemos to generate pdfs for
|
50 |
+
*
|
51 |
* @return Zend_Pdf
|
52 |
*/
|
53 |
public function getPdf($creditmemos = array())
|
58 |
$pdf = new Zend_Pdf();
|
59 |
$this->_setPdf($pdf);
|
60 |
|
|
|
|
|
|
|
61 |
// pagecounter is 0 at the beginning, because it is incremented in newPage()
|
62 |
$this->pagecounter = 0;
|
63 |
|
66 |
Mage::app()->getLocale()->emulate($creditmemo->getStoreId());
|
67 |
Mage::app()->setCurrentStore($creditmemo->getStoreId());
|
68 |
}
|
|
|
|
|
69 |
$order = $creditmemo->getOrder();
|
70 |
+
$this->setOrder($order);
|
71 |
|
72 |
+
$page = $this->newPage(array());
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
$this->insertAddressesAndHeader($page, $creditmemo, $order);
|
|
|
|
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
$this->_setFontRegular($page, 9);
|
|
|
77 |
$this->_drawHeader($page);
|
78 |
|
79 |
+
$this->y -= 20;
|
80 |
|
81 |
$position = 0;
|
82 |
|
83 |
+
foreach ($creditmemo->getAllItems() as $item) {
|
|
|
84 |
if ($item->getOrderItem()->getParentItem()) {
|
85 |
continue;
|
86 |
}
|
98 |
|
99 |
/* add note */
|
100 |
$page = $this->_insertNote($page, $order, $creditmemo);
|
101 |
+
|
102 |
+
// Add footer
|
103 |
+
$this->_addFooter($page, $creditmemo->getStore());
|
104 |
}
|
105 |
|
106 |
$this->_afterGetPdf();
|
114 |
/**
|
115 |
* Draw table header for product items
|
116 |
*
|
117 |
+
* @param Zend_Pdf_Page $page page to draw on
|
118 |
+
*
|
119 |
* @return void
|
120 |
*/
|
121 |
protected function _drawHeader(Zend_Pdf_Page $page)
|
129 |
$font = $this->_setFontRegular($page, 9);
|
130 |
|
131 |
$this->y -= 11;
|
132 |
+
$page->drawText(
|
133 |
+
Mage::helper('firegento_pdf')->__('Pos'),
|
134 |
+
$this->margin['left'] + 3,
|
135 |
+
$this->y,
|
136 |
+
$this->encoding
|
137 |
+
);
|
138 |
+
$page->drawText(
|
139 |
+
Mage::helper('firegento_pdf')->__('No.'),
|
140 |
+
$this->margin['left'] + 25,
|
141 |
+
$this->y,
|
142 |
+
$this->encoding
|
143 |
+
);
|
144 |
+
$page->drawText(
|
145 |
+
Mage::helper('firegento_pdf')->__('Description'),
|
146 |
+
$this->margin['left'] + 120,
|
147 |
+
$this->y,
|
148 |
+
$this->encoding
|
149 |
+
);
|
150 |
|
151 |
$singlePrice = Mage::helper('firegento_pdf')->__('Price (excl. tax)');
|
152 |
+
$page->drawText(
|
153 |
+
$singlePrice,
|
154 |
+
$this->margin['right'] - 153 - $this->widthForStringUsingFontSize($singlePrice, $font, 9),
|
155 |
+
$this->y,
|
156 |
+
$this->encoding
|
157 |
+
);
|
158 |
|
159 |
+
$page->drawText(
|
160 |
+
Mage::helper('firegento_pdf')->__('Qty'),
|
161 |
+
$this->margin['left'] + 360,
|
162 |
+
$this->y,
|
163 |
+
$this->encoding
|
164 |
+
);
|
165 |
|
166 |
$taxLabel = Mage::helper('firegento_pdf')->__('Tax');
|
167 |
+
$page->drawText(
|
168 |
+
$taxLabel,
|
169 |
+
$this->margin['right'] - 65 - $this->widthForStringUsingFontSize($taxLabel, $font, 9),
|
170 |
+
$this->y,
|
171 |
+
$this->encoding
|
172 |
+
);
|
173 |
|
174 |
$totalLabel = Mage::helper('firegento_pdf')->__('Total');
|
175 |
+
$page->drawText(
|
176 |
+
$totalLabel,
|
177 |
+
$this->margin['right'] - 10 - $this->widthForStringUsingFontSize($totalLabel, $font, 10),
|
178 |
+
$this->y,
|
179 |
+
$this->encoding
|
180 |
+
);
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
* Initialize renderer process.
|
185 |
*
|
186 |
+
* @param string $type renderer type to initialize
|
187 |
+
*
|
188 |
* @return void
|
189 |
*/
|
190 |
protected function _initRenderer($type)
|
192 |
parent::_initRenderer($type);
|
193 |
|
194 |
$this->_renderers['default'] = array(
|
195 |
+
'model' => 'firegento_pdf/items_default',
|
196 |
'renderer' => null
|
197 |
);
|
198 |
$this->_renderers['grouped'] = array(
|
199 |
+
'model' => 'firegento_pdf/items_grouped',
|
200 |
'renderer' => null
|
201 |
);
|
202 |
$this->_renderers['bundle'] = array(
|
203 |
+
'model' => 'firegento_pdf/items_bundle',
|
204 |
'renderer' => null
|
205 |
);
|
206 |
}
|
app/code/community/FireGento/Pdf/Model/Engine/Invoice/Default.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -34,6 +34,9 @@
|
|
34 |
class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Engine_Abstract
|
35 |
{
|
36 |
|
|
|
|
|
|
|
37 |
public function __construct()
|
38 |
{
|
39 |
parent::__construct();
|
@@ -43,7 +46,8 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
43 |
/**
|
44 |
* Return PDF document
|
45 |
*
|
46 |
-
* @param array $invoices
|
|
|
47 |
* @return Zend_Pdf
|
48 |
*/
|
49 |
public function getPdf($invoices = array())
|
@@ -54,9 +58,6 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
54 |
$pdf = new Zend_Pdf();
|
55 |
$this->_setPdf($pdf);
|
56 |
|
57 |
-
$style = new Zend_Pdf_Style();
|
58 |
-
$this->_setFontBold($style, 10);
|
59 |
-
|
60 |
// pagecounter is 0 at the beginning, because it is incremented in newPage()
|
61 |
$this->pagecounter = 0;
|
62 |
|
@@ -65,27 +66,13 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
65 |
Mage::app()->getLocale()->emulate($invoice->getStoreId());
|
66 |
Mage::app()->setCurrentStore($invoice->getStoreId());
|
67 |
}
|
68 |
-
$page = $this->newPage();
|
69 |
-
|
70 |
$order = $invoice->getOrder();
|
|
|
71 |
|
72 |
-
|
73 |
-
$this->insertLogo($page, $invoice->getStore());
|
74 |
-
|
75 |
-
/* add billing address */
|
76 |
-
$this->y = 692;
|
77 |
-
$this->insertBillingAddress($page, $order);
|
78 |
-
|
79 |
-
// Add sender address
|
80 |
-
$this->y = 705;
|
81 |
-
$this->_insertSenderAddessBar($page);
|
82 |
-
|
83 |
-
/* add header */
|
84 |
-
$this->y = 592;
|
85 |
-
$this->insertHeader($page, $order, $invoice);
|
86 |
|
|
|
87 |
|
88 |
-
/* add table header */
|
89 |
$this->_setFontRegular($page, 9);
|
90 |
$this->insertTableHeader($page);
|
91 |
|
@@ -97,7 +84,9 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
97 |
if ($item->getOrderItem()->getParentItem()) {
|
98 |
continue;
|
99 |
}
|
100 |
-
|
|
|
|
|
101 |
$page = $this->newPage(array());
|
102 |
}
|
103 |
|
@@ -116,7 +105,6 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
116 |
|
117 |
// Add footer
|
118 |
$this->_addFooter($page, $invoice->getStore());
|
119 |
-
|
120 |
}
|
121 |
|
122 |
$this->_afterGetPdf();
|
@@ -127,7 +115,7 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
127 |
/**
|
128 |
* Insert Table Header for Items
|
129 |
*
|
130 |
-
* @param
|
131 |
*
|
132 |
* @return void
|
133 |
*/
|
@@ -143,8 +131,12 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
143 |
|
144 |
$this->y -= 11;
|
145 |
$page->drawText(Mage::helper('firegento_pdf')->__('Pos'), $this->margin['left'] + 3, $this->y, $this->encoding);
|
146 |
-
$page->drawText(
|
147 |
-
|
|
|
|
|
|
|
|
|
148 |
|
149 |
$columns = array();
|
150 |
$columns['price'] = array(
|
@@ -197,9 +189,10 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
197 |
}
|
198 |
|
199 |
/**
|
200 |
-
* Initialize renderer process
|
|
|
|
|
201 |
*
|
202 |
-
* @param string $type
|
203 |
* @return void
|
204 |
*/
|
205 |
protected function _initRenderer($type)
|
@@ -207,15 +200,15 @@ class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Eng
|
|
207 |
parent::_initRenderer($type);
|
208 |
|
209 |
$this->_renderers['default'] = array(
|
210 |
-
'model'
|
211 |
'renderer' => null
|
212 |
);
|
213 |
$this->_renderers['grouped'] = array(
|
214 |
-
'model'
|
215 |
'renderer' => null
|
216 |
);
|
217 |
$this->_renderers['bundle'] = array(
|
218 |
-
'model'
|
219 |
'renderer' => null
|
220 |
);
|
221 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
34 |
class FireGento_Pdf_Model_Engine_Invoice_Default extends FireGento_Pdf_Model_Engine_Abstract
|
35 |
{
|
36 |
|
37 |
+
/**
|
38 |
+
* constructor to set mode to invoice
|
39 |
+
*/
|
40 |
public function __construct()
|
41 |
{
|
42 |
parent::__construct();
|
46 |
/**
|
47 |
* Return PDF document
|
48 |
*
|
49 |
+
* @param array $invoices invoices to render pdfs for
|
50 |
+
*
|
51 |
* @return Zend_Pdf
|
52 |
*/
|
53 |
public function getPdf($invoices = array())
|
58 |
$pdf = new Zend_Pdf();
|
59 |
$this->_setPdf($pdf);
|
60 |
|
|
|
|
|
|
|
61 |
// pagecounter is 0 at the beginning, because it is incremented in newPage()
|
62 |
$this->pagecounter = 0;
|
63 |
|
66 |
Mage::app()->getLocale()->emulate($invoice->getStoreId());
|
67 |
Mage::app()->setCurrentStore($invoice->getStoreId());
|
68 |
}
|
|
|
|
|
69 |
$order = $invoice->getOrder();
|
70 |
+
$this->setOrder($order);
|
71 |
|
72 |
+
$page = $this->newPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
$this->insertAddressesAndHeader($page, $invoice, $order);
|
75 |
|
|
|
76 |
$this->_setFontRegular($page, 9);
|
77 |
$this->insertTableHeader($page);
|
78 |
|
84 |
if ($item->getOrderItem()->getParentItem()) {
|
85 |
continue;
|
86 |
}
|
87 |
+
|
88 |
+
$showFooter = Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer');
|
89 |
+
if ($this->y < 50 || ($showFooter == 1 && $this->y < 100)) {
|
90 |
$page = $this->newPage(array());
|
91 |
}
|
92 |
|
105 |
|
106 |
// Add footer
|
107 |
$this->_addFooter($page, $invoice->getStore());
|
|
|
108 |
}
|
109 |
|
110 |
$this->_afterGetPdf();
|
115 |
/**
|
116 |
* Insert Table Header for Items
|
117 |
*
|
118 |
+
* @param Zend_Pdf_Page $page current page object of Zend_PDF
|
119 |
*
|
120 |
* @return void
|
121 |
*/
|
131 |
|
132 |
$this->y -= 11;
|
133 |
$page->drawText(Mage::helper('firegento_pdf')->__('Pos'), $this->margin['left'] + 3, $this->y, $this->encoding);
|
134 |
+
$page->drawText(
|
135 |
+
Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'] + 25, $this->y, $this->encoding
|
136 |
+
);
|
137 |
+
$page->drawText(
|
138 |
+
Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 130, $this->y, $this->encoding
|
139 |
+
);
|
140 |
|
141 |
$columns = array();
|
142 |
$columns['price'] = array(
|
189 |
}
|
190 |
|
191 |
/**
|
192 |
+
* Initialize renderer process
|
193 |
+
*
|
194 |
+
* @param string $type renderer type to be initialized
|
195 |
*
|
|
|
196 |
* @return void
|
197 |
*/
|
198 |
protected function _initRenderer($type)
|
200 |
parent::_initRenderer($type);
|
201 |
|
202 |
$this->_renderers['default'] = array(
|
203 |
+
'model' => 'firegento_pdf/items_default',
|
204 |
'renderer' => null
|
205 |
);
|
206 |
$this->_renderers['grouped'] = array(
|
207 |
+
'model' => 'firegento_pdf/items_grouped',
|
208 |
'renderer' => null
|
209 |
);
|
210 |
$this->_renderers['bundle'] = array(
|
211 |
+
'model' => 'firegento_pdf/items_bundle',
|
212 |
'renderer' => null
|
213 |
);
|
214 |
}
|
app/code/community/FireGento/Pdf/Model/Engine/Shipment/Default.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -34,6 +34,9 @@
|
|
34 |
class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_Engine_Abstract
|
35 |
{
|
36 |
|
|
|
|
|
|
|
37 |
public function __construct()
|
38 |
{
|
39 |
parent::__construct();
|
@@ -43,7 +46,8 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
43 |
/**
|
44 |
* Return PDF document
|
45 |
*
|
46 |
-
* @param array $shipments
|
|
|
47 |
* @return Zend_Pdf
|
48 |
*/
|
49 |
public function getPdf($shipments = array())
|
@@ -54,9 +58,6 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
54 |
$pdf = new Zend_Pdf();
|
55 |
$this->_setPdf($pdf);
|
56 |
|
57 |
-
$style = new Zend_Pdf_Style();
|
58 |
-
$this->_setFontBold($style, 10);
|
59 |
-
|
60 |
// pagecounter is 0 at the beginning, because it is incremented in newPage()
|
61 |
$this->pagecounter = 0;
|
62 |
|
@@ -65,34 +66,17 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
65 |
Mage::app()->getLocale()->emulate($shipment->getStoreId());
|
66 |
Mage::app()->setCurrentStore($shipment->getStoreId());
|
67 |
}
|
68 |
-
$page = $this->newPage();
|
69 |
-
|
70 |
$order = $shipment->getOrder();
|
|
|
71 |
|
72 |
-
|
73 |
-
$this->insertLogo($page, $shipment->getStore());
|
74 |
|
75 |
-
|
76 |
-
$this->y = 692;
|
77 |
-
$this->insertShippingAddress($page, $order);
|
78 |
-
|
79 |
-
/* add sender address */
|
80 |
-
$this->y = 705;
|
81 |
-
$this->_insertSenderAddessBar($page);
|
82 |
-
|
83 |
-
/* add header */
|
84 |
-
$this->y = 592;
|
85 |
-
$this->insertHeader($page, $order, $shipment);
|
86 |
-
|
87 |
-
// Add footer
|
88 |
-
$this->_addFooter($page, $shipment->getStore());
|
89 |
|
90 |
-
/* add table header */
|
91 |
$this->_setFontRegular($page, 9);
|
92 |
-
$this->y = 562;
|
93 |
$this->insertTableHeader($page);
|
94 |
|
95 |
-
$this->y -=20;
|
96 |
|
97 |
$position = 0;
|
98 |
|
@@ -101,7 +85,10 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
101 |
continue;
|
102 |
}
|
103 |
|
104 |
-
if ($this->y < 50
|
|
|
|
|
|
|
105 |
$page = $this->newPage(array());
|
106 |
}
|
107 |
|
@@ -111,6 +98,9 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
111 |
|
112 |
/* add note */
|
113 |
$page = $this->_insertNote($page, $order, $shipment);
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
$this->_afterGetPdf();
|
@@ -118,7 +108,30 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
118 |
return $pdf;
|
119 |
}
|
120 |
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
{
|
123 |
$page->setFillColor($this->colors['grey1']);
|
124 |
$page->setLineColor($this->colors['grey1']);
|
@@ -126,16 +139,37 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
126 |
$page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'] - 10, $this->y - 15);
|
127 |
|
128 |
$page->setFillColor($this->colors['black']);
|
129 |
-
$
|
130 |
|
131 |
$this->y -= 11;
|
132 |
-
$page->drawText(
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
$page->drawText(
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
{
|
140 |
$this->_setFontRegular($page, 9);
|
141 |
|
@@ -150,7 +184,8 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
150 |
/**
|
151 |
* Initialize renderer process.
|
152 |
*
|
153 |
-
* @param
|
|
|
154 |
* @return void
|
155 |
*/
|
156 |
protected function _initRenderer($type)
|
@@ -158,11 +193,11 @@ class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_En
|
|
158 |
parent::_initRenderer($type);
|
159 |
|
160 |
$this->_renderers['default'] = array(
|
161 |
-
'model'
|
162 |
'renderer' => null
|
163 |
);
|
164 |
$this->_renderers['bundle'] = array(
|
165 |
-
'model'
|
166 |
'renderer' => null
|
167 |
);
|
168 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
34 |
class FireGento_Pdf_Model_Engine_Shipment_Default extends FireGento_Pdf_Model_Engine_Abstract
|
35 |
{
|
36 |
|
37 |
+
/**
|
38 |
+
* constructor to set shipping mode
|
39 |
+
*/
|
40 |
public function __construct()
|
41 |
{
|
42 |
parent::__construct();
|
46 |
/**
|
47 |
* Return PDF document
|
48 |
*
|
49 |
+
* @param array $shipments list of shipments to generate pdfs for
|
50 |
+
*
|
51 |
* @return Zend_Pdf
|
52 |
*/
|
53 |
public function getPdf($shipments = array())
|
58 |
$pdf = new Zend_Pdf();
|
59 |
$this->_setPdf($pdf);
|
60 |
|
|
|
|
|
|
|
61 |
// pagecounter is 0 at the beginning, because it is incremented in newPage()
|
62 |
$this->pagecounter = 0;
|
63 |
|
66 |
Mage::app()->getLocale()->emulate($shipment->getStoreId());
|
67 |
Mage::app()->setCurrentStore($shipment->getStoreId());
|
68 |
}
|
|
|
|
|
69 |
$order = $shipment->getOrder();
|
70 |
+
$this->setOrder($order);
|
71 |
|
72 |
+
$page = $this->newPage(array());
|
|
|
73 |
|
74 |
+
$this->insertAddressesAndHeader($page, $shipment, $order);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
|
|
76 |
$this->_setFontRegular($page, 9);
|
|
|
77 |
$this->insertTableHeader($page);
|
78 |
|
79 |
+
$this->y -= 20;
|
80 |
|
81 |
$position = 0;
|
82 |
|
85 |
continue;
|
86 |
}
|
87 |
|
88 |
+
if ($this->y < 50
|
89 |
+
|| (Mage::getStoreConfig('sales_pdf/firegento_pdf/show_footer') == 1
|
90 |
+
&& $this->y < 100)
|
91 |
+
) {
|
92 |
$page = $this->newPage(array());
|
93 |
}
|
94 |
|
98 |
|
99 |
/* add note */
|
100 |
$page = $this->_insertNote($page, $order, $shipment);
|
101 |
+
|
102 |
+
// Add footer
|
103 |
+
$this->_addFooter($page, $shipment->getStore());
|
104 |
}
|
105 |
|
106 |
$this->_afterGetPdf();
|
108 |
return $pdf;
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* Inserts the customer's shipping address.
|
113 |
+
*
|
114 |
+
* @param Zend_Pdf_Page $page Current page object of Zend_Pdf
|
115 |
+
* @param Mage_Sales_Model_Order $order Order object
|
116 |
+
*
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
protected function _insertCustomerAddress(&$page, $order)
|
120 |
+
{
|
121 |
+
$this->_setFontRegular($page, 9);
|
122 |
+
$shipping = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
|
123 |
+
foreach ($shipping as $line) {
|
124 |
+
$page->drawText(trim(strip_tags($line)), $this->margin['left'], $this->y, $this->encoding);
|
125 |
+
$this->Ln(12);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* insert the table header of the shipment
|
131 |
+
*
|
132 |
+
* @param Zend_Pdf_Page $page page to write on
|
133 |
+
*/
|
134 |
+
protected function insertTableHeader($page)
|
135 |
{
|
136 |
$page->setFillColor($this->colors['grey1']);
|
137 |
$page->setLineColor($this->colors['grey1']);
|
139 |
$page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'] - 10, $this->y - 15);
|
140 |
|
141 |
$page->setFillColor($this->colors['black']);
|
142 |
+
$this->_setFontRegular($page, 9);
|
143 |
|
144 |
$this->y -= 11;
|
145 |
+
$page->drawText(
|
146 |
+
Mage::helper('firegento_pdf')->__('No.'),
|
147 |
+
$this->margin['left'],
|
148 |
+
$this->y,
|
149 |
+
$this->encoding
|
150 |
+
);
|
151 |
+
$page->drawText(
|
152 |
+
Mage::helper('firegento_pdf')->__('Description'),
|
153 |
+
$this->margin['left'] + 105,
|
154 |
+
$this->y,
|
155 |
+
$this->encoding
|
156 |
+
);
|
157 |
|
158 |
+
$page->drawText(
|
159 |
+
Mage::helper('firegento_pdf')->__('Qty'),
|
160 |
+
$this->margin['left'] + 450,
|
161 |
+
$this->y,
|
162 |
+
$this->encoding
|
163 |
+
);
|
164 |
}
|
165 |
|
166 |
+
/**
|
167 |
+
* insert address into pdf
|
168 |
+
*
|
169 |
+
* @param Zend_Pdf_Page $page to insert addres into
|
170 |
+
* @param Mage_Sales_Model_Order $order order to get address from
|
171 |
+
*/
|
172 |
+
protected function insertShippingAddress($page, $order)
|
173 |
{
|
174 |
$this->_setFontRegular($page, 9);
|
175 |
|
184 |
/**
|
185 |
* Initialize renderer process.
|
186 |
*
|
187 |
+
* @param string $type type to be initialized
|
188 |
+
*
|
189 |
* @return void
|
190 |
*/
|
191 |
protected function _initRenderer($type)
|
193 |
parent::_initRenderer($type);
|
194 |
|
195 |
$this->_renderers['default'] = array(
|
196 |
+
'model' => 'firegento_pdf/items_shipment_default',
|
197 |
'renderer' => null
|
198 |
);
|
199 |
$this->_renderers['bundle'] = array(
|
200 |
+
'model' => 'firegento_pdf/items_shipment_bundle',
|
201 |
'renderer' => null
|
202 |
);
|
203 |
}
|
app/code/community/FireGento/Pdf/Model/Invoice.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -29,7 +29,7 @@
|
|
29 |
* @category FireGento
|
30 |
* @package FireGento_Pdf
|
31 |
* @author FireGento Team <team@firegento.com>
|
32 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
33 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
34 |
* @version $Id:$
|
35 |
* @since 0.1.0
|
@@ -39,10 +39,16 @@ class FireGento_Pdf_Model_Invoice
|
|
39 |
|
40 |
/**
|
41 |
* The actual PDF engine responsible for rendering the file.
|
|
|
42 |
* @var Mage_Sales_Model_Order_Pdf_Abstract
|
43 |
*/
|
44 |
private $_engine;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
protected function getEngine()
|
47 |
{
|
48 |
if (!$this->_engine) {
|
@@ -60,6 +66,13 @@ class FireGento_Pdf_Model_Invoice
|
|
60 |
return $this->_engine;
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
public function getPdf($invoices = array())
|
64 |
{
|
65 |
return $this->getEngine()->getPdf($invoices);
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
29 |
* @category FireGento
|
30 |
* @package FireGento_Pdf
|
31 |
* @author FireGento Team <team@firegento.com>
|
32 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
33 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
34 |
* @version $Id:$
|
35 |
* @since 0.1.0
|
39 |
|
40 |
/**
|
41 |
* The actual PDF engine responsible for rendering the file.
|
42 |
+
*
|
43 |
* @var Mage_Sales_Model_Order_Pdf_Abstract
|
44 |
*/
|
45 |
private $_engine;
|
46 |
|
47 |
+
/**
|
48 |
+
* get pdf rendering engine
|
49 |
+
*
|
50 |
+
* @return Mage_Sales_Model_Order_Pdf_Abstract|Mage_Sales_Model_Order_Pdf_Invoice
|
51 |
+
*/
|
52 |
protected function getEngine()
|
53 |
{
|
54 |
if (!$this->_engine) {
|
66 |
return $this->_engine;
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* get pdf for invoices
|
71 |
+
*
|
72 |
+
* @param array $invoices invoices to render pdfs for
|
73 |
+
*
|
74 |
+
* @return mixed
|
75 |
+
*/
|
76 |
public function getPdf($invoices = array())
|
77 |
{
|
78 |
return $this->getEngine()->getPdf($invoices);
|
app/code/community/FireGento/Pdf/Model/Items/Bundle.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -36,15 +36,16 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
36 |
/**
|
37 |
* Draw item line.
|
38 |
*
|
39 |
-
* @param
|
|
|
40 |
* @return void
|
41 |
*/
|
42 |
public function draw($position = 1)
|
43 |
{
|
44 |
-
$order
|
45 |
-
$item
|
46 |
-
$pdf
|
47 |
-
$page
|
48 |
|
49 |
$fontSize = 9;
|
50 |
|
@@ -55,13 +56,12 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
55 |
$drawItems = array();
|
56 |
|
57 |
foreach ($items as $_item) {
|
58 |
-
$line
|
59 |
|
60 |
$attributes = $this->getSelectionAttributes($_item);
|
61 |
if (is_array($attributes)) {
|
62 |
-
$optionId
|
63 |
-
}
|
64 |
-
else {
|
65 |
$optionId = 0;
|
66 |
}
|
67 |
|
@@ -77,7 +77,7 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
77 |
$line[0] = array(
|
78 |
'font' => 'italic',
|
79 |
'text' => Mage::helper('core/string')->str_split($attributes['option_label'], 45, true, true),
|
80 |
-
'feed' => $pdf->margin['left'] +
|
81 |
'font_size' => $fontSize
|
82 |
);
|
83 |
|
@@ -100,16 +100,16 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
100 |
}
|
101 |
|
102 |
// draw Position Number
|
103 |
-
$line[]= array(
|
104 |
-
'text'
|
105 |
-
'feed'
|
106 |
-
'align'
|
107 |
'font_size' => $fontSize
|
108 |
);
|
109 |
|
110 |
$line[] = array(
|
111 |
-
'text'
|
112 |
-
'feed'
|
113 |
'font_size' => $fontSize
|
114 |
);
|
115 |
}
|
@@ -124,7 +124,7 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
124 |
}
|
125 |
$line[] = array(
|
126 |
'text' => Mage::helper('core/string')->str_split($name, 35, true, true),
|
127 |
-
'feed' => $pdf->margin['left'] +
|
128 |
'font_size' => $fontSize
|
129 |
);
|
130 |
|
@@ -132,31 +132,31 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
132 |
if ($this->canShowPriceInfo($_item)) {
|
133 |
$price = $order->formatPriceTxt($_item->getPrice());
|
134 |
$line[] = array(
|
135 |
-
'text'
|
136 |
-
'feed'
|
137 |
-
'align'
|
138 |
'font_size' => $fontSize
|
139 |
);
|
140 |
$line[] = array(
|
141 |
-
'text'
|
142 |
-
'feed'
|
143 |
-
'align'
|
144 |
'font_size' => $fontSize
|
145 |
);
|
146 |
|
147 |
$tax = $order->formatPriceTxt($_item->getTaxAmount());
|
148 |
$line[] = array(
|
149 |
-
'text'
|
150 |
-
'feed'
|
151 |
-
'align'
|
152 |
'font_size' => $fontSize
|
153 |
);
|
154 |
|
155 |
-
$
|
156 |
$line[] = array(
|
157 |
-
'text'
|
158 |
-
'feed'
|
159 |
-
'align'
|
160 |
'font_size' => $fontSize
|
161 |
);
|
162 |
}
|
@@ -171,9 +171,9 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
171 |
foreach ($options['options'] as $option) {
|
172 |
$lines = array();
|
173 |
$lines[][] = array(
|
174 |
-
'text'
|
175 |
-
'font'
|
176 |
-
'feed'
|
177 |
);
|
178 |
|
179 |
if ($option['value']) {
|
@@ -189,8 +189,8 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
189 |
}
|
190 |
|
191 |
$lines[][] = array(
|
192 |
-
'text'
|
193 |
-
'feed'
|
194 |
);
|
195 |
}
|
196 |
|
@@ -206,4 +206,4 @@ class FireGento_Pdf_Model_Items_Bundle extends Mage_Bundle_Model_Sales_Order_Pdf
|
|
206 |
|
207 |
$this->setPage($page);
|
208 |
}
|
209 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
36 |
/**
|
37 |
* Draw item line.
|
38 |
*
|
39 |
+
* @param int $position position of the product
|
40 |
+
*
|
41 |
* @return void
|
42 |
*/
|
43 |
public function draw($position = 1)
|
44 |
{
|
45 |
+
$order = $this->getOrder();
|
46 |
+
$item = $this->getItem();
|
47 |
+
$pdf = $this->getPdf();
|
48 |
+
$page = $this->getPage();
|
49 |
|
50 |
$fontSize = 9;
|
51 |
|
56 |
$drawItems = array();
|
57 |
|
58 |
foreach ($items as $_item) {
|
59 |
+
$line = array();
|
60 |
|
61 |
$attributes = $this->getSelectionAttributes($_item);
|
62 |
if (is_array($attributes)) {
|
63 |
+
$optionId = $attributes['option_id'];
|
64 |
+
} else {
|
|
|
65 |
$optionId = 0;
|
66 |
}
|
67 |
|
77 |
$line[0] = array(
|
78 |
'font' => 'italic',
|
79 |
'text' => Mage::helper('core/string')->str_split($attributes['option_label'], 45, true, true),
|
80 |
+
'feed' => $pdf->margin['left'] + 130,
|
81 |
'font_size' => $fontSize
|
82 |
);
|
83 |
|
100 |
}
|
101 |
|
102 |
// draw Position Number
|
103 |
+
$line[] = array(
|
104 |
+
'text' => $position,
|
105 |
+
'feed' => $pdf->margin['left'] + 10,
|
106 |
+
'align' => 'right',
|
107 |
'font_size' => $fontSize
|
108 |
);
|
109 |
|
110 |
$line[] = array(
|
111 |
+
'text' => $text,
|
112 |
+
'feed' => $pdf->margin['left'] + 25,
|
113 |
'font_size' => $fontSize
|
114 |
);
|
115 |
}
|
124 |
}
|
125 |
$line[] = array(
|
126 |
'text' => Mage::helper('core/string')->str_split($name, 35, true, true),
|
127 |
+
'feed' => $pdf->margin['left'] + 130,
|
128 |
'font_size' => $fontSize
|
129 |
);
|
130 |
|
132 |
if ($this->canShowPriceInfo($_item)) {
|
133 |
$price = $order->formatPriceTxt($_item->getPrice());
|
134 |
$line[] = array(
|
135 |
+
'text' => $price,
|
136 |
+
'feed' => $pdf->margin['right'] - 160,
|
137 |
+
'align' => 'right',
|
138 |
'font_size' => $fontSize
|
139 |
);
|
140 |
$line[] = array(
|
141 |
+
'text' => $_item->getQty() * 1,
|
142 |
+
'feed' => $pdf->margin['right'] - 120,
|
143 |
+
'align' => 'right',
|
144 |
'font_size' => $fontSize
|
145 |
);
|
146 |
|
147 |
$tax = $order->formatPriceTxt($_item->getTaxAmount());
|
148 |
$line[] = array(
|
149 |
+
'text' => $tax,
|
150 |
+
'feed' => $pdf->margin['right'] - 60,
|
151 |
+
'align' => 'right',
|
152 |
'font_size' => $fontSize
|
153 |
);
|
154 |
|
155 |
+
$rowTotal = $order->formatPriceTxt($_item->getRowTotal());
|
156 |
$line[] = array(
|
157 |
+
'text' => $rowTotal,
|
158 |
+
'feed' => $pdf->margin['right'] - 10,
|
159 |
+
'align' => 'right',
|
160 |
'font_size' => $fontSize
|
161 |
);
|
162 |
}
|
171 |
foreach ($options['options'] as $option) {
|
172 |
$lines = array();
|
173 |
$lines[][] = array(
|
174 |
+
'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, true, true),
|
175 |
+
'font' => 'italic',
|
176 |
+
'feed' => 35
|
177 |
);
|
178 |
|
179 |
if ($option['value']) {
|
189 |
}
|
190 |
|
191 |
$lines[][] = array(
|
192 |
+
'text' => $text,
|
193 |
+
'feed' => 40
|
194 |
);
|
195 |
}
|
196 |
|
206 |
|
207 |
$this->setPage($page);
|
208 |
}
|
209 |
+
}
|
app/code/community/FireGento/Pdf/Model/Items/Default.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -36,7 +36,8 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
|
|
36 |
/**
|
37 |
* Draw item line.
|
38 |
*
|
39 |
-
* @param
|
|
|
40 |
* @return void
|
41 |
*/
|
42 |
public function draw($position = 1)
|
@@ -50,16 +51,18 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
|
|
50 |
$fontSize = 9;
|
51 |
|
52 |
// draw Position Number
|
53 |
-
$lines[0] = array(
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
59 |
|
60 |
// draw SKU
|
61 |
$lines[0][] = array(
|
62 |
-
'text' => Mage::helper('core/string')->str_split($this->getSku($item),
|
63 |
'feed' => $pdf->margin['left'] + 25,
|
64 |
'font_size' => $fontSize
|
65 |
);
|
@@ -67,89 +70,81 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
|
|
67 |
// draw Product name
|
68 |
$lines[0][] = array(
|
69 |
'text' => Mage::helper('core/string')->str_split($item->getName(), 40, true, true),
|
70 |
-
'feed' => $pdf->margin['left'] +
|
71 |
'font_size' => $fontSize
|
72 |
);
|
73 |
|
74 |
$options = $this->getItemOptions();
|
75 |
if ($options) {
|
76 |
foreach ($options as $option) {
|
77 |
-
|
78 |
-
|
79 |
-
'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, false, true),
|
80 |
-
'font' => 'bold',
|
81 |
-
'feed' => $pdf->margin['left'] + 120
|
82 |
-
);
|
83 |
-
|
84 |
-
// draw options value
|
85 |
if ($option['value']) {
|
86 |
-
$
|
87 |
-
$values = explode(', ', $_printValue);
|
88 |
-
foreach ($values as $value) {
|
89 |
-
$lines[][] = array(
|
90 |
-
'text' => Mage::helper('core/string')->str_split($value, 60, true, true),
|
91 |
-
'feed' => $pdf->margin['left'] + 120
|
92 |
-
);
|
93 |
-
}
|
94 |
}
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
}
|
97 |
|
98 |
$columns = array();
|
99 |
// prepare qty
|
100 |
$columns['qty'] = array(
|
101 |
-
'text'
|
102 |
-
'align'
|
103 |
'font_size' => $fontSize,
|
104 |
-
'_width' =>
|
105 |
);
|
106 |
|
107 |
// prepare price
|
108 |
$columns['price'] = array(
|
109 |
-
'text'
|
110 |
-
'align'
|
111 |
'font_size' => $fontSize,
|
112 |
-
'_width'
|
113 |
);
|
114 |
|
115 |
// prepare price_incl_tax
|
116 |
$columns['price_incl_tax'] = array(
|
117 |
-
'text'
|
118 |
-
'align'
|
119 |
'font_size' => $fontSize,
|
120 |
-
'_width'
|
121 |
);
|
122 |
|
123 |
// prepare tax
|
124 |
$columns['tax'] = array(
|
125 |
-
'text'
|
126 |
-
'align'
|
127 |
'font_size' => $fontSize,
|
128 |
-
'_width'
|
129 |
);
|
130 |
|
131 |
// prepare tax_rate
|
132 |
$columns['tax_rate'] = array(
|
133 |
-
'text'
|
134 |
-
'align'
|
135 |
'font_size' => $fontSize,
|
136 |
-
'_width'
|
137 |
);
|
138 |
|
139 |
// prepare subtotal
|
140 |
$columns['subtotal'] = array(
|
141 |
-
'text'
|
142 |
-
'align'
|
143 |
'font_size' => $fontSize,
|
144 |
-
'_width'
|
145 |
);
|
146 |
|
147 |
// prepare subtotal_incl_tax
|
148 |
$columns['subtotal_incl_tax'] = array(
|
149 |
-
'text'
|
150 |
-
'align'
|
151 |
'font_size' => $fontSize,
|
152 |
-
'_width'
|
153 |
);
|
154 |
|
155 |
// draw columns in specified order
|
@@ -175,18 +170,18 @@ class FireGento_Pdf_Model_Items_Default extends Mage_Sales_Model_Order_Pdf_Items
|
|
175 |
$order->formatPriceTxt($item->getDiscountAmount())
|
176 |
);
|
177 |
$lines[][] = array(
|
178 |
-
'text'
|
179 |
'align' => 'right',
|
180 |
-
'feed'
|
181 |
);
|
182 |
}
|
183 |
|
184 |
$lineBlock = array(
|
185 |
-
'lines'
|
186 |
'height' => 15
|
187 |
);
|
188 |
|
189 |
$page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
|
190 |
$this->setPage($page);
|
191 |
}
|
192 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
36 |
/**
|
37 |
* Draw item line.
|
38 |
*
|
39 |
+
* @param int $position position of the product
|
40 |
+
*
|
41 |
* @return void
|
42 |
*/
|
43 |
public function draw($position = 1)
|
51 |
$fontSize = 9;
|
52 |
|
53 |
// draw Position Number
|
54 |
+
$lines[0] = array(
|
55 |
+
array(
|
56 |
+
'text' => $position,
|
57 |
+
'feed' => $pdf->margin['left'] + 10,
|
58 |
+
'align' => 'right',
|
59 |
+
'font_size' => $fontSize
|
60 |
+
)
|
61 |
+
);
|
62 |
|
63 |
// draw SKU
|
64 |
$lines[0][] = array(
|
65 |
+
'text' => Mage::helper('core/string')->str_split($this->getSku($item), 19),
|
66 |
'feed' => $pdf->margin['left'] + 25,
|
67 |
'font_size' => $fontSize
|
68 |
);
|
70 |
// draw Product name
|
71 |
$lines[0][] = array(
|
72 |
'text' => Mage::helper('core/string')->str_split($item->getName(), 40, true, true),
|
73 |
+
'feed' => $pdf->margin['left'] + 130,
|
74 |
'font_size' => $fontSize
|
75 |
);
|
76 |
|
77 |
$options = $this->getItemOptions();
|
78 |
if ($options) {
|
79 |
foreach ($options as $option) {
|
80 |
+
$optionTxt = $option['label'] . ': ';
|
81 |
+
// append option value
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
if ($option['value']) {
|
83 |
+
$optionTxt .= isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
+
$optionArray = $pdf->_prepareText($optionTxt, $page, $pdf->getFontRegular(), $fontSize, 215);
|
86 |
+
$lines[][] = array(
|
87 |
+
'text' => $optionArray,
|
88 |
+
'feed' => $pdf->margin['left'] + 135
|
89 |
+
);
|
90 |
}
|
91 |
}
|
92 |
|
93 |
$columns = array();
|
94 |
// prepare qty
|
95 |
$columns['qty'] = array(
|
96 |
+
'text' => $item->getQty() * 1,
|
97 |
+
'align' => 'right',
|
98 |
'font_size' => $fontSize,
|
99 |
+
'_width' => 30
|
100 |
);
|
101 |
|
102 |
// prepare price
|
103 |
$columns['price'] = array(
|
104 |
+
'text' => $order->formatPriceTxt($item->getPrice()),
|
105 |
+
'align' => 'right',
|
106 |
'font_size' => $fontSize,
|
107 |
+
'_width' => 60
|
108 |
);
|
109 |
|
110 |
// prepare price_incl_tax
|
111 |
$columns['price_incl_tax'] = array(
|
112 |
+
'text' => $order->formatPriceTxt($item->getPriceInclTax()),
|
113 |
+
'align' => 'right',
|
114 |
'font_size' => $fontSize,
|
115 |
+
'_width' => 60
|
116 |
);
|
117 |
|
118 |
// prepare tax
|
119 |
$columns['tax'] = array(
|
120 |
+
'text' => $order->formatPriceTxt($item->getTaxAmount()),
|
121 |
+
'align' => 'right',
|
122 |
'font_size' => $fontSize,
|
123 |
+
'_width' => 50
|
124 |
);
|
125 |
|
126 |
// prepare tax_rate
|
127 |
$columns['tax_rate'] = array(
|
128 |
+
'text' => round($item->getOrderItem()->getTaxPercent(), 2) . '%',
|
129 |
+
'align' => 'right',
|
130 |
'font_size' => $fontSize,
|
131 |
+
'_width' => 50
|
132 |
);
|
133 |
|
134 |
// prepare subtotal
|
135 |
$columns['subtotal'] = array(
|
136 |
+
'text' => $order->formatPriceTxt($item->getPrice() * $item->getQty() * 1),
|
137 |
+
'align' => 'right',
|
138 |
'font_size' => $fontSize,
|
139 |
+
'_width' => 50
|
140 |
);
|
141 |
|
142 |
// prepare subtotal_incl_tax
|
143 |
$columns['subtotal_incl_tax'] = array(
|
144 |
+
'text' => $order->formatPriceTxt(($item->getPrice() * $item->getQty() * 1) + $item->getTaxAmount()),
|
145 |
+
'align' => 'right',
|
146 |
'font_size' => $fontSize,
|
147 |
+
'_width' => 70
|
148 |
);
|
149 |
|
150 |
// draw columns in specified order
|
170 |
$order->formatPriceTxt($item->getDiscountAmount())
|
171 |
);
|
172 |
$lines[][] = array(
|
173 |
+
'text' => $text,
|
174 |
'align' => 'right',
|
175 |
+
'feed' => $pdf->margin['right'] - $columnOffset
|
176 |
);
|
177 |
}
|
178 |
|
179 |
$lineBlock = array(
|
180 |
+
'lines' => $lines,
|
181 |
'height' => 15
|
182 |
);
|
183 |
|
184 |
$page = $pdf->drawLineBlocks($page, array($lineBlock), array('table_header' => true));
|
185 |
$this->setPage($page);
|
186 |
}
|
187 |
+
}
|
app/code/community/FireGento/Pdf/Model/Items/Grouped.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
*/
|
21 |
/**
|
@@ -24,7 +24,7 @@
|
|
24 |
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
28 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
*/
|
30 |
class FireGento_Pdf_Model_Items_Grouped extends Mage_Sales_Model_Order_Pdf_Items_Invoice_Grouped
|
@@ -32,7 +32,8 @@ class FireGento_Pdf_Model_Items_Grouped extends Mage_Sales_Model_Order_Pdf_Items
|
|
32 |
/**
|
33 |
* Draw item line.
|
34 |
*
|
35 |
-
* @param
|
|
|
36 |
* @return void
|
37 |
*/
|
38 |
public function draw($position = 1)
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
*/
|
21 |
/**
|
24 |
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
28 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
*/
|
30 |
class FireGento_Pdf_Model_Items_Grouped extends Mage_Sales_Model_Order_Pdf_Items_Invoice_Grouped
|
32 |
/**
|
33 |
* Draw item line.
|
34 |
*
|
35 |
+
* @param int $position position of the product
|
36 |
+
*
|
37 |
* @return void
|
38 |
*/
|
39 |
public function draw($position = 1)
|
app/code/community/FireGento/Pdf/Model/Items/Shipment/Bundle.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
*/
|
21 |
/**
|
@@ -24,7 +24,7 @@
|
|
24 |
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
28 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
* @version $Id:$
|
30 |
* @since 0.1.0
|
@@ -56,8 +56,7 @@ class FireGento_Pdf_Model_Items_Shipment_Bundle extends Mage_Bundle_Model_Sales_
|
|
56 |
$attributes = $this->getSelectionAttributes($_item);
|
57 |
if (is_array($attributes)) {
|
58 |
$optionId = $attributes['option_id'];
|
59 |
-
}
|
60 |
-
else {
|
61 |
$optionId = 0;
|
62 |
}
|
63 |
|
@@ -102,10 +101,8 @@ class FireGento_Pdf_Model_Items_Shipment_Bundle extends Mage_Bundle_Model_Sales_
|
|
102 |
|
103 |
// draw Name
|
104 |
if ($_item->getParentItem()) {
|
105 |
-
#$feed = 155;
|
106 |
$name = $this->getValueHtml($_item);
|
107 |
} else {
|
108 |
-
#$feed = 150;
|
109 |
$name = $_item->getName();
|
110 |
}
|
111 |
$text = array();
|
@@ -124,7 +121,7 @@ class FireGento_Pdf_Model_Items_Shipment_Bundle extends Mage_Bundle_Model_Sales_
|
|
124 |
) {
|
125 |
if (isset($shipItems[$_item->getId()])) {
|
126 |
$qty = $shipItems[$_item->getId()]->getQty()*1;
|
127 |
-
}
|
128 |
$qty = Mage::helper('bundle')->__('N/A');
|
129 |
} else {
|
130 |
$qty = 0;
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
*/
|
21 |
/**
|
24 |
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
28 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
* @version $Id:$
|
30 |
* @since 0.1.0
|
56 |
$attributes = $this->getSelectionAttributes($_item);
|
57 |
if (is_array($attributes)) {
|
58 |
$optionId = $attributes['option_id'];
|
59 |
+
} else {
|
|
|
60 |
$optionId = 0;
|
61 |
}
|
62 |
|
101 |
|
102 |
// draw Name
|
103 |
if ($_item->getParentItem()) {
|
|
|
104 |
$name = $this->getValueHtml($_item);
|
105 |
} else {
|
|
|
106 |
$name = $_item->getName();
|
107 |
}
|
108 |
$text = array();
|
121 |
) {
|
122 |
if (isset($shipItems[$_item->getId()])) {
|
123 |
$qty = $shipItems[$_item->getId()]->getQty()*1;
|
124 |
+
} elseif ($_item->getIsVirtual()) {
|
125 |
$qty = Mage::helper('bundle')->__('N/A');
|
126 |
} else {
|
127 |
$qty = 0;
|
app/code/community/FireGento/Pdf/Model/Items/Shipment/Default.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -80,17 +80,17 @@ class FireGento_Pdf_Model_Items_Shipment_Default extends Mage_Sales_Model_Order_
|
|
80 |
$lines[][] = array(
|
81 |
'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, false, true),
|
82 |
'font' => 'bold',
|
83 |
-
'feed' => $pdf->margin['left'] +
|
84 |
);
|
85 |
|
86 |
// draw options value
|
87 |
if ($option['value']) {
|
88 |
-
$
|
89 |
-
$values = explode(', ', $
|
90 |
foreach ($values as $value) {
|
91 |
$lines[][] = array(
|
92 |
'text' => Mage::helper('core/string')->str_split($value, 60, true, true),
|
93 |
-
'feed' => $pdf->margin['left'] +
|
94 |
);
|
95 |
}
|
96 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
80 |
$lines[][] = array(
|
81 |
'text' => Mage::helper('core/string')->str_split(strip_tags($option['label']), 40, false, true),
|
82 |
'font' => 'bold',
|
83 |
+
'feed' => $pdf->margin['left'] + 130
|
84 |
);
|
85 |
|
86 |
// draw options value
|
87 |
if ($option['value']) {
|
88 |
+
$_printVal = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
|
89 |
+
$values = explode(', ', $_printVal);
|
90 |
foreach ($values as $value) {
|
91 |
$lines[][] = array(
|
92 |
'text' => Mage::helper('core/string')->str_split($value, 60, true, true),
|
93 |
+
'feed' => $pdf->margin['left'] + 130
|
94 |
);
|
95 |
}
|
96 |
}
|
app/code/community/FireGento/Pdf/Model/Observer.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -36,21 +36,46 @@ class FireGento_Pdf_Model_Observer
|
|
36 |
/**
|
37 |
* Add notes to invoice document.
|
38 |
*
|
39 |
-
* @param
|
|
|
40 |
* @return FireGento_Pdf_Model_Observer
|
41 |
*/
|
42 |
public function addInvoiceNotes(Varien_Event_Observer $observer)
|
43 |
{
|
|
|
44 |
$this->addInvoiceMaturity($observer);
|
45 |
$this->addPaymentMethod($observer);
|
46 |
$this->addShippingMethod($observer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
return $this;
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Add maturity to invoice notes.
|
52 |
*
|
53 |
-
* @param
|
|
|
54 |
* @return FireGento_Pdf_Model_Observer
|
55 |
*/
|
56 |
public function addInvoiceMaturity(Varien_Event_Observer $observer)
|
@@ -60,7 +85,9 @@ class FireGento_Pdf_Model_Observer
|
|
60 |
|
61 |
$maturity = Mage::getStoreConfig('sales_pdf/invoice/maturity');
|
62 |
if (!empty($maturity) || 0 < $maturity) {
|
63 |
-
$maturity = Mage::helper('firegento_pdf')->__(
|
|
|
|
|
64 |
} elseif ('0' === $maturity) {
|
65 |
$maturity = Mage::helper('firegento_pdf')->__('Invoice is payable immediately');
|
66 |
}
|
@@ -73,18 +100,23 @@ class FireGento_Pdf_Model_Observer
|
|
73 |
/**
|
74 |
* Add payment method to invoice notes.
|
75 |
*
|
76 |
-
* @param
|
|
|
77 |
* @return FireGento_Pdf_Model_Observer
|
78 |
*/
|
79 |
public function addPaymentMethod(Varien_Event_Observer $observer)
|
80 |
{
|
81 |
-
if (Mage::getStoreConfig('sales_pdf/invoice/payment_method_position')
|
|
|
|
|
82 |
return $this;
|
83 |
}
|
84 |
|
85 |
$result = $observer->getResult();
|
86 |
$notes = $result->getNotes();
|
87 |
-
$notes[] = Mage::helper('firegento_pdf')->__(
|
|
|
|
|
88 |
$result->setNotes($notes);
|
89 |
return $this;
|
90 |
}
|
@@ -92,19 +124,99 @@ class FireGento_Pdf_Model_Observer
|
|
92 |
/**
|
93 |
* Add shipping method to invoice notes.
|
94 |
*
|
95 |
-
* @param
|
|
|
96 |
* @return FireGento_Pdf_Model_Observer
|
97 |
*/
|
98 |
public function addShippingMethod(Varien_Event_Observer $observer)
|
99 |
{
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
return $this;
|
102 |
}
|
103 |
|
104 |
$result = $observer->getResult();
|
105 |
$notes = $result->getNotes();
|
106 |
-
$notes[] = Mage::helper('firegento_pdf')->__(
|
|
|
|
|
107 |
$result->setNotes($notes);
|
108 |
return $this;
|
109 |
}
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
36 |
/**
|
37 |
* Add notes to invoice document.
|
38 |
*
|
39 |
+
* @param Varien_Event_Observer $observer observer object
|
40 |
+
*
|
41 |
* @return FireGento_Pdf_Model_Observer
|
42 |
*/
|
43 |
public function addInvoiceNotes(Varien_Event_Observer $observer)
|
44 |
{
|
45 |
+
$this->addInvoiceDateNotice($observer);
|
46 |
$this->addInvoiceMaturity($observer);
|
47 |
$this->addPaymentMethod($observer);
|
48 |
$this->addShippingMethod($observer);
|
49 |
+
$this->addInvoiceComments($observer);
|
50 |
+
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* add inovoice date notice to pdf
|
56 |
+
*
|
57 |
+
* @param Varien_Event_Observer $observer observer object
|
58 |
+
*
|
59 |
+
* @return $this
|
60 |
+
*/
|
61 |
+
public function addInvoiceDateNotice(Varien_Event_Observer $observer)
|
62 |
+
{
|
63 |
+
if (!Mage::getStoreConfigFlag('sales_pdf/invoice/show_date_notice')) {
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
$result = $observer->getResult();
|
68 |
+
$notes = $result->getNotes();
|
69 |
+
$notes[] = Mage::helper('firegento_pdf')->__('Invoice date is equal to delivery date.');
|
70 |
+
$result->setNotes($notes);
|
71 |
return $this;
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
* Add maturity to invoice notes.
|
76 |
*
|
77 |
+
* @param Varien_Event_Observer $observer observer object
|
78 |
+
*
|
79 |
* @return FireGento_Pdf_Model_Observer
|
80 |
*/
|
81 |
public function addInvoiceMaturity(Varien_Event_Observer $observer)
|
85 |
|
86 |
$maturity = Mage::getStoreConfig('sales_pdf/invoice/maturity');
|
87 |
if (!empty($maturity) || 0 < $maturity) {
|
88 |
+
$maturity = Mage::helper('firegento_pdf')->__(
|
89 |
+
'Invoice maturity: %s days', Mage::getStoreConfig('sales_pdf/invoice/maturity')
|
90 |
+
);
|
91 |
} elseif ('0' === $maturity) {
|
92 |
$maturity = Mage::helper('firegento_pdf')->__('Invoice is payable immediately');
|
93 |
}
|
100 |
/**
|
101 |
* Add payment method to invoice notes.
|
102 |
*
|
103 |
+
* @param Varien_Event_Observer $observer observer object
|
104 |
+
*
|
105 |
* @return FireGento_Pdf_Model_Observer
|
106 |
*/
|
107 |
public function addPaymentMethod(Varien_Event_Observer $observer)
|
108 |
{
|
109 |
+
if (Mage::getStoreConfig('sales_pdf/invoice/payment_method_position')
|
110 |
+
!= FireGento_Pdf_Model_System_Config_Source_Payment::POSITION_NOTE
|
111 |
+
) {
|
112 |
return $this;
|
113 |
}
|
114 |
|
115 |
$result = $observer->getResult();
|
116 |
$notes = $result->getNotes();
|
117 |
+
$notes[] = Mage::helper('firegento_pdf')->__(
|
118 |
+
'Payment method: %s', $observer->getOrder()->getPayment()->getMethodInstance()->getTitle()
|
119 |
+
);
|
120 |
$result->setNotes($notes);
|
121 |
return $this;
|
122 |
}
|
124 |
/**
|
125 |
* Add shipping method to invoice notes.
|
126 |
*
|
127 |
+
* @param Varien_Event_Observer $observer observer object
|
128 |
+
*
|
129 |
* @return FireGento_Pdf_Model_Observer
|
130 |
*/
|
131 |
public function addShippingMethod(Varien_Event_Observer $observer)
|
132 |
{
|
133 |
+
$invoice = $observer->getInvoice();
|
134 |
+
$shipment = $observer->getShipment();
|
135 |
+
if (empty($invoice) && empty($shipment)
|
136 |
+
|| !empty($invoice) && Mage::getStoreConfig('sales_pdf/invoice/shipping_method_position')
|
137 |
+
!= FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_NOTE
|
138 |
+
|| !empty($shipment) && Mage::getStoreConfig('sales_pdf/shipment/shipping_method_position')
|
139 |
+
!= FireGento_Pdf_Model_System_Config_Source_Shipping::POSITION_NOTE
|
140 |
+
) {
|
141 |
return $this;
|
142 |
}
|
143 |
|
144 |
$result = $observer->getResult();
|
145 |
$notes = $result->getNotes();
|
146 |
+
$notes[] = Mage::helper('firegento_pdf')->__(
|
147 |
+
'Shipping method: %s', $observer->getOrder()->getShippingDescription()
|
148 |
+
);
|
149 |
$result->setNotes($notes);
|
150 |
return $this;
|
151 |
}
|
152 |
+
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Add the invoice comments
|
156 |
+
*
|
157 |
+
* @param Varien_Event_Observer $observer observer object
|
158 |
+
*
|
159 |
+
* @return $this
|
160 |
+
*/
|
161 |
+
public function addInvoiceComments(Varien_Event_Observer $observer)
|
162 |
+
{
|
163 |
+
if (!Mage::getStoreConfigFlag('sales_pdf/invoice/show_comments')) {
|
164 |
+
return $this;
|
165 |
+
}
|
166 |
+
|
167 |
+
/** @var Mage_Sales_Model_Order_Invoice $invoice */
|
168 |
+
$invoice = $observer->getInvoice();
|
169 |
+
|
170 |
+
/** @var Mage_Sales_Model_Resource_Order_Invoice_Comment_Collection $commentsCollection */
|
171 |
+
$commentsCollection = $invoice->getCommentsCollection();
|
172 |
+
$commentsCollection->addVisibleOnFrontFilter();
|
173 |
+
|
174 |
+
$result = $observer->getResult();
|
175 |
+
$notes = $result->getNotes();
|
176 |
+
|
177 |
+
foreach ($commentsCollection as $comment) {
|
178 |
+
/** @var $comment Mage_Sales_Model_Order_Invoice_Comment */
|
179 |
+
$notes[] = $comment->getComment();
|
180 |
+
}
|
181 |
+
|
182 |
+
$result->setNotes($notes);
|
183 |
+
return $this;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Adds a barcode representing the order number to the shipment if activated.
|
188 |
+
*
|
189 |
+
* @param Varien_Event_Observer $observer
|
190 |
+
*
|
191 |
+
* @return $this
|
192 |
+
*/
|
193 |
+
public function addBarcode(Varien_Event_Observer $observer)
|
194 |
+
{
|
195 |
+
if (!Mage::getStoreConfigFlag('sales_pdf/shipment/order_id_as_barcode')) {
|
196 |
+
return $this;
|
197 |
+
}
|
198 |
+
$page = $observer->getPage();
|
199 |
+
$order = $observer->getOrder();
|
200 |
+
|
201 |
+
$barcodeConfig = array(
|
202 |
+
'drawText' => false,
|
203 |
+
'orientation' => 90,
|
204 |
+
'text' => $order->getIncrementId()
|
205 |
+
);
|
206 |
+
$rendererConfig = array(
|
207 |
+
'verticalPosition' => 'middle',
|
208 |
+
'moduleSize' => 0.9
|
209 |
+
);
|
210 |
+
// create dummy Zend_Pdf object, which just stores the current page, so that we can pass it in
|
211 |
+
// Zend_Barcode_Renderer_Pdf->setResource()
|
212 |
+
$pdf = new Zend_Pdf();
|
213 |
+
$pdf->pages[] = $page;
|
214 |
+
/** @var $renderer Zend_Barcode_Renderer_Pdf */
|
215 |
+
$renderer = Zend_Barcode::factory('code128', 'pdf', $barcodeConfig, $rendererConfig)->setResource($pdf, 0);
|
216 |
+
// calculate left offset so that barcode is printed on the right with a little margin
|
217 |
+
$leftOffset = $page->getWidth() - $renderer->getBarcode()->getWidth(true) * $renderer->getModuleSize() - 10;
|
218 |
+
$renderer->setLeftOffset($leftOffset);
|
219 |
+
$renderer->draw();
|
220 |
+
return $this;
|
221 |
+
}
|
222 |
+
}
|
app/code/community/FireGento/Pdf/Model/Shipment.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -36,10 +36,16 @@ class FireGento_Pdf_Model_Shipment
|
|
36 |
|
37 |
/**
|
38 |
* The actual PDF engine responsible for rendering the file.
|
|
|
39 |
* @var Mage_Sales_Model_Order_Pdf_Abstract
|
40 |
*/
|
41 |
private $_engine;
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
protected function getEngine()
|
44 |
{
|
45 |
if (!$this->_engine) {
|
@@ -57,6 +63,13 @@ class FireGento_Pdf_Model_Shipment
|
|
57 |
return $this->_engine;
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function getPdf($shipments = array())
|
61 |
{
|
62 |
return $this->getEngine()->getPdf($shipments);
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
36 |
|
37 |
/**
|
38 |
* The actual PDF engine responsible for rendering the file.
|
39 |
+
*
|
40 |
* @var Mage_Sales_Model_Order_Pdf_Abstract
|
41 |
*/
|
42 |
private $_engine;
|
43 |
|
44 |
+
/**
|
45 |
+
* get pdf rendering engine
|
46 |
+
*
|
47 |
+
* @return Mage_Sales_Model_Order_Pdf_Abstract|Mage_Sales_Model_Order_Pdf_Shipment
|
48 |
+
*/
|
49 |
protected function getEngine()
|
50 |
{
|
51 |
if (!$this->_engine) {
|
63 |
return $this->_engine;
|
64 |
}
|
65 |
|
66 |
+
/**
|
67 |
+
* get PDF object
|
68 |
+
*
|
69 |
+
* @param array $shipments shipments to generate pdfs for
|
70 |
+
*
|
71 |
+
* @return mixed
|
72 |
+
*/
|
73 |
public function getPdf($shipments = array())
|
74 |
{
|
75 |
return $this->getEngine()->getPdf($shipments);
|
app/code/community/FireGento/Pdf/Model/System/Config/Source/Creditmemo/Engine.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -56,8 +56,8 @@ class FireGento_Pdf_Model_System_Config_Source_Creditmemo_Engine
|
|
56 |
$engineNodes = Mage::app()->getConfig()->getNode(self::XML_PATH_PDF_ENGINE);
|
57 |
if ($engineNodes && $engineNodes->hasChildren()) {
|
58 |
foreach ($engineNodes->children() as $engineName => $engineNode) {
|
59 |
-
$className = (string)$engineNode->class;
|
60 |
-
$engineLabel = Mage::helper('firegento_pdf')->__((string)$engineNode->label);
|
61 |
$engines[$className] = $engineLabel;
|
62 |
}
|
63 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
56 |
$engineNodes = Mage::app()->getConfig()->getNode(self::XML_PATH_PDF_ENGINE);
|
57 |
if ($engineNodes && $engineNodes->hasChildren()) {
|
58 |
foreach ($engineNodes->children() as $engineName => $engineNode) {
|
59 |
+
$className = (string) $engineNode->class;
|
60 |
+
$engineLabel = Mage::helper('firegento_pdf')->__((string) $engineNode->label);
|
61 |
$engines[$className] = $engineLabel;
|
62 |
}
|
63 |
}
|
app/code/community/FireGento/Pdf/Model/System/Config/Source/Invoice/Engine.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -56,8 +56,8 @@ class FireGento_Pdf_Model_System_Config_Source_Invoice_Engine
|
|
56 |
$engineNodes = Mage::app()->getConfig()->getNode(self::XML_PATH_PDF_ENGINE);
|
57 |
if ($engineNodes && $engineNodes->hasChildren()) {
|
58 |
foreach ($engineNodes->children() as $engineName => $engineNode) {
|
59 |
-
$className = (string)$engineNode->class;
|
60 |
-
$engineLabel = Mage::helper('firegento_pdf')->__((string)$engineNode->label);
|
61 |
$engines[$className] = $engineLabel;
|
62 |
}
|
63 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
56 |
$engineNodes = Mage::app()->getConfig()->getNode(self::XML_PATH_PDF_ENGINE);
|
57 |
if ($engineNodes && $engineNodes->hasChildren()) {
|
58 |
foreach ($engineNodes->children() as $engineName => $engineNode) {
|
59 |
+
$className = (string) $engineNode->class;
|
60 |
+
$engineLabel = Mage::helper('firegento_pdf')->__((string) $engineNode->label);
|
61 |
$engines[$className] = $engineLabel;
|
62 |
}
|
63 |
}
|
app/code/community/FireGento/Pdf/Model/System/Config/Source/Logo.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,13 +26,18 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
33 |
*/
|
34 |
class FireGento_Pdf_Model_System_Config_Source_Logo
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Return array of possible positions.
|
38 |
*
|
@@ -41,9 +46,10 @@ class FireGento_Pdf_Model_System_Config_Source_Logo
|
|
41 |
public function toOptionArray()
|
42 |
{
|
43 |
$positions = array(
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
47 |
);
|
48 |
$options = array();
|
49 |
foreach ($positions as $k => $v) {
|
@@ -54,4 +60,4 @@ class FireGento_Pdf_Model_System_Config_Source_Logo
|
|
54 |
}
|
55 |
return $options;
|
56 |
}
|
57 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
33 |
*/
|
34 |
class FireGento_Pdf_Model_System_Config_Source_Logo
|
35 |
{
|
36 |
+
const LEFT = 'left';
|
37 |
+
const CENTER = 'center';
|
38 |
+
const RIGHT = 'right';
|
39 |
+
const FULL_WIDTH = 'full_width';
|
40 |
+
|
41 |
/**
|
42 |
* Return array of possible positions.
|
43 |
*
|
46 |
public function toOptionArray()
|
47 |
{
|
48 |
$positions = array(
|
49 |
+
self::LEFT => Mage::helper('firegento_pdf')->__('Left'),
|
50 |
+
self::CENTER => Mage::helper('firegento_pdf')->__('Center'),
|
51 |
+
self::RIGHT => Mage::helper('firegento_pdf')->__('Right'),
|
52 |
+
self::FULL_WIDTH => Mage::helper('firegento_pdf')->__('Full width')
|
53 |
);
|
54 |
$options = array();
|
55 |
foreach ($positions as $k => $v) {
|
60 |
}
|
61 |
return $options;
|
62 |
}
|
63 |
+
}
|
app/code/community/FireGento/Pdf/Model/System/Config/Source/Payment.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
app/code/community/FireGento/Pdf/Model/System/Config/Source/Shipment/Engine.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
@@ -56,8 +56,8 @@ class FireGento_Pdf_Model_System_Config_Source_Shipment_Engine
|
|
56 |
$engineNodes = Mage::app()->getConfig()->getNode(self::XML_PATH_PDF_ENGINE);
|
57 |
if ($engineNodes && $engineNodes->hasChildren()) {
|
58 |
foreach ($engineNodes->children() as $engineName => $engineNode) {
|
59 |
-
$className = (string)$engineNode->class;
|
60 |
-
$engineLabel = Mage::helper('firegento_pdf')->__((string)$engineNode->label);
|
61 |
$engines[$className] = $engineLabel;
|
62 |
}
|
63 |
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
56 |
$engineNodes = Mage::app()->getConfig()->getNode(self::XML_PATH_PDF_ENGINE);
|
57 |
if ($engineNodes && $engineNodes->hasChildren()) {
|
58 |
foreach ($engineNodes->children() as $engineName => $engineNode) {
|
59 |
+
$className = (string) $engineNode->class;
|
60 |
+
$engineLabel = Mage::helper('firegento_pdf')->__((string) $engineNode->label);
|
61 |
$engines[$className] = $engineLabel;
|
62 |
}
|
63 |
}
|
app/code/community/FireGento/Pdf/Model/System/Config/Source/Shipping.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
@@ -26,7 +26,7 @@
|
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
app/code/community/FireGento/Pdf/Model/Tax/Sales/Pdf/Grandtotal.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,7 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
*/
|
21 |
/**
|
@@ -24,7 +24,7 @@
|
|
24 |
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
28 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
* @version $Id:$
|
30 |
* @since 0.1.0
|
@@ -32,7 +32,7 @@
|
|
32 |
class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_Pdf_Grandtotal
|
33 |
{
|
34 |
|
35 |
-
|
36 |
|
37 |
/**
|
38 |
* Check if tax amount should be included to grandtotals block
|
@@ -43,6 +43,7 @@ class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_
|
|
43 |
* 'font_size'=> $font_size
|
44 |
* )
|
45 |
* )
|
|
|
46 |
* @return array
|
47 |
*/
|
48 |
public function getTotalsForDisplay()
|
@@ -96,4 +97,4 @@ class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_
|
|
96 |
);
|
97 |
return $totals;
|
98 |
}
|
99 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
*/
|
21 |
/**
|
24 |
* @category FireGento
|
25 |
* @package FireGento_Pdf
|
26 |
* @author FireGento Team <team@firegento.com>
|
27 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
28 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
29 |
* @version $Id:$
|
30 |
* @since 0.1.0
|
32 |
class FireGento_Pdf_Model_Tax_Sales_Pdf_Grandtotal extends Mage_Tax_Model_Sales_Pdf_Grandtotal
|
33 |
{
|
34 |
|
35 |
+
const NO_SUM_ON_DETAILS = 'tax/sales_display/no_sum_on_details';
|
36 |
|
37 |
/**
|
38 |
* Check if tax amount should be included to grandtotals block
|
43 |
* 'font_size'=> $font_size
|
44 |
* )
|
45 |
* )
|
46 |
+
*
|
47 |
* @return array
|
48 |
*/
|
49 |
public function getTotalsForDisplay()
|
97 |
);
|
98 |
return $totals;
|
99 |
}
|
100 |
+
}
|
app/code/community/FireGento/Pdf/controllers/Sales/OrderController.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,25 +15,24 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
22 |
*/
|
|
|
|
|
23 |
/**
|
24 |
* Sales orders controller
|
25 |
*
|
26 |
* @category FireGento
|
27 |
* @package FireGento_Pdf
|
28 |
* @author FireGento Team <team@firegento.com>
|
29 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
30 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
31 |
* @version $Id:$
|
32 |
* @since 0.1.0
|
33 |
*/
|
34 |
-
|
35 |
-
require_once 'Mage/Sales/controllers/OrderController.php';
|
36 |
-
|
37 |
class FireGento_Pdf_Sales_OrderController extends Mage_Sales_OrderController
|
38 |
{
|
39 |
/**
|
@@ -43,12 +42,12 @@ class FireGento_Pdf_Sales_OrderController extends Mage_Sales_OrderController
|
|
43 |
*/
|
44 |
public function printInvoiceAction()
|
45 |
{
|
46 |
-
$invoiceId = (int)$this->getRequest()->getParam('invoice_id');
|
47 |
if ($invoiceId) {
|
48 |
$invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
|
49 |
$order = $invoice->getOrder();
|
50 |
} else {
|
51 |
-
$orderId = (int)$this->getRequest()->getParam('order_id');
|
52 |
$order = Mage::getModel('sales/order')->load($orderId);
|
53 |
}
|
54 |
|
@@ -83,4 +82,4 @@ class FireGento_Pdf_Sales_OrderController extends Mage_Sales_OrderController
|
|
83 |
}
|
84 |
}
|
85 |
}
|
86 |
-
}
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
22 |
*/
|
23 |
+
|
24 |
+
require_once 'Mage/Sales/controllers/OrderController.php';
|
25 |
/**
|
26 |
* Sales orders controller
|
27 |
*
|
28 |
* @category FireGento
|
29 |
* @package FireGento_Pdf
|
30 |
* @author FireGento Team <team@firegento.com>
|
31 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
32 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
33 |
* @version $Id:$
|
34 |
* @since 0.1.0
|
35 |
*/
|
|
|
|
|
|
|
36 |
class FireGento_Pdf_Sales_OrderController extends Mage_Sales_OrderController
|
37 |
{
|
38 |
/**
|
42 |
*/
|
43 |
public function printInvoiceAction()
|
44 |
{
|
45 |
+
$invoiceId = (int) $this->getRequest()->getParam('invoice_id');
|
46 |
if ($invoiceId) {
|
47 |
$invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
|
48 |
$order = $invoice->getOrder();
|
49 |
} else {
|
50 |
+
$orderId = (int) $this->getRequest()->getParam('order_id');
|
51 |
$order = Mage::getModel('sales/order')->load($orderId);
|
52 |
}
|
53 |
|
82 |
}
|
83 |
}
|
84 |
}
|
85 |
+
}
|
app/code/community/FireGento/Pdf/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<FireGento_Pdf>
|
5 |
-
<version>1.
|
6 |
</FireGento_Pdf>
|
7 |
</modules>
|
8 |
<global>
|
@@ -49,6 +49,22 @@
|
|
49 |
</firegento_pdf>
|
50 |
</observers>
|
51 |
</firegento_pdf_invoice_insert_note>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</events>
|
53 |
<pdf>
|
54 |
<!-- fix totals order -->
|
@@ -93,14 +109,28 @@
|
|
93 |
<default>
|
94 |
<sales_pdf>
|
95 |
<invoice>
|
96 |
-
<engine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
<item_price_column_order>price_incl_tax,qty,tax,subtotal_incl_tax</item_price_column_order>
|
|
|
98 |
</invoice>
|
99 |
<shipment>
|
100 |
-
<engine
|
|
|
|
|
|
|
|
|
101 |
</shipment>
|
102 |
<creditmemo>
|
103 |
-
<engine
|
|
|
|
|
104 |
</creditmemo>
|
105 |
</sales_pdf>
|
106 |
<tax>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<FireGento_Pdf>
|
5 |
+
<version>1.2.0</version>
|
6 |
</FireGento_Pdf>
|
7 |
</modules>
|
8 |
<global>
|
49 |
</firegento_pdf>
|
50 |
</observers>
|
51 |
</firegento_pdf_invoice_insert_note>
|
52 |
+
<firegento_pdf_shipment_insert_note>
|
53 |
+
<observers>
|
54 |
+
<firegento_pdf>
|
55 |
+
<class>firegento_pdf/observer</class>
|
56 |
+
<method>addShippingMethod</method>
|
57 |
+
</firegento_pdf>
|
58 |
+
</observers>
|
59 |
+
</firegento_pdf_shipment_insert_note>
|
60 |
+
<firegento_pdf_shipment_edit_page>
|
61 |
+
<observers>
|
62 |
+
<firegento_pdf>
|
63 |
+
<class>firegento_pdf/observer</class>
|
64 |
+
<method>addBarcode</method>
|
65 |
+
</firegento_pdf>
|
66 |
+
</observers>
|
67 |
+
</firegento_pdf_shipment_edit_page>
|
68 |
</events>
|
69 |
<pdf>
|
70 |
<!-- fix totals order -->
|
109 |
<default>
|
110 |
<sales_pdf>
|
111 |
<invoice>
|
112 |
+
<engine />
|
113 |
+
<show_customer_number>1</show_customer_number>
|
114 |
+
<show_date_notice>0</show_date_notice>
|
115 |
+
<maturity/>
|
116 |
+
<payment_method_position/>
|
117 |
+
<shipping_method_position/>
|
118 |
+
<show_comments>0</show_comments>
|
119 |
+
<note/>
|
120 |
<item_price_column_order>price_incl_tax,qty,tax,subtotal_incl_tax</item_price_column_order>
|
121 |
+
<show_item_discount>0</show_item_discount>
|
122 |
</invoice>
|
123 |
<shipment>
|
124 |
+
<engine />
|
125 |
+
<show_customer_number>1</show_customer_number>
|
126 |
+
<shipping_method_position/>
|
127 |
+
<note/>
|
128 |
+
<order_id_as_barcode>0</order_id_as_barcode>
|
129 |
</shipment>
|
130 |
<creditmemo>
|
131 |
+
<engine />
|
132 |
+
<show_customer_number>1</show_customer_number>
|
133 |
+
<note/>
|
134 |
</creditmemo>
|
135 |
</sales_pdf>
|
136 |
<tax>
|
app/code/community/FireGento/Pdf/etc/system.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
/**
|
4 |
* This file is part of the FIREGENTO project.
|
5 |
*
|
6 |
-
*
|
7 |
* modify it under the terms of the GNU General Public License version 3 as
|
8 |
* published by the Free Software Foundation.
|
9 |
*
|
@@ -16,7 +16,7 @@
|
|
16 |
* @category FireGento
|
17 |
* @package FireGento_Pdf
|
18 |
* @author FireGento Team <team@firegento.com>
|
19 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
20 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
21 |
* @version $Id:$
|
22 |
* @since 0.1.0
|
@@ -32,7 +32,7 @@
|
|
32 |
<label>Don't display Tax Total if display Summary is on</label>
|
33 |
<frontend_type>select</frontend_type>
|
34 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
35 |
-
<sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>1</show_in_website>
|
38 |
<show_in_store>1</show_in_store>
|
@@ -54,10 +54,29 @@
|
|
54 |
<show_in_website>1</show_in_website>
|
55 |
<show_in_store>1</show_in_store>
|
56 |
</engine>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
<maturity translate="label comment">
|
58 |
<label>Invoice Maturity</label>
|
59 |
<frontend_type>text</frontend_type>
|
60 |
-
<sort_order>
|
61 |
<show_in_default>1</show_in_default>
|
62 |
<show_in_website>1</show_in_website>
|
63 |
<show_in_store>1</show_in_store>
|
@@ -67,7 +86,7 @@
|
|
67 |
<label>Show Payment Method</label>
|
68 |
<frontend_type>select</frontend_type>
|
69 |
<source_model>firegento_pdf/system_config_source_payment</source_model>
|
70 |
-
<sort_order>
|
71 |
<show_in_default>1</show_in_default>
|
72 |
<show_in_website>1</show_in_website>
|
73 |
<show_in_store>1</show_in_store>
|
@@ -77,16 +96,25 @@
|
|
77 |
<label>Show Shipping Method</label>
|
78 |
<frontend_type>select</frontend_type>
|
79 |
<source_model>firegento_pdf/system_config_source_shipping</source_model>
|
80 |
-
<sort_order>
|
81 |
<show_in_default>1</show_in_default>
|
82 |
<show_in_website>1</show_in_website>
|
83 |
<show_in_store>1</show_in_store>
|
84 |
<comment>Position of shipping method on invoice.</comment>
|
85 |
</shipping_method_position>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
<note translate="label comment">
|
87 |
<label>Note</label>
|
88 |
<frontend_type>textarea</frontend_type>
|
89 |
-
<sort_order>
|
90 |
<show_in_default>1</show_in_default>
|
91 |
<show_in_website>1</show_in_website>
|
92 |
<show_in_store>1</show_in_store>
|
@@ -95,7 +123,7 @@
|
|
95 |
<item_price_column_order translate="label comment">
|
96 |
<label>Order of price columns of items</label>
|
97 |
<frontend_model>firegento_pdf/adminhtml_columnOrder</frontend_model>
|
98 |
-
<sort_order>
|
99 |
<show_in_default>1</show_in_default>
|
100 |
<show_in_website>1</show_in_website>
|
101 |
<show_in_store>1</show_in_store>
|
@@ -104,7 +132,7 @@
|
|
104 |
<label>Show Item Discount</label>
|
105 |
<frontend_type>select</frontend_type>
|
106 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
107 |
-
<sort_order>
|
108 |
<show_in_default>1</show_in_default>
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>1</show_in_store>
|
@@ -122,15 +150,44 @@
|
|
122 |
<show_in_website>1</show_in_website>
|
123 |
<show_in_store>1</show_in_store>
|
124 |
</engine>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
<note translate="label comment">
|
126 |
<label>Note</label>
|
127 |
<frontend_type>textarea</frontend_type>
|
128 |
-
<sort_order>
|
129 |
<show_in_default>1</show_in_default>
|
130 |
<show_in_website>1</show_in_website>
|
131 |
<show_in_store>1</show_in_store>
|
132 |
<comment>Printed on every shipment.</comment>
|
133 |
</note>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
</fields>
|
135 |
</shipment>
|
136 |
<creditmemo>
|
@@ -144,10 +201,19 @@
|
|
144 |
<show_in_website>1</show_in_website>
|
145 |
<show_in_store>1</show_in_store>
|
146 |
</engine>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
<note translate="label comment">
|
148 |
<label>Note</label>
|
149 |
<frontend_type>textarea</frontend_type>
|
150 |
-
<sort_order>
|
151 |
<show_in_default>1</show_in_default>
|
152 |
<show_in_website>1</show_in_website>
|
153 |
<show_in_store>1</show_in_store>
|
@@ -166,7 +232,7 @@
|
|
166 |
<sender_address_bar translate="label">
|
167 |
<label>Sender Address Bar</label>
|
168 |
<frontend_type>text</frontend_type>
|
169 |
-
<sort_order>
|
170 |
<show_in_default>1</show_in_default>
|
171 |
<show_in_website>1</show_in_website>
|
172 |
<show_in_store>1</show_in_store>
|
@@ -175,7 +241,7 @@
|
|
175 |
<label>Show Footer</label>
|
176 |
<frontend_type>select</frontend_type>
|
177 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
178 |
-
<sort_order>
|
179 |
<show_in_default>1</show_in_default>
|
180 |
<show_in_website>1</show_in_website>
|
181 |
<show_in_store>1</show_in_store>
|
@@ -184,10 +250,11 @@
|
|
184 |
<label>Logo Position</label>
|
185 |
<frontend_type>select</frontend_type>
|
186 |
<source_model>firegento_pdf/system_config_source_logo</source_model>
|
187 |
-
<sort_order>
|
188 |
<show_in_default>1</show_in_default>
|
189 |
<show_in_website>1</show_in_website>
|
190 |
<show_in_store>1</show_in_store>
|
|
|
191 |
</logo_position>
|
192 |
</fields>
|
193 |
</firegento_pdf>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
/**
|
4 |
* This file is part of the FIREGENTO project.
|
5 |
*
|
6 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License version 3 as
|
8 |
* published by the Free Software Foundation.
|
9 |
*
|
16 |
* @category FireGento
|
17 |
* @package FireGento_Pdf
|
18 |
* @author FireGento Team <team@firegento.com>
|
19 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
20 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
21 |
* @version $Id:$
|
22 |
* @since 0.1.0
|
32 |
<label>Don't display Tax Total if display Summary is on</label>
|
33 |
<frontend_type>select</frontend_type>
|
34 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
35 |
+
<sort_order>700</sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>1</show_in_website>
|
38 |
<show_in_store>1</show_in_store>
|
54 |
<show_in_website>1</show_in_website>
|
55 |
<show_in_store>1</show_in_store>
|
56 |
</engine>
|
57 |
+
<show_customer_number translate="label">
|
58 |
+
<label>Show Customer Number</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
61 |
+
<sort_order>35</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
</show_customer_number>
|
66 |
+
<show_date_notice translate="label">
|
67 |
+
<label>Show Date Notice</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
+
<sort_order>10</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<comment>Show Notice: Invoice date is equal to delivery date.</comment>
|
75 |
+
</show_date_notice>
|
76 |
<maturity translate="label comment">
|
77 |
<label>Invoice Maturity</label>
|
78 |
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>30</sort_order>
|
80 |
<show_in_default>1</show_in_default>
|
81 |
<show_in_website>1</show_in_website>
|
82 |
<show_in_store>1</show_in_store>
|
86 |
<label>Show Payment Method</label>
|
87 |
<frontend_type>select</frontend_type>
|
88 |
<source_model>firegento_pdf/system_config_source_payment</source_model>
|
89 |
+
<sort_order>40</sort_order>
|
90 |
<show_in_default>1</show_in_default>
|
91 |
<show_in_website>1</show_in_website>
|
92 |
<show_in_store>1</show_in_store>
|
96 |
<label>Show Shipping Method</label>
|
97 |
<frontend_type>select</frontend_type>
|
98 |
<source_model>firegento_pdf/system_config_source_shipping</source_model>
|
99 |
+
<sort_order>50</sort_order>
|
100 |
<show_in_default>1</show_in_default>
|
101 |
<show_in_website>1</show_in_website>
|
102 |
<show_in_store>1</show_in_store>
|
103 |
<comment>Position of shipping method on invoice.</comment>
|
104 |
</shipping_method_position>
|
105 |
+
<show_comments>
|
106 |
+
<label>Show Invoice Comments</label>
|
107 |
+
<frontend_type>select</frontend_type>
|
108 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
109 |
+
<sort_order>60</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_website>1</show_in_website>
|
112 |
+
<show_in_store>1</show_in_store>
|
113 |
+
</show_comments>
|
114 |
<note translate="label comment">
|
115 |
<label>Note</label>
|
116 |
<frontend_type>textarea</frontend_type>
|
117 |
+
<sort_order>70</sort_order>
|
118 |
<show_in_default>1</show_in_default>
|
119 |
<show_in_website>1</show_in_website>
|
120 |
<show_in_store>1</show_in_store>
|
123 |
<item_price_column_order translate="label comment">
|
124 |
<label>Order of price columns of items</label>
|
125 |
<frontend_model>firegento_pdf/adminhtml_columnOrder</frontend_model>
|
126 |
+
<sort_order>80</sort_order>
|
127 |
<show_in_default>1</show_in_default>
|
128 |
<show_in_website>1</show_in_website>
|
129 |
<show_in_store>1</show_in_store>
|
132 |
<label>Show Item Discount</label>
|
133 |
<frontend_type>select</frontend_type>
|
134 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
135 |
+
<sort_order>90</sort_order>
|
136 |
<show_in_default>1</show_in_default>
|
137 |
<show_in_website>1</show_in_website>
|
138 |
<show_in_store>1</show_in_store>
|
150 |
<show_in_website>1</show_in_website>
|
151 |
<show_in_store>1</show_in_store>
|
152 |
</engine>
|
153 |
+
<show_customer_number translate="label">
|
154 |
+
<label>Show Customer Number</label>
|
155 |
+
<frontend_type>select</frontend_type>
|
156 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
157 |
+
<sort_order>35</sort_order>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>1</show_in_website>
|
160 |
+
<show_in_store>1</show_in_store>
|
161 |
+
</show_customer_number>
|
162 |
+
<shipping_method_position translate="label comment">
|
163 |
+
<label>Show Shipping Method</label>
|
164 |
+
<frontend_type>select</frontend_type>
|
165 |
+
<source_model>firegento_pdf/system_config_source_shipping</source_model>
|
166 |
+
<sort_order>50</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>1</show_in_website>
|
169 |
+
<show_in_store>1</show_in_store>
|
170 |
+
<comment>Position of shipping method on shipment.</comment>
|
171 |
+
</shipping_method_position>
|
172 |
<note translate="label comment">
|
173 |
<label>Note</label>
|
174 |
<frontend_type>textarea</frontend_type>
|
175 |
+
<sort_order>70</sort_order>
|
176 |
<show_in_default>1</show_in_default>
|
177 |
<show_in_website>1</show_in_website>
|
178 |
<show_in_store>1</show_in_store>
|
179 |
<comment>Printed on every shipment.</comment>
|
180 |
</note>
|
181 |
+
<order_id_as_barcode translate="label comment">
|
182 |
+
<label>Show Order ID as Barcode</label>
|
183 |
+
<frontend_type>select</frontend_type>
|
184 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
185 |
+
<sort_order>100</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>1</show_in_website>
|
188 |
+
<show_in_store>1</show_in_store>
|
189 |
+
<comment>Prints the order ID as a barcode on the right hand side.</comment>
|
190 |
+
</order_id_as_barcode>
|
191 |
</fields>
|
192 |
</shipment>
|
193 |
<creditmemo>
|
201 |
<show_in_website>1</show_in_website>
|
202 |
<show_in_store>1</show_in_store>
|
203 |
</engine>
|
204 |
+
<show_customer_number translate="label">
|
205 |
+
<label>Show Customer Number</label>
|
206 |
+
<frontend_type>select</frontend_type>
|
207 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
208 |
+
<sort_order>35</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>1</show_in_store>
|
212 |
+
</show_customer_number>
|
213 |
<note translate="label comment">
|
214 |
<label>Note</label>
|
215 |
<frontend_type>textarea</frontend_type>
|
216 |
+
<sort_order>50</sort_order>
|
217 |
<show_in_default>1</show_in_default>
|
218 |
<show_in_website>1</show_in_website>
|
219 |
<show_in_store>1</show_in_store>
|
232 |
<sender_address_bar translate="label">
|
233 |
<label>Sender Address Bar</label>
|
234 |
<frontend_type>text</frontend_type>
|
235 |
+
<sort_order>100</sort_order>
|
236 |
<show_in_default>1</show_in_default>
|
237 |
<show_in_website>1</show_in_website>
|
238 |
<show_in_store>1</show_in_store>
|
241 |
<label>Show Footer</label>
|
242 |
<frontend_type>select</frontend_type>
|
243 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
244 |
+
<sort_order>200</sort_order>
|
245 |
<show_in_default>1</show_in_default>
|
246 |
<show_in_website>1</show_in_website>
|
247 |
<show_in_store>1</show_in_store>
|
250 |
<label>Logo Position</label>
|
251 |
<frontend_type>select</frontend_type>
|
252 |
<source_model>firegento_pdf/system_config_source_logo</source_model>
|
253 |
+
<sort_order>300</sort_order>
|
254 |
<show_in_default>1</show_in_default>
|
255 |
<show_in_website>1</show_in_website>
|
256 |
<show_in_store>1</show_in_store>
|
257 |
+
<comment><![CDATA[Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.]]></comment>
|
258 |
</logo_position>
|
259 |
</fields>
|
260 |
</firegento_pdf>
|
app/code/community/FireGento/Pdf/sql/firegento_pdf_setup/upgrade-1.0.0-1.1.0.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
-
*
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
@@ -15,21 +15,7 @@
|
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
-
* @copyright 2013 FireGento Team (http://www.firegento.
|
19 |
-
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
-
* @version $Id:$
|
21 |
-
* @since 0.1.0
|
22 |
-
*/
|
23 |
-
/**
|
24 |
-
* Invoice model rewrite.
|
25 |
-
*
|
26 |
-
* The invoice model serves as a proxy to the actual PDF engine as set via
|
27 |
-
* backend configuration.
|
28 |
-
*
|
29 |
-
* @category FireGento
|
30 |
-
* @package FireGento_Pdf
|
31 |
-
* @author FireGento Team <team@firegento.com>
|
32 |
-
* @copyright 2013 FireGento Team (http://www.firegento.de). All rights served.
|
33 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
34 |
* @version $Id:$
|
35 |
* @since 0.1.0
|
2 |
/**
|
3 |
* This file is part of the FIREGENTO project.
|
4 |
*
|
5 |
+
* FireGento_Pdf is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License version 3 as
|
7 |
* published by the Free Software Foundation.
|
8 |
*
|
15 |
* @category FireGento
|
16 |
* @package FireGento_Pdf
|
17 |
* @author FireGento Team <team@firegento.com>
|
18 |
+
* @copyright 2013 FireGento Team (http://www.firegento.com)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
|
20 |
* @version $Id:$
|
21 |
* @since 0.1.0
|
app/locale/de_AT/FireGento_Pdf.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
"VAT-ID","UID"
|
2 |
+
"Standard Germany","Standard Deutsch"
|
app/locale/de_DE/FireGento_Pdf.csv
CHANGED
@@ -67,7 +67,9 @@
|
|
67 |
"Show Shipping Method","Versandart andrucken"
|
68 |
"Hide shipping method","Nicht andrucken"
|
69 |
"Position of shipping method on invoice.","Position der Versandart auf der Rechnung."
|
|
|
70 |
"not to be listed","nicht aufzulisten"
|
|
|
71 |
"Show Item Discount","Rabatt auf Artikelebene anzeigen"
|
72 |
"You get a discount of %s.","Sie erhalten einen Rabatt von %s."
|
73 |
"Tax amount","Steuerbetrag"
|
@@ -76,4 +78,11 @@
|
|
76 |
"Order of price columns of items","Reihenfolge der Spalten in der Artikelliste"
|
77 |
"Define the order by moving the following items using your mouse:","Legen Sie die Reihenfolge durch Verschieben der Einträge mit der Maus fest:"
|
78 |
"Tax rate","Steuersatz"
|
79 |
-
"Total (incl. tax)","Gesamt (brutto)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
"Show Shipping Method","Versandart andrucken"
|
68 |
"Hide shipping method","Nicht andrucken"
|
69 |
"Position of shipping method on invoice.","Position der Versandart auf der Rechnung."
|
70 |
+
"Position of shipping method on shipment.","Position der Versandart auf dem Lieferschein."
|
71 |
"not to be listed","nicht aufzulisten"
|
72 |
+
"Show Invoice Comments","Rechnungskommentare andrucken"
|
73 |
"Show Item Discount","Rabatt auf Artikelebene anzeigen"
|
74 |
"You get a discount of %s.","Sie erhalten einen Rabatt von %s."
|
75 |
"Tax amount","Steuerbetrag"
|
78 |
"Order of price columns of items","Reihenfolge der Spalten in der Artikelliste"
|
79 |
"Define the order by moving the following items using your mouse:","Legen Sie die Reihenfolge durch Verschieben der Einträge mit der Maus fest:"
|
80 |
"Tax rate","Steuersatz"
|
81 |
+
"Total (incl. tax)","Gesamt (brutto)"
|
82 |
+
"Show Date Notice","Anzeige des Datum im Notizbereich"
|
83 |
+
"Show Notice: Invoice date is equal to delivery date.","Zeige im Notizbereich: Rechnungsdatum ist gleich dem Lieferdatum."
|
84 |
+
"Show Customer Number","Kundennummer andrucken"
|
85 |
+
"Full width","volle Breite"
|
86 |
+
"Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.","""volle Breite"" bedeutet, dass das Logo über die komplette Seite von oben links bis zum rechten Rand gezogen wird. Es verbleibt kein Druckrand."
|
87 |
+
"Show Order ID as Barcode","Bestellnummer als Barcode anzeigen"
|
88 |
+
"Prints the order ID as a barcode on the right hand side.","Zeigt die Bestellnummer als Barcode auf der rechten Seite an."
|
app/locale/nl_NL/FireGento_Pdf.csv
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Invoice maturity: %s days","Vervaldatum van de factuur: %s Tage"
|
2 |
+
"Invoice Maturity","Vervaldatum van de factuur"
|
3 |
+
"Days after the invoice is due. Leave this field blank to hide the message on the invoice.","Aantal dagen waarna de factuur is verlopen. Laat dit veld leeg om de melding te verbergen op de factuur."
|
4 |
+
"Invoice is payable immediately","De factuur is betaalbaar direct"
|
5 |
+
"Invoice date is equal to delivery date.","Factuurdatum is gelijk aan de verzending."
|
6 |
+
"Payment method:","Betaalmethode:"
|
7 |
+
"Shipping method:","Verzendmethode:"
|
8 |
+
"Payment method: %s","Betaalmethode: %s"
|
9 |
+
"Shipping method: %s","Verzendmethode: %s"
|
10 |
+
"Page","Pagina"
|
11 |
+
"Telephone:","Telefoon:"
|
12 |
+
"Fax:","Fax:"
|
13 |
+
"E-Mail:","E-mail:"
|
14 |
+
"Web:","Website:"
|
15 |
+
"Bank name:","Banknaam:"
|
16 |
+
"Account:","Rekening nr.:"
|
17 |
+
"Bank number:","Bank nummer:"
|
18 |
+
"Account owner:","Ten name van:"
|
19 |
+
"SWIFT:","SWIFT:"
|
20 |
+
"IBAN:","IBAN:"
|
21 |
+
"Tax number:","BTW-Nummer:"
|
22 |
+
"VAT-ID:","BTW-nr.:"
|
23 |
+
"Register number:","HRB Nummer:"
|
24 |
+
"CEO:","Directeur:"
|
25 |
+
"Pos","Pos."
|
26 |
+
"No.","Artikelnummer"
|
27 |
+
"Description","Omschrijving"
|
28 |
+
"Price (excl. tax)","Prijs (Incl. BTW)"
|
29 |
+
"Amount","Bedrag"
|
30 |
+
"Tax","BTW"
|
31 |
+
"Total","Totaal"
|
32 |
+
"Invoice","Factuur"
|
33 |
+
"Creditmemo","Creditfactuur"
|
34 |
+
"Order number:","Bestelnr.:"
|
35 |
+
"Invoice number:","Factuurnr.:"
|
36 |
+
"Shipment number:","Verzendnr.:"
|
37 |
+
"Creditmemo number:","Creditfactuurnr.:"
|
38 |
+
"Customer number:","Klantnr.:"
|
39 |
+
"Customer IP:","Klant IP:"
|
40 |
+
"Invoice date:","Factuurdatum:"
|
41 |
+
"Shipping date:","Verzenddatum:"
|
42 |
+
"Date:","Datum:"
|
43 |
+
"Additional tax %s","Extra BTW %s"
|
44 |
+
"Subtotal:","Subtotaal:"
|
45 |
+
"Shipping:","Verzending:"
|
46 |
+
"Grand Total:","Eindtotaal:"
|
47 |
+
"Guestorder","Gastbestelling"
|
48 |
+
"PDF Engine","PDF Engine"
|
49 |
+
"Note","Notitie"
|
50 |
+
"Printed on every invoice.","Wordt op elke factuur afgedrukt."
|
51 |
+
"Printed on every shipment.","Wordt op elke verzending afgedrukt."
|
52 |
+
"Printed on every credit memo.","Wordt op elke creditfactuur afgedrukt."
|
53 |
+
"PDF Creation","PDF's Aanmaken"
|
54 |
+
"Sender Address Bar","Afzenderadres"
|
55 |
+
"Show Footer","Toon Footer"
|
56 |
+
"Logo Position","Logo Positie"
|
57 |
+
"Left","Links"
|
58 |
+
"Center","Midden"
|
59 |
+
"Right","Reechts"
|
60 |
+
"Standard Magento","Standaard Magento"
|
61 |
+
"Standard Germany","Standaard Duitsland"
|
62 |
+
"Show Payment Method","Toon betaalmethode"
|
63 |
+
"Hide payment method","Verberg betaalmethode"
|
64 |
+
"Header","Document-header"
|
65 |
+
"Notes area","Notitie-ruimte"
|
66 |
+
"Position of payment method on invoice.","Positie van de betaalmethode op de factuur"
|
67 |
+
"Show Shipping Method","Toon verzendmethode"
|
68 |
+
"Hide shipping method","Verberg verzendmethode"
|
69 |
+
"Position of shipping method on invoice.","Positie van de verzendmethode op de factuur"
|
70 |
+
"Position of shipping method on shipment.","Position of shipping method on shipment."
|
71 |
+
"not to be listed","niet getoond"
|
72 |
+
"Show Invoice Comments","Toon factuurnotities"
|
73 |
+
"Show Item Discount","Toon korting van item"
|
74 |
+
"You get a discount of %s.","U krijg een korting van %s."
|
75 |
+
"Tax amount",BTW-bedrag
|
76 |
+
"Price (incl. tax)","Prijs (Excl. BTW)"
|
77 |
+
"Subtotal (incl. tax)","Subtotaal (Excl. BTW)"
|
78 |
+
"Order of price columns of items","Volgorde van de prijs-kolommen van items"
|
79 |
+
"Define the order by moving the following items using your mouse:","Stel de volgorde in door deze met uw muis te verslepen"
|
80 |
+
"Tax rate",BTW-bedrag
|
81 |
+
"Total (incl. tax)","Totaal (Excl. BTW)"
|
82 |
+
"Show Date Notice","Toon datumopmerking"
|
83 |
+
"Show Notice: Invoice date is equal to delivery date.","Toon opmerking: Factuurdatum is gelijk aan de verzending."
|
84 |
+
"Show Customer Number","Toon klantnummer"
|
85 |
+
"Full width","Volledige breedte"
|
86 |
+
"Full width means that the logo starts at the upper left corner and is drawn to the right edge. There is no left or right margin for printing.","Volledige breedte betekent dat het logo in de linker bovenhoek begint t/m de rechter bovenhoek. Er is geen linker of rechter marge bij het printen."
|
87 |
+
"Show Order ID as Barcode","Toon Bestelling nr. als Barcode"
|
88 |
+
"Prints the order ID as a barcode on the right hand side.","Print het bestel nr. als een barcode aan de rechterkant."
|
package.xml
CHANGED
@@ -1,18 +1,28 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>FireGento_Pdf</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos.</summary>
|
10 |
<description>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos. Anyway, you can still use the standard Magento layout, because the extension is highly configurable.</description>
|
11 |
-
<notes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<authors><author><name>FireGento Team</name><user>firegento</user><email>team@firegento.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="FireGento"><dir name="Pdf"><dir name="Block"><dir name="Adminhtml"><file name="ColumnOrder.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>FireGento_Pdf</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos.</summary>
|
10 |
<description>FireGento PDF overwrites standard PDF layouts for invoices, shipments and creditmemos. Anyway, you can still use the standard Magento layout, because the extension is highly configurable.</description>
|
11 |
+
<notes>- [FEATURE] 1.8 compatibility
|
12 |
+
- [FEATURE] added possibility to print order ID barcodes on shipment PDFs
|
13 |
+
- [FEATURE] added possibility to print shipment type on shipment PDFs
|
14 |
+
- [FEATURE] added universal event, so that developers can add custom stuff anywhere they want via observers
|
15 |
+
- [FEATURE] added possibility to use a full-width logo
|
16 |
+
- [FEATURE] configuration option whether to print the customer number
|
17 |
+
- [FEATURE] possibility to add invoice comments on invoice PDF
|
18 |
+
- [FEATURE] dutch translation
|
19 |
+
- [BUGFIX] fixed error when there is no country in the imprint
|
20 |
+
- [BUGFIX] print shipping address instead of invoice address on shipment PDF
|
21 |
+
- [MISC] respect FireGento coding guidelines</notes>
|
22 |
<authors><author><name>FireGento Team</name><user>firegento</user><email>team@firegento.com</email></author></authors>
|
23 |
+
<date>2014-01-27</date>
|
24 |
+
<time>14:57:29</time>
|
25 |
+
<contents><target name="magecommunity"><dir name="FireGento"><dir name="Pdf"><dir name="Block"><dir name="Adminhtml"><file name="ColumnOrder.php" hash="3799cb56858b9881d148a339ea49f8ca"/></dir></dir><dir name="Helper"><file name="Data.php" hash="dd642120d9bbabcffa22ba501a90683f"/></dir><dir name="Model"><file name="Creditmemo.php" hash="d63eabb984696be7cc619a945485dfc9"/><dir name="Engine"><file name="Abstract.php" hash="6768e733d5e76487301058f4e908aac5"/><dir name="Creditmemo"><file name="Default.php" hash="93676d7f82a7e1b19741dced06c26b99"/></dir><dir name="Invoice"><file name="Default.php" hash="67dea1237c31cb8562c863239d5aa998"/></dir><dir name="Shipment"><file name="Default.php" hash="a968f40a8be37f77bfe7162863561272"/></dir></dir><file name="Invoice.php" hash="28f21f48a6e00e124b185a8162e3869d"/><dir name="Items"><file name="Bundle.php" hash="9a363c8cdf303c451000e5cd2cf6b9f6"/><file name="Default.php" hash="d2c436f53efd3ada79e5640934503589"/><file name="Grouped.php" hash="5ae5053953c7dbdd65c6857c5e3ad2b6"/><dir name="Shipment"><file name="Bundle.php" hash="82db12612534c8169730cca30436d75b"/><file name="Default.php" hash="1a08b281fdabcfaa4ec1b7c7da62a7d8"/></dir></dir><file name="Observer.php" hash="b4dc50302e4c9d8e2bfc493e01b5ae91"/><file name="Shipment.php" hash="9887c67d5766db434b84aa86647c22b4"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Creditmemo"><file name="Engine.php" hash="e0bfb5661b6587163c36f83814f30fe4"/></dir><dir name="Invoice"><file name="Engine.php" hash="a75579d9a37243b4af6ee6c8c1738cca"/></dir><file name="Logo.php" hash="6a9684a27f972fb74799867518687821"/><file name="Payment.php" hash="2597e89d6bdc92f2074f64ed3c3f5f89"/><dir name="Shipment"><file name="Engine.php" hash="8c5b8eca2ac69b666b98999ccbb7df0a"/></dir><file name="Shipping.php" hash="70afa7e0021f152946f21c004fc1dbde"/></dir></dir></dir><dir name="Tax"><dir name="Sales"><dir name="Pdf"><file name="Grandtotal.php" hash="fe79c4aa5975058f5c2c8b29ecea127a"/></dir></dir></dir></dir><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="36f4fe4daa6094d1d1ff8584b4c5aa6d"/></dir></dir><dir name="etc"><file name="config.xml" hash="08df399f9a1c5e6f07d99791f48f656d"/><file name="system.xml" hash="70547aa0c755c599f8a5122078186f88"/></dir><dir name="sql"><dir name="firegento_pdf_setup"><file name="upgrade-1.0.0-1.1.0.php" hash="fedb1a65f1b6c0f9c319f98cc97c26d3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FireGento_Pdf.xml" hash="b50e6c2f168aff9a4fb983240f1d8941"/></dir></target><target name="magelocale"><dir><dir name="de_AT"><file name="FireGento_Pdf.csv" hash="53cdf83910c40cd3b4471d7d4c222211"/></dir><dir name="de_DE"><file name="FireGento_Pdf.csv" hash="5e589e0d40c9db5260f872590c6f107e"/></dir><dir name="nl_NL"><file name="FireGento_Pdf.csv" hash="7bf9bccd08a235991965297f5be94a86"/></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
</package>
|