18 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
182 |
ilm |
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
18 |
ilm |
5 |
*
|
|
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
|
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
|
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
|
|
9 |
* language governing permissions and limitations under the License.
|
|
|
10 |
*
|
|
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
package org.openconcerto.erp.core.humanresources.payroll.action;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.action.CreateFrameAbstractAction;
|
|
|
17 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
|
|
18 |
import org.openconcerto.erp.core.common.ui.PanelFrame;
|
91 |
ilm |
19 |
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheetXML;
|
18 |
ilm |
20 |
import org.openconcerto.erp.core.humanresources.payroll.ui.PanelCumulsPaye;
|
91 |
ilm |
21 |
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
|
18 |
ilm |
22 |
import org.openconcerto.sql.Configuration;
|
|
|
23 |
import org.openconcerto.sql.element.SQLElement;
|
|
|
24 |
import org.openconcerto.sql.model.SQLRow;
|
|
|
25 |
import org.openconcerto.sql.model.Where;
|
|
|
26 |
import org.openconcerto.sql.view.EditFrame;
|
|
|
27 |
import org.openconcerto.sql.view.EditPanel;
|
|
|
28 |
import org.openconcerto.sql.view.IListFrame;
|
|
|
29 |
import org.openconcerto.sql.view.IListener;
|
|
|
30 |
import org.openconcerto.sql.view.ListeAddPanel;
|
19 |
ilm |
31 |
import org.openconcerto.sql.view.list.IListe;
|
91 |
ilm |
32 |
import org.openconcerto.sql.view.list.RowAction;
|
19 |
ilm |
33 |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
|
18 |
ilm |
34 |
|
|
|
35 |
import java.awt.event.ActionEvent;
|
|
|
36 |
import java.awt.event.MouseAdapter;
|
|
|
37 |
import java.awt.event.MouseEvent;
|
|
|
38 |
|
|
|
39 |
import javax.swing.AbstractAction;
|
|
|
40 |
import javax.swing.Action;
|
|
|
41 |
import javax.swing.JButton;
|
|
|
42 |
import javax.swing.JFrame;
|
|
|
43 |
import javax.swing.JPopupMenu;
|
|
|
44 |
|
|
|
45 |
public class ListeDesFichesDePayeAction extends CreateFrameAbstractAction {
|
|
|
46 |
|
|
|
47 |
private EditFrame editFrame = null;
|
|
|
48 |
|
|
|
49 |
public ListeDesFichesDePayeAction() {
|
|
|
50 |
super();
|
|
|
51 |
this.putValue(Action.NAME, "Liste des fiches de paye");
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public JFrame createFrame() {
|
|
|
55 |
|
|
|
56 |
// Liste Panel avec impossibilité de modifier les fiches de paye
|
19 |
ilm |
57 |
final SQLElement elt = Configuration.getInstance().getDirectory().getElement("FICHE_PAYE");
|
|
|
58 |
final SQLTableModelSourceOnline src = elt.getTableSource(true);
|
|
|
59 |
// On affcihe seulement les fiches de payes validées
|
|
|
60 |
src.getReq().setWhere(new Where(elt.getTable().getField("VALIDE"), "=", Boolean.TRUE));
|
142 |
ilm |
61 |
final ListeAddPanel liste = new ListeFichePayeAddPanel(elt, new IListe(src));
|
18 |
ilm |
62 |
|
|
|
63 |
final IListFrame frame = new IListFrame(liste);
|
|
|
64 |
|
151 |
ilm |
65 |
frame.getPanel().getListe().setModificationAllowed(false);
|
18 |
ilm |
66 |
frame.getPanel().setAddVisible(false);
|
|
|
67 |
|
|
|
68 |
final PanelCumulsPaye pCumuls = new PanelCumulsPaye();
|
|
|
69 |
final PanelFrame p = new PanelFrame(pCumuls, "Détails cumuls et variables");
|
|
|
70 |
|
|
|
71 |
frame.getPanel().getListe().addIListener(new IListener() {
|
|
|
72 |
|
|
|
73 |
public void selectionId(int id, int field) {
|
|
|
74 |
|
|
|
75 |
pCumuls.selectFicheFromId(id);
|
|
|
76 |
}
|
|
|
77 |
});
|
|
|
78 |
|
|
|
79 |
// Menu Clic droit Génération documents
|
|
|
80 |
frame.getPanel().getListe().getJTable().addMouseListener(new MouseAdapter() {
|
|
|
81 |
|
|
|
82 |
public void mousePressed(MouseEvent mouseEvent) {
|
|
|
83 |
|
|
|
84 |
if (mouseEvent.getButton() == MouseEvent.BUTTON3 && frame.getPanel().getListe().getSelectedId() > 1) {
|
|
|
85 |
|
|
|
86 |
JPopupMenu menuDroit = new JPopupMenu();
|
|
|
87 |
|
|
|
88 |
final SQLRow rowFiche = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getTable("FICHE_PAYE").getRow(frame.getPanel().getListe().getSelectedId());
|
|
|
89 |
|
182 |
ilm |
90 |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(elt, FichePayeSheetXML.class);
|
18 |
ilm |
91 |
|
91 |
ilm |
92 |
for (RowAction action : l.getRowActions()) {
|
|
|
93 |
menuDroit.add(action.getAction());
|
|
|
94 |
}
|
18 |
ilm |
95 |
|
|
|
96 |
menuDroit.add(new AbstractAction("Détails cumuls et variables") {
|
|
|
97 |
public void actionPerformed(ActionEvent e) {
|
|
|
98 |
|
|
|
99 |
pCumuls.selectFiche(rowFiche);
|
|
|
100 |
p.setVisible(true);
|
|
|
101 |
}
|
|
|
102 |
});
|
|
|
103 |
|
|
|
104 |
menuDroit.pack();
|
|
|
105 |
menuDroit.show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
|
|
|
106 |
menuDroit.setVisible(true);
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
});
|
|
|
110 |
|
|
|
111 |
return frame;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
}
|