File size: 5,046 Bytes
0246947
8ed8c51
94e6b77
5521d2e
9103639
5521d2e
 
 
f5a3dac
 
aefe514
f5a3dac
 
 
 
 
 
5521d2e
aefe514
9103639
f5a3dac
 
 
 
 
aefe514
 
 
f5a3dac
 
 
aefe514
 
 
f5a3dac
 
aefe514
f5a3dac
fc2710a
aefe514
 
f5a3dac
 
 
aefe514
 
9103639
f5a3dac
aefe514
f5a3dac
 
aefe514
 
f5a3dac
aefe514
9103639
aefe514
f5a3dac
aefe514
9103639
f5a3dac
 
9103639
 
aefe514
f5a3dac
 
aefe514
9103639
f5a3dac
9103639
 
aefe514
9103639
f5a3dac
9103639
 
 
 
f5a3dac
5521d2e
fc2710a
f5a3dac
 
 
 
 
 
fc2710a
f5a3dac
 
fc2710a
f5a3dac
 
fc2710a
f5a3dac
fc2710a
f5a3dac
 
aefe514
f5a3dac
fc2710a
f5a3dac
fc2710a
 
 
5521d2e
0147f30
 
aefe514
f5a3dac
 
 
3a050ea
 
0147f30
3a050ea
 
aefe514
3a050ea
 
aefe514
3a050ea
 
5521d2e
3a050ea
 
aefe514
3a050ea
 
aefe514
3a050ea
 
aefe514
f5a3dac
3a050ea
5521d2e
3a050ea
 
f5a3dac
3a050ea
 
477b65f
3a050ea
 
 
477b65f
fc2710a
f5a3dac
0246947
fc2710a
 
bca9eed
f5a3dac
146a8d0
3a050ea
 
 
 
 
 
 
f5a3dac
3a050ea
 
bca9eed
3a050ea
f5a3dac
94e6b77
 
d91cce1
cc43a1f
 
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
<!DOCTYPE html> 
<html lang="pt-BR">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Simulador de Investimentos</title>
  <style>
    body {
      font-family: 'Segoe UI', sans-serif;
      background-color: #f4f6f9;
      color: #333;
      padding: 20px;
      margin: 0;
    }
    h1, h2 {
      text-align: center;
      color: #2c3e50;
    }
    form {
      background: #fff;
      max-width: 600px;
      margin: 0 auto 30px auto;
      padding: 30px;
      border-radius: 10px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    label {
      display: block;
      margin-bottom: 6px;
      font-weight: 600;
      color: #555;
    }
    input[type="number"] {
      width: 100%;
      padding: 10px;
      margin-bottom: 16px;
      border: 1px solid #ccc;
      border-radius: 5px;
      box-sizing: border-box;
    }
    button {
      width: 100%;
      padding: 12px;
      background: #007bff;
      color: white;
      border: none;
      font-size: 1em;
      border-radius: 5px;
      cursor: pointer;
      margin-top: 10px;
      transition: background 0.3s;
    }
    button:hover {
      background: #0056b3;
    }
    .grafico {
      text-align: center;
      margin-bottom: 40px;
    }
    table {
      width: 95%;
      margin: 20px auto;
      border-collapse: collapse;
      background: white;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    th, td {
      padding: 12px 15px;
      border: 1px solid #ddd;
      text-align: right;
    }
    th {
      background-color: #007bff;
      color: white;
      text-align: center;
    }
    tr:hover {
      background-color: #f1f1f1;
    }
    .resultado-destaque {
      max-width: 800px;
      margin: 30px auto;
      background: #e8f5e9;
      color: #2e7d32;
      padding: 20px;
      font-size: 1.2em;
      font-weight: bold;
      text-align: center;
      border-left: 6px solid #2e7d32;
      border-radius: 6px;
    }
    .botao-pdf {
      text-align: center;
      margin-top: 30px;
    }
    .botao-pdf form {
      display: inline-block;
    }
    /* Ocultar itens no modo PDF */
    {% if gerar_pdf %}
    form, .botao-pdf, button {
      display: none !important;
    }
    {% endif %}
  </style>
</head>
<body>

  <h1>Simulador de Investimentos</h1>

  <form method="post" action="/">
    <label for="capital">Capital Inicial (R$):</label>
    <input type="number" id="capital" name="capital" step="0.01" required value="{{ capital or 400000 }}">

    <label for="studio_ret">Retorno Mensal do Studio (%):</label>
    <input type="number" id="studio_ret" name="studio_ret" step="0.01" required value="{{ studio_ret or 1 }}">

    <label for="valorizacao">Valorização Anual do Imóvel (%):</label>
    <input type="number" id="valorizacao" name="valorizacao" step="0.01" required value="{{ valorizacao or 4 }}">

    <label for="franquia_ret">Lucro Anual da Franquia (R$):</label>
    <input type="number" id="franquia_ret" name="franquia_ret" step="0.01" required value="{{ franquia_ret or 40000 }}">

    <label for="acoes_ret">Retorno Anual em Ações (%):</label>
    <input type="number" id="acoes_ret" name="acoes_ret" step="0.01" required value="{{ acoes_ret or 11 }}">

    <label for="renda_fixa">Retorno Anual Renda Fixa (%):</label>
    <input type="number" id="renda_fixa" name="renda_fixa" step="0.01" required value="{{ renda_fixa or 12 }}">

    <label for="inflacao">Inflação Anual Esperada (%):</label>
    <input type="number" id="inflacao" name="inflacao" step="0.01" required value="{{ inflacao or 5 }}">

    <button type="submit">Rodar Simulação</button>
  </form>

  {% if tabela %}
    <div class="grafico">
      <h2>Gráfico Comparativo</h2>
      <img src="data:image/png;base64,{{ grafico }}" alt="Gráfico de Investimentos" />
    </div>

    <div>
      {{ tabela | safe }}
    </div>

    <div class="resultado-destaque">
      Investimento com maior retorno: <span style="color:#1b5e20;">{{ investimento_mais_valorizado }}</span><br>
      Valor final estimado: <span style="color:#1b5e20;">R$ {{ "{:,.2f}".format(valor_mais_alto).replace(",", "X").replace(".", ",").replace("X", ".") }}</span>
    </div>

    {% if not gerar_pdf %}
    <div class="botao-pdf">
      <form action="/download_pdf" method="post">
        <input type="hidden" name="capital" value="{{ capital }}">
        <input type="hidden" name="studio_ret" value="{{ studio_ret }}">
        <input type="hidden" name="valorizacao" value="{{ valorizacao }}">
        <input type="hidden" name="franquia_ret" value="{{ franquia_ret }}">
        <input type="hidden" name="acoes_ret" value="{{ acoes_ret }}">
        <input type="hidden" name="renda_fixa" value="{{ renda_fixa }}">
        <input type="hidden" name="inflacao" value="{{ inflacao }}">
        <button type="submit" style="background: #28a745;">Gerar PDF do Relatório</button>
      </form>
    </div>
    {% endif %}
  {% endif %}

</body>
</html>