| | import gradio as gr |
| | import pandas as pd |
| |
|
| | def calculate_proprietary_ratio( |
| | equity_share_capital, preference_share_capital, reserves_surplus, |
| | land_building, plant_machinery, factory_equipment, office_equipment, |
| | furniture_fixtures, motor_vehicles, computers, electrical_installations, |
| | construction_in_progress, machinery_under_installation, |
| | long_term_investments, long_term_loans_advances, security_deposits, deferred_tax_assets, |
| | cash_on_hand, cash_at_bank, short_term_deposits, marketable_securities, |
| | accounts_receivable, bills_receivable, inventory, prepaid_expenses, |
| | accrued_income, short_term_loans_advances, gst_input_credit |
| | ): |
| |
|
| | |
| | total_shareholders_funds = ( |
| | equity_share_capital + preference_share_capital + reserves_surplus |
| | ) |
| |
|
| | |
| | total_tangible_fixed_assets = ( |
| | land_building + plant_machinery + factory_equipment + office_equipment + |
| | furniture_fixtures + motor_vehicles + computers + electrical_installations |
| | ) |
| |
|
| | |
| | total_cwip = construction_in_progress + machinery_under_installation |
| |
|
| | |
| | total_financial_non_current_assets = ( |
| | long_term_investments + long_term_loans_advances + |
| | security_deposits + deferred_tax_assets |
| | ) |
| |
|
| | |
| | total_current_assets = ( |
| | cash_on_hand + cash_at_bank + short_term_deposits + |
| | marketable_securities + accounts_receivable + bills_receivable + |
| | inventory + prepaid_expenses + accrued_income + |
| | short_term_loans_advances + gst_input_credit |
| | ) |
| |
|
| | |
| | total_assets = ( |
| | total_tangible_fixed_assets + |
| | total_cwip + |
| | total_financial_non_current_assets + |
| | total_current_assets |
| | ) |
| |
|
| | |
| | proprietary_ratio = ( |
| | total_shareholders_funds / total_assets |
| | if total_assets != 0 else 0 |
| | ) |
| |
|
| | summary = f""" |
| | ### 📊 Summary |
| | |
| | - **Total Shareholders' Funds:** ₹ {total_shareholders_funds:,.2f} |
| | - **Total Tangible Fixed Assets:** ₹ {total_tangible_fixed_assets:,.2f} |
| | - **Total Capital Work-in-Progress:** ₹ {total_cwip:,.2f} |
| | - **Total Financial Non-Current Assets:** ₹ {total_financial_non_current_assets:,.2f} |
| | - **Total Current Assets:** ₹ {total_current_assets:,.2f} |
| | - **Total Assets:** ₹ {total_assets:,.2f} |
| | |
| | ### 📈 Proprietary Ratio |
| | **Proprietary Ratio = Shareholders' Funds / Total Assets = {proprietary_ratio:.2f}** |
| | """ |
| |
|
| | data = { |
| | "Category": [ |
| | "Shareholders' Funds", |
| | "Tangible Fixed Assets", |
| | "Capital Work-in-Progress", |
| | "Financial Non-Current Assets", |
| | "Current Assets", |
| | "Total Assets" |
| | ], |
| | "Amount (₹)": [ |
| | total_shareholders_funds, |
| | total_tangible_fixed_assets, |
| | total_cwip, |
| | total_financial_non_current_assets, |
| | total_current_assets, |
| | total_assets |
| | ] |
| | } |
| |
|
| | df = pd.DataFrame(data) |
| |
|
| | return summary, df |
| |
|
| |
|
| | with gr.Blocks() as demo: |
| | gr.Markdown("## PROPRIETARY RATIO Calculator") |
| |
|
| | with gr.Accordion("Shareholders' Funds", open=True): |
| | equity_share_capital = gr.Number(label="Equity Share Capital", value=0) |
| | preference_share_capital = gr.Number(label="Preference Share Capital", value=0) |
| | reserves_surplus = gr.Number(label="Reserves & Surplus", value=0) |
| |
|
| | with gr.Accordion("Tangible Fixed Assets", open=False): |
| | land_building = gr.Number(label="Land & Building", value=0) |
| | plant_machinery = gr.Number(label="Plant & Machinery", value=0) |
| | factory_equipment = gr.Number(label="Factory Equipment", value=0) |
| | office_equipment = gr.Number(label="Office Equipment", value=0) |
| | furniture_fixtures = gr.Number(label="Furniture & Fixtures", value=0) |
| | motor_vehicles = gr.Number(label="Motor Vehicles", value=0) |
| | computers = gr.Number(label="Computers", value=0) |
| | electrical_installations = gr.Number(label="Electrical Installations", value=0) |
| |
|
| | with gr.Accordion("Capital Work-in-Progress", open=False): |
| | construction_in_progress = gr.Number(label="Construction in Progress", value=0) |
| | machinery_under_installation = gr.Number(label="Machinery under Installation", value=0) |
| |
|
| | with gr.Accordion("Financial Non-Current Assets", open=False): |
| | long_term_investments = gr.Number(label="Long-term Investments", value=0) |
| | long_term_loans_advances = gr.Number(label="Long-term Loans & Advances", value=0) |
| | security_deposits = gr.Number(label="Security Deposits", value=0) |
| | deferred_tax_assets = gr.Number(label="Deferred Tax Assets", value=0) |
| |
|
| | with gr.Accordion("Current Assets", open=False): |
| | cash_on_hand = gr.Number(label="Cash on Hand", value=0) |
| | cash_at_bank = gr.Number(label="Cash at Bank", value=0) |
| | short_term_deposits = gr.Number(label="Short-Term Deposits", value=0) |
| | marketable_securities = gr.Number(label="Marketable Securities", value=0) |
| | accounts_receivable = gr.Number(label="Accounts Receivable (Debtors)", value=0) |
| | bills_receivable = gr.Number(label="Bills Receivable", value=0) |
| | inventory = gr.Number(label="Inventory", value=0) |
| | prepaid_expenses = gr.Number(label="Prepaid Expenses", value=0) |
| | accrued_income = gr.Number(label="Accrued Income", value=0) |
| | short_term_loans_advances = gr.Number(label="Short-term Loans & Advances", value=0) |
| | gst_input_credit = gr.Number(label="GST Input Credit / Tax Receivables", value=0) |
| |
|
| | calculate_btn = gr.Button("Calculate Proprietary Ratio") |
| |
|
| | summary_output = gr.Markdown() |
| | table_output = gr.Dataframe() |
| |
|
| | calculate_btn.click( |
| | calculate_proprietary_ratio, |
| | inputs=[ |
| | equity_share_capital, preference_share_capital, reserves_surplus, |
| | land_building, plant_machinery, factory_equipment, office_equipment, |
| | furniture_fixtures, motor_vehicles, computers, electrical_installations, |
| | construction_in_progress, machinery_under_installation, |
| | long_term_investments, long_term_loans_advances, security_deposits, deferred_tax_assets, |
| | cash_on_hand, cash_at_bank, short_term_deposits, marketable_securities, |
| | accounts_receivable, bills_receivable, inventory, prepaid_expenses, |
| | accrued_income, short_term_loans_advances, gst_input_credit |
| | ], |
| | outputs=[summary_output, table_output] |
| | ) |
| |
|
| | demo.launch() |
| |
|
| |
|
| |
|