bug #7458 - Correção aplicada na trunk
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@58389 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
8cb7c97c0b
commit
0c79e296dc
|
@ -151,6 +151,9 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
||||||
|
|
||||||
parentList.add(lsPricingOcupaAntecipa.get(i));
|
parentList.add(lsPricingOcupaAntecipa.get(i));
|
||||||
|
|
||||||
|
if(validaPricingOcupa(i)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (int j = i + 1; j < lsPricingOcupaAntecipa.size(); j++) {
|
for (int j = i + 1; j < lsPricingOcupaAntecipa.size(); j++) {
|
||||||
PricingOcupaAntecipa p = new PricingOcupaAntecipa();
|
PricingOcupaAntecipa p = new PricingOcupaAntecipa();
|
||||||
p.setPricingocupaantecipaId(lsPricingOcupaAntecipa.get(j).getPricingocupaantecipaId());
|
p.setPricingocupaantecipaId(lsPricingOcupaAntecipa.get(j).getPricingocupaantecipaId());
|
||||||
|
@ -176,8 +179,17 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean validaPricingOcupa(int i) {
|
||||||
|
return (i+1) < lsPricingOcupaAntecipa.size() && lsPricingOcupaAntecipa.get(i).getCantdiasmin().equals(lsPricingOcupaAntecipa.get(i + 1).getCantdiasmin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class PricingOcupaAntecipaComparator implements Comparator<PricingOcupaAntecipa> {
|
private class PricingOcupaAntecipaComparator implements Comparator<PricingOcupaAntecipa> {
|
||||||
public int compare(PricingOcupaAntecipa pricing, PricingOcupaAntecipa outroPricing) {
|
public int compare(PricingOcupaAntecipa pricing, PricingOcupaAntecipa outroPricing) {
|
||||||
|
if(pricing.getCantdiasmin().compareTo(outroPricing.getCantdiasmin()) == 0){
|
||||||
|
return pricing.getPorcentaje().compareTo(outroPricing.getPorcentaje());
|
||||||
|
}
|
||||||
return pricing.getCantdiasmin().
|
return pricing.getCantdiasmin().
|
||||||
compareTo(outroPricing.getCantdiasmin());
|
compareTo(outroPricing.getCantdiasmin());
|
||||||
}
|
}
|
||||||
|
@ -187,28 +199,25 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
||||||
Collections.sort(lsPricingOcupaAntecipa, Collections.reverseOrder(new PricingOcupaAntecipaComparator()));
|
Collections.sort(lsPricingOcupaAntecipa, Collections.reverseOrder(new PricingOcupaAntecipaComparator()));
|
||||||
PricingOcupaAntecipa poa;
|
PricingOcupaAntecipa poa;
|
||||||
int cantDiasMinAnterior = lsPricingOcupaAntecipa.get(0).getCantdiasmin();
|
int cantDiasMinAnterior = lsPricingOcupaAntecipa.get(0).getCantdiasmin();
|
||||||
|
int cantDiasMaxAnterior = CANTDIASMAXDEFAULT;
|
||||||
for (int i = 0; i < lsPricingOcupaAntecipa.size(); i++) {
|
for (int i = 0; i < lsPricingOcupaAntecipa.size(); i++) {
|
||||||
poa = lsPricingOcupaAntecipa.get(i);
|
poa = lsPricingOcupaAntecipa.get(i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
poa.setCantdiasmax(CANTDIASMAXDEFAULT);
|
poa.setCantdiasmax(CANTDIASMAXDEFAULT);
|
||||||
} else {
|
} else {
|
||||||
poa.setCantdiasmax(cantDiasMinAnterior - 1);
|
if(poa.getCantdiasmin().intValue() == cantDiasMinAnterior){
|
||||||
cantDiasMinAnterior = poa.getCantdiasmin();
|
poa.setCantdiasmax(cantDiasMaxAnterior);
|
||||||
|
}else{
|
||||||
|
poa.setCantdiasmax(cantDiasMinAnterior - 1);
|
||||||
|
cantDiasMinAnterior = poa.getCantdiasmin();
|
||||||
|
cantDiasMaxAnterior = poa.getCantdiasmax();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnlancar(Event ev) throws Exception {
|
public void onClick$btnlancar(Event ev) throws Exception {
|
||||||
|
|
||||||
for (PricingOcupaAntecipa poa : lsPricingOcupaAntecipa) {
|
|
||||||
if (poa.getCantdiasmin().equals(cantdiasmin.getValue())) {
|
|
||||||
Messagebox.show(Labels.getLabel("editarPricingAutomaticoController.msg.cantDias.erro"),
|
|
||||||
Labels.getLabel("editarPricingController.windowOcupacion.title"),
|
|
||||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PricingOcupaAntecipa poa = new PricingOcupaAntecipa();
|
PricingOcupaAntecipa poa = new PricingOcupaAntecipa();
|
||||||
poa.setPricing(pricing);
|
poa.setPricing(pricing);
|
||||||
poa.setCantdiasmin(cantdiasmin.getValue());
|
poa.setCantdiasmin(cantdiasmin.getValue());
|
||||||
|
|
Loading…
Reference in New Issue