julio 2015-10-20 16:58:52 +00:00
parent 8f21d1820e
commit 3ccb338d48
4 changed files with 423 additions and 2 deletions

View File

@ -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<String, Object> parametros, Connection conexao) {
super(parametros, conexao);
RegistroCalculo rc = (RegistroCalculo) parametros.get("registroCalculo");
List<RegistroCalculo> lsDadosRelatorio = Arrays.asList(rc);
setLsDadosRelatorio(lsDadosRelatorio);
}
public void setLsDadosRelatorio(List<RegistroCalculo> lsDadosRelatorio) {
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
}
@Override
protected void processaParametros() throws Exception {
}
}

View File

@ -0,0 +1,363 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="RelatorioCalculoComissao" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a0e4c57b-f708-4388-8e29-56a2a758254d">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="dsDescontos" uuid="b7826494-a692-464e-8409-8b27d51e65f7">
<field name="nomeDesconto" class="java.lang.String"/>
<field name="valorDesconto" class="java.math.BigDecimal"/>
<field name="tipoDesconto" class="java.lang.String"/>
</subDataset>
<subDataset name="dsReceitas" uuid="8c2ed585-40f3-494c-9a1a-919a1a19ad7b">
<field name="data" class="java.util.Date"/>
<field name="receitaComissao" class="java.math.BigDecimal"/>
<field name="receitaBPR" class="java.math.BigDecimal"/>
<field name="receitaGAP" class="java.math.BigDecimal"/>
<field name="gapImpressa" class="java.math.BigDecimal"/>
<field name="internet" class="java.math.BigDecimal"/>
<field name="cancelados" class="java.math.BigDecimal"/>
<field name="canceladosGAP" class="java.math.BigDecimal"/>
<field name="devolvidos" class="java.math.BigDecimal"/>
<field name="devolvidosGAP" class="java.math.BigDecimal"/>
<field name="devolucoesOrigem" class="java.math.BigDecimal"/>
<field name="devolucoesOrigemGAP" class="java.math.BigDecimal"/>
<field name="receitaExcessoBagagem" class="java.math.BigDecimal"/>
<field name="receitaSeguroOpcional" class="java.math.BigDecimal"/>
<field name="contImpressa" class="java.lang.Integer"/>
<field name="comissaoBPRDiaria" class="java.math.BigDecimal"/>
<field name="comissaoExcessoBagagemDiaria" class="java.math.BigDecimal"/>
<field name="comissaoSegOpcionalDiaria" class="java.math.BigDecimal"/>
<field name="comissaoEntregaPassagemDiaria" class="java.math.BigDecimal"/>
</subDataset>
<parameter name="empresa" class="java.lang.String"/>
<parameter name="puntoventa" class="java.lang.String"/>
<parameter name="periodo" class="java.util.Date"/>
<field name="comissaoPagar" class="java.math.BigDecimal"/>
<field name="comissaoBPR" class="java.math.BigDecimal"/>
<field name="comissaoSegOpcional" class="java.math.BigDecimal"/>
<field name="comissaoExcessoBagagem" class="java.math.BigDecimal"/>
<field name="comissaoEntregaPassagem" class="java.math.BigDecimal"/>
<field name="comissaoBonificaoMetas" class="java.math.BigDecimal"/>
<field name="royaties" class="java.math.BigDecimal"/>
<field name="retidoISS" class="java.math.BigDecimal"/>
<field name="descontos" class="java.math.BigDecimal"/>
<field name="lsDescontos" class="java.util.List"/>
<field name="lsReceitas" class="java.util.List"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<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>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="22" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="40" height="20" uuid="7fc84bc1-91f8-4e1a-8107-1d3ee212a092"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dia]]></text>
</staticText>
<staticText>
<reportElement x="40" y="0" width="48" height="20" uuid="6af5a44f-8c3d-429f-badf-88e20a66807a"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Comissão]]></text>
</staticText>
<staticText>
<reportElement x="88" y="0" width="48" height="20" uuid="35fe71b1-df1c-484a-8f87-af211f200bca"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[BPR]]></text>
</staticText>
<staticText>
<reportElement x="136" y="0" width="48" height="20" uuid="7147ab8f-5bf7-40e9-b1ce-d73850d44a9f"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Gap Impressa]]></text>
</staticText>
<staticText>
<reportElement x="184" y="0" width="48" height="20" uuid="22d06118-da12-4687-a607-a613ccacf6df"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Internet]]></text>
</staticText>
<staticText>
<reportElement x="232" y="0" width="48" height="20" uuid="2cec99a9-c149-4093-803d-243f98e54246"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Cancelados]]></text>
</staticText>
<staticText>
<reportElement x="280" y="0" width="48" height="20" uuid="eae8ef19-6b18-4c16-b5e9-0a6b437a544e"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Cancel. GAP]]></text>
</staticText>
<staticText>
<reportElement x="328" y="0" width="48" height="20" uuid="cd148661-9ac6-424c-871f-85e868b567c2"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Devolvidos]]></text>
</staticText>
<staticText>
<reportElement x="376" y="0" width="48" height="20" uuid="614afc5b-6599-4df1-85be-f7345edf03bd"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dev. GAP]]></text>
</staticText>
<staticText>
<reportElement x="424" y="0" width="48" height="20" uuid="666e7a49-c7c7-486f-b2b4-6dd527b7d61a"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dev. Origem]]></text>
</staticText>
<staticText>
<reportElement x="472" y="0" width="48" height="20" uuid="99b9d63b-e85f-493f-9137-9afe4b0d6d9c"/>
<text><![CDATA[Dev. O. GAP]]></text>
</staticText>
<staticText>
<reportElement x="520" y="0" width="48" height="20" uuid="aff93ffa-25c4-4e94-9c41-0d0645ce9baf"/>
<text><![CDATA[Exc. Bagagem]]></text>
</staticText>
<staticText>
<reportElement x="568" y="0" width="48" height="20" uuid="bebea578-a143-49b9-9fbf-e3cd195da578"/>
<text><![CDATA[Seg. Opcional]]></text>
</staticText>
<staticText>
<reportElement x="616" y="0" width="47" height="20" uuid="2c528771-f11d-46ff-b4da-8d3d374a0c1d"/>
<textElement textAlignment="Center"/>
<text><![CDATA[BPR]]></text>
</staticText>
<staticText>
<reportElement x="663" y="0" width="47" height="20" uuid="8964b28a-d9eb-4bc0-84da-7da7ab9f6938"/>
<text><![CDATA[Exc. Bagagem]]></text>
</staticText>
<staticText>
<reportElement x="708" y="0" width="47" height="20" uuid="1255a9bb-4818-42e6-bb12-08f037ea2697"/>
<text><![CDATA[Seg Opcional]]></text>
</staticText>
<staticText>
<reportElement x="755" y="0" width="47" height="20" uuid="fdfda50b-b3a8-434d-b639-eb3ba2607210"/>
<text><![CDATA[Ent. Passagem]]></text>
</staticText>
<line>
<reportElement x="0" y="20" width="802" height="2" uuid="6b2baf9a-4ce8-451d-81fc-6de170f936a6"/>
</line>
</band>
</columnHeader>
<detail>
<band height="21" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="802" height="20" uuid="91777506-4453-4fb6-a6b3-a59d0617e64c"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="dsReceitas" uuid="2905e9bf-53a5-4bf4-9c86-dab2caaf1568">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{lsReceitas})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="802">
<textField pattern="dd/MM/yyyy">
<reportElement x="0" y="0" width="40" height="20" uuid="e07d813d-bd6b-471a-a2bb-e4dc11f2bdac"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{data}]]></textFieldExpression>
</textField>
<textField pattern="###0.00;-###0.00">
<reportElement x="40" y="0" width="48" height="20" uuid="9d2a49cb-668c-4f48-8d62-c1e4a4dcd35a"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{receitaComissao}]]></textFieldExpression>
</textField>
<textField pattern="###0.00;-###0.00">
<reportElement x="88" y="0" width="48" height="20" uuid="ad82a9e8-075f-4a8e-baac-5692f9adc3a2"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{receitaBPR}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="136" y="0" width="48" height="20" uuid="34256306-a199-4632-ab62-987cbcee2b87"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{gapImpressa}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="184" y="0" width="48" height="20" uuid="b114fd6c-4916-4de7-a29d-818714ed4391"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{internet}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="232" y="0" width="48" height="20" uuid="c6b48d31-2610-4d74-a985-61c0b04c0b03"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{cancelados}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="280" y="0" width="48" height="20" uuid="aba02000-4465-46e7-8906-d00c98486e3d"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{canceladosGAP}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="328" y="0" width="48" height="20" uuid="57c60256-16fc-42cd-9520-7181f7e160a4"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{devolvidos}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="376" y="0" width="48" height="20" uuid="e26f9961-715a-4b8c-8572-124de2fa8d6e"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{devolvidosGAP}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="424" y="0" width="48" height="20" uuid="b0660ec0-0514-425c-af89-f18cc88cd4fe"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{devolucoesOrigem}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="472" y="0" width="48" height="20" uuid="3bf0d7e7-f17b-485e-9ace-b187f2a1c323"/>
<textFieldExpression><![CDATA[$F{devolvidosGAP}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="520" y="0" width="48" height="20" uuid="7e65e013-690a-474f-a364-89969100375d"/>
<textFieldExpression><![CDATA[$F{receitaExcessoBagagem}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="568" y="0" width="48" height="20" uuid="7ca6ab64-e858-4b00-a122-aff8cd4efc1f"/>
<textFieldExpression><![CDATA[$F{receitaSeguroOpcional}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="616" y="0" width="47" height="20" uuid="af43f495-3baf-4e9a-9c62-b34f0e193b77"/>
<textFieldExpression><![CDATA[$F{comissaoBPRDiaria}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="661" y="0" width="47" height="20" uuid="2c04f6b6-4c33-44dc-8b4f-8c2f5cde62ec"/>
<textFieldExpression><![CDATA[$F{comissaoExcessoBagagemDiaria}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="708" y="0" width="47" height="20" uuid="d08279e1-45e7-44fc-9c7f-69a71918b14f"/>
<textFieldExpression><![CDATA[$F{comissaoSegOpcionalDiaria}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="755" y="0" width="47" height="20" uuid="2bd8df87-d632-4eaa-9f17-ac8cba7f15a5"/>
<textFieldExpression><![CDATA[$F{comissaoEntregaPassagemDiaria}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
<line>
<reportElement x="0" y="20" width="802" height="1" uuid="7932e55d-8e4e-45b9-bda9-e6fd179a00e1"/>
</line>
</band>
<band height="50"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>

View File

@ -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<Empresa> lsEmpresas;
private List<PuntoVenta> lsPuntoVenta;
@ -48,13 +60,28 @@ public class BusquedaCalculoComissaoController extends MyGenericForwardComposer
lsPuntoVenta = new ArrayList<PuntoVenta>();
}
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<String, Object> parametros = new HashMap<String, Object>();
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<String, Relatorio> args = new HashMap<String, Relatorio>();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioAcompanhamentoEquivalentesController.window.title"), args, MODAL);
}
public void onClick$btnRegistrar(Event ev) {