0004784: Pricing - Nova tela
Ao cadastrar uma ocupação com a ordem inversa dos dados (4, 8 e 12 dias), ocorre um erro na geração. Foi feita uma alteração no código para poder cadastrar as ocupações independente da ordem. git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@32936 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
0abfd7585a
commit
6c4a97498b
|
@ -36,6 +36,9 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPricingOcupaAnt
|
||||||
public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericForwardComposer {
|
public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final int CANTDIASMAXDEFAULT = 365;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PricingOcupaAntecipaService pricingOcupaAntecipaService;
|
private PricingOcupaAntecipaService pricingOcupaAntecipaService;
|
||||||
private PricingOcupaAntecipa pricingOcupaAntecipa;
|
private PricingOcupaAntecipa pricingOcupaAntecipa;
|
||||||
|
@ -140,6 +143,7 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
||||||
|
|
||||||
public void onClick$btnAdicionarOcupaAntecipa(Event ev) throws Exception {
|
public void onClick$btnAdicionarOcupaAntecipa(Event ev) throws Exception {
|
||||||
List<PricingOcupaAntecipa> parentList = new ArrayList<PricingOcupaAntecipa>();
|
List<PricingOcupaAntecipa> parentList = new ArrayList<PricingOcupaAntecipa>();
|
||||||
|
calculaCantDiasMax();
|
||||||
try {
|
try {
|
||||||
apagarRegistros();
|
apagarRegistros();
|
||||||
for (int i = 0; i < lsPricingOcupaAntecipa.size(); i++){
|
for (int i = 0; i < lsPricingOcupaAntecipa.size(); i++){
|
||||||
|
@ -184,28 +188,25 @@ public class EditarPricingOcupaAntecipaAutomaticoController extends MyGenericFor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnlancar(Event ev) throws Exception {
|
private void calculaCantDiasMax(){
|
||||||
Collections.sort(lsPricingOcupaAntecipa, Collections.reverseOrder(new PricingOcupaAntecipaComparator()));
|
Collections.sort(lsPricingOcupaAntecipa, Collections.reverseOrder(new PricingOcupaAntecipaComparator()));
|
||||||
PricingOcupaAntecipa poa = new PricingOcupaAntecipa();
|
PricingOcupaAntecipa poa;
|
||||||
poa.setPricing(pricing);
|
int cantDiasMinAnterior = lsPricingOcupaAntecipa.get(0).getCantdiasmin();
|
||||||
poa.setCantdiasmin(cantdiasmin.getValue());
|
for (int i = 0; i < lsPricingOcupaAntecipa.size(); i++){
|
||||||
boolean hayCantDiasMax = false;
|
poa = lsPricingOcupaAntecipa.get(i);
|
||||||
if (lsPricingOcupaAntecipa.isEmpty() || lsPricingOcupaAntecipa.get(0).getCantdiasmin() == cantdiasmin.getValue()){
|
if (i == 0){
|
||||||
// TODO verificar qual vai ser o valor do cantDiasMax
|
poa.setCantdiasmax(CANTDIASMAXDEFAULT);
|
||||||
poa.setCantdiasmax(365);
|
|
||||||
} else {
|
} else {
|
||||||
for (PricingOcupaAntecipa p : lsPricingOcupaAntecipa) {
|
poa.setCantdiasmax(cantDiasMinAnterior - 1);
|
||||||
if (p.getCantdiasmin() == poa.getCantdiasmin()){
|
cantDiasMinAnterior = poa.getCantdiasmin();
|
||||||
poa.setCantdiasmax(p.getCantdiasmax());
|
|
||||||
hayCantDiasMax = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hayCantDiasMax){
|
|
||||||
poa.setCantdiasmax(lsPricingOcupaAntecipa.get(lsPricingOcupaAntecipa.size() -1).getCantdiasmin() -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClick$btnlancar(Event ev) throws Exception {
|
||||||
|
PricingOcupaAntecipa poa = new PricingOcupaAntecipa();
|
||||||
|
poa.setPricing(pricing);
|
||||||
|
poa.setCantdiasmin(cantdiasmin.getValue());
|
||||||
poa.setPorcentaje(porcentaje.getValueDecimal());
|
poa.setPorcentaje(porcentaje.getValueDecimal());
|
||||||
if (rdOcupacao.isChecked()){
|
if (rdOcupacao.isChecked()){
|
||||||
poa.setOcupacioninicial(new BigDecimal(ocupacioninicial.getValue()));
|
poa.setOcupacioninicial(new BigDecimal(ocupacioninicial.getValue()));
|
||||||
|
|
Loading…
Reference in New Issue