2026-10-16 10:24:39 -05:00
|
|
|
import type { ListColumn } from '../../shared/list/list.types';
|
|
|
|
|
import type { VhLookup } from '../../shared/value-help/value-help.types';
|
2026-10-16 12:26:49 -05:00
|
|
|
import { ACCOUNT_LOOKUP } from '../documents/dimension-lookups';
|
2026-10-16 10:24:39 -05:00
|
|
|
|
|
|
|
|
const col = (key: string, title: string, extra: Partial<ListColumn> = {}): ListColumn => ({ key, title, ...extra });
|
|
|
|
|
|
|
|
|
|
/** Ventanas de selección de los campos de código de los maestros. */
|
|
|
|
|
export const MASTER_LOOKUPS = {
|
|
|
|
|
/** Grupo de clientes o de proveedores. */
|
|
|
|
|
partnerGroup: (type: 'cCustomer' | 'cSupplier'): VhLookup => ({
|
|
|
|
|
title: type === 'cSupplier' ? 'Grupos de proveedores' : 'Grupos de clientes',
|
|
|
|
|
resource: 'BusinessPartnerGroups',
|
|
|
|
|
orderby: 'Code',
|
|
|
|
|
baseFilter: `Type eq '${type === 'cSupplier' ? 'bbpgt_VendorGroup' : 'bbpgt_CustomerGroup'}'`,
|
|
|
|
|
valueType: 'number',
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'Name',
|
2026-10-16 10:24:39 -05:00
|
|
|
columns: [col('Code', 'Código', { width: '90px', mono: true }), col('Name', 'Nombre')],
|
|
|
|
|
}),
|
|
|
|
|
currency: {
|
|
|
|
|
title: 'Monedas',
|
|
|
|
|
resource: 'Currencies',
|
|
|
|
|
orderby: 'Code',
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'Name',
|
2026-10-16 10:24:39 -05:00
|
|
|
columns: [col('Code', 'Código', { width: '90px', mono: true }), col('Name', 'Nombre')],
|
|
|
|
|
} satisfies VhLookup,
|
|
|
|
|
paymentTerms: {
|
|
|
|
|
title: 'Condiciones de pago',
|
|
|
|
|
resource: 'PaymentTermsTypes',
|
|
|
|
|
orderby: 'GroupNumber',
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'PaymentTermsGroupName',
|
2026-10-16 10:24:39 -05:00
|
|
|
valueType: 'number',
|
|
|
|
|
columns: [col('GroupNumber', 'Código', { width: '90px', mono: true }), col('PaymentTermsGroupName', 'Nombre')],
|
|
|
|
|
} satisfies VhLookup,
|
|
|
|
|
priceList: {
|
|
|
|
|
title: 'Listas de precios',
|
|
|
|
|
resource: 'PriceLists',
|
|
|
|
|
orderby: 'PriceListNo',
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'PriceListName',
|
2026-10-16 10:24:39 -05:00
|
|
|
valueType: 'number',
|
|
|
|
|
columns: [col('PriceListNo', 'Código', { width: '90px', mono: true }), col('PriceListName', 'Nombre')],
|
|
|
|
|
} satisfies VhLookup,
|
2026-10-16 12:26:49 -05:00
|
|
|
salesPerson: {
|
|
|
|
|
title: 'Empleados de ventas',
|
|
|
|
|
resource: 'SalesPersons',
|
|
|
|
|
orderby: 'SalesEmployeeCode',
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'SalesEmployeeName',
|
2026-10-16 12:26:49 -05:00
|
|
|
valueType: 'number',
|
|
|
|
|
baseFilter: `Active eq 'tYES'`,
|
|
|
|
|
columns: [col('SalesEmployeeCode', 'Código', { width: '90px', mono: true }), col('SalesEmployeeName', 'Nombre')],
|
|
|
|
|
} satisfies VhLookup,
|
|
|
|
|
/** Cuenta contable del socio de negocio (cuentas por cobrar o por pagar). */
|
|
|
|
|
account: ACCOUNT_LOOKUP,
|
|
|
|
|
/** Proveedor principal de un artículo. */
|
|
|
|
|
supplier: {
|
|
|
|
|
title: 'Proveedores',
|
|
|
|
|
resource: 'BusinessPartners',
|
|
|
|
|
orderby: 'CardCode',
|
|
|
|
|
baseFilter: `CardType eq 'cSupplier'`,
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'CardName',
|
2026-10-16 12:26:49 -05:00
|
|
|
columns: [col('CardCode', 'Código', { width: '130px', mono: true }), col('CardName', 'Nombre')],
|
|
|
|
|
} satisfies VhLookup,
|
2026-10-16 10:24:39 -05:00
|
|
|
itemGroup: {
|
|
|
|
|
title: 'Grupos de artículos',
|
|
|
|
|
resource: 'ItemGroups',
|
|
|
|
|
orderby: 'Number',
|
2026-10-19 18:52:08 -05:00
|
|
|
nameKey: 'GroupName',
|
2026-10-16 10:24:39 -05:00
|
|
|
valueType: 'number',
|
|
|
|
|
columns: [col('Number', 'Código', { width: '90px', mono: true }), col('GroupName', 'Nombre')],
|
|
|
|
|
} satisfies VhLookup,
|
|
|
|
|
} as const;
|