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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
def calculate_proprietary_ratio(
|
| 5 |
+
equity_share_capital, preference_share_capital, reserves_surplus,
|
| 6 |
+
land_building, plant_machinery, factory_equipment, office_equipment,
|
| 7 |
+
furniture_fixtures, motor_vehicles, computers, electrical_installations,
|
| 8 |
+
construction_in_progress, machinery_under_installation,
|
| 9 |
+
long_term_investments, long_term_loans_advances, security_deposits, deferred_tax_assets,
|
| 10 |
+
cash_on_hand, cash_at_bank, short_term_deposits, marketable_securities,
|
| 11 |
+
accounts_receivable, bills_receivable, inventory, prepaid_expenses,
|
| 12 |
+
accrued_income, short_term_loans_advances, gst_input_credit
|
| 13 |
+
):
|
| 14 |
+
|
| 15 |
+
# Shareholders' Funds
|
| 16 |
+
total_shareholders_funds = (
|
| 17 |
+
equity_share_capital + preference_share_capital + reserves_surplus
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# Tangible Fixed Assets
|
| 21 |
+
total_tangible_fixed_assets = (
|
| 22 |
+
land_building + plant_machinery + factory_equipment + office_equipment +
|
| 23 |
+
furniture_fixtures + motor_vehicles + computers + electrical_installations
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Capital Work-in-Progress
|
| 27 |
+
total_cwip = construction_in_progress + machinery_under_installation
|
| 28 |
+
|
| 29 |
+
# Financial Non-Current Assets
|
| 30 |
+
total_financial_non_current_assets = (
|
| 31 |
+
long_term_investments + long_term_loans_advances +
|
| 32 |
+
security_deposits + deferred_tax_assets
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
# Current Assets
|
| 36 |
+
total_current_assets = (
|
| 37 |
+
cash_on_hand + cash_at_bank + short_term_deposits +
|
| 38 |
+
marketable_securities + accounts_receivable + bills_receivable +
|
| 39 |
+
inventory + prepaid_expenses + accrued_income +
|
| 40 |
+
short_term_loans_advances + gst_input_credit
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
# Total Assets
|
| 44 |
+
total_assets = (
|
| 45 |
+
total_tangible_fixed_assets +
|
| 46 |
+
total_cwip +
|
| 47 |
+
total_financial_non_current_assets +
|
| 48 |
+
total_current_assets
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Proprietary Ratio
|
| 52 |
+
proprietary_ratio = (
|
| 53 |
+
total_shareholders_funds / total_assets
|
| 54 |
+
if total_assets != 0 else 0
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
summary = f"""
|
| 58 |
+
### 📊 Summary
|
| 59 |
+
|
| 60 |
+
- **Total Shareholders' Funds:** ₹ {total_shareholders_funds:,.2f}
|
| 61 |
+
- **Total Tangible Fixed Assets:** ₹ {total_tangible_fixed_assets:,.2f}
|
| 62 |
+
- **Total Capital Work-in-Progress:** ₹ {total_cwip:,.2f}
|
| 63 |
+
- **Total Financial Non-Current Assets:** ₹ {total_financial_non_current_assets:,.2f}
|
| 64 |
+
- **Total Current Assets:** ₹ {total_current_assets:,.2f}
|
| 65 |
+
- **Total Assets:** ₹ {total_assets:,.2f}
|
| 66 |
+
|
| 67 |
+
### 📈 Proprietary Ratio
|
| 68 |
+
**Proprietary Ratio = Shareholders' Funds / Total Assets = {proprietary_ratio:.2f}**
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
data = {
|
| 72 |
+
"Category": [
|
| 73 |
+
"Shareholders' Funds",
|
| 74 |
+
"Tangible Fixed Assets",
|
| 75 |
+
"Capital Work-in-Progress",
|
| 76 |
+
"Financial Non-Current Assets",
|
| 77 |
+
"Current Assets",
|
| 78 |
+
"Total Assets"
|
| 79 |
+
],
|
| 80 |
+
"Amount (₹)": [
|
| 81 |
+
total_shareholders_funds,
|
| 82 |
+
total_tangible_fixed_assets,
|
| 83 |
+
total_cwip,
|
| 84 |
+
total_financial_non_current_assets,
|
| 85 |
+
total_current_assets,
|
| 86 |
+
total_assets
|
| 87 |
+
]
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
df = pd.DataFrame(data)
|
| 91 |
+
|
| 92 |
+
return summary, df
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
with gr.Blocks() as demo:
|
| 96 |
+
gr.Markdown("## PROPRIETARY RATIO Calculator")
|
| 97 |
+
|
| 98 |
+
with gr.Accordion("Shareholders' Funds", open=True):
|
| 99 |
+
equity_share_capital = gr.Number(label="Equity Share Capital", value=0)
|
| 100 |
+
preference_share_capital = gr.Number(label="Preference Share Capital", value=0)
|
| 101 |
+
reserves_surplus = gr.Number(label="Reserves & Surplus", value=0)
|
| 102 |
+
|
| 103 |
+
with gr.Accordion("Tangible Fixed Assets", open=False):
|
| 104 |
+
land_building = gr.Number(label="Land & Building", value=0)
|
| 105 |
+
plant_machinery = gr.Number(label="Plant & Machinery", value=0)
|
| 106 |
+
factory_equipment = gr.Number(label="Factory Equipment", value=0)
|
| 107 |
+
office_equipment = gr.Number(label="Office Equipment", value=0)
|
| 108 |
+
furniture_fixtures = gr.Number(label="Furniture & Fixtures", value=0)
|
| 109 |
+
motor_vehicles = gr.Number(label="Motor Vehicles", value=0)
|
| 110 |
+
computers = gr.Number(label="Computers", value=0)
|
| 111 |
+
electrical_installations = gr.Number(label="Electrical Installations", value=0)
|
| 112 |
+
|
| 113 |
+
with gr.Accordion("Capital Work-in-Progress", open=False):
|
| 114 |
+
construction_in_progress = gr.Number(label="Construction in Progress", value=0)
|
| 115 |
+
machinery_under_installation = gr.Number(label="Machinery under Installation", value=0)
|
| 116 |
+
|
| 117 |
+
with gr.Accordion("Financial Non-Current Assets", open=False):
|
| 118 |
+
long_term_investments = gr.Number(label="Long-term Investments", value=0)
|
| 119 |
+
long_term_loans_advances = gr.Number(label="Long-term Loans & Advances", value=0)
|
| 120 |
+
security_deposits = gr.Number(label="Security Deposits", value=0)
|
| 121 |
+
deferred_tax_assets = gr.Number(label="Deferred Tax Assets", value=0)
|
| 122 |
+
|
| 123 |
+
with gr.Accordion("Current Assets", open=False):
|
| 124 |
+
cash_on_hand = gr.Number(label="Cash on Hand", value=0)
|
| 125 |
+
cash_at_bank = gr.Number(label="Cash at Bank", value=0)
|
| 126 |
+
short_term_deposits = gr.Number(label="Short-Term Deposits", value=0)
|
| 127 |
+
marketable_securities = gr.Number(label="Marketable Securities", value=0)
|
| 128 |
+
accounts_receivable = gr.Number(label="Accounts Receivable (Debtors)", value=0)
|
| 129 |
+
bills_receivable = gr.Number(label="Bills Receivable", value=0)
|
| 130 |
+
inventory = gr.Number(label="Inventory", value=0)
|
| 131 |
+
prepaid_expenses = gr.Number(label="Prepaid Expenses", value=0)
|
| 132 |
+
accrued_income = gr.Number(label="Accrued Income", value=0)
|
| 133 |
+
short_term_loans_advances = gr.Number(label="Short-term Loans & Advances", value=0)
|
| 134 |
+
gst_input_credit = gr.Number(label="GST Input Credit / Tax Receivables", value=0)
|
| 135 |
+
|
| 136 |
+
calculate_btn = gr.Button("Calculate Proprietary Ratio")
|
| 137 |
+
|
| 138 |
+
summary_output = gr.Markdown()
|
| 139 |
+
table_output = gr.Dataframe()
|
| 140 |
+
|
| 141 |
+
calculate_btn.click(
|
| 142 |
+
calculate_proprietary_ratio,
|
| 143 |
+
inputs=[
|
| 144 |
+
equity_share_capital, preference_share_capital, reserves_surplus,
|
| 145 |
+
land_building, plant_machinery, factory_equipment, office_equipment,
|
| 146 |
+
furniture_fixtures, motor_vehicles, computers, electrical_installations,
|
| 147 |
+
construction_in_progress, machinery_under_installation,
|
| 148 |
+
long_term_investments, long_term_loans_advances, security_deposits, deferred_tax_assets,
|
| 149 |
+
cash_on_hand, cash_at_bank, short_term_deposits, marketable_securities,
|
| 150 |
+
accounts_receivable, bills_receivable, inventory, prepaid_expenses,
|
| 151 |
+
accrued_income, short_term_loans_advances, gst_input_credit
|
| 152 |
+
],
|
| 153 |
+
outputs=[summary_output, table_output]
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
demo.launch()
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
gradio
|
| 160 |
+
pandas
|