Topic: Achieved 999% (error?) in Profit and Loss statement

When the denominator is 0, the percentage is shown a 999% for achieved %.

Attached is the screenshot.

Is this the intended denotation for error or out of range values?

Post's attachments

FA_rep707_PL_Err.png 24.8 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Achieved 999% (error?) in Profit and Loss statement

This is not an error, but a constant for out of range value.

Joe

Re: Achieved 999% (error?) in Profit and Loss statement

Where in the wiki should we indicate this fact. Should a translatable string be used in FA 2.4?

Re: Achieved 999% (error?) in Profit and Loss statement

I don't know Apmuthu. We have had this all the time. Maybe you can find somewhere suitable in the Wiki to put this. Isn't it mostly used in the balance Sheet and Profit and Loss Statements?

I my opinion, I Think we can continue with this.

/Joe

5 (edited by apmuthu 02/23/2015 08:19:05 am)

Re: Achieved 999% (error?) in Profit and Loss statement

Then let it be like that except that a constant string can be defined for now as '999' and used in the function Achieve();
Lines 137 to 147 in reporting/rep707.php:

function Achieve($d1, $d2)
{
    if ($d1 == 0 && $d2 == 0)
        return 0;
    elseif ($d2 == 0)
        return 999;
    $ret = ($d1 / $d2 * 100.0);
    if ($ret > 999)
        $ret = 999;
    return $ret;
}

can be

define('OUT_OF_RANGE', 999);

function Achieve($d1, $d2)
{
    if ($d1 == 0 && $d2 == 0)
        return 0;
    elseif ($d2 == 0)
        return OUT_OF_RANGE;
    $ret = ($d1 / $d2 * 100.0);
    if ($ret > OUT_OF_RANGE)
        $ret = OUT_OF_RANGE;
    return $ret;
}

The define can be placed into the file that contains the other constants.

The said function Achieve() is duplicated in gl/inquiry/profit_loss.php.

In reporting/includes/excel_report.inc we find that 9999999 is used to represent "infinity".

In includes/ui/ui_view.inc, the value 999999999999 is used to represent "infinity".

In includes/date_functions.inc, the value 9999 is used to represent the max year.

In admin/view_print_transaction.php and admin/void_transaction.php, the value 999999 is used to represent the max ToTransNo.