@fayz-ai/plugin-fiscal-br 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/InboundNotesPage-UQH2YG3E.js +6 -0
- package/dist/{InboundNotesPage-R72EC5E4.js.map → InboundNotesPage-UQH2YG3E.js.map} +1 -1
- package/dist/NoteReceiptCard-H5BMFPU7.js +4 -0
- package/dist/{NoteReconcileView-3KVXZLCG.js.map → NoteReceiptCard-H5BMFPU7.js.map} +1 -1
- package/dist/NoteReconcileView-QSRL6NKQ.js +5 -0
- package/dist/NoteReconcileView-QSRL6NKQ.js.map +1 -0
- package/dist/chunk-3BDFMEYY.js +231 -0
- package/dist/chunk-3BDFMEYY.js.map +1 -0
- package/dist/chunk-DHCCZXUM.js +50 -0
- package/dist/chunk-DHCCZXUM.js.map +1 -0
- package/dist/{chunk-OGXYHL3Z.js → chunk-LHH2YIDB.js} +30 -15
- package/dist/chunk-LHH2YIDB.js.map +1 -0
- package/dist/{chunk-UYGGBJCR.js → chunk-TZH7AWBD.js} +187 -54
- package/dist/chunk-TZH7AWBD.js.map +1 -0
- package/dist/data/inbox.d.ts +5 -1
- package/dist/data/inbox.d.ts.map +1 -1
- package/dist/data/receipt.d.ts +45 -0
- package/dist/data/receipt.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/receipt.d.ts +39 -0
- package/dist/lib/receipt.d.ts.map +1 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/index.d.ts +2 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/pt-BR.d.ts +2 -0
- package/dist/locales/pt-BR.d.ts.map +1 -0
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +2 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +524 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/views/InboundNotesView.d.ts.map +1 -1
- package/dist/views/NoteReceiptCard.d.ts +4 -0
- package/dist/views/NoteReceiptCard.d.ts.map +1 -0
- package/dist/views/NoteReconcileView.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/InboundNotesPage-R72EC5E4.js +0 -5
- package/dist/NoteReconcileView-3KVXZLCG.js +0 -4
- package/dist/chunk-OGXYHL3Z.js.map +0 -1
- package/dist/chunk-UYGGBJCR.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/views/InboundNotesView.tsx","../src/views/InboundNotesPage.tsx"],"names":["useState","useCallback","useEffect","jsxs","jsx"],"mappings":";;;;;;;;AA0BA,IAAM,QAAQ,CAAC,KAAA,KAAkB,cAAA,CAAe,KAAA,IAAS,GAAG,KAAK,CAAA;AAEjE,IAAM,MAAM,CAAC,GAAA,KAAwB,GAAA,GAAM,GAAA,CAAI,MAAM,CAAA,EAAG,EAAE,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,OAAA,EAAQ,CAAE,IAAA,CAAK,GAAG,CAAA,GAAI,QAAA;AAE7F,IAAM,IAAA,GAAO,CAAC,MAAA,KAA0B;AACtC,EAAA,MAAM,CAAA,GAAA,CAAK,MAAA,IAAU,EAAA,EAAI,OAAA,CAAQ,OAAO,EAAE,CAAA;AAC1C,EAAA,IAAI,CAAA,CAAE,MAAA,KAAW,EAAA,EAAI,OAAO,MAAA,IAAU,QAAA;AACtC,EAAA,OAAO,CAAA,EAAG,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAC,CAAA,CAAA,EAAI,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CAAC,CAAA,CAAA,EAAI,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAC,CA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EAAM,IAAA,EAAM,KAAK,IAAA,KAAS,MAAA,EAAQ,YAAA,EAAc,CAAC,IAAA,KAAS;AAAE,MAAA,IAAI,CAAC,MAAM,UAAA,EAAW;AAAA,IAAE,CAAA,EAClF,eAAK,IAAA,KAAS,MAAA;AAAA;AAAA;AAAA,oBAIbA,IAAC,YAAA,EAAA,EAAa,IAAA,EAAK,OAAM,SAAA,EAAS,IAAA,EAAC,SAAA,EAAU,iBAAA,EAC3C,QAAA,kBAAAA,GAAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,MAAA,EAAO,OAAA;AAAA,QACP,QAAQ,IAAA,CAAK,EAAA;AAAA,QACb,MAAA,EAAQ,UAAA;AAAA,QACR,aAAA,EAAe,YAAA,GACX,CAAC,SAAA,KAAc;AAAE,UAAA,WAAA,CAAY,YAAA,CAAa,SAAS,CAAC,CAAA;AAAA,QAAE,CAAA,GACtD;AAAA;AAAA,OAER,CAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;AAOO,SAAS,qBAAA,CAAsB,OAAA,GAAiC,EAAC,EAA6B;AACnG,EAAA,OAAO,SAAS,iBAAA,GAAoB;AAClC,IAAA,uBAAOA,GAAAA,CAAC,gBAAA,EAAA,EAAkB,GAAG,OAAA,EAAS,CAAA;AAAA,EACxC,CAAA;AACF","file":"chunk-LHH2YIDB.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Manifesto de Notas — a lista das notas de compra, e a área onde o XML entra.\n// ---------------------------------------------------------------------------\n// Duas colunas de estado, e a diferença entre elas é o coração da tela:\n//\n// Conciliação quantos itens já sabem a que produto correspondem — 0/1, 1/1, 0/6\n// Estoque se a entrada aconteceu — Pendente / Estocado\n//\n// No V1 havia 55 notas conciliadas e nunca estocadas. Uma coluna de \"status\" só\n// teria escondido as 55, e a pergunta \"por que o estoque não mudou?\" não teria\n// resposta na tela.\n// ---------------------------------------------------------------------------\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { Eye, FileCode2, FileDown, FileText, Inbox, KeyRound, ListChecks, Loader2, RefreshCw, Trash2, UploadCloud } from 'lucide-react'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport {\n Button, Card, ChevronPager, DataTable, FilterPanel, FilterPanelField, PageHeaderActions, SearchField,\n RowActions, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Tooltip, TooltipContent,\n TooltipProvider, TooltipTrigger, useFilterDraft,\n} from '@fayz-ai/ui'\nimport { PageActions, adminNavigateTo, useUnitFilter } from '@fayz-ai/admin'\nimport { formatCurrency, useTranslation } from '@fayz-ai/core'\nimport { getInboxIntakeHealth, getInboxNotePdf, getInboxNoteXml, listInboxNotes, stageNoteFromXml, rejectNote, syncNewNotes, type InboxIntakeHealth } from '../data/inbox'\nimport type { InboxNote, InboxStatusFilter } from '../types'\nimport { PullByKeyDialog } from './PullByKeyDialog'\n\nconst money = (value: number) => formatCurrency(value || 0, 'BRL')\n\nconst day = (iso: string | null) => (iso ? iso.slice(0, 10).split('-').reverse().join('/') : '—')\n\nconst cnpj = (digits: string | null) => {\n const d = (digits ?? '').replace(/\\D/g, '')\n if (d.length !== 14) return digits ?? '—'\n return `${d.slice(0, 2)}.${d.slice(2, 5)}.${d.slice(5, 8)}/${d.slice(8, 12)}-${d.slice(12)}`\n}\n\n// Same box as SelectTrigger: the date filters sit beside it and must read as one row.\nconst CAMPO = 'h-9 w-full rounded-input border border-input bg-background px-3 text-sm shadow-sm focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'\n\n/** O recorte, como ele vai para a consulta. */\ninterface Recorte {\n filter: InboxStatusFilter\n unitId: string\n from: string\n to: string\n}\n\nconst STATE_OPTIONS: Array<{ value: InboxStatusFilter; label: string }> = [\n { value: 'all', label: 'Todos' },\n { value: 'pending', label: 'Estoque pendente' },\n { value: 'stocked', label: 'Estocado' },\n { value: 'manifest_error', label: 'Manifestação com erro' },\n { value: 'rejected', label: 'Recusada' },\n]\n\nconst isoDay = (d: Date) => d.toISOString().slice(0, 10)\nconst SYNC_KEY = 'fiscalbr.inbox.lastSefazSync'\n\n/** O resultado de arrastar um lote: o que entrou, o que o de-para já resolveu, o que recusou. */\ninterface DropReport {\n ok: Array<{ file: string; number: string; items: number; matched: number; repeated: boolean }>\n failed: Array<{ file: string; message: string }>\n}\n\nexport interface InboundNotesViewProps {\n /** Abre a conciliação da nota. A rota é do host — esta tela não sabe navegar. */\n onOpenNote: (noteId: string) => void\n}\n\nexport function InboundNotesView({ onOpenNote }: InboundNotesViewProps) {\n const [notes, setNotes] = useState<InboxNote[]>([])\n const [loading, setLoading] = useState(true)\n const [search, setSearch] = useState('')\n const [busy, setBusy] = useState(false)\n const [report, setReport] = useState<DropReport | null>(null)\n const [dragging, setDragging] = useState(false)\n const [pullOpen, setPullOpen] = useState(false)\n const fileInput = useRef<HTMLInputElement>(null)\n\n // A unidade é o ALCANCE de quem olha: a lista abre na unidade em que a pessoa\n // está e só oferece as que ela alcança.\n const unidades = useUnitFilter({ scope: 'list' })\n\n // ── Draft and applied ───────────────────────────────────────────────────\n // The same slice engine as the bank reconciliation (FilterPanel): fields\n // write to a draft that applies itself after a pause, so moving unit, state\n // and both ends of the period is one query, not four. The slice is\n // remembered per tenant — except the unit, which is the person's REACH and\n // always opens on the unit the shell is in.\n const { draft, applied, patch, setDraft, apply, reset } = useFilterDraft<Recorte>({\n filter: 'all',\n unitId: unidades.value ?? '',\n // No period by default: V1 opens on «Todos os registros», and a 30-day\n // window would hide exactly the old note that was never stocked.\n from: '',\n to: '',\n }, { persistKey: 'fiscal.inbound-notes', persistExclude: ['unitId'] })\n\n // Switching unit in the shell re-anchors the list, as V1 did when the\n // current unit changed — and applies at once, because a list stuck on the\n // previous slice would show another unit's data.\n const ancora = unidades.value ?? ''\n const ancoraAnterior = useRef(ancora)\n useEffect(() => {\n if (ancoraAnterior.current === ancora) return\n ancoraAnterior.current = ancora\n setDraft((atual) => ({ ...atual, unitId: ancora }))\n apply()\n }, [ancora, setDraft, apply])\n // Slices apply on their own, so requests can overlap: only the latest one\n // may paint the list.\n const requestSeq = useRef(0)\n const reload = useCallback(async () => {\n const seq = ++requestSeq.current\n setLoading(true)\n try {\n const rows = await listInboxNotes({\n filter: applied.filter,\n unitId: applied.unitId || undefined,\n from: applied.from || undefined,\n to: applied.to || undefined,\n // The list pages on screen; the default 200 would silently drop the rest.\n limit: 5000,\n })\n if (seq === requestSeq.current) setNotes(rows)\n } finally {\n if (seq === requestSeq.current) setLoading(false)\n }\n }, [applied])\n\n useEffect(() => { void reload() }, [reload])\n\n const [intake, setIntake] = useState<InboxIntakeHealth | null>(null)\n const [syncing, setSyncing] = useState(false)\n const [syncNote, setSyncNote] = useState<string | null>(null)\n const refreshIntake = useCallback(() => { getInboxIntakeHealth().then(setIntake).catch(() => setIntake(null)) }, [])\n\n const syncNow = useCallback(async (quiet: boolean) => {\n setSyncing(true)\n if (!quiet) setSyncNote(null)\n try {\n const r = await syncNewNotes()\n try { localStorage.setItem(SYNC_KEY, String(Date.now())) } catch { /* private mode */ }\n if (r.added) void reload()\n const parts = [\n r.added ? `${r.added} ${r.added === 1 ? 'nota nova' : 'notas novas'}` : null,\n r.waiting ? `${r.waiting} ainda sem o XML completo na SEFAZ` : null,\n r.failed ? `${r.failed} com erro` : null,\n ].filter(Boolean)\n if (!quiet || parts.length) setSyncNote(parts.length ? `SEFAZ: ${parts.join(' · ')}.` : 'SEFAZ: nenhuma nota nova.')\n } catch (e) {\n if (!quiet) setSyncNote(e instanceof Error ? e.message : String(e))\n } finally {\n setSyncing(false)\n refreshIntake()\n }\n }, [reload, refreshIntake])\n\n // Opening the list is when someone wants to see what arrived; at most every 30 minutes.\n useEffect(() => {\n refreshIntake()\n let last = 0\n try { last = Number(localStorage.getItem(SYNC_KEY) ?? 0) } catch { /* private mode */ }\n if (Date.now() - last > 30 * 60_000) void syncNow(true)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // One file at a time, sequentially. The staging RPC is idempotent on the access\n // key, so a repeated file is not an error — but firing 20 of them in parallel\n // would race on the same de-para rows for the same supplier.\n const ingest = useCallback(async (files: File[]) => {\n const xmls = files.filter((f) => /\\.xml$/i.test(f.name))\n if (xmls.length === 0) {\n setReport({ ok: [], failed: [{ file: '—', message: 'Nenhum arquivo .xml no que foi solto.' }] })\n return\n }\n setBusy(true)\n const next: DropReport = { ok: [], failed: [] }\n for (const file of xmls) {\n try {\n const res = await stageNoteFromXml(await file.text())\n next.ok.push({\n file: file.name,\n number: res.parsed.nfeNumber,\n items: res.itemCount,\n matched: res.matchedCount,\n repeated: res.alreadyAccepted,\n })\n } catch (error) {\n next.failed.push({ file: file.name, message: error instanceof Error ? error.message : String(error) })\n }\n }\n setBusy(false)\n setReport(next)\n await reload()\n }, [reload])\n\n const [rowError, setRowError] = useState<string | null>(null)\n\n const downloadXml = useCallback(async (note: InboxNote) => {\n setRowError(null)\n try {\n const xml = await getInboxNoteXml(note.id)\n if (!xml) { setRowError(`O XML da nota ${note.number} não está guardado.`); return }\n const url = URL.createObjectURL(new Blob([xml], { type: 'application/xml' }))\n const a = document.createElement('a')\n a.href = url\n a.download = `${note.accessKey || note.number || 'nfe'}.xml`\n a.click()\n URL.revokeObjectURL(url)\n } catch (e) {\n setRowError(e instanceof Error ? e.message : String(e))\n }\n }, [])\n\n const openPdf = useCallback(async (note: InboxNote) => {\n setRowError(null)\n // Opened before the await: a tab opened after it is a popup the browser blocks.\n const tab = window.open('', '_blank')\n try {\n const pdf = await getInboxNotePdf(note.accessKey ?? '')\n if (tab) tab.location.href = URL.createObjectURL(pdf)\n } catch (e) {\n tab?.close()\n setRowError(e instanceof Error ? e.message : String(e))\n }\n }, [])\n\n const remove = useCallback(async (note: InboxNote) => {\n // Recusar, não apagar: a nota é documento fiscal e continua legível.\n await rejectNote(note.id, 'Recusada na lista de entrada')\n await reload()\n }, [reload])\n\n const activeCount = (applied.filter === 'all' ? 0 : 1)\n + (applied.unitId ? 1 : 0)\n + (applied.from || applied.to ? 1 : 0)\n\n const limpar = useCallback(() => {\n reset({ filter: 'all', unitId: ancora, from: '', to: '' })\n }, [reset, ancora])\n\n /** As duas pontas nunca ficam invertidas: mexer numa arrasta a outra. */\n const setFrom = (from: string) => patch({ from, to: draft.to && from > draft.to ? from : draft.to })\n const setTo = (to: string) => patch({ to, from: draft.from && to < draft.from ? to : draft.from })\n\n // Local search: the list already arrives whole, so a round trip per keystroke buys nothing.\n const query = search.trim().toLowerCase()\n const shown = useMemo(() => {\n if (!query) return notes\n // CNPJ, access key and date match on digits, so punctuation never matters.\n const digits = query.replace(/\\D/g, '')\n return notes.filter((note) => {\n if (`${note.number} ${note.series} ${note.supplierName}`.toLowerCase().includes(query)) return true\n if (digits.length < 2) return false\n if ((note.supplierCnpj ?? '').replace(/\\D/g, '').includes(digits)) return true\n if ((note.accessKey ?? '').includes(digits)) return true\n return day(note.issueDate).replace(/\\D/g, '').includes(digits)\n })\n }, [notes, query])\n\n const [page, setPage] = useState(1)\n useEffect(() => { setPage(1) }, [notes, query])\n const pageRows = useMemo(() => shown.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE), [shown, page])\n\n const columns = useMemo<ColumnDef<InboxNote, unknown>[]>(() => [\n {\n id: 'issueDate',\n header: 'Emissão',\n accessorFn: (note) => note.issueDate ?? '',\n cell: ({ row }) => <span className=\"tabular-nums text-muted-foreground\">{day(row.original.issueDate)}</span>,\n },\n {\n id: 'number',\n header: 'Nº',\n accessorFn: (note) => Number(note.number) || note.number,\n cell: ({ row }) => <span className=\"tabular-nums font-medium\">{row.original.number}</span>,\n },\n {\n id: 'supplier',\n header: 'Fornecedor',\n accessorFn: (note) => note.supplierName,\n meta: { truncate: true, mobile: 'title' },\n cell: ({ row }) => (\n <div>\n <p className=\"font-medium leading-tight\">{row.original.supplierName || '—'}</p>\n <p className=\"text-xs text-muted-foreground tabular-nums\">{cnpj(row.original.supplierCnpj)}</p>\n </div>\n ),\n },\n {\n id: 'reconciled',\n header: () => <span className=\"block text-center\">Conciliação</span>,\n accessorFn: (note) => (note.itemCount > 0 ? note.reconciledCount / note.itemCount : -1),\n cell: ({ row }) => (\n <div className=\"text-center\">\n <ReconcileBadge done={row.original.reconciledCount} total={row.original.itemCount} />\n </div>\n ),\n },\n {\n id: 'total',\n header: () => <span className=\"block text-right\">Valor</span>,\n accessorFn: (note) => note.total,\n cell: ({ row }) => {\n const note = row.original\n return (\n <div className=\"text-right tabular-nums\">\n {money(note.total)}\n {/* O título nasce com a soma das PARCELAS. Quando ela difere do\n total da nota, a tela mostra as duas — é a divergência que a\n conciliação passaria o mês procurando. */}\n {note.instalmentCount > 0 && Math.abs(note.instalmentTotal - note.total) > 0.01 && (\n <p className=\"text-[11px] text-warning-soft-foreground\">\n parcelas: {money(note.instalmentTotal)}\n </p>\n )}\n </div>\n )\n },\n },\n {\n id: 'stock',\n header: () => <span className=\"block text-center\">Estoque</span>,\n accessorFn: (note) => (note.stockedAt ? 2 : note.status === 'rejected' ? 0 : 1),\n cell: ({ row }) => (\n <div className=\"flex flex-col items-center gap-1\">\n <StockBadge stockedAt={row.original.stockedAt} status={row.original.status} />\n {row.original.shortageCount > 0 && <ShortageBadge />}\n </div>\n ),\n },\n {\n id: 'actions',\n header: () => <span className=\"block text-right\">Ações</span>,\n enableSorting: false,\n cell: ({ row }) => {\n const note = row.original\n const done = !!note.stockedAt || note.status === 'rejected'\n return (\n // The row itself opens the note; the buttons must not fire it a second time.\n <div className=\"flex justify-end gap-1\" onClick={(e) => e.stopPropagation()}>\n <ActionIcon label={done ? 'Ver nota' : 'Conciliar'}>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n aria-label={done ? `Ver a nota ${note.number}` : `Conciliar a nota ${note.number}`}\n className={done ? '' : 'bg-foreground text-background hover:bg-foreground/85 hover:text-background'}\n onClick={() => onOpenNote(note.id)}\n >\n {done ? <Eye className=\"h-4 w-4\" /> : <ListChecks className=\"h-4 w-4\" />}\n </Button>\n </ActionIcon>\n <RowActions\n inlineLimit={0}\n actions={[\n { id: 'xml', label: 'Baixar XML', icon: FileCode2, onSelect: () => downloadXml(note) },\n { id: 'pdf', label: 'Abrir PDF', icon: FileText, onSelect: () => openPdf(note), hidden: !note.accessKey },\n {\n id: 'reject', label: 'Recusar nota', icon: Trash2, intent: 'danger',\n onSelect: () => remove(note), hidden: done || !!note.invoiceId,\n },\n ]}\n />\n </div>\n )\n },\n },\n ], [onOpenNote, remove, downloadXml, openPdf])\n\n // Empty-by-search and empty-by-no-notes have different fixes.\n const emptyMessage = query || activeCount > 0 ? (\n <div>\n <Inbox className=\"mx-auto h-8 w-8 text-muted-foreground\" aria-hidden />\n <p className=\"mt-2 text-sm font-medium\">Nenhuma nota encontrada</p>\n <p className=\"text-xs text-muted-foreground\">Tente outro número, fornecedor ou CNPJ.</p>\n </div>\n ) : (\n <div>\n <Inbox className=\"mx-auto h-8 w-8 text-muted-foreground\" aria-hidden />\n <p className=\"mt-2 text-sm font-medium\">Nenhuma nota de entrada</p>\n <p className=\"text-xs text-muted-foreground\">\n As notas chegam da SEFAZ sozinhas, ou você arrasta o XML aqui.\n </p>\n </div>\n )\n\n return (\n <div className=\"space-y-4\">\n <PageHeaderActions>\n <PageActions\n actions={[\n {\n // Picking an XML off a filesystem is a desk job.\n id: 'import-xml', label: 'Importar XML', icon: busy ? Loader2 : UploadCloud,\n intent: 'primary', creates: true, desktopOnly: true, disabled: busy,\n onSelect: () => fileInput.current?.click(),\n },\n {\n id: 'sync-sefaz', label: syncing ? 'Buscando na SEFAZ…' : 'Buscar notas novas', icon: syncing ? Loader2 : RefreshCw,\n disabled: syncing, testId: 'sync-sefaz', onSelect: () => { void syncNow(false) },\n },\n {\n id: 'pull-by-key', label: 'Puxar por chave', icon: KeyRound, creates: true,\n testId: 'pull-by-key', onSelect: () => setPullOpen(true),\n },\n ]}\n />\n </PageHeaderActions>\n\n {syncNote && <p className=\"text-xs text-muted-foreground\" data-testid=\"sync-note\">{syncNote}</p>}\n\n {intake && (\n <Card className=\"border-warning bg-warning-soft p-4\" data-testid=\"intake-stalled\">\n <p className=\"text-sm font-medium text-warning-soft-foreground\">\n {intake.certificateExpiredAt\n ? `As notas da SEFAZ não estão chegando: o certificado digital venceu em ${day(intake.certificateExpiredAt)}.`\n : `As notas da SEFAZ não estão chegando${intake.since ? ` desde ${day(intake.since)}` : ''}.`}\n </p>\n <p className=\"mt-1 text-xs text-warning-soft-foreground\">\n {intake.certificateExpiredAt\n ? 'Renove o certificado A1 do CNPJ e envie o arquivo novo. As notas que ficaram para trás chegam sozinhas depois disso.'\n : intake.error ?? 'A busca automática parou. Enquanto isso, dá para importar o XML ou puxar a nota pela chave.'}\n {intake.stalled > 1 ? ` (${intake.stalled} CNPJs afetados)` : ''}\n </p>\n {intake.unitId && (intake.certificateExpiredAt || intake.error) && (\n <Button size=\"sm\" variant=\"outline\" className=\"mt-3\" data-testid=\"intake-update-certificate\"\n onClick={() => adminNavigateTo(`/settings/locations/${intake.unitId}/fields:tax`)}>\n Atualizar certificado\n </Button>\n )}\n </Card>\n )}\n\n {/* A área de arrastar é a porta de entrada, e o texto é o do V1: a entrada\n nasce do XML, não da digitação. */}\n <Card\n className={`hidden border-dashed p-6 text-center transition-colors md:block ${dragging ? 'border-primary bg-primary/5' : ''}`}\n onDragOver={(e: React.DragEvent) => { e.preventDefault(); setDragging(true) }}\n onDragLeave={() => setDragging(false)}\n onDrop={(e: React.DragEvent) => {\n e.preventDefault()\n setDragging(false)\n void ingest(Array.from(e.dataTransfer.files))\n }}\n >\n <UploadCloud className=\"mx-auto h-8 w-8 text-muted-foreground\" aria-hidden />\n <p className=\"mt-2 text-sm font-medium\">Arraste arquivos XML aqui ou clique para selecionar</p>\n <p className=\"text-xs text-muted-foreground\">\n Suporta múltiplos arquivos XML de NF-e. O XML do fornecedor dá entrada no estoque e cria a conta a pagar.\n </p>\n <input\n ref={fileInput}\n type=\"file\"\n accept=\".xml,text/xml,application/xml\"\n multiple\n className=\"hidden\"\n onChange={(e) => {\n void ingest(Array.from(e.target.files ?? []))\n e.target.value = ''\n }}\n />\n </Card>\n\n <PullByKeyDialog\n open={pullOpen}\n onOpenChange={setPullOpen}\n unitId={applied.unitId || null}\n onPulled={(r) => {\n setReport({\n ok: [{ file: 'chave', number: r.parsed.nfeNumber, items: r.itemCount, matched: r.matchedCount, repeated: r.alreadyAccepted }],\n failed: [],\n })\n void reload()\n }}\n />\n\n {report && (\n <Card className=\"p-4 space-y-2\">\n {report.ok.map((r) => (\n <p key={r.file} className=\"text-sm\">\n <span className=\"font-medium\">NF-e {r.number}</span>{' '}\n <span className=\"text-muted-foreground\">\n {r.repeated\n ? '— já tinha sido aceita, nada mudou'\n // O número que diz se o de-para está trabalhando. Sem ele, o\n // operador não sabe se importar XML economizou algo.\n : `— ${r.items} ${r.items === 1 ? 'item' : 'itens'}, ${r.matched} já ${r.matched === 1 ? 'vinculado' : 'vinculados'}`}\n </span>\n </p>\n ))}\n {report.failed.map((r) => (\n <p key={r.file} className=\"text-sm text-destructive\">\n <span className=\"font-medium\">{r.file}</span> — {r.message}\n </p>\n ))}\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setReport(null)}>Fechar</Button>\n </Card>\n )}\n\n {/* ── O painel de filtros ──────────────────────────────────────────── */}\n {/* The same FilterPanel as the bank reconciliation: unit, state and both\n ends of the period define WHAT is fetched, and they apply on their\n own. SEARCH is not here — it is the list's bar: whoever types is\n looking for ONE note among those on screen, not redefining the query. */}\n <FilterPanel\n title=\"Filtros\"\n onApply={apply}\n applyLabel=\"Buscar\"\n onClear={activeCount > 0 ? limpar : undefined}\n clearLabel=\"Limpar\"\n busy={loading}\n >\n {unidades.visible && (\n <FilterPanelField label={unidades.label}>\n <Select\n value={draft.unitId || '__all__'}\n onValueChange={(v) => patch({ unitId: v === '__all__' ? '' : v })}\n >\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n <SelectItem value=\"__all__\">{unidades.allLabel}</SelectItem>\n {unidades.options.map((u) => <SelectItem key={u.id} value={u.id}>{u.name}</SelectItem>)}\n </SelectContent>\n </Select>\n </FilterPanelField>\n )}\n\n <FilterPanelField label=\"Estado\">\n <Select value={draft.filter} onValueChange={(v) => patch({ filter: v as InboxStatusFilter })}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {STATE_OPTIONS.map((o) => <SelectItem key={o.value} value={o.value}>{o.label}</SelectItem>)}\n </SelectContent>\n </Select>\n </FilterPanelField>\n\n <FilterPanelField label=\"Emissão de\">\n <input type=\"date\" value={draft.from} max={isoDay(new Date())} onChange={(e) => setFrom(e.target.value)} className={CAMPO} />\n </FilterPanelField>\n <FilterPanelField label=\"Emissão até\">\n <input type=\"date\" value={draft.to} max={isoDay(new Date())} onChange={(e) => setTo(e.target.value)} className={CAMPO} />\n </FilterPanelField>\n </FilterPanel>\n\n {rowError && (\n <p className=\"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive\" role=\"alert\">{rowError}</p>\n )}\n\n {/* Search and table are one surface — they act on the same rows. `clip`, as\n in CrudListView: `hidden` makes a scroll box that swallows the sticky header. */}\n <Card style={{ overflow: 'clip' }}>\n <div className=\"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2\">\n <div className=\"min-w-[10rem] flex-1\">\n <SearchField\n value={search}\n onChange={setSearch}\n placeholder=\"Buscar por número, fornecedor, CNPJ…\"\n data-testid=\"inbound-notes-search\"\n />\n </div>\n </div>\n <TooltipProvider delayDuration={200}>\n <DataTable\n variant=\"bare\"\n columns={columns}\n data={loading ? [] : pageRows}\n loading={loading}\n getRowId={(note) => note.id}\n onRowClick={(note) => onOpenNote(note.id)}\n emptyMessage={emptyMessage}\n mobileLayout=\"cards\"\n />\n </TooltipProvider>\n {!loading && shown.length > 0 && (\n <ChevronPager page={page} pageSize={PAGE_SIZE} total={shown.length} onPageChange={setPage} noun=\"notas\" />\n )}\n </Card>\n </div>\n )\n}\n\nconst PAGE_SIZE = 50\n\nfunction ActionIcon({ label, children }: { label: string; children: React.ReactElement }) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>{children}</TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n )\n}\n\nfunction ReconcileBadge({ done, total }: { done: number; total: number }) {\n const full = total > 0 && done === total\n return (\n <span\n className={`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium tabular-nums ${\n full ? 'bg-success-soft text-success-soft-foreground' : 'bg-muted text-muted-foreground'\n }`}\n >\n {done}/{total}\n </span>\n )\n}\n\n/** Received with something missing (fiscal-br/034): the payable is flagged to abate. */\nfunction ShortageBadge() {\n const t = useTranslation()\n return (\n <span\n className=\"inline-flex items-center rounded-full border border-warning bg-warning-soft px-1.5 py-0 text-[10px] text-warning-soft-foreground\"\n title={t('fiscalbr.receipt.listBadgeHint')}\n data-testid=\"note-shortage-badge\"\n >\n {t('fiscalbr.receipt.listBadge')}\n </span>\n )\n}\n\nfunction StockBadge({ stockedAt, status }: { stockedAt: string | null; status: string }) {\n if (status === 'rejected') {\n return <span className=\"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground line-through\">Recusada</span>\n }\n return stockedAt ? (\n <span className=\"inline-flex items-center rounded-full bg-success-soft px-2 py-0.5 text-[11px] font-medium text-success-soft-foreground\">\n <FileDown className=\"mr-1 h-3 w-3\" aria-hidden />\n Estocado\n </span>\n ) : (\n <span className=\"inline-flex items-center rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-medium text-warning-soft-foreground\">\n Pendente\n </span>\n )\n}\n","// ---------------------------------------------------------------------------\n// A página de notas de compra: lista, conciliação e fila da SEFAZ numa moldura.\n// ---------------------------------------------------------------------------\n// As vistas trocam por ESTADO LOCAL, não por rota. Trocar de rota remonta a\n// página e rebusca tudo — a lista pisca, a posição de rolagem se perde, e voltar\n// da conciliação recarrega 200 notas para mostrar a mesma coisa.\n//\n// A CONCILIAÇÃO É MODAL, e a lista FICA MONTADA ATRÁS DELA. Era subpágina, e\n// subpágina desmonta: quem conciliava a quinta nota de um recorte de 200 voltava\n// para a lista no estado inicial — sem o filtro, sem a busca, no topo. O trabalho\n// é «abrir, decidir, fechar, abrir a próxima», e o custo era pago uma vez por\n// nota. Com o modal a lista nunca é desfeita, então fechar devolve exatamente o\n// que estava na tela.\n//\n// O ENDEREÇO EMPILHA NA DESCIDA. `pushState` não dispara `hashchange`, então o\n// roteador do anfitrião continua sem remontar nada — mas a conciliação passa a\n// existir como um degrau no histórico. Com `replaceState` ela não existia, e o\n// «voltar» do cabeçalho (que anda pelo histórico quando a pessoa veio de outro\n// módulo) saltava a lista inteira e caía no Painel. Subir é desempilhar.\n// ---------------------------------------------------------------------------\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { Modal, ModalContent } from '@fayz-ai/ui'\nimport { findInboxNoteByOperation } from '../data/inbox'\nimport { InboundNotesView } from './InboundNotesView'\nimport { NoteReconcileView } from './NoteReconcileView'\nimport { navigateApp, currentAppPath, appHref, onAppPathChange } from '@fayz-ai/core'\n\ntype View =\n | { kind: 'list' }\n | { kind: 'note'; id: string }\n\nconst ROUTE_PREFIX = '/inbound-notes'\n\nfunction viewFromLocation(): View {\n if (typeof window === 'undefined') return { kind: 'list' }\n const hash = currentAppPath()\n const note = hash.match(/\\/inbound-notes\\/note\\/([0-9a-f-]{36})/i)\n if (note) return { kind: 'note', id: note[1] }\n return { kind: 'list' }\n}\n\nconst pathOf = (view: View) =>\n view.kind === 'note' ? `${ROUTE_PREFIX}/note/${view.id}` : ROUTE_PREFIX\n\nexport interface InboundNotesPageProps {\n /** Onde o título a pagar vive no app anfitrião. Sem isto o botão não aparece. */\n payableRoute?: (invoiceId: string) => string\n}\n\n/** Marca as entradas que ESTA página empilhou, para só elas serem desempilhadas. */\nconst STACK_MARK = { inboundNotes: true }\n\nexport function InboundNotesPage({ payableRoute = (id) => `/financial/payables/${id}` }: InboundNotesPageProps = {}) {\n const [view, setView] = useState<View>(viewFromLocation)\n\n const go = useCallback((next: View) => {\n setView(next)\n if (typeof window === 'undefined') return\n const path = pathOf(next)\n if (currentAppPath() === path) return\n const empilhado = (window.history.state as { inboundNotes?: boolean } | null)?.inboundNotes\n if (next.kind !== 'note' && empilhado) {\n // Desempilha de verdade: trocar a URL à mão deixaria a conciliação no\n // histórico e o «voltar» do navegador entraria nela outra vez.\n window.history.back()\n return\n }\n if (next.kind === 'list') window.history.replaceState(null, '', appHref(path))\n else window.history.pushState(STACK_MARK, '', appHref(path))\n }, [])\n\n // O «voltar» do navegador é um gesto legítimo aqui: quem entrou na conciliação\n // por um deep link espera sair dela com ele.\n useEffect(() => {\n if (typeof window === 'undefined') return\n const onPop = () => {\n const next = viewFromLocation()\n setView(next)\n }\n window.addEventListener('popstate', onPop)\n const off = onAppPathChange(onPop)\n return () => {\n window.removeEventListener('popstate', onPop)\n off()\n }\n }, [])\n\n const fecharNota = useCallback(() => go({ kind: 'list' }), [go])\n\n // ENTRAR PELA OPERAÇÃO DE ESTOQUE. A linha de Movimentações sabe de que\n // OPERAÇÃO ela veio, não de que nota — o id da nota só o banco tem. Então o\n // link chega como `?operation=…` e esta página resolve, em vez de obrigar o\n // Estoque a consultar uma tabela do fiscal para desenhar um href.\n useEffect(() => {\n if (typeof window === 'undefined') return\n const op = currentAppPath().match(/[?&]operation=([0-9a-f-]{36})/i)?.[1]\n if (!op) return\n let vivo = true\n findInboxNoteByOperation(op)\n .then((id) => { if (vivo && id) go({ kind: 'note', id }) })\n .catch(() => { /* link velho ou nota de outra conta: fica na lista */ })\n return () => { vivo = false }\n }, [go])\n\n return (\n <>\n {/* A tela de fundo nunca é desmontada enquanto a nota está aberta: é ela\n que guarda o recorte, a busca e a rolagem a que a pessoa volta. */}\n <InboundNotesView onOpenNote={(id) => go({ kind: 'note', id })} />\n\n <Modal open={view.kind === 'note'} onOpenChange={(open) => { if (!open) fecharNota() }}>\n {view.kind === 'note' && (\n // `noPadding`: a conciliação desenha o próprio cabeçalho e o próprio\n // corpo — o título e o «Sugerir com IA» ficam fora da área que rola, e o\n // rodapé «Aceitar» precisa encostar nas bordas do modal.\n <ModalContent size=\"5xl\" noPadding className=\"sm:max-h-[90vh]\">\n <NoteReconcileView\n chrome=\"modal\"\n noteId={view.id}\n onBack={fecharNota}\n onOpenInvoice={payableRoute\n ? (invoiceId) => { navigateApp(payableRoute(invoiceId)) }\n : undefined}\n />\n </ModalContent>\n )}\n </Modal>\n </>\n )\n}\n\n/**\n * O componente que o registro de rotas monta. Ele recebe as rotas sem prop, então\n * a configuração do host entra por fechamento — e a fábrica mora aqui, num `.tsx`,\n * para o manifesto continuar sendo TypeScript sem JSX.\n */\nexport function makeInboundNotesRoute(options: InboundNotesPageProps = {}): () => React.ReactElement {\n return function InboundNotesRoute() {\n return <InboundNotesPage {...options} />\n }\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { packagingCount } from './chunk-5LI2FDOM.js';
|
|
2
|
+
import { summarizeOccurrence, receivedStockQty, hasShortage, shortageQty, shortageReasonKey, shortageValue, receivedQty, SHORTAGE_REASONS, parseQty } from './chunk-DHCCZXUM.js';
|
|
2
3
|
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
3
4
|
import { KeyRound, Loader2, Download, ChevronDown, FileCode2, FileText, RefreshCw, UserPlus, Gift, AlertTriangle, ChevronRight, Check, Trash2, Plus, Image, UploadCloud, Paperclip, ScanLine, X } from 'lucide-react';
|
|
4
|
-
import { getSupabaseClientOptional, formatCurrency } from '@fayz-ai/core';
|
|
5
|
+
import { useTranslation, getSupabaseClientOptional, formatCurrency } from '@fayz-ai/core';
|
|
5
6
|
import { getActiveTenantId, PersonLink } from '@fayz-ai/admin';
|
|
6
7
|
import { Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ModalFooter, Button, AiActionButton, Dropdown, DropdownTrigger, DropdownContent, DropdownItem, Hint, Card, InlineLink, SearchSelect, EmBreve, DatePicker, SubpageHeader, Skeleton } from '@fayz-ai/ui';
|
|
7
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -332,7 +333,7 @@ var NOTE_COLUMNS = `
|
|
|
332
333
|
total_value, total_products, total_discount, total_freight,
|
|
333
334
|
invoice_id, inventory_operation_id, stocked_at, reviewed_at,
|
|
334
335
|
default_chart_account_id, default_location_id, unit_id, document_id, metadata,
|
|
335
|
-
items:plg_fiscalbr_inbox_items(id, reconciled, entry_type),
|
|
336
|
+
items:plg_fiscalbr_inbox_items(id, reconciled, entry_type, shortage_quantity),
|
|
336
337
|
duplicates:plg_fiscalbr_inbox_duplicates(id, value)
|
|
337
338
|
`;
|
|
338
339
|
function rowToNote(row) {
|
|
@@ -356,6 +357,7 @@ function rowToNote(row) {
|
|
|
356
357
|
total: Number(row.total_value ?? 0),
|
|
357
358
|
itemCount: items.length,
|
|
358
359
|
reconciledCount: items.filter((i) => i.reconciled).length,
|
|
360
|
+
shortageCount: items.filter((i) => Number(i.shortage_quantity ?? 0) > 0).length,
|
|
359
361
|
instalmentCount: duplicates.length,
|
|
360
362
|
// The sum of instalments, because that is the total the payable is opened
|
|
361
363
|
// with (financial/084) — showing the note total here would make the list and
|
|
@@ -565,9 +567,9 @@ async function saveNoteDecision(input) {
|
|
|
565
567
|
cost_mode: i.costMode ?? "novo",
|
|
566
568
|
suggested_by: i.suggestedBy ?? null,
|
|
567
569
|
suggestion_confidence: i.suggestionConfidence ?? null,
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
shortage_note: i.shortageNote ?? null
|
|
570
|
+
// `missing_quantity` (note units) is the key the save RPC reads since
|
|
571
|
+
// fiscal-br/034; without it the receipt already saved is kept.
|
|
572
|
+
...i.missingQuantity !== void 0 ? { missing_quantity: i.missingQuantity, shortage_reason: i.shortageReason ?? null, shortage_note: i.shortageNote ?? null } : {}
|
|
571
573
|
})),
|
|
572
574
|
p_default_chart_account_id: input.defaultChartAccountId ?? null,
|
|
573
575
|
p_default_location_id: input.defaultLocationId ?? null,
|
|
@@ -613,7 +615,9 @@ async function acceptNote(documentId, locationId) {
|
|
|
613
615
|
invoiceTotal: Number(res.invoice_total ?? 0),
|
|
614
616
|
instalments: Number(res.installments ?? 0),
|
|
615
617
|
operationId: res.operation_id ?? null,
|
|
616
|
-
stockLines: Number(res.stock_lines ?? 0)
|
|
618
|
+
stockLines: Number(res.stock_lines ?? 0),
|
|
619
|
+
shortageLines: Number(res.shortage_lines ?? 0),
|
|
620
|
+
shortageValue: Number(res.shortage_value ?? 0)
|
|
617
621
|
};
|
|
618
622
|
}
|
|
619
623
|
async function rejectNote(documentId, reason) {
|
|
@@ -1237,11 +1241,34 @@ var draftOf = (item) => ({
|
|
|
1237
1241
|
conversionFactor: String(item.conversionFactor ?? 1),
|
|
1238
1242
|
costMode: item.costMode === "media" ? "media" : "novo",
|
|
1239
1243
|
shortageQuantity: item.shortageQuantity == null ? "" : String(item.shortageQuantity),
|
|
1244
|
+
shortageReason: item.shortageReason ?? "faltou",
|
|
1245
|
+
shortageNote: item.shortageNote ?? "",
|
|
1240
1246
|
// Vem do SERVIDOR: é o que faz o selo sobreviver a recarregar a página.
|
|
1241
1247
|
suggestedBy: item.suggestedBy,
|
|
1242
1248
|
suggestionConfidence: item.suggestionConfidence
|
|
1243
1249
|
});
|
|
1250
|
+
function receiptOf(item, d) {
|
|
1251
|
+
const missing = parseQty(d.shortageQuantity);
|
|
1252
|
+
if (missing === null || Number.isNaN(missing) || missing <= 0) {
|
|
1253
|
+
return { missingQuantity: null, shortageReason: null, shortageNote: null };
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
missingQuantity: Math.min(missing, item.quantity),
|
|
1257
|
+
shortageReason: d.shortageReason || "faltou",
|
|
1258
|
+
shortageNote: d.shortageNote.trim() || null
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
function receiptInvalid(item, d) {
|
|
1262
|
+
const missing = parseQty(d.shortageQuantity);
|
|
1263
|
+
if (missing === null) return false;
|
|
1264
|
+
return Number.isNaN(missing) || missing < 0 || missing > item.quantity + 1e-9;
|
|
1265
|
+
}
|
|
1266
|
+
var receiptLine = (item, d) => {
|
|
1267
|
+
const missing = parseQty(d.shortageQuantity);
|
|
1268
|
+
return { quantity: item.quantity, total: item.total, shortageQuantity: missing && !Number.isNaN(missing) ? missing : 0 };
|
|
1269
|
+
};
|
|
1244
1270
|
function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
1271
|
+
const t = useTranslation();
|
|
1245
1272
|
const emModal = chrome === "modal";
|
|
1246
1273
|
const sangria = emModal ? "-mx-6 px-6" : "-mx-4 px-4";
|
|
1247
1274
|
const cabecalho = (titulo) => emModal ? null : /* @__PURE__ */ jsx(SubpageHeader, { title: titulo, onBack, parentLabel: "Manifesto de Notas" });
|
|
@@ -1383,20 +1410,29 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1383
1410
|
costMode: d.costMode,
|
|
1384
1411
|
suggestedBy: d.suggestedBy,
|
|
1385
1412
|
suggestionConfidence: d.suggestionConfidence,
|
|
1386
|
-
|
|
1413
|
+
// The receipt travels as `missing_quantity` (note units); nothing missing is null.
|
|
1414
|
+
...receiptOf(item, d)
|
|
1387
1415
|
};
|
|
1388
1416
|
});
|
|
1389
1417
|
}, [note, defaultAccount]);
|
|
1390
1418
|
const decisions = useMemo(() => buildDecisions(drafts), [buildDecisions, drafts]);
|
|
1391
|
-
const
|
|
1419
|
+
const nothingArrived = (id) => {
|
|
1420
|
+
const item = note?.items.find((i) => i.id === id);
|
|
1421
|
+
if (!item) return false;
|
|
1422
|
+
const d = drafts[id] ?? draftOf(item);
|
|
1423
|
+
return !receiptInvalid(item, d) && receivedQty(receiptLine(item, d)) <= 1e-9;
|
|
1424
|
+
};
|
|
1425
|
+
const stockLines = decisions.filter((d) => isStockBearing(d.entryType) && !nothingArrived(d.id));
|
|
1392
1426
|
const missingProduct = stockLines.filter((d) => !d.productId).length;
|
|
1393
1427
|
const missingUnit = stockLines.filter((d) => {
|
|
1394
1428
|
const item = note?.items.find((i) => i.id === d.id);
|
|
1395
1429
|
return !d.stockUnitId && !item?.stockMovementId;
|
|
1396
1430
|
}).length;
|
|
1397
1431
|
const missingType = decisions.filter((d) => !d.entryType).length;
|
|
1432
|
+
const badReceipt = note ? note.items.filter((i) => receiptInvalid(i, drafts[i.id] ?? draftOf(i))).length : 0;
|
|
1433
|
+
const occurrence = note ? summarizeOccurrence(note.items.map((i) => receiptLine(i, drafts[i.id] ?? draftOf(i)))) : { count: 0, value: 0 };
|
|
1398
1434
|
const suspectFactor = (item, d) => packagingCount(item.unit) !== null && isStockBearing(d.entryType) && ((Number(d.conversionFactor.replace(",", ".")) || 1) === 1 || !d.stockUnitId);
|
|
1399
|
-
const unverifiedFactor = note ? note.items.filter((i) => suspectFactor(i, drafts[i.id] ?? draftOf(i))).length : 0;
|
|
1435
|
+
const unverifiedFactor = note ? note.items.filter((i) => suspectFactor(i, drafts[i.id] ?? draftOf(i)) && !nothingArrived(i.id)).length : 0;
|
|
1400
1436
|
const instalmentSum = instalments.reduce((acc, d) => acc + (Number(d.amount) || 0), 0);
|
|
1401
1437
|
const hasPayable = Boolean(note?.invoiceId);
|
|
1402
1438
|
const pendingStock = (note?.items ?? []).some((i) => !i.stockMovementId && (!i.entryType || isStockBearing(i.entryType)));
|
|
@@ -1657,7 +1693,8 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1657
1693
|
unverifiedFactor > 0 && `${unverifiedFactor} com fator por conferir`,
|
|
1658
1694
|
missingType > 0 && `${missingType} sem tipo`,
|
|
1659
1695
|
missingProduct > 0 && `${missingProduct} sem produto`,
|
|
1660
|
-
missingUnit > 0 && `${missingUnit} sem unidade de estoque
|
|
1696
|
+
missingUnit > 0 && `${missingUnit} sem unidade de estoque`,
|
|
1697
|
+
badReceipt > 0 && t("fiscalbr.receipt.pending", { count: badReceipt })
|
|
1661
1698
|
].filter(Boolean).join(" \xB7 ");
|
|
1662
1699
|
const rodape = readOnly ? null : {
|
|
1663
1700
|
start: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1694,7 +1731,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1694
1731
|
onClick: () => {
|
|
1695
1732
|
void accept();
|
|
1696
1733
|
},
|
|
1697
|
-
disabled: accepting || saving || missingType > 0 || missingProduct > 0 || missingUnit > 0 || unverifiedFactor > 0,
|
|
1734
|
+
disabled: accepting || saving || missingType > 0 || missingProduct > 0 || missingUnit > 0 || unverifiedFactor > 0 || badReceipt > 0,
|
|
1698
1735
|
children: [
|
|
1699
1736
|
accepting ? /* @__PURE__ */ jsx(Loader2, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx(Check, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
1700
1737
|
hasPayable ? "Dar entrada no estoque" : "Aceitar"
|
|
@@ -1707,6 +1744,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1707
1744
|
cabecalho(`Concilia\xE7\xE3o \xB7 NF-e ${note.number}`),
|
|
1708
1745
|
accepted && /* @__PURE__ */ jsxs(Card, { className: "border-success bg-success-soft p-4", children: [
|
|
1709
1746
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-success-soft-foreground", children: accepted.alreadyAccepted ? "Esta nota j\xE1 havia sido aceita \u2014 nada foi lan\xE7ado de novo." : accepted.instalments === 0 ? `Entrada no estoque: ${accepted.stockLines} ${accepted.stockLines === 1 ? "linha" : "linhas"}, ligadas \xE0 conta a pagar que a nota j\xE1 tinha (${money2(accepted.invoiceTotal)}).` : `Aceita: ${accepted.stockLines} ${accepted.stockLines === 1 ? "linha" : "linhas"} de estoque e um t\xEDtulo de ${money2(accepted.invoiceTotal)} em ${accepted.instalments} ${accepted.instalments === 1 ? "parcela" : "parcelas"}.` }),
|
|
1747
|
+
!accepted.alreadyAccepted && accepted.shortageLines > 0 && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-success-soft-foreground", "data-testid": "note-accepted-shortage", children: t("fiscalbr.receipt.accepted", { count: accepted.shortageLines, value: money2(accepted.shortageValue) }) }),
|
|
1710
1748
|
accepted.invoiceId && onOpenInvoice && /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", className: "mt-2", onClick: () => onOpenInvoice(accepted.invoiceId), children: "Abrir a conta a pagar" })
|
|
1711
1749
|
] }),
|
|
1712
1750
|
payableLost && !readOnly && /* @__PURE__ */ jsxs(Card, { className: "border-warning bg-warning-soft p-4", "data-testid": "note-payable-lost", children: [
|
|
@@ -1898,14 +1936,16 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1898
1936
|
note.items.map((item) => {
|
|
1899
1937
|
const d = drafts[item.id] ?? draftOf(item);
|
|
1900
1938
|
const factor = Number(d.conversionFactor.replace(",", ".")) || 1;
|
|
1901
|
-
const
|
|
1902
|
-
const stockQty =
|
|
1939
|
+
const rLine = receiptLine(item, d);
|
|
1940
|
+
const stockQty = receivedStockQty(rLine, factor);
|
|
1941
|
+
const rInvalid = receiptInvalid(item, d);
|
|
1942
|
+
const rShort = hasShortage(rLine);
|
|
1903
1943
|
const unitCost = factor > 0 ? item.unitPrice / factor : item.unitPrice;
|
|
1904
1944
|
const bearing = isStockBearing(d.entryType);
|
|
1905
1945
|
const open = openIds.includes(item.id);
|
|
1906
1946
|
const done = Boolean(checked[item.id]);
|
|
1907
1947
|
const ready = isReady(item, d);
|
|
1908
|
-
const typeLabel = ENTRY_TYPES.find((
|
|
1948
|
+
const typeLabel = ENTRY_TYPES.find((t2) => t2.value === d.entryType)?.label;
|
|
1909
1949
|
return /* @__PURE__ */ jsxs(Card, { className: "overflow-hidden", children: [
|
|
1910
1950
|
/* @__PURE__ */ jsxs(
|
|
1911
1951
|
Button,
|
|
@@ -1938,6 +1978,15 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1938
1978
|
] }),
|
|
1939
1979
|
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-sm tabular-nums", children: money2(item.total) }),
|
|
1940
1980
|
d.suggestedBy && !done && /* @__PURE__ */ jsx(AuthorBadge, { draft: d }),
|
|
1981
|
+
rShort && /* @__PURE__ */ jsx(
|
|
1982
|
+
"span",
|
|
1983
|
+
{
|
|
1984
|
+
className: "shrink-0 rounded-full border border-warning bg-warning-soft px-1.5 py-0.5 text-[10px] text-warning-soft-foreground",
|
|
1985
|
+
title: `${t(shortageReasonKey(d.shortageReason))}${d.shortageNote ? ` \u2014 ${d.shortageNote}` : ""} \xB7 ${money2(shortageValue(rLine))}`,
|
|
1986
|
+
"data-testid": "item-shortage-badge",
|
|
1987
|
+
children: t("fiscalbr.receipt.badge", { missing: qty(shortageQty(rLine)), unit: item.unit ?? "" })
|
|
1988
|
+
}
|
|
1989
|
+
),
|
|
1941
1990
|
/* @__PURE__ */ jsx(ItemState, { done: done && ready, ready })
|
|
1942
1991
|
]
|
|
1943
1992
|
}
|
|
@@ -1959,30 +2008,110 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1959
2008
|
/* @__PURE__ */ jsx(Field, { small: true, label: "NCM", value: item.ncm ?? "\u2014", mono: true }),
|
|
1960
2009
|
/* @__PURE__ */ jsx(Field, { small: true, label: "CFOP", value: item.cfop ?? "\u2014", mono: true }),
|
|
1961
2010
|
/* @__PURE__ */ jsx(Field, { small: true, label: "CST/CSOSN", value: item.icmsCst ?? item.icmsCsosn ?? "\u2014", mono: true })
|
|
2011
|
+
] }),
|
|
2012
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-2 rounded-md border p-3", "data-testid": "item-receipt", children: [
|
|
2013
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-2", children: [
|
|
2014
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: t("fiscalbr.receipt.title") }),
|
|
2015
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: rShort ? t("fiscalbr.receipt.summary", {
|
|
2016
|
+
missing: qty(shortageQty(rLine)),
|
|
2017
|
+
billed: qty(item.quantity),
|
|
2018
|
+
unit: item.unit ?? "",
|
|
2019
|
+
reason: t(shortageReasonKey(d.shortageReason)),
|
|
2020
|
+
value: money2(shortageValue(rLine))
|
|
2021
|
+
}) : t("fiscalbr.receipt.allArrived") })
|
|
2022
|
+
] }),
|
|
2023
|
+
readOnly ? /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: t("fiscalbr.receipt.locked") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2024
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2025
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2026
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: t("fiscalbr.receipt.received", { unit: item.unit ?? "" }) }),
|
|
2027
|
+
/* @__PURE__ */ jsx(
|
|
2028
|
+
ReceivedInput,
|
|
2029
|
+
{
|
|
2030
|
+
received: rInvalid ? null : receivedQty(rLine),
|
|
2031
|
+
onChange: (got) => patch(item.id, {
|
|
2032
|
+
shortageQuantity: got >= item.quantity - 1e-9 ? "" : decimalText(Math.max(Math.round((item.quantity - got) * 1e4) / 1e4, 0))
|
|
2033
|
+
})
|
|
2034
|
+
}
|
|
2035
|
+
)
|
|
2036
|
+
] }),
|
|
2037
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2038
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: t("fiscalbr.receipt.missing", { unit: item.unit ?? "" }) }),
|
|
2039
|
+
/* @__PURE__ */ jsx(
|
|
2040
|
+
Input,
|
|
2041
|
+
{
|
|
2042
|
+
value: d.shortageQuantity,
|
|
2043
|
+
inputMode: "decimal",
|
|
2044
|
+
placeholder: "0",
|
|
2045
|
+
"aria-invalid": rInvalid || void 0,
|
|
2046
|
+
onChange: (e) => patch(item.id, { shortageQuantity: e.target.value })
|
|
2047
|
+
}
|
|
2048
|
+
)
|
|
2049
|
+
] })
|
|
2050
|
+
] }),
|
|
2051
|
+
rInvalid && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-destructive", children: t("fiscalbr.receipt.tooMuch", { billed: qty(item.quantity), unit: item.unit ?? "" }) }),
|
|
2052
|
+
rShort && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2053
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2054
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: t("fiscalbr.receipt.reason") }),
|
|
2055
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: SHORTAGE_REASONS.map((r) => /* @__PURE__ */ jsx(
|
|
2056
|
+
Button,
|
|
2057
|
+
{
|
|
2058
|
+
variant: "bare",
|
|
2059
|
+
size: "bare",
|
|
2060
|
+
type: "button",
|
|
2061
|
+
onClick: () => patch(item.id, { shortageReason: r }),
|
|
2062
|
+
className: `gap-0 font-normal rounded-full border px-2.5 py-1 text-[11px] transition-colors ${d.shortageReason === r ? "border-primary bg-primary text-primary-foreground" : "border-input hover:bg-muted"}`,
|
|
2063
|
+
children: t(shortageReasonKey(r))
|
|
2064
|
+
},
|
|
2065
|
+
r
|
|
2066
|
+
)) })
|
|
2067
|
+
] }),
|
|
2068
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2069
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: t("fiscalbr.receipt.note") }),
|
|
2070
|
+
/* @__PURE__ */ jsx(
|
|
2071
|
+
Input,
|
|
2072
|
+
{
|
|
2073
|
+
value: d.shortageNote,
|
|
2074
|
+
placeholder: t("fiscalbr.receipt.notePlaceholder"),
|
|
2075
|
+
onChange: (e) => patch(item.id, { shortageNote: e.target.value })
|
|
2076
|
+
}
|
|
2077
|
+
)
|
|
2078
|
+
] }),
|
|
2079
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
|
|
2080
|
+
Button,
|
|
2081
|
+
{
|
|
2082
|
+
type: "button",
|
|
2083
|
+
size: "sm",
|
|
2084
|
+
variant: "ghost",
|
|
2085
|
+
onClick: () => patch(item.id, { shortageQuantity: "", shortageNote: "" }),
|
|
2086
|
+
children: t("fiscalbr.receipt.clear")
|
|
2087
|
+
}
|
|
2088
|
+
) })
|
|
2089
|
+
] })
|
|
2090
|
+
] })
|
|
1962
2091
|
] })
|
|
1963
2092
|
] }),
|
|
1964
2093
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3 lg:border-l lg:pl-4", children: [
|
|
1965
2094
|
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Item no estoque" }),
|
|
1966
2095
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
1967
2096
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Tipo do registro" }),
|
|
1968
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: ENTRY_TYPES.map((
|
|
2097
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: ENTRY_TYPES.map((t2) => /* @__PURE__ */ jsxs(
|
|
1969
2098
|
Button,
|
|
1970
2099
|
{
|
|
1971
2100
|
variant: "bare",
|
|
1972
2101
|
size: "bare",
|
|
1973
2102
|
type: "button",
|
|
1974
2103
|
disabled: readOnly,
|
|
1975
|
-
onClick: () => patch(item.id, { entryType:
|
|
1976
|
-
className: `gap-0 font-normal rounded-full border px-2.5 py-1 text-[11px] transition-colors disabled:opacity-60 ${d.entryType ===
|
|
2104
|
+
onClick: () => patch(item.id, { entryType: t2.value }),
|
|
2105
|
+
className: `gap-0 font-normal rounded-full border px-2.5 py-1 text-[11px] transition-colors disabled:opacity-60 ${d.entryType === t2.value ? "border-primary bg-primary text-primary-foreground" : "border-input hover:bg-muted"}`,
|
|
1977
2106
|
children: [
|
|
1978
|
-
|
|
1979
|
-
|
|
2107
|
+
t2.label,
|
|
2108
|
+
t2.hint && /* @__PURE__ */ jsxs("span", { className: "ml-1 opacity-70", children: [
|
|
1980
2109
|
"\xB7 ",
|
|
1981
|
-
|
|
2110
|
+
t2.hint
|
|
1982
2111
|
] })
|
|
1983
2112
|
]
|
|
1984
2113
|
},
|
|
1985
|
-
|
|
2114
|
+
t2.value
|
|
1986
2115
|
)) })
|
|
1987
2116
|
] }),
|
|
1988
2117
|
bearing && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -2103,37 +2232,22 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
2103
2232
|
}
|
|
2104
2233
|
)
|
|
2105
2234
|
] }),
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
] }),
|
|
2123
|
-
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2124
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Falta (qtd)" }),
|
|
2125
|
-
/* @__PURE__ */ jsx(
|
|
2126
|
-
Input,
|
|
2127
|
-
{
|
|
2128
|
-
value: d.shortageQuantity,
|
|
2129
|
-
onChange: (e) => patch(item.id, { shortageQuantity: e.target.value }),
|
|
2130
|
-
inputMode: "decimal",
|
|
2131
|
-
placeholder: "0",
|
|
2132
|
-
disabled: readOnly
|
|
2133
|
-
}
|
|
2134
|
-
)
|
|
2135
|
-
] })
|
|
2136
|
-
] })
|
|
2235
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: /* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2236
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Modo de custo" }),
|
|
2237
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 flex gap-1", children: ["novo", "media"].map((mode) => /* @__PURE__ */ jsx(
|
|
2238
|
+
Button,
|
|
2239
|
+
{
|
|
2240
|
+
variant: "bare",
|
|
2241
|
+
size: "bare",
|
|
2242
|
+
type: "button",
|
|
2243
|
+
disabled: readOnly,
|
|
2244
|
+
onClick: () => patch(item.id, { costMode: mode }),
|
|
2245
|
+
className: `font-normal flex-1 rounded-md border px-2 py-1 text-[11px] disabled:opacity-60 ${d.costMode === mode ? "border-primary bg-primary/10" : "border-input hover:bg-muted"}`,
|
|
2246
|
+
children: mode === "novo" ? "Novo" : "M\xE9dia"
|
|
2247
|
+
},
|
|
2248
|
+
mode
|
|
2249
|
+
)) })
|
|
2250
|
+
] }) })
|
|
2137
2251
|
] }),
|
|
2138
2252
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2139
2253
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Plano de contas" }),
|
|
@@ -2178,6 +2292,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
2178
2292
|
] }, item.id);
|
|
2179
2293
|
})
|
|
2180
2294
|
] }),
|
|
2295
|
+
occurrence.count > 0 && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-warning bg-warning-soft px-3 py-2", "data-testid": "note-receipt-occurrence", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-warning-soft-foreground", children: occurrence.count === 1 ? t("fiscalbr.receipt.occurrence.one", { value: money2(occurrence.value) }) : t("fiscalbr.receipt.occurrence.many", { count: occurrence.count, value: money2(occurrence.value) }) }) }),
|
|
2181
2296
|
/* @__PURE__ */ jsxs(Card, { className: "p-4", children: [
|
|
2182
2297
|
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between", children: [
|
|
2183
2298
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Dados de pagamento" }),
|
|
@@ -2283,6 +2398,24 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
2283
2398
|
error && /* @__PURE__ */ jsx(Card, { className: "border-destructive bg-destructive/5 p-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error }) })
|
|
2284
2399
|
] }), `Concilia\xE7\xE3o \xB7 NF-e ${note.number}`, rodape);
|
|
2285
2400
|
}
|
|
2401
|
+
var decimalText = (v) => String(v).replace(".", ",");
|
|
2402
|
+
function ReceivedInput({ received, onChange }) {
|
|
2403
|
+
const [text, setText] = useState(null);
|
|
2404
|
+
return /* @__PURE__ */ jsx(
|
|
2405
|
+
Input,
|
|
2406
|
+
{
|
|
2407
|
+
value: text ?? (received == null ? "" : decimalText(received)),
|
|
2408
|
+
inputMode: "decimal",
|
|
2409
|
+
onFocus: () => setText(received == null ? "" : decimalText(received)),
|
|
2410
|
+
onBlur: () => setText(null),
|
|
2411
|
+
onChange: (e) => {
|
|
2412
|
+
setText(e.target.value);
|
|
2413
|
+
const got = parseQty(e.target.value);
|
|
2414
|
+
if (got !== null && !Number.isNaN(got) && got >= 0) onChange(got);
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
);
|
|
2418
|
+
}
|
|
2286
2419
|
function AuthorBadge({ draft }) {
|
|
2287
2420
|
if (draft.suggestedBy === "ai") {
|
|
2288
2421
|
const confira = draft.suggestionConfidence != null && draft.suggestionConfidence < 0.6;
|
|
@@ -2310,5 +2443,5 @@ function Field({ label, value, mono, small }) {
|
|
|
2310
2443
|
}
|
|
2311
2444
|
|
|
2312
2445
|
export { NfeParseError, NoteReconcileView, PullByKeyDialog, PullByKeyError, STOCK_BEARING_ENTRY_TYPES, acceptNote, addNoteAttachment, extractPaymentCode, fillInboxLines, findInboxNoteByNumber, findInboxNoteByOperation, getInboxIntakeHealth, getInboxNote, getInboxNotePdf, getInboxNoteXml, getNotePayable, healInboxNote, isStockBearing, linkInboxSupplier, listChartAccounts, listInboxNotes, listMeasurementUnits, listNoteAttachments, listProductStockUnits, listProductsByIds, listStockLocations, listSupplierMap, moveNoteAttachmentsToInvoice, onlyDigits, parseBoleto, parseNfeXml, paymentLabel, paymentTypeFromCode, pullNoteByKey, rejectNote, removeNoteAttachment, saveNoteDecision, searchProducts, stageNoteFromXml, suggestNoteItems, syncNewNotes, toStagePayload };
|
|
2313
|
-
//# sourceMappingURL=chunk-
|
|
2314
|
-
//# sourceMappingURL=chunk-
|
|
2446
|
+
//# sourceMappingURL=chunk-TZH7AWBD.js.map
|
|
2447
|
+
//# sourceMappingURL=chunk-TZH7AWBD.js.map
|