PRICING - Ocupação | Antecipação (fixes bug #5836)
Tempo: 03 horas git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@43707 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
4880a1cfff
commit
9dc27f02a0
|
@ -16,7 +16,6 @@ import org.zkoss.zhtml.Messagebox;
|
|||
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.Intbox;
|
||||
import org.zkoss.zul.Radio;
|
||||
|
||||
|
@ -47,16 +46,10 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
|||
private Intbox ocupacioninicial;
|
||||
private Intbox ocupacionfinal;
|
||||
private Intbox cantdiasmin;
|
||||
private Intbox cantdiasmax;
|
||||
private Intbox cantasientosmin;
|
||||
private Intbox cantasientosmax;
|
||||
private MyTextboxDecimal porcentaje;
|
||||
private MyTextboxDecimal importe;
|
||||
private List<PricingOcupaAntecipa> lsPricingOcupaAntecipa;
|
||||
private Radio rdPoltronas;
|
||||
private Radio rdOcupacao;
|
||||
private Boolean hasNoElements;
|
||||
private Button btnAdicionarOcupaAntecipa;
|
||||
|
||||
private List<PricingOcupaAntecipa> argList;
|
||||
private Pricing pricing;
|
||||
|
@ -64,29 +57,19 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
|||
private ConstraintPorcentagem ct;
|
||||
private static Logger log = Logger.getLogger(EditarPricingOcupaAntecipaController.class);
|
||||
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
/*
|
||||
* Transformar a tabela (valores de exemplo) :
|
||||
*
|
||||
* Qtd. Dias Qtd. Dias Ocup. Min. Ocup. Máx. Porcentagem
|
||||
* Minimo Máximo
|
||||
* Qtd. Dias Qtd. Dias Ocup. Min. Ocup. Máx. Porcentagem Minimo Máximo
|
||||
*
|
||||
* 12 * 0% 20% -30%
|
||||
* 12 * 21% 80% -15%
|
||||
* 12 * 81% 90% -10%
|
||||
* 8 11 0% 80% -15%
|
||||
* 8 11 81% 90% -10%
|
||||
* 4 7 0% 90% -10%
|
||||
* 12 * 0% 20% -30% 12 * 21% 80% -15% 12 * 81% 90% -10% 8 11 0% 80% -15% 8 11 81% 90% -10% 4 7 0% 90% -10%
|
||||
*
|
||||
* Na forma:
|
||||
*
|
||||
* 12 dias ----> 30% (ocupação de 0% -> 20%)
|
||||
* 08 dias ----> 15% (ocupação de 21% -> 80%)
|
||||
* 04 dias ----> 10% (ocupação de 81% -> 90%)
|
||||
*
|
||||
* 12 dias ----> 30% (ocupação de 0% -> 20%) 08 dias ----> 15% (ocupação de 21% -> 80%) 04 dias ----> 10% (ocupação de 81% -> 90%)
|
||||
*/
|
||||
|
||||
argList = (List<PricingOcupaAntecipa>) Executions.getCurrent().getArg().get("clasePricingOcupaAntecipaList");
|
||||
|
@ -98,6 +81,7 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
|||
try {
|
||||
Collections.sort(argList, Collections.reverseOrder(new PricingOcupaAntecipaComparator()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Messagebox.show(Labels.getLabel("editarPricingOcupaAntecipaAutomaticoController.MSG.FormatoDados"),
|
||||
Labels.getLabel("editarPricingController.windowOcupacion.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
@ -108,10 +92,14 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
|||
int diaMin = -1;
|
||||
|
||||
for (PricingOcupaAntecipa p : argList) {
|
||||
if (p.getCantdiasmin() != null) {
|
||||
if (diaMin != p.getCantdiasmin()) {
|
||||
lsPricingOcupaAntecipa.add(p);
|
||||
diaMin = p.getCantdiasmin();
|
||||
}
|
||||
} else {
|
||||
lsPricingOcupaAntecipa.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
// se TabelaMaior.size mod TabelaMenor.size = 0, então há possibilidade de transformar a maior na menor.
|
||||
|
@ -183,8 +171,12 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
|||
|
||||
private class PricingOcupaAntecipaComparator implements Comparator<PricingOcupaAntecipa> {
|
||||
public int compare(PricingOcupaAntecipa pricing, PricingOcupaAntecipa outroPricing) {
|
||||
return pricing.getCantdiasmin().
|
||||
compareTo(outroPricing.getCantdiasmin());
|
||||
if (pricing.getCantdiasmin() != null && outroPricing.getCantdiasmin() != null) {
|
||||
return pricing.getCantdiasmin().compareTo(outroPricing.getCantdiasmin());
|
||||
} else if (pricing.getOcupacioninicial() != null && outroPricing.getOcupacioninicial() != null) {
|
||||
return pricing.getOcupacioninicial().compareTo(outroPricing.getOcupacioninicial());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue