Relatório de vendas de comissão.
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@67344 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
deb689494f
commit
23762ecae0
|
@ -33,13 +33,14 @@ public class RelatorioVendasComissao extends Relatorio {
|
||||||
private Timestamp fecFinal;
|
private Timestamp fecFinal;
|
||||||
private Integer empresaId;
|
private Integer empresaId;
|
||||||
private Boolean apenasCancelados;
|
private Boolean apenasCancelados;
|
||||||
private PuntoVenta puntoVenta;
|
private String stringLsPuntoVentaId;
|
||||||
|
|
||||||
public RelatorioVendasComissao(Map<String, Object> parametros, Connection conexao) throws Exception {
|
public RelatorioVendasComissao(Map<String, Object> parametros, Connection conexao) throws Exception {
|
||||||
super(parametros, conexao);
|
super(parametros, conexao);
|
||||||
|
|
||||||
this.setCustomDataSource(new DataSource(this) {
|
this.setCustomDataSource(new DataSource(this) {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void initDados() throws Exception {
|
public void initDados() throws Exception {
|
||||||
Map<String, Object> parametros = this.relatorio.getParametros();
|
Map<String, Object> parametros = this.relatorio.getParametros();
|
||||||
|
@ -50,13 +51,16 @@ public class RelatorioVendasComissao extends Relatorio {
|
||||||
}
|
}
|
||||||
apenasCancelados = (Boolean) parametros.get("apenasCancelados");
|
apenasCancelados = (Boolean) parametros.get("apenasCancelados");
|
||||||
|
|
||||||
Object puntoVentaParam = parametros.get("puntoVenta");
|
List<PuntoVenta> lsPuntoVentaParam = (List<PuntoVenta>) parametros.get("lsPuntoVenta");
|
||||||
if (puntoVentaParam != null) {
|
List<String> lsNombPuntoVenta = new ArrayList<String>();
|
||||||
puntoVenta = (PuntoVenta) puntoVentaParam;
|
List<String> lsPuntoVentaId = new ArrayList<String>();
|
||||||
parametros.put("nombPuntoVenta", puntoVenta.getNombpuntoventa());
|
for (PuntoVenta puntoVenta : lsPuntoVentaParam) {
|
||||||
} else {
|
lsPuntoVentaId.add("'" + String.valueOf(puntoVenta.getPuntoventaId()) + "'");
|
||||||
parametros.put("nombPuntoVenta", "Todas;");
|
lsNombPuntoVenta.add(puntoVenta.getNombpuntoventa());
|
||||||
}
|
}
|
||||||
|
stringLsPuntoVentaId = StringUtils.join(lsPuntoVentaId.toArray(new String[0]), ',');
|
||||||
|
String nombPuntoVenta = !lsNombPuntoVenta.isEmpty() ? StringUtils.join(lsNombPuntoVenta.toArray(new String[0]), ',') : "Todas;";
|
||||||
|
parametros.put("nombPuntoVenta", nombPuntoVenta);
|
||||||
|
|
||||||
Connection conexao = this.relatorio.getConexao();
|
Connection conexao = this.relatorio.getConexao();
|
||||||
processarVendasComissao(conexao);
|
processarVendasComissao(conexao);
|
||||||
|
@ -219,9 +223,6 @@ public class RelatorioVendasComissao extends Relatorio {
|
||||||
if(empresaId != null){
|
if(empresaId != null){
|
||||||
stmt.setInt("EMPRESA_ID", empresaId);
|
stmt.setInt("EMPRESA_ID", empresaId);
|
||||||
}
|
}
|
||||||
if (puntoVenta != null) {
|
|
||||||
stmt.setInt("puntoVentaId", puntoVenta.getPuntoventaId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return stmt;
|
return stmt;
|
||||||
}
|
}
|
||||||
|
@ -240,8 +241,8 @@ public class RelatorioVendasComissao extends Relatorio {
|
||||||
.append("OR (C.INDSTATUSBOLETO = 'T' AND C.INDREIMPRESION = 0) ")
|
.append("OR (C.INDSTATUSBOLETO = 'T' AND C.INDREIMPRESION = 0) ")
|
||||||
.append("OR (C.INDCANCELACION = 1 AND C.INDSTATUSBOLETO = 'C')) ");
|
.append("OR (C.INDCANCELACION = 1 AND C.INDSTATUSBOLETO = 'C')) ");
|
||||||
|
|
||||||
if (puntoVenta != null) {
|
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
|
||||||
sQuery.append("AND C.PUNTOVENTA_ID = :puntoVentaId ");
|
sQuery.append("AND C.PUNTOVENTA_ID IN(" + stringLsPuntoVentaId + ") ");
|
||||||
}
|
}
|
||||||
|
|
||||||
sQuery.append("AND C.FECHORVENTA BETWEEN :fecInicio AND :fecFinal ");
|
sQuery.append("AND C.FECHORVENTA BETWEEN :fecInicio AND :fecFinal ");
|
||||||
|
@ -262,7 +263,7 @@ public class RelatorioVendasComissao extends Relatorio {
|
||||||
.append("(COALESCE (C.PRECIOPAGADO,0) + COALESCE (C.IMPORTETAXAEMBARQUE,0) + COALESCE (C.IMPORTESEGURO,0) + COALESCE (C.IMPORTEPEDAGIO,0) + COALESCE (C.IMPORTEOUTROS,0)) AS TOTAL ")
|
.append("(COALESCE (C.PRECIOPAGADO,0) + COALESCE (C.IMPORTETAXAEMBARQUE,0) + COALESCE (C.IMPORTESEGURO,0) + COALESCE (C.IMPORTEPEDAGIO,0) + COALESCE (C.IMPORTEOUTROS,0)) AS TOTAL ")
|
||||||
.append("FROM CAJA C ")
|
.append("FROM CAJA C ")
|
||||||
.append("JOIN MARCA M ON M.MARCA_ID = C.MARCA_ID ")
|
.append("JOIN MARCA M ON M.MARCA_ID = C.MARCA_ID ")
|
||||||
.append("JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PUNTOVENTA_ID ")
|
.append("JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PTOVTAVENTA_ID ")
|
||||||
.append("WHERE C.INDSTATUSBOLETO = 'C' ")
|
.append("WHERE C.INDSTATUSBOLETO = 'C' ")
|
||||||
.append("AND ((C.MOTIVOCANCELACION_ID IN(32, 10) AND C.INDREIMPRESION = 0) ")
|
.append("AND ((C.MOTIVOCANCELACION_ID IN(32, 10) AND C.INDREIMPRESION = 0) ")
|
||||||
.append("OR (C.MOTIVOCANCELACION_ID = 99 AND C.INDREIMPRESION = 1)) ");
|
.append("OR (C.MOTIVOCANCELACION_ID = 99 AND C.INDREIMPRESION = 1)) ");
|
||||||
|
@ -272,8 +273,8 @@ public class RelatorioVendasComissao extends Relatorio {
|
||||||
sQuery.append("AND M.EMPRESA_ID =:EMPRESA_ID ");
|
sQuery.append("AND M.EMPRESA_ID =:EMPRESA_ID ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (puntoVenta != null) {
|
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
|
||||||
sQuery.append("AND C.PUNTOVENTA_ID = :puntoVentaId ");
|
sQuery.append("AND C.PTOVTAVENTA_ID IN(" + stringLsPuntoVentaId + ") ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sQuery.toString();
|
return sQuery.toString();
|
||||||
|
|
Loading…
Reference in New Issue