alexandre.lima 2017-07-14 19:12:24 +00:00
parent 8ae0c20638
commit 9abc231d79
8 changed files with 262 additions and 100 deletions

View File

@ -4,15 +4,9 @@
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.SeguroKm;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTaxaEmbarqueOrgao;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
@ -24,6 +18,15 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.SeguroKm;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.SeguroPorIntervalo;
/**
*
* @author Administrador
@ -37,6 +40,15 @@ public class BusquedaSeguroKmController extends MyGenericForwardComposer {
private MyListbox seguroKmList;
private Paging pagingSeguroKm;
private Textbox txtOrgao;
private boolean exibeTpp;
public Textbox getTxtOrgao() {
return txtOrgao;
}
public void setTxtOrgao(Textbox txtOrgao) {
this.txtOrgao = txtOrgao;
}
public Paging getPagingSeguroKm() {
return pagingSeguroKm;
@ -65,8 +77,9 @@ public class BusquedaSeguroKmController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
exibeTpp = ApplicationProperties.getInstance().exibeTpp();
seguroKmList.setItemRenderer(new RenderTaxaEmbarqueOrgao());
seguroKmList.setItemRenderer(new SeguroPorIntervalo());
seguroKmList.addEventListener("onDoubleClick", new EventListener() {
@Override
@ -91,10 +104,16 @@ public class BusquedaSeguroKmController extends MyGenericForwardComposer {
// args.put("seguroKm", null);
args.put("seguroKmList", seguroKmList);
if (!exibeTpp) {
openWindow("/gui/tarifas/editarSeguroKm.zul",
Labels.getLabel("busquedaSeguroKmController.semTpp.window.title"),
args, MODAL);
} else {
openWindow("/gui/tarifas/editarSeguroKm.zul",
Labels.getLabel("busquedaSeguroKmController.window.title"),
args, MODAL);
}
}
private void refreshLista() {
@ -102,18 +121,14 @@ public class BusquedaSeguroKmController extends MyGenericForwardComposer {
new HibernateSearchObject<OrgaoConcedente>(OrgaoConcedente.class,
pagingSeguroKm.getPageSize());
seguroKmBusqueda.addFilterEqual("activo", Boolean.TRUE);
if (!txtOrgao.getValue().equals("")) {
seguroKmBusqueda.addFilterLike("descOrgao",
"%" + txtOrgao.getText().trim().concat("%"));
seguroKmBusqueda.addFilterLike("descOrgao", "%" + txtOrgao.getText().trim().concat("%"));
}
seguroKmBusqueda.addSortAsc("descOrgao");
plwOrgao.init(seguroKmBusqueda, seguroKmList, pagingSeguroKm);
if (seguroKmList.getData().length == 0) {
@ -148,8 +163,14 @@ public class BusquedaSeguroKmController extends MyGenericForwardComposer {
args.put("seguroKm", tx);
args.put("seguroKmList", seguroKmList);
if (!exibeTpp) {
openWindow("/gui/tarifas/editarSeguroKm.zul",
Labels.getLabel("busquedaSeguroKmController.semTpp.window.title"),
args, MODAL);
} else {
openWindow("/gui/tarifas/editarSeguroKm.zul",
Labels.getLabel("busquedaSeguroKmController.window.title"),
args, MODAL);
}
}
}

View File

@ -22,6 +22,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zkplus.databind.BindingListModelList;
import org.zkoss.zul.Button;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Categoria;
@ -48,6 +49,7 @@ import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
import com.rjconsultores.ventaboletos.service.UsuarioService;
import com.rjconsultores.ventaboletos.service.ViaService;
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@ -126,6 +128,7 @@ public class BusquedaTarifaController extends MyGenericForwardComposer {
private Parada destino;
private Ruta ruta;
private Via via;
private Listheader listheaderTPP;
private final String PERMISSAO_EXCLUIR_TODAS_PESQUISA = "COM.RJCONSULTORES.VENTABOLETOS.GUI.ADM.PRECO.EXCLUIR.TODAS.PESQUISA";
@ -338,7 +341,7 @@ public class BusquedaTarifaController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
listheaderTPP.setVisible(ApplicationProperties.getInstance().exibeTpp());
this.
cmbMarca.addEventListener("onChange", new EventListener() {
@Override

View File

@ -21,6 +21,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Paging;
import org.zkoss.zul.Textbox;
@ -35,6 +36,7 @@ import com.rjconsultores.ventaboletos.service.ClaseServicioService;
import com.rjconsultores.ventaboletos.service.MarcaService;
import com.rjconsultores.ventaboletos.service.MonedaService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@ -88,6 +90,7 @@ public class BusquedaTarifaOficialController extends MyGenericForwardComposer {
private Combobox cmbMoneda;
private Combobox cmbVigenciaTarifaOficial;
private MyListbox tarifaList;
private Listheader listheaderTPP;
private static final Logger log = Logger.getLogger(BusquedaTarifaOficialController.class);
@ -202,6 +205,7 @@ public class BusquedaTarifaOficialController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
listheaderTPP.setVisible(ApplicationProperties.getInstance().exibeTpp());
tarifaList.setItemRenderer(new RenderTarifaOficial());
tarifaList.addEventListener("onDoubleClick", new EventListener() {

View File

@ -6,7 +6,6 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
@ -16,14 +15,15 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Row;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -54,14 +54,19 @@ public class CopiarTarifaOficialController extends MyGenericForwardComposer {
private Radio rdComTarifa;
private Radio rdComTaxaEmbarque;
private Radio rdComSeguro;
private Radio rdComTPP;
private Row exibeTPP;
@Override
public void doAfterCompose(Component comp) throws Exception {
lsVigenciaTarifa = vigenciaTarifaService.obtenerTodos();
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
lsOrgao = orgaoConcedenteService.obtenerTodosExceto(-1);
super.doAfterCompose(comp);
if (!ApplicationProperties.getInstance().exibeTpp()) {
exibeTPP.setVisible(false);
}
}
public void onClick$btnGenerarVigencia(Event ev) throws InterruptedException {
@ -71,11 +76,12 @@ public class CopiarTarifaOficialController extends MyGenericForwardComposer {
Boolean calculaTarifa = (rdComTarifa.getValue() == null) ? Boolean.FALSE : rdComTarifa.isChecked();
Boolean calculaTaxaEmbarque = (rdComTaxaEmbarque.getValue() == null) ? Boolean.FALSE : rdComTaxaEmbarque.isChecked();
Boolean calculaSeguro = (rdComSeguro.getValue() == null) ? Boolean.FALSE : rdComSeguro.isChecked();
Boolean calculaTPP = (rdComTPP.getValue() == null) ? Boolean.FALSE : rdComTPP.isChecked();
Empresa empresaSelecionada = cmbEmpresa.getSelectedItem() != null ? (Empresa) cmbEmpresa.getSelectedItem().getValue() : null;
OrgaoConcedente orgaoConcedenteSelecionado = cmbOrgao.getSelectedItem() != null ? (OrgaoConcedente) cmbOrgao.getSelectedItem().getValue() : null;
tarifaOficialService.copiarParaTarifa((VigenciaTarifa) cmbVigencia.getSelectedItem().getValue(),
calculaPedagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro, empresaSelecionada, orgaoConcedenteSelecionado);
calculaPedagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro, calculaTPP, empresaSelecionada, orgaoConcedenteSelecionado);
Messagebox.show(Labels.getLabel("copiarTarifaOficialController.MSG.copiaOK"),
Labels.getLabel("indexController.mniGenerarTarifaOrgao.label"),

View File

@ -4,11 +4,8 @@
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.apache.log4j.Logger;
@ -21,17 +18,23 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Button;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Row;
import com.rjconsultores.ventaboletos.constantes.TipoSeguro;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.SeguroKm;
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.SeguroKmService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderSeguroKm;
import org.zkoss.zul.Intbox;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderSeguroSemTpp;
/**
*
@ -50,12 +53,76 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
private List<SeguroKm> lsSeguroKm;
private List<OrgaoConcedente> lsOrgaoConcedente;
private MyListbox seguroKmList;
private MyListbox seguroKmListTpm;
private MyComboboxEstandar cmbOrgao;
private Button btnApagar;
private Button btnAdicionarSeguroKm;
private Intbox txtKm;
private Intbox txtKmSemTpp;
private MyTextboxDecimal txtValor;
private static Logger log = Logger.getLogger(EditarSeguroKmController.class);
private Combobox cmbTipoSeguro;
private List<TipoSeguro> lsTipoSeguro = new ArrayList<TipoSeguro>();
private Boolean exibeTpp;
private Row rowExibeTpp;
private Row columTpp;
private Row columSemTpp;
public SeguroKmService getSeguroKmService() {
return seguroKmService;
}
public void setSeguroKmService(SeguroKmService seguroKmService) {
this.seguroKmService = seguroKmService;
}
public MyListbox getSeguroKmListTpm() {
return seguroKmListTpm;
}
public void setSeguroKmListTpm(MyListbox seguroKmListTpm) {
this.seguroKmListTpm = seguroKmListTpm;
}
public Intbox getTxtKm() {
return txtKm;
}
public void setTxtKm(Intbox txtKm) {
this.txtKm = txtKm;
}
public MyTextboxDecimal getTxtValor() {
return txtValor;
}
public void setTxtValor(MyTextboxDecimal txtValor) {
this.txtValor = txtValor;
}
public Row getRowExibeTpp() {
return rowExibeTpp;
}
public void setRowExibeTpp(Row rowExibeTpp) {
this.rowExibeTpp = rowExibeTpp;
}
public Combobox getCmbTipoSeguro() {
return cmbTipoSeguro;
}
public void setCmbTipoSeguro(Combobox cmbTipoSeguro) {
this.cmbTipoSeguro = cmbTipoSeguro;
}
public List<TipoSeguro> getLsTipoSeguro() {
return lsTipoSeguro;
}
public void setLsTipoSeguro(List<TipoSeguro> lsTipoSeguro) {
this.lsTipoSeguro = lsTipoSeguro;
}
public Button getBtnApagar() {
return btnApagar;
@ -107,24 +174,48 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
exibeTpp = ApplicationProperties.getInstance().exibeTpp();
lsOrgaoConcedente = orgaoConcedenteService.obtenerTodos();
super.doAfterCompose(comp);
lsTipoSeguro.add(TipoSeguro.SEGURO);
lsTipoSeguro.add(TipoSeguro.TPP);
orgao = (OrgaoConcedente) Executions.getCurrent().getArg().get("orgao");
//seguroKm = (SeguroKm) Executions.getCurrent().getArg().get("seguroKm");
seguroKmList.setItemRenderer(new RenderSeguroKm());
seguroKmListTpm.setItemRenderer(new RenderSeguroSemTpp());
lsSeguroKm = new ArrayList<SeguroKm>();
if (orgao != null
&& orgao.getOrgaoConcedenteId() != null) {
lsSeguroKm = seguroKmService.buscarPorOrgao(orgao);
seguroKmList.setData(lsSeguroKm);
seguroKmListTpm.setData(lsSeguroKm);
cmbOrgao.setDisabled(Boolean.TRUE);
cmbOrgao.setValue(orgao.getDescOrgao());
}
if (!exibeTpp) {
seguroKmList.setVisible(true);
seguroKmListTpm.setVisible(false);
rowExibeTpp.setVisible(false);
columTpp.setVisible(true);
columSemTpp.setVisible(false);
txtKm.setVisible(true);
txtKmSemTpp.setVisible(false);
} else {
seguroKmList.setVisible(false);
seguroKmListTpm.setVisible(true);
rowExibeTpp.setVisible(true);
columTpp.setVisible(false);
columSemTpp.setVisible(true);
txtKm.setVisible(false);
txtKmSemTpp.setVisible(true);
}
}
public void onClick$btnSalvar(Event ev) throws InterruptedException {
@ -161,49 +252,19 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
}
}
// public void onClick$btnApagar(Event ev) throws InterruptedException {
// try {
// int resp = Messagebox.show(
// Labels.getLabel("editarSeguroKmController.MSG.borrarPergunta"),
// Labels.getLabel("editarSeguroKmController.window.title"),
// Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
//
// if (resp == Messagebox.YES) {
//
// seguroKmService.borrar(seguroKm);
//
// Messagebox.show(
// Labels.getLabel("editarSeguroKmController.MSG.borrarOK"),
// Labels.getLabel("editarSeguroKmController.window.title"),
// Messagebox.OK, Messagebox.INFORMATION);
//
// seguroKmList.removeItem(seguroKm);
//
// closeWindow();
// }
// } catch (Exception ex) {
// log.error(ex);
// Messagebox.show(
// Labels.getLabel("MSG.Error"),
// Labels.getLabel("editarSeguroKmController.window.title"),
// Messagebox.OK, Messagebox.ERROR);
// }
// }
public void onClick$btnAdicionarSeguroKm(Event ev) throws InterruptedException {
cmbOrgao.getValue();
txtKm.getValue();
txtValor.getValue();
if (lsSeguroKm.isEmpty()) {
lsSeguroKm = seguroKmService.buscarPorOrgao((OrgaoConcedente) cmbOrgao.getSelectedItem().getValue());
seguroKmList.setData(lsSeguroKm);
seguroKmListTpm.setData(lsSeguroKm);
}
//ChecandoDuplicado
boolean existe = false;
for (SeguroKm km : lsSeguroKm) {
if (km.getKmate().equals(txtKm.getValue())) {
if ((txtKm.isVisible() && km.getKmate().equals(txtKm.getValue())) || (txtKmSemTpp.isVisible() && km.getKmate().equals(txtKmSemTpp.getValue()))) {
existe = true;
}
}
@ -219,7 +280,12 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
SeguroKm km = new SeguroKm();
km.setOrgaoconcedente((OrgaoConcedente) cmbOrgao.getSelectedItem().getValue());
km.setTipoSeguro(cmbTipoSeguro.getSelectedItem() != null ? cmbTipoSeguro.getSelectedItem().getLabel() : TipoSeguro.SEGURO.toString());
if (!exibeTpp) {
km.setKmate(txtKm.getValue());
} else {
km.setKmate(txtKmSemTpp.getValue());
}
km.setValortaxa(txtValor.getValueDecimal());
km.setActivo(true);
km.setFecmodif(Calendar.getInstance().getTime());
@ -227,6 +293,7 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
lsSeguroKm.add(km);
seguroKmList.setData(lsSeguroKm);
seguroKmListTpm.setData(lsSeguroKm);
cmbOrgao.setDisabled(Boolean.TRUE);
limparInput();
@ -234,11 +301,18 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
}
private void limparInput() {
if (txtKm.isVisible()) {
txtKm.setConstraint("");
txtValor.setConstraint("");
txtKm.setText("");
txtValor.setText("");
txtKm.setConstraint("no empty, no zero, no negative");
}
if (txtKmSemTpp.isVisible()) {
txtKmSemTpp.setConstraint("");
txtKmSemTpp.setText("");
txtKmSemTpp.setConstraint("no empty, no zero, no negative");
}
txtValor.setConstraint("");
txtValor.setText("");
txtValor.setConstraint("no empty, no zero, no negative");
}
@ -253,5 +327,15 @@ public class EditarSeguroKmController extends MyGenericForwardComposer {
lsSeguroKm.remove(cd);
seguroKmList.setData(lsSeguroKm);
}
cd = (SeguroKm) seguroKmListTpm.getSelected();
if (cd != null) {
cd.setActivo(Boolean.FALSE);
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
cd.setFecmodif(Calendar.getInstance().getTime());
seguroKmService.actualizacion(cd);
lsSeguroKm.remove(cd);
seguroKmListTpm.setData(lsSeguroKm);
}
}
}

View File

@ -8,7 +8,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.poi.hssf.util.HSSFColor.ORCHID;
import org.hibernate.LazyInitializationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
@ -21,6 +20,7 @@ import org.zkoss.zul.Combobox;
import org.zkoss.zul.Constraint;
import org.zkoss.zul.Messagebox;
import com.rjconsultores.ventaboletos.constantes.TipoSeguro;
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
@ -33,6 +33,7 @@ import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.RutaEmpresaService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@ -75,6 +76,7 @@ public class GenerarTarifaOrgaoController extends MyGenericForwardComposer {
private Checkbox chkSeguro;
private Checkbox chkZerarTabela;
private Checkbox chkPedagio;
private Checkbox chkTipoSeguro;
private List<Ruta> listSelectedRutas;
private MyListbox selectedRutasList;
private List<Empresa> lsEmpresaSelected;
@ -110,6 +112,10 @@ public class GenerarTarifaOrgaoController extends MyGenericForwardComposer {
selectedRutasList.setItemRenderer(new RenderRutaDesc());
listSelectedRutas = new ArrayList<Ruta>();
lsEmpresaSelected = new ArrayList<Empresa>();
if (!ApplicationProperties.getInstance().exibeTpp()) {
chkTipoSeguro.setVisible(false);
}
}
public void onClick$chkZerarTabela(Event ev)
@ -122,7 +128,9 @@ public class GenerarTarifaOrgaoController extends MyGenericForwardComposer {
chkTaxaEmbarque.setDisabled(true);
chkSeguro.setChecked(false);
chkSeguro.setDisabled(true);
chkTipoSeguro.setDisabled(true);
chkPedagio.setChecked(false);
chkTipoSeguro.setChecked(false);
chkPedagio.setDisabled(true);
chkArredondarTaxaEmbarque.setChecked(false);
chkArredondarTaxaEmbarque.setDisabled(true);
@ -132,6 +140,7 @@ public class GenerarTarifaOrgaoController extends MyGenericForwardComposer {
chkTarifa.setChecked(true);
chkTaxaEmbarque.setDisabled(false);
chkSeguro.setDisabled(false);
chkTipoSeguro.setDisabled(false);
chkPedagio.setDisabled(false);
chkArredondarTaxaEmbarque.setDisabled(false);
chkArredondarTaxaEmbarque.setChecked(true);
@ -181,7 +190,11 @@ public class GenerarTarifaOrgaoController extends MyGenericForwardComposer {
}
if (chkSeguro.isChecked()) {
tarifaOficialService.atualizarSeguro(listSelectedRutas, orgaoConcedenteId);
tarifaOficialService.atualizarSeguro(listSelectedRutas, orgaoConcedenteId, TipoSeguro.SEGURO);
}
if (chkTipoSeguro.isChecked()) {
tarifaOficialService.atualizarSeguro(listSelectedRutas, orgaoConcedenteId, TipoSeguro.TPP);
}
if (chkPedagio.isChecked()) {
@ -190,6 +203,10 @@ public class GenerarTarifaOrgaoController extends MyGenericForwardComposer {
tarifaOficialService.aplicarArredondamentoTarifa(orgaoConcedenteId, chkArredondarTaxaEmbarque.isChecked());
if (chkTipoSeguro.isChecked()) {
tarifaOficialService.atualizarSeguroTPP(listSelectedRutas, orgaoConcedenteId, TipoSeguro.TPP);
}
long l = tarifaOficialService.obtenerCount(lsEmpresaSelected);
Messagebox.show(Labels.getLabel("generarTarifaOrgaoController.MSG.suscribirOK", new Object[] { l }),

View File

@ -51,6 +51,7 @@ import com.rjconsultores.ventaboletos.service.RutaCombinacionService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.service.TarifaService;
import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
@ -348,42 +349,44 @@ public class TarifaOficialExcelController extends MyGenericForwardComposer {
HSSFRow rowCabecalho = sheet1.createRow(0);
HSSFCell cell = rowCabecalho.createCell(0);
int j = 0;
HSSFCell cell = rowCabecalho.createCell(j++);
cell.setCellValue(
Labels.getLabel("busquedaTarifaController.lhId.label"));
cell.setCellStyle(estilo);
HSSFCell cell0 = rowCabecalho.createCell(1);
HSSFCell cell0 = rowCabecalho.createCell(j++);
cell0.setCellValue(
Labels.getLabel("busquedaTarifaController.lhTramo.label"));
cell0.setCellStyle(estilo);
HSSFCell cell1 = rowCabecalho.createCell(2);
HSSFCell cell1 = rowCabecalho.createCell(j++);
cell1.setCellValue(
Labels.getLabel("busquedaTarifaController.lhOrigen.label"));
cell1.setCellStyle(estilo);
HSSFCell cell2 = rowCabecalho.createCell(3);
HSSFCell cell2 = rowCabecalho.createCell(j++);
cell2.setCellValue(
Labels.getLabel("busquedaTarifaController.lhDestino.label"));
cell2.setCellStyle(estilo);
HSSFCell cell3 = rowCabecalho.createCell(4);
HSSFCell cell3 = rowCabecalho.createCell(j++);
cell3.setCellValue(
Labels.getLabel("busquedaTarifaController.lhRuta.label"));
cell3.setCellStyle(estilo);
HSSFCell cell4 = rowCabecalho.createCell(5);
HSSFCell cell4 = rowCabecalho.createCell(j++);
cell4.setCellValue(
Labels.getLabel("busquedaTarifaController.lhMarca.label"));
cell4.setCellStyle(estilo);
//Preco original I - 6
HSSFCell cell5 = rowCabecalho.createCell(6);
HSSFCell cell5 = rowCabecalho.createCell(j++);
cell5.setCellValue(
Labels.getLabel("busquedaTarifaController.lhClaseServicio.label"));
cell5.setCellStyle(estilo);
j++;
// H - 6
// HSSFCell cell6 = rowCabecalho.createCell(7);
// cell6.setCellValue(
@ -391,43 +394,49 @@ public class TarifaOficialExcelController extends MyGenericForwardComposer {
// cell6.setCellStyle(estilo);
//I - 8
HSSFCell cell7 = rowCabecalho.createCell(8);
HSSFCell cell7 = rowCabecalho.createCell(j++);
cell7.setCellValue(
Labels.getLabel("busquedaTarifaController.lhMoneda.label"));
cell7.setCellStyle(estilo);
//J - 9
HSSFCell cell8 = rowCabecalho.createCell(9);
HSSFCell cell8 = rowCabecalho.createCell(j++);
cell8.setCellValue(
Labels.getLabel("busquedaTarifaController.lhPrecioOriginal.label"));
cell8.setCellStyle(estilo);
//J - 9
HSSFCell cell9 = rowCabecalho.createCell(10);
HSSFCell cell9 = rowCabecalho.createCell(j++);
cell9.setCellValue(
Labels.getLabel("busquedaTarifaController.lhPrecioExcel.label"));
cell9.setCellStyle(estilo);
//h - 10
HSSFCell cell10 = rowCabecalho.createCell(11);
HSSFCell cell10 = rowCabecalho.createCell(j++);
cell10.setCellValue("Taxa");
cell10.setCellStyle(estilo);
HSSFCell cell11 = rowCabecalho.createCell(12);
HSSFCell cell11 = rowCabecalho.createCell(j++);
cell11.setCellValue("Seguro");
cell11.setCellStyle(estilo);
HSSFCell cell12 = rowCabecalho.createCell(13);
cell12.setCellValue("Pedagio");
if (ApplicationProperties.getInstance().exibeTpp()) {
HSSFCell cell12 = rowCabecalho.createCell(j++);
cell12.setCellValue("TPP");
cell12.setCellStyle(estilo);
}
HSSFCell cell13 = rowCabecalho.createCell(14);
cell13.setCellValue("Outros");
HSSFCell cell13 = rowCabecalho.createCell(j++);
cell13.setCellValue("Pedagio");
cell13.setCellStyle(estilo);
HSSFCell cell14 = rowCabecalho.createCell(15);
cell14.setCellValue("Total");
HSSFCell cell14 = rowCabecalho.createCell(j++);
cell14.setCellValue("Outros");
cell14.setCellStyle(estilo);
HSSFCell cell15 = rowCabecalho.createCell(j++);
cell15.setCellValue("Total");
cell15.setCellStyle(estilo);
}
HSSFRow row = sheet1.createRow(contRow++);
@ -458,9 +467,21 @@ public class TarifaOficialExcelController extends MyGenericForwardComposer {
BigDecimal taxa = tx == null ? new BigDecimal(BigInteger.ZERO) : BigDecimal.valueOf(Double.valueOf(tx));
String seg = obj[17] == null ? "0" : obj[17].toString();
BigDecimal seguro = seg == null ? new BigDecimal(BigInteger.ZERO) : BigDecimal.valueOf(Double.valueOf(seg));
String ped = obj[18] == null ? "0" : obj[18].toString();
String tpp;
String ped;
String otr;
BigDecimal seguroTpp = null;
if (ApplicationProperties.getInstance().exibeTpp()) {
tpp = obj[18] == null ? "0" : obj[18].toString();
ped = obj[19] == null ? "0" : obj[19].toString();
otr = obj[20] == null ? "0" : obj[20].toString();
seguroTpp = tpp == null ? new BigDecimal(BigInteger.ZERO) : BigDecimal.valueOf(Double.valueOf(tpp));
} else {
ped = obj[18] == null ? "0" : obj[19].toString();
otr = obj[19] == null ? "0" : obj[20].toString();
}
BigDecimal pedagio = ped == null ? new BigDecimal(BigInteger.ZERO) : BigDecimal.valueOf(Double.valueOf(ped));
String otr = obj[19] == null ? "0" : obj[19].toString();
BigDecimal outros = otr == null ? new BigDecimal(BigInteger.ZERO) : BigDecimal.valueOf(Double.valueOf(otr));
row.createCell(9).setCellValue(original.setScale(2).doubleValue());
@ -468,10 +489,16 @@ public class TarifaOficialExcelController extends MyGenericForwardComposer {
row.createCell(11).setCellValue(taxa.setScale(2).doubleValue());
row.createCell(12).setCellValue(seguro.setScale(2).doubleValue());
if (ApplicationProperties.getInstance().exibeTpp()) {
row.createCell(13).setCellValue(seguroTpp.setScale(2).doubleValue());
row.createCell(14).setCellValue(pedagio.setScale(2).doubleValue());
row.createCell(15).setCellValue(outros.setScale(2).doubleValue());
row.createCell(16).setCellValue(atual.add(taxa).add(seguro).add(pedagio).add(outros).setScale(2).doubleValue());
} else {
row.createCell(13).setCellValue(pedagio.setScale(2).doubleValue());
row.createCell(14).setCellValue(outros.setScale(2).doubleValue());
row.createCell(15).setCellValue(atual.add(taxa).add(seguro).add(pedagio).add(outros).setScale(2).doubleValue());
}
// novo preco:
// BigDecimal novoPrecio = atual;