OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 156
Line 70... Line 70...
70
    // Configuration.getInstance().getBase().getTable("PERIODE_VALIDITE");
70
    // Configuration.getInstance().getBase().getTable("PERIODE_VALIDITE");
71
 
71
 
72
    private SQLJavaEditor javaEdit = new SQLJavaEditor(VariablePayeSQLElement.getMapTree());
72
    private SQLJavaEditor javaEdit = new SQLJavaEditor(VariablePayeSQLElement.getMapTree());
73
 
73
 
74
    // liste des variable de paye à calculer
74
    // liste des variable de paye à calculer
75
    private BigDecimal salBrut, salBrutBase, salBrutCotis, salBrutTaxable, cotPat, cotSal, taxCmPat, taxCmSal, netImp, netAPayer, csg, csgSansAbattement, cice, allegmentCotisation, avantage,
75
    private BigDecimal salBrut, salBrutBase, salBrutCotis, salBrutTaxable, cotPat, cotSal, taxCmPat, taxCmSal, netImp, pas, netAPayer, csg, csgSansAbattement, cice, allegmentCotisation, avantage,
76
            reduction;
76
            reduction;
77
 
77
 
78
    private Map<Integer, String> mapField;
78
    private Map<Integer, String> mapField;
79
 
79
 
80
    private final BigDecimal tauxCSG;
80
    private final BigDecimal tauxCSG;
Line 152... Line 152...
152
 
152
 
153
    public BigDecimal getCsgSansAbattement() {
153
    public BigDecimal getCsgSansAbattement() {
154
        return csgSansAbattement;
154
        return csgSansAbattement;
155
    }
155
    }
156
 
156
 
-
 
157
    public BigDecimal getPas() {
-
 
158
        return pas;
-
 
159
    }
-
 
160
 
157
    public BigDecimal getNetAPayerTotal() {
161
    public BigDecimal getNetAPayerTotal() {
158
        return netAPayer.add(this.salBrut);
162
        return netAPayer.add(this.salBrut);
159
    }
163
    }
160
 
164
 
161
    public BigDecimal getNetImpTotal() {
165
    public BigDecimal getNetImpTotal() {
162
        return netImp.add(this.salBrut);
166
        return netImp.add(this.salBrutTaxable);
-
 
167
    }
-
 
168
 
-
 
169
    public BigDecimal getNetAvantPas() {
-
 
170
        return getNetAPayerTotal().subtract(this.pas);
163
    }
171
    }
164
 
172
 
165
    public BigDecimal getSalBrut() {
173
    public BigDecimal getSalBrut() {
166
        return salBrut;
174
        return salBrut;
167
    }
175
    }
Line 204... Line 212...
204
        this.cotPat = BigDecimal.ZERO;
212
        this.cotPat = BigDecimal.ZERO;
205
        this.cotSal = BigDecimal.ZERO;
213
        this.cotSal = BigDecimal.ZERO;
206
        this.taxCmPat = BigDecimal.ZERO;
214
        this.taxCmPat = BigDecimal.ZERO;
207
        this.taxCmSal = BigDecimal.ZERO;
215
        this.taxCmSal = BigDecimal.ZERO;
208
        this.netAPayer = BigDecimal.ZERO;
216
        this.netAPayer = BigDecimal.ZERO;
-
 
217
        this.pas = BigDecimal.ZERO;
209
        this.netImp = BigDecimal.ZERO;
218
        this.netImp = BigDecimal.ZERO;
210
        this.csg = BigDecimal.ZERO;
219
        this.csg = BigDecimal.ZERO;
211
        this.csgSansAbattement = BigDecimal.ZERO;
220
        this.csgSansAbattement = BigDecimal.ZERO;
212
    }
221
    }
213
 
222
 
Line 755... Line 764...
755
            rowValsFiche.put("SAL_BASE_BRUT", this.salBrutBase);
764
            rowValsFiche.put("SAL_BASE_BRUT", this.salBrutBase);
756
            rowValsFiche.put("SAL_BRUT_COTISABLE", this.salBrutCotis);
765
            rowValsFiche.put("SAL_BRUT_COTISABLE", this.salBrutCotis);
757
            rowValsFiche.put("SAL_BRUT_TAXABLE", this.salBrutTaxable);
766
            rowValsFiche.put("SAL_BRUT_TAXABLE", this.salBrutTaxable);
758
            rowValsFiche.put("NET_IMP", getNetImpTotal());
767
            rowValsFiche.put("NET_IMP", getNetImpTotal());
759
            rowValsFiche.put("NET_A_PAYER", getNetAPayerTotal());
768
            rowValsFiche.put("NET_A_PAYER", getNetAPayerTotal());
-
 
769
            rowValsFiche.put("NET_AVANT_PAS", getNetAvantPas());
760
            rowValsFiche.put("COT_SAL", this.cotSal);
770
            rowValsFiche.put("COT_SAL", this.cotSal);
761
            rowValsFiche.put("COT_PAT", this.cotPat);
771
            rowValsFiche.put("COT_PAT", this.cotPat);
762
            rowValsFiche.put("TAXE_CM_PAT", this.taxCmPat);
772
            rowValsFiche.put("TAXE_CM_PAT", this.taxCmPat);
763
            rowValsFiche.put("TAXE_CM_SAL", this.taxCmSal);
773
            rowValsFiche.put("TAXE_CM_SAL", this.taxCmSal);
764
            rowValsFiche.put("CSG", getCsgTotal());
774
            rowValsFiche.put("CSG", getCsgTotal());
765
            rowValsFiche.put("HEURE_TRAV", getHeureTrav());
775
            rowValsFiche.put("HEURE_TRAV", getHeureTrav());
-
 
776
            rowValsFiche.put("TOTAL_PAS", getPas());
-
 
777
 
766
            if (this.cice == null) {
778
            if (this.cice == null) {
767
                if (salBrut.signum() > 0
779
                if (salBrut.signum() > 0
768
                        && salBrut.compareTo(new BigDecimal(getSmicHoraire(tableFichePaye.getDBRoot())).multiply(getHeureTrav()).multiply(new BigDecimal(2.5), DecimalUtils.HIGH_PRECISION)) <= 0) {
780
                        && salBrut.compareTo(new BigDecimal(getSmicHoraire(tableFichePaye.getDBRoot())).multiply(getHeureTrav()).multiply(new BigDecimal(2.5), DecimalUtils.HIGH_PRECISION)) <= 0) {
769
                    this.cice = salBrut;
781
                    this.cice = salBrut;
770
                } else {
782
                } else {
Line 952... Line 964...
952
 
964
 
953
                    this.netAPayer = this.netAPayer.subtract(montant);
965
                    this.netAPayer = this.netAPayer.subtract(montant);
954
                    if (rowSource.getBoolean("IMPOSABLE")) {
966
                    if (rowSource.getBoolean("IMPOSABLE")) {
955
                        this.netImp = this.netImp.subtract(montant);
967
                        this.netImp = this.netImp.subtract(montant);
956
                    }
968
                    }
-
 
969
                    if (rowSource.getBoolean("PAS")) {
-
 
970
                        this.pas = this.pas.subtract(montant);
-
 
971
                    }
957
 
972
 
958
                } // Gain
973
                } // Gain
959
                else {
974
                else {
960
 
975
 
961
                    rowVals.put("MONTANT_SAL_AJ", montant);
976
                    rowVals.put("MONTANT_SAL_AJ", montant);
962
 
977
 
963
                    this.netAPayer = this.netAPayer.add(montant);
978
                    this.netAPayer = this.netAPayer.add(montant);
964
                    if (rowSource.getBoolean("IMPOSABLE")) {
979
                    if (rowSource.getBoolean("IMPOSABLE")) {
965
                        this.netImp = this.netImp.add(montant);
980
                        this.netImp = this.netImp.add(montant);
966
                    }
981
                    }
-
 
982
                    if (rowSource.getBoolean("PAS")) {
-
 
983
                        this.pas = this.pas.add(montant);
-
 
984
                    }
967
                }
985
                }
968
 
986
 
969
                // Mis a jour du salaire net
987
                // Mis a jour du salaire net
970
                // updateValueFiche();
988
                // updateValueFiche();
971
            } else {
989
            } else {
Line 973... Line 991...
973
                if (ded != null) {
991
                if (ded != null) {
974
                    this.netAPayer = this.netAPayer.subtract(ded);
992
                    this.netAPayer = this.netAPayer.subtract(ded);
975
                    if (rowSource.getBoolean("IMPOSABLE")) {
993
                    if (rowSource.getBoolean("IMPOSABLE")) {
976
                        this.netImp = this.netImp.subtract(ded);
994
                        this.netImp = this.netImp.subtract(ded);
977
                    }
995
                    }
-
 
996
                    if (rowSource.getBoolean("PAS")) {
-
 
997
                        this.pas = this.pas.subtract(ded);
-
 
998
                    }
978
                }
999
                }
979
                BigDecimal add = rowVals.getBigDecimal("MONTANT_SAL_AJ");
1000
                BigDecimal add = rowVals.getBigDecimal("MONTANT_SAL_AJ");
980
                if (add != null) {
1001
                if (add != null) {
981
                    this.netAPayer = this.netAPayer.add(add);
1002
                    this.netAPayer = this.netAPayer.add(add);
982
                    if (rowSource.getBoolean("IMPOSABLE")) {
1003
                    if (rowSource.getBoolean("IMPOSABLE")) {
983
                        this.netImp = this.netImp.add(add);
1004
                        this.netImp = this.netImp.add(add);
984
                    }
1005
                    }
-
 
1006
                    if (rowSource.getBoolean("IMPOSABLE")) {
-
 
1007
                        this.pas = this.pas.add(add);
-
 
1008
                    }
985
                }
1009
                }
986
            }
1010
            }
987
        }
1011
        }
988
    }
1012
    }
989
 
1013
 
Line 1055... Line 1079...
1055
                this.cotPat = this.cotPat.add(montantPat);
1079
                this.cotPat = this.cotPat.add(montantPat);
1056
            }
1080
            }
1057
 
1081
 
1058
            // CICE
1082
            // CICE
1059
            int codeTP = rowSource.getForeignID("ID_CODE_CAISSE_TYPE_RUBRIQUE");
1083
            int codeTP = rowSource.getForeignID("ID_CODE_CAISSE_TYPE_RUBRIQUE");
1060
            if (codeTP == 298) {
1084
            String codeStringTP = "";
-
 
1085
            if (rowSource.getForeign("ID_CODE_CAISSE_TYPE_RUBRIQUE") != null && !rowSource.isForeignEmpty("ID_CODE_CAISSE_TYPE_RUBRIQUE")) {
-
 
1086
                codeStringTP = rowSource.getForeign("ID_CODE_CAISSE_TYPE_RUBRIQUE").getString("CODE");
-
 
1087
            }
-
 
1088
 
-
 
1089
            if (codeTP == 298 || codeStringTP.equals("400")) {
1061
                this.cice = rowVals.getBigDecimal("NB_BASE");
1090
                this.cice = rowVals.getBigDecimal("NB_BASE");
1062
            }
1091
            }
1063
 
1092
 
1064
            // Mis a jour des cotisations
1093
            // Mis a jour des cotisations
1065
            // updateValueFiche();
1094
            // updateValueFiche();
1066
        }
1095
        }
-
 
1096
 
1067
    }
1097
    }
1068
 
1098
 
1069
    private void loadElementCotisation(final SQLRow rowSource, SQLRow row) {
1099
    private void loadElementCotisation(final SQLRow rowSource, SQLRow row) {
1070
        SQLRowValues rowVals = new SQLRowValues(tableFichePayeElt);
1100
        SQLRowValues rowVals = new SQLRowValues(tableFichePayeElt);
1071
        // System.err.println("________________________LOAD ELT COTISATION");
1101
        // System.err.println("________________________LOAD ELT COTISATION");
Line 1125... Line 1155...
1125
        if (loadElement(rowVals, rowSource, row)) {
1155
        if (loadElement(rowVals, rowSource, row)) {
1126
            this.vectRubrique.add(rowVals);
1156
            this.vectRubrique.add(rowVals);
1127
            return;
1157
            return;
1128
        }
1158
        }
1129
 
1159
 
-
 
1160
        try {
1130
        Object baseOb = this.javaEdit.checkFormule(rowSource.getString("NB_BASE"), "BASE");
1161
            Object baseOb = this.javaEdit.checkFormule(rowSource.getString("NB_BASE"), "BASE");
1131
        Object tauxSalOb = this.javaEdit.checkFormule(rowSource.getString("TAUX_SAL"), "SAL");
1162
            Object tauxSalOb = this.javaEdit.checkFormule(rowSource.getString("TAUX_SAL"), "SAL");
1132
        Object tauxPatOb = this.javaEdit.checkFormule(rowSource.getString("TAUX_PAT"), "PAT");
1163
            Object tauxPatOb = this.javaEdit.checkFormule(rowSource.getString("TAUX_PAT"), "PAT");
1133
        Object montantPatOb = this.javaEdit.checkFormule(rowSource.getString("MONTANT_PAT"), "MONTANT");
1164
            Object montantPatOb = this.javaEdit.checkFormule(rowSource.getString("MONTANT_PAT"), "MONTANT");
1134
        Object montantAdOb = this.javaEdit.checkFormule(rowSource.getString("MONTANT_SAL_AJ"), "MONTANT");
1165
            Object montantAdOb = this.javaEdit.checkFormule(rowSource.getString("MONTANT_SAL_AJ"), "MONTANT");
Line 1142... Line 1173...
1142
        rowVals.put("MONTANT_SAL_AJ", montantAj);
1173
            rowVals.put("MONTANT_SAL_AJ", montantAj);
1143
        final BigDecimal montantDed = (montantDedOb == null) ? null : new BigDecimal(montantDedOb.toString());
1174
            final BigDecimal montantDed = (montantDedOb == null) ? null : new BigDecimal(montantDedOb.toString());
1144
        rowVals.put("MONTANT_SAL_DED", montantDed);
1175
            rowVals.put("MONTANT_SAL_DED", montantDed);
1145
 
1176
 
1146
        boolean b = isEltImprimable(rowSource, rowVals);
1177
            boolean b = isEltImprimable(rowSource, rowVals);
1147
        // System.err.println("Impression --- > " + b);
-
 
1148
        rowVals.put("IMPRESSION", Boolean.valueOf(b));
1178
            rowVals.put("IMPRESSION", Boolean.valueOf(b));
1149
 
1179
 
1150
        if (rowSource.getBoolean("REDUCTION_GVT_COM")) {
1180
            if (rowSource.getBoolean("REDUCTION_GVT_COM")) {
1151
            if (montantAj != null) {
1181
                if (montantAj != null) {
1152
                this.reduction = this.reduction.subtract(montantAj);
1182
                    this.reduction = this.reduction.subtract(montantAj);
Line 1155... Line 1185...
1155
                this.reduction = this.reduction.add(montantDed);
1185
                    this.reduction = this.reduction.add(montantDed);
1156
            }
1186
                }
1157
        }
1187
            }
1158
 
1188
 
1159
        this.vectRubrique.add(rowVals);
1189
            this.vectRubrique.add(rowVals);
-
 
1190
        } catch (NumberFormatException e) {
-
 
1191
            JOptionPane.showMessageDialog(null, "Une des formules de la rubrique de commentaire " + rowSource.getString("CODE") + " -- " + rowSource.getString("NOM") + " n'est pas correcte!");
-
 
1192
        }
1160
    }
1193
    }
1161
 
1194
 
1162
    private void calculValue() {
1195
    private void calculValue() {
1163
 
1196
 
1164
        System.err.println("Start calculValue At " + new Date());
1197
        System.err.println("Start calculValue At " + new Date());
1165
 
1198
 
1166
        resetValueFiche();
1199
        resetValueFiche();
1167
 
1200
 
1168
        /*
-
 
1169
         * this.threadUpdate = new Thread("Update Fiche Paye") { public void run() {
-
 
1170
         */
-
 
1171
        Vector<SQLRowValues> vectTmp = new Vector<SQLRowValues>(this.vectRubrique);
1201
        Vector<SQLRowValues> vectTmp = new Vector<SQLRowValues>(this.vectRubrique);
1172
 
1202
 
1173
        this.vectRubrique = new Vector<SQLRowValues>();
1203
        this.vectRubrique = new Vector<SQLRowValues>();
1174
        for (int i = 0; i < vectTmp.size(); i++) {
1204
        for (int i = 0; i < vectTmp.size(); i++) {
1175
 
1205
 
Line 1178... Line 1208...
1178
            int idSource = rowVals.getInt("IDSOURCE");
1208
            int idSource = rowVals.getInt("IDSOURCE");
1179
            SQLRow row = tableFichePayeElt.getRow(rowVals.getID());
1209
            SQLRow row = tableFichePayeElt.getRow(rowVals.getID());
1180
 
1210
 
1181
            if (source.trim().length() != 0) {
1211
            if (source.trim().length() != 0) {
1182
 
1212
 
1183
                // System.err.println("Source != null");
-
 
1184
 
-
 
1185
                if (this.mapTableSource.get(source) != null) {
1213
                if (this.mapTableSource.get(source) != null) {
1186
                    SQLRow rowSource = this.mapTableSource.get(source).getRow(idSource);
1214
                    SQLRow rowSource = this.mapTableSource.get(source).getRow(idSource);
1187
 
1215
 
1188
                    if (rowSource.getTable().getName().equalsIgnoreCase("RUBRIQUE_BRUT")) {
1216
                    if (rowSource.getTable().getName().equalsIgnoreCase("RUBRIQUE_BRUT")) {
1189
                        loadElementBrut(rowSource, row);
1217
                        loadElementBrut(rowSource, row);
Line 1203... Line 1231...
1203
            }
1231
            }
1204
        }
1232
        }
1205
        System.err.println(this.vectRubrique.size() + " elements ADDed ");
1233
        System.err.println(this.vectRubrique.size() + " elements ADDed ");
1206
        updateValueFiche();
1234
        updateValueFiche();
1207
        fireTableDataChanged();
1235
        fireTableDataChanged();
1208
        /*
-
 
1209
         * } }; this.threadUpdate.start();
-
 
1210
         */
-
 
1211
 
1236
 
1212
        System.err.println("End calculValue At " + new Date());
1237
        System.err.println("End calculValue At " + new Date());
1213
    }
1238
    }
1214
 
1239
 
1215
    public void validElt() {
1240
    public void validElt() {