feat(sat): factura global + fecha_efectiva, fallback tenant-contribuyente, fix anio_global typo
Factura Global & fecha_efectiva: - Migracion 045_factura_global.sql: periodicidad, meses_global, año_global, fecha_efectiva - sat-parser.service.ts: extrae InformacionGlobal del XML - sat.service.ts: calcFechaEfectiva con soporte bimestral (periodicidad 05) - metricas-compute, dashboard, impuestos, cfdi, export, conciliacion, alertas: reemplaza fecha_emision-1h por COALESCE(fecha_efectiva, fecha_emision-1h) - Script recalc-metricas.ts para recalculo manual Fallback datos fiscales tenant → contribuyente: - contribuyente.service.ts: fetchTenantFiscalData + mergeContribuyenteWithTenant rellena regimenFiscal, codigoPostal y domicilio cuando el contribuyente tiene el mismo RFC que el tenant y sus campos estan vacios - contribuyente.controller.ts y contribuyente-config.controller.ts: pasan req.user!.tenantId al servicio Fix critico SAT sync: - sat.service.ts: anio_global → año_global en INSERT/UPDATE de CFDIs (la migracion creo 'año_global' con tilde; el codigo usaba 'anio_global', causando fallo en 100% de inserciones de CFDI) - determineChunkMonths: salta sondeo si existe job previo con requestIds - MAX_POLL_ATTEMPTS: 45 → 500 (~8h) para syncs iniciales grandes Docs: - docs/sessions/2026-05-22-factura-global-contribuyente-fallback.md
This commit is contained in:
@@ -24,21 +24,27 @@ const formatCurrency = (value: number) =>
|
||||
currency: 'MXN',
|
||||
}).format(value);
|
||||
|
||||
const formatDate = (dateString: string) =>
|
||||
new Date(dateString).toLocaleDateString('es-MX', {
|
||||
const formatDate = (dateString: string) => {
|
||||
const d = new Date(dateString);
|
||||
d.setHours(d.getHours() - 1);
|
||||
return d.toLocaleDateString('es-MX', {
|
||||
day: '2-digit',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
});
|
||||
};
|
||||
|
||||
const formatDateTime = (dateString: string) =>
|
||||
new Date(dateString).toLocaleString('es-MX', {
|
||||
const formatDateTime = (dateString: string) => {
|
||||
const d = new Date(dateString);
|
||||
d.setHours(d.getHours() - 1);
|
||||
return d.toLocaleString('es-MX', {
|
||||
day: '2-digit',
|
||||
month: 'short',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
};
|
||||
|
||||
const typeLabels: Record<string, string> = {
|
||||
EMITIDO: 'Emitido',
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
Wallet, Calendar, AlertTriangle, CheckCircle2, Trash2, RotateCcw,
|
||||
Building2, TrendingUp, Clock, CircleSlash, Filter,
|
||||
} from 'lucide-react';
|
||||
import { formatCurrency } from '@/lib/utils';
|
||||
import { formatCurrency, toCfdiDate } from '@/lib/utils';
|
||||
|
||||
interface ActivoFijoItem {
|
||||
cfdiId: number;
|
||||
@@ -238,7 +238,7 @@ export function ActivosFijosTab({ año, mes }: { año: number; mes: number }) {
|
||||
return (
|
||||
<tr key={a.cfdiId} className="border-b hover:bg-muted/30">
|
||||
<td className="px-3 py-2 whitespace-nowrap">
|
||||
{new Date(a.fechaEmision).toLocaleDateString('es-MX', { day: 'numeric', month: 'short', year: 'numeric' })}
|
||||
{toCfdiDate(a.fechaEmision).toLocaleDateString('es-MX', { day: 'numeric', month: 'short', year: 'numeric' })}
|
||||
</td>
|
||||
<td className="px-3 py-2">
|
||||
<div className="font-mono text-xs">{a.rfcEmisor}</div>
|
||||
|
||||
Reference in New Issue
Block a user