TovaHasi's picture
Update app.py
8e89fc7
raw
history blame
4.99 kB
import streamlit as st
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
st.title("Калькулятор Toyota📄")
st.markdown("Тут данные ввести")
Buying_an_autopilot = st.number_input('Покупка автопилота, руб.')
Purchase_of_peripheral_equipment = st.number_input('Покупка перефирийного оборудования, руб.')
Purchase_by = st.number_input('Покупка ПО, руб.')
Introduction_of_autopilot = st.number_input('Внедрение автопилота, руб.')
Maintenance = st.number_input('Обслуживание (месяц), руб.')
The_cost_of_repairing_one_car = st.number_input('Стоимость ремонта одной машины, руб.')
Inflation_rate = st.number_input('Уровень инфляции')
Monthly_salary_rate = st.number_input('Заработная ставка, руб. в месяц')
Number_of_months = st.number_input('Количество месяцев')
Equipment_breakdown_rate = st.number_input('Коэфициент поломки оборудования ')
Price_for_processing_ont_pallet = st.number_input('Цена за обработку 1 паллета, руб.')
Cargo_flow = st.number_input('Грузопоток, шт/месяц ')
Efficiency = st.number_input('Производительность, шт в час')
Number_of_working_hours = st.number_input('Количество рабочих часов')
Shift_of_one_employee = st.number_input('Смена 1 работника, ч.')
Number_of_working_days_month = st.number_input('Количество рабочих дней в месяц, дн.')
Social_benefits_for_one_employee = st.number_input('Социальные выплаты 1 сотруднику, руб.')
Insurance_rate = st.number_input('Ставка страхования')
Income_tax_rate = st.number_input('Ставка налога на прибыль')
Number_of_autopilots_serviced_by_one_employee = st.number_input('Количество автопилотов, обслуживаемых 1 работником')
discounting = st.number_input('Ставка дисконтирования в месяц')
def get_number_pallets_and_machines_employees():
Number_pallets = Efficiency * Number_of_working_hours * Number_of_working_days_month
Number_machines = math.ceil(Cargo_flow / Number_pallets)
Number_employees = math.ceil((Number_machines * Number_of_working_hours / Shift_of_one_employee) / Number_of_autopilots_serviced_by_one_employee)
return Number_pallets, Number_machines, Number_employees
Number_pallets, Number_machines, Number_employees = get_number_pallets_and_machines_employees()
def get_revenue():
revenue = Number_machines * Number_pallets * Price_for_processing_ont_pallet
return revenue
def get_costs():
Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
Wage_Fund = Number_employees * (Social_benefits_for_one_employee + Monthly_salary_rate)
The_cost_of_insurance = Number_machines * Insurance_rate * (Buying_an_autopilot + Purchase_of_peripheral_equipment)
return Purchase_by + Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund + The_cost_of_insurance
def get_profit():
profit = get_revenue() - get_costs()
if profit > 0:
return profit
else:
return profit * 0.8
def get_PV(profit, amortization, discounting):
return (profit - amortization) * discounting
def get_array_discounting():
array_discounting = [1]
for idx in range(Number_of_months):
array_discounting.append(array_discounting[-1] / (1 + discounting))
return array_discounting
def get_amortization(value):
array_amortization = [0]
value = value / 60
for idx in range(Number_of_months):
array_amortization.append(value)
return array_amortization
def get_array_PV():
I_0 = Buying_an_autopilot * Number_machines + Purchase_of_peripheral_equipment + Introduction_of_autopilot
array_discounting = get_array_discounting()
array_amortization = get_amortization(I_0)
array_PV = [-I_0]
for idx in range(1, Number_of_months + 1, 1):
profit = get_profit()
cur_PV = get_PV(profit, array_amortization[idx], array_discounting[idx])
array_PV.append(cur_PV)
return array_PV
def get_array_NPV():
array_NPV = [array_PV[0]]
for idx in range(1, Number_of_months + 1, 1):
array_NPV.append(array_NPV[-1] + array_PV[idx])
return array_NPV
array_PV = get_array_PV()
array_NPV = get_array_NPV()
if st.button('Сюда кликнуть чтобы посчитать'):
st.write('Тут всё показываем')
chart_data = pd.DataFrame(
np.array([array_PV, array_NPV]),
columns=['PV', 'NPV'])
st.area_chart(chart_data)