def spend_curve(): confidence_level = float(request.form['confidence_level']) / 100 gender = request.form['gender'] age = int(request.form['age']) salary = float(request.form['salary']) contribution = float(request.form['contribution']) / 100 tax_type = request.form['tax'] if tax_type == 'Traditional': pre_tax_contrib = contribution post_tax_contrib = 0 else: pre_tax_contrib = 0 post_tax_contrib = contribution replacement_1 = float(request.form['replacement_1']) / 100 replacement_2 = float(request.form['replacement_2']) / 100 take_home_income = round( calc_take_home_income(salary, pre_tax_contrib, post_tax_contrib, income_tax_dict, fica_dict)) spend_down_age = calc_spend_down_age(age, gender, confidence_level) return jsonify({ 'spend_down_age': spend_down_age, 'target_0': take_home_income, 'target_1': take_home_income * replacement_1, 'target_2': take_home_income * replacement_2 })
def index(): spend_down_age = calc_spend_down_age(30, 'Male', 0.7) ss_benefit = round(calc_social_security_benefit(100000, 65)) default_take_home_income = round( calc_take_home_income(100000, 0, 0, income_tax_dict, fica_dict)) return render_template("index.html", spen_down_age=spend_down_age, ss_benefit=ss_benefit, take_home_income=default_take_home_income)
def target(): salary = float(request.form['salary']) contribution = float(request.form['contribution']) / 100 tax_type = request.form['tax'] if tax_type == 'Traditional': pre_tax_contrib = contribution post_tax_contrib = 0 else: pre_tax_contrib = 0 post_tax_contrib = contribution replacement_1 = float(request.form['replacement_1']) / 100 replacement_2 = float(request.form['replacement_2']) / 100 take_home_income = round( calc_take_home_income(salary, pre_tax_contrib, post_tax_contrib, income_tax_dict, fica_dict)) return jsonify({ 'target_0': take_home_income, 'target_1': take_home_income * replacement_1, 'target_2': take_home_income * replacement_2 })