Line 179... |
Line 179... |
179 |
// SupplyChainTradeTransaction
|
179 |
// SupplyChainTradeTransaction
|
180 |
Element eSupplyChainTradeTransaction = new Element("SupplyChainTradeTransaction", RSM_NS);
|
180 |
Element eSupplyChainTradeTransaction = new Element("SupplyChainTradeTransaction", RSM_NS);
|
181 |
int lineID = 1;
|
181 |
int lineID = 1;
|
182 |
for (SQLRowAccessor rowItem : factureItems) {
|
182 |
for (SQLRowAccessor rowItem : factureItems) {
|
183 |
String productCode = rowItem.getString("CODE");
|
183 |
String productCode = rowItem.getString("CODE");
|
- |
|
184 |
String productName = rowItem.getString("NOM");
|
184 |
String productName = rowItem.getString("NOM").trim().length() == 0 ? "Ligne" : rowItem.getString("NOM");
|
185 |
if (productName == null || rowItem.getString("NOM").trim().isEmpty()) {
|
- |
|
186 |
productName = "Ligne " + lineID;
|
185 |
|
187 |
}
|
186 |
final BigDecimal pHT, pTTC, totalHTLigne, totalTTCLigne;
|
188 |
final BigDecimal pHT, pTTC, totalHTLigne, totalTTCLigne;
|
187 |
SQLRowAccessor taxeItem = rowItem.getForeign("ID_TAXE");
|
189 |
SQLRowAccessor taxeItem = rowItem.getForeign("ID_TAXE");
|
188 |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2, RoundingMode.HALF_UP);
|
190 |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2, RoundingMode.HALF_UP);
|
189 |
if (rowItem.getInt("NIVEAU") != 1) {
|
191 |
if (rowItem.getInt("NIVEAU") != 1) {
|
190 |
pHT = BigDecimal.ZERO;
|
192 |
pHT = BigDecimal.ZERO;
|
191 |
pTTC = BigDecimal.ZERO;
|
193 |
pTTC = BigDecimal.ZERO;
|
192 |
totalHTLigne = BigDecimal.ZERO;
|
194 |
totalHTLigne = BigDecimal.ZERO;
|
193 |
totalTTCLigne = BigDecimal.ZERO;
|
195 |
totalTTCLigne = BigDecimal.ZERO;
|
194 |
} else {
|
196 |
} else {
|
195 |
pHT = rowItem.getBigDecimal("PV_HT");
|
197 |
pHT = rowItem.getBigDecimal("PV_HT");
|
196 |
pTTC = pHT.multiply(taxValue.add(BigDecimal.ONE));
|
198 |
pTTC = pHT.multiply(taxValue.movePointLeft(2).add(BigDecimal.ONE));
|
197 |
totalHTLigne = rowItem.getBigDecimal("T_PV_HT");
|
199 |
totalHTLigne = rowItem.getBigDecimal("T_PV_HT");
|
198 |
totalTTCLigne = rowItem.getBigDecimal("T_PV_TTC");
|
200 |
totalTTCLigne = rowItem.getBigDecimal("T_PV_TTC");
|
199 |
}
|
201 |
}
|
200 |
|
202 |
|
201 |
int idTaxe = taxeItem.getID();
|
203 |
int idTaxe = taxeItem.getID();
|