About rounding need help

i try round this {{format_number(grand_total-0.05,“0.0”)}}+0.05

for example grand_total = 2.07 so i want 2.07-0.05=2.02 after round =2.00 then +0.05 so final is 2.05

i try {{format_number(grand_total-0.05,“0.0”,+0.05)}} but it become 2.00 not 2.05

anyone help me

thanks

Use round() function instead of format_number() for the purpose.

Hi I tried to do the following for the POS invoice:

		<td class="text-right" style="width: 75%">
				<b>{{ __("Grand Total Rounded") }}</b>
			</td>
			<td class="text-right">
				{{ format_currency(round(grand_total/0.05)*0.05, currency) }}
			</td>

Now my invoice doesnt print. Any ideas why? (the logic works in excel)

wow! it working thanks alot

yes, it work if is POS invoice (Print Format Type =server) but not work if point of sales (Print Format Type=Js), i find another solution ignore 0.05 .

{{ format_number(grand_total-0.03,“0.0”) }}

for example if grand_total = 2.07 then 2.07-0.03 =2.00 or grand_total = 8.10 = 8.10-0.03 = 8.10

1 Like