Line 70... |
Line 70... |
70 |
import javax.swing.event.TableModelEvent;
|
70 |
import javax.swing.event.TableModelEvent;
|
71 |
import javax.swing.event.TableModelListener;
|
71 |
import javax.swing.event.TableModelListener;
|
72 |
|
72 |
|
73 |
public class VenteFactureSituationSQLComponent extends TransfertGroupSQLComponent {
|
73 |
public class VenteFactureSituationSQLComponent extends TransfertGroupSQLComponent {
|
74 |
public static final String ID = "sales.invoice.partial";
|
74 |
public static final String ID = "sales.invoice.partial";
|
- |
|
75 |
public static final String ID_PREVISIONNELLE = "sales.invoice.partial.future";
|
75 |
|
76 |
|
76 |
private PanelOOSQLComponent panelOO;
|
77 |
private PanelOOSQLComponent panelOO;
|
77 |
|
78 |
|
78 |
public VenteFactureSituationSQLComponent(SQLElement element) {
|
79 |
public VenteFactureSituationSQLComponent(SQLElement element) {
|
79 |
super(element, (Group) GlobalMapper.getInstance().get(ID));
|
80 |
super(element, (Group) GlobalMapper.getInstance().get(ID));
|
Line 266... |
Line 267... |
266 |
|
267 |
|
267 |
@Override
|
268 |
@Override
|
268 |
public JComponent createEditor(String id) {
|
269 |
public JComponent createEditor(String id) {
|
269 |
|
270 |
|
270 |
if (id.equals("sales.invoice.number")) {
|
271 |
if (id.equals("sales.invoice.number")) {
|
- |
|
272 |
if (getCode().equals(ID_PREVISIONNELLE)) {
|
- |
|
273 |
this.numberField = new JUniqueTextField(20);
|
- |
|
274 |
return this.numberField;
|
- |
|
275 |
} else {
|
271 |
this.numberField = new JUniqueTextField(20) {
|
276 |
this.numberField = new JUniqueTextField(20) {
|
272 |
@Override
|
277 |
@Override
|
273 |
public String getAutoRefreshNumber() {
|
278 |
public String getAutoRefreshNumber() {
|
274 |
if (getMode() == Mode.INSERTION) {
|
279 |
if (getMode() == Mode.INSERTION) {
|
275 |
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), ((JDate) getEditor("DATE")).getDate());
|
280 |
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), ((JDate) getEditor("DATE")).getDate());
|
Line 277... |
Line 282... |
277 |
return null;
|
282 |
return null;
|
278 |
}
|
283 |
}
|
279 |
}
|
284 |
}
|
280 |
};
|
285 |
};
|
281 |
return this.numberField;
|
286 |
return this.numberField;
|
- |
|
287 |
}
|
282 |
} else if (id.equals("panel.oo")) {
|
288 |
} else if (id.equals("panel.oo")) {
|
283 |
this.panelOO = new PanelOOSQLComponent(this);
|
289 |
this.panelOO = new PanelOOSQLComponent(this);
|
284 |
return this.panelOO;
|
290 |
return this.panelOO;
|
285 |
} else if (id.equals("INFOS")) {
|
291 |
} else if (id.equals("INFOS")) {
|
286 |
final ITextArea jTextArea = new ITextArea();
|
292 |
final ITextArea jTextArea = new ITextArea();
|
Line 391... |
Line 397... |
391 |
e1.printStackTrace();
|
397 |
e1.printStackTrace();
|
392 |
}
|
398 |
}
|
393 |
}
|
399 |
}
|
394 |
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", idSaisieVF);
|
400 |
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", idSaisieVF);
|
395 |
|
401 |
|
- |
|
402 |
if (!rowFacture.getBoolean("PREVISIONNELLE")) {
|
396 |
new GenerationMvtSaisieVenteFacture(idSaisieVF);
|
403 |
new GenerationMvtSaisieVenteFacture(idSaisieVF);
|
397 |
|
404 |
}
|
398 |
try {
|
405 |
try {
|
399 |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
|
406 |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
|
400 |
sheet.createDocument();
|
407 |
sheet.createDocument();
|
401 |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), rowFacture);
|
408 |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), rowFacture);
|
402 |
} catch (Exception e) {
|
409 |
} catch (Exception e) {
|
Line 419... |
Line 426... |
419 |
int id = getSelectedID();
|
426 |
int id = getSelectedID();
|
420 |
super.update();
|
427 |
super.update();
|
421 |
final SQLRow rowFacture = getTable().getRow(id);
|
428 |
final SQLRow rowFacture = getTable().getRow(id);
|
422 |
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", id);
|
429 |
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", id);
|
423 |
|
430 |
|
- |
|
431 |
if (!rowFacture.getBoolean("PREVISIONNELLE")) {
|
424 |
int idMvt = rowFacture.getInt("ID_MOUVEMENT");
|
432 |
int idMvt = rowFacture.getInt("ID_MOUVEMENT");
|
425 |
// on supprime tout ce qui est lié à la facture
|
433 |
// on supprime tout ce qui est lié à la facture
|
426 |
System.err.println("Archivage des fils");
|
434 |
System.err.println("Archivage des fils");
|
427 |
EcritureSQLElement eltEcr = (EcritureSQLElement) getDirectory().getElement("ECRITURE");
|
435 |
EcritureSQLElement eltEcr = (EcritureSQLElement) getDirectory().getElement("ECRITURE");
|
428 |
eltEcr.archiveMouvementProfondeur(idMvt, false);
|
436 |
eltEcr.archiveMouvementProfondeur(idMvt, false);
|
429 |
new GenerationMvtSaisieVenteFacture(id);
|
437 |
new GenerationMvtSaisieVenteFacture(id);
|
- |
|
438 |
}
|
430 |
try {
|
439 |
try {
|
431 |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
|
440 |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
|
432 |
sheet.createDocument();
|
441 |
sheet.createDocument();
|
433 |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), rowFacture);
|
442 |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), rowFacture);
|
434 |
} catch (Exception e) {
|
443 |
} catch (Exception e) {
|
435 |
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e);
|
444 |
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e);
|
436 |
}
|
445 |
}
|
- |
|
446 |
// incrémentation du numéro auto
|
- |
|
447 |
if (NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, rowFacture.getDate("DATE").getTime()).equalsIgnoreCase(rowFacture.getString("NUMERO"))) {
|
- |
|
448 |
SQLRowValues rowVals = new SQLRowValues(this.tableNum);
|
- |
|
449 |
|
- |
|
450 |
String labelNumberFor = NumerotationAutoSQLElement.getLabelNumberFor(SaisieVenteFactureSQLElement.class);
|
- |
|
451 |
int val = this.tableNum.getRow(2).getInt(labelNumberFor);
|
- |
|
452 |
val++;
|
- |
|
453 |
rowVals.put(labelNumberFor, Integer.valueOf(val));
|
- |
|
454 |
try {
|
- |
|
455 |
rowVals.update(2);
|
- |
|
456 |
} catch (SQLException e1) {
|
- |
|
457 |
e1.printStackTrace();
|
- |
|
458 |
}
|
- |
|
459 |
}
|
437 |
}
|
460 |
}
|
438 |
|
461 |
|
439 |
@Override
|
462 |
@Override
|
440 |
protected SQLRowValues createDefaults() {
|
463 |
protected SQLRowValues createDefaults() {
|
441 |
SQLRowValues rowVals = new SQLRowValues(getTable());
|
464 |
SQLRowValues rowVals = new SQLRowValues(getTable());
|
- |
|
465 |
if (getCode().equals(ID_PREVISIONNELLE)) {
|
- |
|
466 |
rowVals.put("NUMERO", "PREV_" + NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
- |
|
467 |
rowVals.put("PREVISIONNELLE", Boolean.TRUE);
|
- |
|
468 |
} else {
|
442 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
469 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
- |
|
470 |
}
|
443 |
rowVals.put("PARTIAL", Boolean.TRUE);
|
471 |
rowVals.put("PARTIAL", Boolean.TRUE);
|
444 |
return rowVals;
|
472 |
return rowVals;
|
445 |
}
|
473 |
}
|
446 |
|
474 |
|
447 |
@Override
|
475 |
@Override
|
Line 450... |
Line 478... |
450 |
return super.addView(new AcompteRowItemView((AcompteField) comp), "MONTANT_FACTURABLE,POURCENT_FACTURABLE", REQ);
|
478 |
return super.addView(new AcompteRowItemView((AcompteField) comp), "MONTANT_FACTURABLE,POURCENT_FACTURABLE", REQ);
|
451 |
} else {
|
479 |
} else {
|
452 |
return super.addView(comp, id);
|
480 |
return super.addView(comp, id);
|
453 |
}
|
481 |
}
|
454 |
}
|
482 |
}
|
- |
|
483 |
|
455 |
}
|
484 |
}
|