Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
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
|
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
|
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.
|
9 |
* language governing permissions and limitations under the License.
|
Line 15... |
Line 15... |
15 |
|
15 |
|
16 |
import org.openconcerto.erp.core.common.ui.TotalCalculator;
|
16 |
import org.openconcerto.erp.core.common.ui.TotalCalculator;
|
17 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
|
17 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
|
18 |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
|
18 |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
|
19 |
import org.openconcerto.erp.generationDoc.SheetXml;
|
19 |
import org.openconcerto.erp.generationDoc.SheetXml;
|
- |
|
20 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
|
20 |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider;
|
21 |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider;
|
21 |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager;
|
22 |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager;
|
22 |
import org.openconcerto.erp.model.PrixTTC;
|
23 |
import org.openconcerto.erp.model.PrixTTC;
|
23 |
import org.openconcerto.sql.model.SQLRow;
|
24 |
import org.openconcerto.sql.model.SQLRow;
|
24 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
25 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
Line 138... |
Line 139... |
138 |
}
|
139 |
}
|
139 |
|
140 |
|
140 |
SQLTable tableEchantillon = null;
|
141 |
SQLTable tableEchantillon = null;
|
141 |
BigDecimal portHT = BigDecimal.valueOf(saisieRow.getLong("PORT_HT")).movePointLeft(2);
|
142 |
BigDecimal portHT = BigDecimal.valueOf(saisieRow.getLong("PORT_HT")).movePointLeft(2);
|
142 |
BigDecimal fraisDocHT = BigDecimal.valueOf(saisieRow.getLong("FRAIS_DOCUMENT_HT")).movePointLeft(2);
|
143 |
BigDecimal fraisDocHT = BigDecimal.valueOf(saisieRow.getLong("FRAIS_DOCUMENT_HT")).movePointLeft(2);
|
- |
|
144 |
SQLRow taxeDoc = saisieRow.getNonEmptyForeign("ID_TAXE_FRAIS_DOCUMENT") == null ? TaxeCache.getCache().getFirstTaxe()
|
- |
|
145 |
: TaxeCache.getCache().getRowFromId(saisieRow.getForeignID("ID_TAXE_FRAIS_DOCUMENT")).asRow();
|
- |
|
146 |
|
143 |
TotalCalculator calc;
|
147 |
TotalCalculator calc;
|
- |
|
148 |
SQLRow taxePort = saisieRow.getNonEmptyForeign("ID_TAXE_PORT") == null ? TaxeCache.getCache().getFirstTaxe()
|
- |
|
149 |
: TaxeCache.getCache().getRowFromId(saisieRow.getForeignID("ID_TAXE_PORT")).asRow();
|
- |
|
150 |
|
144 |
if (clientRow.getTable().contains("ID_COMPTE_PCE_PRODUIT") && !clientRow.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) {
|
151 |
if (clientRow.getTable().contains("ID_COMPTE_PCE_PRODUIT") && !clientRow.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) {
|
- |
|
152 |
|
145 |
calc = getValuesFromElement(false, false, "T_PV_HT", saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), fraisDocHT,
|
153 |
calc = getValuesFromElement(false, false, "T_PV_HT", saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, taxePort, fraisDocHT, taxeDoc, tableEchantillon,
|
146 |
saisieRow.getForeign("ID_TAXE_FRAIS_DOCUMENT"), tableEchantillon, clientRow.getForeign("ID_COMPTE_PCE_PRODUIT"));
|
154 |
clientRow.getForeign("ID_COMPTE_PCE_PRODUIT"));
|
147 |
} else {
|
155 |
} else {
|
- |
|
156 |
|
148 |
calc = getValuesFromElement(saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), fraisDocHT,
|
157 |
calc = getValuesFromElement(saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, taxePort, fraisDocHT, taxeDoc, tableEchantillon);
|
149 |
saisieRow.getForeign("ID_TAXE_FRAIS_DOCUMENT"), tableEchantillon);
|
- |
|
150 |
}
|
158 |
}
|
151 |
|
159 |
|
152 |
// On génére les ecritures si la facture n'est pas un acompte
|
160 |
// On génére les ecritures si la facture n'est pas un acompte
|
153 |
long ttcLongValue = calc.getTotalTTC().movePointRight(2).longValue();
|
161 |
long ttcLongValue = calc.getTotalTTC().movePointRight(2).longValue();
|
154 |
if (acompte == null || !acompte) {
|
162 |
if (acompte == null || !acompte) {
|