Line 20... |
Line 20... |
20 |
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
|
20 |
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
|
21 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement;
|
21 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement;
|
22 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement.GenerationResult;
|
22 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement.GenerationResult;
|
23 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement.IgnoreReason;
|
23 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement.IgnoreReason;
|
24 |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
|
24 |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
|
- |
|
25 |
import org.openconcerto.erp.core.sales.pos.POSConfiguration;
|
25 |
import org.openconcerto.erp.core.sales.pos.ui.TextAreaTicketPanel;
|
26 |
import org.openconcerto.erp.core.sales.pos.ui.TextAreaTicketPanel;
|
26 |
import org.openconcerto.erp.utils.TM;
|
27 |
import org.openconcerto.erp.utils.TM;
|
27 |
import org.openconcerto.sql.Configuration;
|
28 |
import org.openconcerto.sql.Configuration;
|
28 |
import org.openconcerto.sql.element.SQLElement;
|
29 |
import org.openconcerto.sql.element.SQLElement;
|
29 |
import org.openconcerto.sql.model.FieldPath;
|
30 |
import org.openconcerto.sql.model.FieldPath;
|
30 |
import org.openconcerto.sql.model.SQLField;
|
31 |
import org.openconcerto.sql.model.SQLField;
|
31 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
32 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
32 |
import org.openconcerto.sql.model.SQLRowValues;
|
33 |
import org.openconcerto.sql.model.SQLRowValues;
|
33 |
import org.openconcerto.sql.model.Where;
|
34 |
import org.openconcerto.sql.model.Where;
|
34 |
import org.openconcerto.sql.model.graph.Path;
|
35 |
import org.openconcerto.sql.model.graph.Path;
|
- |
|
36 |
import org.openconcerto.sql.request.UpdateBuilder;
|
35 |
import org.openconcerto.sql.view.list.IListe;
|
37 |
import org.openconcerto.sql.view.list.IListe;
|
36 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
38 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
37 |
import org.openconcerto.sql.view.list.ITableModel;
|
39 |
import org.openconcerto.sql.view.list.ITableModel;
|
38 |
import org.openconcerto.sql.view.list.RowAction;
|
40 |
import org.openconcerto.sql.view.list.RowAction;
|
39 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
41 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
Line 156... |
Line 158... |
156 |
final IListe l = IListe.get(e);
|
158 |
final IListe l = IListe.get(e);
|
157 |
final List<Integer> selectedIDs = l.getSelection().getSelectedIDs();
|
159 |
final List<Integer> selectedIDs = l.getSelection().getSelectedIDs();
|
158 |
// TODO dialog with label informing of the successful creation of message for n
|
160 |
// TODO dialog with label informing of the successful creation of message for n
|
159 |
// invoices/n2 messages too far in the future/n3 messages with collection date
|
161 |
// invoices/n2 messages too far in the future/n3 messages with collection date
|
160 |
// changed and having a button to open the file chooser
|
162 |
// changed and having a button to open the file chooser
|
161 |
new SwingWorker<GenerationResult, Object>() {
|
163 |
new SwingWorker<GenerationResult, Void>() {
|
162 |
@Override
|
164 |
@Override
|
163 |
protected GenerationResult doInBackground() throws Exception {
|
165 |
protected GenerationResult doInBackground() throws Exception {
|
164 |
return sepaMsgElem.generateXML(selectedIDs);
|
166 |
return sepaMsgElem.generateXML(selectedIDs);
|
165 |
}
|
167 |
}
|
166 |
|
168 |
|
Line 189... |
Line 191... |
189 |
tmMap.put("futureCount", futureCount);
|
191 |
tmMap.put("futureCount", futureCount);
|
190 |
tmMap.put("duplicateCount", duplicateCount);
|
192 |
tmMap.put("duplicateCount", duplicateCount);
|
191 |
tmMap.put("missingInfoCount", missingInfoCount);
|
193 |
tmMap.put("missingInfoCount", missingInfoCount);
|
192 |
final StringBuilder msg = new StringBuilder(256);
|
194 |
final StringBuilder msg = new StringBuilder(256);
|
193 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored", tmMap));
|
195 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored", tmMap));
|
194 |
msg.append('\n');
|
- |
|
195 |
if (futureCount > 0) {
|
196 |
if (futureCount > 0) {
|
196 |
msg.append("- ");
|
197 |
msg.append("\n- ");
|
197 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored.future", tmMap));
|
198 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored.future", tmMap));
|
198 |
}
|
199 |
}
|
199 |
if (duplicateCount > 0) {
|
200 |
if (duplicateCount > 0) {
|
200 |
msg.append("- ");
|
201 |
msg.append("\n- ");
|
201 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored.duplicateMandate", tmMap));
|
202 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored.duplicateMandate", tmMap));
|
202 |
}
|
203 |
}
|
203 |
if (missingInfoCount > 0) {
|
204 |
if (missingInfoCount > 0) {
|
204 |
msg.append("- ");
|
205 |
msg.append("\n- ");
|
205 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored.missingInfo", tmMap));
|
206 |
msg.append(TM.getTM().trM("sddMessage.generation.someIgnored.missingInfo", tmMap));
|
206 |
}
|
207 |
}
|
207 |
final int messageType = duplicateCount == 0 ? JOptionPane.WARNING_MESSAGE : JOptionPane.ERROR_MESSAGE;
|
208 |
final int messageType = duplicateCount == 0 ? JOptionPane.WARNING_MESSAGE : JOptionPane.ERROR_MESSAGE;
|
208 |
JOptionPane.showMessageDialog(l, msg.toString(), null, messageType);
|
209 |
JOptionPane.showMessageDialog(l, msg.toString(), null, messageType);
|
209 |
}
|
210 |
}
|
Line 212... |
Line 213... |
212 |
}
|
213 |
}
|
213 |
}
|
214 |
}
|
214 |
}.execute();
|
215 |
}.execute();
|
215 |
}
|
216 |
}
|
216 |
}, false, true).setPredicate(IListeEvent.getNonEmptySelectionPredicate()));
|
217 |
}, false, true).setPredicate(IListeEvent.getNonEmptySelectionPredicate()));
|
- |
|
218 |
// TODO remove once we have a join with {SENT, OK, DEFINITIVE_ERROR, TRANSIENT_ERROR}
|
- |
|
219 |
this.listeFact.getListe().addIListeAction(new RowAction.PredicateRowAction(new AbstractAction("Prélever à nouveau", null) {
|
- |
|
220 |
@Override
|
- |
|
221 |
public void actionPerformed(ActionEvent e) {
|
- |
|
222 |
final IListe l = IListe.get(e);
|
- |
|
223 |
if (JOptionPane.showConfirmDialog(l, "Voulez-vous vraiment prélever à nouveau les factures sélectionnées ? Cette action est définitive.", "Prélever à nouveau",
|
- |
|
224 |
JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION)
|
- |
|
225 |
return;
|
- |
|
226 |
final List<Integer> selectedIDs = l.getSelection().getSelectedIDs();
|
- |
|
227 |
final UpdateBuilder upd = new UpdateBuilder(l.getSource().getPrimaryTable());
|
- |
|
228 |
upd.setObject(SaisieVenteFactureSQLElement.MESSAGE_FIELD_NAME, upd.getTable().getForeignTable(SaisieVenteFactureSQLElement.MESSAGE_FIELD_NAME).getUndefinedIDNumber());
|
- |
|
229 |
upd.setObject(SaisieVenteFactureSQLElement.END2END_FIELD_NAME, "");
|
- |
|
230 |
// don't allow to debit already payed invoices
|
- |
|
231 |
upd.setWhere(new Where(upd.getTable().getKey(), selectedIDs).and(Where.isNull(upd.getTable().getField("DATE_REGLEMENT"))));
|
- |
|
232 |
|
- |
|
233 |
upd.getTable().getDBSystemRoot().getDataSource().execute(upd.asString());
|
- |
|
234 |
for (final Integer id : selectedIDs)
|
- |
|
235 |
upd.getTable().fireTableModified(id, upd.getFieldsNames());
|
- |
|
236 |
}
|
- |
|
237 |
}, false, true).setPredicate(IListeEvent.getNonEmptySelectionPredicate()));
|
217 |
this.listeFact.setOpaque(false);
|
238 |
this.listeFact.setOpaque(false);
|
218 |
this.listeFact.getListe().setModificationAllowed(true);
|
239 |
this.listeFact.getListe().setModificationAllowed(true);
|
219 |
final JTable tableFact = this.listeFact.getListe().getJTable();
|
240 |
final JTable tableFact = this.listeFact.getListe().getJTable();
|
220 |
final SQLTableModelColumn numeroCol = src.getColumn(eltFacture.getTable().getField("NUMERO"));
|
241 |
final SQLTableModelColumn numeroCol = src.getColumn(eltFacture.getTable().getField("NUMERO"));
|
221 |
((TableSorter) tableFact.getModel()).setSortingStatus(src.getColumns().indexOf(numeroCol), TableSorter.ASCENDING);
|
242 |
((TableSorter) tableFact.getModel()).setSortingStatus(src.getColumns().indexOf(numeroCol), TableSorter.ASCENDING);
|
Line 297... |
Line 318... |
297 |
// Tab Vente caisse
|
318 |
// Tab Vente caisse
|
298 |
ListeViewPanel panelTicket = new ListeViewPanel(Configuration.getInstance().getDirectory().getElement("TICKET_CAISSE")) {
|
319 |
ListeViewPanel panelTicket = new ListeViewPanel(Configuration.getInstance().getDirectory().getElement("TICKET_CAISSE")) {
|
299 |
@Override
|
320 |
@Override
|
300 |
protected void handleAction(JButton source, ActionEvent evt) {
|
321 |
protected void handleAction(JButton source, ActionEvent evt) {
|
301 |
if (source == this.buttonModifier) {
|
322 |
if (source == this.buttonModifier) {
|
- |
|
323 |
POSConfiguration posConf = POSConfiguration.getInstance();
|
- |
|
324 |
try {
|
- |
|
325 |
if (posConf == null)
|
- |
|
326 |
posConf = POSConfiguration.setInstance();
|
- |
|
327 |
} catch (Exception e) {
|
- |
|
328 |
ExceptionHandler.handle(source, "Impossible d'initialiser la configuration de la caisse", e);
|
- |
|
329 |
return;
|
- |
|
330 |
}
|
302 |
new PanelFrame(new TextAreaTicketPanel(this.getListe().fetchSelectedRow()), "Ticket").setVisible(true);
|
331 |
new PanelFrame(new TextAreaTicketPanel(posConf, this.getListe().fetchSelectedRow()), "Ticket").setVisible(true);
|
303 |
} else {
|
332 |
} else {
|
304 |
super.handleAction(source, evt);
|
333 |
super.handleAction(source, evt);
|
305 |
}
|
334 |
}
|
306 |
}
|
335 |
}
|
307 |
};
|
336 |
};
|