Page 1 of 1

Show extra costs as grouped in documents

Posted: Sun Aug 09, 2015 3:03 pm
by tirgil
Hi, i use document like below

[r4 array="vat_perc_arr_invo"]
<table class="invoice_items" border="1" cellpadding="5" style="border: 1px black solid; width: 740px; margin-left: auto; margin-right: 5px; margin-top: 8px; border-collapse: collapse; background-color: #e6e6e6;">
[r]
[c show_rate_invo="1"]<tr><td style="border-color: black;">Stay from [starting_date] to [ending_date][people_phrase_invo]</td>
<td style="width: 120px; text-align: right; border-color: black;">[currency_name] [rate_no_vat_invo_p]</td></tr>
[/c][c show_discount_invo="1"]<tr><td style="border-color: black;">Discount</td>
<td style="width: 120px; text-align: right; border-color: black;">[currency_name] [discount_no_vat_invo_p]</td></tr>
[/c]
[r3][c show_extra_cost_invo="1"]<tr><td style="border-color: black;">[extra_cost_name]</td>
<td style="border-color: black; width: 120px; text-align:center">[extra_cost_max_multiply]</td>
<td style="width: 120px; text-align: right; border-color: black;">[currency_name] [extra_cost_value_p]</td></tr>
[/c][c show_cost_as_taxes_invo="1"]<tr><td style="border-color: black;">Tax: "[extra_cost_name]"</td>
<td style="width: 120px; text-align: right; border-color: black;">[currency_name] [extra_cost_taxes_p]</td></tr>
[/c][/r3][/r]
</table>
[/r4]

This table shows extra codes according to the Point of Sale so that there are multiple row for each sell. How can i group extra costs. I mean if i sell a cafe on different times in a day or another day, i want to show all of them in one row so that it look likes below

Cafe (extra cost name) - total count (total multiple by) - total cost

Re: Show extra costs as grouped in documents

Posted: Tue Dec 01, 2015 3:39 pm
by marco
Hello,
you could use the extra costs repetitions just to store values in an array, then use the array repetition to show the values. In your conditions you can have a structure like this:

-if [extra_cost_name] is equal to "" then do not evaluate subsequent conditions until next resume
.....
(conditions applied in the extra costs repetition)
.....
-resume evaluating conditions
-if [extra_cost_name] is different from "" then do not evaluate subsequent conditions until the end
.......
(conditions applied outside extra costs repetitions)
.....

In the conditions inside extra costs repetitions you should check if the extra cost was already present, if it was add to its multiplier.

Regards,
Marco