Skip to content

Commit

Permalink
Merge pull request #3856 from erouvier29/patch-14
Browse files Browse the repository at this point in the history
[-] BO : Incorrect shipping taxes in order slips (PSCSX-4881)
  • Loading branch information
Julien Martin committed Apr 6, 2016
2 parents acd8f42 + 69b87a8 commit f42c45f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
Expand Up @@ -104,7 +104,7 @@
{/if}
{/if}
{elseif get_class($document) eq 'OrderSlip'}
{displayPrice price=$document->amount+$document->shipping_cost_amount currency=$currency->id}
{displayPrice price=$document->total_products_tax_incl+$document->total_shipping_tax_incl currency=$currency->id}
{/if}
</td>
<td class="text-right document_action">
Expand Down
2 changes: 1 addition & 1 deletion classes/order/OrderSlip.php
Expand Up @@ -381,7 +381,7 @@ public static function create(Order $order, $product_list, $shipping_cost = fals

$order_slip->{'total_products_tax_'.$inc_or_ex_2} -= (float)$amount && !$amount_choosen ? (float)$amount : 0;
$order_slip->amount = $amount_choosen ? (float)$amount : $order_slip->{'total_products_tax_'.$inc_or_ex_1};
$order_slip->shipping_cost_amount = $order_slip->{'total_shipping_tax_'.$inc_or_ex_1};
$order_slip->shipping_cost_amount = $order_slip->total_shipping_tax_incl;

if ((float)$amount && !$amount_choosen) {
$order_slip->order_slip_type = 1;
Expand Down
16 changes: 3 additions & 13 deletions classes/pdf/HTMLTemplateOrderSlip.php
Expand Up @@ -126,19 +126,9 @@ public function getContent()
$tax_calculator = new TaxCalculator(array($tax));
$tax_excluded_display = Group::getPriceDisplayMethod((int)$customer->id_default_group);

if (/*$this->order_slip->partial == 1 && */$this->order_slip->shipping_cost_amount > 0) {
if ($tax_excluded_display) {
$this->order->total_shipping_tax_incl = Tools::ps_round($tax_calculator->addTaxes($this->order_slip->shipping_cost_amount), 2);
} else {
$this->order->total_shipping_tax_incl = $this->order_slip->shipping_cost_amount;
}
}

if ($tax_excluded_display) {
$this->order->total_shipping_tax_excl = $this->order_slip->shipping_cost_amount;
} else {
$this->order->total_shipping_tax_excl = Tools::ps_round($tax_calculator->removeTaxes($this->order_slip->shipping_cost_amount), 2);
}
$this->order->total_shipping_tax_incl = $this->order_slip->total_shipping_tax_incl;
$this->order->total_shipping_tax_excl = $this->order_slip->total_shipping_tax_excl;
$this->order_slip->shipping_cost_amount = $tax_excluded_display ? $this->order_slip->total_shipping_tax_excl : $this->order_slip->total_shipping_tax_incl;

$this->order->total_paid_tax_incl += $this->order->total_shipping_tax_incl;
$this->order->total_paid_tax_excl += $this->order->total_shipping_tax_excl;
Expand Down
2 changes: 0 additions & 2 deletions pdf/order-slip.total-tab.tpl
Expand Up @@ -94,8 +94,6 @@
{$total_paid = $order->total_paid_tax_incl - $total_cart_rule}
{/if}
- {displayPrice currency=$order->id_currency price=$total_paid}
{elseif $amount_choosen}
- {displayPrice currency=$order->id_currency price=($order_slip->amount+$order_slip->shipping_cost_amount)}
{else}
{if $tax_excluded_display}
- {displayPrice currency=$order->id_currency price=$order->total_paid_tax_excl}
Expand Down

0 comments on commit f42c45f

Please sign in to comment.