Files
mini-erp/mini-frontend/src/config/reports.ts
T
GeorgeandClaude Sonnet 5 ab3c613165 Initial commit: mini-erp (backend FastAPI + frontend React/Vite)
Base para el flujo de ramas por cliente.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 10:34:12 -05:00

354 lines
9.0 KiB
TypeScript

import type { ReportDefinition } from "../types/reports";
import {
CARD_TYPE,
DOCUMENT_STATUS,
ITEM_TYPE,
BATCH_STATUS,
} from "../utils/enums";
export const reportsConfig: Record<string, ReportDefinition[]> = {
socios: [
{
id: "estado-cuenta",
title: "Estado de Cuenta",
description: "Estado de cuenta detallado por cliente",
icon: "📄",
endpoint: "/api/reports/socios/estado-cuenta",
outputType: "pdf",
parameters: [
{
key: "cardCode",
label: "Cliente",
type: "f4-modal",
required: true,
f4Config: {
endpoint: "BusinessPartners",
fields: ["CardCode", "CardName", "Phone1", "EmailAddress"],
columns: [
{ key: "CardCode", title: "Código", width: "100px" },
{ key: "CardName", title: "Nombre", width: "200px" },
{ key: "Phone1", title: "Teléfono", width: "120px" },
{ key: "EmailAddress", title: "Email", width: "180px" },
],
baseFilter: "CardType eq 'cCustomer'",
valueField: "CardCode",
labelField: "CardName",
selectionMode: "unica",
},
},
{
key: "fromDate",
label: "Fecha desde",
type: "date",
required: true,
},
{
key: "toDate",
label: "Fecha hasta",
type: "date",
required: true,
},
],
},
{
id: "saldos-clientes",
title: "Saldos de Clientes",
description: "Resumen de saldos pendientes por cliente",
icon: "💰",
endpoint: "/api/reports/socios/saldos",
outputType: "table+total",
parameters: [
{
key: "asOfDate",
label: "Fecha de corte",
type: "date",
required: true,
},
{
key: "cardType",
label: "Tipo de socio",
type: "enum",
defaultValue: "cCustomer",
enumSource: CARD_TYPE,
},
],
},
{
id: "clientes-por-vendedor",
title: "Clientes por Vendedor",
description: "Listado de clientes asignados por vendedor",
icon: "👥",
endpoint: "/api/reports/socios/por-vendedor",
outputType: "table",
parameters: [
{
key: "salesPerson",
label: "Vendedor",
type: "endpoint-select",
optionsEndpoint: "SalesPersons",
optionsValueField: "SlpCode",
optionsLabelField: "SlpName",
},
],
},
],
ventas: [
{
id: "ventas-por-articulo",
title: "Ventas por Artículo",
description: "Reporte de ventas agrupado por artículo",
icon: "📊",
endpoint: "/api/reports/ventas/por-articulo",
outputType: "table+total",
parameters: [
{
key: "fromDate",
label: "Fecha desde",
type: "date",
required: true,
},
{
key: "toDate",
label: "Fecha hasta",
type: "date",
required: true,
},
{
key: "docStatus",
label: "Estado",
type: "enum",
enumSource: DOCUMENT_STATUS,
},
{
key: "itemType",
label: "Tipo de artículo",
type: "enum",
enumSource: ITEM_TYPE,
},
],
},
{
id: "facturas-pendientes",
title: "Facturas Pendientes",
description: "Facturas de venta pendientes de cobro",
icon: "📋",
endpoint: "/api/reports/ventas/facturas-pendientes",
outputType: "table+total",
parameters: [
{
key: "asOfDate",
label: "Fecha de corte",
type: "date",
required: true,
},
],
},
{
id: "ordenes-venta",
title: "Órdenes de Venta",
description: "Reporte de órdenes de venta por período",
icon: "🛒",
endpoint: "/api/reports/ventas/ordenes",
outputType: "table",
parameters: [
{
key: "fromDate",
label: "Fecha desde",
type: "date",
required: true,
},
{
key: "toDate",
label: "Fecha hasta",
type: "date",
required: true,
},
{
key: "cardCode",
label: "Cliente",
type: "f4-modal",
f4Config: {
endpoint: "BusinessPartners",
fields: ["CardCode", "CardName"],
columns: [
{ key: "CardCode", title: "Código", width: "100px" },
{ key: "CardName", title: "Nombre", width: "200px" },
],
baseFilter: "CardType eq 'cCustomer'",
valueField: "CardCode",
labelField: "CardName",
selectionMode: "unica",
},
},
],
},
],
compras: [
{
id: "compras-por-proveedor",
title: "Compras por Proveedor",
description: "Reporte de compras agrupado por proveedor",
icon: "📊",
endpoint: "/api/reports/compras/por-proveedor",
outputType: "table+total",
parameters: [
{
key: "fromDate",
label: "Fecha desde",
type: "date",
required: true,
},
{
key: "toDate",
label: "Fecha hasta",
type: "date",
required: true,
},
{
key: "cardCode",
label: "Proveedor",
type: "f4-modal",
f4Config: {
endpoint: "BusinessPartners",
fields: ["CardCode", "CardName"],
columns: [
{ key: "CardCode", title: "Código", width: "100px" },
{ key: "CardName", title: "Nombre", width: "200px" },
],
baseFilter: "CardType eq 'cSupplier'",
valueField: "CardCode",
labelField: "CardName",
selectionMode: "unica",
},
},
],
},
{
id: "facturas-pendientes-compra",
title: "Facturas Pendientes",
description: "Facturas de compra pendientes de pago",
icon: "📋",
endpoint: "/api/reports/compras/facturas-pendientes",
outputType: "table+total",
parameters: [
{
key: "asOfDate",
label: "Fecha de corte",
type: "date",
required: true,
},
{
key: "docStatus",
label: "Estado",
type: "enum",
enumSource: DOCUMENT_STATUS,
},
],
},
],
inventario: [
{
id: "kardex",
title: "Kardex de Artículos",
description: "Movimiento de artículos por período",
icon: "📦",
endpoint: "/api/reports/inventario/kardex",
outputType: "table",
parameters: [
{
key: "fromDate",
label: "Fecha desde",
type: "date",
required: true,
},
{
key: "toDate",
label: "Fecha hasta",
type: "date",
required: true,
},
{
key: "itemCode",
label: "Artículo",
type: "f4-modal",
f4Config: {
endpoint: "Items",
fields: ["ItemCode", "ItemName"],
columns: [
{ key: "ItemCode", title: "Código", width: "120px" },
{ key: "ItemName", title: "Nombre", width: "250px" },
],
valueField: "ItemCode",
labelField: "ItemName",
selectionMode: "unica",
},
},
],
},
{
id: "inventario-valorizado",
title: "Inventario Valorizado",
description: "Stock valorizado al costo",
icon: "💰",
endpoint: "/api/reports/inventario/valorizado",
outputType: "table+total",
parameters: [
{
key: "asOfDate",
label: "Fecha de corte",
type: "date",
required: true,
},
{
key: "warehouse",
label: "Almacén",
type: "endpoint-select",
optionsEndpoint: "Warehouses",
optionsValueField: "WarehouseCode",
optionsLabelField: "WarehouseName",
},
],
},
{
id: "lotes-por-vencer",
title: "Lotes por Vencer",
description: "Lotes próximos a vencer",
icon: "⏰",
endpoint: "/api/reports/inventario/lotes-por-vencer",
outputType: "table",
parameters: [
{
key: "dias",
label: "Próximos días",
type: "number",
defaultValue: "30",
placeholder: "30",
},
{
key: "batchStatus",
label: "Estado de lote",
type: "enum",
enumSource: BATCH_STATUS,
},
],
},
],
};
export const moduleLabels: Record<string, string> = {
socios: "Socios de Negocios",
ventas: "Ventas",
compras: "Compras",
inventario: "Inventario",
};
export const moduleIcons: Record<string, string> = {
socios: "👥",
ventas: "🛒",
compras: "💼",
inventario: "📦",
};