From 2459dc6ea1e9ff9b4b6fbad7cba9e680e7fe6534 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Tue, 2 Sep 2025 22:59:45 +1000 Subject: [PATCH] allow handling creating future bills - for when I quit, and will help with when switch to owning Ioniq 6 --- main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 622815e..080516e 100644 --- a/main.py +++ b/main.py @@ -5,7 +5,7 @@ from db import init_db, get_finance_data, update_finance, get_budget_data, inser from db import get_bill_data, new_bill, update_bill_data, delete_bill from db import get_bill_ui, save_ui from db import get_bill_types, insert_bill_type, update_bill_type, delete_bill_type, use_growth -from bills import process_bill_data, calc_future_totals +from bills import process_bill_data, calc_future_totals, set_bill_type_growth from defines import END_YEAR from collections import defaultdict, Counter from datetime import datetime, date @@ -168,13 +168,17 @@ def UpdateBillType(): def InsertBill(): data = request.get_json() # last param is estimated - e.g. anything via GUI is not an estimate, but is a real bill - new_bill( data['name'], data['amount'], data['bill_date'], 0 ) + if 'bill_date' in data: + new_bill( data['bill_type'], data['amount'], data['bill_date'], 0 ) + else: + new_bill( data['bill_type'], data['amount'], 'future', 0 ) + set_bill_type_growth( data['bill_type'], 0, 0, 0, data['growth'] ) return "200" @app.route('/updatebill', methods=['POST']) def UpdateBill(): data = request.get_json() - update_bill_data( data['id'], data['name'], data['amount'], data['bill_date'] ) + update_bill_data( data['id'], data['bill_type'], data['amount'], data['bill_date'] ) return "200" @app.route('/delbilltype', methods=['POST'])