Jump to content

Recommended Posts

Posted

ok, so im trying to determine the net income only based off of gross income - fuel price per pirep. the code i have looks like this:

$gross = FinanceData::FormatMoney($pirep->load * $pirep->price);
$fuel = FinanceData::FormatMoney($pirep->fuelused * $pirep->fuelunitcost);
$netincome = $gross - $fuel;
echo $netincome;

the value it returns is 0, no matter what.

if i echo each gross and fuel separably it shows the numbers properly.

What exactly am i doing wrong here?

  • Like 1
  • Moderators
Posted

Change it to this:

$gross = $pirep->load * $pirep->price;
$fuel = $pirep->fuelused * $pirep-fuelunitcost;
$netincome = $gross - $fuel;
echo FinanceData::FormatMony($netincome);

Posted

yw

it actually ended up not giving me the proper result. i modifified it to the following to get it to work:

$gross = $pirep->load * $pirep->price;
$fuelused = $pirep->fuelused;
$fuelcost = $pirep->fuelunitcost;

$fuel = $fuelused * $fuelcost;
$netincome = $gross - $fuel;

echo FinanceData::FormatMoney($netincome);

Guest lorathon
Posted

parkho's original code has an error

$fuel = $pirep->fuelused * $pirep-fuelunitcost;

Should be

$fuel = $pirep->fuelused * $pirep->fuelunitcost;

> is missing

  • Moderators
Posted

oh I see that now. I thought maybe the "FormatMoney()" function should be used at the end and that's why there were no results. Thanks for pointing that out.

Salamaty :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...