Checkpoint: Module Ventilation FreePro complet : import Excel FreePro, transformation automatique (script/TTC/type XOAUTH2), tableau de ventilation par structure+type, historique par mois, export PDF. Menu Ventilations ajouté dans la navigation.

This commit is contained in:
Manus
2026-06-05 08:02:29 -04:00
parent 4ef130f21d
commit 7f56fa7045
13 changed files with 3123 additions and 3 deletions

View File

@@ -421,3 +421,46 @@ export const invoiceLearnings = mysqlTable("invoiceLearnings", {
export type InvoiceLearning = typeof invoiceLearnings.$inferSelect;
export type InsertInvoiceLearning = typeof invoiceLearnings.$inferInsert;
/**
* FreePro ventilation imports — one record per imported monthly file
*/
export const freeproImports = mysqlTable("freeproImports", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
/** Label du mois, ex: "06/2025" */
moisLabel: varchar("moisLabel", { length: 10 }).notNull(),
/** Année (ex: 2025) */
annee: int("annee").notNull(),
/** Mois numérique (1-12) */
mois: int("mois").notNull(),
/** Référence de la pièce comptable, ex: F202506006010 */
refPiece: varchar("refPiece", { length: 50 }),
/** Nom du fichier Excel importé */
fileName: varchar("fileName", { length: 255 }).notNull(),
/** Nombre de lignes traitées */
nbLignes: int("nbLignes").default(0).notNull(),
/** Total général TTC calculé */
totalTtc: varchar("totalTtc", { length: 30 }),
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
});
export type FreeproImport = typeof freeproImports.$inferSelect;
export type InsertFreeproImport = typeof freeproImports.$inferInsert;
/**
* FreePro ventilation lines — aggregated result (structure + type → montant TTC)
*/
export const freeproVentilationLines = mysqlTable("freeproVentilationLines", {
id: int("id").autoincrement().primaryKey(),
importId: int("importId").notNull(), // FK to freeproImports.id
/** Code structure, ex: "1083ADV" ou null pour (vide) */
structure: varchar("structure", { length: 100 }),
/** Type: "Lien fibre" | "Lien 5G" | "Tél. mobile" */
type: varchar("type", { length: 50 }).notNull(),
/** Montant TTC agrégé en centimes (pour éviter les flottants) */
montantCentimes: int("montantCentimes").notNull(),
createdAt: timestamp("createdAt").defaultNow().notNull(),
});
export type FreeproVentilationLine = typeof freeproVentilationLines.$inferSelect;
export type InsertFreeproVentilationLine = typeof freeproVentilationLines.$inferInsert;