Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -263,7 +263,7 @@ st.sidebar.markdown(html_content_1, unsafe_allow_html=True)
|
|
| 263 |
|
| 264 |
|
| 265 |
v1 = ["Commerce India", "Reliance", "Commerce Global", "Government Projects", "Individual BH"]
|
| 266 |
-
business_head = st.sidebar.selectbox("Business Head", [""] + v1, help="
|
| 267 |
company_id = st.sidebar.text_input("Company ID", help="Enter the company ID")
|
| 268 |
company_name = st.sidebar.text_input("Company Name", help="Enter the company name")
|
| 269 |
currency = st.sidebar.radio("Currency", options= ["INR", "USD"], help= "Select the type of currency", index =None)
|
|
@@ -386,24 +386,24 @@ if bundle_by == "Feature specific":
|
|
| 386 |
|
| 387 |
fee_type_mapping = fee_config['fee_type_mapping']
|
| 388 |
selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
|
| 389 |
-
help="
|
| 390 |
|
| 391 |
|
| 392 |
# 3rd layer mapping: Mapping of Fee type with variables
|
| 393 |
variable_type_mapping = var_config["variable_type_mapping"]
|
| 394 |
selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
|
| 395 |
-
help="
|
| 396 |
|
| 397 |
# 4th layer mapping: Mapping of Fee type with variables
|
| 398 |
chargeable_on_mapping = char_config["chargeable_on_mapping"]
|
| 399 |
selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
|
| 400 |
-
help="
|
| 401 |
|
| 402 |
# Create an empty DataFrame with the desired column names
|
| 403 |
slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage", "Capping/Min_Guarantee_value", "Threshold"])
|
| 404 |
|
| 405 |
ttt = ["Fixed %", "Flat currency", "Slab based"]
|
| 406 |
-
selected_fee_nature = st.selectbox("Fee Nature:", [""] + ttt, key="fee_nature_select")
|
| 407 |
|
| 408 |
if selected_fee_nature == "Slab based":
|
| 409 |
|
|
@@ -487,7 +487,7 @@ if bundle_by == "Feature specific":
|
|
| 487 |
|
| 488 |
# 6th layer: Expected Billing
|
| 489 |
fee_reversal_options = ["RTO", "DTO", "Cancel"]
|
| 490 |
-
fee_reversal = st.multiselect("Fee Reversal", fee_reversal_options) if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
|
| 491 |
reversal_per = st.number_input("Reversal %", min_value= 0.0, help = "Enter the reversal percentage") if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
|
| 492 |
|
| 493 |
usage_1 = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
|
|
@@ -506,7 +506,7 @@ if bundle_by == "Feature specific":
|
|
| 506 |
|
| 507 |
|
| 508 |
abc = ['Capping value', 'Minimum Guarantee']
|
| 509 |
-
threshold = st.selectbox("Threshold option:", [""] + abc)
|
| 510 |
|
| 511 |
initial_expected_billing = Product_1
|
| 512 |
|
|
@@ -532,8 +532,39 @@ if bundle_by == "Feature specific":
|
|
| 532 |
# Using Streamlit to display the HTML content
|
| 533 |
st.markdown(html_content_7, unsafe_allow_html=True)
|
| 534 |
|
| 535 |
-
selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="
|
| 536 |
-
selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 537 |
|
| 538 |
# Submit button
|
| 539 |
# Define CSS styles for the button
|
|
@@ -587,6 +618,7 @@ if bundle_by == "Feature specific":
|
|
| 587 |
"Expected_Billing": expected_billing,
|
| 588 |
"Payment_Method": selected_payment_method,
|
| 589 |
"Plan_Validity": selected_plan_validity,
|
|
|
|
| 590 |
}
|
| 591 |
|
| 592 |
global_user_data.append((user_name, user_data))
|
|
@@ -662,7 +694,8 @@ if bundle_by == "Feature specific":
|
|
| 662 |
"Payment_Method": selected_payment_method,
|
| 663 |
"Plan_Validity": selected_plan_validity,
|
| 664 |
"rule_id": rule_id,
|
| 665 |
-
"plan_id": plan_id
|
|
|
|
| 666 |
}
|
| 667 |
|
| 668 |
service_account_info = {
|
|
@@ -807,17 +840,17 @@ elif bundle_by == "Single value":
|
|
| 807 |
|
| 808 |
fee_type_mapping = fee_config['fee_type_mapping']
|
| 809 |
selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
|
| 810 |
-
help="
|
| 811 |
|
| 812 |
# 3rd layer mapping: Mapping of Fee type with variables
|
| 813 |
variable_type_mapping = var_config["variable_type_mapping"]
|
| 814 |
selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
|
| 815 |
-
help="
|
| 816 |
|
| 817 |
# 4th layer mapping: Mapping of Fee type with variables
|
| 818 |
chargeable_on_mapping = char_config["chargeable_on_mapping"]
|
| 819 |
selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
|
| 820 |
-
help="
|
| 821 |
|
| 822 |
usage_1 = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
|
| 823 |
usage_2 = float(usage_1)
|
|
@@ -825,6 +858,7 @@ elif bundle_by == "Single value":
|
|
| 825 |
|
| 826 |
expected_billing = user_input_3
|
| 827 |
|
|
|
|
| 828 |
html_content_8 = f"""
|
| 829 |
<h1 style='
|
| 830 |
color: #a689f6;
|
|
@@ -840,8 +874,37 @@ elif bundle_by == "Single value":
|
|
| 840 |
# Using Streamlit to display the HTML content
|
| 841 |
st.markdown(html_content_8, unsafe_allow_html=True)
|
| 842 |
|
| 843 |
-
selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="
|
| 844 |
-
selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
|
| 846 |
|
| 847 |
button_styles = """
|
|
@@ -894,7 +957,7 @@ elif bundle_by == "Single value":
|
|
| 894 |
"Expected Billing": user_input_3,
|
| 895 |
"Plan Validity": selected_plan_validity,
|
| 896 |
"Payment Method": selected_payment_method,
|
| 897 |
-
|
| 898 |
}
|
| 899 |
|
| 900 |
global_user_data.append((user_name, user_data))
|
|
@@ -975,7 +1038,8 @@ elif bundle_by == "Single value":
|
|
| 975 |
"Payment_Method": selected_payment_method,
|
| 976 |
"Plan_Validity": selected_plan_validity,
|
| 977 |
"rule_id": rule_id,
|
| 978 |
-
"plan_id": plan_id
|
|
|
|
| 979 |
}
|
| 980 |
|
| 981 |
service_account_info = {
|
|
|
|
| 263 |
|
| 264 |
|
| 265 |
v1 = ["Commerce India", "Reliance", "Commerce Global", "Government Projects", "Individual BH"]
|
| 266 |
+
business_head = st.sidebar.selectbox("Business Head", [""] + v1, help="Business Head is used for cost centre allocation")
|
| 267 |
company_id = st.sidebar.text_input("Company ID", help="Enter the company ID")
|
| 268 |
company_name = st.sidebar.text_input("Company Name", help="Enter the company name")
|
| 269 |
currency = st.sidebar.radio("Currency", options= ["INR", "USD"], help= "Select the type of currency", index =None)
|
|
|
|
| 386 |
|
| 387 |
fee_type_mapping = fee_config['fee_type_mapping']
|
| 388 |
selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
|
| 389 |
+
help="Fee type is a revenue head for grouping the revenue")
|
| 390 |
|
| 391 |
|
| 392 |
# 3rd layer mapping: Mapping of Fee type with variables
|
| 393 |
variable_type_mapping = var_config["variable_type_mapping"]
|
| 394 |
selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
|
| 395 |
+
help="Variable type is an attribute on which revenue calculation will be done")
|
| 396 |
|
| 397 |
# 4th layer mapping: Mapping of Fee type with variables
|
| 398 |
chargeable_on_mapping = char_config["chargeable_on_mapping"]
|
| 399 |
selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
|
| 400 |
+
help="Chargeable on is a service status on which above fee will be applicable")
|
| 401 |
|
| 402 |
# Create an empty DataFrame with the desired column names
|
| 403 |
slabs_df = pd.DataFrame(columns=["Slab", "Max_value", "Commercial_value", "Usage", "Capping/Min_Guarantee_value", "Threshold"])
|
| 404 |
|
| 405 |
ttt = ["Fixed %", "Flat currency", "Slab based"]
|
| 406 |
+
selected_fee_nature = st.selectbox("Fee Nature:", [""] + ttt, key="fee_nature_select", help = "Fee nature is an option to consume the price in flat / % / slab")
|
| 407 |
|
| 408 |
if selected_fee_nature == "Slab based":
|
| 409 |
|
|
|
|
| 487 |
|
| 488 |
# 6th layer: Expected Billing
|
| 489 |
fee_reversal_options = ["RTO", "DTO", "Cancel"]
|
| 490 |
+
fee_reversal = st.multiselect("Fee Reversal", fee_reversal_options, help = "Fee reversal is an option of reversing to be given to any fee on a particular service status") if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
|
| 491 |
reversal_per = st.number_input("Reversal %", min_value= 0.0, help = "Enter the reversal percentage") if selected_fee_type == "Transaction" and selected_variable_type == "Bag" else None
|
| 492 |
|
| 493 |
usage_1 = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
|
|
|
|
| 506 |
|
| 507 |
|
| 508 |
abc = ['Capping value', 'Minimum Guarantee']
|
| 509 |
+
threshold = st.selectbox("Threshold option:", [""] + abc, help = "If Minimum guarantee is set as threshold option then Expected billing will be the higher value b/w 'Commercial*Usage' & 'Threshold' and if it is set to Capping then Expected billing will be the lower value b/w 'Commercial*Usage' & 'Threshold'")
|
| 510 |
|
| 511 |
initial_expected_billing = Product_1
|
| 512 |
|
|
|
|
| 532 |
# Using Streamlit to display the HTML content
|
| 533 |
st.markdown(html_content_7, unsafe_allow_html=True)
|
| 534 |
|
| 535 |
+
selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="Plan validity defines the periodicity of calculation for the above billing", key="plan_vd_2")
|
| 536 |
+
selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="Payment method defines the mode of payment of the plan", key="py_vd_2")
|
| 537 |
+
|
| 538 |
+
|
| 539 |
+
initial_net_billing = 0
|
| 540 |
+
|
| 541 |
+
if selected_plan_validity == 'One time' or selected_plan_validity == 'Monthly':
|
| 542 |
+
final_billing = 1*expected_billing
|
| 543 |
+
elif selected_plan_validity == 'Quarterly':
|
| 544 |
+
final_billing = 3*expected_billing
|
| 545 |
+
elif selected_plan_validity == 'Bi-Annually':
|
| 546 |
+
final_billing = 6*expected_billing
|
| 547 |
+
elif selected_plan_validity == 'Annually':
|
| 548 |
+
final_billing = 12*expected_billing
|
| 549 |
+
else:
|
| 550 |
+
final_billing = initial_net_billing
|
| 551 |
+
|
| 552 |
+
|
| 553 |
+
html_content_8 = f"""
|
| 554 |
+
<h1 style='
|
| 555 |
+
color: #a689f6;
|
| 556 |
+
font-size: 20px;
|
| 557 |
+
background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
|
| 558 |
+
background-clip: text;
|
| 559 |
+
-webkit-background-clip: text;
|
| 560 |
+
text-fill-color: transparent;
|
| 561 |
+
-webkit-text-fill-color: transparent;
|
| 562 |
+
'>Net total billing (excluding GST): {final_billing}</h1>
|
| 563 |
+
"""
|
| 564 |
+
|
| 565 |
+
# Using Streamlit to display the HTML content
|
| 566 |
+
st.markdown(html_content_8, unsafe_allow_html=True)
|
| 567 |
+
|
| 568 |
|
| 569 |
# Submit button
|
| 570 |
# Define CSS styles for the button
|
|
|
|
| 618 |
"Expected_Billing": expected_billing,
|
| 619 |
"Payment_Method": selected_payment_method,
|
| 620 |
"Plan_Validity": selected_plan_validity,
|
| 621 |
+
"Net total billing":final_billing
|
| 622 |
}
|
| 623 |
|
| 624 |
global_user_data.append((user_name, user_data))
|
|
|
|
| 694 |
"Payment_Method": selected_payment_method,
|
| 695 |
"Plan_Validity": selected_plan_validity,
|
| 696 |
"rule_id": rule_id,
|
| 697 |
+
"plan_id": plan_id,
|
| 698 |
+
"Net total billing":final_billing
|
| 699 |
}
|
| 700 |
|
| 701 |
service_account_info = {
|
|
|
|
| 840 |
|
| 841 |
fee_type_mapping = fee_config['fee_type_mapping']
|
| 842 |
selected_fee_type = st.selectbox("Fee Type", [""] + fee_type_mapping.get(ordering_channels, []),
|
| 843 |
+
help="Fee type is a revenue head for grouping the revenue")
|
| 844 |
|
| 845 |
# 3rd layer mapping: Mapping of Fee type with variables
|
| 846 |
variable_type_mapping = var_config["variable_type_mapping"]
|
| 847 |
selected_variable_type = st.selectbox("Variable Type", [""] + variable_type_mapping.get(selected_fee_type, []),
|
| 848 |
+
help="Variable type is an attribute on which revenue calculation will be done")
|
| 849 |
|
| 850 |
# 4th layer mapping: Mapping of Fee type with variables
|
| 851 |
chargeable_on_mapping = char_config["chargeable_on_mapping"]
|
| 852 |
selected_chargeable_on = st.selectbox("Chargeable on", [""] + chargeable_on_mapping.get(selected_variable_type, []),
|
| 853 |
+
help="Chargeable on is a service status on which above fee will be applicable")
|
| 854 |
|
| 855 |
usage_1 = st.number_input(f"Usage limit for {selected_variable_type}", min_value=0.0, help="Enter the usage limit")
|
| 856 |
usage_2 = float(usage_1)
|
|
|
|
| 858 |
|
| 859 |
expected_billing = user_input_3
|
| 860 |
|
| 861 |
+
|
| 862 |
html_content_8 = f"""
|
| 863 |
<h1 style='
|
| 864 |
color: #a689f6;
|
|
|
|
| 874 |
# Using Streamlit to display the HTML content
|
| 875 |
st.markdown(html_content_8, unsafe_allow_html=True)
|
| 876 |
|
| 877 |
+
selected_plan_validity = st.selectbox("Plan Validity", [""] + plan_validity_options, help="Plan validity defines the periodicity of calculation for the above billing", key="plan_vd_2")
|
| 878 |
+
selected_payment_method = st.selectbox("Payment Method", [""] + payment_method_options, help="Payment method defines the mode of payment of the plan", key="py_vd_2")
|
| 879 |
+
|
| 880 |
+
initial_net_billing = 0
|
| 881 |
+
|
| 882 |
+
if selected_plan_validity == 'One time' and selected_plan_validity == 'Monthly':
|
| 883 |
+
final_billing = 1*expected_billing
|
| 884 |
+
elif selected_plan_validity == 'Quarterly':
|
| 885 |
+
final_billing = 3*expected_billing
|
| 886 |
+
elif selected_plan_validity == 'Bi-Annually':
|
| 887 |
+
final_billing = 6*expected_billing
|
| 888 |
+
elif selected_plan_validity == 'Annually':
|
| 889 |
+
final_billing = 12*expected_billing
|
| 890 |
+
else:
|
| 891 |
+
final_billing = initial_net_billing
|
| 892 |
+
|
| 893 |
+
|
| 894 |
+
html_content_8 = f"""
|
| 895 |
+
<h1 style='
|
| 896 |
+
color: #a689f6;
|
| 897 |
+
font-size: 20px;
|
| 898 |
+
background-image: -webkit-linear-gradient(0deg, #a689f6 3%, #272191 33%, #413bb9 61%);
|
| 899 |
+
background-clip: text;
|
| 900 |
+
-webkit-background-clip: text;
|
| 901 |
+
text-fill-color: transparent;
|
| 902 |
+
-webkit-text-fill-color: transparent;
|
| 903 |
+
'>Net total billing (excluding GST): {final_billing}</h1>
|
| 904 |
+
"""
|
| 905 |
+
|
| 906 |
+
# Using Streamlit to display the HTML content
|
| 907 |
+
st.markdown(html_content_8, unsafe_allow_html=True)
|
| 908 |
|
| 909 |
|
| 910 |
button_styles = """
|
|
|
|
| 957 |
"Expected Billing": user_input_3,
|
| 958 |
"Plan Validity": selected_plan_validity,
|
| 959 |
"Payment Method": selected_payment_method,
|
| 960 |
+
"Net total billing":final_billing
|
| 961 |
}
|
| 962 |
|
| 963 |
global_user_data.append((user_name, user_data))
|
|
|
|
| 1038 |
"Payment_Method": selected_payment_method,
|
| 1039 |
"Plan_Validity": selected_plan_validity,
|
| 1040 |
"rule_id": rule_id,
|
| 1041 |
+
"plan_id": plan_id,
|
| 1042 |
+
"Net total billing":final_billing
|
| 1043 |
}
|
| 1044 |
|
| 1045 |
service_account_info = {
|