twiki_application1Add my vote for this tag create new tag
, view all tags

Account Ledger Application

A TWikiApplication providing a useful MashUp of the CommentPlugin, SpreadSheetPlugin and the EditTablePlugin. Useful for keeping a checkbook style account balance. Thanks to everyone for their assistance both here and in the support web!


IDEA! here on twiki.org I have set nonotify="on" in the %COMMENT% declaration. This prevents notification when folks experiment by posting a new ledger entry. In your own implementation, you may wish to have the notifications turned on.

    Date Item Debit Credit Balance
02/10/2007 pay check 10 1000 990
02/10/2007 rent 550   440
02/10/2007 movie tickets 12.50   427.5
02/10/2007 stick of gum .99   426.51
02/10/2007 pay check   100.14 526.65
02/10/2007 another stick of gum .99   525.66
02/14/2007 web camera 13.25   512.41
06/19/2007 pair of shoes 100   412.41
09/10/2007 Gas for scooter 7.86   404.55
01/10/2008       404.55
03/10/2008 vanalles   1000 1404.55
03/15/2008 Wiki book   59.95 1464.5
04/19/2008 Paycheck   100.78 1565.28
05/02/2008 Humptata 20.56   1544.72
05/04/2008 and again 20   1524.72
07/27/2008 Testing 2000   -475.28
03/27/2009   200   -675.28
04/26/2009 test     -675.28
04/26/2009 test1   3000 2324.72
11/26/2009 Can this be used 100   2224.72
11/26/2009 No it can't   100 2324.72
12/08/2009 cewcwecwqcqwcwccqe     2324.72
12/29/2009       2324.72
01/02/2010 teste 100   2224.72
10/15/2012 hgvghvhg 34   2190.72
10/30/2012 Check 400 500 2290.72
03/18/2013 Stuff 20   2270.72
06/11/2014 Laser Sharks 4,375   -2104.28
06/18/2014 Hover Harness (4) 1625   -3729.28
06/18/2014 Test Targets 800   -4529.28
06/18/2014 1st Job   114500 109970.72
07/22/2016 THis is a new entry 200   109770.72
07/22/2016 THis is a new entry 200   109570.72

Add new ledger entry:
Made By: TWikiGuest   Date:   Debit:   Credit:

How To

1. Add the following to your Topic, WebPreferences, or TWikiPreferences

      * Set BALANCE = $EVAL( $VALUE($T(R$ROW(-1):C$COLUMN())) - $VALUE($T(R$ROW():C$COLUMN(-2))) + $VALUE($T(R$ROW():C$COLUMN(-1))) )

2. Add the following to UserTemplates

Add Ledger Entry

%TABLE{ valign="top" }%
| <b>Add new ledger entry:</b> |||||
|  Description: | <input %DISABLED% type="text" size="90" name="descr" value="" /> ||||
|  Made By: | %MAINWEB%.%USERNAME%    | &nbsp; Date: <input %DISABLED% type="text" size="12" name="date" value="%SERVERTIME{$mo/$day/$year}%" /> | &nbsp; Debit: <input type="text" size="6" name="debit" value="" /> | &nbsp; Credit: <input type="text" size="6" name="credit" value="" /> <input %DISABLED% type="submit" value="%button|Add Entry%" /> |

%TMPL:DEF{OUTPUT:accountledger_table}%%POS:BEFORE%| <!--LEDGERITEM--> | <!-- %MAINWEB%.%USERNAME% --> | %URLPARAM{"date"}% | %URLPARAM{"descr"}% | %URLPARAM{"debit"}% | %URLPARAM{"credit"}% |  %CALC{ %BALANCE% }% |

3. Use the following to create an account legder

%EDITTABLE{changerows="off" quietsave="off" format="| label, 1, | label, 1, | text, 10, | text, 20 | text, 10 | text, 10 | label, 0, $percntCALC{ $percntBALANCE$percnt }$percnt |"}%
|  |  | *Date* | *Item*            | *Debit* | *Credit* | *Balance* |
%COMMENT{ type="accountledger_table" }%

-- Contributors: KeithHelfrich, ThomasFreudenberg, PeterThoeny - 12 Dec 2006

Comments and Discussion

Going one step further, here is a handy preference variable that you could set in TWikiPreferences :

   * Set ACCOUNTLEDGER = %EDITTABLE{changerows="off" quietsave="off" format="| label, 1, | label, 1, | text, 10, | text, 20 | text, 10 | text, 10 | label, 0, $percntCALC{ $percntBALANCE$percnt }$percnt |"}% %BR%
   |  |  | *Date* | *Item*            | *Debit* | *Credit* | *Balance* | %BR%
   %COMMENT{ type="accountledger_table" }%

This will allow for any user to place only the %ACCOUNTLEDGER% variable into their topic and receive a ready-to-use table like the one above.

Word of caution: this variable works on DakarRelease but not on CairoRelease

-- KeithHelfrich - 18 Dec 2006

The is an example TableWidgkit.

-- KeithHelfrich - 21 Dec 2006

Almost forgot the date smile I wonder what kind of date functions there are lying around that would insert the journal entry's date automatically, but leave it constant without updating with every change of the system clock ?

-- KeithHelfrich - 21 Dec 2006

Why not use the CommentPlugin to insert entries? That is able to insert a create-time date.

-- CrawfordCurrie - 21 Dec 2006

Keith, reading this, makes me think that you're doing a similar, but less power full thing to what we do using named sections and parameterised INCLUDEs. There are topics describing this technique - when i find them, i'll add links.

-- SvenDowideit - 21 Dec 2006

Thanks guys. Crawford, the simple answer is because I don't know how. Despite that limitation, this is the sort of thing that, to me, is what will make twiki AccessablyUseful - giving users a pop-up menu of portable TableWidgkits that they can place into a topic whenever it serves their needs.

-- KeithHelfrich - 22 Dec 2006

On adding table rows with CommentPlugin, see EditActionItems sample application.

-- PeterThoeny - 24 Dec 2006

Thanks for the example, Peter. Going by that, I've revamped the example and instructions above for using the CommentPlugin. This is all working correctly for me at home. But for some reason, even though I've added the necessary UserTemplate, we get the error message above: No such template def TMPL:DEF{PROMPT:accountledger_table}, (which also prevents this comment box from working correctly)

-- KeithHelfrich - 25 Dec 2006

I have a question though - does the account ledger variable work under the EdinburghRelease ? I would seem not to generate the table correctly.

And the COMMENT variable on this page adds into the example table - not into this list...

-- ChrisHogan - 08 Feb 2007

Hi Chris, to be honest, the variable has never worked for me (I'm on Cairo) and I've not tested on Edinburgh, though I think that it should work. The most important parts to take from this app are the %BALANCE% variable, and the magic that happens there to do the math for you.

I've started the example ledger again with new entries because the comment had somehow been disjointed from the table, probably when folks deleted their old entries. ( Note: the best way to reverse a ledger entry is with another entry wink )

I also updated the example #UserTemplate that is used by the CommentPlugin. The individual now does not have the option to change his or her name in the "made by" field (display only). The template in use on twiki.org was not yet updated b/c I don't have permission to edit UserCommentsTemplate (maybe someone could do that for me?).

I'm certain that this app could be improved further, and would look forward to any contributions! One thing I've been wondering about is the ability to restrict edit of the raw text and instead allow changes only through the CommentPlugin or EditTablePlugin. I'm not sure how that would be done.

-- KeithHelfrich - 10 Feb 2007

This misbehaving comment box (bottom of the page) has been fixed...

-- KeithHelfrich - 10 Feb 2007

I changed the permission in TWiki06x00.UserCommentsTemplate, members of the TWikiCommunityGroup should be able to change the topic.

I also had to fix the output format of your template. You also fell into the trap of a spec change in TWiki 4.1: Leading and trailing empty lines are no longer removed. This breaks TWiki apps, skins and CommentPlugin templates. See Bugs:Item3510. Going forward we should have less issues like this because of our TWikiRelease04x01Process.

Suggestion: The read only WikiName of the person does not work in all cases. For example, a non-authenticated user is listed as TWikiGuest. Possibly restore an editable field, or add a conditional note to login if guest.

-- PeterThoeny - 10 Feb 2007

Thanks, Peter. From reading the Bugs:Item3510 page I can neither tell what was broken nor what you've done to fix it. But I am never-the-less appreciative. Is there a HOW-TO somewhere that tells us what to do after this spec change ?

Re: your suggestion on WikiName, my answer to that would be to Set DENYTOPICCHANGE = %MAINWEB%.TWikiGuest to prevent non-authenticated users from changing the account balance. Many sites will have even more restrictive requirements for who can add entries to the account ledger. But at the very least, this will prevent an anonymous entry.

-- KeithHelfrich - 10 Feb 2007

See TWikiReleaseNotes04x01#Template_spec_changed on how to work around the issue of this spec change.

On login question: The user will be authenticated if needed by the CommentPlugin, so instead of passing along the potentially unauth'ed guest user, simply use %WIKIUSERNAME% in the output template.

-- PeterThoeny - 10 Feb 2007

I've changed the template at UserCommentsTemplate#Add_Ledger_Entry to use %WIKIUSERNAME% instead of %MAINWEB%.%USERNAME%

Also, the #Example above was changed to set nonotify="on". This will prevent notifications to the WebNotify list for every time someone experiments by adding a new ledger entry.

-- KeithHelfrich - 15 Feb 2007

Hi Sorry, a bit of a newbie question. Where exactly do you add the template definition? Do I add as a topic? and if so where? Or manually in a file in the twiki installation?

-- AaronCoday - 10 Jan 2008

See TWiki.TWikiTemplates and follow documentation for Template Topics

-- MartinCleaver - 03 May 2008

Edit | Attach | Watch | Print version | History: r56 < r55 < r54 < r53 < r52 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r56 - 2016-07-22 - JohnBelbute
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.