OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 182 Rev 185
Line 121... Line 121...
121
                }, false);
121
                }, false);
122
                action.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
122
                action.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
123
                action.setPath(Arrays.asList("Etat", "Etat", "Etat"));
123
                action.setPath(Arrays.asList("Etat", "Etat", "Etat"));
124
                getRowActions().add(action);
124
                getRowActions().add(action);
125
            }
125
            }
126
 
-
 
-
 
126
            if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.TRANSFERT_AUTOMATIQUE, false)) {
127
            PredicateRowAction actionTransfertBL = new PredicateRowAction(new AbstractAction("Transfert automatique vers BL") {
127
                PredicateRowAction actionTransfertBL = new PredicateRowAction(new AbstractAction("Transfert automatique vers BL") {
128
 
128
 
129
                @Override
129
                    @Override
130
                public void actionPerformed(ActionEvent e) {
130
                    public void actionPerformed(ActionEvent e) {
131
                    TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
131
                        TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
Line 141... Line 141...
141
 
141
 
142
                }
142
                    }
143
            }, false);
143
                }, false);
144
            actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
144
                actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
145
            getRowActions().add(actionTransfertBL);
145
                getRowActions().add(actionTransfertBL);
-
 
146
            }
146
 
147
 
147
            PredicateRowAction actionStock = new PredicateRowAction(new AbstractAction("Vérification des stocks") {
148
            PredicateRowAction actionStock = new PredicateRowAction(new AbstractAction("Vérification des stocks") {
148
 
149
 
149
                @Override
150
                @Override
150
                public void actionPerformed(ActionEvent e) {
151
                public void actionPerformed(ActionEvent e) {
Line 161... Line 162...
161
 
162
 
162
            }, false);
163
            }, false);
163
            actionStock.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
164
            actionStock.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
164
            getRowActions().add(actionStock);
165
            getRowActions().add(actionStock);
165
 
166
 
-
 
167
            if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.TRANSFERT_AUTOMATIQUE, false)) {
166
            PredicateRowAction actionFacture = new PredicateRowAction(new AbstractAction("Transfert automatique en facture") {
168
                PredicateRowAction actionFacture = new PredicateRowAction(new AbstractAction("Transfert automatique en facture") {
167
 
169
 
168
                @Override
170
                    @Override
169
                public void actionPerformed(ActionEvent e) {
171
                    public void actionPerformed(ActionEvent e) {
170
                    TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
172
                        TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
Line 180... Line 182...
180
 
182
 
181
                }
183
                    }
182
            }, false);
184
                }, false);
183
            actionFacture.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
185
                actionFacture.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
184
            getRowActions().add(actionFacture);
186
                getRowActions().add(actionFacture);
185
 
187
            }
186
        }
188
        }
187
 
189
 
188
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) {
190
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) {
189
            PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Saisir un acompte") {
191
            PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Saisir un acompte") {
190
                EditFrame edit;
192
                EditFrame edit;
Line 359... Line 361...
359
        allowedActions.add(cloneAction);
361
        allowedActions.add(cloneAction);
360
 
362
 
361
        allowedActions.add(bonAction);
363
        allowedActions.add(bonAction);
362
        allowedActions.add(factureAction);
364
        allowedActions.add(factureAction);
363
        allowedActions.add(acompteAction);
365
        allowedActions.add(acompteAction);
-
 
366
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) {
-
 
367
            RowAction acomptePrevAction = new RowAction(new AbstractAction("Créer une facture intermédiaire (prévisionnelle)") {
-
 
368
                public void actionPerformed(ActionEvent e) {
-
 
369
                    transfertAcompteClient(IListe.get(e).getSelectedRows(), true);
-
 
370
                }
-
 
371
            }, false, "sales.order.create.account.prev") {
-
 
372
                BigDecimal cent = BigDecimal.ONE.movePointRight(2);
-
 
373
 
-
 
374
                @Override
-
 
375
                public boolean enabledFor(List<SQLRowValues> selection) {
-
 
376
                    if (selection.isEmpty() || selection.size() > 1) {
-
 
377
                        return false;
-
 
378
                    } else {
-
 
379
                        BigDecimal d = getAvancement(selection.get(0));
-
 
380
                        return NumberUtils.compare(d, cent) != 0;
-
 
381
                    }
-
 
382
                }
-
 
383
            };
-
 
384
            allowedActions.add(acomptePrevAction);
-
 
385
        }
364
        allowedActions.add(soldeAction);
386
        allowedActions.add(soldeAction);
-
 
387
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) {
-
 
388
            RowAction acomptePrevAction = new RowAction(new AbstractAction("Facturer le solde (prévisionnelle)") {
-
 
389
                public void actionPerformed(ActionEvent e) {
-
 
390
                    transfertSoldeClient(IListe.get(e).getSelectedRows(), true);
-
 
391
                }
-
 
392
            }, false, "sales.order.create.account.prev") {
-
 
393
                BigDecimal cent = BigDecimal.ONE.movePointRight(2);
-
 
394
 
-
 
395
                @Override
-
 
396
                public boolean enabledFor(List<SQLRowValues> selection) {
-
 
397
                    if (selection.isEmpty() || selection.size() > 1) {
-
 
398
                        return false;
-
 
399
                    } else {
-
 
400
                        BigDecimal d = getAvancement(selection.get(0));
-
 
401
                        return NumberUtils.compare(d, cent) != 0;
-
 
402
                    }
-
 
403
                }
-
 
404
            };
-
 
405
            allowedActions.add(acomptePrevAction);
-
 
406
        }
365
        allowedActions.add(cmdAction);
407
        allowedActions.add(cmdAction);
366
        allowedActions.add(reliquatAction);
408
        allowedActions.add(reliquatAction);
367
        allowedActions.addAll(mouseSheetXmlListeListener.getRowActions());
409
        allowedActions.addAll(mouseSheetXmlListeListener.getRowActions());
-
 
410
 
368
        getRowActions().addAll(allowedActions);
411
        getRowActions().addAll(allowedActions);
369
    }
412
    }
370
 
413
 
371
    private boolean chiffrageEditableInUI = true;
414
    private boolean chiffrageEditableInUI = true;
372
 
415
 
Line 591... Line 634...
591
                    for (int i = 0; i < res.size(); i++) {
634
                    for (int i = 0; i < res.size(); i++) {
592
                        Object[] tmp = (Object[]) res.get(i);
635
                        Object[] tmp = (Object[]) res.get(i);
593
                        eltMvtStock.archive(((Number) tmp[0]).intValue());
636
                        eltMvtStock.archive(((Number) tmp[0]).intValue());
594
                    }
637
                    }
595
                }
638
                }
-
 
639
 
-
 
640
                final SQLTable tableCmdItem = getTable().getTable("COMMANDE_CLIENT_ELEMENT");
-
 
641
                UpdateBuilder build = new UpdateBuilder(tableCmdItem);
-
 
642
                build.setObject("LIVRE_FORCED", Boolean.TRUE);
-
 
643
                build.setWhere(Where.inValues(tableCmdItem.getField("ID_COMMANDE_CLIENT"), ids));
-
 
644
                getTable().getDBSystemRoot().getDataSource().execute(build.asString());
-
 
645
 
596
            } catch (SQLException e) {
646
            } catch (SQLException e) {
597
                ExceptionHandler.handle("Erreur lors de la suppression des mouvements de stocks", e);
647
                ExceptionHandler.handle("Erreur lors de la suppression des mouvements de stocks", e);
598
            }
648
            }
599
        }
649
        }
600
    }
650
    }
Line 688... Line 738...
688
        // public void executeChecked(TableColumn input) {
738
        // public void executeChecked(TableColumn input) {
689
        // input.setCellRenderer(rend);
739
        // input.setCellRenderer(rend);
690
        // }
740
        // }
691
        // });
741
        // });
692
        source.init();
742
        source.init();
-
 
743
        addCommercialFilter(source, getTable().getField("ID_COMMERCIAL"));
-
 
744
 
693
        SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
745
        SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
694
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) {
746
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) {
695
 
747
 
696
            SQLTableModelColumn col = source.getColumn(getTable().getField("ETAT_COMMANDE"));
748
            SQLTableModelColumn col = source.getColumn(getTable().getField("ETAT_COMMANDE"));
697
            if (col != null) {
749
            if (col != null) {
Line 850... Line 902...
850
     * Transfert en Facture
902
     * Transfert en Facture
851
     * 
903
     * 
852
     * @param row
904
     * @param row
853
     */
905
     */
854
    public EditFrame transfertAcompteClient(List<SQLRowValues> rows) {
906
    public EditFrame transfertAcompteClient(List<SQLRowValues> rows) {
-
 
907
        return transfertAcompteClient(rows, false);
-
 
908
    }
-
 
909
 
-
 
910
    public EditFrame transfertAcompteClient(List<SQLRowValues> rows, boolean prev) {
855
        return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", VenteFactureSituationSQLComponent.ID);
911
        return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", (prev) ? VenteFactureSituationSQLComponent.ID_PREVISIONNELLE : VenteFactureSituationSQLComponent.ID);
856
    }
912
    }
857
 
913
 
858
    /**
914
    /**
859
     * Transfert en Facture
915
     * Transfert en Facture
860
     * 
916
     * 
Line 862... Line 918...
862
     */
918
     */
863
    public EditFrame transfertSoldeClient(List<SQLRowValues> rows) {
919
    public EditFrame transfertSoldeClient(List<SQLRowValues> rows) {
864
        return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", VenteFactureSoldeSQLComponent.ID);
920
        return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", VenteFactureSoldeSQLComponent.ID);
865
    }
921
    }
866
 
922
 
-
 
923
    public EditFrame transfertSoldeClient(List<SQLRowValues> rows, boolean prev) {
-
 
924
        return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", (prev) ? VenteFactureSoldeSQLComponent.ID_PREVISIONNELLE : VenteFactureSoldeSQLComponent.ID);
-
 
925
    }
-
 
926
 
867
    public BigDecimal getAvancement(SQLRowAccessor r) {
927
    public BigDecimal getAvancement(SQLRowAccessor r) {
868
        Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_COMMANDE_CLIENT"));
928
        Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_COMMANDE_CLIENT"));
869
        long totalFact = 0;
929
        long totalFact = 0;
870
        long total = r.getLong("T_HT");
930
        long total = r.getLong("T_HT");
871
        for (SQLRowAccessor row : rows) {
931
        for (SQLRowAccessor row : rows) {
Line 892... Line 952...
892
 
952
 
893
                ((CommandeClientSQLComponent) editFrame.getSQLComponent()).loadCommandeExistant(selectedRow.getID());
953
                ((CommandeClientSQLComponent) editFrame.getSQLComponent()).loadCommandeExistant(selectedRow.getID());
894
                editFrame.setVisible(true);
954
                editFrame.setVisible(true);
895
            }
955
            }
896
        }, true, "sales.quote.clone") {
956
        }, true, "sales.quote.clone") {
-
 
957
 
897
            @Override
958
            @Override
898
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
959
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
899
                return (selection != null && selection.size() == 1);
960
                return (selection != null && selection.size() == 1);
900
            }
961
            }
-
 
962
 
901
        };
963
        };
902
    }
964
    }
903
 
965
 
904
    @Override
966
    @Override
905
    protected String createCode() {
967
    protected String createCode() {