Se añadio el campo de otro en servicios

Se habia olvidado hacer previamente
Junto con esto se eliminaron las funciones que generaban los headers y
footers y ahora se hace ese proceso en las funciones que generan cada
seccion.
This commit is contained in:
Daniel Cortes
2019-02-27 13:31:11 -03:00
parent 57d6d62b10
commit 742347d618
2 changed files with 100 additions and 98 deletions

BIN
dist/Programa Caja.jar vendored

Binary file not shown.

View File

@@ -56,42 +56,25 @@ public class InformeEstadoResultado {
this.styles = this.generateStyles(); this.styles = this.generateStyles();
} }
private void fillHeaders() {
Row venta = this.sheet.createRow(0);
Row gastosOperacionales = this.sheet.createRow(7);
Row servicios = this.sheet.createRow(18);
Row gastosGenerales = this.sheet.createRow(25);
Row resumenGeneral = this.sheet.createRow(34);
venta.createCell(0).setCellValue("Venta");
venta.createCell(1);
gastosOperacionales.createCell(0).setCellValue("Gastos Operacionales");
gastosOperacionales.createCell(1);
servicios.createCell(0).setCellValue("Servicios");
servicios.createCell(1);
gastosGenerales.createCell(0).setCellValue("Gastos Generales");
gastosGenerales.createCell(1);
resumenGeneral.createCell(0).setCellValue("Resumen General");
resumenGeneral.createCell(1);
resumenGeneral.createCell(2);
this.headers.add(venta);
this.headers.add(gastosOperacionales);
this.headers.add(servicios);
this.headers.add(gastosGenerales);
this.headers.add(resumenGeneral);
}
private void fillVentaData() { private void fillVentaData() {
Row bruto = sheet.createRow(1); int startId = 0;
Row neto = sheet.createRow(2);
Row iva = sheet.createRow(3); Row header = this.sheet.createRow(startId++);
Row exentas = sheet.createRow(4); Row bruto = sheet.createRow(startId++);
Row neto = sheet.createRow(startId++);
Row iva = sheet.createRow(startId++);
Row exentas = sheet.createRow(startId++);
Row footer = sheet.createRow(startId++);
this.headers.add(header);
this.ventaRows.add(bruto); this.ventaRows.add(bruto);
this.ventaRows.add(neto); this.ventaRows.add(neto);
this.ventaRows.add(iva); this.ventaRows.add(iva);
this.ventaRows.add(exentas); this.ventaRows.add(exentas);
this.footers.add(footer);
header.createCell(0).setCellValue("Venta");
header.createCell(1);
bruto.createCell(0).setCellValue("Bruto"); bruto.createCell(0).setCellValue("Bruto");
bruto.createCell(1).setCellValue(DAOManager.getIngresoDAO().getTotalIngresoMes(this.mes)); bruto.createCell(1).setCellValue(DAOManager.getIngresoDAO().getTotalIngresoMes(this.mes));
@@ -104,18 +87,25 @@ public class InformeEstadoResultado {
exentas.createCell(0).setCellValue("Exentas"); exentas.createCell(0).setCellValue("Exentas");
exentas.createCell(1).setCellValue(DAOManager.getIngresoDAO().getTotalExentasMes(this.mes)); exentas.createCell(1).setCellValue(DAOManager.getIngresoDAO().getTotalExentasMes(this.mes));
footer.createCell(0).setCellValue("Neto mas Exentas");
footer.createCell(1).setCellFormula("B5+B3");
} }
private void fillGastosOperacionalesData() { private void fillGastosOperacionalesData() {
Row costoVenta = sheet.createRow(8); int startId = 7;
Row remuneraciones = sheet.createRow(9); Row header = sheet.createRow(startId++);
Row finiquitos = sheet.createRow(10); Row costoVenta = sheet.createRow(startId++);
Row aguinaldo = sheet.createRow(11); Row remuneraciones = sheet.createRow(startId++);
Row partime = sheet.createRow(12); Row finiquitos = sheet.createRow(startId++);
Row bonosPersonal = sheet.createRow(13); Row aguinaldo = sheet.createRow(startId++);
Row honorariosContador = sheet.createRow(14); Row partime = sheet.createRow(startId++);
Row arriendo = sheet.createRow(15); Row bonosPersonal = sheet.createRow(startId++);
Row honorariosContador = sheet.createRow(startId++);
Row arriendo = sheet.createRow(startId++);
Row footer = sheet.createRow(startId++);
this.headers.add(header);
this.gastosOperacionalesRows.add(costoVenta); this.gastosOperacionalesRows.add(costoVenta);
this.gastosOperacionalesRows.add(remuneraciones); this.gastosOperacionalesRows.add(remuneraciones);
this.gastosOperacionalesRows.add(finiquitos); this.gastosOperacionalesRows.add(finiquitos);
@@ -124,6 +114,11 @@ public class InformeEstadoResultado {
this.gastosOperacionalesRows.add(bonosPersonal); this.gastosOperacionalesRows.add(bonosPersonal);
this.gastosOperacionalesRows.add(honorariosContador); this.gastosOperacionalesRows.add(honorariosContador);
this.gastosOperacionalesRows.add(arriendo); this.gastosOperacionalesRows.add(arriendo);
this.footers.add(footer);
header.createCell(0).setCellValue("Gastos Operacionales");
header.createCell(1);
costoVenta.createCell(0).setCellValue("Costo de Venta"); costoVenta.createCell(0).setCellValue("Costo de Venta");
costoVenta.createCell(1).setCellValue(this.estadoResultado.getCostoVenta()); costoVenta.createCell(1).setCellValue(this.estadoResultado.getCostoVenta());
@@ -148,19 +143,31 @@ public class InformeEstadoResultado {
arriendo.createCell(0).setCellValue("Arriendo"); arriendo.createCell(0).setCellValue("Arriendo");
arriendo.createCell(1).setCellValue(this.estadoResultado.getArriendo()); arriendo.createCell(1).setCellValue(this.estadoResultado.getArriendo());
footer.createCell(0).setCellValue("Total");
footer.createCell(1).setCellFormula("Sum(B9:B16)");
} }
private void fillServiciosData() { private void fillServiciosData() {
Row agua = sheet.createRow(19); int startId = 18;
Row luz = sheet.createRow(20); Row header = sheet.createRow(startId++);
Row gas = sheet.createRow(21); Row agua = sheet.createRow(startId++);
Row telefono = sheet.createRow(22); Row luz = sheet.createRow(startId++);
Row gas = sheet.createRow(startId++);
Row telefono = sheet.createRow(startId++);
Row otro = sheet.createRow(startId++);
Row footer = sheet.createRow(startId++);
this.headers.add(header);
this.serviciosRows.add(agua); this.serviciosRows.add(agua);
this.serviciosRows.add(luz); this.serviciosRows.add(luz);
this.serviciosRows.add(gas); this.serviciosRows.add(gas);
this.serviciosRows.add(telefono); this.serviciosRows.add(telefono);
this.serviciosRows.add(otro);
this.footers.add(footer);
header.createCell(0).setCellValue("Servicios");
header.createCell(1);
agua.createCell(0).setCellValue("Agua"); agua.createCell(0).setCellValue("Agua");
agua.createCell(1).setCellValue(this.estadoResultado.getAgua()); agua.createCell(1).setCellValue(this.estadoResultado.getAgua());
luz.createCell(0).setCellValue("Luz"); luz.createCell(0).setCellValue("Luz");
@@ -169,6 +176,10 @@ public class InformeEstadoResultado {
gas.createCell(1).setCellValue(this.estadoResultado.getGas()); gas.createCell(1).setCellValue(this.estadoResultado.getGas());
telefono.createCell(0).setCellValue("Telefono"); telefono.createCell(0).setCellValue("Telefono");
telefono.createCell(1).setCellValue(this.estadoResultado.getTelefono()); telefono.createCell(1).setCellValue(this.estadoResultado.getTelefono());
otro.createCell(0).setCellValue("Otros");
otro.createCell(1).setCellValue(this.estadoResultado.getOtroServicio());
footer.createCell(0).setCellValue("Total");
footer.createCell(1).setCellFormula("Sum(B20:B24)");
} }
private void fillGastosGeneralesData() { private void fillGastosGeneralesData() {
@@ -176,57 +187,76 @@ public class InformeEstadoResultado {
TipoEgreso gastoGeneralConBoleta = DAOManager.getTipoEgresoDAO().findByNombre("Gasto General Con Boleta").get(0); TipoEgreso gastoGeneralConBoleta = DAOManager.getTipoEgresoDAO().findByNombre("Gasto General Con Boleta").get(0);
TipoEgreso gastoGeneralSinRespaldo = DAOManager.getTipoEgresoDAO().findByNombre("Gasto General Sin Respaldo").get(0); TipoEgreso gastoGeneralSinRespaldo = DAOManager.getTipoEgresoDAO().findByNombre("Gasto General Sin Respaldo").get(0);
Row cuentaCorrienteFactura = sheet.createRow(26); int startId = 26;
Row cuentaCorrienteBoleta = sheet.createRow(27);
Row cuentaCorrienteSinRespaldo = sheet.createRow(28);
Row efectivoFactura = sheet.createRow(29);
Row efectivoBoleta = sheet.createRow(30);
Row efectivoSinRespaldo = sheet.createRow(31);
Row header = sheet.createRow(startId++);
Row cuentaCorrienteFactura = sheet.createRow(startId++);
Row cuentaCorrienteBoleta = sheet.createRow(startId++);
Row cuentaCorrienteSinRespaldo = sheet.createRow(startId++);
Row efectivoFactura = sheet.createRow(startId++);
Row efectivoBoleta = sheet.createRow(startId++);
Row efectivoSinRespaldo = sheet.createRow(startId++);
Row footer = sheet.createRow(startId++);
this.headers.add(header);
this.gastosGeneralesRows.add(cuentaCorrienteFactura); this.gastosGeneralesRows.add(cuentaCorrienteFactura);
this.gastosGeneralesRows.add(cuentaCorrienteBoleta); this.gastosGeneralesRows.add(cuentaCorrienteBoleta);
this.gastosGeneralesRows.add(cuentaCorrienteSinRespaldo); this.gastosGeneralesRows.add(cuentaCorrienteSinRespaldo);
this.gastosGeneralesRows.add(efectivoFactura); this.gastosGeneralesRows.add(efectivoFactura);
this.gastosGeneralesRows.add(efectivoBoleta); this.gastosGeneralesRows.add(efectivoBoleta);
this.gastosGeneralesRows.add(efectivoSinRespaldo); this.gastosGeneralesRows.add(efectivoSinRespaldo);
this.footers.add(footer);
header.createCell(0).setCellValue("Gastos Generales");
header.createCell(1);
cuentaCorrienteFactura.createCell(0).setCellValue("CTA CTE con Factura"); cuentaCorrienteFactura.createCell(0).setCellValue("CTA CTE con Factura");
cuentaCorrienteFactura.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteFactura()); cuentaCorrienteFactura.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteFactura());
cuentaCorrienteBoleta.createCell(0).setCellValue("CTA CTE con Boleta"); cuentaCorrienteBoleta.createCell(0).setCellValue("CTA CTE con Boleta");
cuentaCorrienteBoleta.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteBoleta()); cuentaCorrienteBoleta.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteBoleta());
cuentaCorrienteSinRespaldo.createCell(0).setCellValue("CTA CTE sin Respaldo"); cuentaCorrienteSinRespaldo.createCell(0).setCellValue("CTA CTE sin Respaldo");
cuentaCorrienteSinRespaldo.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteSinRespaldo()); cuentaCorrienteSinRespaldo.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteSinRespaldo());
efectivoFactura.createCell(0).setCellValue("Efectivo con Factura"); efectivoFactura.createCell(0).setCellValue("Efectivo con Factura");
efectivoFactura.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, facturaGastosGenerales)); efectivoFactura.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, facturaGastosGenerales));
efectivoBoleta.createCell(0).setCellValue("Efectivo con Boleta"); efectivoBoleta.createCell(0).setCellValue("Efectivo con Boleta");
efectivoBoleta.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, gastoGeneralConBoleta)); efectivoBoleta.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, gastoGeneralConBoleta));
efectivoSinRespaldo.createCell(0).setCellValue("Efectivo sin Respaldo"); efectivoSinRespaldo.createCell(0).setCellValue("Efectivo sin Respaldo");
efectivoSinRespaldo.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, gastoGeneralSinRespaldo)); efectivoSinRespaldo.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, gastoGeneralSinRespaldo));
footer.createCell(0).setCellValue("Total");
footer.createCell(1).setCellFormula("Sum(B28:B33)");
} }
private void fillResumenGeneralData() { private void fillResumenGeneralData() {
Row utilidad = sheet.createRow(35); int startId = 35;
Row ppmMes = sheet.createRow(36);
Row ivaMes = sheet.createRow(37);
Row ivaMesPpm = sheet.createRow(38);
Row ivaFavor = sheet.createRow(39);
Row aPagar = sheet.createRow(40);
Row header = sheet.createRow(startId++);
Row utilidad = sheet.createRow(startId++);
Row ppmMes = sheet.createRow(startId++);
Row ivaMes = sheet.createRow(startId++);
Row ivaMesPpm = sheet.createRow(startId++);
Row ivaFavor = sheet.createRow(startId++);
Row aPagar = sheet.createRow(startId++);
Row footer = sheet.createRow(startId++);
this.headers.add(header);
this.resumenGeneralRows.add(utilidad); this.resumenGeneralRows.add(utilidad);
this.resumenGeneralRows.add(ppmMes); this.resumenGeneralRows.add(ppmMes);
this.resumenGeneralRows.add(ivaMes); this.resumenGeneralRows.add(ivaMes);
this.resumenGeneralRows.add(ivaMesPpm); this.resumenGeneralRows.add(ivaMesPpm);
this.resumenGeneralRows.add(ivaFavor); this.resumenGeneralRows.add(ivaFavor);
this.resumenGeneralRows.add(aPagar); this.resumenGeneralRows.add(aPagar);
this.footers.add(footer);
header.createCell(0).setCellValue("Resumen General");
header.createCell(1);
header.createCell(2);
utilidad.createCell(0).setCellValue("Utilidad"); utilidad.createCell(0).setCellValue("Utilidad");
utilidad.createCell(1); utilidad.createCell(1);
utilidad.createCell(2).setCellFormula("B2 - B17 - B24 - B33"); utilidad.createCell(2).setCellFormula("B2 - B17 - B25 - B34");
ppmMes.createCell(0).setCellValue("PPM Mes"); ppmMes.createCell(0).setCellValue("PPM Mes");
ppmMes.createCell(1).setCellValue(this.estadoResultado.getPpm() / 100); ppmMes.createCell(1).setCellValue(this.estadoResultado.getPpm() / 100);
ppmMes.createCell(2).setCellFormula("B6 * B37"); ppmMes.createCell(2).setCellFormula("B6 * B38");
ivaMes.createCell(0).setCellValue("+ IVA Mes"); ivaMes.createCell(0).setCellValue("+ IVA Mes");
ivaMes.createCell(1); ivaMes.createCell(1);
@@ -234,7 +264,7 @@ public class InformeEstadoResultado {
ivaMesPpm.createCell(0); ivaMesPpm.createCell(0);
ivaMesPpm.createCell(1); ivaMesPpm.createCell(1);
ivaMesPpm.createCell(2).setCellFormula("C37 + C38"); ivaMesPpm.createCell(2).setCellFormula("C38 + C39");
ivaFavor.createCell(0).setCellValue("- IVA a Favor"); ivaFavor.createCell(0).setCellValue("- IVA a Favor");
ivaFavor.createCell(1); ivaFavor.createCell(1);
@@ -242,37 +272,11 @@ public class InformeEstadoResultado {
aPagar.createCell(0).setCellValue("A Pagar PPM + IVA"); aPagar.createCell(0).setCellValue("A Pagar PPM + IVA");
aPagar.createCell(1); aPagar.createCell(1);
aPagar.createCell(2).setCellFormula("C39 - C40"); aPagar.createCell(2).setCellFormula("C40 - C41");
}
private void fillFooters() { footer.createCell(0).setCellValue("Resultado");
Row venta = sheet.createRow(5); footer.createCell(1);
Row gastosOperacionales = sheet.createRow(16); footer.createCell(2).setCellFormula("C37 - C42");
Row servicios = sheet.createRow(23);
Row gastosGenerales = sheet.createRow(32);
Row resumenGeneral = sheet.createRow(41);
this.footers.add(venta);
this.footers.add(gastosOperacionales);
this.footers.add(servicios);
this.footers.add(gastosGenerales);
this.footers.add(resumenGeneral);
venta.createCell(0).setCellValue("Neto mas Exentas");
venta.createCell(1).setCellFormula("B5+B3");
gastosOperacionales.createCell(0).setCellValue("Total");
gastosOperacionales.createCell(1).setCellFormula("Sum(B9:B16)");
servicios.createCell(0).setCellValue("Total");
servicios.createCell(1).setCellFormula("Sum(B20:B23)");
gastosGenerales.createCell(0).setCellValue("Total");
gastosGenerales.createCell(1).setCellFormula("Sum(B27:B32)");
resumenGeneral.createCell(0).setCellValue("Resultado");
resumenGeneral.createCell(1);
resumenGeneral.createCell(2).setCellFormula("C36 - C41");
} }
private void setStyles() { private void setStyles() {
@@ -335,29 +339,27 @@ public class InformeEstadoResultado {
pt.drawBorders(new CellRangeAddress(7, 7, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(7, 7, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(16, 16, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(16, 16, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(18, 18, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(18, 18, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(23, 23, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(24, 24, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(25, 25, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(26, 26, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(32, 32, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(33, 33, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(34, 34, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(35, 35, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(41, 41, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE); pt.drawBorders(new CellRangeAddress(42, 42, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE);
pt.drawBorders(new CellRangeAddress(1, 4, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); pt.drawBorders(new CellRangeAddress(1, 4, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL);
pt.drawBorders(new CellRangeAddress(8, 15, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); pt.drawBorders(new CellRangeAddress(8, 15, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL);
pt.drawBorders(new CellRangeAddress(19, 23, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); pt.drawBorders(new CellRangeAddress(19, 23, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL);
pt.drawBorders(new CellRangeAddress(26, 31, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); pt.drawBorders(new CellRangeAddress(27, 32, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL);
pt.drawBorders(new CellRangeAddress(35, 40, 0, 2), BorderStyle.THIN, BorderExtent.VERTICAL); pt.drawBorders(new CellRangeAddress(36, 41, 0, 2), BorderStyle.THIN, BorderExtent.VERTICAL);
pt.applyBorders(this.sheet); pt.applyBorders(this.sheet);
} }
public void generarInforme() { public void generarInforme() {
fillHeaders();
fillVentaData(); fillVentaData();
fillGastosOperacionalesData(); fillGastosOperacionalesData();
fillServiciosData(); fillServiciosData();
fillGastosGeneralesData(); fillGastosGeneralesData();
fillResumenGeneralData(); fillResumenGeneralData();
fillFooters();
setStyles(); setStyles();
addBorders(); addBorders();