feat(web): folio, referencia y RUT en las listas de facturas de venta y de proveedor
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
43cba0cc3e
commit
49408de082
2 files changed
+49
-3
No files matched your search
@@ -80,3 +80,25 @@ describe('documentTotal', () => {
|
||||
expect(documentTotal({ DocCurrency: 'CLP' })).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('columnas de las facturas', () => {
|
||||
const by = (r: string) => DOCUMENT_SCREENS.find((s) => s.resource === r)!;
|
||||
|
||||
it('las facturas de venta y de proveedor muestran folio, referencia y RUT con los nombres del Service Layer', () => {
|
||||
for (const r of ['Invoices', 'PurchaseInvoices']) {
|
||||
const keys = by(r).columns.map((c) => c.key);
|
||||
expect(keys).toEqual(expect.arrayContaining(['FolioPrefixString', 'FolioNumber', 'NumAtCard', 'FederalTaxID']));
|
||||
}
|
||||
});
|
||||
|
||||
it('los demás documentos de ventas y compras no las llevan', () => {
|
||||
for (const r of ['Orders', 'DeliveryNotes', 'CreditNotes', 'PurchaseOrders', 'PurchaseCreditNotes']) {
|
||||
expect(by(r).columns.map((c) => c.key)).not.toContain('FolioNumber');
|
||||
}
|
||||
});
|
||||
|
||||
it('el número de folio se ve sin separador de miles', () => {
|
||||
const col = by('PurchaseInvoices').columns.find((c) => c.key === 'FolioNumber')!;
|
||||
expect(col.format!({ FolioNumber: 198837 })).toBe('198837');
|
||||
});
|
||||
});
|
||||
@@ -69,6 +69,23 @@ export const docNum: ListColumn = {
|
||||
searchable: true,
|
||||
format: (r) => String(r['DocNum'] ?? ''),
|
||||
};
|
||||
/** Facturas: folio tributario (en el Service Layer `FolioPrefixString` y `FolioNumber`), referencia y RUT. */
|
||||
const invoiceColumns: readonly ListColumn[] = [
|
||||
{ key: 'FolioPrefixString', title: 'Folio pref.', width: '90px', mono: true, searchable: true },
|
||||
{
|
||||
key: 'FolioNumber',
|
||||
title: 'Folio núm.',
|
||||
type: 'number',
|
||||
align: 'left',
|
||||
width: '110px',
|
||||
mono: true,
|
||||
searchable: true,
|
||||
format: (r) => String(r['FolioNumber'] ?? ''),
|
||||
},
|
||||
{ key: 'NumAtCard', title: 'Nº referencia', width: '130px', searchable: true },
|
||||
{ key: 'FederalTaxID', title: 'RUT', width: '110px', mono: true, searchable: true },
|
||||
];
|
||||
|
||||
const docDate: ListColumn = { key: 'DocDate', title: 'Fecha contab.', type: 'date', align: 'center', width: '115px' };
|
||||
|
||||
const statusFilter: ListFilter = {
|
||||
@@ -92,7 +109,13 @@ const currencyFilter: ListFilter = {
|
||||
};
|
||||
|
||||
/** Ventas y compras: documentos con socio de negocio y total. */
|
||||
const marketing = (path: string, resource: string, createLabel: string, partner: string): DocumentScreen => ({
|
||||
const marketing = (
|
||||
path: string,
|
||||
resource: string,
|
||||
createLabel: string,
|
||||
partner: string,
|
||||
extraColumns: readonly ListColumn[] = [],
|
||||
): DocumentScreen => ({
|
||||
path,
|
||||
resource,
|
||||
createLabel,
|
||||
@@ -104,6 +127,7 @@ const marketing = (path: string, resource: string, createLabel: string, partner:
|
||||
columns: [
|
||||
docNum,
|
||||
statusColumn,
|
||||
...extraColumns,
|
||||
{ key: 'CardCode', title: partner, width: '130px', mono: true, searchable: true },
|
||||
{ key: 'CardName', title: 'Nombre' },
|
||||
docDate,
|
||||
@@ -146,7 +170,7 @@ export const DOCUMENT_SCREENS: readonly DocumentScreen[] = [
|
||||
marketing('/ventas/ofertas', 'Quotations', 'Nueva oferta', 'Cliente'),
|
||||
marketing('/ventas/ordenes', 'Orders', 'Nueva orden', 'Cliente'),
|
||||
marketing('/ventas/entrega', 'DeliveryNotes', 'Nueva entrega', 'Cliente'),
|
||||
marketing('/ventas/facturas', 'Invoices', 'Nueva factura', 'Cliente'),
|
||||
marketing('/ventas/facturas', 'Invoices', 'Nueva factura', 'Cliente', invoiceColumns),
|
||||
marketing('/ventas/devoluciones', 'Returns', 'Nueva devolución', 'Cliente'),
|
||||
marketing('/ventas/notas-credito', 'CreditNotes', 'Nueva nota de crédito', 'Cliente'),
|
||||
// Compras
|
||||
@@ -169,7 +193,7 @@ export const DOCUMENT_SCREENS: readonly DocumentScreen[] = [
|
||||
marketing('/compras/ofertas', 'PurchaseQuotations', 'Nueva oferta', 'Proveedor'),
|
||||
marketing('/compras/ordenes', 'PurchaseOrders', 'Nueva orden', 'Proveedor'),
|
||||
marketing('/compras/recepcion', 'PurchaseDeliveryNotes', 'Nueva recepción', 'Proveedor'),
|
||||
marketing('/compras/facturas', 'PurchaseInvoices', 'Nueva factura', 'Proveedor'),
|
||||
marketing('/compras/facturas', 'PurchaseInvoices', 'Nueva factura', 'Proveedor', invoiceColumns),
|
||||
marketing('/compras/devoluciones', 'PurchaseReturns', 'Nueva devolución', 'Proveedor'),
|
||||
marketing('/compras/notas-credito', 'PurchaseCreditNotes', 'Nueva nota de crédito', 'Proveedor'),
|
||||
// Inventario
|
||||
|
||||
Reference in new issue
Block a user