diff --git a/dist/Programa Caja.jar b/dist/Programa Caja.jar index 8b8482a..a8c1d02 100644 Binary files a/dist/Programa Caja.jar and b/dist/Programa Caja.jar differ diff --git a/src/danielcortes/xyz/informes/InformeEstadoResultado.java b/src/danielcortes/xyz/informes/InformeEstadoResultado.java index 06ef417..8d47ef2 100644 --- a/src/danielcortes/xyz/informes/InformeEstadoResultado.java +++ b/src/danielcortes/xyz/informes/InformeEstadoResultado.java @@ -56,42 +56,25 @@ public class InformeEstadoResultado { 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() { - Row bruto = sheet.createRow(1); - Row neto = sheet.createRow(2); - Row iva = sheet.createRow(3); - Row exentas = sheet.createRow(4); + int startId = 0; + + Row header = this.sheet.createRow(startId++); + 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(neto); this.ventaRows.add(iva); this.ventaRows.add(exentas); + this.footers.add(footer); + + header.createCell(0).setCellValue("Venta"); + header.createCell(1); bruto.createCell(0).setCellValue("Bruto"); bruto.createCell(1).setCellValue(DAOManager.getIngresoDAO().getTotalIngresoMes(this.mes)); @@ -104,18 +87,25 @@ public class InformeEstadoResultado { exentas.createCell(0).setCellValue("Exentas"); 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() { - Row costoVenta = sheet.createRow(8); - Row remuneraciones = sheet.createRow(9); - Row finiquitos = sheet.createRow(10); - Row aguinaldo = sheet.createRow(11); - Row partime = sheet.createRow(12); - Row bonosPersonal = sheet.createRow(13); - Row honorariosContador = sheet.createRow(14); - Row arriendo = sheet.createRow(15); + int startId = 7; + Row header = sheet.createRow(startId++); + Row costoVenta = sheet.createRow(startId++); + Row remuneraciones = sheet.createRow(startId++); + Row finiquitos = sheet.createRow(startId++); + Row aguinaldo = sheet.createRow(startId++); + Row partime = sheet.createRow(startId++); + 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(remuneraciones); this.gastosOperacionalesRows.add(finiquitos); @@ -124,6 +114,11 @@ public class InformeEstadoResultado { this.gastosOperacionalesRows.add(bonosPersonal); this.gastosOperacionalesRows.add(honorariosContador); 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(1).setCellValue(this.estadoResultado.getCostoVenta()); @@ -148,19 +143,31 @@ public class InformeEstadoResultado { arriendo.createCell(0).setCellValue("Arriendo"); arriendo.createCell(1).setCellValue(this.estadoResultado.getArriendo()); + + footer.createCell(0).setCellValue("Total"); + footer.createCell(1).setCellFormula("Sum(B9:B16)"); } private void fillServiciosData() { - Row agua = sheet.createRow(19); - Row luz = sheet.createRow(20); - Row gas = sheet.createRow(21); - Row telefono = sheet.createRow(22); + int startId = 18; + Row header = sheet.createRow(startId++); + Row agua = sheet.createRow(startId++); + 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(luz); this.serviciosRows.add(gas); 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(1).setCellValue(this.estadoResultado.getAgua()); luz.createCell(0).setCellValue("Luz"); @@ -169,6 +176,10 @@ public class InformeEstadoResultado { gas.createCell(1).setCellValue(this.estadoResultado.getGas()); telefono.createCell(0).setCellValue("Telefono"); 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() { @@ -176,57 +187,76 @@ public class InformeEstadoResultado { TipoEgreso gastoGeneralConBoleta = DAOManager.getTipoEgresoDAO().findByNombre("Gasto General Con Boleta").get(0); TipoEgreso gastoGeneralSinRespaldo = DAOManager.getTipoEgresoDAO().findByNombre("Gasto General Sin Respaldo").get(0); - Row cuentaCorrienteFactura = sheet.createRow(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); + int startId = 26; + 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(cuentaCorrienteBoleta); this.gastosGeneralesRows.add(cuentaCorrienteSinRespaldo); this.gastosGeneralesRows.add(efectivoFactura); this.gastosGeneralesRows.add(efectivoBoleta); 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(1).setCellValue(this.estadoResultado.getCuentaCorrienteFactura()); cuentaCorrienteBoleta.createCell(0).setCellValue("CTA CTE con Boleta"); cuentaCorrienteBoleta.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteBoleta()); cuentaCorrienteSinRespaldo.createCell(0).setCellValue("CTA CTE sin Respaldo"); cuentaCorrienteSinRespaldo.createCell(1).setCellValue(this.estadoResultado.getCuentaCorrienteSinRespaldo()); - efectivoFactura.createCell(0).setCellValue("Efectivo con Factura"); efectivoFactura.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, facturaGastosGenerales)); efectivoBoleta.createCell(0).setCellValue("Efectivo con Boleta"); efectivoBoleta.createCell(1).setCellValue(DAOManager.getEgresoDAO().getTotalEgresoMesPorTipo(this.mes, gastoGeneralConBoleta)); efectivoSinRespaldo.createCell(0).setCellValue("Efectivo sin Respaldo"); 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() { - Row utilidad = sheet.createRow(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); + int startId = 35; + 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(ppmMes); this.resumenGeneralRows.add(ivaMes); this.resumenGeneralRows.add(ivaMesPpm); this.resumenGeneralRows.add(ivaFavor); 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(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(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(1); @@ -234,7 +264,7 @@ public class InformeEstadoResultado { ivaMesPpm.createCell(0); ivaMesPpm.createCell(1); - ivaMesPpm.createCell(2).setCellFormula("C37 + C38"); + ivaMesPpm.createCell(2).setCellFormula("C38 + C39"); ivaFavor.createCell(0).setCellValue("- IVA a Favor"); ivaFavor.createCell(1); @@ -242,37 +272,11 @@ public class InformeEstadoResultado { aPagar.createCell(0).setCellValue("A Pagar PPM + IVA"); aPagar.createCell(1); - aPagar.createCell(2).setCellFormula("C39 - C40"); - } + aPagar.createCell(2).setCellFormula("C40 - C41"); - private void fillFooters() { - Row venta = sheet.createRow(5); - Row gastosOperacionales = sheet.createRow(16); - 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"); + footer.createCell(0).setCellValue("Resultado"); + footer.createCell(1); + footer.createCell(2).setCellFormula("C37 - C42"); } 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(16, 16, 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(25, 25, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(32, 32, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(34, 34, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(41, 41, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE); + pt.drawBorders(new CellRangeAddress(24, 24, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); + pt.drawBorders(new CellRangeAddress(26, 26, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); + pt.drawBorders(new CellRangeAddress(33, 33, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); + pt.drawBorders(new CellRangeAddress(35, 35, 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(8, 15, 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(35, 40, 0, 2), BorderStyle.THIN, BorderExtent.VERTICAL); + pt.drawBorders(new CellRangeAddress(27, 32, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); + pt.drawBorders(new CellRangeAddress(36, 41, 0, 2), BorderStyle.THIN, BorderExtent.VERTICAL); pt.applyBorders(this.sheet); } public void generarInforme() { - fillHeaders(); fillVentaData(); fillGastosOperacionalesData(); fillServiciosData(); fillGastosGeneralesData(); fillResumenGeneralData(); - fillFooters(); setStyles(); addBorders();