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 12... Line 12...
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.sales.invoice.element;
14
 package org.openconcerto.erp.core.sales.invoice.element;
15
 
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
-
 
17
import org.openconcerto.erp.config.Gestion;
17
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
18
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
18
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
19
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
19
import org.openconcerto.erp.core.common.ui.DeviseField;
20
import org.openconcerto.erp.core.common.ui.DeviseField;
20
import org.openconcerto.erp.core.customerrelationship.customer.element.RelanceSQLElement;
21
import org.openconcerto.erp.core.customerrelationship.customer.element.RelanceSQLElement;
21
import org.openconcerto.erp.core.customerrelationship.mail.EmailTemplate;
22
import org.openconcerto.erp.core.customerrelationship.mail.EmailTemplate;
Line 49... Line 50...
49
import org.openconcerto.sql.sqlobject.ElementComboBox;
50
import org.openconcerto.sql.sqlobject.ElementComboBox;
50
import org.openconcerto.sql.users.rights.UserRightsManager;
51
import org.openconcerto.sql.users.rights.UserRightsManager;
51
import org.openconcerto.sql.utils.SQLUtils;
52
import org.openconcerto.sql.utils.SQLUtils;
52
import org.openconcerto.sql.view.EditFrame;
53
import org.openconcerto.sql.view.EditFrame;
53
import org.openconcerto.sql.view.EditPanel.EditMode;
54
import org.openconcerto.sql.view.EditPanel.EditMode;
-
 
55
import org.openconcerto.sql.view.EditPanelListener;
54
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
56
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
55
import org.openconcerto.sql.view.list.IListe;
57
import org.openconcerto.sql.view.list.IListe;
56
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
58
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
57
import org.openconcerto.sql.view.list.RowAction;
59
import org.openconcerto.sql.view.list.RowAction;
58
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
60
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
Line 445... Line 447...
445
    }
447
    }
446
 
448
 
447
    @Override
449
    @Override
448
    protected void _initListRequest(ListSQLRequest req) {
450
    protected void _initListRequest(ListSQLRequest req) {
449
        super._initListRequest(req);
451
        super._initListRequest(req);
450
        req.addToGraphToFetch("REG_COMPTA", "REGLE");
452
        req.addToGraphToFetch("REG_COMPTA", "REGLE","NOMBRE_RELANCE");
451
    }
453
    }
452
 
454
 
453
    /*
455
    /*
454
     * (non-Javadoc)
456
     * (non-Javadoc)
455
     * 
457
     * 
Line 536... Line 538...
536
    @Override
538
    @Override
537
    protected String createCode() {
539
    protected String createCode() {
538
        return createCodeOfPackage() + ".commitment";
540
        return createCodeOfPackage() + ".commitment";
539
    }
541
    }
540
 
542
 
-
 
543
    public void relanceClient(final SQLRow rowEch) {
-
 
544
        final SQLElement relanceElt = getDirectory().getElement("RELANCE");
-
 
545
 
-
 
546
        rowEch.fetchValues();
-
 
547
 
-
 
548
        if (rowEch != null) {
-
 
549
            int idMvtSource = MouvementSQLElement.getSourceId(rowEch.getForeignID("ID_MOUVEMENT"));
-
 
550
            SQLRow rowMvtSource = getTable().getTable("MOUVEMENT").getRow(idMvtSource);
-
 
551
 
-
 
552
            if (!rowMvtSource.getString("SOURCE").equalsIgnoreCase("SAISIE_VENTE_FACTURE")) {
-
 
553
                return;
-
 
554
            }
-
 
555
 
-
 
556
            EditFrame editRelance = new EditFrame(relanceElt);
-
 
557
            editRelance.setIconImages(Gestion.getFrameIcon());
-
 
558
            editRelance.addEditPanelListener(new EditPanelListener() {
-
 
559
 
-
 
560
                public void cancelled() {
-
 
561
                    // rien
-
 
562
                }
-
 
563
 
-
 
564
                public void modified() {
-
 
565
                    // rien
-
 
566
                }
-
 
567
 
-
 
568
                public void deleted() {
-
 
569
                    // rien
-
 
570
                }
-
 
571
 
-
 
572
                public void inserted(int id) {
-
 
573
                    int nbRelance = rowEch.getInt("NOMBRE_RELANCE");
-
 
574
                    nbRelance++;
-
 
575
 
-
 
576
                    SQLRowValues rowValsEch = new SQLRowValues(rowEch.getTable());
-
 
577
                    rowValsEch.put("NOMBRE_RELANCE", nbRelance);
-
 
578
                    rowValsEch.put("DATE_LAST_RELANCE", new Date());
-
 
579
 
-
 
580
                    try {
-
 
581
                        rowValsEch.update(rowEch.getID());
-
 
582
                        relanceElt.getTable().getRow(id).createEmptyUpdateRow().put("ID_ECHEANCE_CLIENT", rowEch.getID()).commit();
-
 
583
                    } catch (SQLException e1) {
-
 
584
                        ExceptionHandler.handle("erreur lors de la mise à jour du nombre de relances", e1);
-
 
585
                    }
-
 
586
                }
-
 
587
            });
-
 
588
 
-
 
589
            SQLRowValues rowVals = new SQLRowValues(relanceElt.getTable());
-
 
590
            rowVals.put("ID_SAISIE_VENTE_FACTURE", rowMvtSource.getInt("IDSOURCE"));
-
 
591
            rowVals.put("MONTANT", rowEch.getObject("MONTANT"));
-
 
592
            rowVals.put("ID_CLIENT", rowEch.getForeignID("ID_CLIENT"));
-
 
593
            rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(RelanceSQLElement.class, new Date()));
-
 
594
            editRelance.getSQLComponent().select(rowVals);
-
 
595
 
-
 
596
            editRelance.pack();
-
 
597
            editRelance.setVisible(true);
-
 
598
        }
-
 
599
 
-
 
600
    }
-
 
601
 
541
}
602
}