1 <%inherit file="/base.mako"/>
4 from decimal import Decimal
7 <form action="${h.url_for(controller='spend', action='update', id=c.expenditure.id)}" method="post">
10 <th><label for="spender_id">Spender</label></th>
11 <td>${h.select('spender_id', c.expenditure.spender_id, c.users)}</td>
14 <th><label for="amount">Amount</label></th>
15 <td>$${h.text('amount', "%0.2f" % (int(c.expenditure.amount) / 100.), size=8)}</td>
18 <th><label for="date">Date</label></th>
19 <td>${h.text('date', c.expenditure.date.strftime('%m/%d/%Y'), size=16, class_='datepicker')}</td>
22 <th><label for="description">Description</label></th>
23 <td>${h.text('description', c.expenditure.description, size=64)}</td>
27 <p>Change how an expenditure is split up. Enter a percentage, or something like a percentage, for each user. They don't have to add to 100.</p>
30 % for user_id, user in c.users:
33 percent = c.values['shares-%d.amount' % user_id]
37 share = [s.share for s in c.expenditure.splits if s.user == user][0]
38 percent = (Decimal(100) * Decimal(int(share)) / Decimal(int(c.expenditure.amount))).quantize(Decimal("0.001"))
42 if user == request.environ['user']:
49 <label for="shares-${user_id}amount">${user.name}</label>
52 ${h.text('shares-%d.amount' % user_id, percent)}
53 ${h.hidden('shares-%d.user_id' % user_id, user.id)}
59 ${h.submit(None, 'Submit', class_="submitbutton")}