How do i change to indian numbering system

Dolibarr uses international number system

but we as Indian cant use that pls help me this to change it Indian number system

any kind of help would be greatful

Hello,

Does not what you mean by “Indian number system” ?

You are not using 123456789 ?

Hi sir,

i meant this system

Ok but where do you want to use this ? in the PDF invoice ? on the screen ? etc…

it would be best if we get both in our Pdfs and on screen

but mainly on pdf as we will be sharing them with our vendors and customers

sir i would appreciate your input in solving this issue we are facing to operate with this in India

it would be significant help in Dolibarr implementation in India as we also going to promote this with our partners and so on.

thanks, and regards
Amogh

Hello :slight_smile:

in the file core/lib/functions.lib.php, you must adapt the function named price

and at this line, you can change the output string to get the indian numbering
image

Good continuation

1 Like

Hi Amogh,

I am a Dolibarr developer from India. Let me know if I can do any help. You will have to modify in the code.

Thanks
Saikat

Hi that is good to know

pls let me how to contact u

we can work this out

can you please provide a code example to have a result like - “1,00,000.00”

Need help

I found a fix, but I’m unsure if this will work for multicurrency users.

also facing minor issues like tax rate column (on pdf) and quantity (on card). How do I fix it?

As per @pcbleu’s suggestion, I edited the core/lib/functions.lib.php file using the code below.

	// Format number
	
	setlocale(LC_MONETARY, 'en_IN');
    $amount = money_format('%!i', $amount);
    $output = $amount;
    
	//$output = number_format($amount, $nbdecimal, $dec, $thousand);
	if ($form) {
		$output = preg_replace('/\s/', ' ', $output);
		$output = preg_replace('/\'/', ''', $output);
	}

here is how it would look on the card view

and PDF

1 Like

I’m getting issues as an output in PDF and Card formats for the following attributes:

  1. Tax Value/Percentage (Eg. 0.00/9.00/9.00): It shows empty values and converts integers into float.
  2. Quantity (Eg. In PDF - 1,200 or 10,000 / Card View - 1,200.00 or 10,000.00): It shows Thousands separator in quantity values. On card view its converts integers into float values.

All this happens when I use money_format function to have an Indian Currency Format.

@eldy Can you help?

All of this is done automatically if your setup for your language and country is correct.
What is your country setup in home - setup
What is your language setup in home - display (the thousand separator depends onbyour language)
Check also the home - setup - accuracy.
What do you lean with using money_format ?Such a function should never be used in code. There is no such use in official version. You already have mehods likes price(), price2num()

I have set the correct country in Home - Setup and Home - Display i.e. English (India) (en_IN)

In Home - Setup - Accuracy: I have default setting as mentioned below

I tried using money_format to get the Indian Currency Format which should look like this. Natively it is not giving me the right format. @amogh has explained it well in his past post.:

1,000.00
22,222.22
3,33,333.33
44,44,444.44
55,55,55,555.55

I’m running Dolibarr 19.0.2

i tried to to modify core>lib>functions.lib.php
as per @pcbleu

here is output

but there is slight issue

hope this helps and let me know if you got any suggestion in code to improve this (hope this get implemented in next version of official version for indian users)

As defined into en_In language file, decimal separayor is . And thousand separator is ,

And this is what we got in dolibarr.
1,000
200,000
1,000,000.25

Dolibarr support only the internationnal system.

But if you succeed in implementing a variant for indian syntax, you can submit the new code in a PR. We may allow an option to choose between the standard international or indian syntax.

What is the issue in your logic? is it about the Margin rate or Total (excl.)?

If you can share the code here, it will be easier to identify and address the problem.

I noticed that through the Dolibarr documentation and I get it, it is done to maintain the global standard.

But can you suggest a way around?