Skip to content

Commit

Permalink
Merge pull request #11 from siena123/master
Browse files Browse the repository at this point in the history
new report
  • Loading branch information
guanlisheng committed Oct 12, 2014
2 parents b46df42 + 55b2d67 commit 6b2253f
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
4 changes: 4 additions & 0 deletions usercoloredtransactions/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
List all user colored transactions.

Use CTRL 1 through CTRL 7 to set color. Use CTRL 0 to clear color.
Map specific colors used in MMEX View Options.
13 changes: 13 additions & 0 deletions usercoloredtransactions/luacontent.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local base_total = 0;

function handle_record(record)
local prefix = record:get("PFX_SYMBOL");
local suffix = record:get("SFX_SYMBOL");
local amount = record:get("TRANSAMOUNT");
record:set("TRANSAMOUNT", prefix .. string.format("%.2f", amount) .. suffix);
base_total = base_total + record:get("BaseAmount");
end

function complete(result)
result:set("BaseTotal", base_total);
end
18 changes: 18 additions & 0 deletions usercoloredtransactions/sqlcontent.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
select t.FOLLOWUPID, t.PAYEENAME, t.TRANSDATE, t.TRANSAMOUNT
, t.TRANSAMOUNT*c.BASECONVRATE as BaseAmount
, c.PFX_SYMBOL, c.SFX_SYMBOL
from
(select p.PAYEENAME as PAYEENAME, c1.TRANSDATE as TRANSDATE, c1.FOLLOWUPID as FOLLOWUPID,
(case when c1.TRANSCODE = 'Deposit' then c1.TRANSAMOUNT else -c1.TRANSAMOUNT end) as TRANSAMOUNT,
a1.CURRENCYID as CURRENCYID
from CHECKINGACCOUNT_V1 as c1
inner join PAYEE_V1 as p on p.PAYEEID = c1.PAYEEID
inner join ACCOUNTLIST_V1 as a1 on a1.ACCOUNTID = c1.ACCOUNTID
union all
select a2.ACCOUNTNAME, c2.TRANSDATE, c2.FOLLOWUPID, c2.TOTRANSAMOUNT, a2.CURRENCYID
from CHECKINGACCOUNT_V1 as c2
inner join ACCOUNTLIST_V1 as a2 on a2.ACCOUNTID = c2.TOACCOUNTID
where TRANSCODE = 'Transfer') as t
inner join CURRENCYFORMATS_V1 as c on t.CURRENCYID=c.CURRENCYID
where t.FOLLOWUPID > 0 and t.FOLLOWUPID <= 7
order by t.FOLLOWUPID asc, t.PAYEENAME asc, t.TRANSDATE asc;
62 changes: 62 additions & 0 deletions usercoloredtransactions/template.htt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http - equiv = "Content-Type" content = "text/html" />
<title><TMPL_VAR REPORTNAME></title>
<link href = "master.css" rel = "stylesheet" />
</head>
<body>
<div class = "container">
<h3><TMPL_VAR REPORTNAME></h3>
<TMPL_VAR TODAY><hr>
<div class = "row">
<div class = "col-xs-2"></div>
<div class = "col-xs-8">
<table class = "table">
<thead>
<tr>
<th>Color</th>
<th>Payee Name</th>
<th>Date</th>
<th class="text-center">Amount</th>
<th class="text-center">Base Amount</th>
</tr>
</thead>
<tbody>
<TMPL_LOOP NAME=CONTENTS>
<tr>
<td><TMPL_VAR "FOLLOWUPID"></td>
<td><TMPL_VAR "PAYEENAME"></td>
<td><TMPL_VAR "TRANSDATE"></td>
<td class = "text-right"><TMPL_VAR "TRANSAMOUNT"></td>
<td class = "money text-right"><TMPL_VAR "BaseAmount"></td>
</tr>
</TMPL_LOOP>
</tbody>
<tfoot>
<tr class="total">
<td>Total</td>
<td></td>
<td></td>
<td></td>
<td class="money text-right"><TMPL_VAR BaseTotal></td>
</tr>
</tfoot>
</table>
</div>
<TMPL_LOOP ERRORS>
<hr>
<TMPL_VAR ERROR>
</TMPL_LOOP>
</div>
</div>
</body>
<script>
<!--Format numbers-->
function currency(n) { n = parseFloat(n); return isNaN(n) ? 0 : n.toFixed(2); }
var elements = document.getElementsByClassName("money");
for (var i = 0; i < elements.length; i++)
{ elements[i].innerHTML = "<TMPL_VAR PFX_SYMBOL>" + currency(elements[i].innerHTML) + "<TMPL_VAR SFX_SYMBOL>"; }
</script>
</html>

0 comments on commit 6b2253f

Please sign in to comment.