feat: moneda y tipo de cambio del documento (debajo del Nº de referencia) y ajustes de moneda local de la empresa

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5.5 committed 2026-10-19 14:40:14 -05:00
1 parent a74c19a139
commit b85383dda1
11 files changed
+229 -9

No files matched your search

@@ -1,3 +1,4 @@
import { todayIso } from '../../core/format';
import type { GridColumn, GridDetail, GridLine } from '../../shared/grid/grid.types';
import type { ListColumn } from '../../shared/list/list.types';
import type { VhLookup } from '../../shared/value-help/value-help.types';
@@ -59,6 +60,8 @@ export type HeaderField =
| { type: 'expenses'; label: string }
/** Redondeo del documento (`Rounding` y `RoundingDiffAmount`): solo se ofrece si la empresa usa redondeo (`OADM.RoundMthd`). */
| { type: 'rounding'; label: string }
/** Moneda del documento (`DocCurrency`) y su tipo de cambio (`DocRate`): el de la fecha del documento si no es la local. */
| { type: 'currency'; label: string }
| { type: 'computed'; label: string; source: ComputedSource };
/** Las listas de valores (ventanas modales) de un formulario. */
@@ -114,7 +117,7 @@ export interface DocumentLayout {
export const SERVICE_DOC_TYPE = 'dDocument_Service';
export const ITEMS_DOC_TYPE = 'dDocument_Items';
export const today = (): string => new Date().toISOString().slice(0, 10);
export const today = (): string => todayIso();
// --- catálogo de campos ---------------------------------------------------------------------
@@ -279,6 +282,7 @@ export function marketingLayout(opts: {
{ type: 'computed', label: 'Nombre', source: 'partnerName' },
{ type: 'computed', label: 'RUT', source: 'partnerTaxId' },
FIELDS.numAtCard,
{ type: 'currency', label: 'Moneda / Tipo de cambio' },
...(opts.identity ? [] : [FIELDS.indicator]),
FIELDS.project,
...(opts.left ?? []),
@@ -341,6 +345,8 @@ export const keysOfFields = (fields: readonly HeaderField[]): string[] =>
return [];
case 'rounding':
return ['Rounding', 'RoundingDiffAmount'];
case 'currency':
return ['DocCurrency', 'DocRate'];
default:
return [f.key];
}
@@ -365,4 +371,6 @@ export const hasSeries = (layout: DocumentLayout): boolean => allFields(layout).
export const hasExpenses = (layout: DocumentLayout): boolean => allFields(layout).some((f) => f.type === 'expenses');
export const hasCurrency = (layout: DocumentLayout): boolean => allFields(layout).some((f) => f.type === 'currency');
export const hasFolio = (layout: DocumentLayout): boolean => allFields(layout).some((f) => f.type === 'folio' || (f.type === 'group' && f.cells.some((c) => c.key === 'FolioNumber')));