CedGauche Posted July 25, 2014 Report Share Posted July 25, 2014 Hi, is there an option, module or stat to show the profit of the month? So all pilots have a quick view without looking in the va finances. I want to put just the profit in the sidebar to the other statistics. At the moment I make this per hand, after every flight I had to update it manually thx Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 25, 2014 Administrators Report Share Posted July 25, 2014 You could use the Finance Data class to get the info in an array, something like $month_info->timestamp = time(); $finances = FinanceData::calculateFinances($month_info); Then you should have the $finances variable filled with; revenue gross fuelprice pilotpay so to show total revenue for the month you could use echo $finances->revenue Quote Link to comment Share on other sites More sharing options...
CedGauche Posted July 26, 2014 Author Report Share Posted July 26, 2014 Hi, Thank you. I've tried it, but I get some Errors. This is the code: <?php$month_info->timestamp = time(); $finances = FinanceData::calculateFinances($month_info); echo $finances->revenue ?> The Error: Warning: Creating default object from empty value in /var/www/web1112/html/va/core/templates/profile_main.tpl on line 334 -553500 The -553500 is the total of all monthly expenses, the right value hat to be around 300.000 Quote Link to comment Share on other sites More sharing options...
StartVM Posted July 26, 2014 Report Share Posted July 26, 2014 Try something like <?php $month_info->timestamp = time(); ?> <?php if($finances = FinanceData::calculateFinances($month_info)) {echo $finances->revenue; } ?> Quote Link to comment Share on other sites More sharing options...
CedGauche Posted July 26, 2014 Author Report Share Posted July 26, 2014 Thx, but I get the same error and also the same wrong revenue: Warning: Creating default object from empty value in /var/www/web1112/html/va/core/templates/profile_main.tpl on line 334 -553500 Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 27, 2014 Administrators Report Share Posted July 27, 2014 You must be on a newer version of php, that is an error that crops up in newer versions when you have not declared a new object and you try to use it. Try adding $finances = new stdClass(); prior to the code snippet. You may have to do the same thing for $month_info Quote Link to comment Share on other sites More sharing options...
CedGauche Posted July 27, 2014 Author Report Share Posted July 27, 2014 Ok thank you, that fixed the strict error But the result is still at -553500 , but the correct value must be around -286000 when I look in the finances. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 27, 2014 Administrators Report Share Posted July 27, 2014 Does it show the same thing on the regular financials page? I am guessing the calculation in the data class is not right if they match. Quote Link to comment Share on other sites More sharing options...
CedGauche Posted July 27, 2014 Author Report Share Posted July 27, 2014 Ok, when I put the code to the finance summerysheet, it show also -55300: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.