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 Integer empresaId;
|
||||
private Boolean apenasCancelados;
|
||||
private PuntoVenta puntoVenta;
|
||||
private String stringLsPuntoVentaId;
|
||||
|
||||
public RelatorioVendasComissao(Map<String, Object> parametros, Connection conexao) throws Exception {
|
||||
super(parametros, conexao);
|
||||
|
||||
this.setCustomDataSource(new DataSource(this) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initDados() throws Exception {
|
||||
Map<String, Object> parametros = this.relatorio.getParametros();
|
||||
|
@ -50,13 +51,16 @@ public class RelatorioVendasComissao extends Relatorio {
|
|||
}
|
||||
apenasCancelados = (Boolean) parametros.get("apenasCancelados");
|
||||
|
||||
Object puntoVentaParam = parametros.get("puntoVenta");
|
||||
if (puntoVentaParam != null) {
|
||||
puntoVenta = (PuntoVenta) puntoVentaParam;
|
||||
parametros.put("nombPuntoVenta", puntoVenta.getNombpuntoventa());
|
||||
} else {
|
||||
parametros.put("nombPuntoVenta", "Todas;");
|
||||
List<PuntoVenta> lsPuntoVentaParam = (List<PuntoVenta>) parametros.get("lsPuntoVenta");
|
||||
List<String> lsNombPuntoVenta = new ArrayList<String>();
|
||||
List<String> lsPuntoVentaId = new ArrayList<String>();
|
||||
for (PuntoVenta puntoVenta : lsPuntoVentaParam) {
|
||||
lsPuntoVentaId.add("'" + String.valueOf(puntoVenta.getPuntoventaId()) + "'");
|
||||
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();
|
||||
processarVendasComissao(conexao);
|
||||
|
@ -77,7 +81,7 @@ public class RelatorioVendasComissao extends Relatorio {
|
|||
NamedParameterStatement stmt = null;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
/* Processando vendas normais */
|
||||
stmt = carregarNamedParameterStatement(conexao);
|
||||
rset = stmt.executeQuery();
|
||||
|
@ -219,9 +223,6 @@ public class RelatorioVendasComissao extends Relatorio {
|
|||
if(empresaId != null){
|
||||
stmt.setInt("EMPRESA_ID", empresaId);
|
||||
}
|
||||
if (puntoVenta != null) {
|
||||
stmt.setInt("puntoVentaId", puntoVenta.getPuntoventaId());
|
||||
}
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
@ -240,8 +241,8 @@ public class RelatorioVendasComissao extends Relatorio {
|
|||
.append("OR (C.INDSTATUSBOLETO = 'T' AND C.INDREIMPRESION = 0) ")
|
||||
.append("OR (C.INDCANCELACION = 1 AND C.INDSTATUSBOLETO = 'C')) ");
|
||||
|
||||
if (puntoVenta != null) {
|
||||
sQuery.append("AND C.PUNTOVENTA_ID = :puntoVentaId ");
|
||||
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
|
||||
sQuery.append("AND C.PUNTOVENTA_ID IN(" + stringLsPuntoVentaId + ") ");
|
||||
}
|
||||
|
||||
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("FROM CAJA C ")
|
||||
.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("AND ((C.MOTIVOCANCELACION_ID IN(32, 10) AND C.INDREIMPRESION = 0) ")
|
||||
.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 ");
|
||||
}
|
||||
|
||||
if (puntoVenta != null) {
|
||||
sQuery.append("AND C.PUNTOVENTA_ID = :puntoVentaId ");
|
||||
if (StringUtils.isNotBlank(stringLsPuntoVentaId)) {
|
||||
sQuery.append("AND C.PTOVTAVENTA_ID IN(" + stringLsPuntoVentaId + ") ");
|
||||
}
|
||||
|
||||
return sQuery.toString();
|
||||
|
|
Loading…
Reference in New Issue