trts commited on
Commit
112ce92
·
verified ·
1 Parent(s): fab1b45

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +42 -0
  2. pages/calc.py +42 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.header("Profit Calc")
4
+ col1, col2, col3 = st.columns(3)
5
+ with col1:
6
+ balance = st.number_input("Total Capital ₹", min_value=0)
7
+ initialbalance = balance
8
+ with col2:
9
+ investment = st.number_input("Investment ₹", min_value=0)
10
+ balance = balance - investment
11
+ with col3:
12
+ prof = st.number_input("Profit %", min_value=0)
13
+ profit = (prof/100) * investment
14
+ pbt = profit
15
+ brokerage = st.number_input("Brokerage Charges ₹", min_value=0)
16
+ col4, col5 = st.columns(2)
17
+ with col4:
18
+ incometax = st.number_input("Incometax Charges %", min_value=0)
19
+ with col5:
20
+ service = st.number_input("Service Charges %", min_value=0)
21
+ incometaxcharge = (incometax/100) * profit
22
+ servicecharge = (service/100) * incometaxcharge
23
+ totalcharge = incometaxcharge + servicecharge + brokerage
24
+
25
+ profit = profit - totalcharge
26
+
27
+ totalprofit = profit + investment
28
+
29
+ balance = balance + totalprofit
30
+ st.sidebar.header("Dashboard")
31
+
32
+ st.sidebar.write("Balance: ₹", balance)
33
+ st.sidebar.write("Total Charges ₹",totalcharge)
34
+ st.sidebar.write("Profit: ₹", profit)
35
+ st.sidebar.write("Investment + Profit ₹",totalprofit)
36
+
37
+ data = {
38
+ "name": ["Initial Balance", "Investment", "Profit Before Tax","brokerage charges","incometax charges", "service charges", "Final Profit", " Final Balance"],
39
+ "Rs.": [initialbalance, investment, pbt, brokerage, incometaxcharge, servicecharge, profit, balance]
40
+ }
41
+ st.sidebar.header("Chart")
42
+ st.sidebar.dataframe(data)
pages/calc.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import matplotlib.pyplot as plt
3
+ st.header("Profit Calc")
4
+
5
+ # Function to calculate final balance after each investment
6
+ def calculate_final_balance(initial_balance, investment, profit_percentage, brokerage, incometax_percentage, service_percentage):
7
+ balance = initial_balance
8
+ total_investments = 0
9
+
10
+ while balance < 10000000:
11
+ prof = (profit_percentage / 100) * investment
12
+ pbt = prof
13
+ incometaxcharge = (incometax_percentage / 100) * prof
14
+ servicecharge = (service_percentage / 100) * incometaxcharge
15
+ totalcharge = incometaxcharge + servicecharge + brokerage
16
+
17
+ profit = prof - totalcharge
18
+ total_profit = profit + investment
19
+
20
+ balance += total_profit
21
+ total_investments += 1
22
+
23
+ return balance, total_investments
24
+ col1, col2, col3 = st.columns(3)
25
+ with col1:
26
+ initial_balance = st.number_input("Total Capital ₹", min_value=0)
27
+ with col2:
28
+ investment = st.number_input("Investment ₹", min_value=0)
29
+ with col3:
30
+ profit_percentage = st.number_input("Profit %", min_value=0)
31
+ brokerage = st.number_input("Brokerage Charges ₹", min_value=0) # You can set brokerage, incometax_percentage, and service_percentage as needed
32
+ col4, col5 = st.columns(2)
33
+ with col4:
34
+ incometax_percentage = st.number_input("Incometax Charges %", min_value=0)
35
+ with col5:
36
+ service_percentage = st.number_input("Service Charges %", min_value=0)
37
+
38
+ final_balance, total_investments = calculate_final_balance(initial_balance, investment, profit_percentage, brokerage, incometax_percentage, service_percentage)
39
+
40
+
41
+ st.write(f"Final Balance after {total_investments} investments: ₹{final_balance:.2f}")
42
+ st.write(f"Total Investments: {total_investments}")