Line 11... |
Line 11... |
11 |
* When distributing the software, include this License Header Notice in each file.
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.erp.generationEcritures;
|
14 |
package org.openconcerto.erp.generationEcritures;
|
15 |
|
15 |
|
- |
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
16 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
|
17 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
|
17 |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
|
- |
|
18 |
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
|
18 |
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
|
- |
|
19 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
|
19 |
import org.openconcerto.sql.Configuration;
|
20 |
import org.openconcerto.sql.Configuration;
|
20 |
import org.openconcerto.sql.element.SQLElement;
|
21 |
import org.openconcerto.sql.element.SQLElement;
|
21 |
import org.openconcerto.sql.model.SQLRow;
|
22 |
import org.openconcerto.sql.model.SQLRow;
|
22 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
23 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
23 |
import org.openconcerto.sql.model.SQLRowValues;
|
24 |
import org.openconcerto.sql.model.SQLRowValues;
|
Line 108... |
Line 109... |
108 |
fillCompteBanqueFromRow(chequeRow, "VenteCheque", false);
|
109 |
fillCompteBanqueFromRow(chequeRow, "VenteCheque", false);
|
109 |
this.putValue("DEBIT", new Long(this.montant));
|
110 |
this.putValue("DEBIT", new Long(this.montant));
|
110 |
this.putValue("CREDIT", new Long(0));
|
111 |
this.putValue("CREDIT", new Long(0));
|
111 |
ajoutEcriture();
|
112 |
ajoutEcriture();
|
112 |
|
113 |
|
- |
|
114 |
// FIXME remove getConf
|
- |
|
115 |
SQLRow rowSoc = ComptaPropsConfiguration.getInstanceCompta().getRowSociete();
|
- |
|
116 |
if (rowSoc.getTable().contains("TVA_ENCAISSEMENT") && rowSoc.getBoolean("TVA_ENCAISSEMENT")) {
|
- |
|
117 |
SQLRow rowTaxe = TaxeCache.getCache().getFirstTaxe();
|
- |
|
118 |
if (rowTaxe.contains("ID_COMPTE_PCE_COLLECTE_ENCAISSEMENT")) {
|
- |
|
119 |
SQLRowAccessor rowCompteTvaEnc = rowTaxe.getNonEmptyForeign("ID_COMPTE_PCE_COLLECTE_ENCAISSEMENT");
|
- |
|
120 |
SQLRowAccessor rowCompteTvaCol = rowTaxe.getNonEmptyForeign("ID_COMPTE_PCE_COLLECTE");
|
- |
|
121 |
if (rowCompteTvaCol != null && rowCompteTvaEnc != null) {
|
- |
|
122 |
Float taux = rowTaxe.getFloat("TAUX");
|
- |
|
123 |
long ht = Math.round(montant / (1.0 + (taux / 100.0)));
|
- |
|
124 |
long tva = montant - ht;
|
- |
|
125 |
this.putValue("ID_COMPTE_PCE", rowCompteTvaCol.getID());
|
- |
|
126 |
this.putValue("DEBIT", Long.valueOf(tva));
|
- |
|
127 |
this.putValue("CREDIT", Long.valueOf(0));
|
- |
|
128 |
ajoutEcriture();
|
- |
|
129 |
|
- |
|
130 |
this.putValue("ID_COMPTE_PCE", rowCompteTvaEnc.getID());
|
- |
|
131 |
this.putValue("DEBIT", Long.valueOf(0));
|
- |
|
132 |
this.putValue("CREDIT", Long.valueOf(tva));
|
- |
|
133 |
ajoutEcriture();
|
- |
|
134 |
|
- |
|
135 |
}
|
- |
|
136 |
}
|
- |
|
137 |
}
|
- |
|
138 |
|
113 |
List<Integer> pieceIDs = new ArrayList<Integer>();
|
139 |
List<Integer> pieceIDs = new ArrayList<Integer>();
|
114 |
pieceIDs.add(mouvementTable.getRow(idMvt).getForeignID("ID_PIECE"));
|
140 |
pieceIDs.add(mouvementTable.getRow(idMvt).getForeignID("ID_PIECE"));
|
115 |
lettrageAuto(pieceIDs, this.date);
|
141 |
lettrageAuto(pieceIDs, this.date);
|
116 |
|
142 |
|
117 |
System.err.println("Ecritures générées pour le mouvement " + this.idMvt);
|
143 |
System.err.println("Ecritures générées pour le mouvement " + this.idMvt);
|