OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 25 → Rev 21

/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/ExerciceCommonSQLElement.java
123,9 → 123,6
 
@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,7 → 23,9
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;
40,8 → 42,7
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;
 
55,14 → 56,10
 
}
 
@Override
protected String getYear() {
return "";
}
private static final Tuple2<String, String> tuple = Tuple2.create("LocationBalance", "Balance");
 
@Override
public String getTemplateId() {
return TEMPLATE_ID;
public static Tuple2<String, String> getTuple2Location() {
return tuple;
}
 
public BalanceSheet(Date du, Date au, String compteDeb, String compteEnd, boolean centralClient, boolean centralFourn) {
75,11 → 72,10
this.nbRowsPerPage = 72;
this.printer = PrinterNXProps.getInstance().getStringProperty("BalancePrinter");
this.modele = "Balance.ods";
 
final DocumentLocalStorageManager storage = DocumentLocalStorageManager.getInstance();
 
// this.locationOO = storage.getDocumentOutputDirectory(TEMPLATE_ID);
// this.locationPDF = storage.getPDFOutputDirectory(TEMPLATE_ID);
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);
this.dateAu = au;
this.dateDu = du;
this.compteDeb = compteDeb;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceAgeeListeSheetXML.java
15,6 → 15,7
 
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;
22,6 → 23,7
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;
32,26 → 34,33
 
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 getDefaultTemplateId() {
public String getDefaultModele() {
return "BalanceAgee";
}
 
@Override
public String getName() {
return "BalanceAgee" + new Date().getTime();
public String getFileName() {
return getValidFileName("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");
97,6 → 106,7
long time = c.getTimeInMillis() - date;
long day = time / 86400000;
if (day < 0) {
// System.err.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
continue;
}
final SQLRow rowCpt = sqlRow.getForeignRow("ID_COMPTE_PCE");
175,7 → 185,7
valuesTab.add(e);
}
}
final Map<String, Object> totalMap = new HashMap<String, Object>();
Map<String, Object> totalMap = new HashMap<String, Object>();
totalMap.put("NOM", "TOTAL");
totalMap.put("30", total30 / 100.0);
totalMap.put("60", total60 / 100.0);
184,7 → 194,29
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,9 → 57,6
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;
69,14 → 66,10
setSize(7, 68);
}
 
@Override
public String getTemplateId() {
return TEMPLATE_ID;
}
private static final Tuple2<String, String> tuple = Tuple2.create("LocationJournaux", "Journaux");
 
@Override
protected String getYear() {
return "";
public static Tuple2<String, String> getTuple2Location() {
return tuple;
}
 
public JournauxSheet(int[] id, Date du, Date au, int lettrage, String compteDeb, String compteEnd) {
85,6 → 78,8
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,6 → 16,7
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;
27,8 → 28,10
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;
63,9 → 66,6
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,9 → 75,10
setSize(7, 69);
}
 
@Override
protected String getYear() {
return "";
private static final Tuple2<String, String> tuple = Tuple2.create("LocationGrandLivre", "Grand Livre");
 
public static Tuple2<String, String> getTuple2Location() {
return tuple;
}
 
public GrandLivreSheet(Date du, Date au, String compteDep, String compteEnd, int lettrage, boolean cumul, boolean excludeCptSolde, boolean centralClient, boolean centralFourn, int idJrnlExclude) {
88,6 → 89,8
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();
618,10 → 621,4
 
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,10 → 66,19
BalanceAgeeListeSheetXML l = new BalanceAgeeListeSheetXML(dateDeb.getDate(), dateFin.getDate());
 
try {
l.createDocument();
l.openDocument(false);
} catch (Exception e1) {
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
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,6 → 13,7
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;
68,6 → 69,7
 
this.add(this.spinYear, c);
 
JPanel panelButton = new JPanel();
panelButton.add(this.gen);
panelButton.add(this.close);
98,8 → 100,7
int mois = this.combo.getValue() - 2;
int year = Integer.valueOf(this.spinYear.getValue().toString());
PointageXmlSheet sheet = new PointageXmlSheet(mois, year);
sheet.createDocumentAsynchronous();
sheet.showPrintAndExportAsynchronous(true, false, true);
sheet.genere(true, false);
} else {
if (e.getSource() == this.close) {
((JFrame) SwingUtilities.getRoot(this)).dispose();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/action/ListeDesRelancesAction.java
26,7 → 26,6
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;
104,20 → 103,14
// Impression
AbstractAction actionPrintFact = new AbstractAction("Imprimer la facture") {
public void actionPerformed(ActionEvent e) {
final Thread t = new Thread(new Runnable() {
 
@Override
public void run() {
try {
printInvoice(rowRelance);
} catch (Exception e) {
ExceptionHandler.handle("Impression impossible", e);
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowRelance.getForeignRow("ID_SAISIE_VENTE_FACTURE"));
if (sheet.getFileODS().exists()) {
sheet.fastPrintDocument();
} else {
sheet.genere(false, true);
}
}
});
t.start();
 
}
};
menu.add(actionPrintFact);
 
125,19 → 118,14
 
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();
printInvoice(rowRelance);
} catch (Exception e) {
ExceptionHandler.handle("Impression impossible", e);
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowRelance.getForeignRow("ID_SAISIE_VENTE_FACTURE"));
if (sheet.getFileODS().exists()) {
sheet.fastPrintDocument();
} else {
sheet.genere(false, true);
}
}
});
t.start();
}
};
menu.add(actionPrintBoth);
 
150,17 → 138,13
}
});
 
// Créer la fiche de relance
// Générer
menu.add(new AbstractAction("Créer la fiche de relance") {
public void actionPerformed(ActionEvent e) {
try {
 
FicheRelanceSheet sheet = new FicheRelanceSheet(rowRelance);
sheet.createDocumentAsynchronous();
sheet.showPrintAndExportAsynchronous(true, false, true);
} catch (Exception ex) {
ExceptionHandler.handle("Impression impossible", ex);
sheet.genere(true, false);
}
}
});
 
menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y);
175,11 → 159,4
 
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);
}
}