[-] FO : invoice: do not display taxes table if there is not tax to display
This commit is contained in:
@@ -384,21 +384,22 @@ class OrderInvoiceCore extends ObjectModel
|
||||
*/
|
||||
public function getEcoTaxTaxesBreakdown()
|
||||
{
|
||||
$res = Db::getInstance()->executeS('
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `ecotax_tax_rate` as `rate`, SUM(`ecotax` * `product_quantity`) as `ecotax_tax_excl`, SUM(`ecotax` * `product_quantity`) as `ecotax_tax_incl`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int)$this->id_order.'
|
||||
AND `id_order_invoice` = '.(int)$this->id.'
|
||||
GROUP BY `ecotax_tax_rate`'
|
||||
);
|
||||
GROUP BY `ecotax_tax_rate`');
|
||||
|
||||
if ($res)
|
||||
foreach ($res as &$row)
|
||||
$taxes = array();
|
||||
foreach ($result as $row)
|
||||
if ($row['ecotax_tax_excl'] > 0)
|
||||
{
|
||||
$row['ecotax_tax_incl'] = Tools::ps_round($row['ecotax_tax_excl'] + ($row['ecotax_tax_excl'] * $row['rate'] / 100), 2);
|
||||
$row['ecotax_tax_excl'] = Tools::ps_round($row['ecotax_tax_excl'], 2);
|
||||
$taxes[] = $row;
|
||||
}
|
||||
return $res;
|
||||
return $taxes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if $tax_exempt || ((isset($product_tax_breakdown) && $product_tax_breakdown|@count > 0) || (isset($ecotax_tax_breakdown) && $ecotax_tax_breakdown|@count > 0))}
|
||||
<!-- TAX DETAILS -->
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
@@ -41,56 +43,56 @@
|
||||
</tr>
|
||||
|
||||
{if isset($product_tax_breakdown)}
|
||||
{foreach $product_tax_breakdown as $rate => $product_tax_infos}
|
||||
<tr style="line-height:6px;background-color:{cycle values='#FFF,#DDD'};">
|
||||
<td style="width: 30%">
|
||||
{if !isset($pdf_product_tax_written)}
|
||||
{l s='Products' pdf='true'}
|
||||
{assign var=pdf_product_tax_written value=1}
|
||||
{foreach $product_tax_breakdown as $rate => $product_tax_infos}
|
||||
<tr style="line-height:6px;background-color:{cycle values='#FFF,#DDD'};">
|
||||
<td style="width: 30%">
|
||||
{if !isset($pdf_product_tax_written)}
|
||||
{l s='Products' pdf='true'}
|
||||
{assign var=pdf_product_tax_written value=1}
|
||||
{/if}
|
||||
</td>
|
||||
<td style="width: 20%; text-align: right;">{$rate} %</td>
|
||||
{if !$use_one_after_another_method}
|
||||
<td style="width: 20%; text-align: right;">
|
||||
{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$product_tax_infos.total_price_tax_excl}
|
||||
</td>
|
||||
{/if}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$product_tax_infos.total_amount}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</td>
|
||||
<td style="width: 20%; text-align: right;">{$rate} %</td>
|
||||
{if !$use_one_after_another_method}
|
||||
<td style="width: 20%; text-align: right;">
|
||||
{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$product_tax_infos.total_price_tax_excl}
|
||||
</td>
|
||||
{/if}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$product_tax_infos.total_amount}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{if isset($shipping_tax_breakdown)}
|
||||
{foreach $shipping_tax_breakdown as $shipping_tax_infos}
|
||||
<tr style="line-height:6px;background-color:{cycle values='#FFF,#DDD'};">
|
||||
<td style="width: 30%">
|
||||
{if !isset($pdf_shipping_tax_written)}
|
||||
{l s='Shipping' pdf='true'}
|
||||
{assign var=pdf_shipping_tax_written value=1}
|
||||
{if isset($shipping_tax_breakdown)}
|
||||
{foreach $shipping_tax_breakdown as $shipping_tax_infos}
|
||||
<tr style="line-height:6px;background-color:{cycle values='#FFF,#DDD'};">
|
||||
<td style="width: 30%">
|
||||
{if !isset($pdf_shipping_tax_written)}
|
||||
{l s='Shipping' pdf='true'}
|
||||
{assign var=pdf_shipping_tax_written value=1}
|
||||
{/if}
|
||||
</td>
|
||||
<td style="width: 20%; text-align: right;">{$shipping_tax_infos.rate} %</td>
|
||||
{if !$use_one_after_another_method}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$shipping_tax_infos.total_tax_excl}</td>
|
||||
{/if}
|
||||
</td>
|
||||
<td style="width: 20%; text-align: right;">{$shipping_tax_infos.rate} %</td>
|
||||
{if !$use_one_after_another_method}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$shipping_tax_infos.total_tax_excl}</td>
|
||||
{/if}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$shipping_tax_infos.total_amount}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$shipping_tax_infos.total_amount}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{if isset($ecotax_tax_breakdown)}
|
||||
{foreach $ecotax_tax_breakdown as $ecotax_tax_infos}
|
||||
{if $ecotax_tax_infos.ecotax_tax_excl > 0}
|
||||
<tr style="line-height:6px;background-color:{cycle values='#FFF,#DDD'};">
|
||||
<td style="width: 30%">{l s='Ecotax' pdf='true'}</td>
|
||||
<td style="width: 20%; text-align: right;">{$ecotax_tax_infos.rate } %</td>
|
||||
{if !$use_one_after_another_method}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$ecotax_tax_infos.ecotax_tax_excl}</td>
|
||||
{foreach $ecotax_tax_breakdown as $ecotax_tax_infos}
|
||||
{if $ecotax_tax_infos.ecotax_tax_excl > 0}
|
||||
<tr style="line-height:6px;background-color:{cycle values='#FFF,#DDD'};">
|
||||
<td style="width: 30%">{l s='Ecotax' pdf='true'}</td>
|
||||
<td style="width: 20%; text-align: right;">{$ecotax_tax_infos.rate } %</td>
|
||||
{if !$use_one_after_another_method}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=$ecotax_tax_infos.ecotax_tax_excl}</td>
|
||||
{/if}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=($ecotax_tax_infos.ecotax_tax_incl - $ecotax_tax_infos.ecotax_tax_excl)}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<td style="width: 20%; text-align: right;">{if isset($is_order_slip) && $is_order_slip}- {/if}{displayPrice currency=$order->id_currency price=($ecotax_tax_infos.ecotax_tax_incl - $ecotax_tax_infos.ecotax_tax_excl)}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</table>
|
||||
{/if}
|
||||
@@ -98,4 +100,4 @@
|
||||
</tr>
|
||||
</table>
|
||||
<!-- / TAX DETAILS -->
|
||||
|
||||
{/if}
|
||||
Reference in New Issue
Block a user