TovaHasi commited on
Commit
fa1e2d7
1 Parent(s): 6634da1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -17
app.py CHANGED
@@ -3,7 +3,7 @@ import matplotlib.pyplot as plt
3
  import numpy as np
4
  import pandas as pd
5
  import math
6
- import numpy_financial as np_fin
7
 
8
  st.title("Калькулятор Toyota📄")
9
 
@@ -31,7 +31,7 @@ if genre == 'Покупка автоматизированного ричтра
31
  Income_tax_rate = st.number_input('Ставка налога на прибыль', value=0.2)
32
  Number_of_autopilots_serviced_by_one_employee = st.number_input('Количество автопилотов, обслуживаемых 1 работником', value=10)
33
  discounting = st.number_input('Ставка дисконтирования в месяц', value=0.028)
34
-
35
  elif genre == 'Аренда автоматизированного ричтрака':
36
  Rent_an_autopilot = st.number_input('Аренда автопилота, руб.', value = 20000)
37
  Rent_of_peripheral_equipment = st.number_input('Аренда перефирийного оборудования, руб.', value = 4000)
@@ -68,8 +68,8 @@ else:
68
  Number_of_working_days_month = st.number_input('Количество рабочих дней в месяц, дн.', value=20)
69
  Social_benefits_for_one_employee = st.number_input('Социальные выплаты 1 сотруднику, руб.', value=10000)
70
  Insurance_rate = st.number_input('Ставка страхования', value=0.005)
71
- The_cost_of_demaged_goods = st.number_input('Стоимость поврежденного товара', value=1000)
72
- Product_damage_rate= st.number_input('Коэфициент повреждения товара', value=0.005)
73
  discounting = st.number_input('Ставка дисконтирования в месяц', value=0.028)
74
 
75
 
@@ -100,31 +100,41 @@ def get_revenue(idx):
100
 
101
  def get_costs(idx):
102
  indexation = math.floor(idx / 12)
103
-
 
104
  wage_fund_with_indexation = (Social_benefits_for_one_employee + Monthly_salary_rate) * math.pow(Rate_CPI, indexation)
105
 
106
  if genre == 'Покупка автоматизированного ричтрака':
107
  Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
108
  Wage_Fund = Number_employees * wage_fund_with_indexation
109
- The_cost_of_insurance = Number_machines * Insurance_rate * (Buying_an_autopilot + Purchase_of_peripheral_equipment)
110
 
111
- cost = Purchase_by + Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund + The_cost_of_insurance
 
 
 
 
112
 
113
  elif genre == 'Аренда автоматизированного ричтрака':
114
  Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
115
  Wage_Fund = Number_employees * wage_fund_with_indexation
116
  Autopilot_rental = Number_machines * Rent_an_autopilot
117
 
118
- cost = Autopilot_rental + Rent_of_peripheral_equipment + Purchase_by + Number_machines * Maintenance + Wage_Fund + Expected_repair_costs_per_month
 
 
 
119
 
120
  else:
121
  Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
122
  Wage_Fund = Number_employees * wage_fund_with_indexation
123
- The_cost_of_insurance = Number_machines * Insurance_rate * Buying_a_richtruck
124
  Expected_costs_for_the_purchase_of_damaged_goods = Efficiency * The_cost_of_demaged_goods * Product_damage_rate
125
 
126
- cost = Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund + The_cost_of_insurance + Expected_costs_for_the_purchase_of_damaged_goods
127
-
 
 
 
 
128
  return cost
129
 
130
  def get_profit(amortization, idx):
@@ -189,15 +199,13 @@ def get_array_NPV():
189
  for idx in range(1, Number_of_months + 1, 1):
190
  array_NPV.append(array_NPV[-1] + array_PV[idx])
191
  return array_NPV
192
-
193
-
194
  def get_id_first_positive_NPV(array_NPV):
195
  for idx, npv in enumerate(array_NPV):
196
  if npv > 0:
197
  return idx
198
  return len(array_NPV)
199
-
200
-
201
  if st.button('Расчет эффективности'):
202
  Number_pallets, Number_machines, Number_employees = get_number_pallets_and_machines_employees()
203
  array_CF, array_PV = get_array_CF_PV()
@@ -222,5 +230,4 @@ if st.button('Расчет эффективности'):
222
  chart_data['PV'] = array_PV
223
  chart_data['NPV'] = array_NPV
224
 
225
- st.line_chart(chart_data)
226
-
 
3
  import numpy as np
4
  import pandas as pd
5
  import math
6
+ import numpy_financial as np_fin
7
 
8
  st.title("Калькулятор Toyota📄")
9
 
 
31
  Income_tax_rate = st.number_input('Ставка налога на прибыль', value=0.2)
32
  Number_of_autopilots_serviced_by_one_employee = st.number_input('Количество автопилотов, обслуживаемых 1 работником', value=10)
33
  discounting = st.number_input('Ставка дисконтирования в месяц', value=0.028)
34
+
35
  elif genre == 'Аренда автоматизированного ричтрака':
36
  Rent_an_autopilot = st.number_input('Аренда автопилота, руб.', value = 20000)
37
  Rent_of_peripheral_equipment = st.number_input('Аренда перефирийного оборудования, руб.', value = 4000)
 
68
  Number_of_working_days_month = st.number_input('Количество рабочих дней в месяц, дн.', value=20)
69
  Social_benefits_for_one_employee = st.number_input('Социальные выплаты 1 сотруднику, руб.', value=10000)
70
  Insurance_rate = st.number_input('Ставка страхования', value=0.005)
71
+ The_cost_of_demaged_goods = ('Стоимость поврежденного товара', value=1000)
72
+ Product_damage_rate= ('Коэфициент повреждения товара', value=0.005)
73
  discounting = st.number_input('Ставка дисконтирования в месяц', value=0.028)
74
 
75
 
 
100
 
101
  def get_costs(idx):
102
  indexation = math.floor(idx / 12)
103
+ start_year = ((idx - 1) % 12 == 0)
104
+ cost = 0
105
  wage_fund_with_indexation = (Social_benefits_for_one_employee + Monthly_salary_rate) * math.pow(Rate_CPI, indexation)
106
 
107
  if genre == 'Покупка автоматизированного ричтрака':
108
  Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
109
  Wage_Fund = Number_employees * wage_fund_with_indexation
 
110
 
111
+ if start_year:
112
+ The_cost_of_insurance = Number_machines * Insurance_rate * (Buying_an_autopilot + Purchase_of_peripheral_equipment)
113
+ cost += The_cost_of_insurance + Purchase_by
114
+
115
+ cost += Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund
116
 
117
  elif genre == 'Аренда автоматизированного ричтрака':
118
  Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
119
  Wage_Fund = Number_employees * wage_fund_with_indexation
120
  Autopilot_rental = Number_machines * Rent_an_autopilot
121
 
122
+ if start_year:
123
+ cost += Purchase_by
124
+
125
+ cost += Autopilot_rental + Rent_of_peripheral_equipment + Purchase_by + Number_machines * Maintenance + Wage_Fund + Expected_repair_costs_per_month
126
 
127
  else:
128
  Expected_repair_costs_per_month = Number_machines * Equipment_breakdown_rate * The_cost_of_repairing_one_car
129
  Wage_Fund = Number_employees * wage_fund_with_indexation
 
130
  Expected_costs_for_the_purchase_of_damaged_goods = Efficiency * The_cost_of_demaged_goods * Product_damage_rate
131
 
132
+ if start_year:
133
+ The_cost_of_insurance = Number_machines * Insurance_rate * Buying_a_richtruck
134
+ cost += The_cost_of_insurance
135
+
136
+ cost += Number_machines * Maintenance + Expected_repair_costs_per_month + Wage_Fund + Expected_costs_for_the_purchase_of_damaged_goods
137
+
138
  return cost
139
 
140
  def get_profit(amortization, idx):
 
199
  for idx in range(1, Number_of_months + 1, 1):
200
  array_NPV.append(array_NPV[-1] + array_PV[idx])
201
  return array_NPV
202
+
 
203
  def get_id_first_positive_NPV(array_NPV):
204
  for idx, npv in enumerate(array_NPV):
205
  if npv > 0:
206
  return idx
207
  return len(array_NPV)
208
+
 
209
  if st.button('Расчет эффективности'):
210
  Number_pallets, Number_machines, Number_employees = get_number_pallets_and_machines_employees()
211
  array_CF, array_PV = get_array_CF_PV()
 
230
  chart_data['PV'] = array_PV
231
  chart_data['NPV'] = array_NPV
232
 
233
+ st.line_chart(chart_data)