-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
280 lines (260 loc) · 9.82 KB
/
index.html
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.js"></script>
<style>
body{
margin: 0;
font-family: "Montserrat",Helvetica,Arial,sans-serif;
font-size: 11pt;
}
td{
width: 200px;
}
th{
background-color: #4CAF50;
color: white;
}
th, td{
border-bottom: 1px solid #ddd;
padding: 15px;
}
.title{
font-size: 16pt;
font-weight: bold;
padding: 25px 0px;
text-align: center;
background-color: #c2c2c2;
}
.content{
padding: 0px 15px;
background-color: #f9f9f9;
min-height: calc(100vh - 30px);
}
footer{
width: 100%;
height: 30px;
padding: 15px 0px;
font-size: 11px;
text-align: center;
background-color: #b2b2b2;
}
input{
height: 40px;
border: 1px solid rgba(0,0,0,.15);
border-radius: 5px;
line-height: 1.2;
font-size: 18px;
}
button{
height: 40px;
background-color: #4CAF50;
border: 1px solid rgba(0,0,0,.15);
border-radius: 5px;
color: white;
cursor: pointer;
line-height: 1.2;
font-size: 14px;
}
button:hover{
background-color: #3b863e;
}
#canvas{
max-width: 700px;
}
</style>
<script>
var ss, irs, irsPago, regressarIrsPago, rnhIrs, rnhIrsPago, liquido, regressar, rnh;
function calcular(){
var bruto = parseFloat(document.getElementById("input-salario-bruto").value);
if(!bruto) return;
calcularSalarios(bruto);
mostrarResultados();
}
function calcularSalarios(bruto){
ss = bruto * .11;
irs = taxaIRS(bruto);
irsPago = bruto * irs;
regressarIrsPago = bruto/2*irs;
rnhIrs = Math.min(irs,.2);
rnhIrsPago = bruto*rnhIrs;
liquido = bruto * .89 - irsPago;
regressar = bruto * .89 - irs*(bruto/2);
rnh = bruto*.89 - rnhIrsPago;
}
function taxaIRS(salario){
var salarios = [ 659, 686, 718, 739, 814, 922, 1005, 1065, 1143, 1225, 1321, 1424, 1562, 1711, 1870, 1977, 2090, 2218, 2367, 2535, 2767, 3104, 3534, 4118, 4650, 5194, 5880, 6727, 7939, 9560, 11282, 18854, 20221, 22749, 25276, 25276 ];
var taxa = [ 0, 0.01, 0.042, 0.073, 0.082, 0.104, 0.116, 0.124, 0.135, 0.145, 0.156, 0.166, 0.177, 0.191, 0.205, 0.215, 0.225, 0.235, 0.245, 0.255, 0.265, 0.278, 0.294, 0.305, 0.323, 0.333, 0.343, 0.363, 0.373, 0.393, 0.403, 0.413, 0.423, 0.431, 0.441, 0.451 ];
for(var i = 0; i < salarios.length; i++){
if(salario <= salarios[i]*12) return taxa[i];
}
return taxa[taxa.length-1];
}
function mostrarResultados(){
document.getElementsByName("seg-social").forEach(function(elem){
elem.innerHTML = "-" + ss.toFixed(2) + "€";
});
document.getElementById("irs").innerHTML = "(" + (irs*100).toFixed(0) + "%) -" + irsPago.toFixed(2) + "€";
document.getElementById("regressar-irs").innerHTML = "(" + (irs*100).toFixed(0) + "% de metade) -" + regressarIrsPago.toFixed(2) + "€";
document.getElementById("rnh-irs").innerHTML = "(" + (rnhIrs*100).toFixed(0) + "%) -" + rnhIrsPago.toFixed(2) + "€";
document.getElementById("salario-liquido-anual").innerHTML = liquido.toFixed(2) + "€";
document.getElementById("salario-liquido-mensal").innerHTML = (liquido/12).toFixed(2) + "€";
document.getElementById("regressar-anual").innerHTML = regressar.toFixed(2) + "€";
document.getElementById("regressar-mensal").innerHTML = (regressar/12).toFixed(2) + "€";
document.getElementById("regressar-ganho-mensal").innerHTML = (regressar/12 - liquido/12).toFixed(2) + "€";
document.getElementById("regressar-ganho-anual").innerHTML = (regressar-liquido).toFixed(2) + "€";
document.getElementById("regressar-ganho-5anos").innerHTML = ((regressar-liquido)*5).toFixed(2) + "€";
document.getElementById("rnh-anual").innerHTML = rnh.toFixed(2) + "€";
document.getElementById("rnh-mensal").innerHTML = (rnh/12).toFixed(2) + "€";
document.getElementById("rnh-ganho-mensal").innerHTML = (rnh/12 - liquido/12).toFixed(2) + "€";
document.getElementById("rnh-ganho-anual").innerHTML = (rnh-liquido).toFixed(2) + "€";
document.getElementById("rnh-ganho-5anos").innerHTML = ((rnh-liquido)*5).toFixed(2) + "€";
document.getElementById("rnh-ganho-10anos").innerHTML = ((rnh-liquido)*10).toFixed(2) + "€";
document.getElementById("resultados").style.display = "block";
}
var valores = [];
var valoresRegressar = [];
var valoresRNH = [];
function plot(){
var valoresRegressar = [];
var valoresRNH = [];
for(var i = 0; i < 100000; i+=250){
calcularSalarios(i);
valores.push(i);
valoresRegressar.push(((regressar-liquido)*5).toFixed(2));
valoresRNH.push(((rnh-liquido)*10).toFixed(2));
}
var config = {
type: 'line',
data: {
labels: valores,
datasets:[
{
label:"Programa Regressar",
data: valoresRegressar,
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
fill: false
},
{
label:"Residente Não-Habitual",
data: valoresRNH,
backgroundColor: 'rgb(54, 162, 235)',
borderColor: 'rgb(54, 162, 235)',
fill: false
}
]
},
options: {
title: {
display: true,
text: 'Beneficio total (€) em função do salário bruto anual (€)'
}
}
};
var ctx = document.getElementById('canvas').getContext('2d');
window.myLine = new Chart(ctx, config);
}
window.onload = plot;
</script>
</head>
<body>
<div class="title">Calculadora<br>Programa Regressar VS Residente Não Habitual</div>
<div class="content">
<p>
<p>Percebe quais as vantagens financeiras ao regressar a Portugal com o Programa Regressar ou com o Estatuto de Residente Não Habitual. Sendo estatutos mutuamente exclusivos, quem se encontre em posição de aderir a qualquer um dos dois deve ter em consideração quanto vai ganhar para poder tomar a melhor decisão do ponto de vista financeiro.</p>
</p>
<table>
<tr>
<th></th>
<th><b>Requisitos</b></th>
<th><b>Beneficios</b></th>
</tr>
<tr>
<td><b>Programa Regressar</b></td>
<td>Ter sido habitante em Portugal antes de 2015 e não ter sido residente em Portugal nos 3 anos anteriores. Válido até ao final de 2021. Mais info <a href="https://www.programaregressar.gov.pt/pt/medida-de-apoio-fiscal/">aqui</a></td>
<td>IRS aplica-se apenas a 50% dos rendimentos. Válido por 5 anos.</td>
</tr>
<tr>
<td><b>Residente Não-Habitual</b></td>
<td>Não ter sido residente em Portugal nos 5 anos anteriores. Apenas aplicável a
<a href="https://dre.pt/pesquisa/-/search/460194/details/maximized" target="_blank">
actividades de elevado valor acrescentado com carácter cientifico, artistico ou tecnico
</a>
</td>
<td>IRS máximo de 20%. Válido por 10 anos</td>
</tr>
</table>
<canvas id="canvas"></canvas>
<br/><br/>
<hr>
<h2>Calculadora</h2>
<h3><p><i>IRS estimado considerando uma pessoal solteira, sem dependentes nem qualquer estatuto especial. Salário mensal considera 12 meses.</i></p></h3>
<br/>
Salario bruto anual (€) a receber em Portugal, incluíndo subsídios:
<input id="input-salario-bruto" type="text" autofocus>
<button onclick="calcular()">Calcular</button>
<div id="resultados" style="display:none">
<table>
<tr>
<th></th>
<th style="width: 200px; text-align: center;">Sem beneficios</th>
<th style="width: 200px; text-align: center;">Programa Regressar</th>
<th style="width: 200px; text-align: center;">Residente Não Habitual</th>
</tr>
<tr>
<td><b>Segurança social (11%)</b></td>
<td name="seg-social" style="text-align: right; color: red;"></td>
<td name="seg-social" style="text-align: right; color: red;"></td>
<td name="seg-social" style="text-align: right; color: red;"></td>
</tr>
<tr>
<td><b>IRS anual</b></td>
<td id="irs" style="text-align: right; color: red;"></td>
<td id="regressar-irs" style="text-align: right; color: red;"></td>
<td id="rnh-irs" style="text-align: right; color: red;"></td>
</tr>
<tr>
<td><b>Salario liquido anual</b></td>
<td id="salario-liquido-anual" style="text-align: right"></td>
<td id="regressar-anual" style="text-align: right"></td>
<td id="rnh-anual" style="text-align: right"></td>
</tr>
<tr>
<td><b>Salario liquido mensal</b></td>
<td id="salario-liquido-mensal" style="text-align: right"></td>
<td id="regressar-mensal" style="text-align: right"></td>
<td id="rnh-mensal" style="text-align: right"></td>
</tr>
<tr>
<td><b>Beneficio mensal</b></td>
<td style="text-align: right">-</td>
<td id="regressar-ganho-mensal" style="text-align: right"></td>
<td id="rnh-ganho-mensal" style="text-align: right"></td>
</tr>
<tr>
<td><b>Beneficio anual</b></td>
<td style="text-align: right">-</td>
<td id="regressar-ganho-anual" style="text-align: right"></td>
<td id="rnh-ganho-anual" style="text-align: right"></td>
</tr>
<tr>
<td><b>Beneficio 5 anos</b></td>
<td style="text-align: right">-</td>
<td id="regressar-ganho-5anos" style="text-align: right"></td>
<td id="rnh-ganho-5anos" style="text-align: right"></td>
</tr>
<tr>
<td><b>Beneficio 10 anos</b></td>
<td style="text-align: right">-</td>
<td style="text-align: right">-</td>
<td id="rnh-ganho-10anos" style="text-align: right"></td>
</tr>
</table>
</div>
<br><br><br>
</div>
<footer>
Aviso legal: A informação apresentada neste website é meramente informativa e não será assumida qualquer responsabilidade pela sua utilização.
</footer>
</body>
</html>