@happyvertical/smrt-commerce 0.56.0 → 0.56.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/AGENTS.md +9 -8
- package/README.md +76 -0
- package/agents/accounting-snapshot-mapper.md +111 -0
- package/agents/contract-money.md +18 -0
- package/agents/cost-billing.md +7 -2
- package/agents/document-money.md +126 -0
- package/agents/invoice-calculations.md +14 -2
- package/agents/line-amount-migration.md +50 -0
- package/agents/minor-unit-migration.md +20 -0
- package/agents/money-calculator.md +45 -0
- package/agents/money-model.md +113 -0
- package/agents/revenue-journal.md +23 -0
- package/agents/tax-codes.md +48 -0
- package/agents/tax-summary.md +126 -0
- package/dist/accounting-snapshot.d.ts +79 -0
- package/dist/accounting-snapshot.d.ts.map +1 -0
- package/dist/billing/runtime.d.ts +2 -0
- package/dist/billing/runtime.d.ts.map +1 -1
- package/dist/chunks/ContractLineItemCollection-DYjhj_pU.js +265 -0
- package/dist/chunks/ContractLineItemCollection-DYjhj_pU.js.map +1 -0
- package/dist/chunks/CustomerCollection-DQIujn4f.js +99 -0
- package/dist/chunks/CustomerCollection-DQIujn4f.js.map +1 -0
- package/dist/chunks/DocumentTaxCollection-BEpoqXAQ.js +1639 -0
- package/dist/chunks/DocumentTaxCollection-BEpoqXAQ.js.map +1 -0
- package/dist/chunks/InvoiceCollection-CKQflFjc.js +1047 -0
- package/dist/chunks/InvoiceCollection-CKQflFjc.js.map +1 -0
- package/dist/chunks/InvoiceLineItemCollection-CHm9zdqh.js +467 -0
- package/dist/chunks/InvoiceLineItemCollection-CHm9zdqh.js.map +1 -0
- package/dist/chunks/TaxCodeCollection-DOpzW4y8.js +149 -0
- package/dist/chunks/TaxCodeCollection-DOpzW4y8.js.map +1 -0
- package/dist/chunks/TaxComponentCollection-Cs2uXwEl.js +129 -0
- package/dist/chunks/TaxComponentCollection-Cs2uXwEl.js.map +1 -0
- package/dist/chunks/TaxSettingsCollection-BBTZDH1S.js +319 -0
- package/dist/chunks/TaxSettingsCollection-BBTZDH1S.js.map +1 -0
- package/dist/chunks/{money-DfrRxrel.js → allocation-integrity-DI3G16BN.js} +7 -12
- package/dist/chunks/allocation-integrity-DI3G16BN.js.map +1 -0
- package/dist/chunks/{calculations-Bz7RB3qK.js → calculations-DaHR17il.js} +134 -54
- package/dist/chunks/calculations-DaHR17il.js.map +1 -0
- package/dist/chunks/credit-allocation-yspz0Lab.js +121 -0
- package/dist/chunks/credit-allocation-yspz0Lab.js.map +1 -0
- package/dist/chunks/document-money-DNVhDJyC.js +860 -0
- package/dist/chunks/document-money-DNVhDJyC.js.map +1 -0
- package/dist/chunks/invoice-posting-BwV8g7z0.js +229 -0
- package/dist/chunks/invoice-posting-BwV8g7z0.js.map +1 -0
- package/dist/chunks/money-rational-CcW7gzG5.js +64 -0
- package/dist/chunks/money-rational-CcW7gzG5.js.map +1 -0
- package/dist/chunks/revenue-journal-DY9fro8E.js +140 -0
- package/dist/chunks/revenue-journal-DY9fro8E.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/tenant-money-barrier-DjRXgMnX.js +135 -0
- package/dist/chunks/tenant-money-barrier-DjRXgMnX.js.map +1 -0
- package/dist/chunks/{types-zVnIjSOk.js → types-LDETvQ1C.js} +3 -14
- package/dist/chunks/types-LDETvQ1C.js.map +1 -0
- package/dist/chunks/{units-BpZ0_Dpk.js → units-CNcjH_eE.js} +2 -2
- package/dist/chunks/{units-BpZ0_Dpk.js.map → units-CNcjH_eE.js.map} +1 -1
- package/dist/collections/ContractCollection.d.ts +35 -1
- package/dist/collections/ContractCollection.d.ts.map +1 -1
- package/dist/collections/ContractLineItemCollection.d.ts +26 -1
- package/dist/collections/ContractLineItemCollection.d.ts.map +1 -1
- package/dist/collections/DocumentTaxCollection.d.ts +75 -0
- package/dist/collections/DocumentTaxCollection.d.ts.map +1 -0
- package/dist/collections/InvoiceCollection.d.ts +26 -1
- package/dist/collections/InvoiceCollection.d.ts.map +1 -1
- package/dist/collections/InvoiceLineItemCollection.d.ts +26 -1
- package/dist/collections/InvoiceLineItemCollection.d.ts.map +1 -1
- package/dist/collections/MoneyMigrationDocumentCollection.d.ts +12 -0
- package/dist/collections/MoneyMigrationDocumentCollection.d.ts.map +1 -0
- package/dist/collections/PaymentAllocationCollection.d.ts +2 -0
- package/dist/collections/PaymentAllocationCollection.d.ts.map +1 -1
- package/dist/collections/TaxCodeCollection.d.ts +7 -0
- package/dist/collections/TaxCodeCollection.d.ts.map +1 -0
- package/dist/collections/TaxComponentCollection.d.ts +6 -0
- package/dist/collections/TaxComponentCollection.d.ts.map +1 -0
- package/dist/collections/TaxSettingsCollection.d.ts +16 -0
- package/dist/collections/TaxSettingsCollection.d.ts.map +1 -0
- package/dist/collections/TaxSummaryReportCollection.d.ts +151 -0
- package/dist/collections/TaxSummaryReportCollection.d.ts.map +1 -0
- package/dist/collections/index.d.ts +6 -0
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/commerce-money-tools.d.ts +9 -0
- package/dist/commerce-money-tools.d.ts.map +1 -0
- package/dist/contract-money.d.ts +27 -0
- package/dist/contract-money.d.ts.map +1 -0
- package/dist/cost-billing.d.ts +0 -1
- package/dist/cost-billing.d.ts.map +1 -1
- package/dist/cost-billing.js +10 -15
- package/dist/cost-billing.js.map +1 -1
- package/dist/credit-allocation.d.ts +48 -0
- package/dist/credit-allocation.d.ts.map +1 -0
- package/dist/document-money-internal.d.ts +44 -0
- package/dist/document-money-internal.d.ts.map +1 -0
- package/dist/document-money.d.ts +85 -0
- package/dist/document-money.d.ts.map +1 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5395 -4246
- package/dist/index.js.map +1 -1
- package/dist/invoice-accounting-sync.d.ts +96 -0
- package/dist/invoice-accounting-sync.d.ts.map +1 -0
- package/dist/invoice-mcp.d.ts +16 -0
- package/dist/invoice-mcp.d.ts.map +1 -0
- package/dist/invoice-posting.d.ts +9 -0
- package/dist/invoice-posting.d.ts.map +1 -0
- package/dist/invoice-record-screen.d.ts +60 -0
- package/dist/invoice-record-screen.d.ts.map +1 -0
- package/dist/invoices.d.ts +2 -0
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +3 -2
- package/dist/manifest.json +10365 -4562
- package/dist/migrations/commerceLineAmounts.d.ts +84 -0
- package/dist/migrations/commerceLineAmounts.d.ts.map +1 -0
- package/dist/models/Contract.d.ts +25 -1
- package/dist/models/Contract.d.ts.map +1 -1
- package/dist/models/ContractLineItem.d.ts +30 -1
- package/dist/models/ContractLineItem.d.ts.map +1 -1
- package/dist/models/Customer.d.ts +7 -0
- package/dist/models/Customer.d.ts.map +1 -1
- package/dist/models/DocumentTax.d.ts +50 -0
- package/dist/models/DocumentTax.d.ts.map +1 -0
- package/dist/models/Invoice.d.ts +46 -2
- package/dist/models/Invoice.d.ts.map +1 -1
- package/dist/models/InvoiceLineItem.d.ts +33 -2
- package/dist/models/InvoiceLineItem.d.ts.map +1 -1
- package/dist/models/MoneyMigrationDocument.d.ts +28 -0
- package/dist/models/MoneyMigrationDocument.d.ts.map +1 -0
- package/dist/models/Payment.d.ts +5 -1
- package/dist/models/Payment.d.ts.map +1 -1
- package/dist/models/PaymentAllocation.d.ts.map +1 -1
- package/dist/models/TaxCode.d.ts +22 -0
- package/dist/models/TaxCode.d.ts.map +1 -0
- package/dist/models/TaxComponent.d.ts +21 -0
- package/dist/models/TaxComponent.d.ts.map +1 -0
- package/dist/models/TaxSettings.d.ts +33 -0
- package/dist/models/TaxSettings.d.ts.map +1 -0
- package/dist/models/TaxSummaryReport.d.ts +35 -0
- package/dist/models/TaxSummaryReport.d.ts.map +1 -0
- package/dist/models/Vendor.d.ts +9 -0
- package/dist/models/Vendor.d.ts.map +1 -1
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/money-rational.d.ts +15 -0
- package/dist/money-rational.d.ts.map +1 -0
- package/dist/money.d.ts +106 -25
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +274 -0
- package/dist/money.js.map +1 -0
- package/dist/recipes.d.ts +15 -15
- package/dist/revenue-journal.d.ts +61 -0
- package/dist/revenue-journal.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +5711 -1029
- package/dist/svelte/components/InvoiceActions.svelte +12 -0
- package/dist/svelte/components/InvoiceActions.svelte.d.ts +5 -0
- package/dist/svelte/components/InvoiceActions.svelte.d.ts.map +1 -1
- package/dist/svelte/components/InvoiceEditor.svelte +15 -1
- package/dist/svelte/components/InvoiceEditor.svelte.d.ts.map +1 -1
- package/dist/svelte/components/InvoiceLineItems.svelte +3 -3
- package/dist/svelte/components/InvoiceRecordScreen.svelte +94 -0
- package/dist/svelte/components/InvoiceRecordScreen.svelte.d.ts +21 -0
- package/dist/svelte/components/InvoiceRecordScreen.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InvoiceTotals.svelte +2 -2
- package/dist/svelte/components/MoneyInvoiceEditor.svelte +282 -0
- package/dist/svelte/components/MoneyInvoiceEditor.svelte.d.ts +31 -0
- package/dist/svelte/components/MoneyInvoiceEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PurchaseOrderEditor.svelte +53 -1
- package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts +5 -0
- package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts.map +1 -1
- package/dist/svelte/components/QuoteEditor.svelte +54 -1
- package/dist/svelte/components/QuoteEditor.svelte.d.ts +5 -0
- package/dist/svelte/components/QuoteEditor.svelte.d.ts.map +1 -1
- package/dist/svelte/i18n.d.ts +16 -0
- package/dist/svelte/i18n.d.ts.map +1 -1
- package/dist/svelte/i18n.js +16 -0
- package/dist/svelte/index.d.ts +7 -2
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +4 -1
- package/dist/svelte/invoices/calculations.d.ts +7 -2
- package/dist/svelte/invoices/calculations.d.ts.map +1 -1
- package/dist/svelte/invoices/calculations.js +141 -47
- package/dist/svelte/invoices/money-editor.d.ts +123 -0
- package/dist/svelte/invoices/money-editor.d.ts.map +1 -0
- package/dist/svelte/invoices/money-editor.js +101 -0
- package/dist/svelte/invoices/types.d.ts +5 -1
- package/dist/svelte/invoices/types.d.ts.map +1 -1
- package/dist/svelte/purchasing-i18n.d.ts +5 -0
- package/dist/svelte/purchasing-i18n.d.ts.map +1 -1
- package/dist/svelte/purchasing-i18n.js +5 -0
- package/dist/svelte/quote-i18n.d.ts +5 -0
- package/dist/svelte/quote-i18n.d.ts.map +1 -1
- package/dist/svelte/quote-i18n.js +5 -0
- package/dist/tax/cookbook.d.ts +22 -0
- package/dist/tax/cookbook.d.ts.map +1 -0
- package/dist/tax/example-pack.d.ts +25 -0
- package/dist/tax/example-pack.d.ts.map +1 -0
- package/dist/tax/identity.d.ts +5 -0
- package/dist/tax/identity.d.ts.map +1 -0
- package/dist/tax/index.d.ts +4 -0
- package/dist/tax/index.d.ts.map +1 -0
- package/dist/tax/legacy.d.ts +48 -0
- package/dist/tax/legacy.d.ts.map +1 -0
- package/dist/tax-summary-report-adapter.d.ts +37 -0
- package/dist/tax-summary-report-adapter.d.ts.map +1 -0
- package/dist/tax-summary.d.ts +129 -0
- package/dist/tax-summary.d.ts.map +1 -0
- package/dist/tenant-money-barrier.d.ts +66 -0
- package/dist/tenant-money-barrier.d.ts.map +1 -0
- package/dist/types/index.d.ts +137 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +19 -11
- package/dist/chunks/calculations-Bz7RB3qK.js.map +0 -1
- package/dist/chunks/money-DfrRxrel.js.map +0 -1
- package/dist/chunks/types-zVnIjSOk.js.map +0 -1
|
@@ -11,6 +11,7 @@ import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
|
11
11
|
import { Button } from '@happyvertical/smrt-ui/ui';
|
|
12
12
|
import type { Snippet } from 'svelte';
|
|
13
13
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
14
|
+
import type { MoneyHeaderDisplay } from '../invoices/money-editor.js';
|
|
14
15
|
import { P } from '../purchasing-i18n.js';
|
|
15
16
|
import {
|
|
16
17
|
type PurchaseDraftValues,
|
|
@@ -78,6 +79,10 @@ export interface Props {
|
|
|
78
79
|
extensions?: Snippet;
|
|
79
80
|
/** Authorized private attachment surface outside the editor form; never loaded by Commerce. */
|
|
80
81
|
attachments?: Snippet;
|
|
82
|
+
/** Explicit v2 stored header facts; no totals are recomputed in this surface. */
|
|
83
|
+
money?: MoneyHeaderDisplay;
|
|
84
|
+
/** Native field name for the explicit document mode. */
|
|
85
|
+
moneyFieldName?: string;
|
|
81
86
|
}
|
|
82
87
|
let {
|
|
83
88
|
operation = 'create',
|
|
@@ -109,9 +114,16 @@ let {
|
|
|
109
114
|
formAttributes = {},
|
|
110
115
|
extensions,
|
|
111
116
|
attachments,
|
|
117
|
+
money: moneyDisplay,
|
|
118
|
+
moneyFieldName = 'lineAmountType',
|
|
112
119
|
}: Props = $props();
|
|
113
120
|
const { t } = useI18n();
|
|
114
121
|
const fields = $derived({ ...purchaseFieldNames, ...names });
|
|
122
|
+
function normalizedMoneyText(value: string): string | null {
|
|
123
|
+
if (!/^\d+(?:\.\d+)?$/u.test(value)) return null;
|
|
124
|
+
const [whole, fraction = ''] = value.split('.');
|
|
125
|
+
return `${whole.replace(/^0+(?=\d)/u, '') || '0'}.${fraction.replace(/0+$/u, '') || '0'}`;
|
|
126
|
+
}
|
|
115
127
|
const title = $derived(
|
|
116
128
|
labels.title ??
|
|
117
129
|
t(
|
|
@@ -136,6 +148,44 @@ function displayMoney(value: QuoteMoneyMinor): string {
|
|
|
136
148
|
}
|
|
137
149
|
const money = (amountMinor: number | null) =>
|
|
138
150
|
displayMoney({ currency, minorUnitDigits, amountMinor });
|
|
151
|
+
function lineAmountTypeText(
|
|
152
|
+
lineAmountType: MoneyHeaderDisplay['lineAmountType'],
|
|
153
|
+
): string {
|
|
154
|
+
return t(
|
|
155
|
+
P[
|
|
156
|
+
lineAmountType === 'inclusive'
|
|
157
|
+
? 'commerce.purchase.tax_inclusive'
|
|
158
|
+
: lineAmountType === 'exclusive'
|
|
159
|
+
? 'commerce.purchase.tax_exclusive'
|
|
160
|
+
: 'commerce.purchase.no_tax'
|
|
161
|
+
],
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function calculatedTaxError(
|
|
165
|
+
enteredTax: string,
|
|
166
|
+
hasLines: boolean,
|
|
167
|
+
header: MoneyHeaderDisplay | undefined,
|
|
168
|
+
headerCurrency: string,
|
|
169
|
+
): string | undefined {
|
|
170
|
+
if (!header || !hasLines) return undefined;
|
|
171
|
+
const calculatedTax = quoteMinorText({
|
|
172
|
+
currency: headerCurrency,
|
|
173
|
+
minorUnitDigits: header.minorUnitDigits,
|
|
174
|
+
amountMinor: header.taxMinor,
|
|
175
|
+
});
|
|
176
|
+
return normalizedMoneyText(enteredTax) ===
|
|
177
|
+
normalizedMoneyText(calculatedTax ?? '')
|
|
178
|
+
? undefined
|
|
179
|
+
: 'Tax must match calculated line tax.';
|
|
180
|
+
}
|
|
181
|
+
const moneyTaxError = $derived.by(() =>
|
|
182
|
+
calculatedTaxError(
|
|
183
|
+
values.tax,
|
|
184
|
+
values.allocations.length > 0,
|
|
185
|
+
moneyDisplay,
|
|
186
|
+
currency,
|
|
187
|
+
),
|
|
188
|
+
);
|
|
139
189
|
</script>
|
|
140
190
|
<section class="purchase-editor" aria-label={title} data-smrt-component="PurchaseOrderEditor">
|
|
141
191
|
<h2>{title}</h2>
|
|
@@ -144,9 +194,11 @@ const money = (amountMinor: number | null) =>
|
|
|
144
194
|
{#if source.notice}<p role="status">{source.notice}</p>{/if}
|
|
145
195
|
{#if operation==='reduce'}<p>{t(P['commerce.purchase.reduction_hint'])}</p>{/if}
|
|
146
196
|
{#if readonly}<p>{t(P['commerce.purchase.readonly'])}</p>{/if}
|
|
197
|
+
{#if moneyDisplay}<p>{t(P['commerce.purchase.money_amounts_are'], { amountType: lineAmountTypeText(moneyDisplay.lineAmountType) })}</p>{#if moneyDisplay.lineAmountType === 'inclusive' && moneyDisplay.taxMinor !== 0}<p>{t(P['commerce.purchase.money_includes_tax'], { amount: displayMoney({currency, minorUnitDigits: moneyDisplay.minorUnitDigits, amountMinor: moneyDisplay.taxMinor}), currency })}</p>{/if}{/if}
|
|
147
198
|
{#if message}<p role="alert">{message}</p>{/if}
|
|
148
199
|
<Form {...formAttributes} {action} method="post" {onsubmit} preventDefault={false}>
|
|
149
200
|
{#each hiddenFields as field}<Input type="hidden" name={field.name} value={field.value} />{/each}
|
|
201
|
+
{#if moneyDisplay}<Input type="hidden" name={moneyFieldName} value={moneyDisplay.lineAmountType} />{/if}
|
|
150
202
|
<fieldset disabled={readonly || busy || source.disabled}>
|
|
151
203
|
<legend>{title}</legend>
|
|
152
204
|
<!-- The first submitter is the safe default for native Enter-in-input submission. -->
|
|
@@ -174,7 +226,7 @@ const money = (amountMinor: number | null) =>
|
|
|
174
226
|
{:else}<p>{t(P['commerce.purchase.empty_allocations'])}</p>{/each}
|
|
175
227
|
{#if rowActions && !readonly}<Button type="submit" name={intents.name} value={rowActions.add} formnovalidate variant="secondary" density="touch">{t(P['commerce.purchase.add'])}</Button>{/if}
|
|
176
228
|
</fieldset>
|
|
177
|
-
<FormGroup label={`${t(P['commerce.purchase.tax'])} (${currency})`} error={errors.tax} required><Input name={fields.tax} value={values.tax} inputmode="decimal" required density="touch" /></FormGroup>
|
|
229
|
+
<FormGroup label={`${t(P['commerce.purchase.tax'])} (${currency})`} error={errors.tax ?? moneyTaxError} required><Input name={fields.tax} value={values.tax} inputmode="decimal" required density="touch" /></FormGroup>
|
|
178
230
|
{#each [{key:'scope',label:'commerce.purchase.scope'}, {key:'inclusions',label:'commerce.purchase.inclusions'}, {key:'exclusions',label:'commerce.purchase.exclusions'}, {key:'reason',label:'commerce.purchase.reason'}] as field}
|
|
179
231
|
<FormGroup label={t(P[field.label as keyof typeof P])} error={errors[field.key]} required={field.key==='scope' || field.key==='reason'}><Textarea name={fields[field.key as keyof PurchaseFieldNames]} value={values[field.key as 'scope']} required={field.key==='scope' || field.key==='reason'} /></FormGroup>
|
|
180
232
|
{/each}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
3
|
+
import type { MoneyHeaderDisplay } from '../invoices/money-editor.js';
|
|
3
4
|
import { type PurchaseDraftValues, type PurchaseFieldNames, type PurchaseReviewSnapshot, type PurchaseSourceOption } from '../purchasing-types.js';
|
|
4
5
|
import type { QuoteFormAttributes } from './QuoteEditor.svelte';
|
|
5
6
|
/** Native purchase/award preparation, review and explicit confirmation; never writes a record. */
|
|
@@ -72,6 +73,10 @@ export interface Props {
|
|
|
72
73
|
extensions?: Snippet;
|
|
73
74
|
/** Authorized private attachment surface outside the editor form; never loaded by Commerce. */
|
|
74
75
|
attachments?: Snippet;
|
|
76
|
+
/** Explicit v2 stored header facts; no totals are recomputed in this surface. */
|
|
77
|
+
money?: MoneyHeaderDisplay;
|
|
78
|
+
/** Native field name for the explicit document mode. */
|
|
79
|
+
moneyFieldName?: string;
|
|
75
80
|
}
|
|
76
81
|
declare const PurchaseOrderEditor: import("svelte").Component<Props, {}, "">;
|
|
77
82
|
type PurchaseOrderEditor = ReturnType<typeof PurchaseOrderEditor>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseOrderEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/PurchaseOrderEditor.svelte.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"PurchaseOrderEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/PurchaseOrderEditor.svelte.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,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import type { Snippet } from 'svelte';
|
|
14
14
|
import type { Attachment } from 'svelte/attachments';
|
|
15
15
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
16
|
+
import type { MoneyHeaderDisplay } from '../invoices/money-editor.js';
|
|
16
17
|
import { Q } from '../quote-i18n.js';
|
|
17
18
|
import {
|
|
18
19
|
type QuoteDocumentKind,
|
|
19
20
|
type QuoteDraftValues,
|
|
20
21
|
type QuoteFieldNames,
|
|
21
22
|
quoteFieldNames,
|
|
23
|
+
quoteMinorText,
|
|
22
24
|
} from '../quote-types.js';
|
|
23
25
|
|
|
24
26
|
/** Narrow native attributes and Svelte attachment keys; avoids recursive HTML prop unions. */
|
|
@@ -73,6 +75,10 @@ export interface Props {
|
|
|
73
75
|
extensions?: Snippet;
|
|
74
76
|
/** Authorized attachment composition; this component never loads private files. */
|
|
75
77
|
attachments?: Snippet;
|
|
78
|
+
/** Explicit v2 stored header facts; this editor never recomputes them. */
|
|
79
|
+
money?: MoneyHeaderDisplay;
|
|
80
|
+
/** Native field name for the explicit document mode. */
|
|
81
|
+
moneyFieldName?: string;
|
|
76
82
|
}
|
|
77
83
|
let {
|
|
78
84
|
kind,
|
|
@@ -99,10 +105,55 @@ let {
|
|
|
99
105
|
formAttributes = {},
|
|
100
106
|
extensions,
|
|
101
107
|
attachments,
|
|
108
|
+
money,
|
|
109
|
+
moneyFieldName = 'lineAmountType',
|
|
102
110
|
}: Props = $props();
|
|
103
111
|
const i18n = useI18n();
|
|
104
112
|
const { t } = i18n;
|
|
105
113
|
const fields = $derived({ ...quoteFieldNames, ...names });
|
|
114
|
+
function lineAmountTypeText(
|
|
115
|
+
lineAmountType: MoneyHeaderDisplay['lineAmountType'],
|
|
116
|
+
): string {
|
|
117
|
+
return t(
|
|
118
|
+
Q[
|
|
119
|
+
lineAmountType === 'inclusive'
|
|
120
|
+
? 'commerce.quote.tax_inclusive'
|
|
121
|
+
: lineAmountType === 'exclusive'
|
|
122
|
+
? 'commerce.quote.tax_exclusive'
|
|
123
|
+
: 'commerce.quote.no_tax'
|
|
124
|
+
],
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function normalizedMoneyText(value: string): string | null {
|
|
128
|
+
if (!/^\d+(?:\.\d+)?$/u.test(value)) return null;
|
|
129
|
+
const [whole, fraction = ''] = value.split('.');
|
|
130
|
+
return `${whole.replace(/^0+(?=\d)/u, '') || '0'}.${fraction.replace(/0+$/u, '') || '0'}`;
|
|
131
|
+
}
|
|
132
|
+
function calculatedTaxError(
|
|
133
|
+
enteredTax: string,
|
|
134
|
+
hasLines: boolean,
|
|
135
|
+
header: MoneyHeaderDisplay | undefined,
|
|
136
|
+
headerCurrency: string,
|
|
137
|
+
): string | undefined {
|
|
138
|
+
if (!header || !hasLines) return undefined;
|
|
139
|
+
const calculatedTax = quoteMinorText({
|
|
140
|
+
currency: headerCurrency,
|
|
141
|
+
minorUnitDigits: header.minorUnitDigits,
|
|
142
|
+
amountMinor: header.taxMinor,
|
|
143
|
+
});
|
|
144
|
+
return normalizedMoneyText(enteredTax) ===
|
|
145
|
+
normalizedMoneyText(calculatedTax ?? '')
|
|
146
|
+
? undefined
|
|
147
|
+
: 'Tax must match calculated line tax.';
|
|
148
|
+
}
|
|
149
|
+
const moneyTaxError = $derived.by(() =>
|
|
150
|
+
calculatedTaxError(
|
|
151
|
+
values.tax,
|
|
152
|
+
values.lines.length > 0,
|
|
153
|
+
money,
|
|
154
|
+
values.currency,
|
|
155
|
+
),
|
|
156
|
+
);
|
|
106
157
|
const title = $derived(
|
|
107
158
|
labels.title ??
|
|
108
159
|
t(
|
|
@@ -118,10 +169,12 @@ const title = $derived(
|
|
|
118
169
|
<section class="quote-editor" aria-label={title} data-smrt-component="QuoteEditor">
|
|
119
170
|
<h2>{title}</h2>
|
|
120
171
|
<p>{t(Q[kind === 'vendor-quotation' ? 'commerce.quote.vendor_hint' : 'commerce.quote.estimate_hint'])}</p>
|
|
172
|
+
{#if money}<p>{t(Q['commerce.quote.money_amounts_are'], { amountType: lineAmountTypeText(money.lineAmountType) })}</p>{#if money.lineAmountType === 'inclusive' && money.taxMinor !== 0}<p>{t(Q['commerce.quote.money_includes_tax'], { amount: quoteMinorText({currency: values.currency, minorUnitDigits: money.minorUnitDigits, amountMinor: money.taxMinor}) })}</p>{/if}{/if}
|
|
121
173
|
{#if readonly}<p>{t(Q['commerce.quote.readonly'])}</p>{/if}
|
|
122
174
|
{#if message}<p role="alert">{message}</p>{/if}
|
|
123
175
|
<Form {...formAttributes} {action} {method} {onsubmit} preventDefault={false}>
|
|
124
176
|
{#each hiddenFields as field}<Input type="hidden" name={field.name} value={field.value} />{/each}
|
|
177
|
+
{#if money}<Input type="hidden" name={moneyFieldName} value={money.lineAmountType} />{/if}
|
|
125
178
|
<fieldset disabled={readonly || busy}>
|
|
126
179
|
<legend>{title}</legend>
|
|
127
180
|
{#if !readonly}<div class="actions"><Button type="submit" name={intents.name} value={intents.save} density="touch">{labels.save ?? t(Q['commerce.quote.save'])}</Button></div>{/if}
|
|
@@ -133,7 +186,7 @@ const title = $derived(
|
|
|
133
186
|
</Select>
|
|
134
187
|
</FormGroup>
|
|
135
188
|
{#each [{key:'reference',label:'commerce.quote.reference'}, {key:'date',label:'commerce.quote.date'}, {key:'validUntil',label:'commerce.quote.expiry'}, {key:'currency',label:'commerce.quote.currency'}, {key:'total',label:'commerce.quote.total'}, {key:'tax',label:'commerce.quote.tax'}] as field}
|
|
136
|
-
<FormGroup label={t(Q[field.label as keyof typeof Q])} error={errors[field.key]}>
|
|
189
|
+
<FormGroup label={t(Q[field.label as keyof typeof Q])} error={field.key === 'tax' ? errors.tax ?? moneyTaxError : errors[field.key]}>
|
|
137
190
|
{#if field.key === 'currency'}
|
|
138
191
|
<CurrencySelect name={fields.currency} value={values.currency} options={currencyOptions} locale={i18n.locale} readOnly={readonly} disabled={busy} density="touch" />
|
|
139
192
|
{:else}
|
|
@@ -2,6 +2,7 @@ import type { CodeSelectOption } from '@happyvertical/smrt-ui/forms';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { Attachment } from 'svelte/attachments';
|
|
4
4
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
5
|
+
import type { MoneyHeaderDisplay } from '../invoices/money-editor.js';
|
|
5
6
|
import { type QuoteDocumentKind, type QuoteDraftValues, type QuoteFieldNames } from '../quote-types.js';
|
|
6
7
|
/** Narrow native attributes and Svelte attachment keys; avoids recursive HTML prop unions. */
|
|
7
8
|
export interface QuoteFormAttributes {
|
|
@@ -69,6 +70,10 @@ export interface Props {
|
|
|
69
70
|
extensions?: Snippet;
|
|
70
71
|
/** Authorized attachment composition; this component never loads private files. */
|
|
71
72
|
attachments?: Snippet;
|
|
73
|
+
/** Explicit v2 stored header facts; this editor never recomputes them. */
|
|
74
|
+
money?: MoneyHeaderDisplay;
|
|
75
|
+
/** Native field name for the explicit document mode. */
|
|
76
|
+
moneyFieldName?: string;
|
|
72
77
|
}
|
|
73
78
|
declare const QuoteEditor: import("svelte").Component<Props, {}, "">;
|
|
74
79
|
type QuoteEditor = ReturnType<typeof QuoteEditor>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/QuoteEditor.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAWrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"QuoteEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/QuoteEditor.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAWrE,OAAO,KAAK,EAAE,OAA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AAC,CAAC;IAChC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mFAAmF;IACnF,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,oDAAoD;IACpD,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,gFAAgF;IAChF,eAAe,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC1C,+FAA+F;IAC/F,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,+EAA+E;IAC/E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mFAAmF;IACnF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAgKD,QAAA,MAAM,WAAW,2CAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
package/dist/svelte/i18n.d.ts
CHANGED
|
@@ -113,16 +113,32 @@ export declare const M: {
|
|
|
113
113
|
readonly 'commerce.select.clear': "commerce.select.clear";
|
|
114
114
|
readonly 'commerce.invoice_actions.send_invoice': "commerce.invoice_actions.send_invoice";
|
|
115
115
|
readonly 'commerce.invoice_actions.mark_as_paid': "commerce.invoice_actions.mark_as_paid";
|
|
116
|
+
readonly 'commerce.invoice_actions.create_credit_note': "commerce.invoice_actions.create_credit_note";
|
|
116
117
|
readonly 'commerce.invoice_header.issue_date': "commerce.invoice_header.issue_date";
|
|
117
118
|
readonly 'commerce.invoice_header.due_date': "commerce.invoice_header.due_date";
|
|
118
119
|
readonly 'commerce.invoice_header.paid_date': "commerce.invoice_header.paid_date";
|
|
119
120
|
readonly 'commerce.invoice_line_items.add_item': "commerce.invoice_line_items.add_item";
|
|
120
121
|
readonly 'commerce.invoice_line_items.unit_price': "commerce.invoice_line_items.unit_price";
|
|
122
|
+
readonly 'commerce.invoice_line_items.line_total': "commerce.invoice_line_items.line_total";
|
|
121
123
|
readonly 'commerce.invoice_line_items.remove_item': "commerce.invoice_line_items.remove_item";
|
|
122
124
|
readonly 'commerce.invoice_totals.amount_paid': "commerce.invoice_totals.amount_paid";
|
|
123
125
|
readonly 'commerce.invoice_totals.balance_due': "commerce.invoice_totals.balance_due";
|
|
124
126
|
readonly 'commerce.invoice_totals.credit': "commerce.invoice_totals.credit";
|
|
125
127
|
readonly 'commerce.invoice_totals.paid_in_full': "commerce.invoice_totals.paid_in_full";
|
|
128
|
+
readonly 'commerce.invoice_record.credit_notes': "commerce.invoice_record.credit_notes";
|
|
129
|
+
readonly 'commerce.invoice_money.aria_label': "commerce.invoice_money.aria_label";
|
|
130
|
+
readonly 'commerce.invoice_money.amounts_are': "commerce.invoice_money.amounts_are";
|
|
131
|
+
readonly 'commerce.invoice_money.tax_exclusive': "commerce.invoice_money.tax_exclusive";
|
|
132
|
+
readonly 'commerce.invoice_money.tax_inclusive': "commerce.invoice_money.tax_inclusive";
|
|
133
|
+
readonly 'commerce.invoice_money.no_tax': "commerce.invoice_money.no_tax";
|
|
134
|
+
readonly 'commerce.invoice_money.exempt_inclusive': "commerce.invoice_money.exempt_inclusive";
|
|
135
|
+
readonly 'commerce.invoice_money.line': "commerce.invoice_money.line";
|
|
136
|
+
readonly 'commerce.invoice_money.unit_price': "commerce.invoice_money.unit_price";
|
|
137
|
+
readonly 'commerce.invoice_money.discount_type': "commerce.invoice_money.discount_type";
|
|
138
|
+
readonly 'commerce.invoice_money.tax_code': "commerce.invoice_money.tax_code";
|
|
139
|
+
readonly 'commerce.invoice_money.exempt_override': "commerce.invoice_money.exempt_override";
|
|
140
|
+
readonly 'commerce.invoice_money.includes_discounts': "commerce.invoice_money.includes_discounts";
|
|
141
|
+
readonly 'commerce.invoice_money.rounded_document': "commerce.invoice_money.rounded_document";
|
|
126
142
|
readonly 'commerce.unbilled_items.select_all': "commerce.unbilled_items.select_all";
|
|
127
143
|
readonly 'commerce.unbilled_items.selected_count': "commerce.unbilled_items.selected_count";
|
|
128
144
|
readonly 'commerce.unbilled_items.selected_total': "commerce.unbilled_items.selected_total";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/svelte/i18n.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/svelte/i18n.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuJZ,CAAC"}
|
package/dist/svelte/i18n.js
CHANGED
|
@@ -114,16 +114,32 @@ export const M = defineMessages({
|
|
|
114
114
|
'commerce.select.clear': 'Clear {label}',
|
|
115
115
|
'commerce.invoice_actions.send_invoice': 'Send Invoice',
|
|
116
116
|
'commerce.invoice_actions.mark_as_paid': 'Mark as Paid',
|
|
117
|
+
'commerce.invoice_actions.create_credit_note': 'Create credit note',
|
|
117
118
|
'commerce.invoice_header.issue_date': 'Issue Date',
|
|
118
119
|
'commerce.invoice_header.due_date': 'Due Date',
|
|
119
120
|
'commerce.invoice_header.paid_date': 'Paid Date',
|
|
120
121
|
'commerce.invoice_line_items.add_item': 'Add Item',
|
|
121
122
|
'commerce.invoice_line_items.unit_price': 'Unit Price',
|
|
123
|
+
'commerce.invoice_line_items.line_total': 'Line total',
|
|
122
124
|
'commerce.invoice_line_items.remove_item': 'Remove item',
|
|
123
125
|
'commerce.invoice_totals.amount_paid': 'Amount Paid',
|
|
124
126
|
'commerce.invoice_totals.balance_due': 'Balance Due',
|
|
125
127
|
'commerce.invoice_totals.credit': 'Credit',
|
|
126
128
|
'commerce.invoice_totals.paid_in_full': 'Paid in Full',
|
|
129
|
+
'commerce.invoice_record.credit_notes': 'Credit notes',
|
|
130
|
+
'commerce.invoice_money.aria_label': 'Invoice money',
|
|
131
|
+
'commerce.invoice_money.amounts_are': 'Amounts are',
|
|
132
|
+
'commerce.invoice_money.tax_exclusive': 'Tax exclusive',
|
|
133
|
+
'commerce.invoice_money.tax_inclusive': 'Tax inclusive',
|
|
134
|
+
'commerce.invoice_money.no_tax': 'No tax',
|
|
135
|
+
'commerce.invoice_money.exempt_inclusive': 'Customer is exempt: prices unchanged, no tax extracted.',
|
|
136
|
+
'commerce.invoice_money.line': 'Invoice line {number}',
|
|
137
|
+
'commerce.invoice_money.unit_price': 'Unit price',
|
|
138
|
+
'commerce.invoice_money.discount_type': 'Discount type',
|
|
139
|
+
'commerce.invoice_money.tax_code': 'Tax code',
|
|
140
|
+
'commerce.invoice_money.exempt_override': 'Customer is exempt; this line is taxed by override.',
|
|
141
|
+
'commerce.invoice_money.includes_discounts': 'Includes discounts of',
|
|
142
|
+
'commerce.invoice_money.rounded_document': 'Rounded per document',
|
|
127
143
|
'commerce.unbilled_items.select_all': 'Select All',
|
|
128
144
|
'commerce.unbilled_items.selected_count': '{selected} of {total} selected',
|
|
129
145
|
'commerce.unbilled_items.selected_total': 'Selected Total:',
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import InvoiceActions from './components/InvoiceActions.svelte';
|
|
|
26
26
|
import InvoiceCard from './components/InvoiceCard.svelte';
|
|
27
27
|
import InvoiceHeader from './components/InvoiceHeader.svelte';
|
|
28
28
|
import InvoiceLineItems from './components/InvoiceLineItems.svelte';
|
|
29
|
+
import type InvoiceRecordScreen from './components/InvoiceRecordScreen.svelte';
|
|
29
30
|
import InvoiceTotals from './components/InvoiceTotals.svelte';
|
|
30
31
|
import PartyContactFields from './components/PartyContactFields.svelte';
|
|
31
32
|
import UnbilledItems from './components/UnbilledItems.svelte';
|
|
@@ -51,6 +52,8 @@ export type InvoiceHeaderProps = ComponentProps<typeof InvoiceHeader>;
|
|
|
51
52
|
export { default as InvoiceHeader } from './components/InvoiceHeader.svelte';
|
|
52
53
|
export type InvoiceLineItemsProps = ComponentProps<typeof InvoiceLineItems>;
|
|
53
54
|
export { default as InvoiceLineItems } from './components/InvoiceLineItems.svelte';
|
|
55
|
+
export type InvoiceRecordScreenProps = ComponentProps<typeof InvoiceRecordScreen>;
|
|
56
|
+
export { default as InvoiceRecordScreen } from './components/InvoiceRecordScreen.svelte';
|
|
54
57
|
export type InvoiceTotalsProps = ComponentProps<typeof InvoiceTotals>;
|
|
55
58
|
export { default as InvoiceTotals } from './components/InvoiceTotals.svelte';
|
|
56
59
|
export type UnbilledItemsProps = ComponentProps<typeof UnbilledItems>;
|
|
@@ -87,9 +90,11 @@ import InvoiceAllocationFields from './components/InvoiceAllocationFields.svelte
|
|
|
87
90
|
import InvoiceEditor from './components/InvoiceEditor.svelte';
|
|
88
91
|
import InvoiceLineEditor from './components/InvoiceLineEditor.svelte';
|
|
89
92
|
import InvoiceReview from './components/InvoiceReview.svelte';
|
|
90
|
-
|
|
93
|
+
import MoneyInvoiceEditor from './components/MoneyInvoiceEditor.svelte';
|
|
94
|
+
export { InvoiceAllocationFields, InvoiceEditor, InvoiceLineEditor, InvoiceReview, MoneyInvoiceEditor, };
|
|
91
95
|
export type InvoiceReviewProps = ComponentProps<typeof InvoiceReview>;
|
|
92
|
-
export
|
|
96
|
+
export { calculateMoneyEditorDraft, moneyEditorFieldNames, moneyEditorSubmission, } from './invoices/money-editor.js';
|
|
97
|
+
export type { InvoiceAllocationDraft, InvoiceAllocationFieldsProps, InvoiceDraftValues, InvoiceEditorProps, InvoiceFieldNames, InvoiceLineDraft, InvoiceLineEditorProps, InvoiceLineFieldNames, InvoicePreparationFields, InvoicePreparationHiddenField, InvoicePreparationReview, InvoicePreparationSource, MoneyEditorDraft, MoneyEditorFieldNames, MoneyEditorLineDraft, MoneyEditorProps, MoneyEditorTaxCode, MoneyStoredDocument, MoneyStoredTax, } from './invoices/types.js';
|
|
93
98
|
import PurchaseOrderEditor from './components/PurchaseOrderEditor.svelte';
|
|
94
99
|
import PurchaseSourceSelector from './components/PurchaseSourceSelector.svelte';
|
|
95
100
|
export { PurchaseOrderEditor, PurchaseSourceSelector };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svelte/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAI7C,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAC5D,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,WAAW,MAAM,iCAAiC,CAAC;AAC1D,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,kBAAkB,MAAM,wCAAwC,CAAC;AACxE,OAAO,aAAa,MAAM,mC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AuB,EAAE,CAAC;AACnC,MAAM,MAAM,4BAA4B,GAAG,cAAc,CACvD,OAAO,uBAAuB,CAC/B,CAAC;AACF,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/svelte/index.js
CHANGED
|
@@ -45,6 +45,7 @@ export { default as InvoiceActions } from './components/InvoiceActions.svelte';
|
|
|
45
45
|
export { default as InvoiceCard } from './components/InvoiceCard.svelte';
|
|
46
46
|
export { default as InvoiceHeader } from './components/InvoiceHeader.svelte';
|
|
47
47
|
export { default as InvoiceLineItems } from './components/InvoiceLineItems.svelte';
|
|
48
|
+
export { default as InvoiceRecordScreen } from './components/InvoiceRecordScreen.svelte';
|
|
48
49
|
export { default as InvoiceTotals } from './components/InvoiceTotals.svelte';
|
|
49
50
|
export { default as UnbilledItems } from './components/UnbilledItems.svelte';
|
|
50
51
|
export { default as PartyContactFields } from './components/PartyContactFields.svelte';
|
|
@@ -86,7 +87,9 @@ import InvoiceAllocationFields from './components/InvoiceAllocationFields.svelte
|
|
|
86
87
|
import InvoiceEditor from './components/InvoiceEditor.svelte';
|
|
87
88
|
import InvoiceLineEditor from './components/InvoiceLineEditor.svelte';
|
|
88
89
|
import InvoiceReview from './components/InvoiceReview.svelte';
|
|
89
|
-
|
|
90
|
+
import MoneyInvoiceEditor from './components/MoneyInvoiceEditor.svelte';
|
|
91
|
+
export { InvoiceAllocationFields, InvoiceEditor, InvoiceLineEditor, InvoiceReview, MoneyInvoiceEditor, };
|
|
92
|
+
export { calculateMoneyEditorDraft, moneyEditorFieldNames, moneyEditorSubmission, } from './invoices/money-editor.js';
|
|
90
93
|
ModuleUIRegistry.register('@happyvertical/smrt-commerce', 'invoice-editor', InvoiceEditor);
|
|
91
94
|
ModuleUIRegistry.register('@happyvertical/smrt-commerce', 'invoice-review', InvoiceReview);
|
|
92
95
|
import PurchaseOrderEditor from './components/PurchaseOrderEditor.svelte';
|
|
@@ -94,16 +94,21 @@ export interface InvoiceMinorLineInput {
|
|
|
94
94
|
quantity: number;
|
|
95
95
|
/** Signed integer minor units; negative prices support existing credit lines. */
|
|
96
96
|
unitPrice: number;
|
|
97
|
-
/**
|
|
97
|
+
/** Legacy uses a nonnegative flat discount; v2 stores the gross sign. */
|
|
98
98
|
discount: number;
|
|
99
99
|
/** Resolved tax fraction, at most eight fractional digits, in [0, 1]. */
|
|
100
100
|
taxRate: number;
|
|
101
101
|
}
|
|
102
|
+
/** Explicit migration boundary for persisted legacy invoice-line arithmetic. */
|
|
103
|
+
export interface InvoiceMinorLineCalculationOptions {
|
|
104
|
+
/** Existing callers remain legacy until #3933's per-tenant marker selects v2. */
|
|
105
|
+
moneyModel?: 'legacy' | 'v2';
|
|
106
|
+
}
|
|
102
107
|
/**
|
|
103
108
|
* Exact model calculation, including existing negative-price credit lines.
|
|
104
109
|
* Throws before persistence for unsafe money, invalid quantity, or invalid tax.
|
|
105
110
|
*/
|
|
106
|
-
export declare function calculateInvoiceMinorLine(input: InvoiceMinorLineInput): InvoiceCalculatedAmounts;
|
|
111
|
+
export declare function calculateInvoiceMinorLine(input: InvoiceMinorLineInput, options?: InvoiceMinorLineCalculationOptions): InvoiceCalculatedAmounts;
|
|
107
112
|
/** Validated line fields suitable for the existing model's resolved money columns. */
|
|
108
113
|
export interface InvoiceResolvedLine extends InvoiceMinorLineInput {
|
|
109
114
|
/** Validated item description. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../../../src/svelte/invoices/calculations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../../../src/svelte/invoices/calculations.ts"],"names":[],"mappings":"AASA,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,gE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