allow handling creating future bills - for when I quit, and will help with when switch to owning Ioniq 6

This commit is contained in:
2025-09-02 22:59:45 +10:00
parent 95d792e72f
commit 2459dc6ea1

10
main.py
View File

@@ -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'])