The SimpleInvoices forum has moved to Google Plus - this forum is now read-only
Quantity number with decimals
  • db2012db2012 January 2012

    I am having trouble with the quantity. Currently, the quantity is saved as a rounded number without decimals. I want the application to be able to handle quantities such as 2.50 or 1.25.

    Can anyone help me with this?

    Thanks in advance!

    gr,

    DB

  • modirmodir January 2012

    Would it be possible for you to use a different unit? So you would save 250 instead if 2.50?

  • db2012db2012 January 2012

    Hi, I don't think I quite understand your question. The quantity numbers were rounded. So 1.5 becomes 1. Only 0.5 works. Everything above 1 fails to give a number with decimals.

    I changed the locale variable to en_GB and strange enough now it works! Even the decimals and thousand separators work well. I am using the euro format (such as €2.000,45)

    I am going to check all functions to see if the problem's solved.

    Thanks anyway!

  • db2012db2012 January 2012

    Hi,

    I have taken a look at the figures. When I change the locale variable to gb_GB I can use quantities with decimals. However, the number format of the invoices screen is then not in the #.###,## format anymore.

    I'd like to stick to the nl_NL locale variable AND use quantity numbers with decimals. Does anyone know how to fix this?


    Thanks in advance!

    DB

  • db2012db2012 January 2012

    Hello Modir,

    I have taken a closer look to your comment, now I understand what you meant. It's not possible to use a different unit.

    I am still looking for a solution (see my previous comment). The quantity with decimals works when using the en_GB locale. Is it possible to change some parameters in order to make this quantity format work with a Euro number format (such as nl_NL)?

    Another alternative for me is to use the gb_GB locale and change the invoices templates (the templates quick_view and manage) and reformat all numbers with the number_format procedure. But I'd rather not use this option, because it's a lot of work and I'm wondering if I'm not harming the functionality of SimpleInvoices.

    Do you have any suggestions rather than the option above?

    Thanks!

    DB

  • modirmodir January 2012

    Sorry, I didn't look at this part of the code yet. So I have no other option. But maybe Matt or Justin have another idea.

    Else I recommend you to open a bug here: http://code.google.com/p/simpleinvoices/issues/list
    The other developers will then see it too.

  • db2012db2012 January 2012

    Hello Modir,

    I solved the problem!

    Apparently, the quantity for a new invoice is working correctly when using a dot as decimal (even though the euro format is different, this is not a problem for me). The rounding of the quantity was still active when changing an existing invoice.

    Because I am using the nl_NL locale variable, the read quantity in the text field (when changing existing invoice) had a incorrect format (such as 2,5). The application cannot handle a number with a comma. Now I have changed the details.tpl and made sure that the quantity text field is fed with a english formatted number. Now it works!

    The only disadvantage is that all displayed number use a comma as a decimal, but insertions have to be done with a "." as the decimal character. I can live with that.

    DB

Categories