String chainter = navigation.getContext().getCurrentChantier().getNom();
TextField<String> societte = (TextField<String>) ComponentManager.get().get("INFORMATION_PANEL_SOCIETE_ID");
TextField<String> lot = (TextField<String>) ComponentManager.get().get("INFORMATION_PANEL_LOT_ID");
ComboBox<LotTypeDto> lotType = (ComboBox<LotTypeDto>) ComponentManager.get().get("INFORMATION_PANEL_LOT_TYPE_ID");
TextField<String> sitravaux = (TextField<String>) ComponentManager.get().get("INFORMATION_PANEL_SITRAVAUX_ID");
NumberField montant = (NumberField) ComponentManager.get().get("INFORMATION_PANEL_MONTANT_ID");
List<NameValuePair> params = new ArrayList<NameValuePair>();
List<GestionDto> list = gestionGrid.getStore().getModels();
Map<String, String> listgestion = new HashMap<String, String>();
Map<String, String> listtotalgestion = new HashMap<String, String>();
List<String> lstKeys = new ArrayList<String>();
String keys = "";
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getMarche() != null && !lstKeys.contains(list.get(i).getMarche().getLabel())) {
lstKeys.add(list.get(i).getMarche().getLabel());
keys += list.get(i).getMarche().getLabel() + Constants.SEPRATE;
}
}
GestionDto gestionDto = null;
String alltotalgestion = "";
double allamount = 0.0;
double allavenants = 0.0;
double allarrete = 0.0;
double allnonarrete = 0.0;
double allprovision = 0.0;
double alldevisrefuse = 0.0;
double allreelactivitive = 0.0;
double allamount2 = 0.0;
double alltotalfdc = 0.0;
double allTotalecart = 0.0;
String summary = "";
String budget = "";
for (int i = 0; i < lstKeys.size(); i++) {
String gestion = "";
String totalgestion = "";
double amount = 0.0;
double avenants = 0.0;
double arrete = 0.0;
double nonarrete = 0.0;
double provision = 0.0;
double devisrefuse = 0.0;
double reelactivitive = 0.0;
double amount2 = 0.0;
String gestionComment = "";
double ecartSum = 0.0;
double totalfdcSum = 0.0;
for (int j = 0; j < list.size(); j++) {
gestionDto = list.get(j);
if (lstKeys.get(i).equalsIgnoreCase(gestionDto.getMarche().getLabel())) {
String tmp = gestionDto.getMarche().getLabel() + " " + gestionDto.getTraite();
gestionComment = gestionDto.getComment() != null ? gestionDto.getComment() : "";
gestion += append(gestionDto.getDevis(), gestionDto.getStatut().getLabel(), gestionDto.getLabel(), gestionComment, gestionDto.getAmount(), tmp, gestionDto.getArrete(),
gestionDto.getNonArrete(), gestionDto.getProvision(), gestionDto.getDevisRefuse(), gestionDto.getTotalFdc(), gestionDto.getReelActivitive(), gestionDto.getType()
.getLabel(), gestionDto.getLabel2(), gestionDto.getAmount2(), gestionDto.getEcart());
// Sum Group
amount += gestionDto.getAmount();
avenants += gestionDto.getTraite();
arrete += gestionDto.getArrete();
nonarrete += gestionDto.getNonArrete();
provision += gestionDto.getProvision();
devisrefuse += gestionDto.getDevisRefuse();
reelactivitive += gestionDto.getReelActivitive();
amount2 += gestionDto.getAmount2();
ecartSum += gestionDto.getEcart();
totalfdcSum += gestionDto.getTotalFdc();
}
}
// Sum Gestion
allamount += amount;
allavenants += avenants;
allarrete += arrete;
allnonarrete += nonarrete;
allprovision += provision;
alldevisrefuse += devisrefuse;
allreelactivitive += reelactivitive;
allamount2 += amount2;
allTotalecart += ecartSum;
alltotalfdc += totalfdcSum;
listgestion.put(lstKeys.get(i), gestion);
totalgestion += append(amount, avenants, arrete, nonarrete, provision, devisrefuse, totalfdcSum, reelactivitive, amount2, ecartSum);
listtotalgestion.put(lstKeys.get(i), totalgestion);
}
if (keys.length() > 0) {
keys = keys.substring(0, keys.length() - (Constants.SEPRATE.length()));
}
params.add(new NameValuePair(ConstantClient.GESTIONDTO_ID_STR, listgestion.toString()));
alltotalgestion += append(allamount, allavenants, allarrete, allnonarrete, allprovision, alldevisrefuse, alltotalfdc, allreelactivitive, allamount2, allTotalecart);
params.add(new NameValuePair("alltotalgestion", alltotalgestion));
String generaleInformation = append(chainter, lot.getValue(), sitravaux.getValue(), societte.getValue(), lotType.getValue().getName(), montant.getValue());
params.add(new NameValuePair("generaleInformation", generaleInformation));
params.add(new NameValuePair("totalgestion", listtotalgestion.toString()));
summary += append(totalObj, totalTF, totalTS, totalRD);
params.add(new NameValuePair("summary", summary));
budget += append(budgetInitial, dernierPoint, dernier);