Spaces:
Runtime error
Runtime error
File size: 12,520 Bytes
c73a3e0 ee6bd21 c73a3e0 6581d31 c73a3e0 6c915d6 c73a3e0 30fe5ce c73a3e0 6c915d6 352d214 6c915d6 352d214 7c11ab5 352d214 7c11ab5 6c915d6 c73a3e0 7c11ab5 6c915d6 352d214 6c915d6 352d214 7c11ab5 352d214 e93c756 352d214 19e516e 6c915d6 352d214 6c915d6 352d214 19e516e 352d214 7c11ab5 352d214 19e516e e93c756 352d214 19e516e 352d214 5b22d2f ee6bd21 7c11ab5 03c98c9 7c11ab5 19e516e c73a3e0 19e516e 7c11ab5 8e89fc7 c73a3e0 6c915d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
import streamlit as st
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import math
st.title("Калькулятор Toyota📄")
genre = st.radio("Какой из вариантов", ("Покупка автоматизированного ричтрака", "Аренда автоматизированного ричтрака", "Покупка механизированного ричтрака"))
if genre == 'Покупка автоматизированного ричтрака':
Buying_an_autopilot = st.number_input('Покупка автопилота, руб.', value=2000000)
Purchase_of_peripheral_equipment = st.number_input('Покупка перефирийного оборудования, руб.', value=40000)
Purchase_by = st.number_input('Покупка ПО, руб.', value=10000)
Introduction_of_autopilot = st.number_input('Внедрение автопилота, руб.', value=20000)
Maintenance = st.number_input('Обслуживание (месяц), руб.', value=100000)
The_cost_of_repairing_one_car = st.number_input('Стоимость ремонта одной машины, руб.', value=10000)
Inflation_rate = st.number_input('Уровень инфляции', value=0.04)
Monthly_salary_rate = st.number_input('Заработная ставка, руб. в месяц', value=40000)
Number_of_months = st.number_input('Количество месяцев', value=12)
Equipment_breakdown_rate = st.number_input('Коэффициент поломки оборудования', value=0.1)
Price_for_processing_ont_pallet = st.number_input('Цена за обработку 1 паллета, руб.', value=300)
Cargo_flow = st.number_input('Грузопоток, шт/месяц', value=10000)
Efficiency = st.number_input('Производительность, шт в час', value=5)
Number_of_working_hours = st.number_input('Количество рабочих часов', value=8)
Shift_of_one_employee = st.number_input('Смена 1 работника, ч.', value=8)
Number_of_working_days_month = st.number_input('Количество рабочих дней в месяц, дн.', value=20)
Social_benefits_for_one_employee = st.number_input('Социальные выплаты 1 сотруднику, руб.', value=10000)
Insurance_rate = st.number_input('Ставка страхования', value=0.005)
Income_tax_rate = st.number_input('Ставка налога на прибыль', value=0.2)
Number_of_autopilots_serviced_by_one_employee = st.number_input('Количество автопилотов, обслуживаемых 1 работником', value=10)
discounting = st.number_input('Ставка дисконтирования в месяц', value=0.028)
elif genre == 'Аренда автоматизированного ричтрака':
Rent_an_autopilot = st.number_input('Аренда автопилота, руб.', value = 20000)
Rent_of_peripheral_equipment = st.number_input('Аренда перефирийного оборудования, руб.', value = 4000)
Purchase_by = st.number_input('Покупка ПО, руб. ', value = 10000)
Introduction_of_autopilot = st.number_input('Внедрение автопилота, руб.', value = 20000)
Maintenance = st.number_input('Обслуживание (месяц), руб.', value = 100000)
The_cost_of_repairing_one_car = st.number_input('Стоимость ремонта одной машины, руб.', value = 10000)
Monthly_salary_rate = st.number_input('Заработная ставка в месяц, руб.', value = 40000)
Rental_period = st.number_input('Срок аренды, месяц', value = 12)
Equipment_breakdown_rate = st.number_input('Коэфициент поломки оборудования', value = 0.1)
Price_for_processing_ont_pallet = st.number_input('Цена за обработку 1 паллета, руб.', value = 300)
Cargo_flow = st.number_input('Грузопоток, шт в месяц ', value = 10000)
Efficiency = st.number_input('Производительность,шт в час', value = 5)
Number_of_working_hours = st.number_input('Количество рабочих часов', value = 8)
Shift_of_one_employee = st.number_input('Смена одного работника, часы', value = 8)
Number_of_working_days_month = st.number_input('Количество рабочих дней в месяц, дн.', value = 20)
Social_benefits_for_one_employee = st.number_input('Социальные выплаты одному сотруднику, руб.', value = 10000)
Income_tax_rate = st.number_input('Ставка налога на прибыль', value = 0.2)
Number_of_autopilots_serviced_by_one_employee = st.number_input('Количество автопилотов, обслуживаемых одним работником, шт.', value = 10)
discounting = st.number_input('Ставка дисконтирования в месяц', value = 0.028)
else:
Buying_a_richtruck = st.number_input('Покупка ричтрака, руб.', value=2000000)
Maintenance = st.number_input('Обслуживание (месяц), руб.', value=10000)
The_cost_of_repairing_one_car = st.number_input('Стоимость ремонта одной машины, руб.', value=1000)
Monthly_salary_rate = st.number_input('Заработная ставка, руб. в месяц', value=40000)
Number_of_months = st.number_input('Количество месяцев', value=12)
Equipment_breakdown_rate = st.number_input('Коэфициент поломки оборудования', value=0.3)
Price_for_processing_ont_pallet = st.number_input('Цена за обработку 1 паллета, руб.', value=300)
Cargo_flow = st.number_input('Грузопоток, шт/месяц всего', value=10000)
Efficiency = st.number_input('Производительность, шт в час', value=3)
Number_of_working_hours = st.number_input('Количество рабочих часов', value=8)
Shift_of_one_employee = st.number_input('Смена 1 работника, ч.', value=8)
Number_of_working_days_month = st.number_input('Количество рабочих дней в месяц, дн.', value=20)
Social_benefits_for_one_employee = st.number_input('Социальные выплаты 1 сотруднику, руб.', value=10000)
Insurance_rate = st.number_input('Ставка страхования', value=0.005)
The_cost_of_demaged_goods = st.number_input('Стоимость поврежденного товара', value=1000)
Product_damage_rate= st.number_input('Коэфициент повреждения товара', value=0.005)
discounting = st.number_input('Ставка дисконтирования в месяц', value=0.028)
Rate_CPI = 1.05
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)
if genre == 'Покупка автоматизированного ричтрака':
Number_employees = math.ceil((Number_machines * Number_of_working_hours / Shift_of_one_employee) / Number_of_autopilots_serviced_by_one_employee)
elif genre == 'Аренда автоматизированного ричтрака':
Number_employees = math.ceil((Number_machines * Number_of_working_hours / Shift_of_one_employee) / Number_of_autopilots_serviced_by_one_employee)
else:
Number_employees = math.ceil((Number_machines * Number_of_working_hours / Shift_of_one_employee))
return Number_pallets, Number_machines, Number_employees
def get_revenue(idx):
indexation = math.floor(idx / 12)
Price = Price_for_processing_ont_pallet * math.pow(Rate_CPI, indexation)
revenue = Number_machines * Number_pallets * Price
return revenue
def get_costs(idx):
indexation = math.floor(idx / 12)
wage_fund_with_indexation = math.pow((Social_benefits_for_one_employee + Monthly_salary_rate), indexation)
if genre == 'Покупка автоматизированного ричтрака':
Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
Wage_Fund = Number_employees * wage_fund_with_indexation
The_cost_of_insurance = Number_machines * Insurance_rate * (Buying_an_autopilot + Purchase_of_peripheral_equipment)
cost = Purchase_by + Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund + The_cost_of_insurance
elif genre == 'Аренда автоматизированного ричтрака':
Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
Wage_Fund = Number_employees * wage_fund_with_indexation
Autopilot_rental = Number_machines * Rent_an_autopilot
cost = Autopilot_rental + Rent_of_peripheral_equipment + Purchase_by + Number_machines * Maintenance + Wage_Fund + Expected_repair_costs_per_month
else:
Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
Wage_Fund = Number_employees * wage_fund_with_indexation
The_cost_of_insurance = Number_machines * Insurance_rate * Buying_a_richtruck
Expected_costs_for_the_purchase_of_damaged_goods = Efficiency * The_cost_of_demaged_goods * Product_damage_rate
cost = Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund + The_cost_of_insurance + Expected_costs_for_the_purchase_of_damaged_goods
return cost
def get_profit(amortization, idx):
profit = get_revenue(idx) - get_costs(idx) - amortization
if profit > 0:
return profit
else:
return profit * 0.8
def get_PV(profit, discounting):
return profit * 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_CF_PV():
if genre == 'Покупка автоматизированного ричтрака':
I_0 = Buying_an_autopilot * Number_machines + Purchase_of_peripheral_equipment + Introduction_of_autopilot * Number_machines
amortizat = Buying_an_autopilot * Number_machines + Introduction_of_autopilot * Number_machines
elif genre == 'Аренда автоматизированного ричтрака':
I_0 = Rent_of_peripheral_equipment
amortizat = 0
else:
I_0 = Buying_a_richtruck * Number_machines
amortizat = Buying_a_richtruck * Number_machines
array_discounting = get_array_discounting()
rray_amortization = get_amortization(amortizat)
array_PV = [-I_0]
array_CF = [-I_0]
for idx in range(1, Number_of_months + 1, 1):
profit = get_profit(array_amortization[idx], idx)
array_CF.append(profit)
cur_PV = get_PV(profit, array_discounting[idx])
array_PV.append(cur_PV)
return array_CF, 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
if st.button('Сюда кликнуть чтобы посчитать'):
Number_pallets, Number_machines, Number_employees = get_number_pallets_and_machines_employees()
array_CF, array_PV = get_array_CF_PV()
array_NPV = get_array_NPV()
IRR = np.irr(array_CF)
st.write(f'NPV за {Number_of_months} месяцев:', array_NPV[-1])
st.write(f'IRR на {Number_of_months} месяцев:', IRR)
chart_data = pd.DataFrame(columns=['PV', 'NPV'])
chart_data['PV'] = array_PV
chart_data['NPV'] = array_NPV
st.line_chart(chart_data)
|