Changing a bill (bill_data) now works, as does cancelling cleanly - this is now functional. I have renamed/improved the left-hand-side fields, right-hand-side next - to improve consistency between html and db and bill_data and bill_type
This commit is contained in:
57
main.py
57
main.py
@@ -2,6 +2,8 @@
|
||||
from flask import Flask, render_template, request, redirect, url_for, Response, jsonify
|
||||
from calc import calculate_savings_depletion
|
||||
from db import init_db, get_finance_data, update_finance, get_budget_data, insert_cset, get_comp_set_data, get_comp_set_options
|
||||
from db import get_bill_data, new_bill, update_bill_data, delete_bill
|
||||
from db import get_bill_types, insert_bill_type, update_bill_type, delete_bill_type
|
||||
from collections import defaultdict, Counter
|
||||
from datetime import datetime
|
||||
import csv
|
||||
@@ -133,21 +135,52 @@ def update():
|
||||
request.form['compare_to'],
|
||||
request.form['Ioniq6_future']
|
||||
)
|
||||
|
||||
update_finance(finance_data)
|
||||
|
||||
return redirect(url_for('index'))
|
||||
|
||||
@app.route('/bills')
|
||||
def DisplayBillData():
|
||||
bill_data = get_bill_data()
|
||||
bill_types = get_bill_types()
|
||||
now=datetime.today().strftime('%Y-%m-%d')
|
||||
return render_template('bills.html', now=now, bill_data=bill_data, bill_types=bill_types )
|
||||
|
||||
@app.route('/newbilltype', methods=['POST'])
|
||||
def InsertBillType():
|
||||
data = request.get_json()
|
||||
insert_bill_type( data['bill_type'] )
|
||||
return "200"
|
||||
|
||||
@app.route('/updatebilltype', methods=['POST'])
|
||||
def UpdateBillType():
|
||||
data = request.get_json()
|
||||
update_bill_type( data['id'], data['bill_type'] )
|
||||
return "200"
|
||||
|
||||
@app.route('/newbill', methods=['POST'])
|
||||
def InsertBill():
|
||||
data = request.get_json()
|
||||
new_bill( data['name'], data['amount'], data['bill_date'] )
|
||||
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'] )
|
||||
return "200"
|
||||
|
||||
@app.route('/delbilltype', methods=['POST'])
|
||||
def DeleteBillType():
|
||||
data = request.get_json()
|
||||
delete_bill_type( data['id'] )
|
||||
return "200"
|
||||
|
||||
@app.route('/delbill', methods=['POST'])
|
||||
def DeleteBill():
|
||||
data = request.get_json()
|
||||
delete_bill( data['id'] )
|
||||
return "200"
|
||||
|
||||
# Main program
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
|
||||
|
||||
##########
|
||||
#
|
||||
# How to cross-check, so we get paid: 4762.29 + 1962.56 per fortnight or: $174846.1 AFTER TAX
|
||||
# take $20k for Cam, and $20k for Mich for schools last year, $10k for Cam pres, take $72k for living, take $8k in furniture.
|
||||
# We went from 250 to 300k (more or less), so about right
|
||||
# to note: transfers to Cam/Mich - $850
|
||||
#
|
||||
##########
|
||||
|
||||
Reference in New Issue
Block a user