OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Ignore whitespace Rev 158 → Rev 159

/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/OLAPPanel.java
20,6 → 20,8
import org.openconcerto.utils.FileUtils;
 
public class OLAPPanel extends JPanel {
private String loadInfo = "";
 
public OLAPPanel() {
this.setOpaque(false);
this.setLayout(new GridLayout(1, 1));
38,10 → 40,12
if (f.exists()) {
System.out.println("OLAP: using catalog " + f.getAbsolutePath());
catalog = FileUtils.read(f, "UTF8");
loadInfo = f.getAbsolutePath() + " ok";
} else {
System.out.println("OLAP: using embedded catalog (" + f.getAbsolutePath() + " missing)");
final InputStream in = this.getClass().getResourceAsStream("openconcerto_catalog.xml");
catalog = FileUtils.readUTF8(in);
loadInfo = f.getAbsolutePath() + " missing";
}
final String url = getOlapURL(ComptaPropsConfiguration.getInstanceCompta(), catalog);
final Connection rConnection = DriverManager.getConnection(url);
90,4 → 94,8
}
return url;
}
 
public String getLoadInfo() {
return this.loadInfo;
}
}
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/OLAPMainPanel.java
1,6 → 1,8
package org.openconcerto.modules.reports.olap;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
8,7 → 10,12
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
 
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
17,9 → 24,13
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
 
import org.jopendocument.panel.Messages;
import org.olap4j.OlapConnection;
import org.olap4j.metadata.Schema;
import org.openconcerto.modules.reports.olap.renderer.Matrix;
import org.openconcerto.ui.JLabelBold;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.text.CSVWriter;
 
public class OLAPMainPanel extends JPanel {
OLAPMainPanel(OlapConnection oConnection, Schema schema, final OLAPPanel olapPanel) {
32,6 → 43,7
c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
final JLabelBold title = new JLabelBold("Analyse multidimensionnelle des données");
title.setToolTipText(olapPanel.getLoadInfo());
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
64,8 → 76,10
JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
split.setBorder(null);
final OLAPParametersPanel parameters = new OLAPParametersPanel(schema);
parameters.setMinimumSize(new Dimension(200, 200));
parameters.setOpaque(false);
split.setLeftComponent(parameters);
split.setDividerLocation(200);
split.setOpaque(true);
 
JPanel rightPanel = new JPanel();
75,16 → 89,65
final OLAPRenderer renderer = new OLAPRenderer();
 
final OLAPMDXPanel mdxPanel = new OLAPMDXPanel(parameters, oConnection, renderer);
 
final OLAPSQLPanel sqlPanel = new OLAPSQLPanel(renderer);
 
final OLAPConfigurationPanel confPanel = new OLAPConfigurationPanel(parameters, oConnection, renderer, mdxPanel);
parameters.setConfigurationPanel(confPanel);
JTabbedPane t = new JTabbedPane();
t.add("Mode simplifié", confPanel);
t.add("Requête MDX", mdxPanel);
 
t.add("Requête SQL", sqlPanel);
renderer.setOpaque(false);
t.setOpaque(false);
// Bottom panel
JPanel p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.LEFT));
JButton bExport = new JButton("Exporter");
bExport.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
 
Matrix m = renderer.getMatrix();
if (m == null) {
return;
}
JFileChooser fileChooser = new JFileChooser();
fileChooser.setSelectedFile(new File("export_olap.csv"));
fileChooser.setDialogTitle(Messages.getString("ODSViewerPanel.saveAs"));
 
int userSelection = fileChooser.showSaveDialog(OLAPMainPanel.this);
 
if (userSelection == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
 
try {
int witdth = m.getWidth();
final FileWriter writer = new FileWriter(file);
CSVWriter w = new CSVWriter(writer);
for (int y = 0; y < m.getHeight(); y++) {
String[] a = new String[witdth];
for (int x = 0; x < witdth; x++) {
a[x] = m.get(x, y).getValue();
}
w.writeNext(a);
w.flush();
}
w.close();
writer.close();
} catch (IOException e1) {
ExceptionHandler.handle("Erreur lors de l'export", e1);
}
}
}
});
 
p.add(bExport);
//
rightPanel.add(t, BorderLayout.NORTH);
rightPanel.add(renderer, BorderLayout.CENTER);
rightPanel.add(p, BorderLayout.SOUTH);
split.setRightComponent(rightPanel);
c.weightx = 1;
c.weighty = 1;
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/OLAPRenderer.java
1,4 → 1,5
package org.openconcerto.modules.reports.olap;
 
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
10,10 → 11,10
 
import org.olap4j.CellSet;
import org.openconcerto.modules.reports.olap.renderer.CellSetRenderer;
import org.openconcerto.modules.reports.olap.renderer.Matrix;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.ReloadPanel;
 
 
public class OLAPRenderer extends JPanel {
final CellSetRenderer cellSetRenderer;
final ReloadPanel reload;
53,4 → 54,13
}
 
}
 
public Matrix getMatrix() {
return this.cellSetRenderer.getMatrix();
}
 
public void setMatrix(Matrix matrix) {
setWaitState(false);
cellSetRenderer.setMatrix(matrix);
}
}
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/Module.java
78,21 → 78,4
protected void stop() {
}
 
public static void main(String[] args) throws IOException {
System.setProperty(ConnexionPanel.QUICK_LOGIN, "true");
final File propsFile = new File("module.properties");
 
final File distDir = new File("dist");
FileUtils.mkdir_p(distDir);
final ModulePackager modulePackager = new ModulePackager(propsFile, new File("bin/"));
modulePackager.setSkipDuplicateFiles(true);
modulePackager.addJarsFromDir(new File("lib"));
modulePackager.writeToDir(distDir);
modulePackager.writeToDir(new File("../OpenConcerto/Modules"));
SQLRequestLog.setEnabled(true);
SQLRequestLog.showFrame();
 
ModuleManager.getInstance().addFactories(new File("../OpenConcerto/Modules"));
Gestion.main(args);
}
}
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/renderer/CellSetRenderer.java
22,7 → 22,6
import org.olap4j.Position;
import org.olap4j.impl.CoordinateIterator;
import org.olap4j.impl.Olap4jUtil;
 
import org.olap4j.metadata.Member;
 
public class CellSetRenderer extends JComponent implements Scrollable {
34,11 → 33,16
private AxisInfo rowsAxisInfo;
private int w;
private int h;
private Matrix matrix;
 
public CellSetRenderer() {
 
}
 
public Matrix getMatrix() {
return matrix;
}
 
public CellSetRenderer(CellSet set) {
this.cellSet = set;
computeCells();
45,7 → 49,7
}
 
public void setCellSet(CellSet set) {
 
this.matrix = null;
this.cellSet = set;
computeCells();
repaint();
52,6 → 56,17
this.setSize(new Dimension(w, h));
}
 
public void setMatrix(Matrix matrix2) {
this.matrix = matrix2;
this.cellSet = null;
this.rowsAxis = null;
this.rowsAxisInfo = null;
this.columnsAxis = null;
this.columnsAxisInfo = null;
repaint();
this.setSize(new Dimension(w, h));
}
 
private void computeCells() {
if (cellSet == null) {
return;
80,10 → 95,16
}
 
boolean isOuside(int x, int y) {
if (rowsAxisInfo == null) {
return false;
}
return x < rowsAxisInfo.getWidth() && y < columnsAxisInfo.getWidth();
}
 
boolean isValue(int x, int y) {
if (rowsAxisInfo == null) {
return true;
}
return x >= rowsAxisInfo.getWidth() && y >= columnsAxisInfo.getWidth();
}
 
98,11 → 119,12
 
g.setColor(Color.WHITE);
g.fillRect(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height);
if (cellSet == null) {
 
if (cellSet == null && matrix == null) {
return;
}
 
if (cellSet.getAxes().size() > 2) {
if (cellSet != null && cellSet.getAxes().size() > 2) {
int[] dimensions = new int[cellSet.getAxes().size() - 2];
for (int i = 2; i < cellSet.getAxes().size(); i++) {
CellSetAxis cellSetAxis = cellSet.getAxes().get(i);
136,38 → 158,41
}
// Figure out the dimensions of the blank rectangle in the top left
// corner.
final int yOffset = columnsAxisInfo.getWidth();
final int xOffsset = rowsAxisInfo.getWidth();
int yOffset = 0;
int xOffsset = 0;
 
// Populate a string matrix
Matrix matrix = new Matrix(xOffsset + (columnsAxis == null ? 1 : columnsAxis.getPositions().size()), yOffset + (rowsAxis == null ? 1 : rowsAxis.getPositions().size()));
if (matrix == null) {
yOffset = columnsAxisInfo.getWidth();
xOffsset = rowsAxisInfo.getWidth();
this.matrix = new Matrix(xOffsset + (columnsAxis == null ? 1 : columnsAxis.getPositions().size()), yOffset + (rowsAxis == null ? 1 : rowsAxis.getPositions().size()));
 
// Populate corner
for (int x = 0; x < xOffsset; x++) {
for (int y = 0; y < yOffset; y++) {
matrix.set(x, y, "", false, x > 0);
// Populate corner
for (int x = 0; x < xOffsset; x++) {
for (int y = 0; y < yOffset; y++) {
matrix.set(x, y, "", false, x > 0);
}
}
}
 
// Populate matrix with cells representing axes
// noinspection SuspiciousNameCombination
populateAxis(matrix, columnsAxis, columnsAxisInfo, true, xOffsset);
populateAxis(matrix, rowsAxis, rowsAxisInfo, false, yOffset);
// Populate matrix with cells representing axes
// noinspection SuspiciousNameCombination
populateAxis(matrix, columnsAxis, columnsAxisInfo, true, xOffsset);
populateAxis(matrix, rowsAxis, rowsAxisInfo, false, yOffset);
 
// Populate cell values
for (Cell cell : cellIter(pageCoords, cellSet)) {
final List<Integer> coordList = cell.getCoordinateList();
int x = xOffsset;
if (coordList.size() > 0) {
x += coordList.get(0);
// Populate cell values
for (Cell cell : cellIter(pageCoords, cellSet)) {
final List<Integer> coordList = cell.getCoordinateList();
int x = xOffsset;
if (coordList.size() > 0) {
x += coordList.get(0);
}
int y = yOffset;
if (coordList.size() > 1) {
y += coordList.get(1);
}
matrix.set(x, y, cell.getFormattedValue(), true, false);
}
int y = yOffset;
if (coordList.size() > 1) {
y += coordList.get(1);
}
matrix.set(x, y, cell.getFormattedValue(), true, false);
}
 
final int matrixWidth = matrix.getWidth();
final int matrixHeight = matrix.getHeight();
int[] columnWidths = new int[matrixWidth];
237,21 → 262,30
 
g.drawString(value, xString, y * lineHeight + (int) (spaceH * 1.4f));
}
if (columnsAxisInfo != null) {
// Top
if (!isOuside(x, y)
&& (value.length() > 0 || y == columnsAxisInfo.getWidth() || isValue(x, y) || (!isValue(x, y) && (leftNotEmpty(matrix, x, y - 1)) || leftNotEmpty(matrix, x, y)))) {
g.setColor(BORDER_COLOR);
g.drawLine(offsetX, y * lineHeight, offsetX + columnWidth, y * lineHeight);
 
// Top
if (!isOuside(x, y)
&& (value.length() > 0 || y == columnsAxisInfo.getWidth() || isValue(x, y) || (!isValue(x, y) && (leftNotEmpty(matrix, x, y - 1)) || leftNotEmpty(matrix, x, y)))) {
}
 
if (rowsAxisInfo != null) {
if ((y < columnsAxisInfo.getWidth() && x >= rowsAxisInfo.getWidth()) || isValue(x, y) || (!isOuside(x, y) && (!leftNotEmpty(matrix, x, y) || !isValue(x, y)))) {
g.setColor(BORDER_COLOR);
// Left
g.drawLine(offsetX, y * lineHeight, offsetX, (y + 1) * lineHeight);
}
 
}
} else {
g.setColor(BORDER_COLOR);
g.drawLine(offsetX, y * lineHeight, offsetX + columnWidth, y * lineHeight);
 
}
if ((y < columnsAxisInfo.getWidth() && x >= rowsAxisInfo.getWidth()) || isValue(x, y) || (!isOuside(x, y) && (!leftNotEmpty(matrix, x, y) || !isValue(x, y)))) {
g.setColor(BORDER_COLOR);
// Left
g.drawLine(offsetX, y * lineHeight, offsetX, (y + 1) * lineHeight);
}
}
 
}
}
offsetX += columnWidth;
widestWidth = Math.max(columnWidth, widestWidth);
258,6 → 292,7
}
// Right
g.setColor(BORDER_COLOR);
 
final int bottomRightX = offsetX;
final int bottomRightY = matrixHeight * lineHeight;
g.drawLine(offsetX, 0, offsetX, bottomRightY);
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/renderer/Matrix.java
26,7 → 26,7
* @param y Y coordinate
* @param value Value
*/
void set(int x, int y, String value) {
public void set(int x, int y, String value) {
set(x, y, value, false, false);
}
 
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/renderer/MatrixCell.java
18,4 → 18,8
this.right = right;
this.sameAsPrev = sameAsPrev;
}
 
public String getValue() {
return value;
}
}
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/OLAPSQLPanel.java
New file
0,0 → 1,180
package org.openconcerto.modules.reports.olap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
 
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.modules.reports.olap.renderer.Matrix;
import org.openconcerto.sql.model.SQLDataSource;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.warning.JLabelWarning;
 
public class OLAPSQLPanel extends JPanel {
 
private OLAPRenderer renderer;
 
final JLabelWarning w = new JLabelWarning();
private JButton bExecute;
final JTextArea textMDX;
 
OLAPSQLPanel(OLAPRenderer renderer) {
this.setOpaque(false);
 
this.renderer = renderer;
this.setLayout(new GridBagLayout());
GridBagConstraints c = new DefaultGridBagConstraints();
c.fill = GridBagConstraints.BOTH;
// Colonnes
c.gridx = 0;
c.gridy = 0;
c.weightx = 1;
c.weighty = 0;
JLabel columnsLabel = new JLabel("Requête SQL (select uniquement)", SwingConstants.LEFT);
this.add(columnsLabel, c);
c.weighty = 1;
c.gridy++;
c.weightx = 1;
textMDX = new JTextArea();
textMDX.setText("select \"NOM\",\"PV_HT\" from \"ARTICLE\" where \"PV_HT\" <300 AND \"ID\">1");
textMDX.setLineWrap(true);
JScrollPane scroll = new JScrollPane(textMDX);
 
scroll.setOpaque(false);
this.add(scroll, c);
 
// Lignes
c.gridx = 0;
c.gridy++;
c.weightx = 0;
c.weighty = 0;
bExecute = new JButton("Executer");
bExecute.setOpaque(false);
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.WEST;
this.add(bExecute, c);
bExecute.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
executeQuery(textMDX.getText());
 
}
});
c.gridy++;
w.setOpaque(false);
w.setVisible(false);
this.add(w, c);
 
textMDX.getDocument().addDocumentListener(new DocumentListener() {
 
@Override
public void removeUpdate(DocumentEvent e) {
w.setVisible(false);
 
}
 
@Override
public void insertUpdate(DocumentEvent e) {
w.setVisible(false);
 
}
 
@Override
public void changedUpdate(DocumentEvent e) {
w.setVisible(false);
 
}
});
 
}
 
protected void executeQuery(final String req) {
String lower = req.toLowerCase();
if (lower.contains("update") || lower.contains("delete") || lower.contains("insert") || lower.contains("add") || lower.contains("alter") || lower.contains("drop") || lower.contains("exec")) {
return;
}
 
this.textMDX.setEditable(false);
this.bExecute.setEnabled(false);
 
SwingWorker<Matrix, Object> worker = new SwingWorker<Matrix, Object>() {
 
@Override
protected Matrix doInBackground() throws Exception {
try {
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
// voir pour utiliser createDataSource avec un user spécifique en lecture seule
SQLDataSource src = ComptaPropsConfiguration.getInstanceCompta().getRootSociete().getDBSystemRoot().getDataSource();
List result = (List) src.execute(req, new ArrayListHandler());
int height = result.size();
 
int width = 0;
if (height > 0) {
width = ((Object[]) result.get(0)).length;
}
final Matrix matrix = new Matrix(width, height);
System.err.println("OLAPSQLPanel.executeQuery() MATRIX :" + matrix.getWidth() + " x " + matrix.getHeight());
for (int y = 0; y < height; y++) {
Object o = result.get(y);
Object[] l = (Object[]) o;
 
for (int x = 0; x < width; x++) {
Object obj = l[x];
if (obj == null) {
obj = "";
}
if (obj instanceof BigDecimal) {
obj = ((BigDecimal) obj).toPlainString();
}
if (obj instanceof Date) {
obj = df.format((Date) obj);
}
matrix.set(x, y, obj.toString());
}
}
 
return matrix;
} catch (Exception e) {
 
e.printStackTrace();
w.setVisible(true);
 
w.setText(e.getCause().getMessage());
return null;
}
}
 
protected void done() {
Matrix matrix;
try {
matrix = get();
renderer.setMatrix(matrix);
} catch (Exception e) {
e.printStackTrace();
}
textMDX.setEditable(true);
bExecute.setEnabled(true);
}
};
renderer.setWaitState(true);
worker.execute();
 
}
}
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/OLAPConfigurationPanel.java
64,7 → 64,7
c.gridy++;
c.weightx = 0;
c.gridwidth = 1;
JLabel filtersLabel = new JLabel("Filtre", SwingConstants.RIGHT);
JLabel filtersLabel = new JLabel("Mesure", SwingConstants.RIGHT);
this.add(filtersLabel, c);
 
filters = new ParameterHolder(false);
/trunk/Modules/Module OLAP/src/org/openconcerto/modules/reports/olap/openconcerto_catalog.xml
2,10 → 2,52
<Schema name="OpenConcerto">
 
<Cube name="Ventes">
<Table name="SAISIE_VENTE_FACTURE_ELEMENT" schema="_SCHEMA_"/>
<Table name="SAISIE_VENTE_FACTURE_ELEMENT" schema="_SCHEMA_" />
<Dimension name="Commercial" foreignKey="ID_SAISIE_VENTE_FACTURE">
<Hierarchy hasAll="true" allMemberName="Tous" primaryKey="ID" primaryKeyTable="SAISIE_VENTE_FACTURE">
<Join leftKey="ID_COMMERCIAL" rightKey="ID_COMMERCIAL">
<Table name="SAISIE_VENTE_FACTURE" schema="_SCHEMA_" />
<Table name="COMMERCIAL" schema="_SCHEMA_" />
</Join>
<Level name="Nom du commercial" table="COMMERCIAL" column="NOM" schema="_SCHEMA_">
</Level>
</Hierarchy>
</Dimension>
 
<Dimension name="Localisation du client" foreignKey="ID_SAISIE_VENTE_FACTURE">
<Hierarchy hasAll="true" allMemberName="Tous" primaryKey="ID" primaryKeyTable="SAISIE_VENTE_FACTURE">
<Join leftKey="ID_CLIENT" rightKey="ID">
<Table name="SAISIE_VENTE_FACTURE" schema="_SCHEMA_" />
 
<Join leftKey="ID_PAYS" rightKey="ID">
<Table name="CLIENT" schema="_SCHEMA_" />
<Table name="PAYS" schema="_SCHEMA_" />
</Join>
</Join>
<Level name="Pays" table="PAYS" column="NOM" schema="_SCHEMA_" uniqueMembers="true">
</Level>
<Level name="Nom du client" table="CLIENT" column="NOM" schema="_SCHEMA_">
</Level>
 
</Hierarchy>
</Dimension>
 
<Dimension name="Client" foreignKey="ID_SAISIE_VENTE_FACTURE">
<Hierarchy hasAll="true" allMemberName="Tous" primaryKey="ID" primaryKeyTable="SAISIE_VENTE_FACTURE">
<Join leftKey="ID_CLIENT" rightKey="ID">
<Table name="SAISIE_VENTE_FACTURE" schema="_SCHEMA_" />
<Table name="CLIENT" schema="_SCHEMA_" />
</Join>
<Level name="Nom du client" table="CLIENT" column="NOM" schema="_SCHEMA_">
</Level>
</Hierarchy>
</Dimension>
 
 
 
<Dimension name="Articles" foreignKey="ID_ARTICLE">
<Hierarchy hasAll="true" allMemberName="Tous les articles" primaryKey="ID">
<View alias="ARTICLE">
<View alias="articles">
<SQL dialect="generic"> <![CDATA[select * from "_SCHEMA_"."ARTICLE" where "ARCHIVE" = '0']]>
</SQL>
</View>
15,7 → 57,7
</Dimension>
<Dimension name="Mode de vente" foreignKey="ID_MODE_VENTE_ARTICLE">
<Hierarchy hasAll="true" allMemberName="Tous les modes de vente" primaryKey="ID">
<View alias="MODE_VENTE_ARTICLE">
<View alias="mode">
<SQL dialect="generic"> <![CDATA[select * from "_SCHEMA_"."MODE_VENTE_ARTICLE" where "ARCHIVE" = '0']]>
</SQL>
</View>
26,7 → 68,7
<Dimension name="Date de facturation" foreignKey="ID_SAISIE_VENTE_FACTURE" type="TimeDimension">
<Hierarchy hasAll="true" allMemberName="Toutes les dates" primaryKey="ID">
 
<View alias="SAISIE_VENTE_FACTURE">
<View alias="factures">
<SQL dialect="generic"> <![CDATA[select * from "_SCHEMA_"."SAISIE_VENTE_FACTURE" where "ARCHIVE" = '0']]>
</SQL>
</View>
33,7 → 75,7
<Level name="Annee" column="DATE" uniqueMembers="true" levelType="TimeYears" type="Numeric">
<KeyExpression>
<SQL dialect="generic">
<![CDATA[EXTRACT(YEAR FROM "SAISIE_VENTE_FACTURE"."DATE")]]>
<![CDATA[EXTRACT(YEAR FROM "factures"."DATE")]]>
</SQL>
</KeyExpression>
</Level>
42,7 → 84,7
formatter="org.openconcerto.modules.reports.olap.formatter.MonthMemberFormatter">
<KeyExpression>
<SQL dialect="generic">
<![CDATA[EXTRACT(MONTH FROM "SAISIE_VENTE_FACTURE"."DATE")]]>
<![CDATA[EXTRACT(MONTH FROM "factures"."DATE")]]>
</SQL>
</KeyExpression>
</Level>
49,21 → 91,22
</Hierarchy>
</Dimension>
<Dimension name="Ligne facturees">
<Hierarchy hasAll="true" primaryKey="ID">
<Table name="SAISIE_VENTE_FACTURE_ELEMENT" schema="_SCHEMA_"/>
<Level name="Quantite" column="QTE" type="Numeric" uniqueMembers="false"/>
<Level name="Code article" column="CODE" type="String" uniqueMembers="false"/>
<Level name="Poids" column="POIDS" type="Numeric" uniqueMembers="false"/>
<Level name="Designation" column="NOM" type="String" uniqueMembers="false"/>
</Hierarchy>
</Dimension>
<Measure name="Nombre vendu" column="ID_ARTICLE" aggregator="count" formatString="Standard" />
<Measure name="Quantite" column="QTE" aggregator="count" formatString="Standard" />
<Hierarchy hasAll="true" primaryKey="ID">
<Table name="SAISIE_VENTE_FACTURE_ELEMENT" schema="_SCHEMA_" />
<Level name="Quantite" column="QTE" type="Numeric" uniqueMembers="false" />
<Level name="Code article" column="CODE" type="String" uniqueMembers="false" />
<Level name="Poids" column="POIDS" type="Numeric" uniqueMembers="false" />
<Level name="Designation" column="NOM" type="String" uniqueMembers="false" />
</Hierarchy>
</Dimension>
 
 
<Measure name="Quantite" column="QTE" aggregator="sum" formatString="Standard" />
<Measure name="Prix de vente HT" column="T_PV_HT" aggregator="sum"
formatter="org.openconcerto.modules.reports.olap.formatter.CentsCellFormatter" />
<Measure name="Prix d'achat HT" column="T_PA_HT" aggregator="sum"
formatter="org.openconcerto.modules.reports.olap.formatter.CentsCellFormatter" />
<Measure name="Nombre de lignes" column="ID_ARTICLE" aggregator="count" formatString="Standard" />
<CalculatedMember name="Marge" dimension="Measures">
<Formula>[Measures].[Prix de vente HT] - [Measures].[Prix d'achat HT]
</Formula>
73,31 → 116,31
 
</Cube>
 
<Cube name="Clients">
<Table name="CLIENT" schema="_SCHEMA_"/>
<Dimension name="Type de client">
<Hierarchy hasAll="true" allMemberName="Toutes formes juridiques" >
<Level name="Forme juridique" column="FORME_JURIDIQUE" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Cube name="Clients">
<Table name="CLIENT" schema="_SCHEMA_" />
<Dimension name="Type de client">
<Hierarchy hasAll="true" allMemberName="Toutes formes juridiques">
<Level name="Forme juridique" column="FORME_JURIDIQUE" uniqueMembers="true" />
</Hierarchy>
</Dimension>
 
<Dimension name="Langue" foreignKey="ID_LANGUE">
<Hierarchy hasAll="true" allMemberName="Toutes les langues" primaryKey="ID" >
<Table name="LANGUE" schema="_SCHEMA_"/>
<Hierarchy hasAll="true" allMemberName="Toutes les langues" primaryKey="ID">
<Table name="LANGUE" schema="_SCHEMA_" />
<Level name="Langue" column="NOM" uniqueMembers="true" />
</Hierarchy>
 
</Dimension>
<Dimension name="Pays" foreignKey="ID_PAYS">
<Hierarchy hasAll="true" allMemberName="Tous les pays" primaryKey="ID" >
<Table name="PAYS" schema="_SCHEMA_"/>
<Hierarchy hasAll="true" allMemberName="Tous les pays" primaryKey="ID">
<Table name="PAYS" schema="_SCHEMA_" />
<Level name="Pays" column="NOM" uniqueMembers="true" />
</Hierarchy>
</Dimension>
<Measure name="Nombre" column="ID" aggregator="count" formatString="Standard" />
</Cube>
 
</Cube>
 
 
</Schema>
 
</Schema>
/trunk/Modules/Module OLAP/module.properties
1,5 → 1,5
# [\p{Alnum}_.]{3,}
id=org.openconcerto.modules.reports.olap
# \p{Digit}(\.\p{Digit}+)?
version=1.0
version=1.2
contact=ILM Informatique