QuitCount

Share your cool Custom SQL reports or Lua scripts with other mmex users

QuitCount

Postby Nikolay » Sun Jul 24, 2011 9:59 am

I have found interesting application QuitCount.

What is QuitCount?

QuitCount is a simple counter that shows what you saved since you quit smoking. Once you tell it the date you quit, how much you smoked, and how much it cost, it'll tell you how many cigarettes you didn't smoke since, and how much it makes in terms of money, tar, and life expectancy. It is released under the terms of the GPL, version 3 or later.

I think to create Custom SQL Report that will show the same info as QuitCount.

PS http://quitcount.sourceforge.net/
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia

Re: QuitCount

Postby Nikolay » Tue Jul 26, 2011 4:21 am

Code: Select all
select case qd.lang when 'russian' then msg.mr else msg.me end as info,
case msg.id
when 1 then qd.quitdate
when 2 then round(julianday('now') - julianday(qd.quitdate))
when 3 then round(julianday('now') - julianday(qd.quitdate)) *qd.sigperday
when 4 then round(julianday('now') - julianday(qd.quitdate)) *qd.sigperday*qd.w 
when 5 then round((julianday('now') - julianday(qd.quitdate)) *qd.sigperday*7/24/60) 
when 6 then round((julianday('now') - julianday(qd.quitdate)) *qd.sigperday/20*qd.cost) 
end as result
from
(select 'The date when I quit smoking' me,'Я бросил курить ' mr, 1 as id
union all select 'Since then, it took days:', 'С тех пор прошло дней:', 2
union all select 'I have not smoked a cigarettes:', 'Я не выкурил сигарет:', 3
union all select 'I have not absorbed the nicotine gram:', 'Я не впитал в себя никотина грам:' , 4
union all select 'I''ll live an additional days', 'Я проживу дополнительно дней:' , 5
union all select 'I save on cigarettes (USD):', 'Я сэкономил на сигаретах (руб.):' , 6
) msg
left join (select '2008-11-01' as quitdate --The date when I quit smoking
, 20 as sigperday --How many cigarettes smoked per day
, 50 as cost -- Cost of one pack of cigarettes
, 0.001 as w -- mg of nikotine per sigaret
, 'english' as lang -- 'russian' --you language
) qd
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia


Return to Custom SQL and Lua Scripts

Who is online

Users browsing this forum: aflcmudvai and 1 guest

cron