Jump to content

Old expenses addon - mods updates


Recommended Posts

Not sure if any of you still have this old addon which is no longer supported by the developer.




However its sort of confusing, they say its under the MIT license, but on the github it sais you can take it and do what you want with it.


This project has not been maintained in a few years. Feel free to take over and do with it what you will.


So rather than take it of which i am not prepared to do right now, and expecially since there is a new expenses addon in the store listing i thought i would just keep this simple.


If your just starting out and no money and just need something simple then i recommend this free addon from the developer, i been using it and it helps. But if you have money and need something fancy and full featured then of course get the new module from the new developer thats listed in the whmcs store.


I started this thread because if i add something simple to this simple addon i will post it here.


One thing i did was i added a column to show profit (or difference basically) that way when you look at the

income today, income monthly, income yearly and you want to see how much was left over after your expenses on the item then it makes it easier.


So in stats.php in the module, right before the first table before the first close php ?>




//differences - profits

//strip away everything $ and currency, leave raw amount no decimal either
// now make sure its in the format xx.xx
$today_inc = preg_replace("/[^0-9]/","",$results['income_today']) / 100;
$inc_month = preg_replace("/[^0-9]/","",$results['income_thismonth']) / 100; 
$inc_year = preg_replace("/[^0-9]/","",$results['income_thisyear']) / 100;

//now format the other factor in the subtractor (subtrahend)
$in_taxamt_today = number_format($tax_in_amt, 2, '.', '');
$in_taxamt_mo = number_format($tax_in_amt1, 2, '.', '');
$in_taxamt_yr = number_format($tax_in_amt2, 2, '.', '');

//do the calculation
$profit_today = $today_inc - $in_taxamt_today; 
$profit_month = $inc_month - $in_taxamt_mo;
$profit_year = $inc_year - $in_taxamt_yr; 


Then in the first row you add the header label




Then in the following rows you add the cell values for each row item, today, monthly, yearly



<td align="center"><?php echo $symbol.$profit_today; ?></td>



<td align="center"><?php echo $symbol.$profit_month; ?></td>


<td align="center"><?php echo $symbol.$profit_year; ?></td>


Thats it and then when you click on quick stats tab, it shoud look like this:





If i do something else worth sharing i will post it here as well.


happy coding :)

Edited by durangod
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated