X-Git-Url: https://plomlompom.com/repos/new_day?a=blobdiff_plain;f=ledger.py;h=9ff0d3eaabc723170071ffbb0e3a4726a6a747d0;hb=93756ded23b6f80333ef26e434f611a94bd04764;hp=cd38b820da6354866cd23d64fb196a3ec9f40952;hpb=3faab835bd9d842cc0a529ba33007b3f85839e12;p=misc
diff --git a/ledger.py b/ledger.py
index cd38b82..9ff0d3e 100755
--- a/ledger.py
+++ b/ledger.py
@@ -68,6 +68,7 @@ add_structured_html = """
+
@@ -523,6 +524,14 @@ class LedgerDB(PlomDB):
ret += [f' {acc_buffer} {-final_minus} ⬠; assume as to earn in year: {acc_buffer} + {12 - months_passed - 1} * this = {year_needed}']
return ret
+ def add_mirror(self, lines):
+ ret = []
+ bookings, _ = parse_lines(lines)
+ booking = bookings[0]
+ for line in booking.lines[1:]:
+ ret += [f'? {-line[1]} {line[2]}']
+ return ret
+
def ledger_as_html(self):
booking_tmpl = jinja2.Template(booking_html)
single_c_tmpl = jinja2.Template('
') ##
@@ -725,6 +734,8 @@ class LedgerDB(PlomDB):
elif 'replace' in postvars.keys():
for i, line in enumerate(lines):
lines[i] = line.replace(postvars['replace_from'][0], postvars['replace_to'][0])
+ elif 'add_mirror' in postvars.keys():
+ lines += self.add_mirror(lines)
return lines, add_empty_line