Generacion de informes desde la interfaz :3
This commit is contained in:
@@ -207,11 +207,11 @@
|
||||
</column>
|
||||
<column id="51" parent="10" name="nro_z_inicial">
|
||||
<Position>7</Position>
|
||||
<DataType>text|0s</DataType>
|
||||
<DefaultExpression>''</DefaultExpression>
|
||||
</column>
|
||||
<column id="52" parent="10" name="nro_z_final">
|
||||
<Position>8</Position>
|
||||
<DataType>text|0s</DataType>
|
||||
<DefaultExpression>''</DefaultExpression>
|
||||
</column>
|
||||
<key id="53" parent="10">
|
||||
<ColNames>id</ColNames>
|
||||
|
||||
876
.idea/workspace.xml
generated
876
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
BIN
dist/caja.jar
vendored
BIN
dist/caja.jar
vendored
Binary file not shown.
BIN
dist/database.sqlite
vendored
BIN
dist/database.sqlite
vendored
Binary file not shown.
@@ -113,8 +113,4 @@ public class Main {
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void test(){
|
||||
InformeMensual informeMensual = new InformeMensual(LocalDate.now());
|
||||
informeMensual.generarInforme();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,6 @@ public class ArqueoController {
|
||||
this.view.getCienField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"),"nextField");
|
||||
this.view.getCincuentaField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"),"nextField");
|
||||
this.view.getDiezField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"),"save");
|
||||
this.view.getGuardarEfectivoButton().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"),"save");
|
||||
|
||||
this.view.getVeinteMilField().getActionMap().put("nextField", new NextAction(this.view.getDiezMilField()));
|
||||
this.view.getDiezMilField().getActionMap().put("nextField", new NextAction(this.view.getCincoMilField()));
|
||||
@@ -195,14 +194,20 @@ public class ArqueoController {
|
||||
this.view.getCienField().getActionMap().put("nextField", new NextAction(this.view.getCincuentaField()));
|
||||
this.view.getCincuentaField().getActionMap().put("nextField", new NextAction(this.view.getDiezField()));
|
||||
this.view.getDiezField().getActionMap().put("save", new GuardarEfectivoAction(this));
|
||||
this.view.getGuardarEfectivoButton().getActionMap().put("save", new GuardarEfectivoAction(this));
|
||||
|
||||
|
||||
this.view.getChequesField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"),"nextField");
|
||||
this.view.getTarjetasField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"),"save");
|
||||
this.view.getChequesField().getActionMap().put("nextField", new NextAction(this.view.getTarjetasField()));
|
||||
this.view.getTarjetasField().getActionMap().put("save", new GuardarDocumentosAction(this));
|
||||
this.view.getGuardarDocumentosButton().getActionMap().put("save", new GuardarDocumentosAction(this));
|
||||
|
||||
this.view.getGuardarEfectivoButton().addActionListener(e ->{
|
||||
this.guardarEfectivoActionListener();
|
||||
});
|
||||
this.view.getGuardarDocumentosButton().addActionListener(e ->{
|
||||
this.guardarEfectivoActionListener();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
93
src/danielcortes/xyz/controllers/InformesController.java
Normal file
93
src/danielcortes/xyz/controllers/InformesController.java
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018-2019 Daniel Cortes
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package danielcortes.xyz.controllers;
|
||||
|
||||
import danielcortes.xyz.informes.InformeMensual;
|
||||
import danielcortes.xyz.views.InformeMensualDialog;
|
||||
import danielcortes.xyz.views.InformesView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class InformesController {
|
||||
private InformesView view;
|
||||
|
||||
public InformesController(InformesView view) {
|
||||
this.view = view;
|
||||
this.setupViewEvents();
|
||||
}
|
||||
|
||||
private void setupViewEvents() {
|
||||
this.view.getInformeMensualButton().addActionListener(e -> generarInformeMensualListener());
|
||||
}
|
||||
|
||||
private void generarInformeMensualListener() {
|
||||
LocalDate month = askForMonth();
|
||||
if (month == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM YYYY");
|
||||
String formatedName = month.format(formatter);
|
||||
String capitalized = formatedName.substring(0, 1).toUpperCase() + formatedName.substring(1);
|
||||
File saveFile = askForFile("Informe "+ capitalized);
|
||||
if (saveFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
InformeMensual informeMensual = new InformeMensual(month, saveFile);
|
||||
informeMensual.generarInforme();
|
||||
}
|
||||
|
||||
private LocalDate askForMonth() {
|
||||
InformeMensualDialog informeMensualDialog = new InformeMensualDialog(this.view.getContentPanel());
|
||||
if (informeMensualDialog.isAcepted()) {
|
||||
return informeMensualDialog.getMonth();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private File askForFile(String suggestedName) {
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
|
||||
chooser.setSelectedFile(new File(suggestedName+".xls"));
|
||||
chooser.setFileFilter(new FileNameExtensionFilter("Excel 2007", "xls"));
|
||||
|
||||
if (chooser.showSaveDialog(this.view.getContentPanel()) == JFileChooser.APPROVE_OPTION) {
|
||||
String filename = chooser.getSelectedFile().toString();
|
||||
if (!filename.endsWith(".xls"))
|
||||
filename += ".xls";
|
||||
|
||||
return new File(filename);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,10 +41,7 @@ import danielcortes.xyz.models.tipo_egreso.MysqlTipoEgresoDAO;
|
||||
import danielcortes.xyz.models.tipo_ingreso.MysqlTipoIngresoDAO;
|
||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
||||
import danielcortes.xyz.views.ArqueoView;
|
||||
import danielcortes.xyz.views.EgresosView;
|
||||
import danielcortes.xyz.views.IngresosView;
|
||||
import danielcortes.xyz.views.ManagerView;
|
||||
import danielcortes.xyz.views.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -60,6 +57,7 @@ public class ManagerController {
|
||||
private IngresosController ingresosController;
|
||||
private EgresosController egresosController;
|
||||
private ArqueoController arqueoController;
|
||||
private InformesController informesController;
|
||||
|
||||
private CajaDAO cajaDAO;
|
||||
private DocumentosDAO documentosDAO;
|
||||
@@ -123,6 +121,10 @@ public class ManagerController {
|
||||
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
|
||||
layout.show(this.view.getCardPanel(), "ARQUEO");
|
||||
});
|
||||
this.view.getInformesButton().addActionListener(e -> {
|
||||
CardLayout layout = (CardLayout) this.view.getCardPanel().getLayout();
|
||||
layout.show(this.view.getCardPanel(), "INFORMES");
|
||||
});
|
||||
this.view.getDatePicker().addDateChangeListener(e -> updateCaja());
|
||||
}
|
||||
|
||||
@@ -159,6 +161,7 @@ public class ManagerController {
|
||||
this.loadEgresosView();
|
||||
this.loadIngresosView();
|
||||
this.loadArqueoView();
|
||||
this.loadInformesView();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +197,13 @@ public class ManagerController {
|
||||
this.arqueoController = new ArqueoController(arqueoView, this.efectivoDAO, this.documentosDAO, this.ingresoDAO, this.egresoDAO);
|
||||
}
|
||||
|
||||
private void loadInformesView() {
|
||||
InformesView informesView = new InformesView();
|
||||
this.view.getCardPanel().add(informesView.getContentPanel(), "INFORMES");
|
||||
|
||||
this.informesController = new InformesController(informesView);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activa el primer boton del manager
|
||||
*/
|
||||
|
||||
@@ -24,11 +24,16 @@
|
||||
|
||||
package danielcortes.xyz.informes;
|
||||
|
||||
import danielcortes.xyz.models.caja.Caja;
|
||||
import danielcortes.xyz.models.caja.SQLiteCajaDAO;
|
||||
import danielcortes.xyz.models.documentos.Documentos;
|
||||
import danielcortes.xyz.models.efectivo.Efectivo;
|
||||
import danielcortes.xyz.models.informe.InformeMensualContent;
|
||||
import danielcortes.xyz.models.informe.SQLiteInformeMensualContentDAO;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -40,88 +45,137 @@ import java.util.List;
|
||||
|
||||
public class InformeMensual {
|
||||
private final String[] titles = {"DIA", "FECHA", "FISCALES", "MANUALES", "FACTURAS", "GUIAS", "TOTAL", "ACUMULADO"};
|
||||
private final String[] dias = {"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"};
|
||||
|
||||
private List<InformeMensualContent> informe;
|
||||
private File saveFile;
|
||||
|
||||
private Workbook wb;
|
||||
private Sheet sheet;
|
||||
private CreationHelper createHelper;
|
||||
private HashMap<String, CellStyle> styles;
|
||||
|
||||
public InformeMensual(LocalDate date){
|
||||
|
||||
private int headerStartRow;
|
||||
private int dataStartRow;
|
||||
private int columnStart;
|
||||
private int totalColumns;
|
||||
|
||||
public InformeMensual(LocalDate date, File saveFile){
|
||||
new SQLiteCajaDAO().createCajasForMonth(date);
|
||||
|
||||
this.informe = new SQLiteInformeMensualContentDAO().getInformeMensual(date);
|
||||
this.saveFile = saveFile;
|
||||
|
||||
this.wb = new HSSFWorkbook();
|
||||
this.sheet = wb.createSheet();
|
||||
this.createHelper = wb.getCreationHelper();
|
||||
this.styles = this.generateStyles();
|
||||
|
||||
this.headerStartRow = 1;
|
||||
this.columnStart = 1;
|
||||
this.dataStartRow = 2;
|
||||
this.totalColumns = 7;
|
||||
}
|
||||
|
||||
public void generarInforme(){
|
||||
for (int x = 0; x < informe.size(); x++) {
|
||||
InformeMensualContent data = informe.get(x);
|
||||
Row dataRow = sheet.createRow(x + 1);
|
||||
private void fillHeaders(){
|
||||
Row headers = sheet.createRow(this.headerStartRow);
|
||||
for (int x = this.columnStart; x < titles.length + this.columnStart; x++) {
|
||||
headers.createCell(x).setCellValue(titles[x - this.columnStart]);
|
||||
}
|
||||
}
|
||||
|
||||
private void fillData(){
|
||||
for (int x = this.dataStartRow; x < this.dataStartRow + informe.size(); x++) {
|
||||
Row dataRow = sheet.createRow(x);
|
||||
|
||||
InformeMensualContent data = informe.get(x-this.dataStartRow);
|
||||
Date fecha = Date.from(data.getFecha().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
dataRow.createCell(0).setCellValue(data.getDia());
|
||||
dataRow.createCell(1).setCellValue(fecha);
|
||||
dataRow.createCell(2).setCellValue(data.getFiscales());
|
||||
dataRow.createCell(3).setCellValue(data.getManuales());
|
||||
dataRow.createCell(4).setCellValue(data.getFacturas());
|
||||
dataRow.createCell(5).setCellValue(data.getGuias());
|
||||
dataRow.createCell(6).setCellValue(data.getTotal());
|
||||
if(x>0){
|
||||
dataRow.createCell(7).setCellFormula(("H"+(x+1))+("+")+("G"+(x+2)));
|
||||
dataRow.createCell(this.columnStart).setCellValue(this.dias[data.getDia()]);
|
||||
dataRow.createCell(this.columnStart + 1).setCellValue(fecha);
|
||||
dataRow.createCell(this.columnStart + 2).setCellValue(data.getFiscales());
|
||||
dataRow.createCell(this.columnStart + 3).setCellValue(data.getManuales());
|
||||
dataRow.createCell(this.columnStart + 4).setCellValue(data.getFacturas());
|
||||
dataRow.createCell(this.columnStart + 5).setCellValue(data.getGuias());
|
||||
dataRow.createCell(this.columnStart + 6).setCellValue(data.getTotal());
|
||||
|
||||
if(x==this.dataStartRow){
|
||||
dataRow.createCell(this.columnStart + 7).setCellFormula(("H"+(x+1)));
|
||||
}else{
|
||||
dataRow.createCell(7).setCellFormula(("G"+(x+2)));
|
||||
dataRow.createCell(this.columnStart + 7).setCellFormula(("I"+(x))+("+")+("H"+(x+1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataRow.getCell(1).setCellStyle(this.styles.get("date"));
|
||||
dataRow.getCell(2).setCellStyle(this.styles.get("money"));
|
||||
dataRow.getCell(3).setCellStyle(this.styles.get("money"));
|
||||
dataRow.getCell(4).setCellStyle(this.styles.get("money"));
|
||||
dataRow.getCell(5).setCellStyle(this.styles.get("money"));
|
||||
dataRow.getCell(6).setCellStyle(this.styles.get("money"));
|
||||
dataRow.getCell(7).setCellStyle(this.styles.get("money"));
|
||||
}
|
||||
|
||||
Row headers = sheet.createRow(0);
|
||||
headers.setHeightInPoints(30);
|
||||
for (int x = 0; x < titles.length; x++) {
|
||||
headers.createCell(x).setCellValue(titles[x]);
|
||||
headers.getCell(x).setCellStyle(this.styles.get("header"));
|
||||
private void setStyles(){
|
||||
this.sheet.getRow(this.headerStartRow).setHeightInPoints(30);
|
||||
for(int x = this.columnStart; x <= this.totalColumns + this.columnStart; x++){
|
||||
this.sheet.getRow(this.headerStartRow).getCell(x).setCellStyle(this.styles.get("header"));
|
||||
sheet.autoSizeColumn(x);
|
||||
}
|
||||
|
||||
try (OutputStream fileOut = new FileOutputStream("workbook.xls")) {
|
||||
|
||||
for(int x = this.dataStartRow; x < informe.size() + this.dataStartRow; x++){
|
||||
Row row = this.sheet.getRow(x);
|
||||
row.getCell(this.columnStart).setCellStyle(this.styles.get("borders"));
|
||||
row.getCell(this.columnStart + 1).setCellStyle(this.styles.get("date"));
|
||||
row.getCell(this.columnStart + 2).setCellStyle(this.styles.get("money"));
|
||||
row.getCell(this.columnStart + 3).setCellStyle(this.styles.get("money"));
|
||||
row.getCell(this.columnStart + 4).setCellStyle(this.styles.get("money"));
|
||||
row.getCell(this.columnStart + 5).setCellStyle(this.styles.get("money"));
|
||||
row.getCell(this.columnStart + 6).setCellStyle(this.styles.get("money"));
|
||||
row.getCell(this.columnStart + 7).setCellStyle(this.styles.get("money"));
|
||||
}
|
||||
|
||||
for(int x = this.columnStart; x <= this.totalColumns + this.columnStart; x++){
|
||||
sheet.autoSizeColumn(x);
|
||||
}
|
||||
}
|
||||
|
||||
public void generarInforme(){
|
||||
fillData();
|
||||
fillHeaders();
|
||||
setStyles();
|
||||
|
||||
try (OutputStream fileOut = new FileOutputStream(this.saveFile)) {
|
||||
wb.write(fileOut);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, CellStyle> generateStyles(){
|
||||
CellStyle dateCellStyle = this.wb.createCellStyle();
|
||||
dateCellStyle.setDataFormat(this.createHelper.createDataFormat().getFormat("d/m/yyyy"));
|
||||
|
||||
CellStyle moneyCellStyle = this.wb.createCellStyle();
|
||||
moneyCellStyle.setDataFormat(this.createHelper.createDataFormat().getFormat("\"$\"#,##0_);(\"$\"#,##0)"));
|
||||
private HashMap<String, CellStyle> generateStyles(){
|
||||
CellStyle bordersStyle = this.wb.createCellStyle();
|
||||
bordersStyle.setBorderBottom(BorderStyle.THIN);
|
||||
bordersStyle.setBorderTop(BorderStyle.THIN);
|
||||
bordersStyle.setBorderLeft(BorderStyle.THIN);
|
||||
bordersStyle.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
CellStyle dateStyle = this.wb.createCellStyle();
|
||||
dateStyle.cloneStyleFrom(bordersStyle);
|
||||
dateStyle.setDataFormat(this.createHelper.createDataFormat().getFormat("dd/mm/yyyy"));
|
||||
|
||||
CellStyle moneyStyle = this.wb.createCellStyle();
|
||||
moneyStyle.cloneStyleFrom(bordersStyle);
|
||||
moneyStyle.setDataFormat(this.createHelper.createDataFormat().getFormat("\"$\"#,##0_);(\"$\"#,##0)"));
|
||||
|
||||
Font headerFont = this.wb.createFont();
|
||||
headerFont.setColor(IndexedColors.WHITE.getIndex());
|
||||
|
||||
CellStyle headerStyle = this.wb.createCellStyle();
|
||||
headerStyle.cloneStyleFrom(bordersStyle);
|
||||
headerStyle.setFont(headerFont);
|
||||
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
headerStyle.setBorderBottom(BorderStyle.THICK);
|
||||
headerStyle.setBorderTop(BorderStyle.THIN);
|
||||
headerStyle.setBorderLeft(BorderStyle.THIN);
|
||||
headerStyle.setBorderRight(BorderStyle.THIN);
|
||||
headerStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
||||
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
HashMap<String, CellStyle> styles = new HashMap<>();
|
||||
styles.put("date", dateCellStyle);
|
||||
styles.put("money", moneyCellStyle);
|
||||
styles.put("date", dateStyle);
|
||||
styles.put("money", moneyStyle);
|
||||
styles.put("header", headerStyle);
|
||||
styles.put("borders", bordersStyle);
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public abstract class CajaDAO {
|
||||
public abstract boolean insertCaja(Caja caja);
|
||||
public abstract boolean updateCaja(Caja caja);
|
||||
|
||||
public abstract void createCajasForMonth(LocalDate month);
|
||||
|
||||
protected List<Caja> cajasFromResultSet(ResultSet rs) throws SQLException {
|
||||
List<Caja> cajaList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
|
||||
@@ -25,6 +25,14 @@
|
||||
package danielcortes.xyz.models.caja;
|
||||
|
||||
import danielcortes.xyz.data.MysqlConnectionHolder;
|
||||
import danielcortes.xyz.models.documentos.Documentos;
|
||||
import danielcortes.xyz.models.documentos.DocumentosDAO;
|
||||
import danielcortes.xyz.models.documentos.MysqlDocumentosDAO;
|
||||
import danielcortes.xyz.models.documentos.SQLiteDocumentosDAO;
|
||||
import danielcortes.xyz.models.efectivo.Efectivo;
|
||||
import danielcortes.xyz.models.efectivo.EfectivoDAO;
|
||||
import danielcortes.xyz.models.efectivo.MysqlEfectivoDAO;
|
||||
import danielcortes.xyz.models.efectivo.SQLiteEfectivoDAO;
|
||||
|
||||
import java.sql.*;
|
||||
import java.time.LocalDate;
|
||||
@@ -149,4 +157,35 @@ public class MysqlCajaDAO extends CajaDAO {
|
||||
}
|
||||
return updates > 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void createCajasForMonth(LocalDate month) {
|
||||
LocalDate date = month.withDayOfMonth(1);
|
||||
LocalDate endDate = date.withDayOfMonth(date.lengthOfMonth());
|
||||
|
||||
while(date.isBefore(endDate)) {
|
||||
if(this.findByFecha(date) != null){
|
||||
date = date.plusDays(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
Caja caja = new Caja();
|
||||
caja.setFecha(date);
|
||||
this.insertCaja(caja);
|
||||
|
||||
Efectivo efectivo = new Efectivo();
|
||||
EfectivoDAO efectivoDAO = new MysqlEfectivoDAO();
|
||||
efectivo.setCaja(caja);
|
||||
efectivoDAO.insertDefaultEfectivo(efectivo);
|
||||
|
||||
Documentos documentos = new Documentos();
|
||||
DocumentosDAO documentosDAO = new MysqlDocumentosDAO();
|
||||
documentos.setCaja(caja);
|
||||
documentosDAO.insertDefaultDocumentos(documentos);
|
||||
|
||||
date = date.plusDays(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
package danielcortes.xyz.models.caja;
|
||||
|
||||
import danielcortes.xyz.data.SQLiteConnectionHolder;
|
||||
import danielcortes.xyz.models.documentos.Documentos;
|
||||
import danielcortes.xyz.models.documentos.DocumentosDAO;
|
||||
import danielcortes.xyz.models.documentos.SQLiteDocumentosDAO;
|
||||
import danielcortes.xyz.models.efectivo.Efectivo;
|
||||
import danielcortes.xyz.models.efectivo.EfectivoDAO;
|
||||
import danielcortes.xyz.models.efectivo.SQLiteEfectivoDAO;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -152,4 +158,34 @@ public class SQLiteCajaDAO extends CajaDAO {
|
||||
}
|
||||
return updates > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCajasForMonth(LocalDate month) {
|
||||
LocalDate date = month.withDayOfMonth(1);
|
||||
LocalDate endDate = date.withDayOfMonth(date.lengthOfMonth());
|
||||
|
||||
while(date.isBefore(endDate)) {
|
||||
if(this.findByFecha(date) != null){
|
||||
date = date.plusDays(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
Caja caja = new Caja();
|
||||
caja.setFecha(date);
|
||||
this.insertCaja(caja);
|
||||
|
||||
Efectivo efectivo = new Efectivo();
|
||||
EfectivoDAO efectivoDAO = new SQLiteEfectivoDAO();
|
||||
efectivo.setCaja(caja);
|
||||
efectivoDAO.insertDefaultEfectivo(efectivo);
|
||||
|
||||
Documentos documentos = new Documentos();
|
||||
DocumentosDAO documentosDAO = new SQLiteDocumentosDAO();
|
||||
documentos.setCaja(caja);
|
||||
documentosDAO.insertDefaultDocumentos(documentos);
|
||||
|
||||
date = date.plusDays(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class InformeMensualContent {
|
||||
private int total;
|
||||
|
||||
public int getDia() {
|
||||
return dia;
|
||||
return this.dia;
|
||||
}
|
||||
|
||||
public void setDia(int dia) {
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SQLiteInformeMensualContentDAO extends InformeMensualContentDAO{
|
||||
public class SQLiteInformeMensualContentDAO extends InformeMensualContentDAO {
|
||||
@Override
|
||||
public List<InformeMensualContent> getInformeMensual(LocalDate date) {
|
||||
ArrayList<InformeMensualContent> list = new ArrayList<>();
|
||||
@@ -46,8 +46,8 @@ public class SQLiteInformeMensualContentDAO extends InformeMensualContentDAO{
|
||||
"sum(case when ingresos.tipo_ingreso_id = 2 then ingresos.valor else 0 end) as \"manuales\"," +
|
||||
"sum(case when ingresos.tipo_ingreso_id = 3 then ingresos.valor else 0 end) as \"facturas\"," +
|
||||
"sum(case when ingresos.tipo_ingreso_id = 4 then ingresos.valor else 0 end) as \"guias\"," +
|
||||
"sum(ingresos.valor) \"total\" " +
|
||||
"from caja join ingresos on (caja.id = ingresos.caja_id) " +
|
||||
"sum(case when ingresos.valor not null then ingresos.valor else 0 end) \"total\" " +
|
||||
"from caja left join ingresos on (caja.id = ingresos.caja_id) " +
|
||||
"where caja.fecha between date(?) and date(?) " +
|
||||
"group by caja.fecha " +
|
||||
"order by caja.fecha ";
|
||||
@@ -58,7 +58,7 @@ public class SQLiteInformeMensualContentDAO extends InformeMensualContentDAO{
|
||||
ps.setString(2, date.withDayOfMonth(LocalDate.now().lengthOfMonth()).toString());
|
||||
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while(rs.next()){
|
||||
while (rs.next()) {
|
||||
InformeMensualContent informeMensualContent = new InformeMensualContent();
|
||||
informeMensualContent.setDia(rs.getInt("dia"));
|
||||
informeMensualContent.setFecha(LocalDate.parse(rs.getString("fecha")));
|
||||
|
||||
100
src/danielcortes/xyz/views/InformeMensualDialog.form
Normal file
100
src/danielcortes/xyz/views/InformeMensualDialog.form
Normal file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.InformeMensualDialog">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="246" height="198"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<hspacer id="98af6">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<grid id="9538f" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="OK"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Cancelar"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="d5732" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Mes"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="319c0" class="javax.swing.JComboBox" binding="monthCombo" custom-create="true" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="ffd13" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Año"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="74a74" class="javax.swing.JSpinner" binding="yearSpinner" custom-create="true" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="56bfd" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Seleccione Mes y Año"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
180
src/danielcortes/xyz/views/InformeMensualDialog.java
Normal file
180
src/danielcortes/xyz/views/InformeMensualDialog.java
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018-2019 Daniel Cortes
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package danielcortes.xyz.views;
|
||||
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.intellij.uiDesigner.core.Spacer;
|
||||
import danielcortes.xyz.views.components.YearSpinnerModel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class InformeMensualDialog extends JDialog {
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JButton buttonCancel;
|
||||
private JComboBox<String> monthCombo;
|
||||
private JSpinner yearSpinner;
|
||||
|
||||
private ArrayList<String> months;
|
||||
|
||||
private boolean acepted;
|
||||
|
||||
public InformeMensualDialog(JComponent parent) {
|
||||
$$$setupUI$$$();
|
||||
setContentPane(contentPane);
|
||||
setModalityType(ModalityType.APPLICATION_MODAL);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
|
||||
|
||||
buttonOK.addActionListener(e -> onOK());
|
||||
|
||||
buttonCancel.addActionListener(e -> onCancel());
|
||||
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
onCancel();
|
||||
}
|
||||
});
|
||||
|
||||
contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||
|
||||
pack();
|
||||
setLocationRelativeTo(parent);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
this.acepted = true;
|
||||
dispose();
|
||||
}
|
||||
|
||||
private void onCancel() {
|
||||
this.acepted = false;
|
||||
dispose();
|
||||
}
|
||||
|
||||
public boolean isAcepted() {
|
||||
return this.acepted;
|
||||
}
|
||||
|
||||
public LocalDate getMonth() {
|
||||
int year = Integer.valueOf((String) yearSpinner.getValue());
|
||||
int month = this.months.indexOf((String) this.monthCombo.getSelectedItem()) + 1;
|
||||
|
||||
LocalDate monthDate = LocalDate.of(year, month, 1);
|
||||
return monthDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method generated by IntelliJ IDEA GUI Designer
|
||||
* >>> IMPORTANT!! <<<
|
||||
* DO NOT edit this method OR call it in your code!
|
||||
*
|
||||
* @noinspection ALL
|
||||
*/
|
||||
private void $$$setupUI$$$() {
|
||||
createUIComponents();
|
||||
contentPane = new JPanel();
|
||||
contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
|
||||
final Spacer spacer1 = new Spacer();
|
||||
panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false));
|
||||
panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
buttonOK = new JButton();
|
||||
buttonOK.setText("OK");
|
||||
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
buttonCancel = new JButton();
|
||||
buttonCancel.setText("Cancel");
|
||||
panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JPanel panel3 = new JPanel();
|
||||
panel3.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setText("Mes");
|
||||
panel3.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel3.add(monthCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label2 = new JLabel();
|
||||
label2.setText("Año");
|
||||
panel3.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel3.add(yearSpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label3 = new JLabel();
|
||||
label3.setText("Seleccione Mes y Año");
|
||||
panel3.add(label3, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
createYearSpinner();
|
||||
createMonthCombo();
|
||||
}
|
||||
|
||||
private void createYearSpinner() {
|
||||
SpinnerModel model = new YearSpinnerModel();
|
||||
this.yearSpinner = new JSpinner();
|
||||
this.yearSpinner.setModel(model);
|
||||
((JSpinner.DefaultEditor) this.yearSpinner.getEditor()).getTextField().setEditable(true);
|
||||
}
|
||||
|
||||
private void createMonthCombo() {
|
||||
months = new ArrayList<>();
|
||||
months.add("Enero");
|
||||
months.add("Febrero");
|
||||
months.add("Marzo");
|
||||
months.add("Abril");
|
||||
months.add("Mayo");
|
||||
months.add("Junio");
|
||||
months.add("Julio");
|
||||
months.add("Agosto");
|
||||
months.add("Septiembre");
|
||||
months.add("Octubre");
|
||||
months.add("Noviembre");
|
||||
months.add("Diciembre");
|
||||
|
||||
monthCombo = new JComboBox<>();
|
||||
for (String month : months) {
|
||||
monthCombo.addItem(month);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
163
src/danielcortes/xyz/views/InformesView.form
Normal file
163
src/danielcortes/xyz/views/InformesView.form
Normal file
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.InformesView">
|
||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="338" height="356"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="ae41b" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="4644d" class="javax.swing.JButton" binding="informeMensualButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Informe Mensual"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d816d" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="40e03" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1d9b7" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a7d8e" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="7ae6d" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="7ca78" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="bb19b" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e0d48" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2c2fd" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fbc02" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="a924" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="36bcc" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d7a56" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6b6f7" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d0642" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6cbbe" class="javax.swing.JButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
124
src/danielcortes/xyz/views/InformesView.java
Normal file
124
src/danielcortes/xyz/views/InformesView.java
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018-2019 Daniel Cortes
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package danielcortes.xyz.views;
|
||||
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class InformesView {
|
||||
private JButton informeMensualButton;
|
||||
private JPanel contentPanel;
|
||||
|
||||
public JPanel getContentPanel() {
|
||||
return contentPanel;
|
||||
}
|
||||
|
||||
public JButton getInformeMensualButton() {
|
||||
return informeMensualButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method generated by IntelliJ IDEA GUI Designer
|
||||
* >>> IMPORTANT!! <<<
|
||||
* DO NOT edit this method OR call it in your code!
|
||||
*
|
||||
* @noinspection ALL
|
||||
*/
|
||||
private void $$$setupUI$$$() {
|
||||
contentPanel = new JPanel();
|
||||
contentPanel.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
informeMensualButton = new JButton();
|
||||
informeMensualButton.setText("Informe Mensual");
|
||||
panel1.add(informeMensualButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button1 = new JButton();
|
||||
button1.setText("Button");
|
||||
panel1.add(button1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button2 = new JButton();
|
||||
button2.setText("Button");
|
||||
panel1.add(button2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button3 = new JButton();
|
||||
button3.setText("Button");
|
||||
panel1.add(button3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button4 = new JButton();
|
||||
button4.setText("Button");
|
||||
panel1.add(button4, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPanel.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
final JButton button5 = new JButton();
|
||||
button5.setText("Button");
|
||||
panel2.add(button5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button6 = new JButton();
|
||||
button6.setText("Button");
|
||||
panel2.add(button6, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button7 = new JButton();
|
||||
button7.setText("Button");
|
||||
panel2.add(button7, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button8 = new JButton();
|
||||
button8.setText("Button");
|
||||
panel2.add(button8, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button9 = new JButton();
|
||||
button9.setText("Button");
|
||||
panel2.add(button9, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JPanel panel3 = new JPanel();
|
||||
panel3.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPanel.add(panel3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
final JButton button10 = new JButton();
|
||||
button10.setText("Button");
|
||||
panel3.add(button10, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button11 = new JButton();
|
||||
button11.setText("Button");
|
||||
panel3.add(button11, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button12 = new JButton();
|
||||
button12.setText("Button");
|
||||
panel3.add(button12, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button13 = new JButton();
|
||||
button13.setText("Button");
|
||||
panel3.add(button13, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JButton button14 = new JButton();
|
||||
button14.setText("Button");
|
||||
panel3.add(button14, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPanel;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="561" height="307"/>
|
||||
<xy x="20" y="20" width="628" height="307"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="b2933" binding="controlsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="b2933" binding="controlsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
|
||||
@@ -65,6 +65,16 @@
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="91b71" class="javax.swing.JToggleButton" binding="informesButton">
|
||||
<constraints>
|
||||
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="200" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Informes"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
|
||||
@@ -40,6 +40,7 @@ public class ManagerView {
|
||||
private JPanel controlsPanel;
|
||||
private JToggleButton arqueoButton;
|
||||
private DatePicker datePicker;
|
||||
private JToggleButton informesButton;
|
||||
|
||||
public JToggleButton getEgresosButton() {
|
||||
return egresosButton;
|
||||
@@ -53,6 +54,10 @@ public class ManagerView {
|
||||
return arqueoButton;
|
||||
}
|
||||
|
||||
public JToggleButton getInformesButton() {
|
||||
return informesButton;
|
||||
}
|
||||
|
||||
public DatePicker getDatePicker() {
|
||||
return datePicker;
|
||||
}
|
||||
@@ -86,7 +91,7 @@ public class ManagerView {
|
||||
cardPanel.setLayout(new CardLayout(0, 0));
|
||||
contentPanel.add(cardPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
controlsPanel = new JPanel();
|
||||
controlsPanel.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1));
|
||||
controlsPanel.setLayout(new GridLayoutManager(1, 6, new Insets(0, 0, 0, 0), -1, -1));
|
||||
contentPanel.add(controlsPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
|
||||
egresosButton = new JToggleButton();
|
||||
egresosButton.setText("Egresos");
|
||||
@@ -107,6 +112,9 @@ public class ManagerView {
|
||||
controlsPanel.add(datePicker, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||
final Spacer spacer1 = new Spacer();
|
||||
controlsPanel.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
|
||||
informesButton = new JToggleButton();
|
||||
informesButton.setText("Informes");
|
||||
controlsPanel.add(informesButton, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false));
|
||||
ButtonGroup buttonGroup;
|
||||
buttonGroup = new ButtonGroup();
|
||||
buttonGroup.add(egresosButton);
|
||||
|
||||
91
src/danielcortes/xyz/views/components/YearSpinnerModel.java
Normal file
91
src/danielcortes/xyz/views/components/YearSpinnerModel.java
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018-2019 Daniel Cortes
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package danielcortes.xyz.views.components;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.time.Year;
|
||||
|
||||
public class YearSpinnerModel extends AbstractSpinnerModel {
|
||||
private int value;
|
||||
private String showingValue;
|
||||
|
||||
public YearSpinnerModel() {
|
||||
this.value = Year.now().getValue();
|
||||
this.showingValue = String.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.showingValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
this.showingValue = String.valueOf(value);
|
||||
this.value = Integer.parseInt(this.showingValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNextValue() {
|
||||
if (this.value == 9999) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.value > 9999) {
|
||||
this.value = 9999;
|
||||
this.showingValue = String.valueOf(this.value);
|
||||
} else if (this.value < 0) {
|
||||
this.value = 0;
|
||||
this.showingValue = String.valueOf(this.value);
|
||||
} else {
|
||||
this.value++;
|
||||
this.showingValue = String.valueOf(value);
|
||||
}
|
||||
|
||||
this.fireStateChanged();
|
||||
return this.showingValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPreviousValue() {
|
||||
if (this.value == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.value > 9999) {
|
||||
this.value = 9999;
|
||||
this.showingValue = String.valueOf(this.value);
|
||||
} else if (this.value < 0) {
|
||||
this.value = 0;
|
||||
this.showingValue = String.valueOf(this.value);
|
||||
} else {
|
||||
this.value--;
|
||||
this.showingValue = String.valueOf(value);
|
||||
}
|
||||
|
||||
this.fireStateChanged();
|
||||
return this.showingValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user