when choosing a Tab, make the new bill drop-down be of that type. When we save a new bill, change the last-tab to be the type of bill we just added
This commit is contained in:
5
db.py
5
db.py
@@ -309,9 +309,12 @@ def get_bill_freqs():
|
||||
def new_bill( bill_type, amount, bill_date, estimated ):
|
||||
conn = connect_db(False)
|
||||
cur = conn.cursor()
|
||||
# force delete estimates as new bill will potentially change them/growth, etc.
|
||||
# if we are a real bill added by UI
|
||||
if not estimated:
|
||||
# delete old estimates as new bill will potentially change them/growth, etc.
|
||||
cur.execute( f"delete from bill_data where estimated=1" )
|
||||
# force the next /bills load to show the tab for the bill we are adding
|
||||
cur.execute( f"update bill_ui set last_tab='{bill_type}'" )
|
||||
cur.execute( f"insert into bill_data ( 'bill_type', 'amount', 'bill_date', 'estimated' ) values ( '{bill_type}', '{float(amount):.2f}', '{bill_date}', {estimated} )" )
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user