fixes bug#20380
dev:fabio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@103738 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
c1099496dd
commit
f357ebeb8c
|
@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -14,6 +15,7 @@ import org.apache.log4j.Logger;
|
|||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioDepositoBean;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
|
||||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||
|
||||
|
@ -60,6 +62,8 @@ public class RelatorioDepositos extends Relatorio {
|
|||
Integer empresaIdAux = null;
|
||||
BigDecimal pendente = BigDecimal.ZERO;
|
||||
BigDecimal totalFechamento = BigDecimal.ZERO;
|
||||
Date dtMotivo = null;
|
||||
Long fechamentocntcorrenteId = null;
|
||||
|
||||
while (rs.next()) {
|
||||
RelatorioDepositoBean deposito = new RelatorioDepositoBean();
|
||||
|
@ -73,18 +77,36 @@ public class RelatorioDepositos extends Relatorio {
|
|||
deposito.setEmpresaId(rs.getInt("empresaId"));
|
||||
deposito.setPuntoventaId(rs.getInt("puntoventaId"));
|
||||
|
||||
if((puntoventaIdAux == null || !puntoventaIdAux.equals(deposito.getPuntoventaId())) ||
|
||||
(empresaIdAux == null || !empresaIdAux.equals(deposito.getEmpresaId()))) {
|
||||
|
||||
puntoventaIdAux = deposito.getPuntoventaId();
|
||||
empresaIdAux = deposito.getEmpresaId();
|
||||
boolean isPontoVendaEmpresaDiferente = (puntoventaIdAux == null || !puntoventaIdAux.equals(deposito.getPuntoventaId())) ||
|
||||
(empresaIdAux == null || !empresaIdAux.equals(deposito.getEmpresaId()));
|
||||
|
||||
if(fechamentocntcorrenteId == null) {
|
||||
fechamentocntcorrenteId = rs.getLong("fechamentocntcorrenteId");
|
||||
} if(!isPontoVendaEmpresaDiferente && dtMotivo != null && DateUtil.compareOnlyDate(dtMotivo, deposito.getDtmotivo()) == 0 && !fechamentocntcorrenteId.equals(rs.getLong("fechamentocntcorrenteId"))) {
|
||||
pendente = deposito.getVrfechamento();
|
||||
totalFechamento = totalFechamento.add(deposito.getVrfechamento());
|
||||
|
||||
if(!lsDadosRelatorio.isEmpty()) {
|
||||
lsDadosRelatorio.get(lsDadosRelatorio.size() - 1).setSomarPendente(true);
|
||||
}
|
||||
fechamentocntcorrenteId = rs.getLong("fechamentocntcorrenteId");
|
||||
}
|
||||
|
||||
if(isPontoVendaEmpresaDiferente || (dtMotivo == null || DateUtil.compareOnlyDate(dtMotivo, deposito.getDtmotivo()) != 0)) {
|
||||
|
||||
if(isPontoVendaEmpresaDiferente) {
|
||||
puntoventaIdAux = deposito.getPuntoventaId();
|
||||
empresaIdAux = deposito.getEmpresaId();
|
||||
pendente = deposito.getVrfechamento();
|
||||
dtMotivo = deposito.getDtmotivo();
|
||||
totalFechamento = totalFechamento.add(deposito.getVrfechamento());
|
||||
fechamentocntcorrenteId = rs.getLong("fechamentocntcorrenteId");
|
||||
}
|
||||
|
||||
if(dtMotivo == null || DateUtil.compareOnlyDate(dtMotivo, deposito.getDtmotivo()) != 0) {
|
||||
pendente = deposito.getVrfechamento();
|
||||
totalFechamento = totalFechamento.add(deposito.getVrfechamento());
|
||||
fechamentocntcorrenteId = rs.getLong("fechamentocntcorrenteId");
|
||||
}
|
||||
dtMotivo = deposito.getDtmotivo();
|
||||
}
|
||||
|
||||
pendente = pendente.subtract(deposito.getVrdeposito());
|
||||
deposito.setVrpendente(pendente);
|
||||
|
||||
|
@ -92,7 +114,6 @@ public class RelatorioDepositos extends Relatorio {
|
|||
}
|
||||
|
||||
if (lsDadosRelatorio.size() > 0) {
|
||||
lsDadosRelatorio.get(lsDadosRelatorio.size() - 1).setSomarPendente(true);
|
||||
setLsDadosRelatorio(lsDadosRelatorio);
|
||||
}
|
||||
parametros.put("totalFechamento", totalFechamento);
|
||||
|
@ -124,6 +145,7 @@ public class RelatorioDepositos extends Relatorio {
|
|||
sql.append(" tmp.dtmotivo, ");
|
||||
sql.append(" tmp.saldo, ");
|
||||
sql.append(" tmp.vrfechamento, ");
|
||||
sql.append(" tmp.fechamentocntcorrenteId, ");
|
||||
|
||||
if (! filtrarPendentes){
|
||||
sql.append(" tmp.numdeposito, ");
|
||||
|
@ -147,7 +169,7 @@ public class RelatorioDepositos extends Relatorio {
|
|||
sql.append(" fdp.NUMDEPOSITO as numdeposito, ");
|
||||
}
|
||||
|
||||
sql.append(" f.FECHAMENTOCNTCORRENTE_ID ");
|
||||
sql.append(" f.FECHAMENTOCNTCORRENTE_ID as fechamentocntcorrenteId ");
|
||||
sql.append(" FROM fechamento_cntcorrente f ");
|
||||
sql.append(" LEFT JOIN punto_venta p ");
|
||||
sql.append(" ON p.puntoventa_id = f.puntoventa_id ");
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
<?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="RelatorioDepositos" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Empty" uuid="65274c35-4f3f-4196-bd84-f042e9ac12ea">
|
||||
<property name="ireport.zoom" value="1.3310000000000006"/>
|
||||
<property name="ireport.x" value="75"/>
|
||||
<property name="ireport.x" value="70"/>
|
||||
<property name="ireport.y" value="38"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="title"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="pageHeader"/>
|
||||
|
@ -29,13 +29,9 @@
|
|||
<field name="nomeInstFinanceira" class="java.lang.String"/>
|
||||
<field name="codigoInstFinanceira" class="java.lang.String"/>
|
||||
<field name="vrpendente" class="java.math.BigDecimal"/>
|
||||
<field name="somarPendente" class="java.lang.Boolean"/>
|
||||
<variable name="TOTAL_DEPOSITOS" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{vrdeposito}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="TOTAL_FECHAMENTO" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{vrfechamento}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="TOTAL_SALDO" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{saldo}]]></variableExpression>
|
||||
</variable>
|
||||
|
@ -48,15 +44,15 @@
|
|||
<variable name="PENDENTE_BANCO" class="java.math.BigDecimal" resetType="Group" resetGroup="grupoBanco" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{saldo}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="TOTAL_PENDENTE" class="java.math.BigDecimal" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{somarPendente} ? $F{vrpendente} : BigDecimal.ZERO]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="verificaGrupoBanco" class="java.lang.String">
|
||||
<variableExpression><![CDATA[$P{isClassificaPorBanco}==true?$F{nombpuntoventa}:""]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="SOMA_VRDEPOSITO" class="java.math.BigDecimal" resetType="Group" resetGroup="grupo_data_agencia" calculation="Sum">
|
||||
<variableExpression><![CDATA[$F{vrdeposito}]]></variableExpression>
|
||||
</variable>
|
||||
<variable name="TOTAL_PENDENTE" class="java.math.BigDecimal">
|
||||
<variableExpression><![CDATA[$F{vrpendente}]]></variableExpression>
|
||||
</variable>
|
||||
<group name="empresa">
|
||||
<groupExpression><![CDATA[$F{nombempresa}]]></groupExpression>
|
||||
<groupHeader>
|
||||
|
@ -124,7 +120,7 @@
|
|||
<font size="8" isBold="true"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$R{header.vrdeposito}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$R{header.vrfechamento}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
|
||||
<reportElement uuid="abb21651-0e84-4231-a213-fe0a5a7fa493" stretchType="RelativeToTallestObject" mode="Opaque" x="349" y="20" width="68" height="20" isPrintWhenDetailOverflows="true" backcolor="#CCCCCC"/>
|
||||
|
@ -138,7 +134,7 @@
|
|||
<font size="8" isBold="true"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$R{header.vrfechamento}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$R{header.vrdeposito}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
|
||||
<reportElement uuid="a704e07a-dff4-4f1f-9acb-e31066999543" stretchType="RelativeToTallestObject" mode="Opaque" x="417" y="20" width="68" height="20" isPrintWhenDetailOverflows="true" backcolor="#CCCCCC"/>
|
||||
|
@ -198,7 +194,7 @@
|
|||
<textElement textAlignment="Right">
|
||||
<font size="6" isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{DEPOSITO_BANCO}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$V{VLFECHAMENTO_BANCO}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00">
|
||||
<reportElement uuid="695d6008-0322-46fd-9423-ec88ceaccdb9" x="349" y="0" width="68" height="20" isPrintWhenDetailOverflows="true">
|
||||
|
@ -207,7 +203,7 @@
|
|||
<textElement textAlignment="Right" verticalAlignment="Top">
|
||||
<font size="6" isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{VLFECHAMENTO_BANCO}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$V{DEPOSITO_BANCO}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00">
|
||||
<reportElement uuid="a0492959-dfa8-4d34-b1ce-ff7a09b8b706" x="417" y="0" width="68" height="20" isPrintWhenDetailOverflows="true">
|
||||
|
@ -344,7 +340,7 @@
|
|||
<font size="8" isBold="true"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{vrdeposito}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$F{vrfechamento}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="a5788fa8-4c63-4d06-b573-48c62d78c222" stretchType="RelativeToTallestObject" x="349" y="0" width="68" height="17"/>
|
||||
|
@ -358,7 +354,7 @@
|
|||
<font size="8" isBold="true"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{vrfechamento}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$F{vrdeposito}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" pattern="#,##0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="4a87d5aa-6020-4021-bb4c-5962a65acd14" stretchType="RelativeToTallestObject" x="417" y="0" width="68" height="17"/>
|
||||
|
@ -445,7 +441,7 @@
|
|||
<textElement>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{TOTAL_PENDENTE}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$P{totalFechamento}.subtract($V{TOTAL_DEPOSITOS} != null ? $V{TOTAL_DEPOSITOS} : BigDecimal.ZERO)]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</summary>
|
||||
|
|
|
@ -17,7 +17,6 @@ public class RelatorioDepositoBean implements Comparable {
|
|||
private String codigoInstFinanceira;
|
||||
private String nomeInstFinanceira;
|
||||
private Long fechamentocntcorrenteId;
|
||||
private Boolean somarPendente;
|
||||
private Integer puntoventaId;
|
||||
private Integer empresaId;
|
||||
|
||||
|
@ -116,14 +115,6 @@ public class RelatorioDepositoBean implements Comparable {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public Boolean getSomarPendente() {
|
||||
return somarPendente != null ? somarPendente : false;
|
||||
}
|
||||
|
||||
public void setSomarPendente(Boolean somarPendente) {
|
||||
this.somarPendente = somarPendente;
|
||||
}
|
||||
|
||||
public BigDecimal getVrpendente() {
|
||||
return vrpendente != null ? vrpendente : BigDecimal.ZERO;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue