Hi, I tried to fix this for me but i’m not able.
i would that subtotal is sum of item_prices, discount is sum of discounts and total is the real total (subtotal-discount)
How i can hack modules to give me this on prints?
Thanks a lot
Hi, I tried to fix this for me but i’m not able.
i would that subtotal is sum of item_prices, discount is sum of discounts and total is the real total (subtotal-discount)
How i can hack modules to give me this on prints?
Thanks a lot
If you have some PHP knowledge you could change it. In the templates of your quotes/invoices. Add three for each loops so for recalculate everything when the pdf is writing the document.
I need some help cause i’m not php’s expert … I tried a lot but don’t work. Obviously I miss something
Thank’s
Could you send me your template? I will try to fix it
Thanks man, I think It’s ok now.
I used array who count during the cicle … seems okay ^^
I post the code here:
<?php
$final_subtotal = 0;
$final_discount = 0;
foreach ($items as $item) {
?>
<tr>
<!--
<td><?php echo $item->item_name; ?></td>
-->
<td><?php echo nl2br($item->item_description); ?></td>
<td><?php echo format_amount($item->item_quantity); ?></td>
<td><?php echo format_amount($item->item_price) . ' €'; ?></td>
<?php echo $discount ? '<td>' . format_amount($item->item_discount_amount) . ' %</td>' : '' ?>
<td><?php
$item_sub = $item->item_subtotal - $item->item_discount;
if ($item_sub != 0){
echo format_amount($item_sub) . ' €';
}
else {
echo '0,00 €';
}?>
</td>
</tr>
<?php
$final_subtotal += $item->item_subtotal;
$final_discount += $item->item_discount;
} ?>
and then, inside the totals:
<tr>
<th><?php echo 'Importo'; ?> </th>
<td><?php echo format_amount($final_subtotal); ?> €</td>
</tr>
<tr>
<th><?php echo 'Sconto'; ?> </th>
<td><?php echo format_amount($final_discount); ?> €</td>
</tr>
Thank’s a lot for help!
Super! Good job!
Ciao simxware,
vorrei poter utilizzare il tuo template per le fatture/preventivi e quindi visualizzare sia lo sconto per riga/item sia nel riepilogo totale.
Come posso fare?
Grazie in anticipo.
P.
Here my working template code for discount, on the invoice-sums section (with InvoicePlane 1.4.6) :
<?php if ($invoice->invoice_discount_percent <> "0") { ?>
<tr>
<td></td>
<td <?php echo ($show_discounts ? 'colspan="5"' : 'colspan="4"'); ?> class="text-right">
<?php echo lang('discount') . "" . round($invoice->invoice_discount_percent, 2) . "%" ; ?>
</td>
<td class="text-right"><?php echo "-" . format_currency($invoice->invoice_item_subtotal * $invoice->invoice_discount_percent / 100); ?></td>
</tr>
<?php } ?>
<?php if ($invoice->invoice_discount_amount <> "0") { ?>
<tr>
<td></td>
<td <?php echo ($show_discounts ? 'colspan="5"' : 'colspan="4"'); ?> class="text-right">
<?php echo lang('discount') ; ?>
</td>
<td class="text-right"><?php echo "-" . format_currency($invoice->invoice_discount_amount); ?></td>
</tr>
<?php } ?>