feature/logica-pedimento-clarion

This commit is contained in:
2026-04-27 12:01:55 -06:00
parent 2f4b9b3a4d
commit eb5df06d24
5 changed files with 106 additions and 18 deletions

View File

@@ -382,6 +382,11 @@
return 'Inicio';
}
function isFutureEffectiveDate(effectiveDate: string | null): boolean {
if (!effectiveDate) return false;
return effectiveDate > getCurrentLocalDate();
}
let lastTrigger = 0;
// Obtener automáticamente el tipo de cambio cuando cambie la fecha efectiva
@@ -414,9 +419,11 @@
console.warn('⚠️ [TIPO CAMBIO] No encontrado para fecha:', effectiveDate);
if (formData) {
formData.exchange_rate = null;
// Mostrar el diálogo automáticamente si no existe el tipo de cambio
missingExchangeRateDate = effectiveDate;
showExchangeRateDialog = true;
// Para fecha futura no forzamos captura de TC/DOF.
if (!isFutureEffectiveDate(effectiveDate)) {
missingExchangeRateDate = effectiveDate;
showExchangeRateDialog = true;
}
}
}
})
@@ -447,6 +454,7 @@
export async function checkPaymentDateRate(date: string): Promise<boolean> {
const effectiveDate = date || getEffectiveExchangeDate();
if (!effectiveDate || !companyStore.activeCompany?.id) return true;
if (isFutureEffectiveDate(effectiveDate)) return true;
try {
const rate = await getExchangeRateByDate(effectiveDate, companyStore.activeCompany.id);