-
-
Save geedmo/9372a136eccce15c96f38b2b7a6c3ce0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C 1.0000d = 8h ; 8-hour work days | |
D £1,000.00 ; default currency and formatting | |
; First approach: automatically set value for work delivered by person at their | |
; current rate | |
; Issue: since time is seconds-based the day rate needs to be divided by 1 day | |
; to arrive at the 'second rate'. This somehow is rounded to two decimals which | |
; means that the below is incorrect when being used. It will result in a | |
; multiplier that's either `0.01` or `0.02`. | |
= /^Work:Client:Project:Alice/ | |
; VALUE:: (post.date < [2017-09-01] ? £350 : £450) / 1d | |
; Second approach: use custom value expression for the account | |
; Issue: Can't use `post.date` in the expression for some reason. Using `date` | |
; doesn't give the same error, but also won't be the right date (date of the | |
; posting) even when using the `-H` flag. | |
account Work:Client:Project:Bob | |
value s, d, t -> (post.date < [2017-09-01] ? £350 : £450) / 1d | |
; Third approach: custom commodities per person | |
; This works, but requires a lot of setup. For example it requires custom time | |
; units for each person. It has the benefit of being the most flexible though | |
; making possible things like having 6-hour days for some people while 8-hour | |
; days for others. It's flexibility we don't really need though. | |
C 1.00 "Carol d" = 8 "Carol h" | |
C 1.00 "Carol h" = 60 "Carol m" | |
P 2017-01-01 "Carol m" £.729166667 ; £350 / d | |
P 2017-09-01 "Carol m" £.9375 ; £450 / d | |
account Work:Client:Project:Carol | |
value s, d, t -> market("Carol m", d, "£") / 60 | |
C 1.00 "Carol cost d" = 8 "Carol cost h" | |
C 1.00 "Carol cost h" = 8 "Carol cost m" | |
P 2017-01-01 "Carol cost m" £.416666667 ; £200 / d | |
P 2017-09-01 "Carol cost m" £.520833333 ; £250 / d | |
account Liabilities:Team:Carol | |
value s, d, t -> market("Carol cost m", d, "£") / 60 | |
; imported from timesheets | |
2017-08-15 Work by Alice on the project in August | |
Work:Client:Project:Alice 4h | |
Liabilities:Team:Alice | |
2017-08-15 Work by Bob on the project in August | |
Work:Client:Project:Bob 4h | |
Liabilities:Team:Bob | |
2017-08-15 Work by Carol on the project in August | |
Work:Client:Project:Carol 4h | |
Liabilities:Team:Carol | |
2017-09-15 Work by Alice on the project in September | |
Work:Client:Project:Alice 4h | |
Liabilities:Team:Alice | |
2017-09-15 Work by Bob on the project in September | |
Work:Client:Project:Bob 4h | |
Liabilities:Team:Bob | |
2017-09-15 Work by Carol on the project in September | |
Work:Client:Project:Carol 4h | |
Liabilities:Team:Carol | |
; ❯ ledger reg -f coop.ledger -V --base Alice | |
; 17-Aug-15 Work by Alice.. Work:Client:Project:Alice £144.00 £144.00 | |
; Liabilities:Team:Alice -14400s -14400s | |
; £144.00 | |
; 17-Sep-15 Work by Alice.. Work:Client:Project:Alice £288.00 -14400s | |
; £432.00 | |
; Liabilities:Team:Alice -14400s -28800s | |
; £432.00 | |
; ❯ ledger reg -f coop.ledger -V --base Bob | |
; While calling function 'market (14400s ((((s, d, t) -> ((((post.date) < [2017/09/01]) ? ({£350.00} : {£450.00})) / {28800s})))), 2017/08/15, )': | |
; While handling posting from "/Users/LacKac/Code/100Starlings/100s/coop.ledger", line 23: | |
; > Work:Client:Project:Bob 4h | |
; Error: Expected return of a scope, but received a boolean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment