mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Update invoice reconciliation to fix display issues
Introduce detailed logging and data type conversions in invoice verification service and client-side reconciliation page to address discrepancies in displayed invoice amounts and due dates. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 41ed310d-8033-46c7-bb26-e56560b56490 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/gTQvEeF
This commit is contained in:
1 parent
fc6661551a
commit
c669c4eba9
3 files changed
+33
-2
No files matched your search
@@ -156,25 +156,46 @@ export default function BLReconciliation() {
|
||||
|
||||
// Auto-remplissage si facture trouvée (référence facture OU numéro BL)
|
||||
if (result.exists) {
|
||||
console.log('🔍 DEBUG - Résultat complet de vérification:', {
|
||||
deliveryId: variables.deliveryId,
|
||||
exists: result.exists,
|
||||
matchType: result.matchType,
|
||||
invoiceReference: result.invoiceReference,
|
||||
invoiceAmount: result.invoiceAmount,
|
||||
dueDate: result.dueDate,
|
||||
hasInvoiceRef: !!result.invoiceReference,
|
||||
hasAmount: result.invoiceAmount !== undefined && result.invoiceAmount !== null,
|
||||
hasDueDate: !!result.dueDate
|
||||
});
|
||||
|
||||
// Auto-remplir les champs dans la livraison via API
|
||||
const updateData: any = {};
|
||||
|
||||
// Ajouter la référence de facture SEULEMENT si trouvée via BL (pas déjà renseignée)
|
||||
if (result.invoiceReference && result.matchType === 'bl_number') {
|
||||
updateData.invoiceReference = result.invoiceReference;
|
||||
console.log('✅ Ajout invoiceReference:', result.invoiceReference);
|
||||
} else {
|
||||
console.log('⚠️ Pas d\'ajout invoiceReference:', { hasRef: !!result.invoiceReference, matchType: result.matchType });
|
||||
}
|
||||
|
||||
// TOUJOURS mettre à jour le montant si disponible (peu importe le matchType)
|
||||
if (result.invoiceAmount !== undefined && result.invoiceAmount !== null) {
|
||||
updateData.invoiceAmount = result.invoiceAmount;
|
||||
console.log('✅ Ajout invoiceAmount:', result.invoiceAmount);
|
||||
} else {
|
||||
console.log('⚠️ Pas d\'ajout invoiceAmount:', { amount: result.invoiceAmount });
|
||||
}
|
||||
|
||||
// TOUJOURS mettre à jour la date d'échéance si disponible (peu importe le matchType)
|
||||
if (result.dueDate) {
|
||||
updateData.dueDate = result.dueDate;
|
||||
console.log('✅ Ajout dueDate:', result.dueDate);
|
||||
} else {
|
||||
console.log('⚠️ Pas d\'ajout dueDate:', { dueDate: result.dueDate });
|
||||
}
|
||||
|
||||
console.log('📝 Données à sauvegarder:', { deliveryId: variables.deliveryId, updateData, matchType: result.matchType });
|
||||
console.log('📝 Données finales à sauvegarder:', { deliveryId: variables.deliveryId, updateData, matchType: result.matchType });
|
||||
|
||||
// Ne faire l'appel que si on a des données à mettre à jour
|
||||
if (Object.keys(updateData).length > 0) {
|
||||
|
||||
Reference in new issue
Block a user