-
Lenguaje
PHP
-
Descripción
Leer un monto a pagar y aplicar un descuento de 4% y luego el 18% de IGV.
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
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Descuento e IGV</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
<html>
<head>
<title>Descuento e IGV</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
if ($_SERVER['REQUEST_METHOD']=='POST')
{
$monto_a_pagar = floatval ($_POST['monto_a_pagar']);
$descuento=$monto_a_pagar*0.04;
$subtotal=$monto_a_pagar-$descuento;
$IGV=$subtotal*0.18;
$total=$subtotal+$IGV;
echo 'Valor de IGV: ' . $IGV . "<br/>\n";
echo 'Valor de descuento: ' . $descuento . "<br/>\n";
echo 'Valor de subtotal: ' . $subtotal . "<br/>\n";
echo 'Valor de total: ' . $total . "<br/>\n";
}
<form method="post">
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<label for="monto_a_pagar">Ingresa el valor de monto a pagar:</label>
</td>
<td>
<input name="monto_a_pagar" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Procesar" type="submit" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<label for="monto_a_pagar">Ingresa el valor de monto a pagar:</label>
</td>
<td>
<input name="monto_a_pagar" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Procesar" type="submit" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>