feature/logica-pedimento-clarion
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user