OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 177
Line 19... Line 19...
19
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
19
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
20
import org.openconcerto.erp.core.common.ui.DeviseField;
20
import org.openconcerto.erp.core.common.ui.DeviseField;
21
import org.openconcerto.erp.core.common.ui.TotalPanel;
21
import org.openconcerto.erp.core.common.ui.TotalPanel;
22
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
22
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
23
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
23
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
-
 
24
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent;
24
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
25
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
25
import org.openconcerto.erp.core.supplychain.order.ui.FactureFournisseurItemTable;
26
import org.openconcerto.erp.core.supplychain.order.ui.FactureFournisseurItemTable;
26
import org.openconcerto.erp.generationDoc.gestcomm.FactureFournisseurXmlSheet;
27
import org.openconcerto.erp.generationDoc.gestcomm.FactureFournisseurXmlSheet;
27
import org.openconcerto.erp.generationEcritures.GenerationMvtFactureFournisseur;
28
import org.openconcerto.erp.generationEcritures.GenerationMvtFactureFournisseur;
28
import org.openconcerto.erp.panel.PanelOOSQLComponent;
29
import org.openconcerto.erp.panel.PanelOOSQLComponent;
Line 62... Line 63...
62
import java.util.HashSet;
63
import java.util.HashSet;
63
import java.util.List;
64
import java.util.List;
64
import java.util.Set;
65
import java.util.Set;
65
 
66
 
66
import javax.swing.JLabel;
67
import javax.swing.JLabel;
-
 
68
import javax.swing.JOptionPane;
67
import javax.swing.JPanel;
69
import javax.swing.JPanel;
68
import javax.swing.JScrollPane;
70
import javax.swing.JScrollPane;
69
import javax.swing.JTextField;
71
import javax.swing.JTextField;
70
import javax.swing.SwingConstants;
72
import javax.swing.SwingConstants;
71
import javax.swing.SwingUtilities;
73
import javax.swing.SwingUtilities;
Line 391... Line 393...
391
        });
393
        });
392
        // Bottom
394
        // Bottom
393
        c.gridy++;
395
        c.gridy++;
394
        c.weighty = 0;
396
        c.weighty = 0;
395
        this.add(getBottomPanel(), c);
397
        this.add(getBottomPanel(), c);
-
 
398
        ModeDeReglementSQLComponent modeReglComp;
-
 
399
 
-
 
400
        modeReglComp = (ModeDeReglementSQLComponent) this.eltModeRegl.getSQLChild();
-
 
401
        modeReglComp.addDateCompListener(this.dateCommande);
396
 
402
 
397
        c.gridx = 0;
403
        c.gridx = 0;
398
        c.gridy++;
404
        c.gridy++;
399
        c.fill = GridBagConstraints.HORIZONTAL;
405
        c.fill = GridBagConstraints.HORIZONTAL;
400
        c.anchor = GridBagConstraints.WEST;
406
        c.anchor = GridBagConstraints.WEST;
Line 696... Line 702...
696
 
702
 
697
            public void insertUpdate(DocumentEvent e) {
703
            public void insertUpdate(DocumentEvent e) {
698
                totalTTC.updateTotal();
704
                totalTTC.updateTotal();
699
            }
705
            }
700
        });
706
        });
-
 
707
 
-
 
708
        ModeDeReglementSQLComponent modeReglComp = (ModeDeReglementSQLComponent) this.eltModeRegl.getSQLChild();
-
 
709
        modeReglComp.addDateCompListener(this.dateCommande);
701
        return panel;
710
        return panel;
702
    }
711
    }
703
 
712
 
704
    protected JPanel getModuleTotalPanel() {
713
    protected JPanel getModuleTotalPanel() {
705
 
714
 
Line 734... Line 743...
734
        super.update();
743
        super.update();
735
        SQLRow row = getTable().getRow(getSelectedID());
744
        SQLRow row = getTable().getRow(getSelectedID());
736
        this.table.updateField("ID_FACTURE_FOURNISSEUR", row.getID());
745
        this.table.updateField("ID_FACTURE_FOURNISSEUR", row.getID());
737
        this.table.createArticle(getSelectedID(), this.getElement());
746
        this.table.createArticle(getSelectedID(), this.getElement());
738
 
747
 
-
 
748
        boolean createCompte = (rowFactureOld.getForeignID("ID_FOURNISSEUR") != row.getForeignID("ID_FOURNISSEUR"));
-
 
749
        createCompte = createCompte || (rowFactureOld.getForeignID("ID_COMPTE_PCE") != row.getForeignID("ID_COMPTE_PCE"));
-
 
750
        createCompte = createCompte || rowFactureOld.getLong("T_TTC") != row.getLong("T_TTC");
-
 
751
        createCompte = createCompte || rowFactureOld.getLong("T_TVA") != row.getLong("T_TVA");
-
 
752
        createCompte = createCompte || rowFactureOld.getLong("T_HT") != row.getLong("T_HT");
-
 
753
        if (!createCompte) {
-
 
754
            int a = JOptionPane.showConfirmDialog(null, "Voulez vous recréer la comptabilité ?", "Comptabilité", JOptionPane.YES_NO_OPTION);
-
 
755
            createCompte = a == JOptionPane.YES_OPTION;
-
 
756
        }
-
 
757
        if (createCompte) {
739
        int idMvt = (row.getObject("ID_MOUVEMENT") == null ? 1 : row.getInt("ID_MOUVEMENT"));
758
            int idMvt = (row.getObject("ID_MOUVEMENT") == null ? 1 : row.getInt("ID_MOUVEMENT"));
740
        System.err.println("__________***************** UPDATE" + idMvt);
759
            System.err.println("__________***************** UPDATE" + idMvt);
741
 
760
 
742
        // on supprime tout ce qui est lié à la facture
761
            // on supprime tout ce qui est lié à la facture
743
        EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
762
            EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
Line 745... Line 764...
745
        if (idMvt > 1) {
764
            if (idMvt > 1) {
746
            new GenerationMvtFactureFournisseur(row, idMvt);
765
                new GenerationMvtFactureFournisseur(row, idMvt);
747
        } else {
766
            } else {
748
            new GenerationMvtFactureFournisseur(row);
767
                new GenerationMvtFactureFournisseur(row);
749
        }
768
            }
-
 
769
        }
750
        final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row);
770
        final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row);
751
        sheet.createDocumentAsynchronous();
771
        sheet.createDocumentAsynchronous();
752
        sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
772
        sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
753
        commitAvoir(rowFactureOld, row);
773
        commitAvoir(rowFactureOld, row);
754
    }
774
    }
Line 921... Line 941...
921
 
941
 
922
        // On duplique la facture
942
        // On duplique la facture
923
        if (idFacture > 1) {
943
        if (idFacture > 1) {
924
            SQLRow row = fact.getTable().getRow(idFacture);
944
            SQLRow row = fact.getTable().getRow(idFacture);
925
            SQLRowValues rowVals = new SQLRowValues(fact.getTable());
945
            SQLRowValues rowVals = new SQLRowValues(fact.getTable());
926
            rowVals.put("ID_FOURNISSEUR", row.getInt("ID_FOURNISSEUR"));
946
            rowVals.put("ID_FOURNISSEUR", row.getForeignID("ID_FOURNISSEUR"));
-
 
947
            if (!row.isForeignEmpty("ID_COMPTE_PCE")) {
-
 
948
                rowVals.put("ID_COMPTE_PCE", row.getForeignID("ID_COMPTE_PCE"));
-
 
949
            }
927
            // if (getTable().contains("ID_NUMEROTATION_AUTO")) {
950
            // if (getTable().contains("ID_NUMEROTATION_AUTO")) {
928
            // rowVals.put("NUMERO",
951
            // rowVals.put("NUMERO",
929
            // NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new
952
            // NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new
930
            // Date(), row.getForeign("ID_NUMEROTATION_AUTO")));
953
            // Date(), row.getForeign("ID_NUMEROTATION_AUTO")));
931
            // } else {
954
            // } else {