fix: lignes FreePro sans structure affectées à 3069UDA (au lieu de vide)
This commit is contained in:
@@ -129,23 +129,25 @@ export function processFreeproExcel(
|
|||||||
|
|
||||||
const description = String(row.description || "");
|
const description = String(row.description || "");
|
||||||
const labelClient = String(row.label_client || "");
|
const labelClient = String(row.label_client || "");
|
||||||
const structure = row.structure ? String(row.structure) : null;
|
// Les lignes sans structure sont affectées à 3069UDA par convention
|
||||||
|
const structureRaw = row.structure ? String(row.structure).trim() : "";
|
||||||
|
const structure = structureRaw !== "" ? structureRaw : "3069UDA";
|
||||||
const totalHt = parseFloat(String(row.total || "0").replace(",", ".")) || 0;
|
const totalHt = parseFloat(String(row.total || "0").replace(",", ".")) || 0;
|
||||||
|
|
||||||
const script = getScript(description);
|
const script = getScript(description);
|
||||||
const ttc = getTtc(totalHt);
|
const ttc = getTtc(totalHt);
|
||||||
const type = getType(labelClient, script);
|
const type = getType(labelClient, script);
|
||||||
|
|
||||||
const key = `${structure ?? ""}|||${type}`;
|
const key = `${structure}|||${type}`;
|
||||||
aggregation.set(key, (aggregation.get(key) || 0) + Math.round(ttc * 100));
|
aggregation.set(key, (aggregation.get(key) || 0) + Math.round(ttc * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construire les lignes de résultat
|
// Construire les lignes de résultat
|
||||||
const lines: FreeproVentilationResult["lines"] = [];
|
const lines: FreeproVentilationResult["lines"] = [];
|
||||||
for (const [key, centimes] of Array.from(aggregation.entries())) {
|
for (const [key, centimes] of Array.from(aggregation.entries())) {
|
||||||
const [structureRaw, type] = key.split("|||");
|
const [structureVal, type] = key.split("|||");
|
||||||
lines.push({
|
lines.push({
|
||||||
structure: structureRaw === "" ? null : structureRaw,
|
structure: structureVal || null,
|
||||||
type,
|
type,
|
||||||
montant: centimes / 100,
|
montant: centimes / 100,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user