OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 142 Rev 149
Line 21... Line 21...
21
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
21
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
22
import org.openconcerto.erp.core.common.ui.DeviseField;
22
import org.openconcerto.erp.core.common.ui.DeviseField;
23
import org.openconcerto.erp.core.common.ui.TotalPanel;
23
import org.openconcerto.erp.core.common.ui.TotalPanel;
24
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
24
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
25
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
25
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
-
 
26
import org.openconcerto.erp.core.supplychain.order.element.DemandeAchatItemSQLElement;
26
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable;
27
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable;
27
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
28
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
28
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
29
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
29
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
30
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
30
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
31
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
Line 89... Line 90...
89
 
90
 
90
    private JUniqueTextField numeroUniqueCommande;
91
    private JUniqueTextField numeroUniqueCommande;
91
    private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
92
    private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
92
    private final ITextArea infos = new ITextArea(3, 3);
93
    private final ITextArea infos = new ITextArea(3, 3);
93
    private ElementComboBox fourn = new ElementComboBox();
94
    private ElementComboBox fourn = new ElementComboBox();
94
    final JCheckBox boxLivrClient = new JCheckBox("Livrer directement le client");
95
    private final JCheckBox boxLivrClient = new JCheckBox("Livrer directement le client");
95
    private DefaultElementSQLObject compAdr;
96
    private DefaultElementSQLObject compAdr;
96
    final JPanel panelAdrSpec = new JPanel(new GridBagLayout());
97
    final JPanel panelAdrSpec = new JPanel(new GridBagLayout());
97
    protected ElementComboBox boxAdr;
98
    protected ElementComboBox boxAdr;
98
    private JDate dateCommande = new JDate(true);
99
    private JDate dateCommande = new JDate(true);
99
    private ElementSQLObject componentPrincipaleAdr;
100
    private ElementSQLObject componentPrincipaleAdr;
Line 164... Line 165...
164
        c.gridwidth = 1;
165
        c.gridwidth = 1;
165
        c.weightx = 1;
166
        c.weightx = 1;
166
        c.weighty = 0;
167
        c.weighty = 0;
167
        c.fill = GridBagConstraints.NONE;
168
        c.fill = GridBagConstraints.NONE;
168
        this.add(this.fourn, c);
169
        this.add(this.fourn, c);
-
 
170
        addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR");
169
 
171
 
170
        if (!getTable().getFieldsName().contains("LIVRER")) {
172
        if (!getTable().getFieldsName().contains("LIVRER")) {
171
            // Commande en cours
173
            // Commande en cours
172
            JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS"));
174
            JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS"));
173
            c.gridx += 2;
175
            c.gridx += 2;
Line 345... Line 347...
345
                labelAdrLiv.setVisible(false);
347
                labelAdrLiv.setVisible(false);
346
 
348
 
347
            } else {
349
            } else {
348
 
350
 
349
                c.gridy++;
351
                c.gridy++;
350
                c.gridx = 0;
352
                c.gridx = 1;
351
                this.add(new JLabel(TM.tr("address.type.delivery"), SwingConstants.RIGHT), c);
-
 
352
                c.gridx++;
-
 
-
 
353
              
353
                c.gridwidth = GridBagConstraints.REMAINDER;
354
                c.gridwidth = GridBagConstraints.REMAINDER;
354
                this.add(boxLivrClient, c);
355
                this.add(boxLivrClient, c);
355
                c.gridwidth = 1;
356
                c.gridwidth = 1;
356
 
357
 
357
                final GridBagConstraints cAdr = new DefaultGridBagConstraints();
358
                final GridBagConstraints cAdr = new DefaultGridBagConstraints();
Line 582... Line 583...
582
        c.gridwidth = GridBagConstraints.REMAINDER;
583
        c.gridwidth = GridBagConstraints.REMAINDER;
583
 
584
 
584
        this.panelOO = new PanelOOSQLComponent(this);
585
        this.panelOO = new PanelOOSQLComponent(this);
585
        this.add(this.panelOO, c);
586
        this.add(this.panelOO, c);
586
 
587
 
587
        addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR");
-
 
588
        addSQLObject(textNom, "NOM");
588
        addSQLObject(textNom, "NOM");
589
        addRequiredSQLObject(dateCommande, "DATE");
589
        addRequiredSQLObject(dateCommande, "DATE");
590
        // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
590
        // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
591
        addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO");
591
        addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO");
592
        addSQLObject(this.infos, "INFOS");
592
        addSQLObject(this.infos, "INFOS");
Line 673... Line 673...
673
        } else {
673
        } else {
674
            addSQLObject(poids, "T_POIDS");
674
            addSQLObject(poids, "T_POIDS");
675
        }
675
        }
676
 
676
 
677
        DeviseField textPortHT = new DeviseField();
677
        DeviseField textPortHT = new DeviseField();
-
 
678
        DeviseField textRemiseHT = new DeviseField();
678
        ElementComboBox comboTaxePort = new ElementComboBox(false, 10);
679
        ElementComboBox comboTaxePort = new ElementComboBox(false, 10);
679
 
680
 
680
        if (getTable().contains("PORT_HT")) {
681
        if (getTable().contains("PORT_HT")) {
-
 
682
 
681
            addRequiredSQLObject(textPortHT, "PORT_HT");
683
            addSQLObject(textPortHT, "PORT_HT");
682
            final JPanel panelPoids = new JPanel(new GridBagLayout());
684
            final JPanel panelPoids = new JPanel(new GridBagLayout());
683
            GridBagConstraints cPort = new DefaultGridBagConstraints();
685
            GridBagConstraints cPort = new DefaultGridBagConstraints();
684
            cPort.gridx = 0;
686
            cPort.gridx = 0;
685
            cPort.fill = GridBagConstraints.NONE;
687
            cPort.fill = GridBagConstraints.NONE;
686
            cPort.weightx = 0;
688
            cPort.weightx = 0;
Line 697... Line 699...
697
            panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort);
699
            panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort);
698
            cPort.gridx++;
700
            cPort.gridx++;
699
            cPort.weightx = 1;
701
            cPort.weightx = 1;
700
            panelPoids.add(comboTaxePort, cPort);
702
            panelPoids.add(comboTaxePort, cPort);
701
 
703
 
-
 
704
            addSQLObject(textRemiseHT, "REMISE_HT");
-
 
705
            cPort.gridy++;
-
 
706
            cPort.gridx = 0;
-
 
707
            cPort.fill = GridBagConstraints.NONE;
-
 
708
            cPort.weightx = 0;
-
 
709
            panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort);
-
 
710
            textRemiseHT.setHorizontalAlignment(JTextField.RIGHT);
-
 
711
            cPort.gridx++;
-
 
712
            cPort.weightx = 1;
-
 
713
            panelPoids.add(textRemiseHT, cPort);
-
 
714
 
702
            c.gridx++;
715
            c.gridx++;
703
            c.gridy = 0;
716
            c.gridy = 0;
704
            c.weightx = 0;
717
            c.weightx = 0;
705
            c.weighty = 0;
718
            c.weighty = 0;
706
            c.gridwidth = 1;
719
            c.gridwidth = 1;
Line 710... Line 723...
710
            panel.add(panelPoids, c);
723
            panel.add(panelPoids, c);
711
            DefaultGridBagConstraints.lockMinimumSize(panelPoids);
724
            DefaultGridBagConstraints.lockMinimumSize(panelPoids);
712
        }
725
        }
713
        // Total
726
        // Total
714
 
727
 
715
        DeviseField textRemiseHT = new DeviseField();
-
 
716
        DeviseField fieldHT = new DeviseField();
728
        DeviseField fieldHT = new DeviseField();
717
        DeviseField fieldEco = new DeviseField();
729
        DeviseField fieldEco = new DeviseField();
718
        DeviseField fieldTVA = new DeviseField();
730
        DeviseField fieldTVA = new DeviseField();
719
        DeviseField fieldTTC = new DeviseField();
731
        DeviseField fieldTTC = new DeviseField();
720
        DeviseField fieldDevise = new DeviseField();
732
        DeviseField fieldDevise = new DeviseField();
Line 868... Line 880...
868
                    rowVals.update(2);
880
                    rowVals.update(2);
869
                } catch (SQLException e) {
881
                } catch (SQLException e) {
870
                    e.printStackTrace();
882
                    e.printStackTrace();
871
                }
883
                }
872
            }
884
            }
-
 
885
            DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
-
 
886
            elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), idCommande);
-
 
887
 
873
            if (attempt > 0) {
888
            if (attempt > 0) {
874
                SwingUtilities.invokeLater(new Runnable() {
889
                SwingUtilities.invokeLater(new Runnable() {
875
                    public void run() {
890
                    public void run() {
876
                        JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
891
                        JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
877
                    }
892
                    }
Line 932... Line 947...
932
                } catch (Exception e) {
947
                } catch (Exception e) {
933
                    ExceptionHandler.handle("Update error", e);
948
                    ExceptionHandler.handle("Update error", e);
934
                }
949
                }
935
            }
950
            }
936
        });
951
        });
-
 
952
 
-
 
953
        DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
-
 
954
        elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), getSelectedID());
-
 
955
 
937
        // generation du document
956
        // generation du document
938
        final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id));
957
        final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id));
939
        sheet.createDocumentAsynchronous();
958
        sheet.createDocumentAsynchronous();
940
        sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
959
        sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
941
 
960