refactor(declaraciones): renombrar SUELDOS→ISN, agregar ISH
- Cambia la opción 'SUELDOS' por 'ISN' (Impuesto Sobre Nómina) - Agrega nueva opción 'ISH' (Impuesto Sobre Hospedaje) - ISH no cierra alertas ni obligaciones (aún no hay flujo definido) - ISN mantiene keywords de sueldos/salarios/nómina + agrega 'isn' - Migración 047: actualiza declaraciones históricas SUELDOS→ISN en BD
This commit is contained in:
@@ -82,7 +82,7 @@ const createDeclaracionSchema = z.object({
|
||||
mes: z.number().int().min(1).max(12),
|
||||
tipo: z.enum(['normal', 'complementaria']),
|
||||
periodicidad: z.enum(['mensual', 'bimestral', 'trimestral', 'semestral', 'anual']).optional(),
|
||||
impuestos: z.array(z.enum(['IVA', 'ISR', 'IEPS', 'SUELDOS', 'DIOT', 'OTRO'])).min(1, 'Selecciona al menos un impuesto'),
|
||||
impuestos: z.array(z.enum(['IVA', 'ISR', 'IEPS', 'ISN', 'DIOT', 'OTRO', 'ISH'])).min(1, 'Selecciona al menos un impuesto'),
|
||||
montoPago: z.number().min(0).optional(),
|
||||
pdfBase64: z.string().min(100),
|
||||
pdfFilename: z.string().min(1).max(255),
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Migración 047: Renombrar SUELDOS → ISN en declaraciones existentes
|
||||
-- Fecha: 2026-05-24
|
||||
--
|
||||
-- El campo impuestos es TEXT[]. Se usa array_replace para actualizar
|
||||
-- declaraciones históricas que tenían 'SUELDOS' como impuesto cubierto.
|
||||
|
||||
UPDATE declaraciones_provisionales
|
||||
SET impuestos = array_replace(impuestos, 'SUELDOS', 'ISN')
|
||||
WHERE 'SUELDOS' = ANY(impuestos);
|
||||
@@ -9,7 +9,8 @@ const IMPUESTO_A_OBLIGACION_KEYWORDS: Record<string, { include: string[]; exclud
|
||||
IVA: { include: ['iva'], exclude: ['diot', 'proveedores de iva', 'informativa'] },
|
||||
ISR: { include: ['isr'], exclude: ['retenciones', 'asimilados a salarios'] },
|
||||
IEPS: { include: ['ieps'], exclude: [] },
|
||||
SUELDOS: { include: ['sueldos', 'salarios', 'nómina'], exclude: [] },
|
||||
ISN: { include: ['isn', 'sueldos', 'salarios', 'nómina'], exclude: [] },
|
||||
ISH: { include: [], exclude: [] },
|
||||
DIOT: { include: ['diot', 'proveedores de iva'], exclude: [] },
|
||||
OTRO: { include: [], exclude: [] },
|
||||
};
|
||||
@@ -93,7 +94,7 @@ async function completarObligacionesPorDeclaracion(
|
||||
* adicional, no reemplaza.
|
||||
*/
|
||||
|
||||
export type Impuesto = 'IVA' | 'ISR' | 'IEPS' | 'SUELDOS' | 'DIOT' | 'OTRO';
|
||||
export type Impuesto = 'IVA' | 'ISR' | 'IEPS' | 'ISN' | 'DIOT' | 'OTRO' | 'ISH';
|
||||
|
||||
export type Periodicidad = 'mensual' | 'bimestral' | 'trimestral' | 'semestral' | 'anual';
|
||||
|
||||
@@ -123,17 +124,19 @@ const IMPUESTO_A_PREFIJO_DECL: Record<string, string[]> = {
|
||||
IVA: ['decl-iva'],
|
||||
ISR: ['decl-isr'],
|
||||
IEPS: ['decl-ieps'],
|
||||
SUELDOS: ['decl-sueldos'],
|
||||
ISN: ['decl-isn'],
|
||||
DIOT: ['diot'],
|
||||
OTRO: [],
|
||||
ISH: [],
|
||||
};
|
||||
const IMPUESTO_A_PREFIJO_PAGO: Record<string, string[]> = {
|
||||
IVA: ['pago-iva'],
|
||||
ISR: ['pago-isr'],
|
||||
IEPS: ['pago-ieps'],
|
||||
SUELDOS: [], // sueldos solo es declaración informativa, no tiene pago provisional
|
||||
ISN: [], // ISN solo es declaración informativa, no tiene pago provisional
|
||||
DIOT: [],
|
||||
OTRO: [],
|
||||
ISH: [],
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import * as docsApi from '@/lib/api/documentos';
|
||||
|
||||
const MESES = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
|
||||
const IMPUESTOS: Impuesto[] = ['IVA', 'ISR', 'IEPS', 'SUELDOS', 'DIOT', 'OTRO'];
|
||||
const IMPUESTOS: Impuesto[] = ['IVA', 'ISR', 'IEPS', 'ISN', 'DIOT', 'OTRO', 'ISH'];
|
||||
const PERIODICIDADES: { value: Periodicidad; label: string }[] = [
|
||||
{ value: 'mensual', label: 'Mensual' },
|
||||
{ value: 'bimestral', label: 'Bimestral' },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { apiClient } from './client';
|
||||
|
||||
export type Impuesto = 'IVA' | 'ISR' | 'IEPS' | 'SUELDOS' | 'DIOT' | 'OTRO';
|
||||
export type Impuesto = 'IVA' | 'ISR' | 'IEPS' | 'ISN' | 'DIOT' | 'OTRO' | 'ISH';
|
||||
export type Periodicidad = 'mensual' | 'bimestral' | 'trimestral' | 'semestral' | 'anual';
|
||||
|
||||
export interface Declaracion {
|
||||
|
||||
Reference in New Issue
Block a user