CSS for Rounding Number in Print

Hi,
could anyone please share a CSS code to put in to show zero decimal points in print format. System default is 2 decimal points and i don’t want to change that. But for print only want it rounded to 0 decimals.

TIA

Look for jinja round method.

{{ 42.55 | round }}
    -> 43.0

{{ 42.55 | round | int }}
    -> 43

https://jinja.palletsprojects.com/en/2.11.x/templates/#round

2 Likes

i have put this code in CSS (pic attached) but i still see 2 decimal places in print / PDF

ErpNext

That’s not CSS ;). You would use the Jinja tags within HTML code. Either within a HTML block in the print format builder or within a custom HTML print format. Replace the 42.55 by doc.your_fieldname.

To apply this customization globally, you need to create a custom print format for each doctype AFAIK. To learn more about custom print format, Refer: Customize Print Format

After you have created the print format, apply the customization suggested by rmeyer on the jinja.