From 1cb47a231cd13b696d61371f95f34ee328008f43 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Wed, 13 Mar 2019 17:34:37 +0400 Subject: [PATCH 01/49] SQL to exclude Duplicate transactions also --- AccountForecast/sqlcontent.sql | 4 +-- AccountSummary/sqlcontent.sql | 2 +- AccountTrend/sqlcontent.sql | 4 +-- BudgetMonitoringCurrentMonth/sqlcontent.sql | 2 +- BudgetMonitoringLastMonth/sqlcontent.sql | 2 +- CategoryForecast/sqlcontent.sql | 4 +-- CategoryTrend/sqlcontent.sql | 4 +-- .../sqlcontent.sql | 2 +- PayeeTrend/sqlcontent.sql | 2 +- SavingsProgress/sqlcontent.sql | 26 +++++++++---------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/AccountForecast/sqlcontent.sql b/AccountForecast/sqlcontent.sql index 6f3fcdb..401e5de 100644 --- a/AccountForecast/sqlcontent.sql +++ b/AccountForecast/sqlcontent.sql @@ -10,7 +10,7 @@ select b.TRANSAMOUNT, b.REPEATS, b.NUMOCCURRENCES, b.NEXTOCCURRENCEDATE, c.PFX_S from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer') as t where t.ACCOUNTID = a.ACCOUNTID - and t.STATUS <> 'V') as Balance + and t.STATUS NOT IN ('V','D')) as Balance from (select ACCOUNTID, STATUS, REPEATS, NUMOCCURRENCES, NEXTOCCURRENCEDATE, (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT @@ -22,4 +22,4 @@ from inner join ACCOUNTLIST_V1 as a on b.ACCOUNTID = a.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID where a.ACCOUNTNAME = 'Account1' -and b.STATUS <> 'V'; +and b.STATUS NOT IN ('V','D'); diff --git a/AccountSummary/sqlcontent.sql b/AccountSummary/sqlcontent.sql index 49da208..0de8be3 100644 --- a/AccountSummary/sqlcontent.sql +++ b/AccountSummary/sqlcontent.sql @@ -9,7 +9,7 @@ select a.ACCOUNTNAME, c.BASECONVRATE, c.PFX_SYMBOL, c.SFX_SYMBOL, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer') as t where t.ACCOUNTID = a.ACCOUNTID - and t.STATUS <> 'V') as Balance + and t.STATUS NOT IN ('D', 'V')) as Balance from ACCOUNTLIST_V1 as a inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID where a.ACCOUNTTYPE in ('Checking', 'Term') and a.STATUS = 'Open' diff --git a/AccountTrend/sqlcontent.sql b/AccountTrend/sqlcontent.sql index 4a69425..a39b35f 100644 --- a/AccountTrend/sqlcontent.sql +++ b/AccountTrend/sqlcontent.sql @@ -13,7 +13,7 @@ select strftime('%Y', t1.TRANSDATE) as YEAR from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer') as t2 where t2.ACCOUNTID = t1.ACCOUNTID - and t2.STATUS <> 'V' + and t2.STATUS NOT IN ('D', 'V') and (strftime('%Y', t2.TRANSDATE) < strftime('%Y', t1.TRANSDATE) or (strftime('%Y', t2.TRANSDATE) = strftime('%Y', t1.TRANSDATE) and strftime('%m', t2.TRANSDATE) < strftime('%m', t1.TRANSDATE))) @@ -29,6 +29,6 @@ from inner join ACCOUNTLIST_V1 as a on a.ACCOUNTID = t1.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID where ACCOUNTNAME = 'Account1' - and t1.STATUS <> 'V' + and t1.STATUS NOT IN ('D', 'V') group by YEAR, MONTH order by YEAR asc, MONTH asc; diff --git a/BudgetMonitoringCurrentMonth/sqlcontent.sql b/BudgetMonitoringCurrentMonth/sqlcontent.sql index 6f1b59d..c8577e4 100644 --- a/BudgetMonitoringCurrentMonth/sqlcontent.sql +++ b/BudgetMonitoringCurrentMonth/sqlcontent.sql @@ -33,7 +33,7 @@ from ( join CurrencyFormats_v1 cf on (a.CurrencyId = cf.CurrencyId) where 1=1 and t.TransCode <> 'Transfer' - and t.Status <> 'V' + and t.STATUS NOT IN ('D', 'V') and TransDate between date('now', '0 month', 'start of month') and date('now', 'start of month', '1 month', '-1 day') diff --git a/BudgetMonitoringLastMonth/sqlcontent.sql b/BudgetMonitoringLastMonth/sqlcontent.sql index ee66b1c..4643656 100644 --- a/BudgetMonitoringLastMonth/sqlcontent.sql +++ b/BudgetMonitoringLastMonth/sqlcontent.sql @@ -33,7 +33,7 @@ from ( join CurrencyFormats_v1 cf on (a.CurrencyId = cf.CurrencyId) where 1=1 and t.TransCode <> 'Transfer' - and t.Status <> 'V' + and t.STATUS NOT IN ('D', 'V') and TransDate between date('now', '-1 month', 'start of month') and date('now', 'start of month', '0 month', '-1 day') diff --git a/CategoryForecast/sqlcontent.sql b/CategoryForecast/sqlcontent.sql index 25f885d..66c0205 100644 --- a/CategoryForecast/sqlcontent.sql +++ b/CategoryForecast/sqlcontent.sql @@ -6,11 +6,11 @@ select TRANSAMOUNT, REPEATS, NUMOCCURRENCES, NEXTOCCURRENCEDATE, (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from CHECKINGACCOUNT_V1) as t where t.CATEGID = a.CATEGID - and t.STATUS <> 'V' AND t.TRANSDATE>=date('now','start of year')) as Balance + and t.STATUS NOT IN ('D', 'V') AND t.TRANSDATE>=date('now','start of year')) as Balance from (select CATEGID, STATUS, REPEATS, NUMOCCURRENCES, NEXTOCCURRENCEDATE, (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from BILLSDEPOSITS_V1) as b inner join CATEGORY_V1 as a on b.CATEGID = a.CATEGID where a.CATEGNAME = 'Donations' -and b.STATUS <> 'V'; \ No newline at end of file +and b.STATUS NOT IN ('D', 'V'); \ No newline at end of file diff --git a/CategoryTrend/sqlcontent.sql b/CategoryTrend/sqlcontent.sql index 4e3eeed..ba8728b 100644 --- a/CategoryTrend/sqlcontent.sql +++ b/CategoryTrend/sqlcontent.sql @@ -4,12 +4,12 @@ select strftime('%Y', TRANSDATE) as YEAR , total((case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) * c1.BASECONVRATE) as AMOUNT from (select ACCOUNTID, TRANSDATE, TRANSCODE, CATEGID, SUBCATEGID, TRANSAMOUNT from CHECKINGACCOUNT_V1 - where STATUS <> 'V' + where STATUS NOT IN ('D', 'V') union all select t1.ACCOUNTID, t1.TRANSDATE, t1.TRANSCODE, t2.CATEGID, t2.SUBCATEGID, t2.SPLITTRANSAMOUNT from SPLITTRANSACTIONS_V1 as t2 inner join CHECKINGACCOUNT_V1 as t1 on t1.TRANSID = t2.TRANSID - where t1.STATUS <> 'V') as t3 + where t1.STATUS NOT IN ('D', 'V')) as t3 inner join ACCOUNTLIST_V1 as a1 on a1.ACCOUNTID = t3.ACCOUNTID inner join CURRENCYFORMATS_V1 as c1 on c1.CURRENCYID = a1.CURRENCYID inner join CATEGORY_V1 as cat on t3.CATEGID = cat.CATEGID diff --git a/DepositVsExpensesAndLoanRepaymentByMonth/sqlcontent.sql b/DepositVsExpensesAndLoanRepaymentByMonth/sqlcontent.sql index d701ef0..287b8ec 100644 --- a/DepositVsExpensesAndLoanRepaymentByMonth/sqlcontent.sql +++ b/DepositVsExpensesAndLoanRepaymentByMonth/sqlcontent.sql @@ -27,7 +27,7 @@ SELECT 'month' AS periode_name, ) THEN ca.transamount ELSE 0 END AS Transfer FROM checkingaccount_V1 AS ca - WHERE ca.status NOT IN ('V', 'D')-- and TRANSDATE > date('now', 'start of month','-5 year','localtime') + WHERE ca.STATUS NOT IN ('D', 'V')-- and TRANSDATE > date('now', 'start of month','-5 year','localtime') ) AS cadata GROUP BY periode diff --git a/PayeeTrend/sqlcontent.sql b/PayeeTrend/sqlcontent.sql index 343fc7b..2a55e06 100644 --- a/PayeeTrend/sqlcontent.sql +++ b/PayeeTrend/sqlcontent.sql @@ -18,6 +18,6 @@ inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID inner join PAYEE_V1 as p on t.PAYEEID = p.PAYEEID where p.PAYEENAME = 'Payee1' and t.TRANSCODE='Withdrawal' - and t.STATUS <> 'V' + and t.STATUS NOT IN ('D', 'V') group by year order by year desc; diff --git a/SavingsProgress/sqlcontent.sql b/SavingsProgress/sqlcontent.sql index f90f5c5..7dbcf9f 100644 --- a/SavingsProgress/sqlcontent.sql +++ b/SavingsProgress/sqlcontent.sql @@ -24,7 +24,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-12 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance12ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -38,7 +38,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-11 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance11ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -52,7 +52,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-10 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance10ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -66,7 +66,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-9 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance9ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -80,7 +80,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-8 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance8ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -94,7 +94,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-7 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance7ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -108,7 +108,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-6 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance6ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -122,7 +122,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-5 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance5ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -136,7 +136,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-4 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance4ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) from @@ -149,7 +149,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-3 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance3ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -163,7 +163,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-2 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance2ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -177,7 +177,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-1 month') ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as Balance1ago, (select a.INITIALBAL + total(t.TRANSAMOUNT) @@ -190,7 +190,7 @@ select a.ACCOUNTNAME, from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer' ) as t - where t.ACCOUNTID = a.ACCOUNTID and t.STATUS <> 'V' + where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('D', 'V') ) * (select BASECONVRATE from CURRENCYFORMATS_V1 where CURRENCYID = a.CURRENCYID) as BalanceNow From 2721940d0f9f7bd14cbe6050f172b320ad7d479e Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 14 Mar 2019 16:22:30 +0400 Subject: [PATCH 02/49] General updates Changed so account name come from SQL and no editing of htt is needed. --- AccountForecast/description.txt | 3 +-- AccountForecast/luacontent.lua | 3 +++ AccountForecast/sqlcontent.sql | 14 +++++++------- AccountForecast/template.htt | 6 +++--- AccountTrend/description.txt | 5 ++--- AccountTrend/luacontent.lua | 12 ++++++++++-- AccountTrend/sqlcontent.sql | 8 ++++---- AccountTrend/template.htt | 8 ++++---- 8 files changed, 34 insertions(+), 25 deletions(-) diff --git a/AccountForecast/description.txt b/AccountForecast/description.txt index 24b4618..215bc1d 100644 --- a/AccountForecast/description.txt +++ b/AccountForecast/description.txt @@ -3,5 +3,4 @@ Account Forecast Report using Repeating Transactions Note: Requires at least one entry for account name in repeating transactions. TODO: -1. Update account name in SQL (line 24). -2. Update account name in Template (line 12). +1. Update account name in SQL (line 24). diff --git a/AccountForecast/luacontent.lua b/AccountForecast/luacontent.lua index 58f296c..7987bc3 100644 --- a/AccountForecast/luacontent.lua +++ b/AccountForecast/luacontent.lua @@ -6,6 +6,7 @@ local period = 6; local initialized = 0; local repeatcode = 0; local numrepeats = 0; +local accountname = ''; function is_leap_year(year) local ly = 0; @@ -143,6 +144,7 @@ function handle_record(record) total = record:get("Balance"); prefix = record:get("PFX_SYMBOL"); suffix = record:get("SFX_SYMBOL"); + accountname = record:get("ACCOUNTNAME"); for i=1,period do forecast[i] = total; end @@ -199,4 +201,5 @@ function complete(result) result:set("Month" .. i .. "_Label", string.format("(%d-%02d-%02d)",date.year,date.month,date.day)); end result:set('CHART_DATA', string.sub(data,1,-2) .. "]}]"); + result:set('ACCOUNTNAME', accountname); end diff --git a/AccountForecast/sqlcontent.sql b/AccountForecast/sqlcontent.sql index 401e5de..f42f9b9 100644 --- a/AccountForecast/sqlcontent.sql +++ b/AccountForecast/sqlcontent.sql @@ -1,4 +1,4 @@ --- TODO: Update account name in line 24. +-- TODO: Update account name in line 24. select b.TRANSAMOUNT, b.REPEATS, b.NUMOCCURRENCES, b.NEXTOCCURRENCEDATE, c.PFX_SYMBOL, c.SFX_SYMBOL, (select a.INITIALBAL + total(t.TRANSAMOUNT) from @@ -6,12 +6,12 @@ select b.TRANSAMOUNT, b.REPEATS, b.NUMOCCURRENCES, b.NEXTOCCURRENCEDATE, c.PFX_S (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from CHECKINGACCOUNT_V1 union all - select TOACCOUNTID, STATUS, TOTRANSAMOUNT + select TOACCOUNTID, STATUS, TOTRANSAMOUNT from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer') as t where t.ACCOUNTID = a.ACCOUNTID - and t.STATUS NOT IN ('V','D')) as Balance -from + and t.STATUS NOT IN ('V','D')) as Balance, a.ACCOUNTNAME as ACCOUNTNAME +from (select ACCOUNTID, STATUS, REPEATS, NUMOCCURRENCES, NEXTOCCURRENCEDATE, (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from BILLSDEPOSITS_V1 @@ -19,7 +19,7 @@ from select TOACCOUNTID, STATUS, REPEATS, NUMOCCURRENCES, NEXTOCCURRENCEDATE, TOTRANSAMOUNT from BILLSDEPOSITS_V1 where TRANSCODE = 'Transfer') as b -inner join ACCOUNTLIST_V1 as a on b.ACCOUNTID = a.ACCOUNTID +inner join ACCOUNTLIST_V1 as a on b.ACCOUNTID = a.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID -where a.ACCOUNTNAME = 'Account1' -and b.STATUS NOT IN ('V','D'); +where a.ACCOUNTNAME = 'AccountName' +and b.STATUS NOT IN ('V','D'); \ No newline at end of file diff --git a/AccountForecast/template.htt b/AccountForecast/template.htt index d70adeb..773a2db 100644 --- a/AccountForecast/template.htt +++ b/AccountForecast/template.htt @@ -9,8 +9,8 @@
-

Account Forecast Report (Account1)

-

+

Account Forecast Report ()

+

Report Date:

@@ -68,11 +68,11 @@
+ - diff --git a/AccountTrend/description.txt b/AccountTrend/description.txt index 8e1a786..954c15e 100644 --- a/AccountTrend/description.txt +++ b/AccountTrend/description.txt @@ -1,5 +1,4 @@ Account Trend with Forecast Report using Linear Regression -TODO: -1. Update account name in SQL (line 31). -2. Update account name in Template (line 12). +TODO: +1. Update account name in SQL (line 31). \ No newline at end of file diff --git a/AccountTrend/luacontent.lua b/AccountTrend/luacontent.lua index ecb4863..0b601d4 100644 --- a/AccountTrend/luacontent.lua +++ b/AccountTrend/luacontent.lua @@ -27,10 +27,17 @@ local product_sum = 0; local squared_sum = 0; local zero_count = 0; local last_value = 0; +local initialized =0 ; +local accountname = ''; function handle_record(record) - prefix = record:get("PFX_SYMBOL"); - suffix = record:get("SFX_SYMBOL"); + if initialized == 0 then + prefix = record:get("PFX_SYMBOL"); + suffix = record:get("SFX_SYMBOL"); + accountname = record:get("ACCOUNTNAME"); + initialized = 1; + end + if count ~= 0 then local prev_y = year; local prev_m = month + 1; @@ -106,4 +113,5 @@ function complete(result) result:set('FVALUE' .. i, prefix .. fval .. suffix); end result:set('CHART_DATA', string.sub(labels,1,-2) .. "]," .. string.sub(data,1,-2) .. "]}]"); + result:set('ACCOUNTNAME', accountname); end diff --git a/AccountTrend/sqlcontent.sql b/AccountTrend/sqlcontent.sql index a39b35f..8344154 100644 --- a/AccountTrend/sqlcontent.sql +++ b/AccountTrend/sqlcontent.sql @@ -9,7 +9,7 @@ select strftime('%Y', t1.TRANSDATE) as YEAR (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from CHECKINGACCOUNT_V1 union all - select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT + select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer') as t2 where t2.ACCOUNTID = t1.ACCOUNTID @@ -17,18 +17,18 @@ select strftime('%Y', t1.TRANSDATE) as YEAR and (strftime('%Y', t2.TRANSDATE) < strftime('%Y', t1.TRANSDATE) or (strftime('%Y', t2.TRANSDATE) = strftime('%Y', t1.TRANSDATE) and strftime('%m', t2.TRANSDATE) < strftime('%m', t1.TRANSDATE))) - ) as Balance + ) as Balance, a.ACCOUNTNAME as ACCOUNTNAME from (select ACCOUNTID, TRANSDATE, STATUS, (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from CHECKINGACCOUNT_V1 union all - select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT + select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT from CHECKINGACCOUNT_V1 where TRANSCODE = 'Transfer') as t1 inner join ACCOUNTLIST_V1 as a on a.ACCOUNTID = t1.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID -where ACCOUNTNAME = 'Account1' +where ACCOUNTNAME = 'HSBC Advanced' and t1.STATUS NOT IN ('D', 'V') group by YEAR, MONTH order by YEAR asc, MONTH asc; diff --git a/AccountTrend/template.htt b/AccountTrend/template.htt index d611cac..d1085ef 100644 --- a/AccountTrend/template.htt +++ b/AccountTrend/template.htt @@ -9,7 +9,7 @@
-

Account Trend Report (Account1)

+

Account Trend Report ()

@@ -82,7 +82,7 @@ - +
@@ -93,12 +93,12 @@
-
+ + - From 611dc3935ad5bd0d16b3eab0a8dc07053650c331 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 21 Mar 2019 17:26:08 +0400 Subject: [PATCH 03/49] Formating currency figures. Using SQL values from currency table to format correctly currency values on the reports using javascript. --- AccountForecast/luacontent.lua | 17 +++++++++++++---- AccountForecast/sqlcontent.sql | 8 ++++---- AccountForecast/template.htt | 21 ++++++++++++++------- AccountSummary/luacontent.lua | 8 ++++---- AccountSummary/sqlcontent.sql | 2 +- AccountSummary/template.htt | 18 ++++++++++-------- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/AccountForecast/luacontent.lua b/AccountForecast/luacontent.lua index 7987bc3..086ce9b 100644 --- a/AccountForecast/luacontent.lua +++ b/AccountForecast/luacontent.lua @@ -1,7 +1,9 @@ local total = 0; local prefix = ''; local suffix = ''; -local forecast = {0,0,0,0,0,0} +local dpchar = ''; +local grpsepchar = ''; +local forecast = {0,0,0,0,0,0}; local period = 6; local initialized = 0; local repeatcode = 0; @@ -53,7 +55,7 @@ end function get_next_date(record, previousYear, previousMonth, previousDay) local originalnumber = tonumber(record:get("NUMOCCURRENCES")); - -- Auto Execute User Acknowlegement required + -- Auto Execute User Acknowledgment required if repeatcode >= 100 then repeatcode = repeatcode - 100; end @@ -144,6 +146,8 @@ function handle_record(record) total = record:get("Balance"); prefix = record:get("PFX_SYMBOL"); suffix = record:get("SFX_SYMBOL"); + dpchar = record:get("DECIMAL_POINT"); + grpsepchar = record:get("GROUP_SEPARATOR"); accountname = record:get("ACCOUNTNAME"); for i=1,period do forecast[i] = total; @@ -188,7 +192,7 @@ function complete(result) else data = data .. value .. ','; end - result:set("Current_Total", prefix .. value .. suffix); + result:set("Current_Total", value); for i=1,period do value = string.format("%.2f", forecast[i]); if tonumber(string.sub(value,-1)) == 0 and tonumber(string.sub(value,-2)) ~= 0 then @@ -196,10 +200,15 @@ function complete(result) else data = data .. value .. ','; end - result:set("Month" .. i .. "_Total", prefix .. value .. suffix); + result:set("Month" .. i .. "_Total", value); local date = os.date("*t", os.time{year=curYear,month=curMonth+i,day=curDay}); result:set("Month" .. i .. "_Label", string.format("(%d-%02d-%02d)",date.year,date.month,date.day)); end result:set('CHART_DATA', string.sub(data,1,-2) .. "]}]"); + -- override the base currency as the account may be in different currency + result:set('PFX_SYMBOL', prefix); + result:set('SFX_SYMBOL', suffix); + result:set('DECIMAL_POINT', dpchar); + result:set('GROUP_SEPARATOR', grpsepchar); result:set('ACCOUNTNAME', accountname); end diff --git a/AccountForecast/sqlcontent.sql b/AccountForecast/sqlcontent.sql index f42f9b9..33024b3 100644 --- a/AccountForecast/sqlcontent.sql +++ b/AccountForecast/sqlcontent.sql @@ -1,5 +1,5 @@ --- TODO: Update account name in line 24. -select b.TRANSAMOUNT, b.REPEATS, b.NUMOCCURRENCES, b.NEXTOCCURRENCEDATE, c.PFX_SYMBOL, c.SFX_SYMBOL, +-- TODO: Update account name in line 24. +select b.TRANSAMOUNT, b.REPEATS, b.NUMOCCURRENCES, b.NEXTOCCURRENCEDATE, c.PFX_SYMBOL, c.SFX_SYMBOL, c.DECIMAL_POINT, c.GROUP_SEPARATOR, (select a.INITIALBAL + total(t.TRANSAMOUNT) from (select ACCOUNTID, STATUS, @@ -11,7 +11,7 @@ select b.TRANSAMOUNT, b.REPEATS, b.NUMOCCURRENCES, b.NEXTOCCURRENCEDATE, c.PFX_S where TRANSCODE = 'Transfer') as t where t.ACCOUNTID = a.ACCOUNTID and t.STATUS NOT IN ('V','D')) as Balance, a.ACCOUNTNAME as ACCOUNTNAME -from +from (select ACCOUNTID, STATUS, REPEATS, NUMOCCURRENCES, NEXTOCCURRENCEDATE, (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT from BILLSDEPOSITS_V1 @@ -21,5 +21,5 @@ from where TRANSCODE = 'Transfer') as b inner join ACCOUNTLIST_V1 as a on b.ACCOUNTID = a.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID -where a.ACCOUNTNAME = 'AccountName' +where a.ACCOUNTNAME = 'Account1' and b.STATUS NOT IN ('V','D'); \ No newline at end of file diff --git a/AccountForecast/template.htt b/AccountForecast/template.htt index 773a2db..768a799 100644 --- a/AccountForecast/template.htt +++ b/AccountForecast/template.htt @@ -27,33 +27,33 @@ Current - + 1 month - + 2 months - + 3 months - + 4 months - + 5 months - + 6 months - + @@ -70,6 +70,13 @@ From f0843f850e0cf7cf4fa66250c883bdafdb32a603 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 21 Mar 2019 17:30:01 +0400 Subject: [PATCH 04/49] New Report Income vs. Expense Transactions By Year --- .../description.txt | 6 ++ .../luacontent.lua | 37 ++++++++ .../sqlcontent.sql | 9 ++ .../template.htt | 85 +++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 Income vs Expenses Transactions By Year/description.txt create mode 100644 Income vs Expenses Transactions By Year/luacontent.lua create mode 100644 Income vs Expenses Transactions By Year/sqlcontent.sql create mode 100644 Income vs Expenses Transactions By Year/template.htt diff --git a/Income vs Expenses Transactions By Year/description.txt b/Income vs Expenses Transactions By Year/description.txt new file mode 100644 index 0000000..1275f1e --- /dev/null +++ b/Income vs Expenses Transactions By Year/description.txt @@ -0,0 +1,6 @@ +

Income vs. Expenses Report by Year

+

This report adds up all the deposit and withdrawal transactions and provides totals per Year.

+

The report is shown in the base currency and any transactions not in the base currency are converted using the currency of the account and the base conversion rate for the currencyt to base currency.

+It ignores any transactions that are marked Void (V) or Duplicate (D) and also ignores Transfer type transactions. +
+

For MMEX v1.3.3. DB v7

\ No newline at end of file diff --git a/Income vs Expenses Transactions By Year/luacontent.lua b/Income vs Expenses Transactions By Year/luacontent.lua new file mode 100644 index 0000000..861ecb5 --- /dev/null +++ b/Income vs Expenses Transactions By Year/luacontent.lua @@ -0,0 +1,37 @@ +local gdata=''; +local gdataincome=''; +local gdataexpense=''; +local gdatadiff='' +local glabels=''; + +local titles = {'Income','Expenses','Difference'} -- don't change the order +local colors = {"#66FFB2","#FF6666","#66B2FF"}; -- alter colours if you desire + +function handle_record(record) + local diff = record:get('INCOME') - record:get('EXPENSE') + record:set('DIFFERENCE', diff) + -- Labels + if (glabels:len() > 0) then + glabels = glabels .. ','; + gdataincome = gdataincome .. ','; + gdataexpense = gdataexpense .. ','; + gdatadiff = gdatadiff .. ','; + end + glabels = glabels .. '"' .. tostring(record:get('YEAR')) .. '"'; + gdataincome = gdataincome .. tostring(record:get('INCOME')); + gdataexpense = gdataexpense .. tostring(record:get('EXPENSE')); + gdatadiff = gdatadiff .. tostring(diff); +end + +function complete(result) + local gformatting='{fillColor:"",strokeColor:"", data:[' + local gtitles='],title:"' + result:set('GLABELS', glabels); + + gdata = gformatting:gsub('',colors[1]) .. tostring(gdataincome) .. gtitles .. titles[1] .. '"}' + gdata = gdata .. ',' .. gformatting:gsub('',colors[2]) .. tostring(gdataexpense) .. gtitles .. titles[2] .. '"}' + gdata = gdata .. ',' .. gformatting:gsub('',colors[3]) .. tostring(gdatadiff) .. gtitles .. titles[3] .. '"}' + + result:set('CHART_DATA', gdata); + result:set('DEBUG_TXT', debugtxt); +end \ No newline at end of file diff --git a/Income vs Expenses Transactions By Year/sqlcontent.sql b/Income vs Expenses Transactions By Year/sqlcontent.sql new file mode 100644 index 0000000..f15375e --- /dev/null +++ b/Income vs Expenses Transactions By Year/sqlcontent.sql @@ -0,0 +1,9 @@ +SELECT strftime('%Y', TRANSDATE) AS YEAR, + SUM(CASE WHEN CA.TRANSCODE = 'Deposit' THEN (CA.TRANSAMOUNT * cf.BASECONVRATE) ELSE 0 END) AS INCOME, + SUM(CASE WHEN CA.TRANSCODE = 'Withdrawal' THEN (CA.TRANSAMOUNT * cf.BASECONVRATE) ELSE 0 END) AS EXPENSE +FROM CHECKINGACCOUNT_V1 AS ca +INNER JOIN ACCOUNTLIST_V1 AS acc ON acc.ACCOUNTID = ca.ACCOUNTID +INNER JOIN CURRENCYFORMATS_V1 AS CF ON cf.CURRENCYID = acc.CURRENCYID +WHERE CA.STATUS NOT IN ('D', 'V') AND CA.TRANSCODE <> 'Transfer' +GROUP BY strftime('%Y', TRANSDATE) +ORDER BY strftime('%Y', TRANSDATE) ASC \ No newline at end of file diff --git a/Income vs Expenses Transactions By Year/template.htt b/Income vs Expenses Transactions By Year/template.htt new file mode 100644 index 0000000..58bb68e --- /dev/null +++ b/Income vs Expenses Transactions By Year/template.htt @@ -0,0 +1,85 @@ + + + + + + <TMPL_VAR REPORTNAME> + + + + + +
+

Income vs. Expenses by Year

+

+ Report Date: + +

+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + + + + + + + + +
YearIncomeExpenseDifference
+ + + + + + + +
+
+
+ + + \ No newline at end of file From 235dab0bb2f917070efd83e731642313db5b0404 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 21 Mar 2019 18:15:21 +0400 Subject: [PATCH 05/49] Ignore .ds_store files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2b1076d..a1246d2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *.grm *.zip local_settings.py +.DS_Store From 8326c15aa701f11fca80d493713ff7a3527732f5 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Sun, 24 Mar 2019 12:50:14 +0400 Subject: [PATCH 06/49] Made report configurable for Calendar or Financial Year The report has two parameters in SQL, one to set to Calendar or Financial Year and the 2nd to set the years the report should show collated values for. --- .../description.txt | 29 +++++++-- .../luacontent.lua | 39 +++++++----- .../sqlcontent.sql | 59 ++++++++++++++++--- .../template.htt | 11 +++- 4 files changed, 108 insertions(+), 30 deletions(-) diff --git a/Income vs Expenses Transactions By Year/description.txt b/Income vs Expenses Transactions By Year/description.txt index 1275f1e..617765b 100644 --- a/Income vs Expenses Transactions By Year/description.txt +++ b/Income vs Expenses Transactions By Year/description.txt @@ -1,6 +1,25 @@ -

Income vs. Expenses Report by Year

-

This report adds up all the deposit and withdrawal transactions and provides totals per Year.

-

The report is shown in the base currency and any transactions not in the base currency are converted using the currency of the account and the base conversion rate for the currencyt to base currency.

-It ignores any transactions that are marked Void (V) or Duplicate (D) and also ignores Transfer type transactions. +

Income vs. Expenses Comparison by Year

+

This report totals all the Deposit and Withdrawal transactions and provides totals per Year.
+When imported, the report will show years 2015-2020 (where there at least one transaction in the year) and will collate results as per Calendar year.
+The report is shown in the base currency, converting all non-base currency values to base currency using the MMEX setting Convert to Base Rate value on the currency.

+

The report can be adjusted for the year(s) of interest and provide results for either Calendar year or Financial Year.

+

As defaulted on import:
+

    +
  • Display years 2015-2020, if you wish to change the years displayed, then change line 44 in the SQL.
  • +
  • Uses Calendar year (Jan-01 to Dec-31). Should you need the report to show Financial year, then change line 20 in the SQL.
  • +
    +
    "SELECT 'YEAR' AS yeartype,"
    +
    - This will set the results to Calendar year (Jan-01 to Dec-31)
    +
    "SELECT 'FIN_YEAR' AS yeartype,"
    +
    - This will set the results to Financial year. The exact dates of the financial year are read from the MMEX options settings
    +
    +
+

+
    +
  • ✅ Converts all transaction amounts into Base Currency, using the Transactions's Account and the Conversion to Base Rate value on the currency record.
  • +
  • ✅ Ignores transactions marked as Void (V) or Duplicate (D).
  • +
  • ✅ Ignores Transfer type transactions.
  • +
  • ✅ Uses the MMEX Options for the Financial year start month and day when yeartype set to "FIN_YEAR".
  • +

-

For MMEX v1.3.3. DB v7

\ No newline at end of file +

For MMEX v1.3.3. DB v7

\ No newline at end of file diff --git a/Income vs Expenses Transactions By Year/luacontent.lua b/Income vs Expenses Transactions By Year/luacontent.lua index 861ecb5..af49242 100644 --- a/Income vs Expenses Transactions By Year/luacontent.lua +++ b/Income vs Expenses Transactions By Year/luacontent.lua @@ -3,35 +3,44 @@ local gdataincome=''; local gdataexpense=''; local gdatadiff='' local glabels=''; +local yeartype='' +local initialized=0; local titles = {'Income','Expenses','Difference'} -- don't change the order local colors = {"#66FFB2","#FF6666","#66B2FF"}; -- alter colours if you desire function handle_record(record) - local diff = record:get('INCOME') - record:get('EXPENSE') + if (initialized==0) then + yeartype=record:get('YEARTYPE'); + initialized=1; + end + local diff=record:get('INCOME') - record:get('EXPENSE') record:set('DIFFERENCE', diff) -- Labels if (glabels:len() > 0) then - glabels = glabels .. ','; - gdataincome = gdataincome .. ','; - gdataexpense = gdataexpense .. ','; - gdatadiff = gdatadiff .. ','; + glabels=glabels .. ','; + gdataincome=gdataincome .. ','; + gdataexpense=gdataexpense .. ','; + gdatadiff=gdatadiff .. ','; end - glabels = glabels .. '"' .. tostring(record:get('YEAR')) .. '"'; - gdataincome = gdataincome .. tostring(record:get('INCOME')); - gdataexpense = gdataexpense .. tostring(record:get('EXPENSE')); - gdatadiff = gdatadiff .. tostring(diff); + glabels=glabels .. '"' .. tostring(record:get('YEAR')) .. '"'; + gdataincome=gdataincome .. tostring(record:get('INCOME')); + gdataexpense=gdataexpense .. tostring(record:get('EXPENSE')); + gdatadiff=gdatadiff .. tostring(diff); end function complete(result) local gformatting='{fillColor:"",strokeColor:"", data:[' local gtitles='],title:"' result:set('GLABELS', glabels); - - gdata = gformatting:gsub('',colors[1]) .. tostring(gdataincome) .. gtitles .. titles[1] .. '"}' - gdata = gdata .. ',' .. gformatting:gsub('',colors[2]) .. tostring(gdataexpense) .. gtitles .. titles[2] .. '"}' - gdata = gdata .. ',' .. gformatting:gsub('',colors[3]) .. tostring(gdatadiff) .. gtitles .. titles[3] .. '"}' - + gdata=gformatting:gsub('',colors[1]) .. tostring(gdataincome) .. gtitles .. titles[1] .. '"}' + gdata=gdata .. ',' .. gformatting:gsub('',colors[2]) .. tostring(gdataexpense) .. gtitles .. titles[2] .. '"}' + gdata=gdata .. ',' .. gformatting:gsub('',colors[3]) .. tostring(gdatadiff) .. gtitles .. titles[3] .. '"}' result:set('CHART_DATA', gdata); - result:set('DEBUG_TXT', debugtxt); + + if (yeartype=='FIN_YEAR') then + result:set('YEAR_TYPE', 'Finanical Year'); + else + result:set('YEAR_TYPE', 'Calendar Year'); + end end \ No newline at end of file diff --git a/Income vs Expenses Transactions By Year/sqlcontent.sql b/Income vs Expenses Transactions By Year/sqlcontent.sql index f15375e..2d9f477 100644 --- a/Income vs Expenses Transactions By Year/sqlcontent.sql +++ b/Income vs Expenses Transactions By Year/sqlcontent.sql @@ -1,9 +1,50 @@ -SELECT strftime('%Y', TRANSDATE) AS YEAR, - SUM(CASE WHEN CA.TRANSCODE = 'Deposit' THEN (CA.TRANSAMOUNT * cf.BASECONVRATE) ELSE 0 END) AS INCOME, - SUM(CASE WHEN CA.TRANSCODE = 'Withdrawal' THEN (CA.TRANSAMOUNT * cf.BASECONVRATE) ELSE 0 END) AS EXPENSE -FROM CHECKINGACCOUNT_V1 AS ca -INNER JOIN ACCOUNTLIST_V1 AS acc ON acc.ACCOUNTID = ca.ACCOUNTID -INNER JOIN CURRENCYFORMATS_V1 AS CF ON cf.CURRENCYID = acc.CURRENCYID -WHERE CA.STATUS NOT IN ('D', 'V') AND CA.TRANSCODE <> 'Transfer' -GROUP BY strftime('%Y', TRANSDATE) -ORDER BY strftime('%Y', TRANSDATE) ASC \ No newline at end of file +SELECT tx_yr_data.yeartype as YEARTYPE, + tx_yr_data.year as YEAR, + sum(tx_yr_data.income) AS INCOME, + sum(tx_yr_data.expense) AS EXPENSE + FROM ( + SELECT yeartype as yeartype, + CASE yeartype + WHEN 'FIN_YEAR' + THEN CASE WHEN ( (CAST (strftime('%m', transdate) AS INTEGER) < fin_yr_mth) OR + (CAST (strftime('%m', transdate) AS INTEGER) = fin_yr_mth AND + CAST (strftime('%d', transdate) AS INTEGER) < fin_yr_day) ) + THEN tx_data.year - 1 + ELSE tx_data.year + END + ELSE tx_data.year + END AS YEAR, + tx_data.income AS income, + tx_data.expense AS expense + FROM (/* change SELECT 'YEAR' to SELECT 'FINYEAR' if you want financial years based on settings for financial year start month & day from MMEX options, keep as SELECT 'YEAR' for normal years Jan-01 to Dec-31 */ + SELECT 'YEAR' AS yeartype, -- values are 'YEAR' or 'FIN_YEAR' + CA.transdate AS transdate, + CAST (strftime('%Y', transdate) AS INTEGER) AS year, + CASE WHEN ca.transcode = 'Deposit' THEN ROUND(CA.TRANSAMOUNT * cf.baseconvrate, 2) ELSE 0 END AS income, + CASE WHEN ca.transcode = 'Withdrawal' THEN ROUND(CA.TRANSAMOUNT * cf.baseconvrate, 2) ELSE 0 END AS expense, + CAST ( ( + SELECT it1.infovalue + FROM infotable_v1 AS it1 + WHERE IT1.infoname = 'FINANCIAL_YEAR_START_MONTH' + ) + AS INTERGER) AS fin_yr_mth, + CAST ( ( + SELECT it2.infovalue + FROM infotable_v1 AS it2 + WHERE IT2.infoname = 'FINANCIAL_YEAR_START_DAY' + ) + AS INTEGER) AS fin_yr_day + FROM checkingaccount_v1 AS ca + INNER JOIN + accountlist_v1 AS acc ON acc.accountid = ca.accountid + INNER JOIN + currencyformats_v1 AS CF ON cf.currencyid = acc.currencyid + WHERE ca.status NOT IN ('D', 'V') AND + ca.transcode <> 'Transfer' AND + strftime('%Y', transdate) IN ('2015', '2016', '2017', '2018', '2019', '2020') -- change the years to those you're interested in, note the yeartype flag above. + ) + AS tx_data + ) + tx_yr_data + GROUP BY tx_yr_data.year, tx_yr_data.yeartype + ORDER BY tx_yr_data.year ASC; diff --git a/Income vs Expenses Transactions By Year/template.htt b/Income vs Expenses Transactions By Year/template.htt index 58bb68e..9ec1897 100644 --- a/Income vs Expenses Transactions By Year/template.htt +++ b/Income vs Expenses Transactions By Year/template.htt @@ -10,7 +10,7 @@
-

Income vs. Expenses by Year

+

()

Report Date: @@ -22,6 +22,7 @@ +

All values in base currency .

@@ -53,6 +54,14 @@ + + + + + + + +

Error

- + + function formatNumberWithSeparators(n, grpchar) {return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, grpchar);} + function changeDecimalPoint(s, dpchar) {var dppos = s.lastIndexOf("."); return (dppos > 0 ? s.slice(0,dppos) + dpchar + s.substr(dppos+1) : s)} + function currency(n, grpsep, dpt) {n=parseFloat(n); return isNaN(n) ? 0 : formatNumberWithSeparators(changeDecimalPoint(n.toFixed(2), dpt),grpsep);} + + var elements=document.getElementsByClassName("money"); + if (elements) {for (var i=0; i < elements.length; i++) {elements[i].innerHTML =((elements[i].hasAttribute("data-prefix") ? elements[i].getAttribute("data-prefix") : "") + " " + currency(elements[i].innerHTML, (elements[i].hasAttribute("data-grpsep") ? elements[i].getAttribute("data-grpsep") : ""),(elements[i].hasAttribute("data-decpt") ? elements[i].getAttribute("data-decpt") : "")) + " " + (elements[i].hasAttribute("data-suffix") ? elements[i].getAttribute("data-suffix") : "")).trim();}} + + elements=document.getElementsByClassName("account"); + if (elements) {document.write("account"); for (i=0; i < elements.length; i++) {currency(elements[i].innerHTML, (elements[i].hasAttribute("data-grpsep") ? elements[i].getAttribute("data-grpsep") : ""),(elements[i].hasAttribute("data-decpt") ? elements[i].getAttribute("data-decpt") : "")).trim();}} + + \ No newline at end of file From 71e67ae1a39491868ab8bc3e149712a5fd395da7 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Mon, 25 Mar 2019 15:22:30 +0400 Subject: [PATCH 08/49] HTML5 & .STATUS to ignore Void & Duplicate Transactions --- AttachmentList/template.htt | 4 ++-- CreditReport/sqlcontent.sql | 2 +- CreditReport2/sqlcontent.sql | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AttachmentList/template.htt b/AttachmentList/template.htt index cd2c783..c162230 100644 --- a/AttachmentList/template.htt +++ b/AttachmentList/template.htt @@ -1,5 +1,5 @@ - + <TMPL_VAR REPORTNAME> @@ -8,7 +8,7 @@

-
+Report Date:
diff --git a/CreditReport/sqlcontent.sql b/CreditReport/sqlcontent.sql index 12a77d8..8a94e2a 100644 --- a/CreditReport/sqlcontent.sql +++ b/CreditReport/sqlcontent.sql @@ -14,6 +14,6 @@ from inner join ACCOUNTLIST_V1 as a on a.ACCOUNTID=t.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on a.CURRENCYID=c.CURRENCYID where ACCOUNTNAME in ('Account1', 'Account2') - and t.STATUS<>'V' + and t.STATUS NOT IN ('V','D') group by a.ACCOUNTID order by ACCOUNTNAME; \ No newline at end of file diff --git a/CreditReport2/sqlcontent.sql b/CreditReport2/sqlcontent.sql index 02d2d97..3484a26 100644 --- a/CreditReport2/sqlcontent.sql +++ b/CreditReport2/sqlcontent.sql @@ -20,7 +20,7 @@ FROM INNER JOIN ACCOUNTLIST_V1 on ACCOUNTLIST_V1.ACCOUNTID = transactions.ACCOUNTID INNER JOIN CURRENCYFORMATS_V1 as c on ACCOUNTLIST_V1.CURRENCYID=c.CURRENCYID WHERE - transactions.STATUS<>'V' + transactions.STATUS NOT IN ('V','D') AND ACCOUNTLIST_V1.ACCOUNTTYPE = "Credit Card" AND ACCOUNTLIST_V1.STATUS <> "Closed" GROUP BY ACCOUNTLIST_V1.ACCOUNTID From 3743eef6f91329ce1f68819c03cbcabc582d4cf5 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Tue, 26 Mar 2019 15:45:39 +0400 Subject: [PATCH 09/49] Use account's currency & display on page Display the currency the report is in (using the account's currency setting) and format the amounts as numbers correctly with the dec & group characters. --- AccountForecast/description.txt | 4 +- AccountForecast/luacontent.lua | 2 +- AccountForecast/template.htt | 67 ++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/AccountForecast/description.txt b/AccountForecast/description.txt index 215bc1d..9f9673f 100644 --- a/AccountForecast/description.txt +++ b/AccountForecast/description.txt @@ -1,6 +1,8 @@ Account Forecast Report using Repeating Transactions +Figures are displayed in the currency of the account selected. + Note: Requires at least one entry for account name in repeating transactions. -TODO: +Setup: 1. Update account name in SQL (line 24). diff --git a/AccountForecast/luacontent.lua b/AccountForecast/luacontent.lua index ee3f923..f6a9696 100644 --- a/AccountForecast/luacontent.lua +++ b/AccountForecast/luacontent.lua @@ -205,7 +205,7 @@ function complete(result) result:set("Month" .. i .. "_Label", string.format("(%d-%02d-%02d)",date.year,date.month,date.day)); end result:set('CHART_DATA', string.sub(data,1,-2) .. "]}]"); - -- Override the base currency as the account may be in different currency + -- Override the base currency variables as the account may be in different currency result:set('PFX_SYMBOL', prefix); result:set('SFX_SYMBOL', suffix); result:set('DECIMAL_POINT', dpchar); diff --git a/AccountForecast/template.htt b/AccountForecast/template.htt index 3545fd8..1ccde44 100644 --- a/AccountForecast/template.htt +++ b/AccountForecast/template.htt @@ -15,44 +15,44 @@
- +
 

All figures in Account's currency:

- + - + - + - + - + - + - + - +
DateValueAmount ()
Current
1 month
2 months
3 months
4 months
5 months
6 months
@@ -67,18 +67,51 @@
- + + From bad79a59604d3cc23cc7be9137ee8908a9bc0755 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Tue, 26 Mar 2019 16:12:38 +0400 Subject: [PATCH 10/49] Currency conversion and currency formatting. Pickup the latets currency conversion from the CURRENCYHISTORY_V1 table. If there are no value, then use CURRENCYFORMATS_V1.BASECONVRATE. --- AccountSummary/description.txt | 5 ++- AccountSummary/luacontent.lua | 6 ++-- AccountSummary/sqlcontent.sql | 57 +++++++++++++++++++++--------- AccountSummary/template.htt | 63 +++++++++++++++++++++++++--------- 4 files changed, 93 insertions(+), 38 deletions(-) diff --git a/AccountSummary/description.txt b/AccountSummary/description.txt index cdbee5e..3fcb0d7 100644 --- a/AccountSummary/description.txt +++ b/AccountSummary/description.txt @@ -1 +1,4 @@ -Checking and Term Account Summary Report \ No newline at end of file +Checking and Term Account Summary Report + +Setup: +1. Edit SQL line 36 for the account types required \ No newline at end of file diff --git a/AccountSummary/luacontent.lua b/AccountSummary/luacontent.lua index 54f5d23..61f2156 100644 --- a/AccountSummary/luacontent.lua +++ b/AccountSummary/luacontent.lua @@ -4,10 +4,8 @@ local count = 0; local colors = {"#FF6666", "#FFB266", "#FFFF66", "#B2FF66", "#66FF66", "#66FFB2", "#66FFFF", "#66B2FF", "#6666FF", "#B266FF", "#FF66FF", "#FF66B2"}; function handle_record(record) - --local bal = string.format("%.2f", record:get('Balance')); -- Not needed a 'money' format in htt - local base = record:get('Balance') * record:get("BASECONVRATE"); - --record:set("Balance", record:get('PFX_SYMBOL') .. bal .. record:get('SFX_SYMBOL')); -- Not needed a 'money' format in htt - record:set("Base", base); + local base = record:get('BALANCE') * record:get("CURRVALUE"); + record:set("BASE", base); total = total + base; local color = colors[1 + (count % #colors)]; data = data .. '{value:' .. string.format("%.2f", base) .. ',color:"' .. color .. '"},'; diff --git a/AccountSummary/sqlcontent.sql b/AccountSummary/sqlcontent.sql index e7856e3..2b1954d 100644 --- a/AccountSummary/sqlcontent.sql +++ b/AccountSummary/sqlcontent.sql @@ -1,17 +1,40 @@ -select a.ACCOUNTNAME, c.BASECONVRATE, c.PFX_SYMBOL, c.SFX_SYMBOL, c.DECIMAL_POINT, c.GROUP_SEPARATOR, - (select a.INITIALBAL + total(t.TRANSAMOUNT) - from - (select ACCOUNTID, STATUS, - (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT - from CHECKINGACCOUNT_V1 - union all - select TOACCOUNTID, STATUS, TOTRANSAMOUNT - from CHECKINGACCOUNT_V1 - where TRANSCODE = 'Transfer') as t - where t.ACCOUNTID = a.ACCOUNTID - and t.STATUS NOT IN ('D', 'V')) as Balance -from ACCOUNTLIST_V1 as a -inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID -where a.ACCOUNTTYPE in ('Checking', 'Term') and a.STATUS = 'Open' -group by a.ACCOUNTNAME -order by a.ACCOUNTNAME asc; +/* Setup: edit line 36 for the account types required */ +SELECT a.ACCOUNTNAME, + IFNULL(CH.CURRVALUE, c.BASECONVRATE) AS CURRVALUE, -- Remove this for v13 DB + c.PFX_SYMBOL, + c.SFX_SYMBOL, + c.DECIMAL_POINT, + c.GROUP_SEPARATOR, + ( + SELECT a.INITIALBAL + total(t.TRANSAMOUNT) + FROM ( + SELECT ACCOUNTID, + STATUS, + (CASE WHEN TRANSCODE = 'Deposit' THEN TRANSAMOUNT ELSE -TRANSAMOUNT END) AS TRANSAMOUNT + FROM CHECKINGACCOUNT_V1 + UNION ALL + SELECT TOACCOUNTID, + STATUS, + TOTRANSAMOUNT + FROM CHECKINGACCOUNT_V1 + WHERE TRANSCODE = 'Transfer' + ) + AS t + WHERE t.ACCOUNTID = a.ACCOUNTID AND + t.STATUS NOT IN ('D', 'V') + ) + AS BALANCE + FROM ACCOUNTLIST_V1 AS a + INNER JOIN + CURRENCYFORMATS_V1 AS c ON c.CURRENCYID = a.CURRENCYID + LEFT JOIN + CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = c.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = c.CURRENCYID + ) + WHERE a.ACCOUNTTYPE IN ('Checking', 'Term') AND + a.STATUS = 'Open' + GROUP BY a.ACCOUNTNAME + ORDER BY a.ACCOUNTNAME ASC; diff --git a/AccountSummary/template.htt b/AccountSummary/template.htt index 8120a28..9f6358c 100644 --- a/AccountSummary/template.htt +++ b/AccountSummary/template.htt @@ -11,7 +11,8 @@

Report Date:

-
+
+

All chart figures in base currency:

@@ -27,8 +28,8 @@ - - " class="money text-right"> + + " class="money text-right"> @@ -44,21 +45,51 @@
    - -
  • Error
  • -
    + +
  • Error
  • +
+ \ No newline at end of file From 265a98de3211d8557d8aa9b9b097ffb3508e4a97 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Tue, 26 Mar 2019 16:22:46 +0400 Subject: [PATCH 11/49] Support for accounts in non-base currency Display values in the account's currency formats. --- AccountTrend/luacontent.lua | 9 +++++ AccountTrend/sqlcontent.sql | 2 +- AccountTrend/template.htt | 76 +++++++++++++++++++++++++------------ 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/AccountTrend/luacontent.lua b/AccountTrend/luacontent.lua index 2feffa5..49ba810 100644 --- a/AccountTrend/luacontent.lua +++ b/AccountTrend/luacontent.lua @@ -3,6 +3,8 @@ local labels = 'labels : ['; local data = ''; local prefix = ''; local suffix = ''; +local dpchar = ''; +local grpsepchar = ''; local json = [[ datasets : [{ fillColor : "rgba(255,255,255,0)", @@ -34,6 +36,8 @@ function handle_record(record) if initialized == 0 then prefix = record:get("PFX_SYMBOL"); suffix = record:get("SFX_SYMBOL"); + dpchar = record:get("DECIMAL_POINT"); + grpsepchar = record:get("GROUP_SEPARATOR"); accountname = record:get("ACCOUNTNAME"); initialized = 1; end @@ -114,4 +118,9 @@ function complete(result) end result:set('CHART_DATA', string.sub(labels,1,-2) .. "]," .. string.sub(data,1,-2) .. "]}]"); result:set('ACCOUNTNAME', accountname); + -- Override the base currency variables as the account may be in different currency + result:set('PFX_SYMBOL', prefix); + result:set('SFX_SYMBOL', suffix); + result:set('DECIMAL_POINT', dpchar); + result:set('GROUP_SEPARATOR', grpsepchar); end diff --git a/AccountTrend/sqlcontent.sql b/AccountTrend/sqlcontent.sql index 9c61a95..1f1bffb 100644 --- a/AccountTrend/sqlcontent.sql +++ b/AccountTrend/sqlcontent.sql @@ -28,7 +28,7 @@ from where TRANSCODE = 'Transfer') as t1 inner join ACCOUNTLIST_V1 as a on a.ACCOUNTID = t1.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID -where ACCOUNTNAME = 'Lloyds' +where ACCOUNTNAME = 'Account1' and t1.STATUS NOT IN ('D', 'V') group by YEAR, MONTH order by YEAR asc, MONTH asc; diff --git a/AccountTrend/template.htt b/AccountTrend/template.htt index 8708af0..7cdb1ee 100644 --- a/AccountTrend/template.htt +++ b/AccountTrend/template.htt @@ -15,70 +15,70 @@
- +
 

All figures in Account's currency:

- + - + - + - + - + - + - + - + - + - + - + - + - + - +
DateBalanceBalance
@@ -100,14 +100,42 @@ var ctx = document.getElementById("reportChart").getContext("2d"); var reportChart = new Chart(ctx).Line(data,opt); - function formatNumberWithSeparators(n, grpchar) {return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, grpchar);} - function changeDecimalPoint(s, dpchar) {var dppos = s.lastIndexOf("."); return (dppos > 0 ? s.slice(0,dppos) + dpchar + s.substr(dppos+1) : s)} - function currency(n, grpsep, dpt) {n=parseFloat(n); return isNaN(n) ? 0 : formatNumberWithSeparators(changeDecimalPoint(n.toFixed(2), dpt),grpsep);} - - var elements=document.getElementsByClassName("money"); - if (elements) {for (var i=0; i < elements.length; i++) {elements[i].innerHTML =((elements[i].hasAttribute("data-prefix") ? elements[i].getAttribute("data-prefix") : "") + " " + currency(elements[i].innerHTML, (elements[i].hasAttribute("data-grpsep") ? elements[i].getAttribute("data-grpsep") : ""),(elements[i].hasAttribute("data-decpt") ? elements[i].getAttribute("data-decpt") : "")) + " " + (elements[i].hasAttribute("data-suffix") ? elements[i].getAttribute("data-suffix") : "")).trim();}} - - elements=document.getElementsByClassName("account"); - if (elements) {document.write("account"); for (i=0; i < elements.length; i++) {currency(elements[i].innerHTML, (elements[i].hasAttribute("data-grpsep") ? elements[i].getAttribute("data-grpsep") : ""),(elements[i].hasAttribute("data-decpt") ? elements[i].getAttribute("data-decpt") : "")).trim();}} + function formatNumberWithSeparators(sn, grpchar) { + if (grpchar != "") { + return sn.toString().replace(/\B(?=(\d{3})+(?!\d))/g, grpchar); + } + else { + return sn; + } + } + + function changeDecimalPoint(sn, dpchar) { + var dppos = sn.lastIndexOf("."); + if (dpchar != "") { + return (dppos > 0 ? sn.slice(0, dppos) + dpchar + sn.substr(dppos + 1) : sn); + } + else { + return sn; + } + } + + function currency(sn, grpsep, dpt) { + var fn = parseFloat(sn); + return isNaN(fn) ? sn : formatNumberWithSeparators(changeDecimalPoint(fn.toFixed(2), dpt), grpsep); + } + var NegValue = 0; + var elements = document.getElementsByClassName("money"); //Currency format e.g. $1,234.00 and -$1,234.00 [red colour] + if (elements) { + for (var i = 0; i < elements.length; i++) { + NegValue = (elements[i].innerHTML.indexOf("-") > -1) ? 1 : 0; + elements[i].innerHTML = ((elements[i].hasAttribute("data-prefix") ? elements[i].getAttribute("data-prefix") : "") + " " + currency((elements[i].innerHTML).replace("-",""), (elements[i].hasAttribute("data-grpsep") ? elements[i].getAttribute("data-grpsep") : ""), (elements[i].hasAttribute("data-decpt") ? elements[i].getAttribute("data-decpt") : "")) + " " + (elements[i].hasAttribute("data-suffix") ? elements[i].getAttribute("data-suffix") : "")).trim(); + if (NegValue) { + elements[i].style.color = "#ff0000"; + elements[i].innerHTML = "-" + elements[i].innerHTML + } + elements[i].style.textAlign = 'right'; + } + } + \ No newline at end of file From a78160ab28d54edd0cb7c8b4a230045f16cfc0c4 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Tue, 26 Mar 2019 16:27:55 +0400 Subject: [PATCH 12/49] Currency conversion and currency formatting. Pickup the latets currency conversion from the CURRENCYHISTORY_V1 table. If there are no value, then use CURRENCYFORMATS_V1.BASECONVRATE. --- BlankNotes/sqlcontent.sql | 41 ++++-- BlankNotes/template.htt | 296 ++++++++++++++++++++++---------------- 2 files changed, 203 insertions(+), 134 deletions(-) diff --git a/BlankNotes/sqlcontent.sql b/BlankNotes/sqlcontent.sql index 8ccd105..960b454 100644 --- a/BlankNotes/sqlcontent.sql +++ b/BlankNotes/sqlcontent.sql @@ -1,11 +1,30 @@ -select - t.TRANSID - ,TRANSDATE,ACCOUNTNAME,PAYEENAME - ,t.NOTES - , case t.TRANSCODE when 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end TRANSAMOUNT - ,m.PFX_SYMBOL, m.SFX_SYMBOL, m.GROUP_SEPARATOR, m.DECIMAL_POINT -from CHECKINGACCOUNT_V1 as t - join PAYEE_V1 as p on p.PAYEEID=t.PAYEEID - join ACCOUNTLIST_V1 as a on a.ACCOUNTID=t.ACCOUNTID - join CURRENCYFORMATS_V1 as m on m.CURRENCYID=a.CURRENCYID -where t.NOTES=""; \ No newline at end of file +SELECT IFNULL(CH.CURRVALUE, m.BASECONVRATE) AS CURRRATE, + t.TRANSID, + t.TRANSDATE, + a.ACCOUNTNAME, + p.PAYEENAME, + t.NOTES, + ((CASE t.TRANSCODE WHEN 'Deposit' THEN t.TRANSAMOUNT ELSE -t.TRANSAMOUNT END) * (IFNULL(CH.CURRVALUE, m.BASECONVRATE))) AS TRANSAMOUNT, + m.PFX_SYMBOL, + m.SFX_SYMBOL, + m.GROUP_SEPARATOR, + m.DECIMAL_POINT + FROM CHECKINGACCOUNT_V1 AS t + JOIN + PAYEE_V1 AS p ON p.PAYEEID = t.PAYEEID + JOIN + ACCOUNTLIST_V1 AS a ON a.ACCOUNTID = t.ACCOUNTID + JOIN + CURRENCYFORMATS_V1 AS m ON m.CURRENCYID = a.CURRENCYID + LEFT JOIN + CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = m.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = m.CURRENCYID + ) + WHERE t.NOTES; +/* For v13 DB +- remove the _V1 from the tablenames +- remove the m.BASECONVRATE and ISNULL checks on CH.CURRVALUE +*/ \ No newline at end of file diff --git a/BlankNotes/template.htt b/BlankNotes/template.htt index aa46cd5..5202d73 100644 --- a/BlankNotes/template.htt +++ b/BlankNotes/template.htt @@ -1,129 +1,179 @@ - - - <TMPL_VAR REPORTNAME> - - - - - -
-

_Title_

-

-
-
- - - - - - - - - - - - - - - - - -
IDDateAccountPayeeAmount
- - - -
-
-
-
- -
    - -
  • Error
  • -
    -
+ + + + <TMPL_VAR REPORTNAME> + + + + + + +
+

_Title_

+

+ +

+
+
+ + + + + + + + + + + + + + + + + +
IDDateAccountPayeeAmount
+ + + + + + + + + + + + + + + +
+
+
+
+
    + +
  • + Error + +
  • +
    +
+ - - - - + elements = document.getElementsByClassName("account"); // Account format e.g. $1,234.00 and ($1,234.00) [red colour] + if (elements) { + for (var i = 0; i < elements.length; i++) { + NegValue = (elements[i].innerHTML.indexOf("-") > -1) ? 1 : 0; + elements[i].innerHTML = ((elements[i].hasAttribute("data-prefix") ? elements[i].getAttribute("data-prefix") : "") + + " " + + currency((elements[i].innerHTML).replace("-",""), + (elements[i].hasAttribute("data-grpsep") ? elements[i].getAttribute("data-grpsep") : ""), + (elements[i].hasAttribute("data-decpt") ? elements[i].getAttribute("data-decpt") : "")) + + " " + + (elements[i].hasAttribute("data-suffix") ? elements[i].getAttribute("data-suffix") : "")).trim(); + if (NegValue) { + elements[i].style.color = "#ff0000"; + elements[i].innerHTML = "(" + elements[i].innerHTML + ")" + } + elements[i].style.textAlign = 'right'; + } + } + + + + + \ No newline at end of file From 1e2751764a38499db5ca39299137468ae652add0 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Tue, 26 Mar 2019 16:50:34 +0400 Subject: [PATCH 13/49] SQL: Get latest currency conversion rate Now get the conversion rate from CURRENCYHISTORY_V1, if not found then uses CURRENCYHISTORY_V1.BASECONVRATE --- CategoriesStatLast12Months/sqlcontent.sql | 158 ++++++++++++---------- 1 file changed, 83 insertions(+), 75 deletions(-) diff --git a/CategoriesStatLast12Months/sqlcontent.sql b/CategoriesStatLast12Months/sqlcontent.sql index 70b58ba..c4e8f4c 100644 --- a/CategoriesStatLast12Months/sqlcontent.sql +++ b/CategoriesStatLast12Months/sqlcontent.sql @@ -1,75 +1,83 @@ -select -case t.subcateg when -1 then ca.categname else ca.categname ||':'||sc.subcategname end category -, t.transid, t.categ -, total( case strftime('%m', date('now', 'start of month','-11 month','localtime')) when month then amount end ) as twe -, total( case strftime('%m', date('now', 'start of month','-10 month','localtime')) when month then amount end ) as ele -, total( case strftime('%m', date('now', 'start of month','-9 month','localtime')) when month then amount end ) as ten -, total( case strftime('%m', date('now', 'start of month','-8 month','localtime')) when month then amount end ) as nin -, total( case strftime('%m', date('now', 'start of month','-7 month','localtime')) when month then amount end ) as egh -, total( case strftime('%m', date('now', 'start of month','-6 month','localtime')) when month then amount end ) as sev -, total( case strftime('%m', date('now', 'start of month','-5 month','localtime')) when month then amount end ) as six -, total( case strftime('%m', date('now', 'start of month','-4 month','localtime')) when month then amount end ) as fiv -, total( case strftime('%m', date('now', 'start of month','-3 month','localtime')) when month then amount end ) as fou -, total( case strftime('%m', date('now', 'start of month','-2 month','localtime')) when month then amount end ) as thr -, total( case strftime('%m', date('now', 'start of month','-1 month','localtime')) when month then amount end ) as two -, total( case strftime('%m', date('now', 'start of month','-0 month','localtime')) when month then amount end ) as one - -, total( case strftime('%m', date('now', 'start of month','-11 month','localtime')) when month then amountWithdraw end ) as WITH_twe -, total( case strftime('%m', date('now', 'start of month','-10 month','localtime')) when month then amountWithdraw end ) as WITH_ele -, total( case strftime('%m', date('now', 'start of month','-9 month','localtime')) when month then amountWithdraw end ) as WITH_ten -, total( case strftime('%m', date('now', 'start of month','-8 month','localtime')) when month then amountWithdraw end ) as WITH_nin -, total( case strftime('%m', date('now', 'start of month','-7 month','localtime')) when month then amountWithdraw end ) as WITH_egh -, total( case strftime('%m', date('now', 'start of month','-6 month','localtime')) when month then amountWithdraw end ) as WITH_sev -, total( case strftime('%m', date('now', 'start of month','-5 month','localtime')) when month then amountWithdraw end ) as WITH_six -, total( case strftime('%m', date('now', 'start of month','-4 month','localtime')) when month then amountWithdraw end ) as WITH_fiv -, total( case strftime('%m', date('now', 'start of month','-3 month','localtime')) when month then amountWithdraw end ) as WITH_fou -, total( case strftime('%m', date('now', 'start of month','-2 month','localtime')) when month then amountWithdraw end ) as WITH_thr -, total( case strftime('%m', date('now', 'start of month','-1 month','localtime')) when month then amountWithdraw end ) as WITH_two -, total( case strftime('%m', date('now', 'start of month','-0 month','localtime')) when month then amountWithdraw end ) as WITH_one - -, total( case strftime('%m', date('now', 'start of month','-11 month','localtime')) when month then amountDeposit end ) as DEP_twe -, total( case strftime('%m', date('now', 'start of month','-10 month','localtime')) when month then amountDeposit end ) as DEP_ele -, total( case strftime('%m', date('now', 'start of month','-9 month','localtime')) when month then amountDeposit end ) as DEP_ten -, total( case strftime('%m', date('now', 'start of month','-8 month','localtime')) when month then amountDeposit end ) as DEP_nin -, total( case strftime('%m', date('now', 'start of month','-7 month','localtime')) when month then amountDeposit end ) as DEP_egh -, total( case strftime('%m', date('now', 'start of month','-6 month','localtime')) when month then amountDeposit end ) as DEP_sev -, total( case strftime('%m', date('now', 'start of month','-5 month','localtime')) when month then amountDeposit end ) as DEP_six -, total( case strftime('%m', date('now', 'start of month','-4 month','localtime')) when month then amountDeposit end ) as DEP_fiv -, total( case strftime('%m', date('now', 'start of month','-3 month','localtime')) when month then amountDeposit end ) as DEP_fou -, total( case strftime('%m', date('now', 'start of month','-2 month','localtime')) when month then amountDeposit end ) as DEP_thr -, total( case strftime('%m', date('now', 'start of month','-1 month','localtime')) when month then amountDeposit end ) as DEP_two -, total( case strftime('%m', date('now', 'start of month','-0 month','localtime')) when month then amountDeposit end ) as DEP_one - -, total(amount) as OVERALL -from( - select - strftime('%m', TRANSDATE) as month - , c.transid, cf.BaseConvRate - , c.accountid, c.transcode - , case ifnull(c.categid, -1) when -1 then s.categid else c.categid end as categ - , case ifnull(c.subcategid,-1) when -1 then ifnull(s.subcategid,-1) else ifnull(c.subcategid,-1) end as subcateg - , c.payeeid - , sum((case c.categid when -1 then splittransamount else transamount end) - * (case transcode when 'Withdrawal' then - cf.BaseConvRate else cf.BaseConvRate end) - ) amount - , sum((case c.categid when -1 then splittransamount else transamount end) - * (case transcode when 'Withdrawal' then - cf.BaseConvRate else 0 end) - ) amountWithdraw - , sum((case c.categid when -1 then splittransamount else transamount end) - * (case transcode when 'Withdrawal' then 0 else cf.BaseConvRate end) - ) amountDeposit - from checkingaccount_v1 c - left join splittransactions_v1 s on s.transid=c.transid - left join ACCOUNTLIST_V1 AC on AC.ACCOUNTID = c.ACCOUNTID - left join currencyformats_v1 cf on cf.currencyid=AC.currencyid - where transcode != 'Transfer' - and c.status NOT IN ('V','D') - and ac.status !='Closed' - and (date('now', 'start of month','-11 month','localtime') <= transdate - and transdate < date('now', 'start of month','+1 month','localtime')) - group by month, categ, subcateg - ) t - left join category_v1 ca on ca.categid=t.categ - left join subcategory_v1 sc on sc.categid=t.categ and sc.subcategid=t.subcateg -group by category -order by category +SELECT CASE t.subcateg WHEN -1 THEN ca.categname ELSE ca.categname || ':' || sc.subcategname END as category, + t.transid as transid, + t.categ as categ, + total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime') ) WHEN month THEN amount END) AS twe, + total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime') ) WHEN month THEN amount END) AS ele, + total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime') ) WHEN month THEN amount END) AS ten, + total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime') ) WHEN month THEN amount END) AS nin, + total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime') ) WHEN month THEN amount END) AS egh, + total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime') ) WHEN month THEN amount END) AS sev, + total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime') ) WHEN month THEN amount END) AS six, + total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime') ) WHEN month THEN amount END) AS fiv, + total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime') ) WHEN month THEN amount END) AS fou, + total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime') ) WHEN month THEN amount END) AS thr, + total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime') ) WHEN month THEN amount END) AS two, + total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime') ) WHEN month THEN amount END) AS one, + total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_twe, + total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_ele, + total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_ten, + total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_nin, + total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_egh, + total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_sev, + total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_six, + total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_fiv, + total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_fou, + total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_thr, + total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_two, + total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_one, + total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_twe, + total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_ele, + total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_ten, + total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_nin, + total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_egh, + total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_sev, + total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_six, + total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_fiv, + total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_fou, + total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_thr, + total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_two, + total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_one, + total(amount) AS OVERALL + FROM ( + SELECT strftime('%m', TRANSDATE) AS month, + c.transid as transid, + IFNULL(CH.CURRVALUE, CF.BASECONVRATE) AS CURRVALUE, + c.accountid as accountid, + c.transcode as transcode, + CASE ifnull(c.categid, -1) WHEN -1 THEN s.categid ELSE c.categid END AS categ, + CASE ifnull(c.subcategid, -1) WHEN -1 THEN ifnull(s.subcategid, -1) ELSE ifnull(c.subcategid, -1) END AS subcateg, + c.payeeid as payeeid, + sum( (CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN -IFNULL(CH.CURRVALUE, CF.BASECONVRATE) ELSE cf.BaseConvRate END) ) as amount, + sum( (CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN -IFNULL(CH.CURRVALUE, CF.BASECONVRATE) ELSE 0.00 END) ) as amountWithdraw, + sum( (CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN 0.00 ELSE IFNULL(CH.CURRVALUE, CF.BASECONVRATE) END) ) as amountDeposit + FROM checkingaccount_v1 c + LEFT JOIN + splittransactions_v1 s ON s.transid = c.transid + LEFT JOIN + ACCOUNTLIST_V1 AC ON AC.ACCOUNTID = c.ACCOUNTID + LEFT JOIN + currencyformats_v1 cf ON cf.currencyid = AC.currencyid + LEFT JOIN + CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = CF.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = CF.CURRENCYID + ) + WHERE transcode != 'Transfer' AND + c.status NOT IN ('V', 'D') AND + ac.status != 'Closed' AND + (date('now', 'start of month', '-11 month', 'localtime') <= transdate AND + transdate < date('now', 'start of month', '+1 month', 'localtime') ) + GROUP BY month, + categ, + subcateg + ) + t + LEFT JOIN + category_v1 ca ON ca.categid = t.categ + LEFT JOIN + subcategory_v1 sc ON sc.categid = t.categ AND + sc.subcategid = t.subcateg + GROUP BY category + ORDER BY category asc; From b17d8ba93dd12bfcb3004caad0d147d5df1bbf05 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Tue, 26 Mar 2019 16:59:53 +0400 Subject: [PATCH 14/49] SQL: Get Latest Curr Rate & Categories without SubCategories Pickup the latets currency conversion from the CURRENCYHISTORY_V1 table. If there are no value, then use CURRENCYFORMATS_V1.BASECONVRATE. Changed the SUBCATEGORY_V1 to left join as not all Categories have a subcategory (Other Expenses) and Transactions can be put at Category level by user. --- CategoryTrend/sqlcontent.sql | 56 ++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/CategoryTrend/sqlcontent.sql b/CategoryTrend/sqlcontent.sql index ba8728b..e59b49a 100644 --- a/CategoryTrend/sqlcontent.sql +++ b/CategoryTrend/sqlcontent.sql @@ -1,19 +1,37 @@ --- TODO: Update category and subcategory name in line 17. -select strftime('%Y', TRANSDATE) as YEAR - , strftime('%m', TRANSDATE) as MONTH - , total((case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) * c1.BASECONVRATE) as AMOUNT -from - (select ACCOUNTID, TRANSDATE, TRANSCODE, CATEGID, SUBCATEGID, TRANSAMOUNT from CHECKINGACCOUNT_V1 - where STATUS NOT IN ('D', 'V') - union all - select t1.ACCOUNTID, t1.TRANSDATE, t1.TRANSCODE, t2.CATEGID, t2.SUBCATEGID, t2.SPLITTRANSAMOUNT from SPLITTRANSACTIONS_V1 as t2 - inner join CHECKINGACCOUNT_V1 as t1 - on t1.TRANSID = t2.TRANSID - where t1.STATUS NOT IN ('D', 'V')) as t3 -inner join ACCOUNTLIST_V1 as a1 on a1.ACCOUNTID = t3.ACCOUNTID -inner join CURRENCYFORMATS_V1 as c1 on c1.CURRENCYID = a1.CURRENCYID -inner join CATEGORY_V1 as cat on t3.CATEGID = cat.CATEGID -inner join SUBCATEGORY_V1 as subcat on t3.SUBCATEGID = subcat.SUBCATEGID -where cat.CATEGNAME = 'Food' and subcat.SUBCATEGNAME = 'Groceries' -group by year, month -order by year asc, month asc; \ No newline at end of file +-- TODO: Update category and subcategory name in line 35. +SELECT strftime('%Y', TRANSDATE) AS YEAR, + strftime('%m', TRANSDATE) AS MONTH, + total( (CASE WHEN TRANSCODE = 'Deposit' THEN TRANSAMOUNT ELSE -TRANSAMOUNT END) * IFNULL(CH.CURRVALUE, C1.BASECONVRATE) ) AS AMOUNT + FROM ( + SELECT ACCOUNTID, + TRANSDATE, + TRANSCODE, + CATEGID, + SUBCATEGID, + TRANSAMOUNT + FROM CHECKINGACCOUNT_V1 + WHERE STATUS NOT IN ('D', 'V') + UNION ALL + SELECT t1.ACCOUNTID, + t1.TRANSDATE, + t1.TRANSCODE, + t2.CATEGID, + t2.SUBCATEGID, + t2.SPLITTRANSAMOUNT + FROM SPLITTRANSACTIONS_V1 AS t2 + INNER JOIN + CHECKINGACCOUNT_V1 AS t1 ON t1.TRANSID = t2.TRANSID + WHERE t1.STATUS NOT IN ('D', 'V') + ) + AS t3 + INNER JOIN ACCOUNTLIST_V1 AS a1 ON a1.ACCOUNTID = t3.ACCOUNTID + INNER JOIN CURRENCYFORMATS_V1 AS c1 ON c1.CURRENCYID = a1.CURRENCYID + INNER JOIN CATEGORY_V1 AS cat ON t3.CATEGID = cat.CATEGID + LEFT JOIN SUBCATEGORY_V1 AS subcat ON t3.SUBCATEGID = subcat.SUBCATEGID + LEFT JOIN CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = C1.CURRENCYID AND + CH.CURRDATE = ( SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = C1.CURRENCYID) + WHERE cat.CATEGNAME = 'Food' AND subcat.SUBCATEGNAME = 'Groceries' + GROUP BY year, month + ORDER BY year ASC, month ASC; From f65c107ec825735249ad6e22676744c606b0629a Mon Sep 17 00:00:00 2001 From: AO1 <44472390+siowena@users.noreply.github.com> Date: Tue, 26 Mar 2019 23:59:33 +0400 Subject: [PATCH 15/49] Get current ex rate from HISTORY Format currency and deal with various currencies. --- CreditReport/luacontent.lua | 14 ++++------- CreditReport/sqlcontent.sql | 46 ++++++++++++++++++++++++------------ CreditReport/template.htt | 47 ++++++++++++++++++++++++++++++------- 3 files changed, 74 insertions(+), 33 deletions(-) diff --git a/CreditReport/luacontent.lua b/CreditReport/luacontent.lua index 2a3f739..747db4e 100644 --- a/CreditReport/luacontent.lua +++ b/CreditReport/luacontent.lua @@ -4,18 +4,12 @@ local index = 1; local base_total = 0; function handle_record(record) - local prefix = record:get("PFX_SYMBOL"); - local suffix = record:get("SFX_SYMBOL"); - local balance = record:get("Balance"); - local credit = limits[index]; - local available = credit + balance; - record:set("Balance", prefix .. string.format("%.2f", balance) .. suffix); - record:set("Credit", prefix .. string.format("%.2f", credit) .. suffix); - record:set("Available", prefix .. string.format("%.2f", available) .. suffix); + record:set("CREDIT", limits[index]); + record:set("AVAILABLE", credit + record:get("BALANCE")); index = index + 1; - base_total = base_total + record:get("BaseBal"); + base_total = base_total + record:get("BASEBAL"); end function complete(result) - result:set("Base_Total", base_total); + result:set("BASE_TOTAL", base_total); end diff --git a/CreditReport/sqlcontent.sql b/CreditReport/sqlcontent.sql index 8a94e2a..af63e35 100644 --- a/CreditReport/sqlcontent.sql +++ b/CreditReport/sqlcontent.sql @@ -1,19 +1,35 @@ --- TODO: Update account names in line 16 and Lua. -select a.ACCOUNTNAME - , a.INITIALBAL + total(t.TRANSAMOUNT) as Balance - , (a.INITIALBAL + total(t.TRANSAMOUNT))*c.BASECONVRATE as BaseBal - , c.PFX_SYMBOL, c.SFX_SYMBOL -from - (select ACCOUNTID, TRANSDATE, STATUS, - (case when TRANSCODE='Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT - from CHECKINGACCOUNT_V1 - union all - select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT - from CHECKINGACCOUNT_V1 where TRANSCODE='Transfer') as t inner join ACCOUNTLIST_V1 as a on a.ACCOUNTID=t.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on a.CURRENCYID=c.CURRENCYID where ACCOUNTNAME in ('Account1', 'Account2') - and t.STATUS NOT IN ('V','D') -group by a.ACCOUNTID -order by ACCOUNTNAME; \ No newline at end of file +-- TODO: Update account names in line 28 and Lua +SELECT a.accountname AS ACCOUNTNAME, + a.initialbal + Total(t.transamount) AS BALANCE, + (a.initialbal + Total(t.transamount)) * Ifnull(ch.currvalue, c.baseconvrate) AS BASEBAL, + c.pfx_symbol AS PFX_SYMBOL, + c.sfx_symbol AS SFX_SYMBOL, + c.group_separator AS GROUP_SEPARATOR, + c.decimal_point AS DECIMAL_POINT +FROM + (SELECT ca1.accountid AS ACCOUNTID, + ca1.transdate AS TRANSDATE, + ca1.status AS STATUS, + (CASE WHEN ca1.transcode = 'Deposit' THEN ca1.transamount ELSE -ca1.transamount END) AS TRANSAMOUNT + FROM checkingaccount_v1 AS ca1 + UNION ALL + SELECT ca2.toaccountid AS ACCOUNTID, + ca2.transdate AS TRANSDATE, + ca2.status AS STATUS, + ca2.totransamount AS TRANSAMOUNT + FROM checkingaccount_v1 AS ca2 + WHERE transcode = 'Transfer') AS t +INNER JOIN accountlist_v1 AS a ON a.accountid = t.accountid +INNER JOIN currencyformats_v1 AS c ON a.currencyid = c.currencyid +LEFT JOIN currencyhistory_v1 AS ch ON ch.currencyid = c.currencyid + AND ch.currdate = (SELECT MAX(crhst.currdate) + FROM currencyhistory_v1 AS crhst + WHERE crhst.currencyid = c.currencyid) +WHERE accountname IN ('Account1', 'Account2') + AND t.status NOT IN ('V', 'D') +GROUP BY a.accountid +ORDER BY accountname; \ No newline at end of file diff --git a/CreditReport/template.htt b/CreditReport/template.htt index a4e3c5d..6bb0d5c 100644 --- a/CreditReport/template.htt +++ b/CreditReport/template.htt @@ -26,17 +26,17 @@ - - - - + + + + Total - + @@ -56,8 +56,39 @@
From e877f0bb78cf19a085a77fc3fba4dbb3c2a75509 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Wed, 27 Mar 2019 10:46:48 +0400 Subject: [PATCH 16/49] New chart js and currency conversion & formatting - Switch to ChartNew.js - Exclude Void & Duplicates & Transfers - Switch to base currency using History values or default - Display currency --- YearlyExpenseAndRevenue/luacontent.lua | 15 +- YearlyExpenseAndRevenue/sqlcontent.sql | 109 ++++---- YearlyExpenseAndRevenue/template.htt | 346 ++++++++++++------------- 3 files changed, 221 insertions(+), 249 deletions(-) diff --git a/YearlyExpenseAndRevenue/luacontent.lua b/YearlyExpenseAndRevenue/luacontent.lua index 51666b7..1f500bd 100644 --- a/YearlyExpenseAndRevenue/luacontent.lua +++ b/YearlyExpenseAndRevenue/luacontent.lua @@ -3,6 +3,7 @@ local name_n1 ; local name_n2 ; local name_n3 ; local name_n4 ; +local initialized=0; local cumul_n0 = 0; local cumul_n1 = 0; @@ -11,12 +12,14 @@ local cumul_n3 = 0; local cumul_n4 = 0; function handle_record(record) - name_n0 = record:get('name_n0'); - name_n1 = record:get('name_n1'); - name_n2 = record:get('name_n2'); - name_n3 = record:get('name_n3'); - name_n4 = record:get('name_n4'); - + if initialized == 0 then + name_n0 = record:get('name_n0'); + name_n1 = record:get('name_n1'); + name_n2 = record:get('name_n2'); + name_n3 = record:get('name_n3'); + name_n4 = record:get('name_n4'); + initialized=1; + end cumul_n0 = cumul_n0 + record:get('Total'); record:set("cumul_n0", cumul_n0); cumul_n1 = cumul_n1 + record:get('Total_n1'); diff --git a/YearlyExpenseAndRevenue/sqlcontent.sql b/YearlyExpenseAndRevenue/sqlcontent.sql index 43c8181..705b57f 100644 --- a/YearlyExpenseAndRevenue/sqlcontent.sql +++ b/YearlyExpenseAndRevenue/sqlcontent.sql @@ -1,64 +1,45 @@ -select - periode_month, - sum(Total) Total, - sum(Total_n1) Total_n1, - sum(Total_n2) Total_n2, - sum(Total_n3) Total_n3, - sum(Total_n4) Total_n4, - strftime('%Y',date('now', 'start of year','localtime')) name_n0, - strftime('%Y',date('now', 'start of year','-1 year','localtime')) name_n1, - strftime('%Y',date('now', 'start of year','-2 year','localtime')) name_n2, - strftime('%Y',date('now', 'start of year','-3 year','localtime')) name_n3, - strftime('%Y',date('now', 'start of year','-4 year','localtime')) name_n4 -from ( - select - periode_month, - case - when periode_year = strftime('%Y',date('now', 'start of year','localtime')) - then round(sum(Deposit) + sum(Withdrawal),2) - else 0 - end as Total, - case - when periode_year = strftime('%Y',date('now', 'start of year','-1 year','localtime')) - then round(sum(Deposit) + sum(Withdrawal),2) - else 0 - end as Total_n1, - case - when periode_year = strftime('%Y',date('now', 'start of year','-2 year','localtime')) - then round(sum(Deposit) + sum(Withdrawal),2) - else 0 - end as Total_n2, - case - when periode_year = strftime('%Y',date('now', 'start of year','-3 year','localtime')) - then round(sum(Deposit) + sum(Withdrawal),2) - else 0 - end as Total_n3, - case - when periode_year = strftime('%Y',date('now', 'start of year','-4 year','localtime')) - then round(sum(Deposit) + sum(Withdrawal),2) - else 0 - end as Total_n4 - from ( - select - strftime('%Y', TRANSDATE) as periode_year, - strftime('%m', TRANSDATE) as periode_month, - case - when transcode = 'Deposit' then transamount - else 0 - end as Deposit, - case - when transcode = 'Withdrawal' then -transamount - else 0 - end as Withdrawal - --,* - from - checkingaccount_V1 - where - TRANSDATE > date('now', 'start of year','-4 year','localtime') - and status <>'V' - ) - group by periode_year,periode_month - order by periode_year,periode_month asc -) -group by periode_month -order by periode_month asc; \ No newline at end of file +SELECT mdata.periode_month AS periode_month, + sum(mdata.Total) AS Total, + sum(mdata.Total_n1) AS Total_n1, + sum(mdata.Total_n2) AS Total_n2, + sum(mdata.Total_n3) AS Total_n3, + sum(mdata.Total_n4) AS Total_n4, + strftime('%Y', date('now', 'start of year', 'localtime') ) AS name_n0, + strftime('%Y', date('now', 'start of year', '-1 year', 'localtime') ) AS name_n1, + strftime('%Y', date('now', 'start of year', '-2 year', 'localtime') ) AS name_n2, + strftime('%Y', date('now', 'start of year', '-3 year', 'localtime') ) AS name_n3, + strftime('%Y', date('now', 'start of year', '-4 year', 'localtime') ) AS name_n4 + FROM ( + SELECT txd.periode_month, + CASE WHEN txd.periode_year = strftime('%Y', date('now', 'start of year', 'localtime') ) THEN txd.Deposit + txd.Withdrawal ELSE 0 END AS Total, + CASE WHEN txd.periode_year = strftime('%Y', date('now', 'start of year', '-1 year', 'localtime') ) THEN txd.Deposit + txd.Withdrawal ELSE 0 END AS Total_n1, + CASE WHEN txd.periode_year = strftime('%Y', date('now', 'start of year', '-2 year', 'localtime') ) THEN txd.Deposit + txd.Withdrawal ELSE 0 END AS Total_n2, + CASE WHEN txd.periode_year = strftime('%Y', date('now', 'start of year', '-3 year', 'localtime') ) THEN txd.Deposit + txd.Withdrawal ELSE 0 END AS Total_n3, + CASE WHEN txd.periode_year = strftime('%Y', date('now', 'start of year', '-4 year', 'localtime') ) THEN txd.Deposit + txd.Withdrawal ELSE 0 END AS Total_n4 + FROM ( + SELECT strftime('%Y', ca.TRANSDATE) AS periode_year, + strftime('%m', ca.TRANSDATE) AS periode_month, + CASE WHEN ca.transcode = 'Deposit' THEN (ca.transamount * IFNULL(CH.CURRVALUE, CF.BASECONVRATE) * 1.0) ELSE 0 END AS Deposit, + CASE WHEN ca.transcode = 'Withdrawal' THEN - (ca.transamount * IFNULL(CH.CURRVALUE, CF.BASECONVRATE) * 1.0) ELSE 0 END AS Withdrawal + FROM CHECKINGACCOUNT_V1 AS ca + LEFT JOIN + ACCOUNTLIST_V1 AC ON AC.ACCOUNTID = ca.ACCOUNTID + LEFT JOIN + CURRENCYFORMATS_V1 cf ON cf.currencyid = AC.currencyid + LEFT JOIN + CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = CF.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = CF.CURRENCYID + ) + WHERE ca.TRANSDATE > date('now', 'start of year', '-4 year', 'localtime') AND + ca.STATUS NOT IN ('V', 'D') AND + ca.TRANSCODE <> 'Transfer' + ) + AS txd + ) + AS mdata + GROUP BY mdata.periode_month + ORDER BY mdata.periode_month ASC; +; diff --git a/YearlyExpenseAndRevenue/template.htt b/YearlyExpenseAndRevenue/template.htt index b04abc6..858cc74 100644 --- a/YearlyExpenseAndRevenue/template.htt +++ b/YearlyExpenseAndRevenue/template.htt @@ -1,196 +1,184 @@ - + - <TMPL_VAR REPORTNAME> - - - + + + -
-

-
- -
-
-
-
-
-
- -
-
- -
-
-
-
- - - - - - - +
+

+

Report Date:


+
+
+
+
+
periode_month
+ + + - - + + + + - + - + + +

Base currency is set to:  

All chart figures in base currency:

+ + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - -
Period Month Cumul Cumul Cumul
Cumul Cumul Cumul
- - - - - - - - + + var ctx=document.getElementById("myChart").getContext("2d"); + var myNewChart=new Chart(ctx).Line(data,options); + + From 06fdf815c6b04e4e52ece76b5fc7205779585dd8 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Wed, 27 Mar 2019 13:32:57 +0400 Subject: [PATCH 17/49] Currency format and rates - SQL now pulls both the Currency rate from currency record and latets historical currency rate - Displayed prefix & suffix symbol(s) of the currency --- CurrencySummary/description.txt | 9 ++++++++- CurrencySummary/sqlcontent.sql | 26 ++++++++++++++++++++------ CurrencySummary/template.htt | 25 +++++++++++++++---------- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/CurrencySummary/description.txt b/CurrencySummary/description.txt index af3854e..be6e040 100644 --- a/CurrencySummary/description.txt +++ b/CurrencySummary/description.txt @@ -1 +1,8 @@ -Used Currency Summary Report \ No newline at end of file +

Used Currency Summary Report

+

Lists all currencies used in 'Open' Accounts

+
+
Currency Conversion Rate
+
This is the values from the 'Conversion to Base Rate' field on the Currency Record.
Note: This field will be depreciated in MMEX v1.4.x (DB v13), currency conversion will be done using the Currency History Options
+
Latest History Rate
+
This is the latest value from the 'Conversion to Base Rate' field on the Currency Record.
If no history values is set, then displayed '0.0000'.
+
\ No newline at end of file diff --git a/CurrencySummary/sqlcontent.sql b/CurrencySummary/sqlcontent.sql index 2cd8bb5..721d0ba 100644 --- a/CurrencySummary/sqlcontent.sql +++ b/CurrencySummary/sqlcontent.sql @@ -1,6 +1,20 @@ -select c.CURRENCYNAME, c.CURRENCY_SYMBOL, count(*) as Quantity, c.BASECONVRATE -from CURRENCYFORMATS_V1 as c -inner join ACCOUNTLIST_V1 as a on a.CURRENCYID = c.CURRENCYID -where a.STATUS = 'Open' -group by c.CURRENCYNAME -order by c.CURRENCYNAME asc; +SELECT c.CURRENCYNAME AS CURRENCYNAME, + c.CURRENCY_SYMBOL AS CURRENCY_SYMBOL, + c.PFX_SYMBOL AS PFX_SYMBOL, + c.SFX_SYMBOL AS SFX_SYMBOL, + count( * ) AS Quantity, + c.BASECONVRATE AS BASECONVRATE, + IFNULL(CH.CURRVALUE, 0) AS HISTBASECONVRATE + FROM CURRENCYFORMATS_V1 AS c + INNER JOIN + ACCOUNTLIST_V1 AS a ON a.CURRENCYID = c.CURRENCYID + LEFT JOIN + CURRENCYHISTORY_V1 AS CH ON C.CURRENCYID = CH.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = C.CURRENCYID + ) + WHERE a.STATUS = 'Open' + GROUP BY c.CURRENCYNAME + ORDER BY c.CURRENCYNAME ASC; diff --git a/CurrencySummary/template.htt b/CurrencySummary/template.htt index 130eb06..202a903 100644 --- a/CurrencySummary/template.htt +++ b/CurrencySummary/template.htt @@ -9,7 +9,7 @@

Currency Summary Report

-

+

Report Date:

@@ -20,19 +20,23 @@
Currency NameNumber of AccountsConversion RateSymbolNo. of AccountsCurrency Conversion RateLatest History Rate
">
@@ -45,14 +49,15 @@
-
+
+ + From c1607fb4c66c149a5dd14f228702225d07eb551f Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Wed, 3 Apr 2019 16:25:03 +0400 Subject: [PATCH 23/49] YearlyExpenseAndRevenue updates - correct date range - Remove zero dataset - more description --- YearlyExpenseAndRevenue/description.txt | 4 +++- YearlyExpenseAndRevenue/sqlcontent.sql | 5 ++--- YearlyExpenseAndRevenue/template.htt | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/YearlyExpenseAndRevenue/description.txt b/YearlyExpenseAndRevenue/description.txt index 9ffb28c..60abdbb 100644 --- a/YearlyExpenseAndRevenue/description.txt +++ b/YearlyExpenseAndRevenue/description.txt @@ -1,2 +1,4 @@ Yearly Expense/Revenue -show graph of cumul yearly expense and revenus by month for the last 3 years \ No newline at end of file +Show a graph of cumulative yearly expense and revenus by month for the last 3 years + +Displays all figures in the base currency, converting amounts from the account currency to base currency using the latest currency history value. If there are no currency history values, then uses the currency base rate conversion. \ No newline at end of file diff --git a/YearlyExpenseAndRevenue/sqlcontent.sql b/YearlyExpenseAndRevenue/sqlcontent.sql index 705b57f..e0a4de9 100644 --- a/YearlyExpenseAndRevenue/sqlcontent.sql +++ b/YearlyExpenseAndRevenue/sqlcontent.sql @@ -33,7 +33,7 @@ SELECT mdata.periode_month AS periode_month, FROM CURRENCYHISTORY_V1 AS CRHST WHERE CRHST.CURRENCYID = CF.CURRENCYID ) - WHERE ca.TRANSDATE > date('now', 'start of year', '-4 year', 'localtime') AND + WHERE ca.TRANSDATE >= date('now', 'start of year', '-4 year', 'localtime') AND ca.STATUS NOT IN ('V', 'D') AND ca.TRANSCODE <> 'Transfer' ) @@ -41,5 +41,4 @@ SELECT mdata.periode_month AS periode_month, ) AS mdata GROUP BY mdata.periode_month - ORDER BY mdata.periode_month ASC; -; + ORDER BY mdata.periode_month ASC; \ No newline at end of file diff --git a/YearlyExpenseAndRevenue/template.htt b/YearlyExpenseAndRevenue/template.htt index 858cc74..0008674 100644 --- a/YearlyExpenseAndRevenue/template.htt +++ b/YearlyExpenseAndRevenue/template.htt @@ -104,7 +104,7 @@ var data={ labels: ["",], datasets: [ - { +/* { label: "0 axis", fillColor: "rgba(220,220,220,0.2)", strokeColor: "rgba(220,220,220,1)", @@ -114,7 +114,6 @@ pointHighlightStroke: "rgba(220,220,220,1)", data: [0,] }, -/* { label: "", fillColor: "rgba(151,186,204,0)", From 1468f6ce1b19b435e5201c567211f997b0caedb8 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Wed, 3 Apr 2019 16:26:35 +0400 Subject: [PATCH 24/49] Withdrawal currency display - Displays the amounts in currency of the account - HTML5 check on template - refined SQL to reduce number of JOINS --- Withdrawals/sqlcontent.sql | 63 +++++++++++++++++++---------------- Withdrawals/template.htt | 67 ++++++++++++++++++++++++++++++-------- 2 files changed, 88 insertions(+), 42 deletions(-) diff --git a/Withdrawals/sqlcontent.sql b/Withdrawals/sqlcontent.sql index 839d18e..7d42f76 100644 --- a/Withdrawals/sqlcontent.sql +++ b/Withdrawals/sqlcontent.sql @@ -1,37 +1,44 @@ -SELECT t1.transid id, - t1.transdate date, - t2.splittransamount amount, +SELECT wd_data.id id, + wd_data.date AS date, + wd_data.amount AS amount, COALESCE(c.categname, '') - || ":" || - COALESCE(sc.subcategname, '') cat, - '' notes, - p.payeename payee, - a.accountname account + || ":" || + COALESCE(sc.subcategname, '') AS cat, + wd_data.notes AS notes, + p.payeename AS payee, + acc.accountname AS account, + c.PFX_SYMBOL AS pfx_symbol, + c.SFX_SYMBOL AS sfx_symbol, + c.GROUP_SEPARATOR AS group_separator, + c.DECIMAL_POINT AS decimal_point +FROM (SELECT t1.transid AS id, + t1.transdate AS date, + t2.splittransamount AS amount, + t2.categid AS catid, + t2.subcategid AS subcatid, + '' AS notes, + t1.payeeid AS payeeid, + t1.accountid AS accountid FROM splittransactions_v1 AS t2 INNER JOIN checkingaccount_v1 AS t1 ON t1.TRANSID = t2.TRANSID - LEFT JOIN category_v1 c ON t2.categid=c.categid - LEFT JOIN subcategory_v1 sc ON t2.subcategid= sc.subcategid - LEFT JOIN accountlist_v1 a ON t1.accountid = a.accountid - LEFT JOIN payee_v1 p ON t1.payeeid = p.payeeid WHERE - --t1.accountid in ( SELECT accountid FROM accountlist_v1 WHERE accountname LIKE "EUR%") AND t1.transcode = "Withdrawal" UNION ALL -SELECT ca.transid id, - ca.transdate date, - ca.transamount amount, - COALESCE(c.categname, '') - || ":" || - COALESCE(sc.subcategname, '') cat, - ca.notes notes, - p.payeename payee, - a.accountname account +SELECT ca.transid AS id, + ca.transdate AS date, + ca.transamount AS amount, + ca.categid AS catid, + ca.subcategid AS subcatid, + ca.notes AS notes, + ca.payeeid AS payeeid, + ca.accountid AS accountid FROM checkingaccount_v1 AS ca - JOIN accountlist_v1 a ON ca.accountid = a.accountid - LEFT JOIN payee_v1 p ON ca.payeeid = p.payeeid - LEFT JOIN category_v1 c ON ca.categid=c.categid - LEFT JOIN subcategory_v1 sc ON ca.subcategid= sc.subcategid WHERE - --ca.accountid in (SELECT accountid FROM accountlist_v1 WHERE accountname LIKE "EUR%") AND ca.transcode = "Withdrawal" AND ca.categid <>-1 -ORDER BY date \ No newline at end of file +) AS wd_data +LEFT JOIN accountlist_v1 AS acc ON wd_data.accountid = acc.accountid +LEFT JOIN CURRENCYFORMATS_V1 AS c ON c.CURRENCYID = acc.CURRENCYID +LEFT JOIN category_v1 AS c ON wd_data.catid=c.categid +LEFT JOIN subcategory_v1 AS sc ON wd_data.subcatid= sc.subcategid +LEFT JOIN payee_v1 AS p ON wd_data.payeeid = p.payeeid +ORDER BY date ASC; \ No newline at end of file diff --git a/Withdrawals/template.htt b/Withdrawals/template.htt index 5da8afa..8b41d01 100644 --- a/Withdrawals/template.htt +++ b/Withdrawals/template.htt @@ -1,11 +1,10 @@ - + - - + <TMPL_VAR REPORTNAME> + -
@@ -13,27 +12,25 @@ - - - - - - - + + + + + + + - - + - @@ -45,5 +42,47 @@ + + \ No newline at end of file From 6118ab3b083e5488eaf3f67b22cf53c6208c9f7e Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 13:07:31 +0400 Subject: [PATCH 25/49] Multi currency support, display and conversion from historic - Currency conversion uses Historic values if available - Mulit-currency support & formatting per row in report - --- Withdrawals/description.txt | 4 +- YearlyExpenseAndRevenue/description.txt | 7 ++- usercoloredtransactions/luacontent.lua | 4 -- usercoloredtransactions/sqlcontent.sql | 71 ++++++++++++++++++------- usercoloredtransactions/template.htt | 54 +++++++++++++++---- 5 files changed, 102 insertions(+), 38 deletions(-) diff --git a/Withdrawals/description.txt b/Withdrawals/description.txt index 1b46e65..1d3cf56 100644 --- a/Withdrawals/description.txt +++ b/Withdrawals/description.txt @@ -2,6 +2,8 @@ Report: select all withdrawal transactions (for specified accounts). Included columns: date, amount, cat:subcat, notes, payee, account name. Author: Aleksandr Anfilov +Displays amouts in the currency of the account. + How to export results to Excel: 1. Create a blank worksheet in Excel, set format for columns: B (date) - Date format, @@ -11,4 +13,4 @@ find a "Withdrawals.grm" file. Go to SQL tab and click Test, you should see the At this stage, you may want to specify accounts by name - just update the WHERE clause at lines 17 & 35 and uncomment them. 3. Run this report. Select all records in the Output tab and Copy, then switch to Excel. -4. Set cursor to cell A1. "Paste - keep text only". +4. Set cursor to cell A1. "Paste - keep text only". \ No newline at end of file diff --git a/YearlyExpenseAndRevenue/description.txt b/YearlyExpenseAndRevenue/description.txt index 60abdbb..82750f2 100644 --- a/YearlyExpenseAndRevenue/description.txt +++ b/YearlyExpenseAndRevenue/description.txt @@ -1,4 +1,3 @@ -Yearly Expense/Revenue -Show a graph of cumulative yearly expense and revenus by month for the last 3 years - -Displays all figures in the base currency, converting amounts from the account currency to base currency using the latest currency history value. If there are no currency history values, then uses the currency base rate conversion. \ No newline at end of file +

Yearly Expense/Revenue

+

Show a graph of cumulative yearly expense and revenues by month for the last 3 years

+

Displays all figures in the Base currency, converting amounts from the Account currency to Base currency using the latest Currency History value. If there are no currency history values, then uses the Currency Base Rate Conversion.

\ No newline at end of file diff --git a/usercoloredtransactions/luacontent.lua b/usercoloredtransactions/luacontent.lua index 53a7594..cc0f197 100644 --- a/usercoloredtransactions/luacontent.lua +++ b/usercoloredtransactions/luacontent.lua @@ -1,10 +1,6 @@ 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 diff --git a/usercoloredtransactions/sqlcontent.sql b/usercoloredtransactions/sqlcontent.sql index e5ec20b..2feb495 100644 --- a/usercoloredtransactions/sqlcontent.sql +++ b/usercoloredtransactions/sqlcontent.sql @@ -1,18 +1,53 @@ -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; \ No newline at end of file +SELECT t.FOLLOWUPID, + t.PAYEENAME, + t.TRANSDATE, + t.TRANSAMOUNT, + t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) AS BaseAmount, + c.PFX_SYMBOL, + c.SFX_SYMBOL, + ( + SELECT inf.infovalue + FROM infotable_V1 AS inf + WHERE inf.infoname = 'USER_COLOR' || CAST (t.followupid AS TEXT) + ) + AS FOLLOWCOLOR, +t.transid as transid + FROM ( + SELECT (CASE WHEN c1.TRANSCODE = 'Transfer' THEN ' < ' ELSE '' END) || 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, + c1.TRANSID + 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 AS PAYEENAME, + c2.TRANSDATE, + c2.FOLLOWUPID, + c2.TOTRANSAMOUNT, + a2.CURRENCYID, +c2.TRANSID + 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 + LEFT JOIN + CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = c.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = c.CURRENCYID + ) + WHERE t.FOLLOWUPID > 0 + ORDER BY t.FOLLOWUPID ASC, + t.PAYEENAME ASC, + t.TRANSDATE ASC; +; diff --git a/usercoloredtransactions/template.htt b/usercoloredtransactions/template.htt index 62cf291..5e8ecee 100644 --- a/usercoloredtransactions/template.htt +++ b/usercoloredtransactions/template.htt @@ -15,8 +15,8 @@
iddatewithdrawalcategorynotespayeeaccountIDDateWithdrawalCategoryNotesPayeeAccount
- - + + @@ -25,10 +25,10 @@ - - - - + + + + @@ -51,11 +51,43 @@ From bab0da18473e286a6b7a4a1b9b82073a2928ec35 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:02:01 +0400 Subject: [PATCH 26/49] BlankNotes - UTF8 Save the template in UTF8 for the internation characters --- BlankNotes/template.htt | 12 ++-- SVG_Clock_animated/description.txt | 3 + SVG_Clock_animated/luacontent.lua | 0 SVG_Clock_animated/sqlcontent.sql | 1 + SVG_Clock_animated/template.htt | 102 +++++++++++++++++++++++++++ TransactionStatistics/template.htt | 2 +- YearlyExpenseAndRevenue/template.htt | 8 +-- 7 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 SVG_Clock_animated/description.txt create mode 100644 SVG_Clock_animated/luacontent.lua create mode 100644 SVG_Clock_animated/sqlcontent.sql create mode 100644 SVG_Clock_animated/template.htt diff --git a/BlankNotes/template.htt b/BlankNotes/template.htt index 5202d73..aa9c852 100644 --- a/BlankNotes/template.htt +++ b/BlankNotes/template.htt @@ -2,9 +2,7 @@ - - <TMPL_VAR REPORTNAME> - + <TMPL_VAR REPORTNAME> @@ -145,10 +143,10 @@ "_Title_":"Transactions with Blank Note field" }], "russian": [{ - "_Title_":" ", "Amount":"" - , "Date": "", "Account": "" - , "Payee":"", "ID":"" - , "Amount":"", "Error":"" + "_Title_":"Транзакции с пустыми заметками", "Amount":"Сумма" + , "Date": "Дата", "Account": "Счёт" + , "Payee":"Получатель", "ID":"№" + , "Amount":"Сумма", "Error":"Ошибка" }], }; var my_lang = []; diff --git a/SVG_Clock_animated/description.txt b/SVG_Clock_animated/description.txt new file mode 100644 index 0000000..1117409 --- /dev/null +++ b/SVG_Clock_animated/description.txt @@ -0,0 +1,3 @@ +SVG Example: SVG Clock: animated with Javascript + +https://kihyuckhong.wordpress.com/2010/01/10/svg-example-svg-clock-animated-with-javascript/ \ No newline at end of file diff --git a/SVG_Clock_animated/luacontent.lua b/SVG_Clock_animated/luacontent.lua new file mode 100644 index 0000000..e69de29 diff --git a/SVG_Clock_animated/sqlcontent.sql b/SVG_Clock_animated/sqlcontent.sql new file mode 100644 index 0000000..6bb32b4 --- /dev/null +++ b/SVG_Clock_animated/sqlcontent.sql @@ -0,0 +1 @@ +select 1 \ No newline at end of file diff --git a/SVG_Clock_animated/template.htt b/SVG_Clock_animated/template.htt new file mode 100644 index 0000000..d732422 --- /dev/null +++ b/SVG_Clock_animated/template.htt @@ -0,0 +1,102 @@ + + + + + + <TMPL_VAR REPORTNAME> + + + + +
+

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + + + diff --git a/TransactionStatistics/template.htt b/TransactionStatistics/template.htt index e2f800c..89f34ed 100755 --- a/TransactionStatistics/template.htt +++ b/TransactionStatistics/template.htt @@ -32,7 +32,7 @@ } ] } - var opts= { annotateDisplay : true }; + var opts= {annotateDisplay:true,legend:true}; window.onload = function() { var myBar = new Chart(document.getElementById("mycanvas").getContext("2d")).Line(LineData,opts); } diff --git a/YearlyExpenseAndRevenue/template.htt b/YearlyExpenseAndRevenue/template.htt index 0008674..46f1b34 100644 --- a/YearlyExpenseAndRevenue/template.htt +++ b/YearlyExpenseAndRevenue/template.htt @@ -167,15 +167,13 @@ } ] }; - //display graph var options={ legend:true, - bezierCurve:false - ,scaleLineWidth: 1 - ,responsive:true + bezierCurve:false, + scaleLineWidth:1, + responsive:true }; - var ctx=document.getElementById("myChart").getContext("2d"); var myNewChart=new Chart(ctx).Line(data,options); From 8cf52f9b4f2c2f4b6dca560c56ec56b164f96938 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:06:41 +0400 Subject: [PATCH 27/49] ExpenseAndRevenueBy - ChartNew.js Upgraded to use the ChartNew.js script file. --- ExpenseAndRevenueByMonth/template.htt | 2 +- ExpenseAndRevenueByQuarter/template.htt | 2 +- ExpenseAndRevenueByYear/template.htt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ExpenseAndRevenueByMonth/template.htt b/ExpenseAndRevenueByMonth/template.htt index f00918c..10c9621 100644 --- a/ExpenseAndRevenueByMonth/template.htt +++ b/ExpenseAndRevenueByMonth/template.htt @@ -4,7 +4,7 @@ <TMPL_VAR REPORTNAME> - + diff --git a/ExpenseAndRevenueByQuarter/template.htt b/ExpenseAndRevenueByQuarter/template.htt index f00918c..10c9621 100644 --- a/ExpenseAndRevenueByQuarter/template.htt +++ b/ExpenseAndRevenueByQuarter/template.htt @@ -4,7 +4,7 @@ <TMPL_VAR REPORTNAME> - + diff --git a/ExpenseAndRevenueByYear/template.htt b/ExpenseAndRevenueByYear/template.htt index f00918c..10c9621 100644 --- a/ExpenseAndRevenueByYear/template.htt +++ b/ExpenseAndRevenueByYear/template.htt @@ -4,7 +4,7 @@ <TMPL_VAR REPORTNAME> - + From b1777bb61c7447a14bdbd1b0bc7e2308b08d4d61 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:08:32 +0400 Subject: [PATCH 28/49] StockSummary Currency Converion on History Values Used Historic Values before using Conversion Based currency rate --- StockSummary/sqlcontent.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/StockSummary/sqlcontent.sql b/StockSummary/sqlcontent.sql index 676a65e..6e40752 100755 --- a/StockSummary/sqlcontent.sql +++ b/StockSummary/sqlcontent.sql @@ -1,9 +1,15 @@ select s1.STOCKNAME, s1.SYMBOL, total(s1.NUMSHARES) as NUMSHARES, - total(s1.VALUE * c1.BASECONVRATE) as VALUE + total(s1.VALUE * IFNULL(CH.CURRVALUE, c1.BASECONVRATE)) as VALUE from ACCOUNTLIST_V1 as a1 inner join STOCK_V1 as s1 on s1.HELDAT = a1.ACCOUNTID inner join CURRENCYFORMATS_V1 as c1 on c1.CURRENCYID = a1.CURRENCYID +left join CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = c1.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = c1.CURRENCYID + ) where a1.ACCOUNTTYPE = 'Investment' and a1.STATUS = 'Open' group by s1.SYMBOL -order by VALUE desc; +order by VALUE desc; \ No newline at end of file From 296638819d00644d979d446760f40a87f0202d8b Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:10:20 +0400 Subject: [PATCH 29/49] PayeeTrend - currency conversion Used Historic Values before using Conversion Based currency rate Report gets Payee from SQL. --- PayeeTrend/description.txt | 3 +-- PayeeTrend/luacontent.lua | 3 +++ PayeeTrend/sqlcontent.sql | 33 ++++++++++++++++----------- PayeeTrend/template.htt | 46 +++++++++++++++++++++----------------- 4 files changed, 50 insertions(+), 35 deletions(-) diff --git a/PayeeTrend/description.txt b/PayeeTrend/description.txt index 2754e4b..fd42762 100644 --- a/PayeeTrend/description.txt +++ b/PayeeTrend/description.txt @@ -1,5 +1,4 @@ Payee Trend Report TODO: -1. Update payee name in SQL (line 19). -2. Update payee name in Template (line 12). +1. Update payee name in SQL (line 26). diff --git a/PayeeTrend/luacontent.lua b/PayeeTrend/luacontent.lua index 373721f..e4732ba 100644 --- a/PayeeTrend/luacontent.lua +++ b/PayeeTrend/luacontent.lua @@ -1,5 +1,6 @@ local months = {"Jan", "Feb", "Mar" , "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; local colors = {"#FF6666", "#FFB266", "#FFFF66", "#B2FF66", "#66FF66", "#66FFB2", "#66FFFF", "#66B2FF", "#6666FF", "#B266FF", "#FF66FF", "#FF66B2"}; +payeename = '' function handle_record(record) local color = colors[1 + (tonumber(record:get('YEAR')) % #colors)]; @@ -13,7 +14,9 @@ function handle_record(record) end end end + payeename = record:get('PAYEENAME'); end function complete(result) + result:set('PAYEENAME', payeename); end diff --git a/PayeeTrend/sqlcontent.sql b/PayeeTrend/sqlcontent.sql index 2a55e06..648ce2c 100644 --- a/PayeeTrend/sqlcontent.sql +++ b/PayeeTrend/sqlcontent.sql @@ -1,21 +1,28 @@ --- TODO: Update payee name in line 19. +-- TODO: Update payee name in line 26. select strftime('%Y', t.TRANSDATE) as YEAR - , total(case when '01' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Jan - , total(case when '02' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Feb - , total(case when '03' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Mar - , total(case when '04' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Apr - , total(case when '05' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as May - , total(case when '06' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Jun - , total(case when '07' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Jul - , total(case when '08' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Aug - , total(case when '09' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Sep - , total(case when '10' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Oct - , total(case when '11' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Nov - , total(case when '12' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * c.BASECONVRATE else null end) as Dec + , total(case when '01' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Jan + , total(case when '02' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Feb + , total(case when '03' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Mar + , total(case when '04' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Apr + , total(case when '05' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as May + , total(case when '06' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Jun + , total(case when '07' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Jul + , total(case when '08' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Aug + , total(case when '09' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Sep + , total(case when '10' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Oct + , total(case when '11' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Nov + , total(case when '12' = strftime('%m', t.TRANSDATE) then t.TRANSAMOUNT * IFNULL(CH.CURRVALUE, c.BASECONVRATE) else 0 end) as Dec + , p.PAYEENAME AS PAYEENAME from CHECKINGACCOUNT_V1 as t inner join ACCOUNTLIST_V1 as a on a.ACCOUNTID = t.ACCOUNTID inner join CURRENCYFORMATS_V1 as c on c.CURRENCYID = a.CURRENCYID inner join PAYEE_V1 as p on t.PAYEEID = p.PAYEEID +LEFT JOIN CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = c.CURRENCYID AND + CH.CURRDATE = ( + SELECT MAX(CRHST.CURRDATE) + FROM CURRENCYHISTORY_V1 AS CRHST + WHERE CRHST.CURRENCYID = c.CURRENCYID + ) where p.PAYEENAME = 'Payee1' and t.TRANSCODE='Withdrawal' and t.STATUS NOT IN ('D', 'V') diff --git a/PayeeTrend/template.htt b/PayeeTrend/template.htt index d891c48..2d6ca0c 100644 --- a/PayeeTrend/template.htt +++ b/PayeeTrend/template.htt @@ -1,5 +1,4 @@ - @@ -9,14 +8,14 @@
-

Payee Trend Report (Payee 1)

-

+

Payee Trend Report ()

+

Report Date:

ColorPayee NameColorPayee Name Date Amount Base Amount
- +
 

All figures in base currency:

@@ -39,22 +38,26 @@ - - - - - - - - - - - - + + + + + + + + + + + + -
">
+ + +

All figures in base currency:

+ +
@@ -71,14 +74,16 @@ 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 = "" + currency(elements[i].innerHTML) + "";} + var elements= document.getElementsByClassName("accounting"); + for (var i = 0; i < elements.length; i++) {elements[i].innerHTML = currency(elements[i].innerHTML);} var data = { - labels : ["January","February","March","April","May","June","July", + labels: ["January","February","March","April","May","June","July", "August","September","October","November","December"], datasets: [ { - title: , + title: "", fillColor: "rgba(255,255,255,0)", strokeColor: "", pointColor: "", @@ -89,8 +94,9 @@ ] } + var options={legend:true, scaleLineWidth:1, responsive:true} var ctx = document.getElementById("reportChart").getContext("2d"); - var reportChart = new Chart(ctx).Line(data); + var reportChart = new Chart(ctx).Line(data, options); From 2e896c26888d9a7a7c17372de53cf5b7c3bfb380 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:11:25 +0400 Subject: [PATCH 30/49] Income vs Expenses TX - New Report New report showing same as built-in but for multiple years. --- .../description.txt | 25 +++++ .../luacontent.lua | 46 +++++++++ .../sqlcontent.sql | 50 ++++++++++ .../template.htt | 94 +++++++++++++++++++ 4 files changed, 215 insertions(+) create mode 100644 Income_vs_Expenses_Transactions_By_Year/description.txt create mode 100644 Income_vs_Expenses_Transactions_By_Year/luacontent.lua create mode 100644 Income_vs_Expenses_Transactions_By_Year/sqlcontent.sql create mode 100644 Income_vs_Expenses_Transactions_By_Year/template.htt diff --git a/Income_vs_Expenses_Transactions_By_Year/description.txt b/Income_vs_Expenses_Transactions_By_Year/description.txt new file mode 100644 index 0000000..617765b --- /dev/null +++ b/Income_vs_Expenses_Transactions_By_Year/description.txt @@ -0,0 +1,25 @@ +

Income vs. Expenses Comparison by Year

+

This report totals all the Deposit and Withdrawal transactions and provides totals per Year.
+When imported, the report will show years 2015-2020 (where there at least one transaction in the year) and will collate results as per Calendar year.
+The report is shown in the base currency, converting all non-base currency values to base currency using the MMEX setting Convert to Base Rate value on the currency.

+

The report can be adjusted for the year(s) of interest and provide results for either Calendar year or Financial Year.

+

As defaulted on import:
+

    +
  • Display years 2015-2020, if you wish to change the years displayed, then change line 44 in the SQL.
  • +
  • Uses Calendar year (Jan-01 to Dec-31). Should you need the report to show Financial year, then change line 20 in the SQL.
  • +
    +
    "SELECT 'YEAR' AS yeartype,"
    +
    - This will set the results to Calendar year (Jan-01 to Dec-31)
    +
    "SELECT 'FIN_YEAR' AS yeartype,"
    +
    - This will set the results to Financial year. The exact dates of the financial year are read from the MMEX options settings
    +
    +
+

+
    +
  • ✅ Converts all transaction amounts into Base Currency, using the Transactions's Account and the Conversion to Base Rate value on the currency record.
  • +
  • ✅ Ignores transactions marked as Void (V) or Duplicate (D).
  • +
  • ✅ Ignores Transfer type transactions.
  • +
  • ✅ Uses the MMEX Options for the Financial year start month and day when yeartype set to "FIN_YEAR".
  • +
+
+

For MMEX v1.3.3. DB v7

\ No newline at end of file diff --git a/Income_vs_Expenses_Transactions_By_Year/luacontent.lua b/Income_vs_Expenses_Transactions_By_Year/luacontent.lua new file mode 100644 index 0000000..af49242 --- /dev/null +++ b/Income_vs_Expenses_Transactions_By_Year/luacontent.lua @@ -0,0 +1,46 @@ +local gdata=''; +local gdataincome=''; +local gdataexpense=''; +local gdatadiff='' +local glabels=''; +local yeartype='' +local initialized=0; + +local titles = {'Income','Expenses','Difference'} -- don't change the order +local colors = {"#66FFB2","#FF6666","#66B2FF"}; -- alter colours if you desire + +function handle_record(record) + if (initialized==0) then + yeartype=record:get('YEARTYPE'); + initialized=1; + end + local diff=record:get('INCOME') - record:get('EXPENSE') + record:set('DIFFERENCE', diff) + -- Labels + if (glabels:len() > 0) then + glabels=glabels .. ','; + gdataincome=gdataincome .. ','; + gdataexpense=gdataexpense .. ','; + gdatadiff=gdatadiff .. ','; + end + glabels=glabels .. '"' .. tostring(record:get('YEAR')) .. '"'; + gdataincome=gdataincome .. tostring(record:get('INCOME')); + gdataexpense=gdataexpense .. tostring(record:get('EXPENSE')); + gdatadiff=gdatadiff .. tostring(diff); +end + +function complete(result) + local gformatting='{fillColor:"",strokeColor:"", data:[' + local gtitles='],title:"' + result:set('GLABELS', glabels); + gdata=gformatting:gsub('',colors[1]) .. tostring(gdataincome) .. gtitles .. titles[1] .. '"}' + gdata=gdata .. ',' .. gformatting:gsub('',colors[2]) .. tostring(gdataexpense) .. gtitles .. titles[2] .. '"}' + gdata=gdata .. ',' .. gformatting:gsub('',colors[3]) .. tostring(gdatadiff) .. gtitles .. titles[3] .. '"}' + result:set('CHART_DATA', gdata); + + if (yeartype=='FIN_YEAR') then + result:set('YEAR_TYPE', 'Finanical Year'); + else + result:set('YEAR_TYPE', 'Calendar Year'); + end +end \ No newline at end of file diff --git a/Income_vs_Expenses_Transactions_By_Year/sqlcontent.sql b/Income_vs_Expenses_Transactions_By_Year/sqlcontent.sql new file mode 100644 index 0000000..2d9f477 --- /dev/null +++ b/Income_vs_Expenses_Transactions_By_Year/sqlcontent.sql @@ -0,0 +1,50 @@ +SELECT tx_yr_data.yeartype as YEARTYPE, + tx_yr_data.year as YEAR, + sum(tx_yr_data.income) AS INCOME, + sum(tx_yr_data.expense) AS EXPENSE + FROM ( + SELECT yeartype as yeartype, + CASE yeartype + WHEN 'FIN_YEAR' + THEN CASE WHEN ( (CAST (strftime('%m', transdate) AS INTEGER) < fin_yr_mth) OR + (CAST (strftime('%m', transdate) AS INTEGER) = fin_yr_mth AND + CAST (strftime('%d', transdate) AS INTEGER) < fin_yr_day) ) + THEN tx_data.year - 1 + ELSE tx_data.year + END + ELSE tx_data.year + END AS YEAR, + tx_data.income AS income, + tx_data.expense AS expense + FROM (/* change SELECT 'YEAR' to SELECT 'FINYEAR' if you want financial years based on settings for financial year start month & day from MMEX options, keep as SELECT 'YEAR' for normal years Jan-01 to Dec-31 */ + SELECT 'YEAR' AS yeartype, -- values are 'YEAR' or 'FIN_YEAR' + CA.transdate AS transdate, + CAST (strftime('%Y', transdate) AS INTEGER) AS year, + CASE WHEN ca.transcode = 'Deposit' THEN ROUND(CA.TRANSAMOUNT * cf.baseconvrate, 2) ELSE 0 END AS income, + CASE WHEN ca.transcode = 'Withdrawal' THEN ROUND(CA.TRANSAMOUNT * cf.baseconvrate, 2) ELSE 0 END AS expense, + CAST ( ( + SELECT it1.infovalue + FROM infotable_v1 AS it1 + WHERE IT1.infoname = 'FINANCIAL_YEAR_START_MONTH' + ) + AS INTERGER) AS fin_yr_mth, + CAST ( ( + SELECT it2.infovalue + FROM infotable_v1 AS it2 + WHERE IT2.infoname = 'FINANCIAL_YEAR_START_DAY' + ) + AS INTEGER) AS fin_yr_day + FROM checkingaccount_v1 AS ca + INNER JOIN + accountlist_v1 AS acc ON acc.accountid = ca.accountid + INNER JOIN + currencyformats_v1 AS CF ON cf.currencyid = acc.currencyid + WHERE ca.status NOT IN ('D', 'V') AND + ca.transcode <> 'Transfer' AND + strftime('%Y', transdate) IN ('2015', '2016', '2017', '2018', '2019', '2020') -- change the years to those you're interested in, note the yeartype flag above. + ) + AS tx_data + ) + tx_yr_data + GROUP BY tx_yr_data.year, tx_yr_data.yeartype + ORDER BY tx_yr_data.year ASC; diff --git a/Income_vs_Expenses_Transactions_By_Year/template.htt b/Income_vs_Expenses_Transactions_By_Year/template.htt new file mode 100644 index 0000000..9ec1897 --- /dev/null +++ b/Income_vs_Expenses_Transactions_By_Year/template.htt @@ -0,0 +1,94 @@ + + + + + + <TMPL_VAR REPORTNAME> + + + + + +
+

()

+

+ Report Date: + +

+
+
+
+
+ + + +
+ +

All values in base currency .

+
+ + + + + + + + + + + + + + + + + + + +
YearIncomeExpenseDifference
+ + + + + + + +
+ + + + + + + +

Error

+
+
+ + + \ No newline at end of file From b31f3d55c26ec3f913b8fe01038ee03f1f09d23a Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:12:18 +0400 Subject: [PATCH 31/49] DepositVsExpenses - use Chart legend Remove the legend js and use the options for legend. --- DepositVsExpensesAndLoanRepaymentByMonth/template.htt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/DepositVsExpensesAndLoanRepaymentByMonth/template.htt b/DepositVsExpensesAndLoanRepaymentByMonth/template.htt index 411a37f..5fca86a 100644 --- a/DepositVsExpensesAndLoanRepaymentByMonth/template.htt +++ b/DepositVsExpensesAndLoanRepaymentByMonth/template.htt @@ -136,11 +136,6 @@ var data={ ctx.canvas.width =document.getElementById("myChartParent").offsetWidth; var myNewChart=new Chart(ctx).Line(data,options); myNewChart.resize(); - - //then you just need to generate the legend - var legend=myNewChart.generateLegend(); - document.getElementById("legendDiv").innerHTML=legend; - } From ec6dfc6d7bfe472f9c3e2fb49ca542f3969736d4 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:13:33 +0400 Subject: [PATCH 32/49] CurrencySummary - graph legend and fixes. - Correct graph value titles (from color) - add legend to graph - format description.txt --- CurrencySummary/description.txt | 4 ++-- CurrencySummary/luacontent.lua | 5 +---- CurrencySummary/template.htt | 28 +++++++++++++--------------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CurrencySummary/description.txt b/CurrencySummary/description.txt index be6e040..4bfa0fd 100644 --- a/CurrencySummary/description.txt +++ b/CurrencySummary/description.txt @@ -1,8 +1,8 @@

Used Currency Summary Report

Lists all currencies used in 'Open' Accounts

-
+

Currency Conversion Rate
This is the values from the 'Conversion to Base Rate' field on the Currency Record.
Note: This field will be depreciated in MMEX v1.4.x (DB v13), currency conversion will be done using the Currency History Options
Latest History Rate
This is the latest value from the 'Conversion to Base Rate' field on the Currency Record.
If no history values is set, then displayed '0.0000'.
-
\ No newline at end of file +

\ No newline at end of file diff --git a/CurrencySummary/luacontent.lua b/CurrencySummary/luacontent.lua index c2bef48..737d831 100644 --- a/CurrencySummary/luacontent.lua +++ b/CurrencySummary/luacontent.lua @@ -5,7 +5,4 @@ function handle_record(record) local color = colors[1 + (count % #colors)]; count = count + 1; record:set('COLOR', color); -end - -function complete(result) -end +end \ No newline at end of file diff --git a/CurrencySummary/template.htt b/CurrencySummary/template.htt index 1377ee1..910ab5b 100644 --- a/CurrencySummary/template.htt +++ b/CurrencySummary/template.htt @@ -19,12 +19,12 @@ - - - - - - + + + + + + @@ -100,18 +100,16 @@ var data = [ { - value: , - color: "", - label: "", - labelColor: "black", - labelFontSize: "12", - labelAlign: "center" + value:, + color:"", + title:"", + labelColor:"black", + labelFontSize:"12", + labelAlign:"center" } , ] - var options = { - animationEasing: 'easeOutQuint' - } + var options = {legend:true,animationEasing:'easeOutQuint'} var ctx = document.getElementById("reportChart").getContext("2d"); var reportChart = new Chart(ctx).Pie(data, options); From 2195d0b47943794c7ec13c6ec3364a5ce744301f Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:14:22 +0400 Subject: [PATCH 33/49] CateogriesStatLast12Month - fixes and tidy Fixes and tidy the report. --- CategoriesStatLast12Months/luacontent.lua | 10 ++- CategoriesStatLast12Months/sqlcontent.sql | 97 ++++++++++------------- CategoriesStatLast12Months/template.htt | 24 +++--- 3 files changed, 63 insertions(+), 68 deletions(-) diff --git a/CategoriesStatLast12Months/luacontent.lua b/CategoriesStatLast12Months/luacontent.lua index 394bf58..9d7c7c6 100644 --- a/CategoriesStatLast12Months/luacontent.lua +++ b/CategoriesStatLast12Months/luacontent.lua @@ -8,11 +8,13 @@ local colsDeposit = {["one"]=0, ["two"]=0, ["thr"]=0 , ["fou"]=0, ["fiv"]=0, ["s function handle_record(record) grandTotal = grandTotal + record:get('OVERALL'); for key, value in pairs(cols) do + withdrawAmount=record:get("WITH_" .. key); + depositAmount=record:get("DEP_" .. key); cols[key] = cols[key] + record:get(key); - colsWithdraw[key] = colsWithdraw[key] + record:get("WITH_" .. key); - colsDeposit[key] = colsDeposit[key] + record:get("DEP_" .. key); - TotalWithdraw = TotalWithdraw + record:get("WITH_" .. key); - TotalDeposit = TotalDeposit + record:get("DEP_" .. key); + colsWithdraw[key] = colsWithdraw[key] + withdrawAmount; + colsDeposit[key] = colsDeposit[key] + depositAmount; + TotalWithdraw = TotalWithdraw + withdrawAmount; + TotalDeposit = TotalDeposit + depositAmount; end end diff --git a/CategoriesStatLast12Months/sqlcontent.sql b/CategoriesStatLast12Months/sqlcontent.sql index c4e8f4c..347cf25 100644 --- a/CategoriesStatLast12Months/sqlcontent.sql +++ b/CategoriesStatLast12Months/sqlcontent.sql @@ -1,55 +1,48 @@ SELECT CASE t.subcateg WHEN -1 THEN ca.categname ELSE ca.categname || ':' || sc.subcategname END as category, - t.transid as transid, - t.categ as categ, - total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime') ) WHEN month THEN amount END) AS twe, - total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime') ) WHEN month THEN amount END) AS ele, - total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime') ) WHEN month THEN amount END) AS ten, - total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime') ) WHEN month THEN amount END) AS nin, - total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime') ) WHEN month THEN amount END) AS egh, - total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime') ) WHEN month THEN amount END) AS sev, - total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime') ) WHEN month THEN amount END) AS six, - total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime') ) WHEN month THEN amount END) AS fiv, - total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime') ) WHEN month THEN amount END) AS fou, - total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime') ) WHEN month THEN amount END) AS thr, - total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime') ) WHEN month THEN amount END) AS two, - total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime') ) WHEN month THEN amount END) AS one, - total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_twe, - total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_ele, - total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_ten, - total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_nin, - total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_egh, - total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_sev, - total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_six, - total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_fiv, - total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_fou, - total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_thr, - total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_two, - total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime') ) WHEN month THEN amountWithdraw END) AS WITH_one, - total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_twe, - total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_ele, - total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_ten, - total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_nin, - total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_egh, - total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_sev, - total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_six, - total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_fiv, - total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_fou, - total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_thr, - total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_two, - total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime') ) WHEN month THEN amountDeposit END) AS DEP_one, + total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime')) WHEN month THEN amount END) AS twe, + total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime')) WHEN month THEN amount END) AS ele, + total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime')) WHEN month THEN amount END) AS ten, + total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime')) WHEN month THEN amount END) AS nin, + total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime')) WHEN month THEN amount END) AS egh, + total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime')) WHEN month THEN amount END) AS sev, + total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime')) WHEN month THEN amount END) AS six, + total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime')) WHEN month THEN amount END) AS fiv, + total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime')) WHEN month THEN amount END) AS fou, + total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime')) WHEN month THEN amount END) AS thr, + total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime')) WHEN month THEN amount END) AS two, + total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime')) WHEN month THEN amount END) AS one, + total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_twe, + total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_ele, + total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_ten, + total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_nin, + total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_egh, + total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_sev, + total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_six, + total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_fiv, + total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_fou, + total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_thr, + total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_two, + total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime')) WHEN month THEN amountWithdraw END) AS WITH_one, + total(CASE strftime('%m', date('now', 'start of month', '-11 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_twe, + total(CASE strftime('%m', date('now', 'start of month', '-10 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_ele, + total(CASE strftime('%m', date('now', 'start of month', '-9 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_ten, + total(CASE strftime('%m', date('now', 'start of month', '-8 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_nin, + total(CASE strftime('%m', date('now', 'start of month', '-7 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_egh, + total(CASE strftime('%m', date('now', 'start of month', '-6 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_sev, + total(CASE strftime('%m', date('now', 'start of month', '-5 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_six, + total(CASE strftime('%m', date('now', 'start of month', '-4 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_fiv, + total(CASE strftime('%m', date('now', 'start of month', '-3 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_fou, + total(CASE strftime('%m', date('now', 'start of month', '-2 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_thr, + total(CASE strftime('%m', date('now', 'start of month', '-1 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_two, + total(CASE strftime('%m', date('now', 'start of month', '-0 month', 'localtime')) WHEN month THEN amountDeposit END) AS DEP_one, total(amount) AS OVERALL FROM ( SELECT strftime('%m', TRANSDATE) AS month, - c.transid as transid, - IFNULL(CH.CURRVALUE, CF.BASECONVRATE) AS CURRVALUE, - c.accountid as accountid, - c.transcode as transcode, CASE ifnull(c.categid, -1) WHEN -1 THEN s.categid ELSE c.categid END AS categ, - CASE ifnull(c.subcategid, -1) WHEN -1 THEN ifnull(s.subcategid, -1) ELSE ifnull(c.subcategid, -1) END AS subcateg, - c.payeeid as payeeid, - sum( (CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN -IFNULL(CH.CURRVALUE, CF.BASECONVRATE) ELSE cf.BaseConvRate END) ) as amount, - sum( (CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN -IFNULL(CH.CURRVALUE, CF.BASECONVRATE) ELSE 0.00 END) ) as amountWithdraw, - sum( (CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN 0.00 ELSE IFNULL(CH.CURRVALUE, CF.BASECONVRATE) END) ) as amountDeposit + CASE ifnull(c.categid, -1) WHEN -1 THEN ifnull(s.subcategid, -1) ELSE ifnull(c.subcategid, -1) END AS subcateg, + sum((CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN -IFNULL(CH.CURRVALUE, CF.BASECONVRATE) ELSE cf.BaseConvRate END)) as amount, + sum((CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN -IFNULL(CH.CURRVALUE, CF.BASECONVRATE) ELSE 0.00 END)) as amountWithdraw, + sum((CASE c.categid WHEN -1 THEN splittransamount ELSE transamount END) * (CASE transcode WHEN 'Withdrawal' THEN 0.00 ELSE IFNULL(CH.CURRVALUE, CF.BASECONVRATE) END)) as amountDeposit FROM checkingaccount_v1 c LEFT JOIN splittransactions_v1 s ON s.transid = c.transid @@ -66,18 +59,16 @@ SELECT CASE t.subcateg WHEN -1 THEN ca.categname ELSE ca.categname || ':' || sc. ) WHERE transcode != 'Transfer' AND c.status NOT IN ('V', 'D') AND - ac.status != 'Closed' AND + ac.status = 'Open' AND (date('now', 'start of month', '-11 month', 'localtime') <= transdate AND - transdate < date('now', 'start of month', '+1 month', 'localtime') ) + transdate < date('now', 'start of month', '+1 month', 'localtime')) GROUP BY month, categ, subcateg - ) - t + ) AS t LEFT JOIN category_v1 ca ON ca.categid = t.categ LEFT JOIN - subcategory_v1 sc ON sc.categid = t.categ AND - sc.subcategid = t.subcateg + subcategory_v1 sc ON sc.categid = t.categ AND sc.subcategid = t.subcateg GROUP BY category ORDER BY category asc; diff --git a/CategoriesStatLast12Months/template.htt b/CategoriesStatLast12Months/template.htt index e41fa56..fb94297 100644 --- a/CategoriesStatLast12Months/template.htt +++ b/CategoriesStatLast12Months/template.htt @@ -20,22 +20,25 @@
-

_Title_

+
-
-
-
-
Currency NameSymbolNo. of AccountsCurrency Conversion RateLatest History RateDisplay FormatCurrency NameSymbolNo. of AccountsCurrency Conversion RateLatest History RateDisplay Format
- - -
yyyy
yyyy
- +
+
+ + + + + + +
All figures in base currency:
yyyy
yyyy
+
+ @@ -128,10 +131,9 @@
-
+
- \ No newline at end of file From ee2517d13544d2faf59a7a9081a4499ad59a2aa6 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Sun, 14 Apr 2019 15:13:55 +0400 Subject: [PATCH 36/49] updates for travis test Check_gm.py - now includes traceback for more informative error reporting - opens files in read text mode (binary was failing) and force encoding utf-8 tables_v1.sql - copy the file from v7 release as CURRENCYHISTORY_V1 table (and other DB changes) are not in the file in master repository --- check_gm.py | 14 +- tables_v1.sql | 362 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 346 insertions(+), 30 deletions(-) diff --git a/check_gm.py b/check_gm.py index 6e04f87..7cec7b2 100755 --- a/check_gm.py +++ b/check_gm.py @@ -2,22 +2,23 @@ # vi:tabstop=4:expandtab:shiftwidth=4:softtabstop=4:autoindent:smarttab import os +import traceback import sqlite3 def check(curs, report): - print 'checking %s' % report + print ('checking %s' % report) sql = '' - for line in open(os.path.join(report, 'sqlcontent.sql'), 'rb'): + for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): sql = sql + line curs.execute(sql) - print 'done %s' % report + print ('done %s' % report) if __name__ == '__main__': conn = sqlite3.connect(':memory:') conn.row_factory = sqlite3.Row curs = conn.cursor() sql = '' - for line in open('tables_v1.sql', 'rb'): + for line in open('tables_v1.sql', mode='r', encoding='utf-8'): sql = sql + line curs.executescript(sql) @@ -28,11 +29,12 @@ def check(curs, report): try: check(curs, report) except: - print 'ERR: %s' % report + print(traceback.print_exc()) + print ('ERR: %s' % report) conn.close() if anyNotPassed: exit(1) - exit(0) + # exit(0) \ No newline at end of file diff --git a/tables_v1.sql b/tables_v1.sql index baa468c..3254ad9 100644 --- a/tables_v1.sql +++ b/tables_v1.sql @@ -2,43 +2,49 @@ CREATE TABLE ACCOUNTLIST_V1( ACCOUNTID integer primary key , ACCOUNTNAME TEXT COLLATE NOCASE NOT NULL UNIQUE -, ACCOUNTTYPE TEXT NOT NULL +, ACCOUNTTYPE TEXT NOT NULL /* Checking, Term, Investment, Credit Card */ , ACCOUNTNUM TEXT -, STATUS TEXT NOT NULL -, NOTES TEXT -, HELDAT TEXT -, WEBSITE TEXT +, STATUS TEXT NOT NULL /* Open, Closed */ +, NOTES TEXT +, HELDAT TEXT +, WEBSITE TEXT , CONTACTINFO TEXT -, ACCESSINFO TEXT -, INITIALBAL numeric +, ACCESSINFO TEXT +, INITIALBAL numeric , FAVORITEACCT TEXT NOT NULL , CURRENCYID integer NOT NULL +, STATEMENTLOCKED integer +, STATEMENTDATE TEXT +, MINIMUMBALANCE numeric +, CREDITLIMIT numeric +, INTERESTRATE numeric +, PAYMENTDUEDATE text +, MINIMUMPAYMENT numeric ); CREATE INDEX IDX_ACCOUNTLIST_ACCOUNTTYPE ON ACCOUNTLIST_V1(ACCOUNTTYPE); -- Describe ASSETS_V1 CREATE TABLE ASSETS_V1( ASSETID integer primary key -, STARTDATE TEXT NOT NULL +, STARTDATE TEXT NOT NULL , ASSETNAME TEXT COLLATE NOCASE NOT NULL , VALUE numeric -, VALUECHANGE TEXT +, VALUECHANGE TEXT /* None, Appreciates, Depreciates */ , NOTES TEXT , VALUECHANGERATE numeric -, ASSETTYPE TEXT +, ASSETTYPE TEXT /* Property, Automobile, Household Object, Art, Jewellery, Cash, Other */ ); CREATE INDEX IDX_ASSETS_ASSETTYPE ON ASSETS_V1(ASSETTYPE); - -- Describe BILLSDEPOSITS_V1 CREATE TABLE BILLSDEPOSITS_V1( BDID integer primary key , ACCOUNTID integer NOT NULL , TOACCOUNTID integer , PAYEEID integer NOT NULL -, TRANSCODE TEXT NOT NULL +, TRANSCODE TEXT NOT NULL /* Withdrawal, Deposit, Transfer */ , TRANSAMOUNT numeric NOT NULL -, STATUS TEXT +, STATUS TEXT /* None, Reconciled, Void, Follow up, Duplicate */ , TRANSACTIONNUMBER TEXT , NOTES TEXT , CATEGID integer @@ -48,7 +54,7 @@ BDID integer primary key , TOTRANSAMOUNT numeric , REPEATS integer , NEXTOCCURRENCEDATE TEXT -, NUMOCCURRENCES integer +, NUMOCCURRENCES integer ); CREATE INDEX IDX_BILLSDEPOSITS_ACCOUNT ON BILLSDEPOSITS_V1 (ACCOUNTID, TOACCOUNTID); @@ -68,7 +74,7 @@ BUDGETENTRYID integer primary key , BUDGETYEARID integer , CATEGID integer , SUBCATEGID integer -, PERIOD TEXT NOT NULL +, PERIOD TEXT NOT NULL /* None, Weekly, Bi-Weekly, Monthly, Monthly, Bi-Monthly, Quarterly, Half-Yearly, Yearly, Daily*/ , AMOUNT numeric NOT NULL ); CREATE INDEX IDX_BUDGETTABLE_BUDGETYEARID ON BUDGETTABLE_V1(BUDGETYEARID); @@ -87,6 +93,25 @@ CATEGID integer primary key ); CREATE INDEX IDX_CATEGORY_CATEGNAME ON CATEGORY_V1(CATEGNAME); +-- Note: All strings requiring translation are prefix by: '_tr_' +-- The _tr_ prefix is removed when generating .h files by sqlite2cpp.py +-- strings containing unicode should not be translated. +INSERT INTO CATEGORY_V1 VALUES(1,'_tr_Bills'); +INSERT INTO CATEGORY_V1 VALUES(2,'_tr_Food'); +INSERT INTO CATEGORY_V1 VALUES(3,'_tr_Leisure'); +INSERT INTO CATEGORY_V1 VALUES(4,'_tr_Automobile'); +INSERT INTO CATEGORY_V1 VALUES(5,'_tr_Education'); +INSERT INTO CATEGORY_V1 VALUES(6,'_tr_Homeneeds'); +INSERT INTO CATEGORY_V1 VALUES(7,'_tr_Healthcare'); +INSERT INTO CATEGORY_V1 VALUES(8,'_tr_Insurance'); +INSERT INTO CATEGORY_V1 VALUES(9,'_tr_Vacation'); +INSERT INTO CATEGORY_V1 VALUES(10,'_tr_Taxes'); +INSERT INTO CATEGORY_V1 VALUES(11,'_tr_Miscellaneous'); +INSERT INTO CATEGORY_V1 VALUES(12,'_tr_Gifts'); +INSERT INTO CATEGORY_V1 VALUES(13,'_tr_Income'); +INSERT INTO CATEGORY_V1 VALUES(14,'_tr_Other Income'); +INSERT INTO CATEGORY_V1 VALUES(15,'_tr_Other Expenses'); +INSERT INTO CATEGORY_V1 VALUES(16,'_tr_Transfer'); -- Describe CHECKINGACCOUNT_V1 CREATE TABLE CHECKINGACCOUNT_V1( @@ -94,9 +119,9 @@ TRANSID integer primary key , ACCOUNTID integer NOT NULL , TOACCOUNTID integer , PAYEEID integer NOT NULL -, TRANSCODE TEXT NOT NULL +, TRANSCODE TEXT NOT NULL /* Withdrawal, Deposit, Transfer */ , TRANSAMOUNT numeric NOT NULL -, STATUS TEXT +, STATUS TEXT /* None, Reconciled, Void, Follow up, Duplicate */ , TRANSACTIONNUMBER TEXT , NOTES TEXT , CATEGID integer @@ -108,6 +133,16 @@ TRANSID integer primary key CREATE INDEX IDX_CHECKINGACCOUNT_ACCOUNT ON CHECKINGACCOUNT_V1 (ACCOUNTID, TOACCOUNTID); CREATE INDEX IDX_CHECKINGACCOUNT_TRANSDATE ON CHECKINGACCOUNT_V1 (TRANSDATE); +-- Describe CURRENCYHISTORY_V1 +CREATE TABLE CURRENCYHISTORY_V1( +CURRHISTID INTEGER PRIMARY KEY +, CURRENCYID INTEGER NOT NULL +, CURRDATE TEXT NOT NULL +, CURRVALUE NUMERIC NOT NULL +, CURRUPDTYPE INTEGER +, UNIQUE(CURRENCYID, CURRDATE) +); +CREATE INDEX IDX_CURRENCYHISTORY_CURRENCYID_CURRDATE ON CURRENCYHISTORY_V1(CURRENCYID, CURRDATE); -- Describe CURRENCYFORMATS_V1 CREATE TABLE CURRENCYFORMATS_V1( @@ -125,6 +160,162 @@ CURRENCYID integer primary key ); CREATE INDEX IDX_CURRENCYFORMATS_SYMBOL ON CURRENCYFORMATS_V1(CURRENCY_SYMBOL); +-- Note: All strings requiring translation are prefix by: '_tr_' +-- The _tr_ prefix is removed when generating .h files by sqlite2cpp.py +-- strings containing unicode should not be translated. +INSERT INTO CURRENCYFORMATS_V1 VALUES(1,'_tr_United States dollar','$','','.',' ','','',100,1,'USD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(2,'_tr_European euro','€','','.',' ','','',100,1,'EUR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(3,'_tr_UK Pound','£','','.',' ','Pound','Pence',100,1,'GBP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(4,'_tr_Russian Ruble','','р',',',' ','руб.','коп.',100,1,'RUB'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(5,'_tr_Ukrainian hryvnia','₴','',',',' ','','',100,1,'UAH'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(6,'_tr_Afghan afghani','؋','','.',' ','','pul',100,1,'AFN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(7,'_tr_Albanian lek','','L','.',' ','','',1,1,'ALL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(8,'_tr_Algerian dinar','دج','','.',' ','','',100,1,'DZD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(9,'_tr_Angolan kwanza','','Kz','.',' ','','Céntimo',100,1,'AOA'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(10,'_tr_East Caribbean dollar','EC$','','.',' ','','',100,1,'XCD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(11,'_tr_Argentine peso','AR$','',',','.','','centavo',100,1,'ARS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(12,'_tr_Armenian dram','','','.',' ','','',1,1,'AMD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(13,'_tr_Aruban florin','ƒ','','.',' ','','',100,1,'AWG'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(14,'_tr_Australian dollar','$','','.',',','','',100,1,'AUD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(15,'_tr_Azerbaijani manat','','','.',' ','','',100,1,'AZN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(16,'_tr_Bahamian dollar','B$','','.',' ','','',100,1,'BSD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(17,'_tr_Bahraini dinar','','','.',' ','','',100,1,'BHD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(18,'_tr_Bangladeshi taka','','','.',' ','','',100,1,'BDT'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(19,'_tr_Barbadian dollar','Bds$','','.',' ','','',100,1,'BBD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(20,'_tr_Belarusian ruble','Br','',',',' ','','',1,1,'BYR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(21,'_tr_Belize dollar','BZ$','','.',' ','','',100,1,'BZD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(22,'_tr_West African CFA franc','CFA','','.',' ','','',100,1,'XOF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(23,'_tr_Bermudian dollar','BD$','','.',' ','','',100,1,'BMD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(24,'_tr_Bhutanese ngultrum','Nu.','','.',' ','','',100,1,'BTN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(25,'_tr_Bolivian boliviano','Bs.','','.',' ','','',100,1,'BOB'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(26,'_tr_Bosnia and Herzegovina konvertibilna marka','KM','',',','.','','',100,1,'BAM'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(27,'_tr_Botswana pula','P','','.',' ','','',100,1,'BWP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(28,'_tr_Brazilian real','R$','','.',' ','','',100,1,'BRL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(29,'_tr_Brunei dollar','B$','','.',' ','','',100,1,'BND'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(30,'_tr_Bulgarian lev','','','.',' ','','',100,1,'BGN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(31,'_tr_Burundi franc','FBu','','.',' ','','',1,1,'BIF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(32,'_tr_Cambodian riel','','','.',' ','','',100,1,'KHR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(33,'_tr_Central African CFA franc','CFA','','.',' ','','',1,1,'XAF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(34,'_tr_Canadian dollar','$','','.',' ','','',100,1,'CAD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(35,'_tr_Cape Verdean escudo','Esc','','.',' ','','',100,1,'CVE'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(36,'_tr_Cayman Islands dollar','KY$','','.',' ','','',100,1,'KYD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(37,'_tr_Chilean peso','$','','.',' ','','',1,1,'CLP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(38,'_tr_Chinese renminbi','¥','','.',' ','','',100,1,'CNY'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(39,'_tr_Colombian peso','Col$','','.',' ','','',100,1,'COP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(40,'_tr_Comorian franc','','','.',' ','','',1,1,'KMF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(41,'_tr_Congolese franc','F','','.',' ','','',100,1,'CDF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(42,'_tr_Costa Rican colon','₡','','.',' ','','',1,1,'CRC'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(43,'_tr_Croatian kuna','kn','','.',' ','','',100,1,'HRK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(44,'_tr_Czech koruna','Kč','','.',' ','','',100,1,'CZK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(45,'_tr_Danish krone','Kr','','.',' ','','',100,1,'DKK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(46,'_tr_Djiboutian franc','Fdj','','.',' ','','',1,1,'DJF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(47,'_tr_Dominican peso','RD$','','.',' ','','',100,1,'DOP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(48,'_tr_Egyptian pound','£','','.',' ','','',100,1,'EGP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(49,'_tr_Eritrean nakfa','Nfa','','.',' ','','',100,1,'ERN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(50,'_tr_Ethiopian birr','Br','','.',' ','','',100,1,'ETB'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(51,'_tr_Falkland Islands pound','£','','.',' ','','',100,1,'FKP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(52,'_tr_Fijian dollar','FJ$','','.',' ','','',100,1,'FJD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(53,'_tr_CFP franc','F','','.',' ','','',100,1,'XPF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(54,'_tr_Gambian dalasi','D','','.',' ','','',100,1,'GMD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(55,'_tr_Georgian lari','','','.',' ','','',100,1,'GEL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(56,'_tr_Ghanaian cedi','','','.',' ','','',100,1,'GHS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(57,'_tr_Gibraltar pound','£','','.',' ','','',100,1,'GIP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(58,'_tr_Guatemalan quetzal','Q','','.',' ','','',100,1,'GTQ'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(59,'_tr_Guinean franc','FG','','.',' ','','',1,1,'GNF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(60,'_tr_Guyanese dollar','GY$','','.',' ','','',100,1,'GYD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(61,'_tr_Haitian gourde','G','','.',' ','','',100,1,'HTG'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(62,'_tr_Honduran lempira','L','','.',' ','','',100,1,'HNL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(63,'_tr_Hong Kong dollar','HK$','','.',' ','','',100,1,'HKD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(64,'_tr_Hungarian forint','Ft','','.',' ','','',1,1,'HUF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(65,'Icelandic króna','kr','','.',' ','','',1,1,'ISK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(66,'_tr_Indian rupee','₹','','.',' ','','',100,1,'INR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(67,'_tr_Indonesian rupiah','Rp','','.',' ','','',1,1,'IDR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(68,'_tr_Special Drawing Rights','SDR','','.',' ','','',100,1,'XDR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(69,'_tr_Iranian rial','','','.',' ','','',1,1,'IRR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(70,'_tr_Iraqi dinar','','','.',' ','','',1,1,'IQD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(71,'_tr_Israeli new shekel','₪','','.',' ','','',100,1,'ILS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(72,'_tr_Jamaican dollar','J$','','.',' ','','',100,1,'JMD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(73,'_tr_Japanese yen','¥','','.',' ','','',1,1,'JPY'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(74,'_tr_Jordanian dinar','','','.',' ','','',100,1,'JOD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(75,'_tr_Kazakhstani tenge','T','','.',' ','','',100,1,'KZT'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(76,'_tr_Kenyan shilling','KSh','','.',' ','','',100,1,'KES'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(77,'_tr_North Korean won','W','','.',' ','','',100,1,'KPW'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(78,'_tr_South Korean won','W','','.',' ','','',1,1,'KRW'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(79,'_tr_Kuwaiti dinar','','','.',' ','','',100,1,'KWD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(80,'_tr_Kyrgyzstani som','','','.',' ','','',100,1,'KGS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(81,'_tr_Lao kip','KN','','.',' ','','',100,1,'LAK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(82,'_tr_Latvian lats','Ls','','.',' ','','',100,1,'LVL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(83,'_tr_Lebanese lira','','','.',' ','','',1,1,'LBP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(84,'_tr_Lesotho loti','M','','.',' ','','',100,1,'LSL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(85,'_tr_Liberian dollar','L$','','.',' ','','',100,1,'LRD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(86,'_tr_Libyan dinar','LD','','.',' ','','',100,1,'LYD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(87,'_tr_Lithuanian litas','Lt','','.',' ','','',100,1,'LTL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(88,'_tr_Macanese pataca','P','','.',' ','','',100,1,'MOP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(89,'_tr_Macedonian denar','','','.',' ','','',100,1,'MKD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(90,'_tr_Malagasy ariary','FMG','','.',' ','','',100,1,'MGA'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(91,'_tr_Malawian kwacha','MK','','.',' ','','',1,1,'MWK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(92,'_tr_Malaysian ringgit','RM','','.',' ','','',100,1,'MYR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(93,'_tr_Maldivian rufiyaa','Rf','','.',' ','','',100,1,'MVR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(94,'_tr_Mauritanian ouguiya','UM','','.',' ','','',100,1,'MRO'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(95,'_tr_Mauritian rupee','Rs','','.',' ','','',1,1,'MUR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(96,'_tr_Mexican peso','$','','.',' ','','',100,1,'MXN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(97,'_tr_Moldovan leu','','','.',' ','','',100,1,'MDL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(98,'_tr_Mongolian tugrik','₮','','.',' ','','',100,1,'MNT'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(99,'_tr_Moroccan dirham','','','.',' ','','',100,1,'MAD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(100,'_tr_Myanma kyat','K','','.',' ','','',1,1,'MMK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(101,'_tr_Namibian dollar','N$','','.',' ','','',100,1,'NAD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(102,'_tr_Nepalese rupee','NRs','','.',' ','','',100,1,'NPR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(103,'_tr_Netherlands Antillean gulden','NAƒ','','.',' ','','',100,1,'ANG'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(104,'_tr_New Zealand dollar','NZ$','','.',' ','','',100,1,'NZD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(105,'Nicaraguan córdoba','C$','','.',' ','','',100,1,'NIO'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(106,'_tr_Nigerian naira','₦','','.',' ','','',100,1,'NGN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(107,'_tr_Norwegian krone','kr','','.',' ','','',100,1,'NOK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(108,'_tr_Omani rial','','','.',' ','','',100,1,'OMR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(109,'_tr_Pakistani rupee','Rs.','','.',' ','','',1,1,'PKR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(110,'_tr_Panamanian balboa','B./','','.',' ','','',100,1,'PAB'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(111,'_tr_Papua New Guinean kina','K','','.',' ','','',100,1,'PGK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(112,'_tr_Paraguayan guarani','','','.',' ','','',1,1,'PYG'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(113,'_tr_Peruvian nuevo sol','S/.','','.',' ','','',100,1,'PEN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(114,'_tr_Philippine peso','₱','','.',' ','','',100,1,'PHP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(115,'_tr_Polish zloty','','zł',',','.','złoty','grosz',100,1,'PLN'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(116,'_tr_Qatari riyal','QR','','.',' ','','',100,1,'QAR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(117,'_tr_Romanian leu','L','','.',' ','','',100,1,'RON'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(118,'_tr_Rwandan franc','RF','','.',' ','','',1,1,'RWF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(119,'São Tomé and Príncipe dobra','Db','','.',' ','','',100,1,'STD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(120,'_tr_Saudi riyal','SR','','.',' ','','',100,1,'SAR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(121,'_tr_Serbian dinar','din.','','.',' ','','',1,1,'RSD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(122,'_tr_Seychellois rupee','SR','','.',' ','','',100,1,'SCR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(123,'_tr_Sierra Leonean leone','Le','','.',' ','','',100,1,'SLL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(124,'_tr_Singapore dollar','S$','','.',' ','','',100,1,'SGD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(125,'_tr_Solomon Islands dollar','SI$','','.',' ','','',100,1,'SBD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(126,'_tr_Somali shilling','Sh.','','.',' ','','',1,1,'SOS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(127,'_tr_South African rand','R','','.',' ','','',100,1,'ZAR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(128,'_tr_Sri Lankan rupee','Rs','','.',' ','','',100,1,'LKR'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(129,'_tr_Saint Helena pound','£','','.',' ','','',100,1,'SHP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(130,'_tr_Sudanese pound','','','.',' ','','',100,1,'SDG'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(131,'_tr_Surinamese dollar','$','','.',' ','','',100,1,'SRD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(132,'_tr_Swazi lilangeni','E','','.',' ','','',100,1,'SZL'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(133,'_tr_Swedish krona','kr','','.',' ','','',100,1,'SEK'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(134,'_tr_Swiss franc','Fr.','','.',' ','','',100,1,'CHF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(135,'_tr_Syrian pound','','','.',' ','','',1,1,'SYP'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(136,'_tr_New Taiwan dollar','NT$','','.',' ','','',100,1,'TWD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(137,'_tr_Tajikistani somoni','','','.',' ','','',100,1,'TJS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(138,'_tr_Tanzanian shilling','','','.',' ','','',1,1,'TZS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(139,'_tr_Thai baht','฿','','.',' ','','',100,1,'THB'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(140,'_tr_Trinidad and Tobago dollar','TT$','','.',' ','','',100,1,'TTD'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(141,'_tr_Tunisian dinar','DT','','.',' ','','',100,1,'TND'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(142,'_tr_Turkish lira','₺','','.',' ','','',100,1,'TRY'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(143,'_tr_Turkmen manat','m','','.',' ','','',100,1,'TMT'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(144,'_tr_Ugandan shilling','USh','','.',' ','','',1,1,'UGX'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(145,'_tr_UAE dirham','','','.',' ','','',100,1,'AED'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(146,'_tr_Uruguayan peso','$U','','.',' ','','',100,1,'UYU'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(147,'_tr_Uzbekistani som','','','.',' ','','',1,1,'UZS'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(148,'_tr_Vanuatu vatu','VT','','.',' ','','',100,1,'VUV'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(149,'_tr_Vietnamese dong','₫','','.',' ','','',1,1,'VND'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(150,'_tr_Samoan tala','WS$','','.',' ','','',100,1,'WST'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(151,'_tr_Yemeni rial','','','.',' ','','',1,1,'YER'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(152,'Venezuelan Bolívar','Bs.','','.',',','bolívar','céntimos',100,1,'VEF'); +INSERT INTO CURRENCYFORMATS_V1 VALUES(153,'_tr_Bitcoin','Ƀ','','.',',','','',100000000,1,'BTC'); -- Describe INFOTABLE_V1 CREATE TABLE INFOTABLE_V1( @@ -134,6 +325,7 @@ INFOID integer not null primary key ); CREATE INDEX IDX_INFOTABLE_INFONAME ON INFOTABLE_V1(INFONAME); +INSERT INTO INFOTABLE_V1 VALUES(1, 'DATAVERSION', '3'); -- Describe PAYEE_V1 CREATE TABLE PAYEE_V1( @@ -144,7 +336,6 @@ PAYEEID integer primary key ); CREATE INDEX IDX_PAYEE_INFONAME ON PAYEE_V1(PAYEENAME); - -- Describe SPLITTRANSACTIONS_V1 CREATE TABLE SPLITTRANSACTIONS_V1( SPLITTRANSID integer primary key @@ -155,11 +346,23 @@ SPLITTRANSID integer primary key ); CREATE INDEX IDX_SPLITTRANSACTIONS_TRANSID ON SPLITTRANSACTIONS_V1(TRANSID); +-- Describe SPLITTRANSACTIONS_V2 +CREATE TABLE SPLITTRANSACTIONS_V2( +SPLITTRANSID integer primary key +, ACCOUNTID integer NOT NULL +, TRANSID integer NOT NULL +, CATEGID integer +, SUBCATEGID integer +, SPLITTRANSAMOUNT numeric +, NOTES TEXT +); +CREATE INDEX IDX_SPLITTRANSACTIONS_V2_ACCOUNTID ON SPLITTRANSACTIONS_V2(ACCOUNTID); +CREATE INDEX IDX_SPLITTRANSACTIONS_V2_TRANSID ON SPLITTRANSACTIONS_V2(TRANSID); -- Describe STOCK_V1 CREATE TABLE STOCK_V1( STOCKID integer primary key -, HELDAT integer +, HELDAT integer , PURCHASEDATE TEXT NOT NULL , STOCKNAME TEXT COLLATE NOCASE NOT NULL , SYMBOL TEXT @@ -172,6 +375,16 @@ STOCKID integer primary key ); CREATE INDEX IDX_STOCK_HELDAT ON STOCK_V1(HELDAT); +-- Describe STOCKHISTORY_V1 +CREATE TABLE STOCKHISTORY_V1( +HISTID integer primary key +, SYMBOL TEXT NOT NULL +, DATE TEXT NOT NULL +, VALUE numeric NOT NULL +, UPDTYPE integer +, UNIQUE(SYMBOL, DATE) +); +CREATE INDEX IDX_STOCKHISTORY_SYMBOL ON STOCKHISTORY_V1(SYMBOL); -- Describe SUBCATEGORY_V1 CREATE TABLE SUBCATEGORY_V1( @@ -182,6 +395,51 @@ SUBCATEGID integer primary key ); CREATE INDEX IDX_SUBCATEGORY_CATEGID ON SUBCATEGORY_V1(CATEGID); +-- Note: All strings requiring translation are prefix by: '_tr_' +-- The _tr_ prefix is removed when generating .h files by sqlite2cpp.py +-- strings containing unicode should not be translated. +INSERT INTO SUBCATEGORY_V1 VALUES(1,'_tr_Telephone',1); +INSERT INTO SUBCATEGORY_V1 VALUES(2,'_tr_Electricity',1); +INSERT INTO SUBCATEGORY_V1 VALUES(3,'_tr_Gas',1); +INSERT INTO SUBCATEGORY_V1 VALUES(4,'_tr_Internet',1); +INSERT INTO SUBCATEGORY_V1 VALUES(5,'_tr_Rent',1); +INSERT INTO SUBCATEGORY_V1 VALUES(6,'_tr_Cable TV',1); +INSERT INTO SUBCATEGORY_V1 VALUES(7,'_tr_Water',1); +INSERT INTO SUBCATEGORY_V1 VALUES(8,'_tr_Groceries',2); +INSERT INTO SUBCATEGORY_V1 VALUES(9,'_tr_Dining out',2); +INSERT INTO SUBCATEGORY_V1 VALUES(10,'_tr_Movies',3); +INSERT INTO SUBCATEGORY_V1 VALUES(11,'_tr_Video Rental',3); +INSERT INTO SUBCATEGORY_V1 VALUES(12,'_tr_Magazines',3); +INSERT INTO SUBCATEGORY_V1 VALUES(13,'_tr_Maintenance',4); +INSERT INTO SUBCATEGORY_V1 VALUES(14,'_tr_Gas',4); +INSERT INTO SUBCATEGORY_V1 VALUES(15,'_tr_Parking',4); +INSERT INTO SUBCATEGORY_V1 VALUES(16,'_tr_Registration',4); +INSERT INTO SUBCATEGORY_V1 VALUES(17,'_tr_Books',5); +INSERT INTO SUBCATEGORY_V1 VALUES(18,'_tr_Tuition',5); +INSERT INTO SUBCATEGORY_V1 VALUES(19,'_tr_Others',5); +INSERT INTO SUBCATEGORY_V1 VALUES(20,'_tr_Clothing',6); +INSERT INTO SUBCATEGORY_V1 VALUES(21,'_tr_Furnishing',6); +INSERT INTO SUBCATEGORY_V1 VALUES(22,'_tr_Others',6); +INSERT INTO SUBCATEGORY_V1 VALUES(23,'_tr_Health',7); +INSERT INTO SUBCATEGORY_V1 VALUES(24,'_tr_Dental',7); +INSERT INTO SUBCATEGORY_V1 VALUES(25,'_tr_Eyecare',7); +INSERT INTO SUBCATEGORY_V1 VALUES(26,'_tr_Physician',7); +INSERT INTO SUBCATEGORY_V1 VALUES(27,'_tr_Prescriptions',7); +INSERT INTO SUBCATEGORY_V1 VALUES(28,'_tr_Auto',8); +INSERT INTO SUBCATEGORY_V1 VALUES(29,'_tr_Life',8); +INSERT INTO SUBCATEGORY_V1 VALUES(30,'_tr_Home',8); +INSERT INTO SUBCATEGORY_V1 VALUES(31,'_tr_Health',8); +INSERT INTO SUBCATEGORY_V1 VALUES(32,'_tr_Travel',9); +INSERT INTO SUBCATEGORY_V1 VALUES(33,'_tr_Lodging',9); +INSERT INTO SUBCATEGORY_V1 VALUES(34,'_tr_Sightseeing',9); +INSERT INTO SUBCATEGORY_V1 VALUES(35,'_tr_Income Tax',10); +INSERT INTO SUBCATEGORY_V1 VALUES(36,'_tr_House Tax',10); +INSERT INTO SUBCATEGORY_V1 VALUES(37,'_tr_Water Tax',10); +INSERT INTO SUBCATEGORY_V1 VALUES(38,'_tr_Others',10); +INSERT INTO SUBCATEGORY_V1 VALUES(39,'_tr_Salary',13); +INSERT INTO SUBCATEGORY_V1 VALUES(40,'_tr_Reimbursement/Refunds',13); +INSERT INTO SUBCATEGORY_V1 VALUES(41,'_tr_Investment Income',13); + -- Describe SETTING_V1 create table SETTING_V1( SETTINGID integer not null primary key @@ -190,7 +448,7 @@ SETTINGID integer not null primary key ); CREATE INDEX IDX_SETTING_SETTINGNAME ON SETTING_V1(SETTINGNAME); --- Describe REPORT_V1 +-- Describe REPORT_V1 create table REPORT_V1( REPORTID integer not null primary key , REPORTNAME TEXT COLLATE NOCASE NOT NULL UNIQUE @@ -205,18 +463,74 @@ CREATE INDEX INDEX_REPORT_NAME ON REPORT_V1(REPORTNAME); -- Describe ATTACHMENT_V1 CREATE TABLE ATTACHMENT_V1 ( ATTACHMENTID INTEGER NOT NULL PRIMARY KEY -, REFTYPE TEXT NOT NULL +, REFTYPE TEXT NOT NULL /* Transaction, Stock, Asset, BankAccount, RepeatingTransaction, Payee */ , REFID INTEGER NOT NULL , DESCRIPTION TEXT COLLATE NOCASE , FILENAME TEXT NOT NULL COLLATE NOCASE ); CREATE INDEX IDX_ATTACHMENT_REF ON ATTACHMENT_V1 (REFTYPE, REFID); - - -- Describe USAGE_V1 + +-- Describe USAGE_V1 CREATE TABLE USAGE_V1 ( USAGEID INTEGER NOT NULL PRIMARY KEY -, USAGEDATE TEXT NOT NULL +, USAGEDATE TEXT NOT NULL , JSONCONTENT TEXT NOT NULL ); CREATE INDEX IDX_USAGE_DATE ON USAGE_V1 (USAGEDATE); +-- Asset Classes +CREATE TABLE ASSETCLASS_V1 ( +ID INTEGER primary key +, PARENTID INTEGER +, NAME TEXT COLLATE NOCASE NOT NULL +, ALLOCATION REAL +, SORTORDER INTEGER +); + +-- Asset Class / Stock link table +CREATE TABLE ASSETCLASS_STOCK_V1 ( +ID INTEGER primary key +, ASSETCLASSID INTEGER NOT NULL +, STOCKSYMBOL TEXT UNIQUE +); + +-- Describe CUSTOMFIELD_V1 +CREATE TABLE CUSTOMFIELD_V1 ( +FIELDID INTEGER NOT NULL PRIMARY KEY +, REFTYPE TEXT NOT NULL /* Transaction, Stock, Asset, BankAccount, RepeatingTransaction, Payee */ +, DESCRIPTION TEXT COLLATE NOCASE +, TYPE TEXT NOT NULL /* String, Integer, Decimal, Boolean, Date, Time, SingleChoiche, MultiChoiche */ +, PROPERTIES TEXT NOT NULL +); +CREATE INDEX IDX_CUSTOMFIELD_REF ON CUSTOMFIELD_V1 (REFTYPE); + +-- Describe CUSTOMFIELDDATA_V1 +CREATE TABLE CUSTOMFIELDDATA_V1 ( +FIELDATADID INTEGER NOT NULL PRIMARY KEY +, FIELDID INTEGER NOT NULL +, REFID INTEGER NOT NULL +, CONTENT TEXT +, UNIQUE(FIELDID, REFID) +); +CREATE INDEX IDX_CUSTOMFIELDDATA_REF ON CUSTOMFIELDDATA_V1 (FIELDID, REFID); + +-- describe TRANSACTIONLINK_V1 +CREATE TABLE TRANSLINK_V1 ( +TRANSLINKID integer NOT NULL primary key +, CHECKINGACCOUNTID integer NOT NULL +, LINKTYPE TEXT NOT NULL /* Asset, Stock */ +, LINKRECORDID integer NOT NULL +); +CREATE INDEX IDX_LINKRECORD ON TRANSLINK_V1 (LINKTYPE, LINKRECORDID); +CREATE INDEX IDX_CHECKINGACCOUNT ON TRANSLINK_V1 (CHECKINGACCOUNTID); + +-- describe SHAREINFO_V1 +CREATE TABLE SHAREINFO_V1 ( +SHAREINFOID integer NOT NULL primary key +, CHECKINGACCOUNTID integer NOT NULL +, SHARENUMBER numeric +, SHAREPRICE numeric +, SHARECOMMISSION numeric +, SHARELOT TEXT +); +CREATE INDEX IDX_SHAREINFO ON SHAREINFO_V1 (CHECKINGACCOUNTID); From a34609b22a27c55651533e3326ff027939fb0e2b Mon Sep 17 00:00:00 2001 From: siowena <44472390+siowena@users.noreply.github.com> Date: Mon, 15 Apr 2019 18:12:19 +0400 Subject: [PATCH 37/49] Changed open command for python 2.7 commented out v3 line as travis-ci is upgrading soon --- check_gm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/check_gm.py b/check_gm.py index 7cec7b2..e994bf7 100755 --- a/check_gm.py +++ b/check_gm.py @@ -8,7 +8,8 @@ def check(curs, report): print ('checking %s' % report) sql = '' - for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): +#3. for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): + for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r'): sql = sql + line curs.execute(sql) print ('done %s' % report) @@ -18,7 +19,8 @@ def check(curs, report): conn.row_factory = sqlite3.Row curs = conn.cursor() sql = '' - for line in open('tables_v1.sql', mode='r', encoding='utf-8'): +# for line in open('tables_v1.sql', mode='r', encoding='utf-8'): + for line in open('tables_v1.sql', mode='r'): sql = sql + line curs.executescript(sql) From 58793a717309ef7c2d398040cb265c09a5eeabee Mon Sep 17 00:00:00 2001 From: siowena <44472390+siowena@users.noreply.github.com> Date: Mon, 15 Apr 2019 18:15:57 +0400 Subject: [PATCH 38/49] Corrected SQL to remove 2nd ; causing check_gm to fail --- usercoloredtransactions/sqlcontent.sql | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/usercoloredtransactions/sqlcontent.sql b/usercoloredtransactions/sqlcontent.sql index 2feb495..fc2c126 100644 --- a/usercoloredtransactions/sqlcontent.sql +++ b/usercoloredtransactions/sqlcontent.sql @@ -8,7 +8,7 @@ SELECT t.FOLLOWUPID, ( SELECT inf.infovalue FROM infotable_V1 AS inf - WHERE inf.infoname = 'USER_COLOR' || CAST (t.followupid AS TEXT) + WHERE inf.infoname = 'USER_COLOR' || CAST (t.followupid AS TEXT) ) AS FOLLOWCOLOR, t.transid as transid @@ -40,14 +40,13 @@ c2.TRANSID INNER JOIN CURRENCYFORMATS_V1 AS c ON t.CURRENCYID = c.CURRENCYID LEFT JOIN - CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = c.CURRENCYID AND + CURRENCYHISTORY_V1 AS CH ON CH.CURRENCYID = c.CURRENCYID AND CH.CURRDATE = ( - SELECT MAX(CRHST.CURRDATE) + SELECT MAX(CRHST.CURRDATE) FROM CURRENCYHISTORY_V1 AS CRHST WHERE CRHST.CURRENCYID = c.CURRENCYID ) WHERE t.FOLLOWUPID > 0 ORDER BY t.FOLLOWUPID ASC, t.PAYEENAME ASC, - t.TRANSDATE ASC; -; + t.TRANSDATE ASC;ß From f37a24e582b19fe2f8dfe82102cc49d94ea42b95 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Sun, 28 Apr 2019 12:47:40 +0400 Subject: [PATCH 39/49] Fix for the SQL/Lua references Reference in SQL changed case, Lua needs to change also as it's case sensitive --- CategoryForecast/luacontent.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CategoryForecast/luacontent.lua b/CategoryForecast/luacontent.lua index c887bf1..931796f 100644 --- a/CategoryForecast/luacontent.lua +++ b/CategoryForecast/luacontent.lua @@ -140,7 +140,7 @@ function handle_record(record) if initialized == 0 then - total = record:get("Balance"); + total = record:get("BALANCE"); forecast= total; initialized = 1; end From d72a9be2930594edb4216e5d53e2536998f1d715 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Sun, 28 Apr 2019 13:54:38 +0400 Subject: [PATCH 40/49] Fixed for travis-ci.org moving to Python 3 On Apr 167th, travis-ci.org moved to Python 3, print syntax updated --- check_gm.py | 11 ++++------- pack_gm.py | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/check_gm.py b/check_gm.py index e994bf7..0d35e13 100755 --- a/check_gm.py +++ b/check_gm.py @@ -8,8 +8,7 @@ def check(curs, report): print ('checking %s' % report) sql = '' -#3. for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): - for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r'): + for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): sql = sql + line curs.execute(sql) print ('done %s' % report) @@ -19,8 +18,7 @@ def check(curs, report): conn.row_factory = sqlite3.Row curs = conn.cursor() sql = '' -# for line in open('tables_v1.sql', mode='r', encoding='utf-8'): - for line in open('tables_v1.sql', mode='r'): + for line in open('tables_v1.sql', mode='r', encoding='utf-8'): sql = sql + line curs.executescript(sql) @@ -31,12 +29,11 @@ def check(curs, report): try: check(curs, report) except: - print(traceback.print_exc()) + print (traceback.print_exc()) print ('ERR: %s' % report) conn.close() if anyNotPassed: exit(1) - # exit(0) - \ No newline at end of file + exit(0) \ No newline at end of file diff --git a/pack_gm.py b/pack_gm.py index 935ac5a..c8a2eae 100755 --- a/pack_gm.py +++ b/pack_gm.py @@ -5,12 +5,12 @@ import zipfile def pack_report(report): - print 'packing %s' % report + print ('packing %s' % report) f = zipfile.ZipFile(report + '.zip', 'w') for item in os.listdir(report): f.write(os.path.join(report, item)) f.close() - print 'done %s' % report + print ('done %s' % report) if __name__ == '__main__': for report in os.listdir('.'): From e04482edcb7d5807cedb41fc3dc62689ca116820 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Sun, 28 Apr 2019 13:54:58 +0400 Subject: [PATCH 41/49] Bug fix, characters after ; removed. --- usercoloredtransactions/sqlcontent.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usercoloredtransactions/sqlcontent.sql b/usercoloredtransactions/sqlcontent.sql index fc2c126..2483ce8 100644 --- a/usercoloredtransactions/sqlcontent.sql +++ b/usercoloredtransactions/sqlcontent.sql @@ -49,4 +49,4 @@ c2.TRANSID WHERE t.FOLLOWUPID > 0 ORDER BY t.FOLLOWUPID ASC, t.PAYEENAME ASC, - t.TRANSDATE ASC;ß + t.TRANSDATE ASC; From 85d4d9f0035fe51eeeef31ff406a56aa5a7b43ad Mon Sep 17 00:00:00 2001 From: AO1 <44472390+andrewaimia@users.noreply.github.com> Date: Sun, 28 Apr 2019 14:25:16 +0400 Subject: [PATCH 42/49] Bug fix to correct typo Missing the ="" in the where clause. Fixed. --- BlankNotes/description.txt | 4 +++- BlankNotes/sqlcontent.sql | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BlankNotes/description.txt b/BlankNotes/description.txt index bf583c5..2010946 100644 --- a/BlankNotes/description.txt +++ b/BlankNotes/description.txt @@ -1 +1,3 @@ -This report will show transactions with Blank note fields \ No newline at end of file +This report will show transactions with Blank note fields. + +Transaction amounts are displayed in the currency of the Account. \ No newline at end of file diff --git a/BlankNotes/sqlcontent.sql b/BlankNotes/sqlcontent.sql index 960b454..7e91d3c 100644 --- a/BlankNotes/sqlcontent.sql +++ b/BlankNotes/sqlcontent.sql @@ -23,7 +23,7 @@ SELECT IFNULL(CH.CURRVALUE, m.BASECONVRATE) AS CURRRATE, FROM CURRENCYHISTORY_V1 AS CRHST WHERE CRHST.CURRENCYID = m.CURRENCYID ) - WHERE t.NOTES; + WHERE t.NOTES=""; /* For v13 DB - remove the _V1 from the tablenames - remove the m.BASECONVRATE and ISNULL checks on CH.CURRVALUE From b0cbe5b94ec605d29b590edad3bbb005de43e5b2 Mon Sep 17 00:00:00 2001 From: AO1 <44472390+siowena@users.noreply.github.com> Date: Sun, 28 Apr 2019 18:44:32 +0400 Subject: [PATCH 43/49] Delete .gitignore --- .gitignore | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a1246d2..0000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -*.log -*.pot -*.pyc -*.grm -*.zip -local_settings.py -.DS_Store From 3807de17f326af852b0db40185fac567ac7d7bb3 Mon Sep 17 00:00:00 2001 From: siowena <44472390+siowena@users.noreply.github.com> Date: Sun, 28 Apr 2019 18:53:21 +0400 Subject: [PATCH 44/49] Revert "Delete .gitignore" This reverts commit b0cbe5b94ec605d29b590edad3bbb005de43e5b2. --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a1246d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.log +*.pot +*.pyc +*.grm +*.zip +local_settings.py +.DS_Store From 328a2b1f2b4b798649ccd4d7aefd91a154b4141f Mon Sep 17 00:00:00 2001 From: siowena <44472390+siowena@users.noreply.github.com> Date: Sun, 28 Apr 2019 18:59:00 +0400 Subject: [PATCH 45/49] Revert "Fixed for travis-ci.org moving to Python 3" This reverts commit d72a9be2930594edb4216e5d53e2536998f1d715. --- check_gm.py | 11 +++++++---- pack_gm.py | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/check_gm.py b/check_gm.py index 0d35e13..e994bf7 100755 --- a/check_gm.py +++ b/check_gm.py @@ -8,7 +8,8 @@ def check(curs, report): print ('checking %s' % report) sql = '' - for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): +#3. for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r', encoding='utf-8'): + for line in open(os.path.join(report, 'sqlcontent.sql'), mode='r'): sql = sql + line curs.execute(sql) print ('done %s' % report) @@ -18,7 +19,8 @@ def check(curs, report): conn.row_factory = sqlite3.Row curs = conn.cursor() sql = '' - for line in open('tables_v1.sql', mode='r', encoding='utf-8'): +# for line in open('tables_v1.sql', mode='r', encoding='utf-8'): + for line in open('tables_v1.sql', mode='r'): sql = sql + line curs.executescript(sql) @@ -29,11 +31,12 @@ def check(curs, report): try: check(curs, report) except: - print (traceback.print_exc()) + print(traceback.print_exc()) print ('ERR: %s' % report) conn.close() if anyNotPassed: exit(1) - exit(0) \ No newline at end of file + # exit(0) + \ No newline at end of file diff --git a/pack_gm.py b/pack_gm.py index c8a2eae..935ac5a 100755 --- a/pack_gm.py +++ b/pack_gm.py @@ -5,12 +5,12 @@ import zipfile def pack_report(report): - print ('packing %s' % report) + print 'packing %s' % report f = zipfile.ZipFile(report + '.zip', 'w') for item in os.listdir(report): f.write(os.path.join(report, item)) f.close() - print ('done %s' % report) + print 'done %s' % report if __name__ == '__main__': for report in os.listdir('.'): From 9858bbf33ff83c3e3c92123caf7925d83819bd7c Mon Sep 17 00:00:00 2001 From: siowena <44472390+siowena@users.noreply.github.com> Date: Sun, 28 Apr 2019 19:04:47 +0400 Subject: [PATCH 46/49] Revert --- .DS_Store | Bin 0 -> 18436 bytes .gitignore | 1 - AssetsSummary/template.htt | 4 ++-- 3 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4ffa0e244c5627f8506b2fb6d201264b0822df6c GIT binary patch literal 18436 zcmeGkYiu0lamI0+z1=+4&eKlPTyO|^n8c3rA`o(ZB?KJuupK85az6Vu_L1|Qb9=TE zQqzdG(5fi`N3KFdakS z6Y$>dfndOn*4Dm)CF4rRmrc-Ix-qe3<0jo}RtyEK;jIJFKsaRYv?4ZLz2+3VFFd@t zCmh-qvDkaBS>EFd_6!DnQL7;sYzy3A*_}P%;9!5q-W9bDMp?-)g`CpzntFp?N zqkpAyC}0P=gI33Iz#r|~?X!EVkUtRW?I3jPpjM7GE^~r_o^MoZ<`bH!iN}S;BF+4T zW|r_reW`J=%k*jHIPtbtU!j?PmpNX%U8S#anYPO;6>rz+mucozF0)L$-JrW%0s0~*1fD|9k$WR=@6}!ELxMsyo>H(JLX-$d#St&moeEeu4^MVqAlu+4%&^r zh}WFc7Vul$zDOrqi?>^$mY_9cg|yJfLw=jX$B6U$ZN6w9(b1|s{T?O*`5Z2T z8;xeod{#?xOoeoA;|fjN&0Nn0zu)q!PMwQpHRjD-04w1N>P5TB4;dzJ?)z{T+|9kY z$KVM#1Al-&!b|WnoP#&vZFm?!z6&`|$yM2p`5@;!}7EPvdiV7XOT|3S)M> zx-E`z^Beq22Gh+PSD>)M<)5$Vjt(z0I!&6?in2lF8D5w@M>j+mAvw4Zw|8>_i!X?H zf_uJUn9PjCcI7HvH%rN;#oJ5P(c3bz zUh($w4fGaRuM@AE77{JgTuHW=!4iK0KZn!sJlWtmcpd%@|9}q>$@(VYOo}JW#|3yH zF2vaXaoHTikNAMX=%&c=K`Tmz<4pMa+EWec`-IV@dasz%bZ$;lD9zHt2joHOdr{a(Lo*wed#Jb4bR@Hw1yo@i zR=-Y+WxVuX8iNCt55QcvZ$OCgUXHo7UuHn4?To z<=oBu;SA6+?lQ2FQGOr~$Et8=-FWdKvftYS&T4A8Qez0al; zGl>n^7<0o&Atp2TDE+bJZJ(2OZEM5HI0bO1xZSc&wnr-oXmII0cR*kNmJH(HrNz=&LKVrX${!RJBCPxvvnaG z!-ZQbC+4H+(&gK4Bv}fkCCmG6*=_ORU<~vUZFoNDse0=oQ7N>SO>eDY{!6Pd7DOn3 zimWS7rK78YC?&KsHcBb{ea@I6+}QCAl_L{DlUkQtmL=O zI32J+S_w6em6oDttYwC1CMo(*@&ZiNN&TK&aAf&UtaFSkYhChSlnJ&Ms)4yTzQ-qO)7}=4WgE~WH z8PuaTcy)gk=x{`#VP`!(% zgBG|AL(Upd1fS)n7A-b(oWs}m+&=aSFxpV256c0$uImm9)ih;k>EZz43+;_ zm_}a6kJ@3IB*QBtLzX?cvK+bZZ>a^Cxl^QcE{mo73I z%EcviVT(S__H|pd3qoY4__s!?wJo6UnsURFZSIk!x5pjDoa&Tyk}s|*C+|gPNj(!THmC(^xX{FH9%pCO;%U!7&svIB<%cFDMNkKIIKctDAab+EhtakQF=7FD(z7Tv>ZV$0eIsHu}CHo>}E9{eG z-pBd{jVe-VMYVwm_4#4TvcKKt$eu_2@(5ZOg%t8%L|+w!c>0Lxz)dM!n|>2>i1?Dn zEonyH`M_Y=S3K@`dRW!bBIZh;=Ne=^UUJTvgU)*`2}}FzYRTFjUfv$wQSISP+a6xt z9^RbWW6U+k?J;+QvsXoJkMmGVqCGylT2i#fRNg;^Xp9Kb3d)~O@2cI;V5x;1F=hRY zTs=RY&&nA)p_lxzQ^-4o#=#Jc1j%2w#!^6Xt}6?us*FlDD9SrV> zxN;QwVIcgV8}=#Q73_h^xpPa`F80h0x<4YWbVtYk{6jz~ZXgfP`TFqk>NQ_nWv~`1 Z%G>8wr=z0(U-bW#|5lJLe&qQ7{{=@)$VmVI literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index a1246d2..2b1076d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ *.grm *.zip local_settings.py -.DS_Store diff --git a/AssetsSummary/template.htt b/AssetsSummary/template.htt index 6f9c783..8e77522 100755 --- a/AssetsSummary/template.htt +++ b/AssetsSummary/template.htt @@ -9,7 +9,7 @@

Asset Summary Report

-

+

Report Date:

@@ -43,7 +43,7 @@
-
+
- - -
-

()

-

- Report Date: - -

-
-
-
- - - - -
- -

All values in base currency .

-
- - - - - - - - - - - - - - - - - - - -
YearIncomeExpenseDifference
- - - - - - - -
- - - - - - - -

Error

-
-
- - - \ No newline at end of file