Cambiados JTextFields del resumen de arqueo por NumberFormatedTextFields

This commit is contained in:
Daniel Cortes
2019-01-05 22:25:34 -03:00
parent d27c48c10a
commit 5497e39aee
7 changed files with 147 additions and 194 deletions

View File

@@ -33,6 +33,7 @@ import danielcortes.xyz.models.efectivo.EfectivoDAO;
import danielcortes.xyz.models.egreso.EgresoDAO;
import danielcortes.xyz.models.ingreso.IngresoDAO;
import danielcortes.xyz.views.ArqueoView;
import danielcortes.xyz.views.components.NumberFormatedTextField;
import javax.swing.*;
import java.awt.*;
@@ -124,7 +125,7 @@ public class ArqueoController {
* Calcula el total de efectivo y lo muestra en el efectivoField
*/
private void updateResumenEfectivo() {
JTextField efectivoField = this.view.getEfectivoField();
NumberFormatedTextField efectivoField = this.view.getEfectivoField();
int total = 0;
total += this.efectivo.getDiez();
total += this.efectivo.getCincuenta();
@@ -136,19 +137,19 @@ public class ArqueoController {
total += this.efectivo.getDiezMil();
total += this.efectivo.getVeinteMil();
efectivoField.setText(String.valueOf(total));
efectivoField.setValue(total);
}
/**
* Calcula el total de documentos y lo muestra en el documentosField
*/
private void updateResumenDocumentos() {
JTextField documentosField = this.view.getDocumentosField();
NumberFormatedTextField documentosField = this.view.getDocumentosField();
int total = 0;
total += this.documentos.getCheques();
total += this.documentos.getTarjetas();
documentosField.setText(String.valueOf(total));
documentosField.setValue(total);
}
/**
@@ -156,24 +157,24 @@ public class ArqueoController {
*/
private void updateResumenEgresos() {
int total = this.egresoDAO.getTotalEgreso(this.caja);
this.view.getEgresosField().setText(String.valueOf(total));
this.view.getEgresosField().setValue(total);
}
/**
* Calcula los datos de arqueo, rendido y ajuste y los muestra en sus campos correspondientes
*/
private void updateResumenArqueo() {
int totalEfectivo = Integer.parseInt(this.view.getEfectivoField().getText());
int totalDocumentos = Integer.parseInt(this.view.getDocumentosField().getText());
int totalEfectivo = this.view.getEfectivoField().getValue();
int totalDocumentos = this.view.getDocumentosField().getValue();
int totalIngresos = ingresoDAO.getTotalIngreso(this.caja);
int totalEgresos = Integer.parseInt(this.view.getEgresosField().getText());
int totalEgresos = this.view.getEgresosField().getValue();
int rendido = totalDocumentos + totalEfectivo + totalEgresos;
int diferencia = rendido - totalIngresos;
this.view.getRendidoField().setText(String.valueOf(rendido));
this.view.getDebeRendirField().setText(String.valueOf(totalIngresos));
this.view.getDiferenciaField().setText(String.valueOf(diferencia));
this.view.getRendidoField().setValue(rendido);
this.view.getDebeRendirField().setValue(totalIngresos);
this.view.getDiferenciaField().setValue(diferencia);
if(diferencia < 0) {
this.view.getDiferenciaField().setForeground(new Color(255,0,0));