fixes bug#14151
dev:emerson qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@92210 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
55c1776a15
commit
a778ec6b6d
|
@ -9,6 +9,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioGratuidadeBean;
|
||||
|
@ -56,10 +57,9 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
String destino = parametros.get("destino") != null ? parametros.get("destino").toString() : "";
|
||||
String categoria = parametros.get("categoria") != null ? parametros.get("categoria").toString() : "";
|
||||
orgaoConcedenteId = parametros.get("orgao_concedente_id") != null ? (Integer) parametros.get("orgao_concedente_id") : null;
|
||||
|
||||
|
||||
Integer mcAlteracaoPoltrona = (Integer) (parametros.get("mcAlteracaoPoltrona") != null ? parametros.get("mcAlteracaoPoltrona") : null);
|
||||
|
||||
String sql = getSql(empresa, agencia, ruta, fecInicioViagem, fecFinalViagem, fecInicioVenda, fecFinalVenda, origem, destino, categoria);
|
||||
String sql = getSql(empresa, agencia, ruta, fecInicioViagem, fecFinalViagem, fecInicioVenda, fecFinalVenda, origem, destino, categoria, mcAlteracaoPoltrona);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
|
||||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||
|
@ -93,6 +93,10 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
if(orgaoConcedenteId != null && !orgaoConcedenteId.equals(-1)){
|
||||
stmt.setInt("orgao_concedente_id", orgaoConcedenteId);
|
||||
}
|
||||
if(mcAlteracaoPoltrona != null) {
|
||||
stmt.setInt("mcAlteracaoPoltrona", mcAlteracaoPoltrona);
|
||||
}
|
||||
stmt.setString("bpeEventoAlteracaoPoltrona", Constantes.BPE_ALTERACAO_POLTRONA);
|
||||
|
||||
ResultSet rset = null;
|
||||
|
||||
|
@ -161,7 +165,7 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
protected void processaParametros() throws Exception {
|
||||
}
|
||||
|
||||
private String getSql(String empresa, String agencia, String ruta, String fecInicioViagem, String fecFinalViagem, String fecInicioVenda, String fecFinalVenda, String origem, String destino, String categoria) {
|
||||
private String getSql(String empresa, String agencia, String ruta, String fecInicioViagem, String fecFinalViagem, String fecInicioVenda, String fecFinalVenda, String origem, String destino, String categoria, Integer mcAlteracaoPoltrona) {
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -293,11 +297,20 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
sb.append(" when c.indstatusboleto = 'C' and c.motivocancelacion_id = 32 then 'DEVOLVIDO' ");
|
||||
sb.append(" when c.indstatusboleto = 'C' and c.motivocancelacion_id = 37 then 'CANCEC. EMERG' ");
|
||||
sb.append(" when c.indstatusboleto = 'E' and c.indreimpresion = 1 then 'ENTREGUE' ");
|
||||
sb.append(" when (c.indstatusboleto = 'T' and c.motivocancelacion_id = 10 or c.tipoventa_id = 8) or (c.indstatusboleto = 'T' and c.motivocancelacion_id is null) then 'TROCA' ");
|
||||
sb.append(" when (c.indstatusboleto = 'T' and c.motivocancelacion_id = 10 or c.tipoventa_id = 8) ");
|
||||
sb.append(" or (c.indstatusboleto = 'T' and c.motivocancelacion_id is null and (bpe.tipoevento is null or bpe.tipoevento <> :bpeEventoAlteracaoPoltrona)) ");
|
||||
sb.append(" then 'TROCA' ");
|
||||
sb.append(" when c.indstatusboleto = 'T' and c.motivocancelacion_id is null and bpe.tipoevento = :bpeEventoAlteracaoPoltrona then 'TROCA POLTRONA' ");
|
||||
sb.append(" when c.indstatusboleto = 'T' and c.tipoventa_id = 81 or c.tipoventa_id = 81 then 'TRANSFERÊNCIA' " );
|
||||
sb.append(" when c.indstatusboleto = 'T' and c.tipoventa_id = 82 then 'CONFIRM.ABERTO' " );
|
||||
sb.append(" when c.indstatusboleto = 'C' and c.motivocancelacion_id = 10 then 'TROCA PASSAGEM' " );
|
||||
|
||||
if(mcAlteracaoPoltrona != null) {
|
||||
sb.append(" when c.indstatusboleto = 'C' and c.indreimpresion = 1 and c.motivocancelacion_id = :mcAlteracaoPoltrona then 'POLTRONA ALTERADA' ");
|
||||
}
|
||||
|
||||
sb.append(" when c.indstatusboleto = 'T' and c.tipoventa_id = 41 then 'CHECKIN REATIVADO' end as indstatusboleto, ");
|
||||
|
||||
sb.append(" ori.cveparada codorigem,");
|
||||
sb.append(" des.cveparada coddestino");
|
||||
sb.append(" FROM caja c");
|
||||
|
@ -317,8 +330,18 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
sb.append(" AND tar.destino_id = c.destino_id and tar.activo = 1)");
|
||||
sb.append(" JOIN empresa e ON e.empresa_id = c.empresacorrida_id");
|
||||
sb.append(" JOIN orgao_concedente og ON og.orgaoconcedente_id = tar.orgaoconcedente_id");
|
||||
sb.append(" WHERE 1=1 and (c.motivocancelacion_id IN (31,32,37,10) OR c.motivocancelacion_id IS NULL) ");
|
||||
sb.append(" AND (c.indreimpresion = 0 OR (c.indstatusboleto IN ('E','T') AND c.indreimpresion = 1))");
|
||||
sb.append(" LEFT JOIN bpe bpe on bpe.boleto_id = c.transacao_id ");
|
||||
sb.append(" WHERE 1=1 ");
|
||||
sb.append(" and (c.motivocancelacion_id IN (");
|
||||
sb.append(carregarMotivosCancelacion(mcAlteracaoPoltrona));
|
||||
sb.append(") OR c.motivocancelacion_id IS NULL) ");
|
||||
|
||||
if(mcAlteracaoPoltrona != null) {
|
||||
sb.append(" AND (c.indreimpresion = 0 OR (c.indstatusboleto IN ('E','T') AND c.indreimpresion = 1) OR (c.indstatusboleto = 'C' AND c.indreimpresion = 1 AND c.motivocancelacion_id = :mcAlteracaoPoltrona)) ");
|
||||
} else {
|
||||
sb.append(" AND (c.indreimpresion = 0 OR (c.indstatusboleto IN ('E','T') AND c.indreimpresion = 1))");
|
||||
}
|
||||
|
||||
if (fecInicioViagem != null && fecFinalViagem != null) {
|
||||
sb.append(" AND c.feccorrida BETWEEN :fecInicioViagem AND :fecFinalViagem ");
|
||||
}
|
||||
|
@ -351,4 +374,18 @@ public class RelatorioGratuidade extends Relatorio {
|
|||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String carregarMotivosCancelacion(Integer mcAlteracaoPoltrona) {
|
||||
List<Integer> motivosCancelacion = new ArrayList<Integer>();
|
||||
motivosCancelacion.add(31);
|
||||
motivosCancelacion.add(32);
|
||||
motivosCancelacion.add(37);
|
||||
motivosCancelacion.add(10);
|
||||
|
||||
if(mcAlteracaoPoltrona != null) {
|
||||
motivosCancelacion.add(mcAlteracaoPoltrona);
|
||||
}
|
||||
|
||||
return motivosCancelacion.toString().replaceAll("[\\[\\]]", "");
|
||||
}
|
||||
}
|
|
@ -17,8 +17,10 @@ import org.zkoss.zk.ui.Component;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zul.Datebox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
|
@ -27,6 +29,7 @@ import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidade;
|
|||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.MotivoCancelacionService;
|
||||
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
|
||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||
|
@ -50,6 +53,8 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
private RutaService rutaService;
|
||||
@Autowired
|
||||
private OrgaoConcedenteService orgaocConcedenteService;
|
||||
@Autowired
|
||||
private MotivoCancelacionService motivoCancelacionService;
|
||||
|
||||
private Datebox datInicialViagem;
|
||||
private Datebox datFinalViagem;
|
||||
|
@ -201,6 +206,8 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
parametros.put("TITULO", Labels.getLabel("relatorioGratuidadeController.window.title"));
|
||||
|
||||
carregarParametroMotivoCancelamentoAlteracaoPoltrona(parametros);
|
||||
|
||||
Relatorio relatorio = new RelatorioGratuidade(parametros, dataSourceRead.getConnection());
|
||||
|
||||
|
@ -212,6 +219,13 @@ public class RelatorioGratuidadeController extends MyGenericForwardComposer {
|
|||
|
||||
}
|
||||
|
||||
private void carregarParametroMotivoCancelamentoAlteracaoPoltrona(Map<String, Object> parametros) {
|
||||
MotivoCancelacion motivoCancelacion = motivoCancelacionService.findByCveSistema(Constantes.CVESISTEMA_MOTIVO_CANCELAMENTO_ALTERACAO_POLTRONA);
|
||||
if(motivoCancelacion != null) {
|
||||
parametros.put("mcAlteracaoPoltrona", motivoCancelacion.getMotivocancelacionId());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
|
||||
executarRelatorio();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue