-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayment.py
29 lines (25 loc) · 851 Bytes
/
payment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class PaymentRow(object):
"""
represents an actual payment on a given date.
"""
def __init__(self, payment_date, description, amount):
self.payment_date = payment_date
self.description = description
self.amount = amount
def as_row_values(self):
"""
Provide the details in the format of the monthly sheet, with these columns:
Expected date
Bank date
Description
Amount in
Amount out
"""
row = [self.payment_date.strftime("%d/%m/%Y"), '', self.description, '', '']
if self.amount > 0:
row[3] = "£{}".format(self.amount)
else:
row[4] = "£{}".format(-self.amount)
return row
def __str__(self):
return "{} : {} ({})".format(self.payment_date, self.amount, self.description)