OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 73 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 73 Rev 142
Line 92... Line 92...
92
        // Liste des codes de lettrage hors période
92
        // Liste des codes de lettrage hors période
93
        SQLSelect sel = new SQLSelect();
93
        SQLSelect sel = new SQLSelect();
94
        sel.addSelect(ecr.getTable().getField("LETTRAGE"));
94
        sel.addSelect(ecr.getTable().getField("LETTRAGE"));
95
        Where w = new Where(ecr.getTable().getField("LETTRAGE"), "IS NOT", (Object) null);
95
        Where w = new Where(ecr.getTable().getField("LETTRAGE"), "IS NOT", (Object) null);
96
        w = w.and(new Where(ecr.getTable().getField("LETTRAGE"), "!=", ""));
96
        w = w.and(new Where(ecr.getTable().getField("LETTRAGE"), "!=", ""));
-
 
97
        if (this.fin == null) {
-
 
98
            this.fin = new Date();
-
 
99
        }
97
 
100
 
98
        if (fin != null) {
-
 
99
            w = w.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
101
        w = w.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
100
        }
-
 
101
        sel.setWhere(w);
102
        sel.setWhere(w);
102
 
103
 
103
        final List<String> lettrageList = (List<String>) Configuration.getInstance().getBase().getDataSource().executeCol(sel.asString());
104
        final List<String> lettrageList = (List<String>) Configuration.getInstance().getBase().getDataSource().executeCol(sel.asString());
104
 
105
 
105
        // Liste des codes de lettrage hors période
106
        // Liste des codes de lettrage hors période
Line 108... Line 109...
108
        Where w2 = new Where(ecr.getTable().getField("LETTRAGE"), "IS NOT", (Object) null);
109
        Where w2 = new Where(ecr.getTable().getField("LETTRAGE"), "IS NOT", (Object) null);
109
        w2 = w2.and(new Where(ecr.getTable().getField("LETTRAGE"), "!=", ""));
110
        w2 = w2.and(new Where(ecr.getTable().getField("LETTRAGE"), "!=", ""));
110
        if (deb != null) {
111
        if (deb != null) {
111
            w2 = w2.and(new Where(ecr.getTable().getField("DATE"), ">=", deb));
112
            w2 = w2.and(new Where(ecr.getTable().getField("DATE"), ">=", deb));
112
        }
113
        }
113
        if (fin != null) {
-
 
-
 
114
 
114
            w2 = w2.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
115
        w2 = w2.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
115
        }
116
 
116
        sel2.addGroupBy(ecr.getTable().getField("LETTRAGE"));
117
        sel2.addGroupBy(ecr.getTable().getField("LETTRAGE"));
117
        sel2.setHaving(Where.createRaw("SUM(\"DEBIT\") != SUM(\"CREDIT\")", Arrays.asList(ecr.getTable().getField("DEBIT"), ecr.getTable().getField("CREDIT"))));
118
        sel2.setHaving(Where.createRaw("SUM(\"DEBIT\") != SUM(\"CREDIT\")", Arrays.asList(ecr.getTable().getField("DEBIT"), ecr.getTable().getField("CREDIT"))));
118
        sel2.setWhere(w2);
119
        sel2.setWhere(w2);
119
        System.err.println(sel2.asString());
120
        System.err.println(sel2.asString());
120
        lettrageList.addAll((List<String>) Configuration.getInstance().getBase().getDataSource().executeCol(sel2.asString()));
121
        lettrageList.addAll((List<String>) Configuration.getInstance().getBase().getDataSource().executeCol(sel2.asString()));
Line 133... Line 134...
133
                final SQLTable tableEcriture = ecr.getTable();
134
                final SQLTable tableEcriture = ecr.getTable();
134
                Where w = new Where(tableEcriture.getField("COMPTE_NUMERO"), "LIKE", "411%");
135
                Where w = new Where(tableEcriture.getField("COMPTE_NUMERO"), "LIKE", "411%");
135
                if (deb != null) {
136
                if (deb != null) {
136
                    w = w.and(new Where(tableEcriture.getField("DATE"), ">=", deb));
137
                    w = w.and(new Where(tableEcriture.getField("DATE"), ">=", deb));
137
                }
138
                }
138
                if (fin != null) {
-
 
139
                    w = w.and(new Where(tableEcriture.getField("DATE"), "<=", fin));
139
                w = w.and(new Where(tableEcriture.getField("DATE"), "<=", fin));
140
                }
-
 
-
 
140
 
141
                // w = w.and(new Where(cpt.getTable().getField("NOM"), "LIKE", "%RIBEIRO%"));
141
                // w = w.and(new Where(cpt.getTable().getField("NOM"), "LIKE", "%RIBEIRO%"));
142
                // w = w.and(new Where(ecr.getTable().getField("ID_COMPTE_PCE"), "=",
142
                // w = w.and(new Where(ecr.getTable().getField("ID_COMPTE_PCE"), "=",
143
                // cpt.getTable().getKey()));
143
                // cpt.getTable().getKey()));
144
                // Where whereLettrage = new Where(ecr.getTable().getField("LETTRAGE"), "=",
144
                // Where whereLettrage = new Where(ecr.getTable().getField("LETTRAGE"), "=",
145
                // "").or(new
145
                // "").or(new