fixes bug#0012396
dev: wallace qua: renato git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@86252 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
267716e704
commit
d9f3f91a48
|
@ -79,6 +79,7 @@ public class RelatorioHistoricoCompras extends Relatorio {
|
|||
stmt.setTimestamp("dt_embarque_inicio", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("dtEmbarqueInicial")).getTime()));
|
||||
stmt.setTimestamp("dt_embarque_fim", new Timestamp(DateUtil.fimFecha((Date) parametros.get("dtEmbarqueFinal")).getTime()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getSql(Map<String, Object> parametros) {
|
||||
|
@ -109,6 +110,7 @@ public class RelatorioHistoricoCompras extends Relatorio {
|
|||
sql.append(" INNER JOIN cliente cli ON ca.clientecomprador_id = cli.cliente_id ");
|
||||
sql.append(" INNER JOIN usuario u ON ca.usuario_id = u.usuario_id ");
|
||||
sql.append(" INNER JOIN punto_venta pv ON ca.puntoventa_id = pv.puntoventa_id ");
|
||||
sql.append(" INNER JOIN ruta r on ca.ruta_id = r.ruta_id ");
|
||||
sql.append(" LEFT JOIN parada o ON ca.origen_id = o.parada_id ");
|
||||
sql.append(" LEFT JOIN parada d ON ca.destino_id = d.parada_id ");
|
||||
|
||||
|
@ -120,14 +122,13 @@ public class RelatorioHistoricoCompras extends Relatorio {
|
|||
sql.append(" WHERE ca.fechorventa_h BETWEEN :dt_venda_inicio and :dt_venda_fim ");
|
||||
} else {
|
||||
sql.append(" WHERE ca.fechorviaje BETWEEN :dt_embarque_inicio and :dt_embarque_fim ");
|
||||
|
||||
}
|
||||
|
||||
if (parametros.get("puntoVentaId") != null) {
|
||||
sql.append(" and pv.puntoventa_id in("+parametros.get("puntoVentaId")+") ");
|
||||
}
|
||||
if (parametros.get("rutaId") != null) {
|
||||
sql.append(" and ca.ruta_id in("+parametros.get("rutaId")+") ");
|
||||
if (parametros.get("numRuta") != null) {
|
||||
sql.append(" and r.numruta in ("+obtemIdsParametrizadosParaString(parametros.get("numRuta").toString())+ ") ");
|
||||
}
|
||||
if (parametros.get("clienteId") != null) {
|
||||
sql.append(" and cli.cliente_id in("+parametros.get("clienteId")+") ");
|
||||
|
@ -135,6 +136,24 @@ public class RelatorioHistoricoCompras extends Relatorio {
|
|||
sql.append("order by ca.fechorventa_h");
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
public String obtemIdsParametrizadosParaString(String parametro) {
|
||||
String[] ids = parametro.split(", ");
|
||||
StringBuilder retorno = new StringBuilder();
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (isIntermediario(ids, i)) {
|
||||
retorno.append(", ");
|
||||
}
|
||||
retorno.append("'");
|
||||
retorno.append(ids[i]);
|
||||
retorno.append("'");
|
||||
}
|
||||
return retorno.toString();
|
||||
}
|
||||
|
||||
private boolean isIntermediario(String[] ids, int i) {
|
||||
return (i > 0) && (i != ids.length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.zkoss.zul.Paging;
|
|||
|
||||
import com.rjconsultores.ventaboletos.entidad.Cliente;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioHistoricoCompras;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.PagedListCliente;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.PagedListGenerico;
|
||||
|
@ -26,6 +25,7 @@ import com.rjconsultores.ventaboletos.relatorios.utilitarios.PagedListPuntoVenta
|
|||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ValidarDatas;
|
||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||
import com.rjconsultores.ventaboletos.vo.ruta.RutaVO;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
|
@ -117,7 +117,7 @@ public class RelatorioHistoricoComprasController extends MyGenericForwardCompose
|
|||
}
|
||||
|
||||
public void onClick$btnPesquisaLinha(Event ev) {
|
||||
linhaList.setData(rutaService.buscaRuta(txtPalavraPesquisaLinha.getText()));
|
||||
linhaList.setData(rutaService.buscaRutaPorNumeroSemDadoRepetido(txtPalavraPesquisaLinha.getText()));
|
||||
PagedListGenerico.validarPagedListSemRegistro(linhaList, TITULO_RELATORIO);
|
||||
}
|
||||
|
||||
|
@ -126,11 +126,11 @@ public class RelatorioHistoricoComprasController extends MyGenericForwardCompose
|
|||
}
|
||||
|
||||
public void onDoubleClick$linhaSelList(Event ev) {
|
||||
linhaSelList.removeItem((Ruta) linhaSelList.getSelected());
|
||||
linhaSelList.removeItem((RutaVO) linhaSelList.getSelected());
|
||||
}
|
||||
|
||||
public void onDoubleClick$linhaList(Event ev) {
|
||||
PagedListGenerico.validarInclusaoLista((Ruta) linhaList.getSelected(), linhaSelList);
|
||||
PagedListGenerico.validarInclusaoLista((RutaVO) linhaList.getSelected(), linhaSelList);
|
||||
}
|
||||
|
||||
public void onClick$btnPesquisaCpf(Event ev) {
|
||||
|
@ -186,9 +186,9 @@ public class RelatorioHistoricoComprasController extends MyGenericForwardCompose
|
|||
}
|
||||
|
||||
private void getParametroLinha(Map<String, Object> parametros) {
|
||||
EspecializaLista<Ruta> especializaLista = new EspecializaLista<Ruta>(Ruta.class, linhaSelList, "getRutaId");
|
||||
EspecializaLista<RutaVO> especializaLista = new EspecializaLista<RutaVO>(RutaVO.class, linhaSelList, "getNumRuta");
|
||||
if (!especializaLista.getLista().isEmpty()) {
|
||||
parametros.put("rutaId", especializaLista.obtemIds());
|
||||
parametros.put("numRuta", especializaLista.obtemIds());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.util.List;
|
|||
import org.zkoss.zul.Listcell;
|
||||
import org.zkoss.zul.Listitem;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.vo.ruta.RutaVO;
|
||||
|
||||
public class RenderRutaPersonalizado extends RenderPersonalizado<Ruta> {
|
||||
|
||||
|
@ -18,8 +18,18 @@ public class RenderRutaPersonalizado extends RenderPersonalizado<Ruta> {
|
|||
@Override
|
||||
protected void incluirColunasRender(Listitem item, Object objeto) throws IllegalAccessException, InvocationTargetException {
|
||||
super.incluirColunasRender(item, objeto);
|
||||
OrgaoConcedente orgaoConcedente = ((Ruta)objeto).getOrgaoConcedente();
|
||||
Listcell lc = orgaoConcedente != null ? new Listcell(orgaoConcedente.getDescOrgao()) : new Listcell("-");
|
||||
Listcell lc = new Listcell(getOrgaoConcedente(objeto));
|
||||
lc.setParent(item);
|
||||
}
|
||||
|
||||
private String getOrgaoConcedente(Object objeto) {
|
||||
try {
|
||||
if (objeto instanceof RutaVO) {
|
||||
return ((RutaVO)objeto).getOrgaoConcedente();
|
||||
}
|
||||
return ((Ruta)objeto).getOrgaoConcedente().getDescOrgao();
|
||||
} catch (NullPointerException e) {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue