1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
9 |
* language governing permissions and limitations under the License.
|
9 |
* language governing permissions and limitations under the License.
|
10 |
*
|
10 |
*
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.erp.core.humanresources.payroll.report;
|
14 |
package org.openconcerto.erp.core.humanresources.payroll.report;
|
15 |
|
15 |
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
17 |
import org.openconcerto.erp.generationDoc.SheetInterface;
|
17 |
import org.openconcerto.erp.generationDoc.SheetInterface;
|
18 |
import org.openconcerto.erp.preferences.PrinterNXProps;
|
18 |
import org.openconcerto.erp.preferences.PrinterNXProps;
|
19 |
import org.openconcerto.sql.Configuration;
|
19 |
import org.openconcerto.sql.Configuration;
|
20 |
import org.openconcerto.sql.model.SQLRow;
|
20 |
import org.openconcerto.sql.model.SQLRow;
|
21 |
import org.openconcerto.sql.model.SQLRowValues;
|
21 |
import org.openconcerto.sql.model.SQLRowValues;
|
22 |
import org.openconcerto.sql.model.SQLSelect;
|
22 |
import org.openconcerto.sql.model.SQLSelect;
|
23 |
import org.openconcerto.sql.model.SQLTable;
|
23 |
import org.openconcerto.sql.model.SQLTable;
|
24 |
import org.openconcerto.sql.model.Where;
|
24 |
import org.openconcerto.sql.model.Where;
|
25 |
|
25 |
|
26 |
import java.math.BigDecimal;
|
26 |
import java.math.BigDecimal;
|
27 |
import java.text.DateFormat;
|
27 |
import java.text.DateFormat;
|
28 |
import java.util.Date;
|
28 |
import java.util.Date;
|
29 |
import java.util.HashMap;
|
29 |
import java.util.HashMap;
|
30 |
import java.util.List;
|
30 |
import java.util.List;
|
31 |
import java.util.Map;
|
31 |
import java.util.Map;
|
32 |
|
32 |
|
33 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
33 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
34 |
|
34 |
|
35 |
public class EtatChargesPayeSheet extends SheetInterface {
|
35 |
public class EtatChargesPayeSheet extends SheetInterface {
|
36 |
|
36 |
|
37 |
private static int debutFill, endFill;
|
37 |
private static int debutFill, endFill;
|
38 |
private final static SQLTable tableFichePaye = base.getTable("FICHE_PAYE");
|
38 |
private final static SQLTable tableFichePaye = base.getTable("FICHE_PAYE");
|
39 |
private final static SQLTable tableFichePayeElement = base.getTable("FICHE_PAYE_ELEMENT");
|
39 |
private final static SQLTable tableFichePayeElement = base.getTable("FICHE_PAYE_ELEMENT");
|
40 |
private final static SQLTable tableMois = base.getTable("MOIS");
|
40 |
private final static SQLTable tableMois = base.getTable("MOIS");
|
41 |
private final static SQLTable tableCaisse = Configuration.getInstance().getBase().getTable("CAISSE_COTISATION");
|
41 |
private final static SQLTable tableCaisse = Configuration.getInstance().getBase().getTable("CAISSE_COTISATION");
|
42 |
private final static SQLTable tableRubCot = Configuration.getInstance().getBase().getTable("RUBRIQUE_COTISATION");
|
42 |
private final static SQLTable tableRubCot = Configuration.getInstance().getBase().getTable("RUBRIQUE_COTISATION");
|
43 |
|
43 |
|
44 |
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
|
44 |
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
|
45 |
private int moisDu, moisAu;
|
45 |
private int moisDu, moisAu;
|
46 |
private String annee;
|
46 |
private String annee;
|
47 |
|
47 |
|
48 |
public static void setSize(int debut, int fin) {
|
48 |
public static void setSize(int debut, int fin) {
|
49 |
debutFill = debut;
|
49 |
debutFill = debut;
|
50 |
endFill = fin;
|
50 |
endFill = fin;
|
51 |
|
51 |
|
52 |
}
|
52 |
}
|
53 |
|
53 |
|
54 |
static {
|
54 |
static {
|
55 |
setSize(7, 66);
|
55 |
setSize(7, 66);
|
56 |
}
|
56 |
}
|
57 |
|
57 |
|
58 |
public static String TEMPLATE_ID = "Etat des charges";
|
58 |
public static String TEMPLATE_ID = "Etat des charges";
|
59 |
public static String TEMPLATE_PROPERTY_NAME = "LocationEtatChargesPaye";
|
59 |
public static String TEMPLATE_PROPERTY_NAME = "LocationEtatChargesPaye";
|
60 |
|
60 |
|
61 |
@Override
|
61 |
@Override
|
62 |
public String getTemplateId() {
|
62 |
public String getTemplateId() {
|
63 |
return TEMPLATE_ID;
|
63 |
return TEMPLATE_ID;
|
64 |
}
|
64 |
}
|
65 |
|
65 |
|
66 |
@Override
|
66 |
@Override
|
67 |
protected String getYear() {
|
67 |
protected String getYear() {
|
68 |
return "";
|
68 |
return "";
|
69 |
}
|
69 |
}
|
70 |
|
70 |
|
71 |
public EtatChargesPayeSheet(int moisDu, int moisAu, String annee) {
|
71 |
public EtatChargesPayeSheet(int moisDu, int moisAu, String annee) {
|
72 |
super();
|
72 |
super();
|
73 |
|
73 |
|
74 |
this.printer = PrinterNXProps.getInstance().getStringProperty("EtatChargesPayePrinter");
|
74 |
this.printer = PrinterNXProps.getInstance().getStringProperty("EtatChargesPayePrinter");
|
75 |
this.modele = "EtatChargesPaye.ods";
|
75 |
this.modele = "EtatChargesPaye.ods";
|
76 |
this.moisAu = moisAu;
|
76 |
this.moisAu = moisAu;
|
77 |
this.moisDu = moisDu;
|
77 |
this.moisDu = moisDu;
|
78 |
this.annee = annee;
|
78 |
this.annee = annee;
|
79 |
|
79 |
|
80 |
this.nbRowsPerPage = 68;
|
80 |
this.nbRowsPerPage = 68;
|
81 |
|
81 |
|
82 |
createMap();
|
82 |
createMap();
|
83 |
}
|
83 |
}
|
84 |
|
84 |
|
85 |
private void makeEntete(int row) {
|
85 |
private void makeEntete(int row) {
|
86 |
SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
|
86 |
SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
|
87 |
this.mCell.put("A" + row, rowSociete.getObject("NOM"));
|
87 |
this.mCell.put("A" + row, rowSociete.getObject("NOM"));
|
88 |
this.mCell.put("F" + row, "Edition du " + dateFormat.format(new Date()));
|
88 |
this.mCell.put("F" + row, "Edition du " + dateFormat.format(new Date()));
|
89 |
// this.mCell.put("D" + (row + 2), "Impression Journaux");
|
89 |
// this.mCell.put("D" + (row + 2), "Impression Journaux");
|
90 |
System.err.println("MAKE ENTETE");
|
90 |
System.err.println("MAKE ENTETE");
|
91 |
}
|
91 |
}
|
92 |
|
92 |
|
93 |
private void makeBasPage(int row) {
|
93 |
private void makeBasPage(int row) {
|
94 |
SQLRow rowMoisDu = tableMois.getRow(this.moisDu);
|
94 |
SQLRow rowMoisDu = tableMois.getRow(this.moisDu);
|
95 |
SQLRow rowMoisAu = tableMois.getRow(this.moisAu);
|
95 |
SQLRow rowMoisAu = tableMois.getRow(this.moisAu);
|
96 |
|
96 |
|
97 |
this.mCell.put("A" + row, "Période de " + rowMoisDu.getString("NOM") + " à " + rowMoisAu.getString("NOM") + " " + this.annee);
|
97 |
this.mCell.put("A" + row, "Période de " + rowMoisDu.getString("NOM") + " à " + rowMoisAu.getString("NOM") + " " + this.annee);
|
98 |
}
|
98 |
}
|
99 |
|
99 |
|
100 |
protected void createMap() {
|
100 |
protected void createMap() {
|
101 |
|
101 |
|
102 |
this.mapReplace = new HashMap();
|
102 |
this.mapReplace = new HashMap();
|
103 |
this.mCell = new HashMap();
|
103 |
this.mCell = new HashMap();
|
104 |
this.mapStyleRow = new HashMap();
|
104 |
this.mapStyleRow = new HashMap();
|
105 |
|
105 |
|
106 |
SQLSelect sel = new SQLSelect(base);
|
106 |
SQLSelect sel = new SQLSelect(base);
|
107 |
sel.addSelect(tableFichePaye.getField("ID"));
|
107 |
sel.addSelect(tableFichePaye.getField("ID"));
|
108 |
sel.addSelect(tableFichePayeElement.getField("ID"));
|
108 |
sel.addSelect(tableFichePayeElement.getField("ID"));
|
109 |
// sel.addSelect(tableSalarie.getField("ID"));
|
109 |
// sel.addSelect(tableSalarie.getField("ID"));
|
110 |
|
110 |
|
111 |
Where w = (new Where(tableFichePayeElement.getField("ID_FICHE_PAYE"), "=", tableFichePaye.getField("ID")));
|
111 |
Where w = (new Where(tableFichePayeElement.getField("ID_FICHE_PAYE"), "=", tableFichePaye.getField("ID")));
|
112 |
Where w6 = (new Where(tableFichePayeElement.getField("SOURCE"), "=", "RUBRIQUE_COTISATION"));
|
112 |
Where w6 = (new Where(tableFichePayeElement.getField("SOURCE"), "=", "RUBRIQUE_COTISATION"));
|
113 |
// Where w2 = (new Where(tableFichePaye.getField("ID_SALARIE"), "=",
|
113 |
// Where w2 = (new Where(tableFichePaye.getField("ID_SALARIE"), "=",
|
114 |
// tableSalarie.getField("ID")));
|
114 |
// tableSalarie.getField("ID")));
|
115 |
Where w3 = (new Where(tableFichePaye.getField("ID_MOIS"), new Integer(this.moisDu), new Integer(this.moisAu)));
|
115 |
Where w3 = (new Where(tableFichePaye.getField("ID_MOIS"), new Integer(this.moisDu), new Integer(this.moisAu)));
|
116 |
Where w4 = (new Where(tableFichePaye.getField("ANNEE"), "=", new Integer(this.annee)));
|
116 |
Where w4 = (new Where(tableFichePaye.getField("ANNEE"), "=", new Integer(this.annee)));
|
117 |
Where w5 = (new Where(tableFichePaye.getField("VALIDE"), "=", Boolean.TRUE));
|
117 |
Where w5 = (new Where(tableFichePaye.getField("VALIDE"), "=", Boolean.TRUE));
|
118 |
|
118 |
|
119 |
sel.setWhere(w);
|
119 |
sel.setWhere(w);
|
120 |
// sel.andWhere(w2);
|
120 |
// sel.andWhere(w2);
|
121 |
sel.andWhere(w3);
|
121 |
sel.andWhere(w3);
|
122 |
sel.andWhere(w4);
|
122 |
sel.andWhere(w4);
|
123 |
sel.andWhere(w5);
|
123 |
sel.andWhere(w5);
|
124 |
sel.andWhere(w6);
|
124 |
sel.andWhere(w6);
|
125 |
sel.setDistinct(true);
|
125 |
sel.setDistinct(true);
|
126 |
String req = sel.asString();
|
126 |
String req = sel.asString();
|
127 |
|
127 |
|
128 |
System.err.println(req);
|
128 |
System.err.println(req);
|
129 |
|
129 |
|
130 |
// Liste des rubriques de chaque salaries
|
130 |
// Liste des rubriques de chaque salaries
|
131 |
List l = (List) base.getDataSource().execute(req, new ArrayListHandler());
|
131 |
List l = (List) base.getDataSource().execute(req, new ArrayListHandler());
|
132 |
|
132 |
|
133 |
// Association idCaisse, Map rowValsRubCotCumulé
|
133 |
// Association idCaisse, Map rowValsRubCotCumulé
|
134 |
Map mapCaisse = new HashMap();
|
134 |
Map mapCaisse = new HashMap();
|
135 |
Map mapFiche = new HashMap();
|
135 |
Map mapFiche = new HashMap();
|
136 |
|
136 |
|
137 |
// Cumuls des rubriques de cotisations par caisse
|
137 |
// Cumuls des rubriques de cotisations par caisse
|
138 |
for (int i = 0; i < l.size(); i++) {
|
138 |
for (int i = 0; i < l.size(); i++) {
|
139 |
Object[] tmp = (Object[]) l.get(i);
|
139 |
Object[] tmp = (Object[]) l.get(i);
|
140 |
mapFiche.put(tmp[0], "");
|
140 |
mapFiche.put(tmp[0], "");
|
141 |
int idFicheElt = Integer.parseInt(tmp[1].toString());
|
141 |
int idFicheElt = Integer.parseInt(tmp[1].toString());
|
142 |
|
142 |
|
143 |
SQLRow rowFicheElt = tableFichePayeElement.getRow(idFicheElt);
|
143 |
SQLRow rowFicheElt = tableFichePayeElement.getRow(idFicheElt);
|
144 |
SQLRow rowRub = tableRubCot.getRow(rowFicheElt.getInt("IDSOURCE"));
|
144 |
SQLRow rowRub = tableRubCot.getRow(rowFicheElt.getInt("IDSOURCE"));
|
145 |
|
145 |
|
146 |
// On recupere la map de la caisse
|
146 |
// On recupere la map de la caisse
|
147 |
Map mapValueRub;
|
147 |
Map mapValueRub;
|
148 |
if (mapCaisse.containsKey(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")))) {
|
148 |
if (mapCaisse.containsKey(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")))) {
|
149 |
mapValueRub = (Map) mapCaisse.get(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")));
|
149 |
mapValueRub = (Map) mapCaisse.get(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")));
|
150 |
} else {
|
150 |
} else {
|
151 |
mapValueRub = new HashMap();
|
151 |
mapValueRub = new HashMap();
|
152 |
mapCaisse.put(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")), mapValueRub);
|
152 |
mapCaisse.put(new Integer(rowRub.getInt("ID_CAISSE_COTISATION")), mapValueRub);
|
153 |
}
|
153 |
}
|
154 |
|
154 |
|
155 |
// on recupere la rowvalues de la rubrique
|
155 |
// on recupere la rowvalues de la rubrique
|
156 |
SQLRowValues rowVals;
|
156 |
SQLRowValues rowVals;
|
157 |
if (mapValueRub.containsKey(rowFicheElt.getObject("IDSOURCE"))) {
|
157 |
if (mapValueRub.containsKey(rowFicheElt.getObject("IDSOURCE"))) {
|
158 |
rowVals = (SQLRowValues) mapValueRub.get(rowFicheElt.getObject("IDSOURCE"));
|
158 |
rowVals = (SQLRowValues) mapValueRub.get(rowFicheElt.getObject("IDSOURCE"));
|
159 |
// on cumule les données
|
159 |
// on cumule les données
|
160 |
if (rowFicheElt.getObject("NB_BASE") != null) {
|
160 |
if (rowFicheElt.getObject("NB_BASE") != null) {
|
161 |
Object o = rowVals.getObject("NB_BASE");
|
161 |
Object o = rowVals.getObject("NB_BASE");
|
162 |
BigDecimal base = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
162 |
BigDecimal base = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
163 |
base = base.add(rowFicheElt.getBigDecimal("NB_BASE"));
|
163 |
base = base.add(rowFicheElt.getBigDecimal("NB_BASE"));
|
164 |
rowVals.put("NB_BASE", base);
|
164 |
rowVals.put("NB_BASE", base);
|
165 |
}
|
165 |
}
|
166 |
if (rowFicheElt.getObject("MONTANT_PAT") != null) {
|
166 |
if (rowFicheElt.getObject("MONTANT_PAT") != null) {
|
167 |
Object o = rowVals.getObject("MONTANT_PAT");
|
167 |
Object o = rowVals.getObject("MONTANT_PAT");
|
168 |
BigDecimal montant = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
168 |
BigDecimal montant = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
169 |
montant = montant.add(rowFicheElt.getBigDecimal("MONTANT_PAT"));
|
169 |
montant = montant.add(rowFicheElt.getBigDecimal("MONTANT_PAT"));
|
170 |
rowVals.put("MONTANT_PAT", montant);
|
170 |
rowVals.put("MONTANT_PAT", montant);
|
171 |
}
|
171 |
}
|
172 |
if (rowFicheElt.getObject("MONTANT_SAL_DED") != null) {
|
172 |
if (rowFicheElt.getObject("MONTANT_SAL_DED") != null) {
|
173 |
Object o = rowVals.getObject("MONTANT_SAL_DED");
|
173 |
Object o = rowVals.getObject("MONTANT_SAL_DED");
|
174 |
BigDecimal montant = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
174 |
BigDecimal montant = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
175 |
montant = montant.add(rowFicheElt.getBigDecimal("MONTANT_SAL_DED"));
|
175 |
montant = montant.add(rowFicheElt.getBigDecimal("MONTANT_SAL_DED"));
|
176 |
rowVals.put("MONTANT_SAL_DED", montant);
|
176 |
rowVals.put("MONTANT_SAL_DED", montant);
|
177 |
}
|
177 |
}
|
178 |
} else {
|
178 |
} else {
|
179 |
rowVals = new SQLRowValues(tableFichePayeElement);
|
179 |
rowVals = new SQLRowValues(tableFichePayeElement);
|
180 |
Configuration.getInstance().getDirectory().getElement(tableFichePayeElement).loadAllSafe(rowVals, rowFicheElt);
|
180 |
Configuration.getInstance().getDirectory().getElement(tableFichePayeElement).loadAllSafe(rowVals, rowFicheElt);
|
181 |
BigDecimal montantPat, montantSal;
|
181 |
BigDecimal montantPat, montantSal;
|
182 |
|
182 |
|
183 |
Object o = rowVals.getObject("MONTANT_PAT");
|
183 |
Object o = rowVals.getObject("MONTANT_PAT");
|
184 |
montantPat = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
184 |
montantPat = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
185 |
|
185 |
|
186 |
o = rowVals.getObject("MONTANT_SAL_DED");
|
186 |
o = rowVals.getObject("MONTANT_SAL_DED");
|
187 |
montantSal = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
187 |
montantSal = (o == null) ? BigDecimal.ZERO : ((BigDecimal) o);
|
188 |
|
188 |
|
189 |
if (montantPat.signum() != 0 || montantSal.signum() != 0) {
|
189 |
if (montantPat.signum() != 0 || montantSal.signum() != 0) {
|
190 |
mapValueRub.put(rowFicheElt.getObject("IDSOURCE"), rowVals);
|
190 |
mapValueRub.put(rowFicheElt.getObject("IDSOURCE"), rowVals);
|
191 |
}
|
191 |
}
|
192 |
}
|
192 |
}
|
193 |
|
193 |
|
194 |
}
|
194 |
}
|
195 |
|
195 |
|
196 |
// Fill
|
196 |
// Fill
|
197 |
int posLine = 1;
|
197 |
int posLine = 1;
|
198 |
int firstLine = 1;
|
198 |
int firstLine = 1;
|
199 |
|
199 |
|
200 |
System.err.println("Dump fiche " + mapFiche);
|
200 |
System.err.println("Dump fiche " + mapFiche);
|
201 |
System.err.println("NB Pages = " + mapCaisse.keySet().size());
|
201 |
System.err.println("NB Pages = " + mapCaisse.keySet().size());
|
202 |
|
202 |
|
203 |
for (int n = 0; n < mapCaisse.keySet().size(); n++) {
|
203 |
for (int n = 0; n < mapCaisse.keySet().size(); n++) {
|
204 |
|
204 |
|
205 |
// entete
|
205 |
// entete
|
206 |
makeEntete(posLine);
|
206 |
makeEntete(posLine);
|
207 |
posLine += (debutFill - 1);
|
207 |
posLine += (debutFill - 1);
|
208 |
|
208 |
|
209 |
Map mapValue = (Map) mapCaisse.get(mapCaisse.keySet().toArray()[n]);
|
209 |
Map mapValue = (Map) mapCaisse.get(mapCaisse.keySet().toArray()[n]);
|
210 |
BigDecimal totalMontantSal = BigDecimal.ZERO;
|
210 |
BigDecimal totalMontantSal = BigDecimal.ZERO;
|
211 |
BigDecimal totalMontantPat = BigDecimal.ZERO;
|
211 |
BigDecimal totalMontantPat = BigDecimal.ZERO;
|
212 |
|
212 |
|
213 |
SQLRow rowCaisse = tableCaisse.getRow(Integer.parseInt(mapCaisse.keySet().toArray()[n].toString()));
|
213 |
SQLRow rowCaisse = tableCaisse.getRow(Integer.parseInt(mapCaisse.keySet().toArray()[n].toString()));
|
214 |
this.mCell.put("A" + posLine, "Caisse " + rowCaisse.getObject("NOM"));
|
214 |
this.mCell.put("A" + posLine, "Caisse " + rowCaisse.getObject("NOM"));
|
215 |
this.mCell.put("B" + posLine, "");
|
215 |
this.mCell.put("B" + posLine, "");
|
216 |
this.mCell.put("C" + posLine, "");
|
216 |
this.mCell.put("C" + posLine, "");
|
217 |
this.mCell.put("D" + posLine, "");
|
217 |
this.mCell.put("D" + posLine, "");
|
218 |
this.mCell.put("E" + posLine, "");
|
218 |
this.mCell.put("E" + posLine, "");
|
219 |
this.mCell.put("F" + posLine, "");
|
219 |
this.mCell.put("F" + posLine, "");
|
220 |
this.mapStyleRow.put(new Integer(posLine), "Titre 1");
|
220 |
this.mapStyleRow.put(new Integer(posLine), "Titre 1");
|
221 |
|
221 |
|
222 |
posLine++;
|
222 |
posLine++;
|
223 |
|
223 |
|
224 |
for (int i = 0; i < mapValue.keySet().size(); i++) {
|
224 |
for (int i = 0; i < mapValue.keySet().size(); i++) {
|
225 |
SQLRowValues rowVals = (SQLRowValues) mapValue.get(mapValue.keySet().toArray()[i]);
|
225 |
SQLRowValues rowVals = (SQLRowValues) mapValue.get(mapValue.keySet().toArray()[i]);
|
226 |
|
226 |
|
227 |
this.mCell.put("A" + posLine, rowVals.getObject("NOM"));
|
227 |
this.mCell.put("A" + posLine, rowVals.getObject("NOM"));
|
228 |
this.mCell.put("B" + posLine, rowVals.getObject("NB_BASE"));
|
228 |
this.mCell.put("B" + posLine, rowVals.getObject("NB_BASE"));
|
229 |
|
229 |
|
230 |
BigDecimal txSal = rowVals.getBigDecimal("TAUX_SAL");
|
230 |
BigDecimal txSal = rowVals.getBigDecimal("TAUX_SAL");
|
231 |
txSal = (txSal == null) ? BigDecimal.ZERO : txSal;
|
231 |
txSal = (txSal == null) ? BigDecimal.ZERO : txSal;
|
232 |
BigDecimal txPat = rowVals.getBigDecimal("TAUX_PAT");
|
232 |
BigDecimal txPat = rowVals.getBigDecimal("TAUX_PAT");
|
233 |
txPat = (txPat == null) ? BigDecimal.ZERO : txPat;
|
233 |
txPat = (txPat == null) ? BigDecimal.ZERO : txPat;
|
234 |
this.mCell.put("C" + posLine, txSal.add(txPat));
|
234 |
this.mCell.put("C" + posLine, txSal.add(txPat));
|
235 |
|
235 |
|
236 |
// System.err.println(rowVals.getObject("MONTANT_SAL_DED").getClass());
|
236 |
// System.err.println(rowVals.getObject("MONTANT_SAL_DED").getClass());
|
237 |
BigDecimal montantSal = rowVals.getBigDecimal("MONTANT_SAL_DED");
|
237 |
BigDecimal montantSal = rowVals.getBigDecimal("MONTANT_SAL_DED");
|
238 |
montantSal = (montantSal == null) ? BigDecimal.ZERO : montantSal;
|
238 |
montantSal = (montantSal == null) ? BigDecimal.ZERO : montantSal;
|
239 |
BigDecimal montantPat = rowVals.getBigDecimal("MONTANT_PAT");
|
239 |
BigDecimal montantPat = rowVals.getBigDecimal("MONTANT_PAT");
|
240 |
montantPat = (montantPat == null) ? BigDecimal.ZERO : montantPat;
|
240 |
montantPat = (montantPat == null) ? BigDecimal.ZERO : montantPat;
|
241 |
this.mCell.put("D" + posLine, montantPat);
|
241 |
this.mCell.put("D" + posLine, montantPat);
|
242 |
this.mCell.put("E" + posLine, montantSal);
|
242 |
this.mCell.put("E" + posLine, montantSal);
|
243 |
this.mCell.put("F" + posLine, montantSal.add(montantPat));
|
243 |
this.mCell.put("F" + posLine, montantSal.add(montantPat));
|
244 |
totalMontantPat = totalMontantPat.add(montantPat);
|
244 |
totalMontantPat = totalMontantPat.add(montantPat);
|
245 |
totalMontantSal = totalMontantSal.add(montantSal);
|
245 |
totalMontantSal = totalMontantSal.add(montantSal);
|
246 |
|
246 |
|
247 |
this.mapStyleRow.put(new Integer(posLine), "Normal");
|
247 |
this.mapStyleRow.put(new Integer(posLine), "Normal");
|
248 |
posLine++;
|
248 |
posLine++;
|
249 |
}
|
249 |
}
|
250 |
|
250 |
|
251 |
this.mCell.put("A" + posLine, "Total");
|
251 |
this.mCell.put("A" + posLine, "Total");
|
252 |
this.mCell.put("B" + posLine, "");
|
252 |
this.mCell.put("B" + posLine, "");
|
253 |
this.mCell.put("C" + posLine, "");
|
253 |
this.mCell.put("C" + posLine, "");
|
254 |
this.mCell.put("D" + posLine, totalMontantPat);
|
254 |
this.mCell.put("D" + posLine, totalMontantPat);
|
255 |
this.mCell.put("E" + posLine, totalMontantSal);
|
255 |
this.mCell.put("E" + posLine, totalMontantSal);
|
256 |
this.mCell.put("F" + posLine, totalMontantPat.add(totalMontantSal));
|
256 |
this.mCell.put("F" + posLine, totalMontantPat.add(totalMontantSal));
|
257 |
this.mapStyleRow.put(new Integer(posLine), "Titre 1");
|
257 |
this.mapStyleRow.put(new Integer(posLine), "Titre 1");
|
258 |
|
258 |
|
259 |
// pied de page
|
259 |
// pied de page
|
260 |
posLine = firstLine + endFill - 1;
|
260 |
posLine = firstLine + endFill - 1;
|
261 |
posLine += 2;
|
261 |
posLine += 2;
|
262 |
makeBasPage(posLine);
|
262 |
makeBasPage(posLine);
|
263 |
|
263 |
|
264 |
posLine++;
|
264 |
posLine++;
|
265 |
firstLine = posLine;
|
265 |
firstLine = posLine;
|
266 |
}
|
266 |
}
|
267 |
|
267 |
|
268 |
this.nbPage = mapCaisse.size();
|
268 |
this.nbPage = mapCaisse.size();
|
269 |
|
269 |
|
- |
|
270 |
if (this.nbPage < 1) {
|
- |
|
271 |
this.nbPage = 1;
|
- |
|
272 |
}
|
270 |
System.err.println("Nombre de page " + this.nbPage);
|
273 |
System.err.println("Nombre de page " + this.nbPage);
|
271 |
|
274 |
|
272 |
// on conserve la page d'origine du model
|
- |
|
273 |
|
- |
|
274 |
if (this.nbPage > 0) {
|
- |
|
275 |
this.nbPage--;
|
- |
|
276 |
}
|
- |
|
277 |
}
|
275 |
}
|
278 |
}
|
276 |
}
|