This commit is contained in:
Guillermo Roche 2020-02-10 19:55:48 +01:00
commit ed6c182e56
60 changed files with 1005 additions and 17 deletions

View File

@ -2,10 +2,22 @@
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="jfreechart-1.5.0-javadoc.jar"/>
<classpathentry kind="lib" path="jfreechart-1.5.0.jar"/>
<classpathentry kind="lib" path="LGoodDatePicker-10.4.1-javadoc.jar"/> <classpathentry kind="lib" path="LGoodDatePicker-10.4.1-javadoc.jar"/>
<classpathentry kind="lib" path="LGoodDatePicker-10.4.1.jar"/> <classpathentry kind="lib" path="LGoodDatePicker-10.4.1.jar"/>
<classpathentry kind="lib" path="Loggin.jar"/> <classpathentry kind="lib" path="Loggin.jar"/>
<classpathentry kind="lib" path="lib/com.lowagie.text-2.1.7.jar"/>
<classpathentry kind="lib" path="lib/commons-beanutils-1.8.3.jar"/>
<classpathentry kind="lib" path="lib/commons-digester-2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-javaflow.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="lib/commons.collections-3.2.1.jar"/>
<classpathentry kind="lib" path="lib/jasperreports-6.6.0.jar"/>
<classpathentry kind="lib" path="lib/jasperreports-fonts-6.6.0.jar"/>
<classpathentry kind="lib" path="lib/jasperreports-functions-6.11.0.jar"/>
<classpathentry kind="lib" path="lib/jcommon-1.0.23.jar"/>
<classpathentry kind="lib" path="lib/joda-time-2.10.5.jar"/>
<classpathentry kind="lib" path="lib/livingdoc-confluence5-plugin-1.1.2.jar"/>
<classpathentry kind="lib" path="lib/mariadb-java-client-2.5.3-javadoc.jar"/>
<classpathentry kind="lib" path="lib/mariadb-java-client-2.5.3.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -1,4 +1,4 @@
#Configuracion general #Configuracion general
#Tue Nov 26 22:32:47 CET 2019 #Thu Jan 30 13:09:04 CET 2020
tema=2 tema=0
ruta=.mes ruta=.mes

BIN
.mes

Binary file not shown.

BIN
Cherry.jasper Normal file

Binary file not shown.

209
Cherry.jrxml Normal file
View File

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Cherry" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="13acf49e-4913-4d1b-bccc-113817ad15d1">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapter.xml"/>
<style name="Title" forecolor="#FFFFFF" fontName="Times New Roman" fontSize="50" isBold="false"/>
<style name="SubTitle" forecolor="#CCCCCC" fontName="Times New Roman" fontSize="18" isBold="false"/>
<style name="Column header" forecolor="#666666" fontName="Times New Roman" fontSize="14" isBold="true"/>
<style name="Detail" mode="Transparent" fontName="Times New Roman"/>
<style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style mode="Opaque" backcolor="#F0EFEF"/>
</conditionalStyle>
</style>
<parameter name="Year" class="java.lang.String">
<defaultValueExpression><![CDATA[new String("")]]></defaultValueExpression>
</parameter>
<parameter name="Order" class="java.lang.String">
<defaultValueExpression><![CDATA[new String("")]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[select transacciones.descripcion, gestiones.descripcion, usuarios.usuario, transacciones.precio, transacciones.fecha
from transacciones
join gestiones on transacciones.idGestion = gestiones.id
join usuarios on usuarios.id = gestiones.idUsuario
where year(transacciones.fecha)=$P{Year}
order by $P!{Order}]]>
</queryString>
<field name="descripcion" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="descripcion"/>
<property name="com.jaspersoft.studio.field.tree.path" value="transacciones"/>
</field>
<field name="usuario" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="usuario"/>
<property name="com.jaspersoft.studio.field.tree.path" value="usuarios"/>
</field>
<field name="precio" class="java.lang.Float">
<property name="com.jaspersoft.studio.field.label" value="precio"/>
<property name="com.jaspersoft.studio.field.tree.path" value="transacciones"/>
</field>
<field name="fecha" class="java.sql.Date">
<property name="com.jaspersoft.studio.field.label" value="fecha"/>
<property name="com.jaspersoft.studio.field.tree.path" value="transacciones"/>
</field>
<variable name="Variable_1" class="java.lang.String">
<variableExpression><![CDATA[CONCATENATE(TEXT(SUM($V{COLUMN_COUNT},1),""),".",$F{usuario})]]></variableExpression>
</variable>
<group name="Group1">
<groupExpression><![CDATA[$F{usuario}]]></groupExpression>
<groupHeader>
<band height="37">
<frame>
<reportElement mode="Opaque" x="0" y="7" width="555" height="24" forecolor="#B89F7D" backcolor="#000000" uuid="0a5fc4ac-2e39-4b7a-8f96-59f8eb2df66d"/>
<textField textAdjust="StretchHeight">
<reportElement style="SubTitle" isPrintRepeatedValues="false" x="2" y="0" width="479" height="24" forecolor="#FFFFFF" uuid="4fbebfd3-a184-45af-b7d9-5c3faaf087b5"/>
<textElement>
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[CONCATENATE(TEXT(SUM($V{COLUMN_COUNT},1),""),".",$F{usuario})]]></textFieldExpression>
</textField>
</frame>
</band>
</groupHeader>
<groupFooter>
<band height="6"/>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="132" splitType="Stretch">
<image>
<reportElement x="456" y="0" width="99" height="132" uuid="97705585-a0b5-4ec7-86f3-ae10c220e6af"/>
<imageExpression><![CDATA["invoice_logo.png"]]></imageExpression>
</image>
<frame>
<reportElement mode="Opaque" x="0" y="0" width="451" height="95" backcolor="#000000" uuid="6c6ca4e1-17cd-4913-93d6-5e670ea9ae8a"/>
<staticText>
<reportElement style="Title" x="0" y="0" width="370" height="66" uuid="a2a2cac8-5a7d-4487-8c54-dab235ce4e21"/>
<textElement>
<font size="40" isBold="false"/>
</textElement>
<text><![CDATA[Datos de los usuarios]]></text>
</staticText>
</frame>
<frame>
<reportElement mode="Opaque" x="0" y="100" width="451" height="32" forecolor="#000000" backcolor="#003366" uuid="e3c14156-5b51-4201-918b-97fdc012e5d4"/>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="307" y="12" width="144" height="20" forecolor="#FFFFFF" uuid="5c3301e7-a737-4c59-8a2f-a6c79fd1adb8"/>
<textElement textAlignment="Right">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="26" splitType="Stretch">
<staticText>
<reportElement style="Column header" x="0" y="7" width="185" height="18" forecolor="#000000" uuid="0a14b49a-1924-402b-8ef5-1b6a4602232e">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="04480cd9-c6b5-4c12-afd8-8519fe0dd49e"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<text><![CDATA[descripcion]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="185" y="7" width="185" height="18" forecolor="#000000" uuid="957b7838-46a3-4a90-b692-761135201b07">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="4ca07f53-30ea-477b-b7b4-84c03072358b"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<text><![CDATA[precio]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="370" y="7" width="185" height="18" forecolor="#000000" uuid="287945e4-8609-4d3e-bd62-4f794281d8c5">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bf52e93f-dd0d-46d0-8b2c-612076262bb1"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<text><![CDATA[fecha]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="18" splitType="Stretch">
<frame>
<reportElement style="Row" mode="Opaque" x="0" y="0" width="555" height="18" uuid="b50221b5-8254-440b-8c6f-1f0b138c9259"/>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" positionType="Float" x="0" y="0" width="185" height="18" uuid="3a3c3563-4cea-46de-b00b-a468eb4fb11c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="04480cd9-c6b5-4c12-afd8-8519fe0dd49e"/>
</reportElement>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{descripcion}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" positionType="Float" x="185" y="0" width="185" height="18" uuid="bac435e7-f53e-4850-9743-c329334afa6e">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="4ca07f53-30ea-477b-b7b4-84c03072358b"/>
</reportElement>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{precio}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" positionType="Float" x="370" y="0" width="185" height="18" uuid="76ae6bde-8b83-4f03-aa68-133b0aa8afd1">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bf52e93f-dd0d-46d0-8b2c-612076262bb1"/>
</reportElement>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{fecha}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<columnFooter>
<band height="7" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1" uuid="1133a906-5b71-476e-9f3e-bc97c97058c1"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
</band>
</columnFooter>
<pageFooter>
<band height="25" splitType="Stretch">
<frame>
<reportElement mode="Opaque" x="0" y="1" width="555" height="24" forecolor="#D0B48E" backcolor="#000000" uuid="729c3539-f946-4d0e-a0a7-bda2815ea1b0"/>
<textField evaluationTime="Report">
<reportElement style="Column header" x="513" y="0" width="40" height="20" forecolor="#FFFFFF" uuid="4834e99c-7f6c-485a-b098-50e5187f2ab4"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Column header" x="433" y="0" width="80" height="20" forecolor="#FFFFFF" uuid="9825b46e-76f1-469a-abb8-a1cc27aad685"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement style="Column header" x="2" y="1" width="197" height="20" forecolor="#FFFFFF" uuid="137d38c7-1a83-4fc5-b156-9d5f1b1a0ddc"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>

23
ConsultasInformes.sql Normal file
View File

@ -0,0 +1,23 @@
select count(transacciones.id), sum(transacciones.precio)
from transacciones
join gestiones on gestiones.id = transacciones.idGestion
where gestiones.idUsuario = 1;
select gestiones.descripcion, month(transacciones.fecha), sum(precio), gestiones.idUsuario
from transacciones
join gestiones on transacciones.idGestion = gestiones.id
where gestiones.idUsuario = 1
group by idGestion, month(fecha);
select transacciones.descripcion, gestiones.descripcion, usuarios.usuario, transacciones.precio, transacciones.fecha
from transacciones
join gestiones on transacciones.idGestion = gestiones.id
join usuarios on usuarios.id = gestiones.idUsuario
where year(transacciones.fecha)="2019"
order by usuario;
select usuarios.id, usuarios.usuario
from usuarios;
select distinct year(transacciones.fecha)
from transacciones;

2
DataAdapter.xml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jdbcDataAdapter class="net.sf.jasperreports.data.jdbc.JdbcDataAdapterImpl"><name>ew Data Adapter 1</name><driver>org.mariadb.jdbc.Driver</driver><username>root</username><password>1234</password><savePassword>true</savePassword><url>jdbc:mariadb://localhost:3306/informes</url><database></database><serverAddress></serverAddress></jdbcDataAdapter>

BIN
Grafico.jasper Normal file

Binary file not shown.

67
Grafico.jrxml Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Grafico" printOrder="Horizontal" pageWidth="300" pageHeight="200" orientation="Landscape" columnWidth="260" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1fcb641f-d3aa-42ae-908f-abf28f5dceda">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapter.xml"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<parameter name="ID_Usuario" class="java.lang.Integer">
<defaultValueExpression><![CDATA[new Integer(1)]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[select gestiones.descripcion, month(fecha), sum(precio)
from transacciones
join gestiones on transacciones.idGestion = gestiones.id
where gestiones.idUsuario = $P{ID_Usuario}
group by idGestion, month(fecha), gestiones.idUsuario]]>
</queryString>
<field name="descripcion" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="descripcion"/>
<property name="com.jaspersoft.studio.field.tree.path" value="gestiones"/>
</field>
<field name="month(fecha)" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.label" value="month(fecha)"/>
</field>
<field name="sum(precio)" class="java.lang.Double">
<property name="com.jaspersoft.studio.field.label" value="sum(precio)"/>
</field>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="140">
<areaChart>
<chart evaluationTime="Report">
<reportElement x="-10" y="10" width="260" height="130" uuid="983e1be7-88fd-4dc1-b8bd-9559f97fece0"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Report"/>
<categorySeries>
<seriesExpression><![CDATA[$F{descripcion}]]></seriesExpression>
<categoryExpression><![CDATA[$F{month(fecha)}]]></categoryExpression>
<valueExpression><![CDATA[$F{sum(precio)}]]></valueExpression>
</categorySeries>
</categoryDataset>
<areaPlot>
<plot/>
<categoryAxisFormat>
<axisFormat/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat/>
</valueAxisFormat>
</areaPlot>
</areaChart>
</band>
</summary>
</jasperReport>

BIN
Graficos_gastos.jasper Normal file

Binary file not shown.

169
Graficos_gastos.jrxml Normal file
View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Graficos_gastos" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4eedbb89-b4f6-4469-9ab6-f642a1688cf7">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapter.xml"/>
<style name="Title" forecolor="#FFFFFF" fontName="Times New Roman" fontSize="50" isBold="false" pdfFontName="Times-Bold"/>
<style name="SubTitle" forecolor="#CCCCCC" fontName="Times New Roman" fontSize="18" isBold="false" pdfFontName="Times-Roman"/>
<style name="Column header" forecolor="#666666" fontName="Times New Roman" fontSize="14" isBold="true"/>
<style name="Detail" mode="Transparent" fontName="Times New Roman"/>
<style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style mode="Opaque" backcolor="#EEEFF0"/>
</conditionalStyle>
</style>
<style name="Table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#CACED0">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#D8D8D8"/>
</conditionalStyle>
</style>
<subDataset name="tableDataset" uuid="f13e6d36-5148-4ecc-bbe3-3035def80980">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<parameter name="Order" class="java.lang.String">
<defaultValueExpression><![CDATA[new String("")]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[select usuarios.id, usuarios.usuario
from usuarios
order by $P!{Order}]]>
</queryString>
<field name="id" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.label" value="id"/>
<property name="com.jaspersoft.studio.field.tree.path" value="usuarios"/>
</field>
<field name="usuario" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="usuario"/>
<property name="com.jaspersoft.studio.field.tree.path" value="usuarios"/>
</field>
<variable name="Variable_1" class="java.lang.String">
<variableExpression><![CDATA[CONCATENATE(TEXT($V{COLUMN_COUNT},""),".",$F{usuario})]]></variableExpression>
</variable>
<title>
<band height="96" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<line>
<reportElement x="0" y="80" width="556" height="1" uuid="806ce5df-1219-4876-ae0c-ca7405b1f246">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<staticText>
<reportElement x="415" y="10" width="50" height="20" uuid="0f86baff-6386-4f3f-b3fe-2388707babe8"/>
<box rightPadding="4"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Date:]]></text>
</staticText>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="465" y="10" width="84" height="20" uuid="bb10dbe1-0a4f-4722-9953-c163b63cf979"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<image hAlign="Center">
<reportElement x="0" y="0" width="65" height="60" uuid="94883631-a913-43e2-b182-ab8d77d0181e"/>
<imageExpression><![CDATA["invoice_logo.png"]]></imageExpression>
</image>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="465" y="30" width="84" height="20" uuid="3836ce65-eca3-4cad-a6de-b1818def0a2b"/>
<textFieldExpression><![CDATA["INV0001"]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="415" y="30" width="50" height="20" uuid="0b3f9342-da78-4cfa-9fc5-2301c4749678"/>
<box rightPadding="4"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Invoice #]]></text>
</staticText>
<staticText>
<reportElement x="95" y="0" width="315" height="25" uuid="e622555d-198b-4ccd-a4a1-c59c53304058">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="19" isBold="true"/>
</textElement>
<text><![CDATA[Grafico de gastos de cada usuario]]></text>
</staticText>
</band>
</title>
<detail>
<band height="185">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" positionType="Float" x="0" y="0" width="339" height="20" uuid="00b15f08-8d05-4c88-acfc-e6d2822f6f20">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="014c73cd-a412-44c6-b3a8-d2abf2bfb4da"/>
</reportElement>
<textElement>
<font fontName="Arial" size="15" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{Variable_1}]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="10" y="20" width="535" height="160" uuid="51188cef-4f1f-4b2b-83c6-88e0a9fbfb2b"/>
<subreportParameter name="ID_Usuario">
<subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["Grafico.jasper"]]></subreportExpression>
</subreport>
<line>
<reportElement x="10" y="180" width="556" height="1" uuid="fa212de6-0534-4ad4-81d1-cd5c3fb63c99">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
</band>
</detail>
<lastPageFooter>
<band height="80">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="25" width="556" height="30" backcolor="#E6E8E9" uuid="36aa233d-4305-48e6-974a-1bbf89bb3c8f"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Serif" size="9" isItalic="true"/>
</textElement>
<text><![CDATA[Fin de los usuarios]]></text>
</staticText>
<textField>
<reportElement x="521" y="67" width="35" height="13" uuid="7e1dfabf-9edf-453c-8b85-58c6682b2a6f"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>
</jasperReport>

BIN
Informe1.pdf Normal file

Binary file not shown.

BIN
Invoice.jasper Normal file

Binary file not shown.

198
Invoice.jrxml Normal file
View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Invoice" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4eedbb89-b4f6-4469-9ab6-f642a1688cf7">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapter.xml"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<style name="Title" forecolor="#FFFFFF" fontName="Times New Roman" fontSize="50" isBold="false" pdfFontName="Times-Bold"/>
<style name="SubTitle" forecolor="#CCCCCC" fontName="Times New Roman" fontSize="18" isBold="false" pdfFontName="Times-Roman"/>
<style name="Column header" forecolor="#666666" fontName="Times New Roman" fontSize="14" isBold="true"/>
<style name="Detail" mode="Transparent" fontName="Times New Roman"/>
<style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style mode="Opaque" backcolor="#EEEFF0"/>
</conditionalStyle>
</style>
<style name="Table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#CACED0">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#D8D8D8"/>
</conditionalStyle>
</style>
<subDataset name="tableDataset" uuid="f13e6d36-5148-4ecc-bbe3-3035def80980">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<queryString language="SQL">
<![CDATA[select gestiones.descripcion, sum(transacciones.precio)
from gestiones
join transacciones on transacciones.idGestion = gestiones.id
group by gestiones.id, gestiones.descripcion]]>
</queryString>
<field name="descripcion" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="descripcion"/>
<property name="com.jaspersoft.studio.field.tree.path" value="gestiones"/>
</field>
<field name="sum(transacciones.precio)" class="java.lang.Double">
<property name="com.jaspersoft.studio.field.label" value="sum(transacciones.precio)"/>
</field>
<title>
<band height="82" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<line>
<reportElement x="0" y="80" width="556" height="1" uuid="806ce5df-1219-4876-ae0c-ca7405b1f246">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<staticText>
<reportElement x="415" y="10" width="50" height="20" uuid="0f86baff-6386-4f3f-b3fe-2388707babe8"/>
<box rightPadding="4"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Date:]]></text>
</staticText>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="465" y="10" width="84" height="20" uuid="bb10dbe1-0a4f-4722-9953-c163b63cf979"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<image hAlign="Center">
<reportElement x="0" y="0" width="65" height="60" uuid="94883631-a913-43e2-b182-ab8d77d0181e"/>
<imageExpression><![CDATA["invoice_logo.png"]]></imageExpression>
</image>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="465" y="30" width="84" height="20" uuid="3836ce65-eca3-4cad-a6de-b1818def0a2b"/>
<textFieldExpression><![CDATA["INV0001"]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="415" y="30" width="50" height="20" uuid="0b3f9342-da78-4cfa-9fc5-2301c4749678"/>
<box rightPadding="4"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Invoice #]]></text>
</staticText>
<staticText>
<reportElement x="95" y="0" width="210" height="25" uuid="e622555d-198b-4ccd-a4a1-c59c53304058">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font size="19" isBold="true"/>
</textElement>
<text><![CDATA[Your company name]]></text>
</staticText>
<staticText>
<reportElement x="95" y="55" width="205" height="15" uuid="b8cc42fd-b569-497d-834d-7e854040ad18"/>
<text><![CDATA[900800700]]></text>
</staticText>
<staticText>
<reportElement x="95" y="25" width="205" height="15" uuid="c226e44d-3bb5-4145-b0b3-903bf1d79fde"/>
<text><![CDATA[Calle inventada 17]]></text>
</staticText>
<staticText>
<reportElement x="95" y="40" width="205" height="15" uuid="b96f7183-44f8-43ad-ba60-43d8fbf50b6e"/>
<text><![CDATA[Madrid]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="20">
<staticText>
<reportElement style="Column header" positionType="Float" x="0" y="0" width="277" height="20" forecolor="#000000" uuid="57dffb8d-3b93-4b5f-97cf-28fa1dc03bf9">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="fb053cc8-e14e-4244-b7c4-c5e5201bd034"/>
</reportElement>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[descripcion]]></text>
</staticText>
<staticText>
<reportElement style="Column header" positionType="Float" x="277" y="0" width="277" height="20" forecolor="#000000" uuid="a4b427b3-f106-4cb8-a175-7574edf518be">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="99e14397-834b-4a0f-ad03-571054b699b6"/>
</reportElement>
<textElement>
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[suma transacciones]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="35">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Table_TD" positionType="Float" x="0" y="0" width="277" height="20" uuid="0a730749-b3ce-498c-861a-52e89eb08101">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="fb053cc8-e14e-4244-b7c4-c5e5201bd034"/>
</reportElement>
<textElement>
<font fontName="Arial" size="12" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{descripcion}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" positionType="Float" x="290" y="0" width="264" height="20" uuid="ae73ffab-73f4-4b35-b41f-ef90146f0469">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="99e14397-834b-4a0f-ad03-571054b699b6"/>
</reportElement>
<textElement>
<font fontName="Arial" size="12" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{sum(transacciones.precio)}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="45">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement positionType="Float" mode="Opaque" x="-10" y="0" width="556" height="30" backcolor="#E6E8E9" uuid="36aa233d-4305-48e6-974a-1bbf89bb3c8f"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Serif" size="9" isItalic="true"/>
</textElement>
<text><![CDATA[THANKYOU FOR YOUR BUSINESS]]></text>
</staticText>
</band>
</lastPageFooter>
</jasperReport>

2
bin/.gitignore vendored
View File

@ -1,2 +0,0 @@
/VistaControlador/
/Logica/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
cherry.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

55
crearDB.sql Normal file
View File

@ -0,0 +1,55 @@
drop database informes;
create database if not exists informes;
use informes;
create table if not exists usuarios(
id int not null auto_increment,
usuario varchar(30) not null,
primary key(id, usuario),
pass varchar(30) not null);
insert into usuarios(usuario, pass) values
("pepe", "pass"),
("juan", "1234"),
("roberto", "asdgg");
create table if not exists gestiones(
id int not null primary key auto_increment,
descripcion varchar(30),
idUsuario int not null,
foreign key (idUsuario) references usuarios(id)
);
insert into gestiones(descripcion, idUsuario)values
("vicio", 1),
("comida", 1),
("escuela", 1),
("colegio", 2),
("super", 2),
("pc", 2),
("cosa1", 3),
("cosa2", 3),
("cosa3", 3);
create table if not exists transacciones(
id int not null primary key auto_increment,
precio float,
descripcion varchar(30),
fecha date,
idGestion int not null,
foreign key (idGestion) references gestiones(id)
);
insert into transacciones(precio, descripcion, fecha, idGestion) values
(9, "juego1", '19-01-01',1),
(3, "jego2", '19-02-01',1),
(6, "cosas ilegales", '19-03-03', 1),
(8, "objeto prueba", '19-04-01', 2),
(9, "objeto peuba2", '19-02-02', 2),
(7, "otro objeto", '19-04-03', 3),
(8, "juego1", '19-01-01',4),
(4, "jego2", '19-02-02',4),
(5, "cosas ilegales", '19-03-03', 4),
(9, "objeto prueba", '19-01-01', 5),
(10, "objeto peuba2", '19-02-02', 5),
(2, "otro objeto", '19-03-03', 6);

BIN
invoice_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
leaf_banner_red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/commons-javaflow.jar Normal file

Binary file not shown.

BIN
lib/commons-logging-1.1.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/jasperreports-6.6.0.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/jcommon-1.0.23.jar Normal file

Binary file not shown.

BIN
lib/joda-time-2.10.5.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -22,6 +22,7 @@ public class BarraOpciones extends JMenuBar{
JMenuItem gestion; JMenuItem gestion;
JMenuItem modificacion; JMenuItem modificacion;
JMenuItem menuInterfaz; JMenuItem menuInterfaz;
JMenuItem menuInforme;
JMenu administracion; JMenu administracion;
JMenuItem aniadirUsuario; JMenuItem aniadirUsuario;
@ -30,16 +31,22 @@ public class BarraOpciones extends JMenuBar{
*/ */
public BarraOpciones() { public BarraOpciones() {
this.menuAr = new JMenu("Archivo"); this.menuAr = new JMenu("Archivo");
this.menuAr.setToolTipText("exportar o importar los datos");
this.add(this.menuAr); this.add(this.menuAr);
this.guardarIns = new JMenuItem("Guardar instantanea"); this.guardarIns = new JMenuItem("Guardar instantanea");
this.guardarIns.setToolTipText("Guarda en un fcchero el estado actual del programa");
this.menuAr.add(this.guardarIns); this.menuAr.add(this.guardarIns);
this.cambiarRuta = new JMenuItem("Cambiar ruta de guardado"); this.cambiarRuta = new JMenuItem("Cambiar ruta de guardado");
this.cambiarRuta.setToolTipText("Configura donde se guardan los datos de tu programa");
this.menuAr.add(this.cambiarRuta); this.menuAr.add(this.cambiarRuta);
this.exportarXML = new JMenuItem("Exportar en un XML"); this.exportarXML = new JMenuItem("Exportar en un XML");
this.exportarXML.setToolTipText("Exporta los datos en formato xml");
this.menuAr.add(this.exportarXML); this.menuAr.add(this.exportarXML);
this.importarXML = new JMenuItem("Importar en un XML"); this.importarXML = new JMenuItem("Importar en un XML");
this.importarXML.setToolTipText("Importa los datos en formato xml");
this.menuAr.add(this.importarXML); this.menuAr.add(this.importarXML);
this.interfaz = new JMenu("Interfaz"); this.interfaz = new JMenu("Interfaz");
this.interfaz.setToolTipText("elige tu tema preferido");
this.add(this.interfaz); this.add(this.interfaz);
this.modoClaro = new JMenuItem("Modo claro"); this.modoClaro = new JMenuItem("Modo claro");
this.interfaz.add(this.modoClaro); this.interfaz.add(this.modoClaro);
@ -52,16 +59,25 @@ public class BarraOpciones extends JMenuBar{
this.mostrar.add(this.mostrarTodo); this.mostrar.add(this.mostrarTodo);
this.add(this.mostrar); this.add(this.mostrar);
this.vistas = new JMenu("Vista"); this.vistas = new JMenu("Vista");
this.vistas.setToolTipText("Elige la vista en la que quieres trabajar");
this.add(this.vistas); this.add(this.vistas);
this.gestion = new JMenuItem("Gestion"); this.gestion = new JMenuItem("Gestion");
this.gestion.setToolTipText("Aniade gestiones y estudia sus datos");
this.vistas.add(this.gestion); this.vistas.add(this.gestion);
this.modificacion = new JMenuItem("Modificacion"); this.modificacion = new JMenuItem("Modificacion");
this.modificacion.setToolTipText("Modifica los datos aniadidos");
this.vistas.add(this.modificacion); this.vistas.add(this.modificacion);
this.menuInterfaz = new JMenuItem("Gestion tema"); this.menuInterfaz = new JMenuItem("Gestion tema");
this.menuInterfaz.setToolTipText("Modifica de forma especifica cada elemento de la interfaz");
this.vistas.add(this.menuInterfaz); this.vistas.add(this.menuInterfaz);
this.menuInforme = new JMenuItem("Crear Informes");
this.menuInforme.setToolTipText("Genera informes para ver los datos de cada usuario de forma simple");
this.vistas.add(this.menuInforme);
this.administracion = new JMenu("Administracion"); this.administracion = new JMenu("Administracion");
this.administracion.setToolTipText("gestion de usuarios");
this.add(this.administracion); this.add(this.administracion);
this.aniadirUsuario = new JMenuItem("Aniadir usuario"); this.aniadirUsuario = new JMenuItem("Aniadir usuario");
this.aniadirUsuario.setToolTipText("crea un usuario con su contrasenia de forma segura");
this.administracion.add(this.aniadirUsuario); this.administracion.add(this.aniadirUsuario);
} }
} }

View File

@ -94,6 +94,10 @@ public class ControladorBarra implements ActionListener{
this.menu.cambiarVista(this.menu.VISTA_INTERFAZ); this.menu.cambiarVista(this.menu.VISTA_INTERFAZ);
break; break;
} }
case "Informes":{
this.menu.cambiarVista(this.menu.VISTA_INFORMES);
break;
}
case "Aniadir usuario":{ case "Aniadir usuario":{
Vista loggin = new Vista(Vista.Guardar); Vista loggin = new Vista(Vista.Guardar);
break; break;
@ -129,6 +133,8 @@ public class ControladorBarra implements ActionListener{
this.barra.modificacion.setActionCommand("Cambiar Modificar"); this.barra.modificacion.setActionCommand("Cambiar Modificar");
this.barra.menuInterfaz.addActionListener(this); this.barra.menuInterfaz.addActionListener(this);
this.barra.menuInterfaz.setActionCommand("Ajustar tema"); this.barra.menuInterfaz.setActionCommand("Ajustar tema");
this.barra.menuInforme.addActionListener(this);
this.barra.menuInforme.setActionCommand("Informes");
this.barra.aniadirUsuario.addActionListener(this); this.barra.aniadirUsuario.addActionListener(this);
this.barra.aniadirUsuario.setActionCommand("Aniadir usuario"); this.barra.aniadirUsuario.setActionCommand("Aniadir usuario");
} }

View File

@ -0,0 +1,115 @@
package VistaControlador;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.export.SimpleExporterInput;
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
import net.sf.jasperreports.export.SimplePdfExporterConfiguration;
import net.sf.jasperreports.view.JasperViewer;
public class ControladorInforme implements ActionListener{
VistaInformes vista;
ModeloInformes modelo;
public ControladorInforme(VistaInformes vista, ModeloInformes modelo) {
this.vista = vista;
this.modelo = modelo;
for(String anios:this.modelo.anios()) {
this.vista.opciones1_2.addItem(anios);
}
this.iniciarControlador();
}
private void iniciarControlador() {
this.vista.exportarInforme1.addActionListener(this);
this.vista.exportarInforme1.setActionCommand("exportar informe 1");
this.vista.mostrarInforme1.addActionListener(this);
this.vista.mostrarInforme1.setActionCommand("mostrar informe 1");
this.vista.exportarInforme2.addActionListener(this);
this.vista.exportarInforme2.setActionCommand("exportar informe 2");
this.vista.mostrarInforme2.addActionListener(this);
this.vista.mostrarInforme2.setActionCommand("mostrar informe 2");
}
@Override
public void actionPerformed(ActionEvent ev) {
switch(ev.getActionCommand()) {
case "mostrar informe 1":{
JasperPrint jasperPrint=null;
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("Order", this.vista.opciones1_1.getSelectedItem());
params.put("Year", this.vista.opciones1_2.getSelectedItem());
jasperPrint=JasperFillManager.fillReport("Cherry.jasper",params,modelo.controlador);
JasperViewer jasperViewver=new JasperViewer(jasperPrint,false);
jasperViewver.setVisible(true);
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
}
case "exportar informe 1":{
JasperPrint jasperPrint=null;
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("Order", this.vista.opciones1_1.getSelectedItem());
params.put("Year", this.vista.opciones1_2.getSelectedItem());
jasperPrint=JasperFillManager.fillReport("Cherry.jasper",params,modelo.controlador);
JRPdfExporter exp=new JRPdfExporter();
exp.setExporterInput(new SimpleExporterInput(jasperPrint));
exp.setExporterOutput(new SimpleOutputStreamExporterOutput("Informe1.pdf"));
SimplePdfExporterConfiguration conf=new SimplePdfExporterConfiguration();
exp.setConfiguration(conf);
exp.exportReport();
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
}
case "mostrar informe 2":{
JasperPrint jasperPrint=null;
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("Order",this.vista.opciones2.getSelectedItem());
jasperPrint=JasperFillManager.fillReport("Graficos_gastos.jasper",params,modelo.controlador);
JasperViewer jasperViewver=new JasperViewer(jasperPrint,false);
jasperViewver.setVisible(true);
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
}
case "exportar informe 2":{
JasperPrint jasperPrint=null;
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("Order",this.vista.opciones2.getSelectedItem());
jasperPrint=JasperFillManager.fillReport("Graficos_gastos.jasper",params,modelo.controlador);
JRPdfExporter exp=new JRPdfExporter();
exp.setExporterInput(new SimpleExporterInput(jasperPrint));
exp.setExporterOutput(new SimpleOutputStreamExporterOutput("Informe2.pdf"));
SimplePdfExporterConfiguration conf=new SimplePdfExporterConfiguration();
exp.setConfiguration(conf);
exp.exportReport();
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
}
}
}
}

View File

@ -8,30 +8,21 @@ import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.Month; import java.time.Month;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.github.lgooddatepicker.components.DatePicker; import com.github.lgooddatepicker.components.DatePicker;
import com.github.lgooddatepicker.optionalusertools.DateChangeListener;
import Ficheros.Configuracion; import Ficheros.Configuracion;
import Logica.Gestion; import Logica.Gestion;
import Logica.Meses; import Logica.Meses;
import Logica.Transaccion;
import loggin.Vista; import loggin.Vista;
public class Menu extends JFrame{ public class Menu extends JFrame{
static final int VISTA_MODIFICAR = 0; static final int VISTA_MODIFICAR = 0;
static final int VISTA_GESTION = 1; static final int VISTA_GESTION = 1;
static final int VISTA_INTERFAZ = 2; static final int VISTA_INTERFAZ = 2;
static final int VISTA_INFORMES = 3;
JPanel panelCentral; JPanel panelCentral;
JTabbedPane pestania; JTabbedPane pestania;
@ -39,6 +30,7 @@ public class Menu extends JFrame{
VistaAniadirVisualizar gastos; VistaAniadirVisualizar gastos;
VistaPanelGestion panelGestion; VistaPanelGestion panelGestion;
VistaPanelModificar panelModificar; VistaPanelModificar panelModificar;
VistaInformes vista;
VistaPanel panel; VistaPanel panel;
String rutaGuardado; String rutaGuardado;
int tema; int tema;
@ -84,6 +76,7 @@ public class Menu extends JFrame{
this.panelGestion = new VistaPanelGestion(this.meses); this.panelGestion = new VistaPanelGestion(this.meses);
this.panelModificar = new VistaPanelModificar(); this.panelModificar = new VistaPanelModificar();
this.panelInterfaz = new VistaPanelInterfaz(); this.panelInterfaz = new VistaPanelInterfaz();
this.vista = new VistaInformes();
this.panel = this.panelGestion; this.panel = this.panelGestion;
constrain.fill = GridBagConstraints.HORIZONTAL; constrain.fill = GridBagConstraints.HORIZONTAL;
@ -107,6 +100,7 @@ public class Menu extends JFrame{
ControladorPanelGestion controlador3 = new ControladorPanelGestion(this.panelGestion, this); ControladorPanelGestion controlador3 = new ControladorPanelGestion(this.panelGestion, this);
ControladorPanelModificar controlador4 = new ControladorPanelModificar(this.panelModificar, this); ControladorPanelModificar controlador4 = new ControladorPanelModificar(this.panelModificar, this);
ControladorPanelInterfaz controlador5 = new ControladorPanelInterfaz(this.panelInterfaz, this); ControladorPanelInterfaz controlador5 = new ControladorPanelInterfaz(this.panelInterfaz, this);
ControladorInforme controlador6 = new ControladorInforme(this.vista, new ModeloInformes());
this.listenerPestania(); this.listenerPestania();
this.elegirMes = new DatePicker(); this.elegirMes = new DatePicker();
@ -379,6 +373,9 @@ public class Menu extends JFrame{
this.panel = this.panelInterfaz; this.panel = this.panelInterfaz;
break; break;
} }
case Menu.VISTA_INFORMES:{
this.panel = this.vista;
}
} }
this.panelCentral.add(this.panel,constrain); this.panelCentral.add(this.panel,constrain);
this.panel.repaint(); this.panel.repaint();

View File

@ -0,0 +1,38 @@
package VistaControlador;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
public class ModeloInformes {
Connection controlador;
ModeloInformes(){
String url="jdbc:mariadb://localhost:3306/informes?user=root&password=1234";
try {
this.controlador=DriverManager.getConnection(url);
} catch (SQLException e) {
e.printStackTrace();
}
}
Vector<String> anios() {
Vector<String> ret = new Vector<String>();
String query = "select distinct year(transacciones.fecha) from transacciones;";
try {
PreparedStatement stmt = this.controlador.prepareStatement(query);
ResultSet resultado = stmt.executeQuery();
while(resultado.next()) {
ret.add(resultado.getString(1));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ret;
}
}

View File

@ -36,6 +36,7 @@ public class VistaAniadirVisualizar extends JPanel{
this.menu = menu; this.menu = menu;
this.x = 100; this.x = 100;
this.boton = new JButton("aniadir"); this.boton = new JButton("aniadir");
this.boton.setToolTipText("aniade una nueva transaccion");
this.add(boton); this.add(boton);
this.cuadro = new JPanel(); this.cuadro = new JPanel();
this.panel = new JScrollPane(cuadro); this.panel = new JScrollPane(cuadro);

View File

@ -0,0 +1,70 @@
package VistaControlador;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
public class VistaInformes extends VistaPanel{
JButton mostrarInforme1;
JButton exportarInforme1;
JButton mostrarInforme2;
JButton exportarInforme2;
JComboBox<String> opciones1_1;
JComboBox<String> opciones1_2;
JComboBox<String> opciones2;
public VistaInformes() {
super();
this.setLayout(new GridBagLayout());
GridBagConstraints constrain = new GridBagConstraints();
constrain.gridx = 0;
constrain.gridy = 0;
this.mostrarInforme1 = new JButton("Mostrar 1");
this.mostrarInforme1.setToolTipText("Muestra el resultado final del informe 1");
this.add(mostrarInforme1,constrain);
constrain.gridx = 0;
constrain.gridy = 1;
this.exportarInforme1 = new JButton("Exportar 1");
this.exportarInforme1.setToolTipText("Exporta el informe 1 que puedes visualizar");
this.add(exportarInforme1,constrain);
this.opciones1_1 = new JComboBox<String>();
this.opciones1_1.setToolTipText("Por que quieres ordenar?");
constrain.gridx = 0;
constrain.gridy = 2;
this.add(opciones1_1, constrain);
this.opciones1_2 = new JComboBox<String>();
this.opciones1_2.setToolTipText("Anio de la busqueda");
constrain.gridx = 0;
constrain.gridy = 3;
this.add(opciones1_2, constrain);
constrain.gridx = 1;
constrain.gridy = 0;
this.mostrarInforme2 = new JButton("Mostrar 2");
this.add(mostrarInforme2,constrain);
this.mostrarInforme2.setToolTipText("Muestra el resultado final del informe 2");
constrain.gridx = 1;
constrain.gridy = 1;
this.exportarInforme2 = new JButton("Exportar 2");
this.exportarInforme2.setToolTipText("Exporta el informe 2 que puedes visualizar");
this.add(exportarInforme2,constrain);
constrain.gridx = 1;
constrain.gridy = 2;
this.opciones2 = new JComboBox<String>();
this.opciones2.setToolTipText("Por que quieres ordenar?");
this.add(opciones2, constrain);
this.cargarComb();
}
private void cargarComb() {
this.opciones2.addItem("id");
this.opciones2.addItem("usuario");
this.opciones1_1.addItem("fecha");
this.opciones1_1.addItem("usuario");
}
}

View File

@ -32,13 +32,17 @@ public class VistaPanelGestion extends VistaPanel{
this.total = new JTextArea(String.valueOf(meses.getTotal())); this.total = new JTextArea(String.valueOf(meses.getTotal()));
this.gastoEnvio = new JTextArea(); this.gastoEnvio = new JTextArea();
this.mostrarEstadisticas = new JButton("Mostrar grafico del mes"); this.mostrarEstadisticas = new JButton("Mostrar grafico del mes");
this.mostrarEstadisticas.setToolTipText("Muestar de forma visual los gastos de este mes");
this.aniadirGestion = new JButton("Aniadir nueva gestión"); this.aniadirGestion = new JButton("Aniadir nueva gestión");
this.aniadirGestion.setToolTipText("aniade una nueva pestania de gestion este mes");
this.add(this.mostrarEstadisticas); this.add(this.mostrarEstadisticas);
//this.add(VistaPanelGestion.elegirMes); //this.add(VistaPanelGestion.elegirMes);
this.add(this.total); this.add(this.total);
this.add(this.gastoEnvio); this.add(this.gastoEnvio);
this.add(this.aniadirGestion); this.add(this.aniadirGestion);
this.eliminarTransaccion = new JButton("Eliminar Deseleccionados"); this.eliminarTransaccion = new JButton("Eliminar Deseleccionados");
this.eliminarTransaccion.setToolTipText("Elimina los elementos deseleccionados, \n"
+ "los cuales ya no se tienen en cuenta en el calculo de precio");
this.add(this.eliminarTransaccion); this.add(this.eliminarTransaccion);
} }

View File

@ -38,10 +38,12 @@ VistaPanelInterfaz() {
constrain.gridy = 0; constrain.gridy = 0;
this.add(this.temaOscuro,constrain); this.add(this.temaOscuro,constrain);
this.aplicarBarra = new JCheckBox("Barra"); this.aplicarBarra = new JCheckBox("Barra");
this.aplicarBarra.setToolTipText("Selecciona para aplicar también el tema en la barra");
constrain.gridx = 0; constrain.gridx = 0;
constrain.gridy = 1; constrain.gridy = 1;
this.add(this.aplicarBarra,constrain); this.add(this.aplicarBarra,constrain);
this.aplicarCambios = new JButton("Aplicar"); this.aplicarCambios = new JButton("Aplicar");
this.aplicarCambios.setToolTipText("aplicar el tema");
constrain.gridx = 1; constrain.gridx = 1;
constrain.gridy = 1; constrain.gridy = 1;
this.add(this.aplicarCambios,constrain); this.add(this.aplicarCambios,constrain);

View File

@ -36,22 +36,26 @@ public class VistaPanelModificar extends VistaPanel{
this.viejoEditar = new JTextField(); this.viejoEditar = new JTextField();
this.viejoEditar.setPreferredSize(new Dimension(80, 17)); this.viejoEditar.setPreferredSize(new Dimension(80, 17));
this.viejoEditar.setToolTipText("Nombre del elemento a editar");
constrain.gridx = 1; constrain.gridx = 1;
constrain.gridy = 0; constrain.gridy = 0;
this.add(this.viejoEditar, constrain); this.add(this.viejoEditar, constrain);
this.nuevoEditar = new JTextField(); this.nuevoEditar = new JTextField();
this.nuevoEditar.setPreferredSize(new Dimension(80, 17)); this.nuevoEditar.setPreferredSize(new Dimension(80, 17));
this.nuevoEditar.setToolTipText("Nombre que le quieres poner al elemento a editar");
constrain.gridx = 1; constrain.gridx = 1;
constrain.gridy = 1; constrain.gridy = 1;
this.add(this.nuevoEditar, constrain); this.add(this.nuevoEditar, constrain);
this.editarGestion = new JButton("Gestion"); this.editarGestion = new JButton("Gestion");
this.editarGestion.setToolTipText("Pulsa aqui si lo que quieres editar es una gestion");
constrain.gridx = 0; constrain.gridx = 0;
constrain.gridy = 2; constrain.gridy = 2;
this.add(this.editarGestion, constrain); this.add(this.editarGestion, constrain);
this.editarTransaccion = new JButton("Transaccion"); this.editarTransaccion = new JButton("Transaccion");
this.editarTransaccion.setToolTipText("Pulsa aqui si lo que quieres editar es una transaccion");
constrain.gridx = 1; constrain.gridx = 1;
constrain.gridy = 2; constrain.gridy = 2;
this.add(this.editarTransaccion, constrain); this.add(this.editarTransaccion, constrain);
@ -63,6 +67,8 @@ public class VistaPanelModificar extends VistaPanel{
this.add(this.dineroPanel, constrain); this.add(this.dineroPanel, constrain);
this.dineroEditar = new JTextField(); this.dineroEditar = new JTextField();
this.dineroEditar.setToolTipText("la cantidad de dinero en número a cambiar "
+ "(solo valido si es una transaccion)");
constrain.gridx = 1; constrain.gridx = 1;
constrain.gridy = 3; constrain.gridy = 3;
this.dineroEditar.setPreferredSize(new Dimension(80, 17)); this.dineroEditar.setPreferredSize(new Dimension(80, 17));