Page 1 of 1

href to goto to account?

Posted: Sun Jun 21, 2015 3:33 pm
by sterling
Hi,

I'm using Nikolay's dolls report as reference here, and i want to make a URL link to an account in one of my reports.  But i'm unsure how to do this.  The doll example uses a transaction id, but i dont have a transaction id from my SQL.  Is there a way to link to an account without a transaction id?

Here is what i've got as reference
record:set("TRX_GOTO", string.format('<a href="trxid:%s">%s</a>', record:get('Nr'),  record:get('ACCOUNTNAME')));

Thanks.

Re: href to goto to account?

Posted: Sun Jun 21, 2015 8:25 pm
by Nikolay
I've updated the report
http://forum.moneymanagerex.org/viewtop ... 388#p12388

Now Lua script does not used for hyperlinks.

Code: Select all

        <td class = "text-right"><a href='trx:<TMPL_VAR Nr>' ><TMPL_VAR Nr></a></td>
        <td nowrap><a href='trxid:<TMPL_VAR Nr>' ><TMPL_VAR ACCOUNTNAME></a></td>
Where 'Nr' is "checkingaccount_v1.transid AS Nr" in SQL script.

Re: href to goto to account?

Posted: Sun Jun 21, 2015 9:22 pm
by sterling
Can i do it without a transid though?  I can surely do it with some wasteful SQL, but it isn't efficient.

Re: href to goto to account?

Posted: Sun Jun 21, 2015 9:28 pm
by Nikolay
Transid should be here.
I don't understand what the problem to use it. Any transaction has unique id.

Re: href to goto to account?

Posted: Fri Jun 26, 2015 6:47 pm
by sterling
This is to link to accounts where my report doesn't have transactions.  Like I say I can add transactions to the report but it's not efficient.

Re: href to goto to account?

Posted: Sat Jun 27, 2015 3:47 pm
by sterling
This is a report to show all my accounts and savings levels.

I've extended my sql now to have a transid in my list of accounts, but have stumbled on a different issue now and wondered if there was a solution.  Here is my lua

Code: Select all

record:set("TRX_GOTO", string.format('<a href="trxid:%d">%s</a>', record:get('A_Transaction'), record:get('ACCOUNTNAME')));
But if its an account with only transfers to the account, i get one of those transactions, but this hyperlink takes you to the source account, not the destination account.

Is there a way to go to the destination account?

Re: href to goto to account?

Posted: Sat Jun 27, 2015 4:36 pm
by sterling
Ive found a hacky work around.  I've created void  transfers from accounts which dont have any already.  Now all my accounts can have links :lol:.

Re: href to goto to account?

Posted: Sun Jun 28, 2015 6:55 am
by Nikolay
You have not provided SQL script. Any discussion has no sense.

Re: href to goto to account?

Posted: Sun Jun 28, 2015 7:33 am
by sterling
As a programmer by profession it is definitely possible to discuss code without see it, but if you insist.

sql

Code: Select all

select a.ACCOUNTNAME,
   strftime('%m-%Y', date('now', 'start of month', '-11 month')) as date11,
   strftime('%m-%Y', date('now', 'start of month', '-10 month')) as date10,
   strftime('%m-%Y', date('now', 'start of month', '-9 month')) as date9,
   strftime('%m-%Y', date('now', 'start of month', '-8 month')) as date8,
   strftime('%m-%Y', date('now', 'start of month', '-7 month')) as date7,
   strftime('%m-%Y', date('now', 'start of month', '-6 month')) as date6,
   strftime('%m-%Y', date('now', 'start of month', '-5 month')) as date5,
   strftime('%m-%Y', date('now', 'start of month', '-4 month')) as date4,
   strftime('%m-%Y', date('now', 'start of month', '-3 month')) as date3,
   strftime('%m-%Y', date('now', 'start of month', '-2 month')) as date2,
   strftime('%m-%Y', date('now', 'start of month', '-1 month')) as date1,
   strftime('%m-%Y', date('now')) as date0,

   (select max(t.TRANSID)
      from CHECKINGACCOUNT_V1 as t
      where  t.ACCOUNTID = a.ACCOUNTID or t.TOACCOUNTID = a.ACCOUNTID
   ) as A_Transaction,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-11 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance12ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-10 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance11ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-9 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance10ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-8 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance9ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-7 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance8ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-6 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance7ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-5 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance6ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-4 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance5ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-3 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance4ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-2 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance3ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-1 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         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 == 'R'
   ) as Balance2ago,

   (select a.INITIALBAL + total(t.TRANSAMOUNT)
      from
      (select ACCOUNTID, STATUS,
         (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
         from CHECKINGACCOUNT_V1
         where  TRANSDATE < date('now', 'start of month', '-0 month')
         union all
         select TOACCOUNTID, STATUS, TOTRANSAMOUNT 
         from CHECKINGACCOUNT_V1
         where TRANSCODE = 'Transfer' and TRANSDATE < date('now', 'start of month', '-0 month')
      ) as t
      where  t.ACCOUNTID = a.ACCOUNTID and t.STATUS == 'R'
   ) as Balance1ago,

   (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 == 'R' 
   ) as BalanceNow

from ACCOUNTLIST_V1 as a
where a.STATUS = 'Open' and a.FAVORITEACCT <> 'blahTRUE'  and a.ACCOUNTTYPE!='Credit Card' and a.ACCOUNTNAME<>'Santander-Joint' and BalanceNow>0
group by a.ACCOUNTNAME
order by BalanceNow desc
limit 20;

Re: href to goto to account?

Posted: Sun Jun 28, 2015 3:51 pm
by Nikolay
Now I understand. In that case it maybe added more hyperlink types for account id.
But your solution is smart.

Re: href to goto to account?

Posted: Tue Jul 07, 2015 4:09 pm
by Nikolay
I suggest this report for your purposes.

Re: href to goto to account?

Posted: Tue Jul 07, 2015 6:20 pm
by Renato
Hello Nikolay
Good job, but I miss the total of monthly columns

Re: href to goto to account?

Posted: Tue Jul 07, 2015 6:57 pm
by Nikolay
I'll add links for all cells, translations and totals in next release. And dorting as well.

Re: href to goto to account?

Posted: Wed Jul 08, 2015 11:49 am
by Nikolay
Account balances to end of month for last 12 months

Re: href to goto to account?

Posted: Wed Jul 08, 2015 3:04 pm
by Nikolay
Here is the same report with graph:
http://forum.moneymanagerex.org/viewtop ... =16&t=5915

Re: href to goto to account?

Posted: Thu Jul 09, 2015 8:41 am
by sterling
Renato wrote:Hello Nikolay
Good job, but I miss the total of monthly columns
I'll upload my full report when I get home. I'm out of the country at the minute. It has totals, and also change per month.

Re: href to goto to account?

Posted: Sun Jul 12, 2015 5:08 pm
by sterling
I've uploaded my latest report to the thread linked here
Nikolay wrote:Here is the same report with graph:
http://forum.moneymanagerex.org/viewtop ... =16&t=5915
Its is more relevant than this support thread.