X-Git-Url: https://plomlompom.com/repos/process_titles?a=blobdiff_plain;f=ledger.py;h=9ff0d3eaabc723170071ffbb0e3a4726a6a747d0;hb=92c86eae1c6c758defda091b628a259d84f39b18;hp=817def60ea1f2f29feeb4a4436496b1f1d2158ad;hpb=4aa69f1601319ceeef640a4c56f9d2b1eb25cd6b;p=misc
diff --git a/ledger.py b/ledger.py
index 817def6..9ff0d3e 100755
--- a/ledger.py
+++ b/ledger.py
@@ -65,6 +65,10 @@ add_structured_html = """
+
+
+
+
@@ -520,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('
') ##
@@ -715,10 +727,15 @@ class LedgerDB(PlomDB):
lines += [f'Assets {amount:.2f} {currency}']
except PlomException:
pass
- if 'add_taxes' in postvars.keys():
+ elif 'add_taxes' in postvars.keys():
lines += self.add_taxes(lines, finish=False)
elif 'add_taxes2' in postvars.keys():
lines += self.add_taxes(lines, finish=True)
+ 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