fixes bug#20380
dev:fabio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@103706 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
72b4c629ac
commit
c1099496dd
|
@ -6,7 +6,6 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -18,7 +17,6 @@ import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioDepositoBe
|
|||
|
||||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class RelatorioDepositos extends Relatorio {
|
||||
|
||||
private static Logger log = Logger.getLogger(RelatorioDepositos.class);
|
||||
|
@ -57,25 +55,47 @@ public class RelatorioDepositos extends Relatorio {
|
|||
rs.setFetchSize(500);
|
||||
|
||||
lsDadosRelatorio = new ArrayList<RelatorioDepositoBean>();
|
||||
|
||||
Integer puntoventaIdAux = null;
|
||||
Integer empresaIdAux = null;
|
||||
BigDecimal pendente = BigDecimal.ZERO;
|
||||
BigDecimal totalFechamento = BigDecimal.ZERO;
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
RelatorioDepositoBean deposito = new RelatorioDepositoBean();
|
||||
deposito.setNombempresa(rs.getString("nombempresa"));
|
||||
deposito.setNombpuntoventa(rs.getString("nombpuntoventa"));
|
||||
deposito.setNumpuntoventa(rs.getString("numpuntoventa"));
|
||||
deposito.setDtmotivo(rs.getDate("dtmotivo"));
|
||||
deposito.setSaldo(rs.getBigDecimal("saldo").multiply(BigDecimal.valueOf(-1)));
|
||||
deposito.setVrdeposito(rs.getBigDecimal("vrfechamento"));
|
||||
deposito.setVrfechamento(rs.getBigDecimal("vrdeposito"));
|
||||
// deposito.setNumdeposito(rs.getString("numdeposito"));
|
||||
deposito.setVrdeposito(rs.getBigDecimal("vrdeposito"));
|
||||
deposito.setVrfechamento(rs.getBigDecimal("vrfechamento"));
|
||||
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();
|
||||
pendente = deposito.getVrfechamento();
|
||||
totalFechamento = totalFechamento.add(deposito.getVrfechamento());
|
||||
|
||||
if(!lsDadosRelatorio.isEmpty()) {
|
||||
lsDadosRelatorio.get(lsDadosRelatorio.size() - 1).setSomarPendente(true);
|
||||
}
|
||||
}
|
||||
pendente = pendente.subtract(deposito.getVrdeposito());
|
||||
deposito.setVrpendente(pendente);
|
||||
|
||||
lsDadosRelatorio.add(deposito);
|
||||
}
|
||||
|
||||
Collections.sort(lsDadosRelatorio);
|
||||
if (lsDadosRelatorio.size() > 0) {
|
||||
lsDadosRelatorio.get(lsDadosRelatorio.size() - 1).setSomarPendente(true);
|
||||
setLsDadosRelatorio(lsDadosRelatorio);
|
||||
}
|
||||
parametros.put("totalFechamento", totalFechamento);
|
||||
setNomeSubReporte(nomeSubReporte);
|
||||
}
|
||||
|
||||
|
@ -109,15 +129,19 @@ public class RelatorioDepositos extends Relatorio {
|
|||
sql.append(" tmp.numdeposito, ");
|
||||
}
|
||||
|
||||
sql.append(" tmp.vrdeposito ");
|
||||
sql.append(" tmp.vrdeposito, ");
|
||||
sql.append(" tmp.puntoventaId, ");
|
||||
sql.append(" tmp.empresaId ");
|
||||
sql.append(" FROM ");
|
||||
sql.append(" ( SELECT DISTINCT e.nombempresa, ");
|
||||
sql.append(" p.nombpuntoventa, ");
|
||||
sql.append(" p.numpuntoventa, ");
|
||||
sql.append(" p.puntoventa_id as puntoventaId, ");
|
||||
sql.append(" e.empresa_id as empresaId, ");
|
||||
sql.append(" f.fecfechamento AS dtmotivo, ");
|
||||
sql.append(" ( SUM(NVL(fd.valor_pago,0)) - f.total ) AS saldo, ");
|
||||
sql.append(" SUM(NVL(fd.valor_pago,0)) AS vrfechamento , ");
|
||||
sql.append(" f.total AS vrdeposito, ");
|
||||
sql.append(" SUM(NVL(fd.valor_pago,0)) AS vrdeposito , ");
|
||||
sql.append(" f.total AS vrfechamento, ");
|
||||
|
||||
if (! filtrarPendentes){
|
||||
sql.append(" fdp.NUMDEPOSITO as numdeposito, ");
|
||||
|
@ -152,6 +176,8 @@ public class RelatorioDepositos extends Relatorio {
|
|||
sql.append(" GROUP BY e.nombempresa, ");
|
||||
sql.append(" p.nombpuntoventa, ");
|
||||
sql.append(" p.numpuntoventa, ");
|
||||
sql.append(" p.puntoventa_id, ");
|
||||
sql.append(" e.empresa_id, ");
|
||||
sql.append(" f.fecfechamento, ");
|
||||
sql.append(" f.FECHAMENTOCNTCORRENTE_ID, ");
|
||||
|
||||
|
@ -168,7 +194,9 @@ public class RelatorioDepositos extends Relatorio {
|
|||
sql.append(" ORDER BY tmp.nombempresa, ");
|
||||
sql.append(" tmp.nombpuntoventa, ");
|
||||
sql.append(" tmp.dtmotivo, ");
|
||||
sql.append(" tmp.vrdeposito ");
|
||||
sql.append(" tmp.vrdeposito, ");
|
||||
sql.append(" tmp.puntoventaId, ");
|
||||
sql.append(" tmp.empresaId ");
|
||||
return sql.toString();
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -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="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="60"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<property name="ireport.x" value="75"/>
|
||||
<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"/>
|
||||
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="columnHeader"/>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<parameter name="fecFinal" class="java.lang.String"/>
|
||||
<parameter name="TITULO" class="java.lang.String"/>
|
||||
<parameter name="isClassificaPorBanco" class="java.lang.Boolean"/>
|
||||
<parameter name="totalFechamento" class="java.math.BigDecimal"/>
|
||||
<queryString>
|
||||
<![CDATA[]]>
|
||||
</queryString>
|
||||
|
@ -27,6 +28,8 @@
|
|||
<field name="numpuntoventa" class="java.lang.String"/>
|
||||
<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>
|
||||
|
@ -45,8 +48,8 @@
|
|||
<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">
|
||||
<variableExpression><![CDATA[$V{TOTAL_FECHAMENTO}.subtract($V{TOTAL_DEPOSITOS})]]></variableExpression>
|
||||
<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>
|
||||
|
@ -201,7 +204,7 @@
|
|||
<reportElement uuid="695d6008-0322-46fd-9423-ec88ceaccdb9" x="349" y="0" width="68" height="20" isPrintWhenDetailOverflows="true">
|
||||
<printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression>
|
||||
</reportElement>
|
||||
<textElement textAlignment="Right">
|
||||
<textElement textAlignment="Right" verticalAlignment="Top">
|
||||
<font size="6" isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{VLFECHAMENTO_BANCO}]]></textFieldExpression>
|
||||
|
@ -369,7 +372,7 @@
|
|||
<font size="8" isBold="true"/>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{VLFECHAMENTO_BANCO}.subtract($V{DEPOSITO_BANCO})]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$F{vrpendente}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isStretchWithOverflow="true" pattern="¤ #,##0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="8b59222e-761c-4aba-9132-638c2b9932a9" stretchType="RelativeToTallestObject" x="485" y="0" width="70" height="17"/>
|
||||
|
@ -428,7 +431,7 @@
|
|||
<textElement>
|
||||
<paragraph lineSpacing="Single"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$V{TOTAL_FECHAMENTO}]]></textFieldExpression>
|
||||
<textFieldExpression><![CDATA[$P{totalFechamento}]]></textFieldExpression>
|
||||
</textField>
|
||||
<staticText>
|
||||
<reportElement uuid="d746843f-a730-4bbb-9520-80954166d840" x="0" y="52" width="100" height="20"/>
|
||||
|
|
|
@ -10,12 +10,16 @@ public class RelatorioDepositoBean implements Comparable {
|
|||
private BigDecimal saldo;
|
||||
private BigDecimal vrdeposito;
|
||||
private BigDecimal vrfechamento;
|
||||
private BigDecimal vrpendente;
|
||||
private Date dtmotivo;
|
||||
private String numdeposito;
|
||||
private String numpuntoventa;
|
||||
private String codigoInstFinanceira;
|
||||
private String nomeInstFinanceira;
|
||||
private Long fechamentocntcorrenteId;
|
||||
private Boolean somarPendente;
|
||||
private Integer puntoventaId;
|
||||
private Integer empresaId;
|
||||
|
||||
public String getCodigoInstFinanceira() {
|
||||
return codigoInstFinanceira;
|
||||
|
@ -58,13 +62,13 @@ public class RelatorioDepositoBean implements Comparable {
|
|||
this.nombempresa = nombempresa;
|
||||
}
|
||||
public BigDecimal getVrdeposito() {
|
||||
return vrdeposito;
|
||||
return vrdeposito != null ? vrdeposito : BigDecimal.ZERO;
|
||||
}
|
||||
public void setVrdeposito(BigDecimal vrdeposito) {
|
||||
this.vrdeposito = vrdeposito;
|
||||
}
|
||||
public BigDecimal getVrfechamento() {
|
||||
return vrfechamento;
|
||||
return vrfechamento != null ? vrfechamento : BigDecimal.ZERO;
|
||||
}
|
||||
public void setVrfechamento(BigDecimal vrfechamento) {
|
||||
this.vrfechamento = vrfechamento;
|
||||
|
@ -111,5 +115,37 @@ 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;
|
||||
}
|
||||
|
||||
public void setVrpendente(BigDecimal vrpendente) {
|
||||
this.vrpendente = vrpendente;
|
||||
}
|
||||
|
||||
public Integer getPuntoventaId() {
|
||||
return puntoventaId;
|
||||
}
|
||||
|
||||
public void setPuntoventaId(Integer puntoventaId) {
|
||||
this.puntoventaId = puntoventaId;
|
||||
}
|
||||
|
||||
public Integer getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
||||
public void setEmpresaId(Integer empresaId) {
|
||||
this.empresaId = empresaId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue