Results 1 to 6 of 6

Thread: format amount 0 to 0.00

  1. #1
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default how to format amount 0 to 0.00 ?

    Hi,

    how to format the amount 0 to 0.00 (or 0,00)?

    When I format the amount with format_number I get the right 0.00 but every amount > 999.99 is cut of: 1,256.88 -> 256.88
    I wrote a little function in my module class to format the 0 to 0.00 (or 0,00)

    Code:
    function formatAmount( $amount )
    {
        if ( 0 == $amount )
        {
            $seps   = get_number_seperators();
        	$amount = '0' . $seps[1] . '00';
    
        	return $amount;
        }
    
        return $amount;
    }
    But I think this could not be the right way.
    Where is my fault?

    Thanks for help
    Andi

    SugarOS 4.5.1b
    PHP 5.2.1 Linux
    Last edited by lilewian; 2007-04-10 at 02:09 PM.

  2. #2
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: format amount 0 to 0.00

    no suggestions?

    What's ambiguous at this question?
    Which information lacks?

    Andi

  3. #3
    beuten is offline Sugar Community Member
    Join Date
    May 2006
    Location
    Berlin, Germany
    Posts
    151

    Default Re: format amount 0 to 0.00

    Hallo Andi,

    I assume you are using German formatting? Generally, you should be able to set the formatting in the local settings section (as admin).

    Hope this helps und Grüße aus Berlin!
    Chad (beuten)
    DAXTEN
    www.daxten.com

  4. #4
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: format amount 0 to 0.00

    Hi beuten,

    thanks for help.

    The formatting in general is ok:
    1.988,99 (in german)
    1,988.99 (default)

    but if the amount is only 0 then only 0 is shown and not like it should be:
    0,00 (in german)
    0.00 (default)

    That's because I wrote this little function above. The problem occures only when the amount is 0.
    I installed SugarOS 4.5.1b and installed my module - nothing more, so locale settings are default. 0.00 should be shown, 0 is shown. All amounts are correct exept the 0.

    Any more idea?
    Thanks Andi

  5. #5
    beuten is offline Sugar Community Member
    Join Date
    May 2006
    Location
    Berlin, Germany
    Posts
    151

    Default Re: format amount 0 to 0.00

    In which modules / views? I am also using 4.5.1b and just checked Opportunities and all '0' numbers are showing up as '€0,00' in any currency values.
    Chad (beuten)
    DAXTEN
    www.daxten.com

  6. #6
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: format amount 0 to 0.00

    Ok you point me to the right direction - I checked the opportunities module:
    In this module the amount is shown as 0 in DetailView and in the ListView it is shown as 0.00.
    I looked at the code and there is the function currency_format_number($amount).
    But with this function the currency symbol is shown on the left side of the amount.
    Is there any possibility to put it on the right side of the amount?

    And what can I affect with an entry like this in the listviewdefs.php:
    Code:
    'AMOUNT' => array(
       ...		
       'currency_format' => true,
    ),
    Actual there is no effect with true and false.
    What possibilities do I have here?

    Thanks for help (aus dem herrlich sonnigen Berlin )
    Andi

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 2007-02-14, 07:28 PM
  2. Wrong date format in $this?
    By leenwebb in forum Developer Help
    Replies: 5
    Last Post: 2007-02-06, 08:41 PM
  3. Problem with Date format
    By nicolas in forum Help
    Replies: 1
    Last Post: 2005-05-19, 02:16 PM
  4. Date format
    By florent in forum Help
    Replies: 1
    Last Post: 2005-03-22, 06:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •