wilian 2017-08-29 19:59:30 +00:00
parent f7b415ab44
commit b7383b7d49
6 changed files with 79 additions and 59 deletions

View File

@ -135,6 +135,7 @@ public class RelatorioDevolucaoBilhetes extends Relatorio {
db.setValorIsenta(BigDecimal.ZERO);
boolean isEstadual = rset.getInt("IS_ESTADUAL") == 1;
db.setEstadual(isEstadual);
BigDecimal valorContabil = BigDecimal.ZERO;
if(isEstadual) {
@ -190,33 +191,34 @@ public class RelatorioDevolucaoBilhetes extends Relatorio {
}
}
BigDecimal baseCalculoIcms = BigDecimal.ZERO;
BigDecimal valorIcms = BigDecimal.ZERO;
if(db.isIsenta()) {
db.setValorIsenta(valorContabil);
} else {
BigDecimal redutor = valorContabil.multiply(redBaseCalcIcms);
valorIcms = valorContabil.subtract(redutor);
baseCalculoIcms = valorContabil.subtract(redutor);
if(isEstadual) {
if(db.getTributacaoimportacao() == null) {
valorIcms = db.getValorContabil().multiply(db.getIcmsInterestadual().divide(UtiliteriasFiscal.CEM));
valorIcms = baseCalculoIcms.multiply(db.getIcmsInterestadual().divide(UtiliteriasFiscal.CEM));
} else {
valorIcms = db.getValorContabil().multiply(db.getTributacaoimportacao().divide(UtiliteriasFiscal.CEM));
valorIcms = baseCalculoIcms.multiply(db.getTributacaoimportacao().divide(UtiliteriasFiscal.CEM));
}
} else {
valorIcms = db.getValorContabil().multiply(db.getIcmsIntermunicipal().divide(UtiliteriasFiscal.CEM));
valorIcms = baseCalculoIcms.multiply(db.getIcmsIntermunicipal().divide(UtiliteriasFiscal.CEM));
}
db.setValorIcms(valorIcms);
}
db.setBaseCalculoIcms(baseCalculoIcms);
db.setEstornoEstadual(BigDecimal.ZERO);
db.setEstornoMunicipal(BigDecimal.ZERO);
if(!db.isIsenta()) {
if (isEstadual) {
db.setEstornoEstadual(valorContabil);
db.setEstornoEstadual(baseCalculoIcms);
} else {
db.setEstornoMunicipal(valorContabil);
db.setEstornoMunicipal(baseCalculoIcms);
}
}
@ -318,7 +320,7 @@ public class RelatorioDevolucaoBilhetes extends Relatorio {
sql.append(estados == null ? "" : "AND COALESCE(EOS.ESTADO_ID, EST.ESTADO_ID) IN (" + estados + ") ");
sql.append(puntoVentas == null ? "" : "AND PTV.PUNTOVENTA_ID IN (" + puntoVentas + ") ");
sql.append(empresaId == null ? "" : "AND E.EMPRESA_ID IN (" + empresaId + ") ");
sql.append("ORDER BY NOMB_EMPRESA, ESTADO, UF, FECHOR_VENTA, NUMFOLIOSISTEMA");
sql.append("ORDER BY NOMB_EMPRESA, ESTADO, UF, FECHOR_DEVOLUCAO, NUMFOLIOSISTEMA");
return sql.toString();
}

View File

@ -16,7 +16,7 @@ label.aliquota=Al
label.icms=ICMS
label.pagina=Página:
label.total=Total
label.qtdeBilhetes=Quantidade de Bilhetes
label.qtdeBilhetes=Quantidade de Bilhetes:
label.totalBilhete=Total Bilhete
label.numeroBilhete=Nº Bilhete
label.numpuntoventa=Nº Agência

View File

@ -16,7 +16,7 @@ label.aliquota=Al
label.icms=ICMS
label.pagina=Página:
label.total=Total
label.qtdeBilhetes=Quantidade de Bilhetes
label.qtdeBilhetes=Quantidade de Bilhetes:
label.totalBilhete=Total Bilhete
label.numeroBilhete=Nº Bilhete
label.numpuntoventa=Nº Agência

View File

@ -1,8 +1,8 @@
<?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="RelatorioDevolucaoBilhetes" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="efbc89d4-6f08-4ea5-802f-d4f48ed208e2">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="477"/>
<property name="ireport.y" value="124"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="96"/>
<style name="textStyle" isDefault="true" fontSize="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="table">
<box>
@ -40,20 +40,14 @@
<field name="numFolioSistema" class="java.lang.String"/>
<field name="serieSubSerie" class="java.lang.String"/>
<field name="folio" class="java.lang.String"/>
<field name="precioPagado" class="java.math.BigDecimal"/>
<field name="precioBase" class="java.math.BigDecimal"/>
<field name="estadoId" class="java.lang.Integer"/>
<field name="uf" class="java.lang.String"/>
<field name="fechorVenta" class="java.lang.String"/>
<field name="icmsInterestadual" class="java.math.BigDecimal"/>
<field name="valorIcms" class="java.math.BigDecimal"/>
<field name="empresaId" class="java.lang.Integer"/>
<field name="empresa" class="java.lang.String"/>
<field name="porcMunicipal" class="java.math.BigDecimal"/>
<field name="porcEstadual" class="java.math.BigDecimal"/>
<field name="estornoMunicipal" class="java.math.BigDecimal"/>
<field name="estornoEstadual" class="java.math.BigDecimal"/>
<field name="totalBilhete" class="java.math.BigDecimal"/>
<field name="numpuntoventa" class="java.lang.String"/>
<field name="numpuntoventaOrigem" class="java.lang.String"/>
<field name="valorIsenta" class="java.math.BigDecimal"/>
@ -61,29 +55,17 @@
<field name="valorOutras" class="java.math.BigDecimal"/>
<field name="fechorDevolucao" class="java.lang.String"/>
<field name="estado" class="java.lang.String"/>
<field name="icmsIntermunicipal" class="java.math.BigDecimal"/>
<field name="tributacaoimportacao" class="java.math.BigDecimal"/>
<variable name="precioPagado_1" class="java.math.BigDecimal" resetType="Group" resetGroup="data_group" calculation="Sum">
<variableExpression><![CDATA[$F{precioPagado}]]></variableExpression>
</variable>
<variable name="valorIcms_1" class="java.math.BigDecimal" resetType="Group" resetGroup="data_group" calculation="Sum">
<field name="baseCalculoIcms" class="java.math.BigDecimal"/>
<field name="aliquota" class="java.math.BigDecimal"/>
<variable name="vSubTotalIcms" class="java.math.BigDecimal" resetType="Group" resetGroup="data_group" calculation="Sum">
<variableExpression><![CDATA[$F{valorIcms}]]></variableExpression>
</variable>
<variable name="qtdeBilhetes" class="java.lang.Integer" calculation="Count">
<variableExpression><![CDATA[$F{numFolioSistema}]]></variableExpression>
</variable>
<variable name="precioPagado_total" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{precioPagado}]]></variableExpression>
</variable>
<variable name="valorIcms_total" class="java.math.BigDecimal" calculation="Sum">
<variable name="vTotalIcms" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{valorIcms}]]></variableExpression>
</variable>
<variable name="vTotalBilhete" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{totalBilhete}]]></variableExpression>
</variable>
<variable name="vSubTotalBilhete" class="java.math.BigDecimal" resetType="Group" resetGroup="data_group" calculation="Sum">
<variableExpression><![CDATA[$F{totalBilhete}]]></variableExpression>
</variable>
<variable name="vSubTotalIsenta" class="java.math.BigDecimal" resetType="Group" resetGroup="data_group" calculation="Sum">
<variableExpression><![CDATA[$F{valorIsenta}]]></variableExpression>
</variable>
@ -102,15 +84,21 @@
<variable name="vTotalContabil" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{valorContabil}]]></variableExpression>
</variable>
<variable name="estornoMunicipal_1" class="java.math.BigDecimal" resetType="Group" resetGroup="estado_empresa" calculation="Sum">
<variable name="vTotalEstornoIntermunicipal" class="java.math.BigDecimal" resetType="Group" resetGroup="estado_empresa" calculation="Sum">
<variableExpression><![CDATA[$F{estornoMunicipal}]]></variableExpression>
</variable>
<variable name="estornoEstadual_1" class="java.math.BigDecimal" resetType="Group" resetGroup="estado_empresa" calculation="Sum">
<variable name="vTotalEstornoInterestadual" class="java.math.BigDecimal" resetType="Group" resetGroup="estado_empresa" calculation="Sum">
<variableExpression><![CDATA[$F{estornoEstadual}]]></variableExpression>
</variable>
<variable name="somaEstorno" class="java.math.BigDecimal" resetType="Group" resetGroup="estado_empresa" calculation="Sum">
<variable name="vTotalSomaEstorno" class="java.math.BigDecimal" resetType="Group" resetGroup="estado_empresa" calculation="Sum">
<variableExpression><![CDATA[$F{estornoEstadual}.add($F{estornoMunicipal})]]></variableExpression>
</variable>
<variable name="vSubTotalBaseCalculoIcms" class="java.math.BigDecimal" resetType="Group" resetGroup="data_group" calculation="Sum">
<variableExpression><![CDATA[$F{baseCalculoIcms}]]></variableExpression>
</variable>
<variable name="vTotalBaseCalculoIcms" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{baseCalculoIcms}]]></variableExpression>
</variable>
<group name="empresa">
<groupExpression><![CDATA[$F{empresaId}]]></groupExpression>
<groupHeader>
@ -158,25 +146,25 @@
<textFieldExpression><![CDATA[$R{label.impEstornarIntermunicipal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="288" y="15" width="72" height="14" uuid="ac8a5a5d-6d23-445c-925f-81a506de6e5e"/>
<reportElement x="271" y="15" width="111" height="14" uuid="ac8a5a5d-6d23-445c-925f-81a506de6e5e"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{estornoMunicipal_1}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vTotalEstornoIntermunicipal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="288" y="1" width="72" height="14" uuid="824c2026-e1ef-459e-88d3-a746acff0dad"/>
<reportElement x="271" y="1" width="111" height="14" uuid="824c2026-e1ef-459e-88d3-a746acff0dad"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{estornoEstadual_1}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vTotalEstornoInterestadual}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="288" y="29" width="72" height="14" uuid="10545815-fcf1-40b9-b645-7d1e3097cf0c"/>
<reportElement x="271" y="29" width="111" height="14" uuid="10545815-fcf1-40b9-b645-7d1e3097cf0c"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{somaEstorno}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vTotalSomaEstorno}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="29" width="271" height="14" uuid="d4909dc9-7ef7-4fc0-b835-73c30300e693"/>
@ -192,7 +180,7 @@
</groupFooter>
</group>
<group name="data_group">
<groupExpression><![CDATA[$F{fechorVenta}]]></groupExpression>
<groupExpression><![CDATA[$F{fechorDevolucao}]]></groupExpression>
<groupHeader>
<band height="17">
<textField>
@ -200,7 +188,7 @@
<textElement>
<font size="6" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{fechorVenta}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{fechorDevolucao}]]></textFieldExpression>
</textField>
<line>
<reportElement x="1" y="15" width="800" height="1" uuid="fc2f690d-3659-4d11-a671-9c004341d03d"/>
@ -214,14 +202,14 @@
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{vSubTotalContabil}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vSubTotalBaseCalculoIcms}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="447" y="1" width="94" height="14" uuid="943bc881-8248-4da5-999a-62b2f67a573a"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{precioPagado_1}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vSubTotalContabil}]]></textFieldExpression>
</textField>
<line>
<reportElement x="1" y="0" width="800" height="1" uuid="eb29c074-35dc-47d8-855b-78b95676b7ae"/>
@ -231,14 +219,14 @@
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{valorIcms_1}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vSubTotalIcms}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="1" y="1" width="139" height="13" uuid="bbb5fed7-d553-42f3-9d90-4e548e0b7b38"/>
<reportElement x="1" y="1" width="187" height="13" uuid="bbb5fed7-d553-42f3-9d90-4e548e0b7b38"/>
<textElement verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA["Subtotal - " + $F{fechorVenta}]]></textFieldExpression>
<textFieldExpression><![CDATA["Subtotal - " + $F{fechorDevolucao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="708" y="1" width="42" height="14" uuid="dd9cdc1b-7478-467b-ab0c-c6b491790a34"/>
@ -539,21 +527,21 @@
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{precioPagado}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{valorContabil}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="615" y="0" width="47" height="14" uuid="3285bf53-66f1-4dc2-b3db-d12875efa546"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{tributacaoimportacao} == null ? $F{icmsInterestadual} : $F{tributacaoimportacao}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{aliquota}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="541" y="0" width="74" height="14" uuid="6772d6a9-3611-4cb6-9c3b-f78dc3fb5dc0"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{valorContabil}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{baseCalculoIcms}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="662" y="0" width="46" height="14" uuid="e948b0e2-03c4-47c9-91f1-90d3a3fc4bf4"/>
@ -626,15 +614,15 @@
<textFieldExpression><![CDATA[$R{label.total}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="236" y="1" width="59" height="14" uuid="0dcac787-43f7-4e9f-84c8-06567671ddb7"/>
<reportElement stretchType="RelativeToTallestObject" x="238" y="1" width="59" height="14" uuid="0dcac787-43f7-4e9f-84c8-06567671ddb7"/>
<textElement verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{qtdeBilhetes}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="140" y="1" width="96" height="14" uuid="fba1bd88-a15f-4d9f-93fb-9abbfaa5429e"/>
<textElement verticalAlignment="Middle">
<reportElement stretchType="RelativeToTallestObject" x="68" y="1" width="168" height="14" uuid="fba1bd88-a15f-4d9f-93fb-9abbfaa5429e"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.qtdeBilhetes}]]></textFieldExpression>
@ -647,21 +635,21 @@
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{precioPagado_total}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vTotalContabil}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement stretchType="RelativeToTallestObject" x="541" y="1" width="74" height="14" uuid="7c3ce565-f549-48d2-815d-9b4d7a39b1ca"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{vTotalContabil}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vTotalBaseCalculoIcms}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement stretchType="RelativeToTallestObject" x="662" y="1" width="46" height="14" uuid="7a2dbe9b-868e-46db-b3b3-6e759d4dba98"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{valorIcms_total}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{vTotalIcms}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
<reportElement stretchType="RelativeToTallestObject" x="750" y="1" width="52" height="14" uuid="fba9c1d7-5a33-4229-9371-31aacc2a9fbb"/>

View File

@ -36,6 +36,7 @@ public class DevolucaoBilhetes {
private boolean isenta;
private BigDecimal valorIsenta;
private BigDecimal valorContabil;
private boolean estadual;
BigDecimal porcMunicipal;
BigDecimal porcEstadual;
@ -52,6 +53,7 @@ public class DevolucaoBilhetes {
private Boolean indSeguroEstadual;
private Boolean indTxEmbarqueEstadual;
private Boolean indPedadioEstdual;
private BigDecimal baseCalculoIcms;
public String getAidf() {
return aidf;
@ -425,4 +427,32 @@ public class DevolucaoBilhetes {
this.tributacaoimportacao = tributacaoimportacao;
}
public BigDecimal getBaseCalculoIcms() {
return baseCalculoIcms;
}
public void setBaseCalculoIcms(BigDecimal baseCalculoIcms) {
this.baseCalculoIcms = baseCalculoIcms;
}
public BigDecimal getAliquota() {
if(isEstadual()) {
if(getTributacaoimportacao() == null) {
return getIcmsInterestadual();
} else {
return getTributacaoimportacao();
}
} else {
return getIcmsIntermunicipal();
}
}
public boolean isEstadual() {
return estadual;
}
public void setEstadual(boolean estadual) {
this.estadual = estadual;
}
}