Checkpoint: Améliorations Factures BAP : suppression colonne Abonnement, mode d'export configurable (navigateur/dossier), génération PDF annoté avec zone blanche (CAPEX/OPEX | BAP | Destinataire + signature du service) lors du clic BAP, historique BAP dans le menu Traçabilité, table bapHistory en DB.

This commit is contained in:
Manus
2026-04-12 05:57:02 -04:00
parent edf7cc704d
commit 5f7c8c7c7f
12 changed files with 2261 additions and 39 deletions

View File

@@ -178,6 +178,7 @@ export const importSettings = mysqlTable("importSettings", {
// Export folder settings
exportFolder: text("exportFolder"), // Path to folder for exporting invoices
bapExportMode: mysqlEnum("bapExportMode", ["browser", "folder"]).default("browser").notNull(), // BAP export mode: open in browser or save to folder
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
@@ -347,3 +348,27 @@ export const serviceSignatures = mysqlTable("serviceSignatures", {
export type ServiceSignature = typeof serviceSignatures.$inferSelect;
export type InsertServiceSignature = typeof serviceSignatures.$inferInsert;
/**
* BAP History table - records every BAP validation with PDF export details
*/
export const bapHistory = mysqlTable("bapHistory", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
invoiceId: int("invoiceId").notNull(),
supplierName: varchar("supplierName", { length: 255 }),
invoiceNumber: varchar("invoiceNumber", { length: 100 }),
invoiceDate: timestamp("invoiceDate"),
totalAmount: varchar("totalAmount", { length: 50 }),
typeAchat: varchar("typeAchat", { length: 50 }), // CAPEX / OPEX
serviceConcerne: varchar("serviceConcerne", { length: 100 }),
ventilationComptable: varchar("ventilationComptable", { length: 100 }),
recipientName: varchar("recipientName", { length: 255 }),
exportMode: mysqlEnum("exportMode", ["browser", "folder"]).default("browser").notNull(),
exportPath: text("exportPath"), // null for browser mode
pdfUrl: text("pdfUrl"), // S3 URL for browser mode
signatureName: varchar("signatureName", { length: 255 }), // Signer name if applied
validatedAt: timestamp("validatedAt").defaultNow().notNull(),
});
export type BapHistory = typeof bapHistory.$inferSelect;
export type InsertBapHistory = typeof bapHistory.$inferInsert;