[-] FO : invoice: do not display taxes table if there is not tax to display

This commit is contained in:
Damien Metzger committed 2013-04-23 16:46:11 +02:00
1 parent 913d0d9711
commit 6f96f0ac9a
2 files changed
+10 -7

No files matched your search

+7 -6
View File
@@ -384,21 +384,22 @@ class OrderInvoiceCore extends ObjectModel
*/ */
public function getEcoTaxTaxesBreakdown() 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` 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` FROM `'._DB_PREFIX_.'order_detail`
WHERE `id_order` = '.(int)$this->id_order.' WHERE `id_order` = '.(int)$this->id_order.'
AND `id_order_invoice` = '.(int)$this->id.' AND `id_order_invoice` = '.(int)$this->id.'
GROUP BY `ecotax_tax_rate`' GROUP BY `ecotax_tax_rate`');
);
if ($res) $taxes = array();
foreach ($res as &$row) 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_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); $row['ecotax_tax_excl'] = Tools::ps_round($row['ecotax_tax_excl'], 2);
$taxes[] = $row;
} }
return $res; return $taxes;
} }
/** /**
+3 -1
View File
@@ -22,6 +22,8 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * 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 --> <!-- TAX DETAILS -->
<table style="width: 100%"> <table style="width: 100%">
<tr> <tr>
@@ -98,4 +100,4 @@
</tr> </tr>
</table> </table>
<!-- / TAX DETAILS --> <!-- / TAX DETAILS -->
{/if}