OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 142 Rev 156
Line 15... Line 15...
15
 
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.config.Gestion;
17
import org.openconcerto.erp.config.Gestion;
18
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
19
import org.openconcerto.erp.core.finance.accounting.model.SommeCompte;
19
import org.openconcerto.erp.core.finance.accounting.model.SommeCompte;
20
import org.openconcerto.erp.preferences.TemplateNXProps;
-
 
21
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.model.SQLBase;
21
import org.openconcerto.sql.model.SQLBase;
23
import org.openconcerto.sql.model.SQLRow;
22
import org.openconcerto.sql.model.SQLRow;
24
import org.openconcerto.sql.model.SQLRowValues;
23
import org.openconcerto.sql.model.SQLRowValues;
25
import org.openconcerto.sql.model.SQLTable;
24
import org.openconcerto.sql.model.SQLTable;
26
import org.openconcerto.utils.GestionDevise;
25
import org.openconcerto.utils.GestionDevise;
27
 
26
 
28
import java.io.File;
-
 
29
import java.text.DateFormat;
-
 
30
import java.text.SimpleDateFormat;
-
 
31
import java.util.Calendar;
-
 
32
import java.util.Date;
27
import java.util.Date;
33
import java.util.HashMap;
28
import java.util.HashMap;
34
import java.util.Map;
29
import java.util.Map;
35
 
30
 
36
import javax.swing.JProgressBar;
31
import javax.swing.JProgressBar;
37
import javax.swing.SwingUtilities;
32
import javax.swing.SwingUtilities;
38
 
33
 
39
public class Map3310 extends Thread {
34
public class Map3310 extends Thread {
40
 
35
 
41
    private Map<String, Object> m;
36
    private Map<String, String> m;
42
    private final DateFormat format = new SimpleDateFormat("ddMMyyyy");
-
 
43
    private JProgressBar bar;
37
    private JProgressBar bar;
44
    private Date dateDebut, dateFin;
38
    private Date dateDebut;
45
 
-
 
-
 
39
    private Date dateFin;
46
    private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
40
    private static final SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
47
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
41
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
48
    private static final SQLTable tableCompte = Configuration.getInstance().getRoot().findTable("COMPTE_PCE");
42
    private static final SQLTable tableCompte = Configuration.getInstance().getRoot().findTable("COMPTE_PCE");
49
    private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
43
    private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
50
    SommeCompte sommeCompte;
44
    SommeCompte sommeCompte;
51
 
45
 
Line 115... Line 109...
115
            }
109
            }
116
        }
110
        }
117
        SQLRow rowCompteTVAImmo = tableCompte.getRow(idCompteTVAImmo);
111
        SQLRow rowCompteTVAImmo = tableCompte.getRow(idCompteTVAImmo);
118
 
112
 
119
        PdfGenerator_3310 p = new PdfGenerator_3310();
113
        PdfGenerator_3310 p = new PdfGenerator_3310();
120
        this.m = new HashMap<String, Object>();
114
        this.m = new HashMap<String, String>();
121
 
115
 
122
        long v010 = -this.sommeCompte.soldeCompte(70, 70, true, this.dateDebut, this.dateFin);
116
        long v010 = -this.sommeCompte.soldeCompte(70, 70, true, this.dateDebut, this.dateFin);
123
        this.m.put("A01", GestionDevise.round(v010));
117
        this.m.put("A01", GestionDevise.round(v010));
124
 
118
 
125
        // long vA02 = this.sommeCompte.soldeCompte(70, 70, true, this.dateDebut, this.dateFin);
-
 
126
        this.m.put("A02", "");
119
        this.m.put("A02", "");
127
        long tvaIntra = -this.sommeCompte.sommeCompteFils(rowCompteTVAIntra.getString("NUMERO"), this.dateDebut, this.dateFin);
120
        long tvaIntra = -this.sommeCompte.sommeCompteFils(rowCompteTVAIntra.getString("NUMERO"), this.dateDebut, this.dateFin);
128
        long achatsIntra = this.sommeCompte.sommeCompteFils(rowCompteAchatIntra.getString("NUMERO"), this.dateDebut, this.dateFin);
121
        long achatsIntra = this.sommeCompte.sommeCompteFils(rowCompteAchatIntra.getString("NUMERO"), this.dateDebut, this.dateFin);
129
        this.m.put("A03", GestionDevise.round(achatsIntra));
122
        this.m.put("A03", GestionDevise.round(achatsIntra));
130
        this.m.put("A04", "");
123
        this.m.put("A04", "");
Line 191... Line 184...
191
            }
184
            }
192
        });
185
        });
193
 
186
 
194
        SwingUtilities.invokeLater(new Runnable() {
187
        SwingUtilities.invokeLater(new Runnable() {
195
            public void run() {
188
            public void run() {
196
 
-
 
197
                String file = TemplateNXProps.getInstance().getStringProperty("Location3310PDF") + File.separator + String.valueOf(Calendar.getInstance().get(Calendar.YEAR)) + File.separator
-
 
198
                        + "result_3310_2.pdf";
-
 
199
                System.err.println(file);
-
 
200
                File f = new File(file);
-
 
201
                Gestion.openPDF(f);
189
                Gestion.openPDF(p.getGeneratedFile());
202
                Map3310.this.bar.setValue(100);
190
                Map3310.this.bar.setValue(100);
203
            }
191
            }
204
        });
192
        });
205
 
193
 
206
    }
194
    }
207
 
195
 
208
    public Map3310(JProgressBar bar, Date dateDeb, Date dateFin) {
196
    public Map3310(JProgressBar bar, Date dateDeb, Date dateFin) {
209
 
-
 
210
        this.bar = bar;
197
        this.bar = bar;
211
 
-
 
212
        if (dateDeb == null && dateFin == null) {
198
        if (dateDeb == null && dateFin == null) {
213
            SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
199
            SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
214
            SQLRow rowExercice = Configuration.getInstance().getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON"));
200
            SQLRow rowExercice = Configuration.getInstance().getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON"));
215
            dateFin = (Date) rowExercice.getObject("DATE_FIN");
201
            dateFin = (Date) rowExercice.getObject("DATE_FIN");
216
            dateDeb = (Date) rowExercice.getObject("DATE_DEB");
202
            dateDeb = (Date) rowExercice.getObject("DATE_DEB");
217
        }
203
        }
218
 
-
 
219
        this.dateDebut = dateDeb;
204
        this.dateDebut = dateDeb;
220
        this.dateFin = dateFin;
205
        this.dateFin = dateFin;
221
        this.sommeCompte = new SommeCompte();
206
        this.sommeCompte = new SommeCompte();
222
    }
207
    }
223
 
208
 
224
    public Map3310(JProgressBar bar) {
209
    public Map3310(JProgressBar bar) {
225
 
-
 
226
        this(bar, null, null);
210
        this(bar, null, null);
227
    }
211
    }
228
 
212
 
229
    public void generateMap2033A() {
213
    public void generateMap2033A() {
230
        this.start();
214
        this.start();