Line 159... |
Line 159... |
159 |
} else {
|
159 |
} else {
|
160 |
totalTTC.setCategorieComptable(null);
|
160 |
totalTTC.setCategorieComptable(null);
|
161 |
tableFacture.setRowCatComptable(null);
|
161 |
tableFacture.setRowCatComptable(null);
|
162 |
}
|
162 |
}
|
163 |
|
163 |
|
164 |
if (!isFilling()) {
|
- |
|
165 |
tableFacture.setClient(rowCli, true);
|
164 |
SaisieVenteFactureSQLComponent.this.tableFacture.setClient(rowCli, !isFilling());
|
166 |
}
|
- |
|
167 |
|
165 |
|
168 |
if (getMode() == SQLComponent.Mode.INSERTION || !isFilling()) {
|
166 |
if (getMode() == SQLComponent.Mode.INSERTION || !isFilling()) {
|
169 |
SQLElement sqleltModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
|
167 |
SQLElement sqleltModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
|
170 |
int idModeRegl = rowCli.getInt("ID_MODE_REGLEMENT");
|
168 |
int idModeRegl = rowCli.getInt("ID_MODE_REGLEMENT");
|
171 |
if (idModeRegl > 1) {
|
169 |
if (idModeRegl > 1) {
|
Line 299... |
Line 297... |
299 |
|
297 |
|
300 |
@Override
|
298 |
@Override
|
301 |
public void propertyChange(PropertyChangeEvent evt) {
|
299 |
public void propertyChange(PropertyChangeEvent evt) {
|
302 |
if (!isFilling() && dateSaisie.getValue() != null) {
|
300 |
if (!isFilling() && dateSaisie.getValue() != null) {
|
303 |
|
301 |
|
304 |
final String nextNumero = NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, dateSaisie.getValue(), defaultNum);
|
302 |
final String nextNumero = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateSaisie.getValue(), defaultNum);
|
305 |
|
303 |
|
306 |
if (textNumeroUnique.getText().trim().length() > 0 && !nextNumero.equalsIgnoreCase(textNumeroUnique.getText())) {
|
304 |
if (textNumeroUnique.getText().trim().length() > 0 && !nextNumero.equalsIgnoreCase(textNumeroUnique.getText())) {
|
307 |
|
305 |
|
308 |
int answer = JOptionPane.showConfirmDialog(SaisieVenteFactureSQLComponent.this, "Voulez vous actualiser le numéro de la facture?", "Changement du numéro de facture",
|
306 |
int answer = JOptionPane.showConfirmDialog(SaisieVenteFactureSQLComponent.this, "Voulez vous actualiser le numéro de la facture?", "Changement du numéro de facture",
|
309 |
JOptionPane.YES_NO_OPTION);
|
307 |
JOptionPane.YES_NO_OPTION);
|
Line 1413... |
Line 1411... |
1413 |
if (getMode() == Mode.INSERTION) {
|
1411 |
if (getMode() == Mode.INSERTION) {
|
1414 |
idSaisieVF = super.insert(order);
|
1412 |
idSaisieVF = super.insert(order);
|
1415 |
rowFacture = getTable().getRow(idSaisieVF);
|
1413 |
rowFacture = getTable().getRow(idSaisieVF);
|
1416 |
// incrémentation du numéro auto
|
1414 |
// incrémentation du numéro auto
|
1417 |
final SQLRow rowNum = comboNumAuto == null ? this.tableNum.getRow(2) : comboNumAuto.getSelectedRow();
|
1415 |
final SQLRow rowNum = comboNumAuto == null ? this.tableNum.getRow(2) : comboNumAuto.getSelectedRow();
|
1418 |
if (NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, rowFacture.getDate("DATE").getTime(), rowNum)
|
1416 |
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), rowFacture.getDate("DATE").getTime(), rowNum).equalsIgnoreCase(this.textNumeroUnique.getText().trim())) {
|
1419 |
.equalsIgnoreCase(this.textNumeroUnique.getText().trim())) {
|
- |
|
1420 |
SQLRowValues rowVals = rowNum.createEmptyUpdateRow();
|
1417 |
SQLRowValues rowVals = rowNum.createEmptyUpdateRow();
|
1421 |
|
1418 |
|
1422 |
String labelNumberFor = NumerotationAutoSQLElement.getLabelNumberFor(SaisieVenteFactureSQLElement.class);
|
1419 |
String labelNumberFor = NumerotationAutoSQLElement.getLabelNumberFor(getElement().getClass());
|
1423 |
int val = rowNum.getInt(labelNumberFor);
|
1420 |
int val = rowNum.getInt(labelNumberFor);
|
1424 |
val++;
|
1421 |
val++;
|
1425 |
rowVals.put(labelNumberFor, Integer.valueOf(val));
|
1422 |
rowVals.put(labelNumberFor, Integer.valueOf(val));
|
1426 |
rowVals.update();
|
1423 |
rowVals.update();
|
1427 |
}
|
1424 |
}
|
Line 1606... |
Line 1603... |
1606 |
if (idFacture > 1) {
|
1603 |
if (idFacture > 1) {
|
1607 |
SQLRow row = fact.getTable().getRow(idFacture);
|
1604 |
SQLRow row = fact.getTable().getRow(idFacture);
|
1608 |
SQLRowValues rowVals = new SQLRowValues(fact.getTable());
|
1605 |
SQLRowValues rowVals = new SQLRowValues(fact.getTable());
|
1609 |
rowVals.put("ID_CLIENT", row.getInt("ID_CLIENT"));
|
1606 |
rowVals.put("ID_CLIENT", row.getInt("ID_CLIENT"));
|
1610 |
if (getTable().contains("ID_NUMEROTATION_AUTO")) {
|
1607 |
if (getTable().contains("ID_NUMEROTATION_AUTO")) {
|
1611 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date(), row.getForeign("ID_NUMEROTATION_AUTO")));
|
1608 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date(), row.getForeign("ID_NUMEROTATION_AUTO")));
|
1612 |
} else {
|
1609 |
} else {
|
1613 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
1610 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date()));
|
1614 |
}
|
1611 |
}
|
1615 |
rowVals.put("NOM", row.getObject("NOM"));
|
1612 |
rowVals.put("NOM", row.getObject("NOM"));
|
1616 |
this.select(rowVals);
|
1613 |
this.select(rowVals);
|
1617 |
}
|
1614 |
}
|
1618 |
|
1615 |
|
Line 1646... |
Line 1643... |
1646 |
if (idFacture > 1) {
|
1643 |
if (idFacture > 1) {
|
1647 |
SQLRow row = fact.getTable().getRow(idFacture);
|
1644 |
SQLRow row = fact.getTable().getRow(idFacture);
|
1648 |
SQLRowValues rowVals = new SQLRowValues(fact.getTable());
|
1645 |
SQLRowValues rowVals = new SQLRowValues(fact.getTable());
|
1649 |
rowVals.put("ID_CLIENT", row.getInt("ID_CLIENT"));
|
1646 |
rowVals.put("ID_CLIENT", row.getInt("ID_CLIENT"));
|
1650 |
rowVals.put("ID_AFFAIRE", row.getInt("ID_AFFAIRE"));
|
1647 |
rowVals.put("ID_AFFAIRE", row.getInt("ID_AFFAIRE"));
|
1651 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
1648 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date()));
|
1652 |
rowVals.put("NOM", "Acompte de " + GestionDevise.currencyToString(acompte) + "€");
|
1649 |
rowVals.put("NOM", "Acompte de " + GestionDevise.currencyToString(acompte) + "€");
|
1653 |
this.select(rowVals);
|
1650 |
this.select(rowVals);
|
1654 |
}
|
1651 |
}
|
1655 |
|
1652 |
|
1656 |
// On duplique les elements de facture
|
1653 |
// On duplique les elements de facture
|
Line 1806... |
Line 1803... |
1806 |
vals.put("TOTAL_TIMBRE_FISCAL", 0L);
|
1803 |
vals.put("TOTAL_TIMBRE_FISCAL", 0L);
|
1807 |
// User
|
1804 |
// User
|
1808 |
final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration.getInstance());
|
1805 |
final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration.getInstance());
|
1809 |
if (getTable().contains("ID_NUMEROTATION_AUTO")) {
|
1806 |
if (getTable().contains("ID_NUMEROTATION_AUTO")) {
|
1810 |
vals.put("ID_NUMEROTATION_AUTO", this.defaultNum.getID());
|
1807 |
vals.put("ID_NUMEROTATION_AUTO", this.defaultNum.getID());
|
1811 |
vals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date(), vals.getForeign("ID_NUMEROTATION_AUTO")));
|
1808 |
vals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date(), vals.getForeign("ID_NUMEROTATION_AUTO")));
|
1812 |
} else {
|
1809 |
} else {
|
1813 |
vals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
1810 |
vals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date()));
|
1814 |
}
|
1811 |
}
|
1815 |
int idCompteVenteProduit = rowPrefsCompte.getInt("ID_COMPTE_PCE_VENTE_PRODUIT");
|
1812 |
int idCompteVenteProduit = rowPrefsCompte.getInt("ID_COMPTE_PCE_VENTE_PRODUIT");
|
1816 |
if (idCompteVenteProduit <= 1) {
|
1813 |
if (idCompteVenteProduit <= 1) {
|
1817 |
try {
|
1814 |
try {
|
1818 |
idCompteVenteProduit = ComptePCESQLElement.getIdComptePceDefault("VentesProduits");
|
1815 |
idCompteVenteProduit = ComptePCESQLElement.getIdComptePceDefault("VentesProduits");
|
Line 1850... |
Line 1847... |
1850 |
}
|
1847 |
}
|
1851 |
|
1848 |
|
1852 |
public void setDefaults() {
|
1849 |
public void setDefaults() {
|
1853 |
this.resetValue();
|
1850 |
this.resetValue();
|
1854 |
|
1851 |
|
1855 |
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new java.util.Date(), defaultNum));
|
1852 |
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new java.util.Date(), defaultNum));
|
1856 |
this.tableFacture.getModel().clearRows();
|
1853 |
this.tableFacture.getModel().clearRows();
|
1857 |
}
|
1854 |
}
|
1858 |
|
1855 |
|
1859 |
public RowValuesTableModel getRowValuesTableModel() {
|
1856 |
public RowValuesTableModel getRowValuesTableModel() {
|
1860 |
return this.tableFacture.getModel();
|
1857 |
return this.tableFacture.getModel();
|
Line 1868... |
Line 1865... |
1868 |
*/
|
1865 |
*/
|
1869 |
@Deprecated
|
1866 |
@Deprecated
|
1870 |
public void setPrevisonnelle(boolean b) {
|
1867 |
public void setPrevisonnelle(boolean b) {
|
1871 |
this.checkPrevisionnelle.setSelected(b);
|
1868 |
this.checkPrevisionnelle.setSelected(b);
|
1872 |
if (!b) {
|
1869 |
if (!b) {
|
1873 |
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date()));
|
1870 |
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date()));
|
1874 |
}
|
1871 |
}
|
1875 |
}
|
1872 |
}
|
1876 |
|
1873 |
|
1877 |
/**
|
1874 |
/**
|
1878 |
* Définir la facture comme complémentaire. Règlement supérieur au montant de la facture
|
1875 |
* Définir la facture comme complémentaire. Règlement supérieur au montant de la facture
|
Line 1914... |
Line 1911... |
1914 |
private void updateStock(int id) throws SQLException {
|
1911 |
private void updateStock(int id) throws SQLException {
|
1915 |
|
1912 |
|
1916 |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
|
1913 |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
|
1917 |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
|
1914 |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
|
1918 |
SQLRow row = getTable().getRow(id);
|
1915 |
SQLRow row = getTable().getRow(id);
|
- |
|
1916 |
|
- |
|
1917 |
// Check if tr from bl or cmd pour DS
|
- |
|
1918 |
if (getTable().getForeignTable("ID_CLIENT").contains("NOTE_2018")) {
|
- |
|
1919 |
List<SQLRow> trCmd = row.getReferentRows(getTable().getTable("TR_COMMANDE_CLIENT"));
|
- |
|
1920 |
if (!trCmd.isEmpty()) {
|
- |
|
1921 |
return;
|
- |
|
1922 |
}
|
- |
|
1923 |
}
|
- |
|
1924 |
|
1919 |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
|
1925 |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
|
1920 |
|
1926 |
|
1921 |
@Override
|
1927 |
@Override
|
1922 |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
|
1928 |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
|
1923 |
return getLibelleStock(rowOrigin, rowElt);
|
1929 |
return getLibelleStock(rowOrigin, rowElt);
|