OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 21 → Rev 25

/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/ExerciceCommonSQLElement.java
123,6 → 123,9
 
@Override
public synchronized ValidState getValidState() {
if (this.dateDeb.getValue() == null || this.dateFin.getValue() == null) {
return new ValidState(false, "Date de début ou de fin d'exercice non définie");
}
return super.getValidState().and(ValidState.createCached(this.dateDeb.getValue().before(this.dateFin.getValue()), "Date de début après date de fin"));
}
};
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceSheet.java
14,8 → 14,8
package org.openconcerto.erp.core.finance.accounting.report;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.generationDoc.DocumentLocalStorageManager;
import org.openconcerto.erp.generationDoc.SheetInterface;
import org.openconcerto.erp.generationDoc.SheetXml;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.SQLRow;
23,9 → 23,7
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.utils.GestionDevise;
import org.openconcerto.utils.Tuple2;
 
import java.io.File;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
42,7 → 40,8
private boolean centralClient, centralFourn;
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final static DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
 
public static String TEMPLATE_ID = "Balance";
public static String TEMPLATE_PROPERTY_NAME = "LocationBalance";
private Date dateDu, dateAu;
private String compteDeb, compteEnd;
 
56,10 → 55,14
 
}
 
private static final Tuple2<String, String> tuple = Tuple2.create("LocationBalance", "Balance");
@Override
protected String getYear() {
return "";
}
 
public static Tuple2<String, String> getTuple2Location() {
return tuple;
@Override
public String getTemplateId() {
return TEMPLATE_ID;
}
 
public BalanceSheet(Date du, Date au, String compteDeb, String compteEnd, boolean centralClient, boolean centralFourn) {
72,10 → 75,11
this.nbRowsPerPage = 72;
this.printer = PrinterNXProps.getInstance().getStringProperty("BalancePrinter");
this.modele = "Balance.ods";
final String locationForTuple = SheetXml.getLocationForTuple(tuple, false);
System.err.println("Emplacement balance :::: " + locationForTuple);
this.locationOO = locationForTuple + File.separator + cal.get(Calendar.YEAR);
this.locationPDF = SheetXml.getLocationForTuple(tuple, true) + File.separator + cal.get(Calendar.YEAR);
 
final DocumentLocalStorageManager storage = DocumentLocalStorageManager.getInstance();
 
// this.locationOO = storage.getDocumentOutputDirectory(TEMPLATE_ID);
// this.locationPDF = storage.getPDFOutputDirectory(TEMPLATE_ID);
this.dateAu = au;
this.dateDu = du;
this.compteDeb = compteDeb;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceAgeeListeSheetXML.java
15,7 → 15,6
 
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
import org.openconcerto.erp.generationDoc.SheetXml;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
23,7 → 22,6
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.Where;
import org.openconcerto.utils.Tuple2;
 
import java.util.ArrayList;
import java.util.Calendar;
34,33 → 32,26
 
public class BalanceAgeeListeSheetXML extends AbstractListeSheetXml {
 
// private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
private Date deb, fin;
public static String TEMPLATE_ID = "Balance agée";
 
public static Tuple2<String, String> getTuple2Location() {
return tupleDefault;
}
 
public BalanceAgeeListeSheetXML(Date deb, Date fin) {
this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
this.deb = deb;
this.fin = fin;
 
this.locationOO = SheetXml.getLocationForTuple(tupleDefault, false);
this.locationPDF = SheetXml.getLocationForTuple(tupleDefault, true);
}
 
@Override
public String getDefaultModele() {
public String getDefaultTemplateId() {
return "BalanceAgee";
}
 
public String getFileName() {
return getValidFileName("BalanceAgee" + new Date().getTime());
@Override
public String getName() {
return "BalanceAgee" + new Date().getTime();
}
 
protected void createListeValues() {
 
SQLElement ecr = Configuration.getInstance().getDirectory().getElement("ECRITURE");
SQLElement cpt = Configuration.getInstance().getDirectory().getElement("COMPTE_PCE");
SQLElement fact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
106,7 → 97,6
long time = c.getTimeInMillis() - date;
long day = time / 86400000;
if (day < 0) {
// System.err.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
continue;
}
final SQLRow rowCpt = sqlRow.getForeignRow("ID_COMPTE_PCE");
185,7 → 175,7
valuesTab.add(e);
}
}
Map<String, Object> totalMap = new HashMap<String, Object>();
final Map<String, Object> totalMap = new HashMap<String, Object>();
totalMap.put("NOM", "TOTAL");
totalMap.put("30", total30 / 100.0);
totalMap.put("60", total60 / 100.0);
194,29 → 184,7
totalMap.put("TOTAL", totalFull / 100.0);
valuesTab.add(totalMap);
 
// Map<String, Object> values = this.mapAllSheetValues.get(0);
// if (values == null) {
// values = new HashMap<String, Object>();
// }
// valuesHA.put("TOTAL", totalHA);
// valuesE.put("TOTAL_HA", totalHA);
// valuesE.put("TOTAL", totalE);
// valuesE.put("TOTAL_VT", totalTPVTTC);
// values.put("TOTAL", totalVC);
// values.put("TOTAL_MARGE", totalTPVTTC - totalTPA);
//
// valuesE.put("TOTAL_GLOBAL", totalTPVTTC + totalHA);
// values.put("TOTAL_PA", totalTPA);
// values.put("TOTAL_PV_TTC", totalTPVTTC);
//
// String periode = "Période Du " + dateFormat.format(this.du) + " au " +
// dateFormat.format(this.au);
// values.put("DATE", periode);
// valuesHA.put("DATE", periode);
// valuesE.put("DATE", periode);
 
this.listAllSheetValues.put(0, valuesTab);
// this.mapAllSheetValues.put(0, values);
 
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/JournauxSheet.java
57,6 → 57,9
protected int lettrage;
private String compteDeb, compteEnd;
 
public static String TEMPLATE_ID = "Journaux";
public static String TEMPLATE_PROPERTY_NAME = "LocationJournaux";
 
public static void setSize(int debut, int fin) {
debutFill = debut;
endFill = fin;
66,10 → 69,14
setSize(7, 68);
}
 
private static final Tuple2<String, String> tuple = Tuple2.create("LocationJournaux", "Journaux");
@Override
public String getTemplateId() {
return TEMPLATE_ID;
}
 
public static Tuple2<String, String> getTuple2Location() {
return tuple;
@Override
protected String getYear() {
return "";
}
 
public JournauxSheet(int[] id, Date du, Date au, int lettrage, String compteDeb, String compteEnd) {
78,8 → 85,6
cal.setTime(au);
this.printer = PrinterNXProps.getInstance().getStringProperty("JournauxPrinter");
this.modele = "Journaux.ods";
this.locationOO = SheetXml.getLocationForTuple(tuple, false) + File.separator + cal.get(Calendar.YEAR);
this.locationPDF = SheetXml.getLocationForTuple(tuple, true) + File.separator + cal.get(Calendar.YEAR);
this.dateAu = au;
this.dateDu = du;
this.idS = id;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/GrandLivreSheet.java
16,7 → 16,6
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.generationDoc.SheetInterface;
import org.openconcerto.erp.generationDoc.SheetXml;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.erp.rights.ComptaUserRight;
import org.openconcerto.sql.Configuration;
28,10 → 27,8
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.utils.GestionDevise;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.ITransformer;
 
import java.io.File;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
66,6 → 63,9
private boolean centralFourn = false;
int idJrnlExclude = -1;
 
public static String TEMPLATE_ID = "Grand Livre";
public static String TEMPLATE_PROPERTY_NAME = "LocationGrandLivre";
 
public static void setSize(int debut, int fin) {
debutFill = debut;
endFill = fin;
75,10 → 75,9
setSize(7, 69);
}
 
private static final Tuple2<String, String> tuple = Tuple2.create("LocationGrandLivre", "Grand Livre");
 
public static Tuple2<String, String> getTuple2Location() {
return tuple;
@Override
protected String getYear() {
return "";
}
 
public GrandLivreSheet(Date du, Date au, String compteDep, String compteEnd, int lettrage, boolean cumul, boolean excludeCptSolde, boolean centralClient, boolean centralFourn, int idJrnlExclude) {
89,8 → 88,6
this.idJrnlExclude = idJrnlExclude;
this.printer = PrinterNXProps.getInstance().getStringProperty("GrandLivrePrinter");
this.modele = "GrandLivre.ods";
this.locationOO = SheetXml.getLocationForTuple(tuple, false) + File.separator + cal.get(Calendar.YEAR);
this.locationPDF = SheetXml.getLocationForTuple(tuple, true) + File.separator + cal.get(Calendar.YEAR);
this.dateAu = au;
this.dateDu = du;
this.compteDeb = compteDep.trim();
621,4 → 618,10
 
return map;
}
 
@Override
public String getTemplateId() {
// TODO Auto-generated method stub
return TEMPLATE_ID;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/BalanceAgeePanel.java
66,19 → 66,10
BalanceAgeeListeSheetXML l = new BalanceAgeeListeSheetXML(dateDeb.getDate(), dateFin.getDate());
 
try {
l.genere(false, false).get();
// FIXME Probleme avec l'odsviewer
if (!Boolean.getBoolean("org.openconcerto.oo.useODSViewer")) {
l.showDocument();
} else {
l.showPreviewDocument();
}
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
l.createDocument();
l.openDocument(false);
} catch (Exception e1) {
e1.printStackTrace();
} catch (ExecutionException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/GenerationPointagePanel.java
13,7 → 13,6
package org.openconcerto.erp.core.finance.accounting.ui;
 
 
import org.openconcerto.erp.generationDoc.gestcomm.PointageXmlSheet;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
69,7 → 68,6
 
this.add(this.spinYear, c);
 
JPanel panelButton = new JPanel();
panelButton.add(this.gen);
panelButton.add(this.close);
100,7 → 98,8
int mois = this.combo.getValue() - 2;
int year = Integer.valueOf(this.spinYear.getValue().toString());
PointageXmlSheet sheet = new PointageXmlSheet(mois, year);
sheet.genere(true, false);
sheet.createDocumentAsynchronous();
sheet.showPrintAndExportAsynchronous(true, false, true);
} else {
if (e.getSource() == this.close) {
((JFrame) SwingUtilities.getRoot(this)).dispose();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/action/ListeDesRelancesAction.java
26,6 → 26,7
import org.openconcerto.sql.view.list.SQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelColumnPath;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.utils.ExceptionHandler;
 
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
103,14 → 104,20
// Impression
AbstractAction actionPrintFact = new AbstractAction("Imprimer la facture") {
public void actionPerformed(ActionEvent e) {
final Thread t = new Thread(new Runnable() {
 
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowRelance.getForeignRow("ID_SAISIE_VENTE_FACTURE"));
if (sheet.getFileODS().exists()) {
sheet.fastPrintDocument();
} else {
sheet.genere(false, true);
@Override
public void run() {
try {
printInvoice(rowRelance);
} catch (Exception e) {
ExceptionHandler.handle("Impression impossible", e);
}
}
});
t.start();
 
}
};
menu.add(actionPrintFact);
 
118,14 → 125,19
 
AbstractAction actionPrintBoth = new AbstractAction("Imprimer la facture et la relance") {
public void actionPerformed(ActionEvent e) {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
s.fastPrintDocument();
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowRelance.getForeignRow("ID_SAISIE_VENTE_FACTURE"));
if (sheet.getFileODS().exists()) {
sheet.fastPrintDocument();
} else {
sheet.genere(false, true);
printInvoice(rowRelance);
} catch (Exception e) {
ExceptionHandler.handle("Impression impossible", e);
}
}
});
t.start();
}
};
menu.add(actionPrintBoth);
 
138,13 → 150,17
}
});
 
// Générer
// Créer la fiche de relance
menu.add(new AbstractAction("Créer la fiche de relance") {
public void actionPerformed(ActionEvent e) {
 
try {
FicheRelanceSheet sheet = new FicheRelanceSheet(rowRelance);
sheet.genere(true, false);
sheet.createDocumentAsynchronous();
sheet.showPrintAndExportAsynchronous(true, false, true);
} catch (Exception ex) {
ExceptionHandler.handle("Impression impossible", ex);
}
}
});
 
menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y);
159,4 → 175,11
 
public void mouseExited(MouseEvent e) {
}
 
private void printInvoice(final SQLRow rowRelance) throws Exception {
final VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowRelance.getForeignRow("ID_SAISIE_VENTE_FACTURE"));
sheet.getOrCreateDocumentFile();
sheet.fastPrintDocument();
sheet.showPrintAndExport(false, false, true);
}
}