public void onExportSyntheseEcran(ExportSyntheseEcranEvent event) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
// Information Chantier
String chantier = chatierName.getValue();
params.add(new NameValuePair("paramChantier", chantier));
if( prorataTheorique.getValue() != null ) {
Double prorata = prorataTheorique.getValue().doubleValue();
params.add(new NameValuePair("paramProrata", prorata + ""));
}
// Synthese des fiches st
// + Grid 1
List<FicheStDto> fichestGrid1 = ficheStGrid1.getStore().getModels();
List<String> lstKeyGrid1 = new ArrayList<String>();
String keyGrid1 = "";
for( int i = 0 ; i < fichestGrid1.size() ; i++ ) {
if( fichestGrid1.get(i).getLotType() != null && !lstKeyGrid1.contains(fichestGrid1.get(i).getLotType().getName()) ) {
lstKeyGrid1.add(fichestGrid1.get(i).getLotType().getName());
keyGrid1 += fichestGrid1.get(i).getLotType().getName() + Constants.SEPRATE;
}
}
if( keyGrid1 != null && keyGrid1.length() > 0 ) {
keyGrid1 = keyGrid1.substring(0, keyGrid1.length() - Constants.SEPRATE.length());
params.add(new NameValuePair("paramKeyGrid1", keyGrid1));
}
Map<String, String> mapGrid1 = new HashMap<String, String>();
Map<String, String> mapTotalGroupGrid1 = new HashMap<String, String>();
String totalSumGrid1 = createGridReport(fichestGrid1, lstKeyGrid1, mapGrid1, mapTotalGroupGrid1);
params.add(new NameValuePair("paramMapGrid1", mapGrid1.toString()));
params.add(new NameValuePair("paramMapTotalGroupGrid1", mapTotalGroupGrid1.toString()));
params.add(new NameValuePair("paramTotalSumGrid1", totalSumGrid1));
// +Grid 2
List<FicheStDto> fichestGrid2 = ficheStGrid2.getStore().getModels();
Map<String, String> mapGrid2 = new HashMap<String, String>();
Map<String, String> mapTotalGroupGrid2 = new HashMap<String, String>();
List<String> lstKeyGrid2 = new ArrayList<String>();
String keyGrid2 = "";
for( int i = 0 ; i < fichestGrid2.size() ; i++ ) {
if( fichestGrid2.get(i).getLotType() != null && !lstKeyGrid2.contains(fichestGrid2.get(i).getLotType().getName()) ) {
lstKeyGrid2.add(fichestGrid2.get(i).getLotType().getName());
keyGrid2 += fichestGrid2.get(i).getLotType().getName() + Constants.SEPRATE;
}
}
if( keyGrid2 != null && keyGrid2.length() > 0 ) {
keyGrid2 = keyGrid2.substring(0, keyGrid2.length() - Constants.SEPRATE.length());
params.add(new NameValuePair("paramKeyGrid2", keyGrid2));
}
String totalSumGrid2 = createGridReport(fichestGrid2, lstKeyGrid2, mapGrid2, mapTotalGroupGrid2);
params.add(new NameValuePair("paramMapGrid2", mapGrid2.toString()));
params.add(new NameValuePair("paramMapTotalGroupGrid2", mapTotalGroupGrid2.toString()));
params.add(new NameValuePair("paramTotalSumGrid2", totalSumGrid2));
// Synthese des transpert pp
List<TransfertPpSummaryDto> listTransfertPpGrid = transfertPpGrid.getStore().getModels();
TransfertPpSummaryDto transfertPpSummaryDto = null;
String grid3 = "";
double sumColumnObjectif = 0.0;
double sumColumnObj = 0.0;
double sumColumnTransfert = 0.0;
double sumColumnRd = 0.0;
double sumColumnTs = 0.0;
double sumRow = 0.0;
double sumSumRow = 0.0;
NumberFormat numberFormat = NumberFormat.getFormat(Constants.NUMBER_FORMAT);
for( int i = 0 ; i < listTransfertPpGrid.size() ; i++ ) {
transfertPpSummaryDto = listTransfertPpGrid.get(i);
sumColumnObjectif += transfertPpSummaryDto.getObjective();
sumColumnObj += transfertPpSummaryDto.getObj();
sumColumnTransfert += transfertPpSummaryDto.getDevers();
sumColumnRd += transfertPpSummaryDto.getRd();
sumColumnTs += transfertPpSummaryDto.getTs();
sumRow = transfertPpSummaryDto.getObj() + transfertPpSummaryDto.getDevers() + transfertPpSummaryDto.getRd() + transfertPpSummaryDto.getTs();
sumSumRow += sumRow;
grid3 += createTotalSumReport(
numberFormat, transfertPpSummaryDto.getLabel(), transfertPpSummaryDto.getObjective(),
transfertPpSummaryDto.getObj(), transfertPpSummaryDto.getDevers(),
transfertPpSummaryDto.getRd(), transfertPpSummaryDto.getTs(), sumRow);
}
params.add(new NameValuePair("paramGrid3", grid3));
String totalSumGrid3 = createTotalSumReport(
numberFormat, "Total PP", sumColumnObjectif, sumColumnObj, sumColumnTransfert, sumColumnRd,
sumColumnTs, sumSumRow);
params.add(new NameValuePair("paramTotalSumGrid3", totalSumGrid3));
// ficheStSummaryGrid
// +Grid 4
List<FicheStDto> fichestGrid4 = ficheStSummaryGrid.getStore().getModels();
String[] arr = createGridReportSummary(fichestGrid4);
params.add(new NameValuePair("paramGrid4", arr[0]));
params.add(new NameValuePair("paramTotalSumGrid4", arr[1]));
String exportPdfUrl = GWT.getHostPageBaseURL() + "synthese.pdf";
ReportUtil.showReport(exportPdfUrl, params.toArray(new NameValuePair[params.size()]));
}