Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16 from gratipay/peters-feedback
Browse files Browse the repository at this point in the history
incorporate Peter's feedback
  • Loading branch information
kaguillera committed Feb 3, 2016
2 parents b4f02c8 + 87ebe4b commit d979ed3
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 174 deletions.
152 changes: 76 additions & 76 deletions FY2013/2012-06.dat
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
2012-06-01 Opening Balance
Assets:Operations:New Alliance $ 102.45
Equity:Owners:Chad Whitacre
Equity:Owners:Chad Whitacre -$ 102.45

; Gittip Payday 0
2012-06-01 Users
Assets:Escrow:Samurai $ 2.96
Assets:Fee Buffer:Samurai $ 0.34
Income:Fee Buffer:Samurai -$ 0.34
Income:Escrow:Samurai
2012-06-01 Retained Earnings
Income:Escrow:Samurai -$ 2.96
2012-06-01 Balance Sheet
Income:Escrow:Samurai $ 2.96
Income:Fee Buffer:Samurai $ 0.34
Equity:Retained Earnings -$ 0.34
Liabilities:Escrow
Liabilities:Fee Buffer -$ 0.34
Liabilities:Escrow -$ 2.96

2012-06-04 Settlement
; We expected $3.30, but saw $7.56 instead: an overpayment of $4.26.
Expand All @@ -21,44 +21,44 @@
Assets:Operations:New Alliance $ 4.26
Income:Operations:Errors:Samurai -$ 4.26
Assets:Fee Buffer:Samurai -$ 0.34
Assets:Escrow:Samurai
2012-06-04 Retained Earnings
Assets:Escrow:Samurai -$ 2.96
2012-06-04 Balance Sheet
Income:Operations:Errors:Samurai $ 4.26
Equity:Retained Earnings
Equity:Current Activity -$ 4.26

2012-06-04 Samurai
Expenses:Fee Buffer:Samurai $ 0.08
Assets:Fee Buffer:New Alliance
2012-06-04 Retained Earnings
Equity:Retained Earnings $ 0.08
Expenses:Fee Buffer:Samurai
Assets:Fee Buffer:New Alliance -$ 0.08
2012-06-04 Balance Sheet
Liabilities:Fee Buffer $ 0.08
Expenses:Fee Buffer:Samurai -$ 0.08

2012-06-04 Samurai
Expenses:Fee Buffer:Samurai $ 31.35
Assets:Fee Buffer:New Alliance
2012-06-04 Retained Earnings
Equity:Retained Earnings $ 31.35
Expenses:Fee Buffer:Samurai
Assets:Fee Buffer:New Alliance -$ 31.35
2012-06-04 Balance Sheet
Liabilities:Fee Buffer $ 31.35
Expenses:Fee Buffer:Samurai -$ 31.35

; Gittip Payday 1
2012-06-08 Users
Assets:Escrow:Samurai $ 23.17
Assets:Fee Buffer:Samurai $ 2.11
Income:Fee Buffer:Samurai -$ 2.11
Income:Escrow:Samurai
2012-06-08 Retained Earnings
Income:Escrow:Samurai -$ 23.17
2012-06-08 Balance Sheet
Income:Escrow:Samurai $ 23.17
Income:Fee Buffer:Samurai $ 2.11
Equity:Retained Earnings -$ 2.11
Liabilities:Escrow
Liabilities:Fee Buffer -$ 2.11
Liabilities:Escrow -$ 23.17

2012-06-11 Settlement
; AMEX
; We expected 0.61, and we saw 0.61.
Assets:Escrow:New Alliance $ 0.48
Assets:Fee Buffer:New Alliance $ 0.13
Assets:Fee Buffer:Samurai -$ 0.13
Assets:Escrow:Samurai
Assets:Escrow:Samurai -$ 0.48

2012-06-11 Settlement
; VISA + MasterCard
Expand All @@ -68,50 +68,50 @@
Expenses:Operations:Errors:Samurai $ 0.56
Assets:Operations:New Alliance -$ 0.56
Assets:Fee Buffer:Samurai -$ 1.98
Assets:Escrow:Samurai
2012-06-11 Retained Earnings
Equity:Retained Earnings $ 0.56
Expenses:Operations:Errors:Samurai
Assets:Escrow:Samurai -$ 22.69
2012-06-11 Balance Sheet
Equity:Current Activity $ 0.56
Expenses:Operations:Errors:Samurai -$ 0.56

2012-06-11 Samurai
Expenses:Fee Buffer:Samurai $ 2.00
Assets:Fee Buffer:New Alliance
2012-06-11 Retained Earnings
Equity:Retained Earnings $ 2.00
Expenses:Fee Buffer:Samurai
Assets:Fee Buffer:New Alliance -$ 2.00
2012-06-11 Balance Sheet
Liabilities:Fee Buffer $ 2.00
Expenses:Fee Buffer:Samurai -$ 2.00

; Gittip Payday 2
2012-06-15 Users
Assets:Escrow:Samurai $ 1.36
Assets:Fee Buffer:Samurai $ 0.69
Income:Fee Buffer:Samurai -$ 0.69
Income:Escrow:Samurai
2012-06-15 Retained Earnings
Income:Escrow:Samurai -$ 1.36
2012-06-15 Balance Sheet
Income:Escrow:Samurai $ 1.36
Income:Fee Buffer:Samurai $ 0.69
Equity:Retained Earnings -$ 0.69
Liabilities:Escrow
Liabilities:Fee Buffer -$ 0.69
Liabilities:Escrow -$ 1.36

; Our first payout! Chad took money out of his pocket and put it in Steve Klabnik's hand.
2012-06-15 Owners
; Chad increases our escrow with cash from his pocket, pushing above what we need.
Assets:Escrow:Cash $ 1.50
Equity:Owners:Chad Whitacre
Equity:Owners:Chad Whitacre -$ 1.50
2012-06-15 Escrow
; We bleed off the excess escrow over to operations(!?).
Assets:Operations:New Alliance $ 1.50
Assets:Escrow:New Alliance
Assets:Escrow:New Alliance -$ 1.50
2012-06-15 Users
; Now we can do the payout ...
Expenses:Escrow:Cash $ 1.50
Income:Fee Buffer:Cash $ 0.00
Assets:Fee Buffer:Cash -$ 0.00
Assets:Escrow:Cash
2012-06-15 Retained Earnings
Assets:Escrow:Cash -$ 1.50
2012-06-15 Balance Sheet
Liabilities:Escrow $ 1.50
Equity:Retained Earnings $ 0.00
Liabilities:Fee Buffer $ 0.00
Expenses:Fee Buffer:Cash -$ 0.00
Expenses:Escrow:Cash
Expenses:Escrow:Cash -$ 1.50

2012-06-18 Settlement
; We expected $2.05, but only saw $2.01: an underpayment of $0.04.
Expand All @@ -120,91 +120,91 @@
Expenses:Operations:Errors:Samurai $ 0.04
Assets:Operations:New Alliance -$ 0.04
Assets:Fee Buffer:Samurai -$ 0.69
Assets:Escrow:Samurai
2012-06-18 Retained Earnings
Equity:Retained Earnings $ 0.04
Expenses:Operations:Errors:Samurai
Assets:Escrow:Samurai -$ 1.36
2012-06-18 Balance Sheet
Equity:Current Activity $ 0.04
Expenses:Operations:Errors:Samurai -$ 0.04

; Testing out Stripe
2012-06-15 Users
Assets:Operations:Stripe $ 0.54
Income:Operations:Verification & Testing
2012-06-15 Retained Earnings
Income:Operations:Verification & Testing -$ 0.54
2012-06-15 Balance Sheet
Income:Operations:Verification & Testing $ 0.54
Equity:Retained Earnings
Equity:Current Activity -$ 0.54

2012-06-22 Stripe
Expenses:Operations:Processing:Stripe $ 0.32
Assets:Operations:Stripe
2012-06-22 Retained Earnings
Equity:Retained Earnings $ 0.32
Expenses:Operations:Processing:Stripe
Assets:Operations:Stripe -$ 0.32
2012-06-22 Balance Sheet
Equity:Current Activity $ 0.32
Expenses:Operations:Processing:Stripe -$ 0.32

2012-06-22 Settlement
Assets:Operations:New Alliance $ 0.22
Assets:Operations:Stripe
Assets:Operations:Stripe -$ 0.22

; Gittip Payday 3
2012-06-22 Users
Assets:Escrow:Stripe $ 20.67
Assets:Fee Buffer:Stripe $ 4.62
Income:Fee Buffer:Stripe -$ 4.62
Income:Escrow:Stripe
2012-06-22 Retained Earnings
Income:Escrow:Stripe -$ 20.67
2012-06-22 Balance Sheet
Income:Escrow:Stripe $ 20.67
Income:Fee Buffer:Stripe $ 4.62
Equity:Retained Earnings -$ 4.62
Liabilities:Escrow
Liabilities:Fee Buffer -$ 4.62
Liabilities:Escrow -$ 20.67

2012-06-22 Stripe
Expenses:Fee Buffer:Stripe $ 4.32
Assets:Fee Buffer:Stripe
2012-06-22 Retained Earnings
Equity:Retained Earnings $ 4.32
Expenses:Fee Buffer:Stripe
Assets:Fee Buffer:Stripe -$ 4.32
2012-06-22 Balance Sheet
Liabilities:Fee Buffer $ 4.32
Expenses:Fee Buffer:Stripe -$ 4.32

2012-06-28 Settlement
Assets:Escrow:New Alliance $ 20.67
Assets:Fee Buffer:New Alliance $ 0.30
Assets:Fee Buffer:Stripe -$ 0.30
Assets:Escrow:Stripe
Assets:Escrow:Stripe -$ 20.67
2012-06-28 Settlement

; Gittip Payday 4
2012-06-29 Users
Assets:Escrow:Stripe $ 95.24
Assets:Fee Buffer:Stripe $ 15.76
Income:Fee Buffer:Stripe -$ 15.76
Income:Escrow:Stripe
2012-06-29 Retained Earnings
Income:Escrow:Stripe -$ 95.24
2012-06-29 Balance Sheet
Income:Escrow:Stripe $ 95.24
Income:Fee Buffer:Stripe $ 15.76
Equity:Retained Earnings -$ 15.76
Liabilities:Escrow
Liabilities:Fee Buffer -$ 15.76
Liabilities:Escrow -$ 95.24

2012-06-29 Stripe
Expenses:Fee Buffer:Stripe $ 14.63
Assets:Fee Buffer:Stripe
2012-06-29 Retained Earnings
Equity:Retained Earnings $ 14.63
Expenses:Fee Buffer:Stripe
Assets:Fee Buffer:Stripe -$ 14.63
2012-06-29 Balance Sheet
Liabilities:Fee Buffer $ 14.63
Expenses:Fee Buffer:Stripe -$ 14.63

; IHasAMoney.com
2012-06-18 Users
Assets:Operations:Samurai $ 2.92
Income:Operations:IHasAMoney.com
2012-06-18 Retained Earnings
Income:Operations:IHasAMoney.com -$ 2.92
2012-06-18 Balance Sheet
Income:Operations:IHasAMoney.com $ 2.92
Equity:Retained Earnings
Equity:Current Activity -$ 2.92
2012-06-18 Settlement
Assets:Operations:New Alliance $ 2.92
Assets:Operations:Samurai
Assets:Operations:Samurai -$ 2.92
2012-06-25 Users
Assets:Operations:Samurai $ 2.99
Income:Operations:IHasAMoney.com
2012-06-25 Retained Earnings
Income:Operations:IHasAMoney.com -$ 2.99
2012-06-25 Balance Sheet
Income:Operations:IHasAMoney.com $ 2.99
Equity:Retained Earnings
Equity:Current Activity -$ 2.99
2012-06-25 Settlement
Assets:Operations:New Alliance $ 2.99
Assets:Operations:Samurai
Assets:Operations:Samurai -$ 2.99
1 change: 1 addition & 0 deletions bin/escrow-statement.py
1 change: 1 addition & 0 deletions bin/fee-buffer-statement.py
34 changes: 1 addition & 33 deletions bin/income-statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,10 @@

import sys
from os import path
import calendar

ourdir = path.realpath(path.dirname(__file__))
sys.path.insert(0, ourdir)

import reporting

base = path.realpath(path.join(path.dirname(__file__), '..'))
cmd = [ 'ledger'
, 'balance'
, '^Income'
, '^Expense'
, '--prepend-width=0' # this is here to satisfy ledger on Travis
, '--limit "not (payee =~ /^Retained Earnings$/)"'
, '--sort "account =~ /^Income.*/ ? 0 : '
, '(account =~ /^Expense.*/ ? 1 : 2))"'
]
cmd += sys.argv[1:]

start, end = reporting.parse(sys.argv[1:])
cmd += reporting.list_datfiles(start, end)

print()
print("INCOME STATEMENT".center(42))
if start == end:
print("for {}, {}".format(calendar.month_name[int(end[1])], end[0]).center(42))
elif start[0] == end[0]:
print("for {} through {}, {}".format( calendar.month_name[int(start[1])]
, calendar.month_name[int(end[1])]
, end[0]).center(42)
)
else:
print("for {}, {} through {}, {}".format( calendar.month_name[int(start[1])]
, start[0]
, calendar.month_name[int(end[1])]
, end[0]
).center(42))
print()
reporting.report(cmd)
reporting.income_statement()
29 changes: 17 additions & 12 deletions bin/rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import sys
from os import path, chdir
from os import path

ourdir = path.realpath(path.dirname(__file__))
sys.path.insert(0, ourdir)

import reporting

OLD, NEW = sys.argv[1:3]

chdir(reporting.root)
for filename in reporting.list_datfiles():
with open(filename, 'r') as fp:
contents = fp.read()
for tmpl in (" {:<64}$", " {:<63}-$", " {}\n"):
old = tmpl.format(OLD)
new = tmpl.format(NEW)
contents = contents.replace(old, new)
with open(filename, 'w+') as fp:
fp.write(contents)
@reporting.in_root
def rename():
old_name, new_name = sys.argv[1:3]
for dash_f in reporting.list_datfiles():
filename = dash_f[len('-f '):]
with open(filename, 'r') as fp:
contents = fp.read()
for tmpl in (" {:<64}$", " {:<63}-$"):
old = tmpl.format(old_name)
new = tmpl.format(new_name)
contents = contents.replace(old, new)
with open(filename, 'w+') as fp:
fp.write(contents)

if __name__ == '__main__':
rename()
Loading

0 comments on commit d979ed3

Please sign in to comment.