Consulta de aproximación
Publicado por Hector (63 intervenciones) el 21/06/2019 22:26:04
Hola amigos del foro, he aqui con otra consulta para mejorar así el código existente, al igual que el anterior esta reflejado en las facturas, lo que quiero hacer que el valor del IVA realiza una aproximación de decimales, con el actual código funciona bien, pero no lo aproxima, por ejemplo en txtiva 64125,6, lo hace pero no lo aumenta en un peso, a continuación les dejo el código que utilizo.
ojala que me puedan ayudar y desde ya muchas gracias.
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
private void cmdrepuestosActionPerformed(java.awt.event.ActionEvent evt) {
if (cmdrepuestos.isSelected()) {
cmdrepuestos.setText("No");
String valor2 = cmdrepuestos.getText();
int a = 0;
String texto1 = txtrepuestos.getText();
texto1 = texto1.replaceAll(" ", "");
if (texto1.isEmpty()) {
if (txtrepuestos.getText().length() == 0) {
String valor = Integer.toString(a);
txtrepuestos.setText(valor);
}
}
int val1 = Integer.parseInt(txtmano.getText());
int val2 = Integer.parseInt(txtrepuestos.getText());
int val3 = Integer.parseInt(txtdeducible.getText());
int suma = val1 + val2 - val3;
String valorNeto = Integer.toString(suma);
txtneto.setText(valorNeto);
int val4 = Integer.parseInt(txtneto.getText());
Double suma1 = val4 * 0.19;
String valorTotal1 = Integer.toString(suma1.intValue());
txtiva.setText(valorTotal1);
int val5 = Integer.parseInt(txtneto.getText());
int val6 = Integer.parseInt(txtiva.getText());
int suma2 = val5 + val6;
String valorTotal2 = Integer.toString(suma2);
txttotal.setText(valorTotal2);
String valor3 = (TareasProgramacion.cantidadConLetra(txttotal.getText()));
txtletras.setText(valor3);
txtleyenda.requestFocus();
} else {
cmdrepuestos.setText("Si");
String valor2 = cmdrepuestos.getText();
mostrardatos1(txtpatente.getText());
existe2();
int val1 = Integer.parseInt(txtmano.getText());
int val2 = Integer.parseInt(txtrepuestos.getText());
int val3 = Integer.parseInt(txtdeducible.getText());
int suma = val1 + val2 - val3;
String valorNeto = Integer.toString(suma);
txtneto.setText(valorNeto);
int val4 = Integer.parseInt(txtneto.getText());
Double suma1 = val4 * 0.19;
String valorTotal1 = Integer.toString(suma1.intValue());
txtiva.setText(valorTotal1);
int val5 = Integer.parseInt(txtneto.getText());
int val6 = Integer.parseInt(txtiva.getText());
int suma2 = val5 + val6;
String valorTotal2 = Integer.toString(suma2);
txttotal.setText(valorTotal2);
String valor3 = (TareasProgramacion.cantidadConLetra(txttotal.getText()));
txtletras.setText(valor3);
txtleyenda.requestFocus();
}
}
Valora esta pregunta


0