mattoofahad
commited on
Commit
·
d769745
1
Parent(s):
9af1696
adding mutiple tab for each module
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import streamlit as st
|
|
| 4 |
from functions import Functions, StreamlitFunctions
|
| 5 |
from logs import logger
|
| 6 |
|
|
|
|
| 7 |
def calculate_salary_parameters():
|
| 8 |
logger.info("Calculating based on Salary parameters")
|
| 9 |
st.session_state.type_to_calculate = "salary_parameters"
|
|
@@ -18,45 +19,60 @@ def calculate_tax_on_current_salary():
|
|
| 18 |
logger.info("Calculating Tax on Current Salary")
|
| 19 |
st.session_state.type_to_calculate = "tax_on_current_salary"
|
| 20 |
|
|
|
|
| 21 |
def calculate_tax_on_yearly_salary():
|
| 22 |
logger.info("Calculating Tax on Yearly Salary")
|
| 23 |
st.session_state.type_to_calculate = "tax_on_yearly_salary"
|
| 24 |
-
|
|
|
|
| 25 |
StreamlitFunctions.initialize_session_values()
|
| 26 |
StreamlitFunctions.print_tax_brackets()
|
| 27 |
StreamlitFunctions.reset_tax_brackets()
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
| 35 |
)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
StreamlitFunctions.
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
StreamlitFunctions.
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
StreamlitFunctions.
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
if st.session_state.type_to_calculate is not None:
|
| 62 |
if st.session_state.type_to_calculate == "tax_on_current_salary":
|
|
@@ -105,7 +121,7 @@ if st.session_state.type_to_calculate is not None:
|
|
| 105 |
st.success(
|
| 106 |
"✅ Calculation was done based on the selected value of 'Tax on Yearly Salary'"
|
| 107 |
)
|
| 108 |
-
result = {key:value*12 for key, value in result.items()}
|
| 109 |
summary_df = pd.DataFrame(
|
| 110 |
{
|
| 111 |
"Parameter": [
|
|
|
|
| 4 |
from functions import Functions, StreamlitFunctions
|
| 5 |
from logs import logger
|
| 6 |
|
| 7 |
+
|
| 8 |
def calculate_salary_parameters():
|
| 9 |
logger.info("Calculating based on Salary parameters")
|
| 10 |
st.session_state.type_to_calculate = "salary_parameters"
|
|
|
|
| 19 |
logger.info("Calculating Tax on Current Salary")
|
| 20 |
st.session_state.type_to_calculate = "tax_on_current_salary"
|
| 21 |
|
| 22 |
+
|
| 23 |
def calculate_tax_on_yearly_salary():
|
| 24 |
logger.info("Calculating Tax on Yearly Salary")
|
| 25 |
st.session_state.type_to_calculate = "tax_on_yearly_salary"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
StreamlitFunctions.initialize_session_values()
|
| 29 |
StreamlitFunctions.print_tax_brackets()
|
| 30 |
StreamlitFunctions.reset_tax_brackets()
|
| 31 |
|
| 32 |
+
tab1, tab2, tab3, tab4 = st.tabs(
|
| 33 |
+
[
|
| 34 |
+
"Tax on Monthly Salary",
|
| 35 |
+
"Tax on Yearly Salary",
|
| 36 |
+
"Final Desired Net Salary",
|
| 37 |
+
"Desired Salary Calculation",
|
| 38 |
+
]
|
| 39 |
)
|
| 40 |
|
| 41 |
+
with tab1:
|
| 42 |
+
StreamlitFunctions.print_tax_on_current_salary()
|
| 43 |
+
StreamlitFunctions.reset_tax_on_current_salary()
|
| 44 |
+
st.button(
|
| 45 |
+
"Calculate Tax on Current Salary",
|
| 46 |
+
use_container_width=True,
|
| 47 |
+
on_click=calculate_tax_on_current_salary,
|
| 48 |
+
)
|
| 49 |
|
| 50 |
+
with tab2:
|
| 51 |
+
StreamlitFunctions.print_tax_on_yearly_salary()
|
| 52 |
+
StreamlitFunctions.reset_tax_on_yearly_salary()
|
| 53 |
+
st.button(
|
| 54 |
+
"Calculate Tax on Yearly Salary",
|
| 55 |
+
use_container_width=True,
|
| 56 |
+
on_click=calculate_tax_on_yearly_salary,
|
| 57 |
+
)
|
| 58 |
|
| 59 |
+
with tab3:
|
| 60 |
+
StreamlitFunctions.initial_salary_parameter()
|
| 61 |
+
StreamlitFunctions.reset_initial_salary_parameter()
|
| 62 |
+
st.button(
|
| 63 |
+
"Calculate Based on Desired Net Salary",
|
| 64 |
+
use_container_width=True,
|
| 65 |
+
on_click=calculate_initial_salary_parameter,
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
with tab4:
|
| 69 |
+
StreamlitFunctions.print_salary_parameters()
|
| 70 |
+
StreamlitFunctions.reset_salary_parameters()
|
| 71 |
+
st.button(
|
| 72 |
+
"Calculate Based on Salary Parameters",
|
| 73 |
+
use_container_width=True,
|
| 74 |
+
on_click=calculate_salary_parameters,
|
| 75 |
+
)
|
| 76 |
|
| 77 |
if st.session_state.type_to_calculate is not None:
|
| 78 |
if st.session_state.type_to_calculate == "tax_on_current_salary":
|
|
|
|
| 121 |
st.success(
|
| 122 |
"✅ Calculation was done based on the selected value of 'Tax on Yearly Salary'"
|
| 123 |
)
|
| 124 |
+
result = {key: value * 12 for key, value in result.items()}
|
| 125 |
summary_df = pd.DataFrame(
|
| 126 |
{
|
| 127 |
"Parameter": [
|