add support for bill_freq
This commit is contained in:
11
main.py
11
main.py
@@ -1,9 +1,10 @@
|
|||||||
# main.py
|
# main.py
|
||||||
from flask import Flask, render_template, request, redirect, url_for, Response, jsonify
|
from flask import Flask, render_template, request, redirect, url_for, Response, jsonify
|
||||||
from calc import calculate_savings_depletion
|
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 init_db, get_finance_data, update_finance, get_budget_data, insert_cset, get_comp_set_data, get_comp_set_options, get_bill_freqs
|
||||||
from db import get_bill_data, new_bill, update_bill_data, delete_bill
|
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 db import get_bill_types, insert_bill_type, update_bill_type, delete_bill_type
|
||||||
|
from bills import derive_bill_data
|
||||||
from collections import defaultdict, Counter
|
from collections import defaultdict, Counter
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import csv
|
import csv
|
||||||
@@ -142,19 +143,21 @@ def update():
|
|||||||
def DisplayBillData():
|
def DisplayBillData():
|
||||||
bill_data = get_bill_data()
|
bill_data = get_bill_data()
|
||||||
bill_types = get_bill_types()
|
bill_types = get_bill_types()
|
||||||
|
bill_freqs = get_bill_freqs()
|
||||||
now=datetime.today().strftime('%Y-%m-%d')
|
now=datetime.today().strftime('%Y-%m-%d')
|
||||||
return render_template('bills.html', now=now, bill_data=bill_data, bill_types=bill_types )
|
derive_bill_data()
|
||||||
|
return render_template('bills.html', now=now, bill_data=bill_data, bill_types=bill_types, bill_freqs=bill_freqs )
|
||||||
|
|
||||||
@app.route('/newbilltype', methods=['POST'])
|
@app.route('/newbilltype', methods=['POST'])
|
||||||
def InsertBillType():
|
def InsertBillType():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
insert_bill_type( data['bill_type'] )
|
insert_bill_type( data['bill_type'], data['freq'] )
|
||||||
return "200"
|
return "200"
|
||||||
|
|
||||||
@app.route('/updatebilltype', methods=['POST'])
|
@app.route('/updatebilltype', methods=['POST'])
|
||||||
def UpdateBillType():
|
def UpdateBillType():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
update_bill_type( data['id'], data['bill_type'] )
|
update_bill_type( data['id'], data['bill_type'], data['freq'] )
|
||||||
return "200"
|
return "200"
|
||||||
|
|
||||||
@app.route('/newbill', methods=['POST'])
|
@app.route('/newbill', methods=['POST'])
|
||||||
|
|||||||
Reference in New Issue
Block a user