diff --git a/admin-dev/pdf.php b/admin-dev/pdf.php
index 8623c8493..47069a133 100644
--- a/admin-dev/pdf.php
+++ b/admin-dev/pdf.php
@@ -102,7 +102,7 @@ function generateOrderSlipPDF()
$order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
$tmp = NULL;
- generatePDF($order, PDF::TEMPLATE_ORDER_SLIP);
+ generatePDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP);
}
function generateDeliverySlipPDF()
diff --git a/admin-dev/themes/template/orders/_product_line.tpl b/admin-dev/themes/template/orders/_product_line.tpl
index e43c1bc13..200be6ef1 100755
--- a/admin-dev/themes/template/orders/_product_line.tpl
+++ b/admin-dev/themes/template/orders/_product_line.tpl
@@ -94,7 +94,7 @@
0/{$productQuantity}
{/if}
-
€ |
+ € |
{if $can_edit}
{if $order->hasBeenPaid()}
diff --git a/admin-dev/themes/template/orders/view.tpl b/admin-dev/themes/template/orders/view.tpl
index 6d2699af8..e52405f72 100755
--- a/admin-dev/themes/template/orders/view.tpl
+++ b/admin-dev/themes/template/orders/view.tpl
@@ -551,24 +551,29 @@
|
| {l s='Products'} |
{displayPrice price=$order->total_products_wt currency=$currency->id} |
+ |
total_discounts_tax_incl == 0}style="display: none;"{/if}>
| {l s='Discounts'} |
-{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id} |
+ |
total_wrapping_tax_incl == 0}style="display: none;"{/if}>
| {l s='Wrapping'} |
{displayPrice price=$order->total_wrapping_tax_incl currency=$currency->id} |
+ |
| {l s='Shipping'} |
{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id} |
+ € |
| {l s='Total'} |
{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}
|
+ |
diff --git a/classes/order/OrderSlip.php b/classes/order/OrderSlip.php
index 6ba62a6e9..8e1059454 100644
--- a/classes/order/OrderSlip.php
+++ b/classes/order/OrderSlip.php
@@ -39,9 +39,15 @@ class OrderSlipCore extends ObjectModel
/** @var float */
public $conversion_rate;
+ /** @var integer */
+ public $amount;
+
/** @var integer */
public $shipping_cost;
+ /** @var integer */
+ public $shipping_cost_amount;
+
/** @var string Object creation date */
public $date_add;
@@ -63,7 +69,9 @@ class OrderSlipCore extends ObjectModel
$fields['id_customer'] = (int)($this->id_customer);
$fields['id_order'] = (int)($this->id_order);
$fields['conversion_rate'] = (float)($this->conversion_rate);
+ $fields['amount'] = (int)($this->amount);
$fields['shipping_cost'] = (int)($this->shipping_cost);
+ $fields['shipping_cost_amount'] = (float)($this->shipping_cost_amount);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
return $fields;
@@ -177,5 +185,29 @@ class OrderSlipCore extends ObjectModel
$orderSlip->addSlipDetail($productList, $qtyList);
return true;
}
+
+ public static function createPartialOrderSlip($order, $amount, $shipping_cost_amount, $order_detail_list)
+ {
+ $currency = new Currency($order->id_currency);
+ $orderSlip = new OrderSlip();
+ $orderSlip->id_customer = (int)($order->id_customer);
+ $orderSlip->id_order = (int)($order->id);
+ $orderSlip->amount = (float)($amount);
+ $orderSlip->shipping_cost = false;
+ $orderSlip->shipping_cost_amount = (float)($shipping_cost_amount);
+ $orderSlip->conversion_rate = $currency->conversion_rate;
+ if (!$orderSlip->add())
+ return false;
+
+ $orderSlip->addPartialSlipDetail($order_detail_list);
+ return true;
+ }
+
+ public function addPartialSlipDetail($order_detail_list)
+ {
+ foreach ($order_detail_list as $id_order_detail => $amount)
+ Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_slip_detail', array('id_order_slip' => (int)($this->id), 'id_order_detail' => (int)($id_order_detail), 'product_quantity' => 0, 'amount' => (float)($amount)), 'INSERT');
+ }
+
}
diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php
index f3ed44fd5..b043e3586 100644
--- a/classes/pdf/HTMLTemplateOrderSlip.php
+++ b/classes/pdf/HTMLTemplateOrderSlip.php
@@ -82,7 +82,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
'tax_tab' => '',
));
- return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/invoice.tpl');
+ return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/order-slip.tpl');
}
/**
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index c34b078aa..ac12515f2 100755
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -333,6 +333,32 @@ class AdminOrdersControllerCore extends AdminController
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
+ /* Partial refund from order */
+ elseif (Tools::isSubmit('partialRefund') AND Validate::isLoadedObject($order = new Order((int)(Tools::getValue('id_order')))))
+ {
+ $amount = 0;
+ $order_detail_list = array();
+ foreach ($_POST['partialRefundProduct'] as $id_order_detail => $amount_detail)
+ if (isset($amount_detail) && !empty($amount_detail))
+ {
+ $amount += $amount_detail;
+ $order_detail_list[$id_order_detail] = $amount_detail;
+ }
+ $shipping_cost_amount = (float)(Tools::getValue('partialRefundShippingCost'));
+
+ if ($shipping_cost_amount > 0 OR $amount > 0)
+ {
+ if (!OrderSlip::createPartialOrderSlip($order, $amount, $shipping_cost_amount, $order_detail_list))
+ $this->_errors[] = Tools::displayError('Cannot generate partial credit slip');
+ }
+ else
+ $this->_errors[] = Tools::displayError('You have to write an amount if you want to do a partial credit slip');
+
+ // Redirect if no errors
+ if (!sizeof($this->_errors))
+ Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token);
+ }
+
/* Cancel product from order */
elseif (Tools::isSubmit('cancelProduct') AND Validate::isLoadedObject($order = new Order((int)(Tools::getValue('id_order')))))
{
diff --git a/themes/prestashop/pdf/order-slip.tpl b/themes/prestashop/pdf/order-slip.tpl
new file mode 100755
index 000000000..8f44c0067
--- /dev/null
+++ b/themes/prestashop/pdf/order-slip.tpl
@@ -0,0 +1,206 @@
+
+
+
+
+
+
+
+ |
+
+ {if !empty($delivery_address)}
+
+
+
+ {l s='Delivery Address' pdf='true'}
+ {$delivery_address}
+ |
+
+ {l s='Billing Address' pdf='true'}
+ {$invoice_address}
+ |
+
+
+ {else}
+
+
+
+ {l s='Billing & Delivery Address.' pdf='true'}
+ {$invoice_address}
+ |
+
+
+ |
+
+
+ {/if}
+ |
+
+
+
+
+
+
+
+
+
+
+
+ {l s='Order Number:' pdf='true'}
+ {'%06d'|sprintf:$order->id}
+
+ {l s='Order Date:' pdf='true'}
+ {$order->date_add|date_format:"%d-%m-%Y %H:%M"}
+
+ {l s='Payment Method:' pdf='true'}
+ {$order->payment}
+
+
+ |
+
+
+
+ | {l s='Product / Reference' pdf='true'} |
+
+ {if !$tax_excluded_display}
+ {l s='Unit Price' pdf='true'} {l s='(Tax Excl.)' pdf='true'} |
+ {/if}
+ {l s='Unit Price' pdf='true'} |
+ {l s='Discount' pdf='true'} |
+ {l s='Qty' pdf='true'} |
+ {l s='Total' pdf='true'} |
+
+ {foreach $order_details as $order_detail}
+ {cycle values='#FFF,#DDD' assign=bgcolor}
+
+ | {$order_detail.product_name} |
+
+ {if !$tax_excluded_display}
+
+ {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
+ |
+ {/if}
+
+ {if $tax_excluded_display}
+ {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
+ {else}
+ {displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_incl}
+ {/if}
+ |
+
+ {if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
+ -{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
+ {else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
+ -{$order_detail.reduction_percent}%
+ {else}
+ --
+ {/if}
+ |
+ {$order_detail.product_quantity} |
+
+ {if $tax_excluded_display}
+ {displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_excl}
+ {else}
+ {displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_incl}
+ {/if}
+ |
+
+ {foreach $order_detail.customizedDatas as $customization}
+
+
+ {foreach $customization.datas as $customization_types}
+
+ {foreach $customization_types as $customization_infos name=custo_foreach}
+ {$customization_infos.name}: {$customization_infos.value}
+ {if !$smarty.foreach.custo_foreach.last}
+ {else}
+
+ {/if}
+ {/foreach}
+
+ {/foreach}
+ |
+ |
+ ({$customization.quantity}) |
+ |
+
+ {/foreach}
+ {/foreach}
+
+
+
+ {if (($order->total_paid_tax_incl - $order->total_paid_tax_excl) > 0)}
+
+ | {l s='Product Total (Tax Excl.)' pdf='true'} |
+ {displayPrice currency=$order->id_currency price=$order->total_products} |
+
+
+
+ | {l s='Product Total (Tax Incl.)' pdf='true'} |
+ {displayPrice currency=$order->id_currency price=$order->total_products_wt} |
+
+ {else}
+
+ | {l s='Product Total' pdf='true'} |
+ {displayPrice currency=$order->id_currency price=$order->total_products} |
+
+ {/if}
+
+ {if $order->total_discounts_tax_incl > 0}
+
+ | {l s='Total Vouchers' pdf='true'} |
+ -{displayPrice currency=$order->id_currency price=$order->total_discounts_tax_incl} |
+
+ {/if}
+
+ {if $order->total_wrapping_tax_incl > 0}
+
+ | {l s='Wrapping Cost' pdf='true'} |
+
+ {if $tax_excluded_display}
+ {displayPrice currency=$order->id_currency price=$order->total_wrapping_tax_excl}
+ {else}
+ {displayPrice currency=$order->id_currency price=$order->total_wrapping_tax_incl}
+ {/if}
+ |
+
+ {/if}
+
+ {if $order->total_shipping_tax_incl > 0}
+
+ | {l s='Shipping Cost' pdf='true'} |
+
+ {if $tax_excluded_display}
+ {displayPrice currency=$order->id_currency price=$order->total_shipping_tax_excl}
+ {else}
+ {displayPrice currency=$order->id_currency price=$order->total_shipping_tax_incl}
+ {/if}
+ |
+
+ {/if}
+
+ {if ($order->total_paid_tax_incl - $order->total_paid_tax_excl) > 0}
+
+ | {l s='Total Tax' pdf='true'} |
+ {displayPrice currency=$order->id_currency price=($order->total_paid_tax_incl - $order->total_paid_tax_excl)} |
+
+ {/if}
+
+
+ | {l s='Total' pdf='true'} |
+ {displayPrice currency=$order->id_currency price=$order->total_paid_tax_incl} |
+
+
+
+ |
+
+
+
+
+
+
+{$tax_tab}
+
+
+