Assets

Build and share your cool customized reports built w/ one sql, Chart.js and Lua

Moderator: Renato

Post Reply
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Assets

Post by Nikolay »

New GRM will be described on wiki
https://sourceforge.net/p/moneymanagere ... 20Manager/
assetsGRM.gif
assetsGRM.gif (241.38 KiB) Viewed 3463 times
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Re: Assets

Post by Nikolay »

More advances js
https://github.com/Regaddi/Chart.js/tree/tooltips
assets_gt.png
(24.3 KiB) Downloaded 520 times
SQL

Code: Select all

SELECT
'' as COLOR,
assettype,
total(value) as VALUE
FROM ASSETS_V1 
group by assettype
order by value desc;
Lua script:

Code: Select all

local total = 1;
local count = 0;
local data = "";
local colors = {"#FBD4B4", "#E5B8B7", "#B6DDE8", "#B8CCE4", "#F0EDCE", "#DEE3E7", "#99FF99"};

function handle_record(record)
	total = total + record:get('VALUE');
    count = count +1;
    data = data .. '{value: ' .. record:get('VALUE') .. ', color:"' .. colors[count] .. '", label : "' .. record:get('ASSETTYPE') ..'", labelColor : "black", labelFontSize : "12", labelAlign : "center"},\n';
    record:set('COLOR', colors[count]);
end

function complete(result)
	result:set('ASSET_TOTAL', total);
	result:set('ASSET_DATA', data);
end
Template:

Code: Select all

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>MoneyManagerEx - Report</title>
    <SCRIPT><TMPL_INCLUDE NAME="Chart.js"></SCRIPT>
</head>
<h3><TMPL_VAR REPORTNAME></h3>
<TMPL_VAR TODAY><hr>
<table cellspacing='1' width='90%'>
<tr><td><table cellspacing='1' >

<tr><td><canvas id="reportChart" width="300" height="300"></canvas></td></tr>

    <tr bgcolor='#4f81bd'>
        <th ><font color="white">ASSETTYPE</font></th>
        <th><font color="white">VALUE</font></th>
    </tr>
    <TMPL_LOOP NAME=CONTENTS>
        <tr bgcolor='<TMPL_VAR "COLOR">'>
        <td><TMPL_VAR "ASSETTYPE"></td>
        <td nowrap align='right'><TMPL_VAR "VALUE"></td>
        </tr>
    </TMPL_LOOP>
    <tr><td colspan=2><table border='1' width='100%'></table></td></tr>
        <tr>
        <td>Total:</td>
        <td nowrap align='right'><TMPL_VAR "ASSET_TOTAL"></td>
        </tr>
</td><td></td></tr></table></table>

<TMPL_LOOP ERRORS>
    <hr>
    <TMPL_VAR ERROR>
</TMPL_LOOP>

<script type="text/javascript">
   	var data = [
<TMPL_VAR "ASSET_DATA">
];
   	
   	var options = {
   	// animation : false,
   	animationEasing: 'easeOutQuint'
   	};
   
  // Get the context of the canvas element we want to select
  var ctx = document.getElementById("reportChart").getContext("2d");
  var reportChart = new Chart(ctx).Pie(data, options);
</script>
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Re: Assets

Post by Nikolay »

Report container


http://msdn.microsoft.com/en-us/library ... _emulation

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"mmex.exe"=dword:00002af9
Attachments
Asset_Totals.grm
(1.51 KiB) Downloaded 473 times
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Re: Assets

Post by Nikolay »

updated. only for svn >= 6145
Attachments
Asset_Totals.grm
(1.48 KiB) Downloaded 486 times
Post Reply