diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCalculoComissao.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCalculoComissao.java new file mode 100644 index 000000000..4e7e0b9ea --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioCalculoComissao.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioCalculoComissao extends Relatorio { + + public RelatorioCalculoComissao(Map parametros, Connection conexao) { + super(parametros, conexao); + + RegistroCalculo rc = (RegistroCalculo) parametros.get("registroCalculo"); + List lsDadosRelatorio = Arrays.asList(rc); + setLsDadosRelatorio(lsDadosRelatorio); + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + } + + @Override + protected void processaParametros() throws Exception { + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCalculoComissao.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCalculoComissao.jasper new file mode 100644 index 000000000..b66e4bd14 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCalculoComissao.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCalculoComissao.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCalculoComissao.jrxml new file mode 100644 index 000000000..4f17a94f9 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioCalculoComissao.jrxml @@ -0,0 +1,363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="112" splitType="Stretch"> + <staticText> + <reportElement x="0" y="0" width="428" height="20" uuid="e54ab765-96d2-440b-b26f-66111a4ce955"/> + <textElement verticalAlignment="Middle"> + <font size="14" isBold="true"/> + </textElement> + <text><![CDATA[Cálculo de Comissão]]></text> + </staticText> + <textField pattern="dd/MM/yyyy HH:mm"> + <reportElement x="428" y="0" width="374" height="20" uuid="08997b69-e04b-4909-bc46-5b12622d7d7a"/> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="74" y="40" width="728" height="23" isPrintWhenDetailOverflows="true" uuid="e367d6ec-e940-4ee5-afe8-2d2a252dfc87"/> + <textElement> + <font size="11"/> + </textElement> + <textFieldExpression><![CDATA[$P{empresa}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="40" width="74" height="23" uuid="93b8323d-42dc-4d64-8b67-8cf24a25558c"/> + <textElement verticalAlignment="Middle"> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Empresa:]]></text> + </staticText> + <staticText> + <reportElement x="0" y="63" width="74" height="23" uuid="982133a6-3b28-4680-a607-731523b29e9d"/> + <textElement verticalAlignment="Middle"> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Agência:]]></text> + </staticText> + <textField> + <reportElement x="74" y="63" width="728" height="23" isPrintWhenDetailOverflows="true" uuid="3564990b-f006-4bcf-8f24-9af8311ef8b2"/> + <textFieldExpression><![CDATA[$P{puntoventa}]]></textFieldExpression> + </textField> + <textField pattern="MMMMM, yyyy"> + <reportElement x="74" y="20" width="728" height="23" isPrintWhenDetailOverflows="true" uuid="8a00eb79-8246-4e24-b142-a28c56786b13"/> + <textElement> + <font size="11"/> + </textElement> + <textFieldExpression><![CDATA[$P{periodo}]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="0" y="20" width="74" height="20" uuid="aa2db491-e467-4ad0-a87f-b905600c484b"/> + <textElement verticalAlignment="Middle"> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Período:]]></text> + </staticText> + <line> + <reportElement x="0" y="86" width="802" height="1" uuid="b3a684d6-3fa2-49d1-a9d8-dd4646ed6e79"/> + </line> + <line> + <reportElement x="60" y="109" width="553" height="1" uuid="5fb1e6f6-ed00-47e1-bc25-983b590bb3ec"/> + </line> + <staticText> + <reportElement x="48" y="86" width="576" height="23" uuid="7aec384c-a1dd-4e9d-957e-d362fa0c15bd"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Receitas]]></text> + </staticText> + <staticText> + <reportElement x="624" y="86" width="178" height="23" uuid="34ef98f2-f883-485a-a028-52d64db21d33"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="11" isBold="true"/> + </textElement> + <text><![CDATA[Comissões]]></text> + </staticText> + <line> + <reportElement x="636" y="110" width="155" height="1" uuid="c9868cfe-ba36-41d4-bbfc-87fcbb114786"/> + </line> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/BusquedaCalculoComissaoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/BusquedaCalculoComissaoController.java index 40cf77375..9c5eaa9cc 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/BusquedaCalculoComissaoController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/BusquedaCalculoComissaoController.java @@ -1,14 +1,20 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.comissao; +import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; +import org.zkoss.util.resource.Labels; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Combobox; @@ -16,8 +22,11 @@ import org.zkoss.zul.Datebox; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioCalculoComissao; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.CalculoComissaoService; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -34,6 +43,9 @@ public class BusquedaCalculoComissaoController extends MyGenericForwardComposer @Autowired private EmpresaService empresaService; + @Autowired + private DataSource dataSourceRead; + private Combobox cmbEmpresa; private List lsEmpresas; private List lsPuntoVenta; @@ -48,13 +60,28 @@ public class BusquedaCalculoComissaoController extends MyGenericForwardComposer lsPuntoVenta = new ArrayList(); } - public void onClick$btnRelatorio(Event ev) { + public void onClick$btnRelatorio(Event ev) throws SQLException { PuntoVenta puntoVenta = (PuntoVenta) (cmbPuntoVenta.getSelectedItem() != null ? cmbPuntoVenta.getSelectedItem().getValue() : null); Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa.getSelectedItem().getValue() : null); Date periodo = datMes.getValue(); - calculoComissaoService.relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), periodo); + RegistroCalculo rc = calculoComissaoService.relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), periodo); + + Map parametros = new HashMap(); + parametros.put("puntoventa", puntoVenta.getNombpuntoventa()); + parametros.put("empresa", empresa.getNombempresa()); + parametros.put("periodo", periodo); + parametros.put("registroCalculo", rc); + + Relatorio relatorio = new RelatorioCalculoComissao(parametros, dataSourceRead.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"), args, MODAL); + } public void onClick$btnRegistrar(Event ev) {