OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 174 Rev 180
Line 18... Line 18...
18
import org.openconcerto.erp.core.common.element.StyleSQLElement;
18
import org.openconcerto.erp.core.common.element.StyleSQLElement;
19
import org.openconcerto.erp.core.common.ui.TotalCalculator;
19
import org.openconcerto.erp.core.common.ui.TotalCalculator;
20
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
20
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
21
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
21
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
22
import org.openconcerto.erp.preferences.DefaultNXProps;
22
import org.openconcerto.erp.preferences.DefaultNXProps;
-
 
23
import org.openconcerto.openoffice.LengthUnit;
-
 
24
import org.openconcerto.openoffice.ODFrame;
23
import org.openconcerto.openoffice.ODPackage;
25
import org.openconcerto.openoffice.ODPackage;
-
 
26
import org.openconcerto.openoffice.spreadsheet.BytesProducer.ByteArrayProducer;
24
import org.openconcerto.openoffice.spreadsheet.MutableCell;
27
import org.openconcerto.openoffice.spreadsheet.MutableCell;
25
import org.openconcerto.openoffice.spreadsheet.Sheet;
28
import org.openconcerto.openoffice.spreadsheet.Sheet;
26
import org.openconcerto.openoffice.spreadsheet.SpreadSheet;
29
import org.openconcerto.openoffice.spreadsheet.SpreadSheet;
27
import org.openconcerto.sql.Configuration;
30
import org.openconcerto.sql.Configuration;
28
import org.openconcerto.sql.element.SQLElement;
31
import org.openconcerto.sql.element.SQLElement;
Line 54... Line 57...
54
import java.text.SimpleDateFormat;
57
import java.text.SimpleDateFormat;
55
import java.util.Collection;
58
import java.util.Collection;
56
import java.util.HashMap;
59
import java.util.HashMap;
57
import java.util.List;
60
import java.util.List;
58
import java.util.Map;
61
import java.util.Map;
-
 
62
import java.util.UUID;
59
 
63
 
60
import javax.swing.JOptionPane;
64
import javax.swing.JOptionPane;
61
import javax.swing.SwingUtilities;
65
import javax.swing.SwingUtilities;
62
 
66
 
63
import org.jdom2.Document;
67
import org.jdom2.Document;
Line 698... Line 702...
698
                        // tableau et donc enlever la ligne de bas de tableau
702
                        // tableau et donc enlever la ligne de bas de tableau
699
                        if (tableField.isLineOption() && value != null && value.toString().trim().length() == 0) {
703
                        if (tableField.isLineOption() && value != null && value.toString().trim().length() == 0) {
700
                            value = null;
704
                            value = null;
701
                            styleOO = null;
705
                            styleOO = null;
702
                        }
706
                        }
-
 
707
                        int tmpCelluleAffect;
703
 
708
 
-
 
709
                        if (tableField.isImage()) {
-
 
710
                            OOXMLTableImage tableImage = this.rowRefCache.getOOXMLTableImage(tableField, e, rowElt);
-
 
711
                            tmpCelluleAffect = 1;
-
 
712
                            try {
-
 
713
                                if (tableImage.getImgBytes() != null) {
-
 
714
                                    MutableCell cell = sheet.getCellAt(test ? "A1" : loc);
-
 
715
                                    if (!test) {
704
                        int tmpCelluleAffect = fill(test ? "A1" : loc, value, sheet, tableField.isTypeReplace(), null, styleOO, test, tableField.isMultilineAuto(), tableField.isKeepingEmptyLines());
716
                                        final ODFrame<SpreadSheet> frame = cell.addFrame(tableImage.getX(), tableImage.getY(), tableImage.getWidth(), tableImage.getHeight(), LengthUnit.MM);
-
 
717
                                        frame.addImage(UUID.randomUUID() + ".png", new ByteArrayProducer(tableImage.getImgBytes(), false));
-
 
718
                                    }
705
                        // tmpCelluleAffect = Math.max(tmpCelluleAffect,
719
                                    tmpCelluleAffect = tableImage.getRowCount();
-
 
720
                                }
706
                        // tableField.getLine());
721
                            } catch (Exception e1) {
-
 
722
                                // TODO popup???
-
 
723
                                e1.printStackTrace();
-
 
724
                            }
-
 
725
 
-
 
726
                        } else {
-
 
727
                            tmpCelluleAffect = fill(test ? "A1" : loc, value, sheet, tableField.isTypeReplace(), null, styleOO, test, tableField.isMultilineAuto(), tableField.isKeepingEmptyLines());
-
 
728
                        }
707
                        if (tableField.getLine() != 1 && (!tableField.isLineOption() || (value != null && value.toString().trim().length() > 0))) {
729
                        if (tableField.getLine() != 1 && (!tableField.isLineOption() || (value != null && value.toString().trim().length() > 0))) {
708
                            if (nbCellule >= tableField.getLine()) {
730
                            if (nbCellule >= tableField.getLine()) {
709
                                tmpCelluleAffect = tmpCelluleAffect + nbCellule;
731
                                tmpCelluleAffect = tmpCelluleAffect + nbCellule;
710
                            } else {
732
                            } else {
711
                                tmpCelluleAffect += tableField.getLine() - 1;
733
                                tmpCelluleAffect += tableField.getLine() - 1;
Line 793... Line 815...
793
            final OOXMLElement OOElt = new OOXMLElement(elt, sqlElt, row.getID(), row, null, this.rowRefCache);
815
            final OOXMLElement OOElt = new OOXMLElement(elt, sqlElt, row.getID(), row, null, this.rowRefCache);
794
            final Object result = OOElt.getValue();
816
            final Object result = OOElt.getValue();
795
            if (result != null) {
817
            if (result != null) {
796
                Object o = elt.getAttributeValue("sheet");
818
                Object o = elt.getAttributeValue("sheet");
797
                int sheet = (o == null) ? 0 : Integer.valueOf(o.toString().trim());
819
                int sheet = (o == null) ? 0 : Integer.valueOf(o.toString().trim());
-
 
820
                if (OOElt.isImage()) {
-
 
821
                    OOXMLTableImage tableImage = new OOXMLTableImage(OOElt, elt, row);
-
 
822
                    try {
-
 
823
                        if (tableImage.getImgBytes() != null) {
-
 
824
                            MutableCell cell = spreadSheet.getSheet(sheet).getCellAt(elt.getAttributeValue("location"));
-
 
825
                            final ODFrame<SpreadSheet> frame = cell.addFrame(tableImage.getX(), tableImage.getY(), tableImage.getWidth(), tableImage.getHeight(), LengthUnit.MM);
-
 
826
                            frame.addImage(UUID.randomUUID() + ".png", new ByteArrayProducer(tableImage.getImgBytes(), false));
-
 
827
 
-
 
828
                        }
-
 
829
                    } catch (Exception e1) {
-
 
830
                        // TODO popup???
-
 
831
                        e1.printStackTrace();
-
 
832
                    }
-
 
833
 
-
 
834
                } else {
798
                fill(elt.getAttributeValue("location"), result, spreadSheet.getSheet(sheet), OOElt.isTypeReplace(), OOElt.getReplacePattern(), null, false, OOElt.isMultilineAuto(),
835
                    fill(elt.getAttributeValue("location"), result, spreadSheet.getSheet(sheet), OOElt.isTypeReplace(), OOElt.getReplacePattern(), null, false, OOElt.isMultilineAuto(),
799
                        OOElt.isKeepingEmptyLines());
836
                            OOElt.isKeepingEmptyLines());
800
            }
837
                }
801
        }
838
            }
802
    }
839
        }
-
 
840
    }
803
 
841
 
804
    private static boolean isIncluded(int filterID, String foreignTable, int id, String fieldWhere, SQLRowAccessor rowElt) {
842
    private static boolean isIncluded(int filterID, String foreignTable, int id, String fieldWhere, SQLRowAccessor rowElt) {
805
 
843
 
806
        if (rowElt.getTable().getName().equals("FICHE_PAYE_ELEMENT")) {
844
        if (rowElt.getTable().getName().equals("FICHE_PAYE_ELEMENT")) {
807
            if (!rowElt.getBoolean("IMPRESSION")) {
845
            if (!rowElt.getBoolean("IMPRESSION")) {