diff --git a/admin-dev/themes/template/orders/_product_line.tpl b/admin-dev/themes/template/orders/_product_line.tpl index c4cc8332c..a2e57298e 100755 --- a/admin-dev/themes/template/orders/_product_line.tpl +++ b/admin-dev/themes/template/orders/_product_line.tpl @@ -95,7 +95,10 @@ 0/{$productQuantity} {/if} - € + +
{l s='Quantity:'}
0/{$productQuantity-$product['product_quantity_refunded']}
+
{l s='Amount:'}
+ {if ($can_edit && !$order->hasBeenDelivered())} {if sizeof($invoices_collection)} diff --git a/classes/order/OrderSlip.php b/classes/order/OrderSlip.php index 4f60fb007..32443ff41 100644 --- a/classes/order/OrderSlip.php +++ b/classes/order/OrderSlip.php @@ -206,8 +206,29 @@ class OrderSlipCore extends ObjectModel 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'); + foreach ($order_detail_list as $id_order_detail => $tab) + { + $tab['amount_tax_excl'] = $tab['amount_tax_incl'] = $tab['amount']; + $id_tax = (int)Db::getInstance()->getValue('SELECT `id_tax` FROM `'._DB_PREFIX_.'order_detail_tax` WHERE `id_order_detail` = '.(int)$id_order_detail); + if ($id_tax > 0) + { + $rate = (float)Db::getInstance()->getValue('SELECT `rate` FROM `'._DB_PREFIX_.'tax` WHERE `id_tax` = '.(int)$id_tax); + if ($rate > 0) + { + $rate = 1 + ($rate / 100); + $tab['amount_tax_excl'] = $tab['amount_tax_excl'] / $rate; + } + } + + $insertOrderSlip = array( + 'id_order_slip' => (int)($this->id), + 'id_order_detail' => (int)($id_order_detail), + 'product_quantity' => (int)($tab['quantity']), + 'amount_tax_excl' => (float)($tab['amount_tax_excl']), + 'amount_tax_incl' => (float)($tab['amount_tax_incl']), + ); + Db::getInstance()->autoExecute(_DB_PREFIX_.'order_slip_detail', $insertOrderSlip, 'INSERT'); + } } } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index eb6033dcb..b667bee8c 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -338,7 +338,8 @@ class AdminOrdersControllerCore extends AdminController if (isset($amount_detail) && !empty($amount_detail)) { $amount += $amount_detail; - $order_detail_list[$id_order_detail] = $amount_detail; + $order_detail_list[$id_order_detail]['quantity'] = (int)$_POST['partialRefundProductQuantity'][$id_order_detail]; + $order_detail_list[$id_order_detail]['amount'] = (float)$amount_detail; } $shipping_cost_amount = (float)(Tools::getValue('partialRefundShippingCost')); if ($shipping_cost_amount > 0) diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index 53c736b39..7c6cefc29 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -1234,7 +1234,8 @@ CREATE TABLE `PREFIX_order_slip_detail` ( `id_order_slip` int(10) unsigned NOT NULL, `id_order_detail` int(10) unsigned NOT NULL, `product_quantity` int(10) unsigned NOT NULL default '0', - `amount` DECIMAL(10,2) NOT NULL, + `amount_tax_excl` DECIMAL(10,2) default NULL, + `amount_tax_incl` DECIMAL(10,2) default NULL, PRIMARY KEY (`id_order_slip`,`id_order_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; diff --git a/install-dev/sql/upgrade/1.5.0.2.sql b/install-dev/sql/upgrade/1.5.0.2.sql index 801dcdedb..e108ccf54 100644 --- a/install-dev/sql/upgrade/1.5.0.2.sql +++ b/install-dev/sql/upgrade/1.5.0.2.sql @@ -410,4 +410,8 @@ SET `position` = ( FROM `PREFIX_tab` WHERE `id_parent` = 0 ) -WHERE `class_name` = 'AdminAccounting'; \ No newline at end of file +WHERE `class_name` = 'AdminAccounting'; + + +ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount` `amount_tax_excl` DECIMAL( 10, 2 ) default NULL; +ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount_tax_incl` DECIMAL(10,2) default NULL AFTER `amount_tax_excl`;