Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat(sales): bill rental agreements monthly from the start date (#1942)

Brad Barbin18980ae501ba
diff --git a/.ai/lessons.md b/.ai/lessons.md
index 10278bb2f0..ba6b8cea18 100644
--- a/.ai/lessons.md
+++ b/.ai/lessons.md
@@ -3699,3 +3699,13 @@ The write was then removed (nothing reads it), so the rail always starts collaps
**Rule:** Before adding a unique index, list every writer of the table, interceptors included, and give each one `ON CONFLICT … DO NOTHING` or a conflict-safe update in the same change. When a composite unique key includes a nullable column, assume it deduplicates nothing for rows where that column is NULL.
**Applies to:** `membership` and its interceptors in `packages/database/src/event-system/handlers/`, and any unique key with a nullable column.
+
+## A docs heading is read by the in-app agent, and its length counts against a budget
+
+**Context:** Adding a billing cycle to rental agreements lengthened two troubleshooting headings in `docs/content/docs/reference/rental-agreements.mdx`, each quoting every variant of an error message.
+
+**Problem:** The in-app agent's `read_doc` returns a long page as its intro plus a link per section, and `agent.kb.test.ts` caps every page and section read at `READ_BUDGET` (16,000 characters). Each heading appears twice in that list, as text and inside its anchor URL. About 1,400 characters of heading growth pushed the page over the cap and failed the ERP test suite, far from the docs package.
+
+**Rule:** Keep a troubleshooting heading to one message. Use `…` for the part that varies and list the variants in the body. After you edit a long reference page, run `apps/erp/app/modules/agent/agent.kb.test.ts` as well as the docs checks.
+
+**Applies to:** `docs/content/docs/**`, `apps/erp/app/modules/agent/agent.kb.ts`.
diff --git a/.ai/plans/2026-10-16-rental-monthly-anniversary-billing.md b/.ai/plans/2026-10-16-rental-monthly-anniversary-billing.md
new file mode 100644
index 0000000000..cb177c5caa
--- /dev/null
+++ b/.ai/plans/2026-10-16-rental-monthly-anniversary-billing.md
@@ -0,0 +1,111 @@
+# Rental agreements: monthly billing from the start date
+
+**Request:** a customer wants each rental agreement invoiced on the same day every
+month, counted from its start date (start on the 7th, invoice on the 7th), for the
+same amount every month. Service contracts already do this with Monthly frequency
+and "Align to calendar periods" unticked. Rental agreements offer only:
+
+- **Calendar Month**: moves every customer onto the 1st, with a part month first.
+- **28 Days**: the invoice date moves every month, and a year has 13 periods at
+ the monthly rate, so the customer pays more than they were quoted.
+
+Spec context: the rentals spec listed this as follow-on work ("anniversary cycles
+later", `.ai/specs/implemented/2026-09-22-revenue-recognition-rentals-and-contracts.md`
+decision 10).
+
+**Sibling:** contract `billingAlignment = Anniversary` with `billingFrequency = Month`
+(`packages/database/src/contract-schedule.ts` → `gridAnchor` / `gridPeriodStart` /
+`periodUnits`). Rentals copy its period grid and its pricing rule. Rentals do not
+share its code: contracts price per contract-line unit and plan invoices, and
+rentals persist `rentalBillingPeriod` rows per unit.
+
+## Decisions (recommended, to confirm)
+
+1. **Storage: add a third value to the `rentalBillingCycle` enum, `'Monthly'`.** Do not
+ add a separate alignment column. Alignment means nothing to `28 Days`, and every
+ billing function already switches on `cycle`. `Calendar Month` stays as it is, and
+ so do existing agreements.
+2. **UI copies the contract Billing card:** Billing Cycle cards **Monthly** and
+ **28 Days**, with the **Align to calendar periods** checkbox under them. The
+ checkbox is enabled only for Monthly. Ticked stores `Calendar Month`, and unticked
+ stores `Monthly`. An existing Calendar Month agreement shows Monthly, ticked. The
+ Properties panel select labels the three values "Monthly", "Monthly (calendar)"
+ and "28 Days".
+3. **The default for a new agreement stays `Calendar Month`.** This preserves current
+ behavior. (Contracts default to Anniversary. We can change the default if you
+ want.)
+
+## Behavior of `Monthly`
+
+- **Periods:** period k is `[start + k months, start + (k+1) months − 1 day]`. Each
+ period is computed from the start date and is never chained from the previous
+ period, so a 31 Jan start bills 31 Jan–27 Feb, then 28 Feb–30 Mar, then 31 Mar–…
+ (the contract clamp rule). The end date and the return date still cut the last
+ period. A holdover period that starts the day after the end date ends on the next
+ anniversary boundary.
+- **Price:** a whole period for a Monthly unit is exactly its month rate, every month.
+ A part period (cut by the end date, the return date or holdover) is the month rate ×
+ days used ÷ days in the whole period it belongs to. Daily and Weekly units bill the
+ whole days or weeks the period covers, as they do on the other cycles.
+- **Horizon:** today + 1 month. Rolling agreements still get one more period beyond
+ the horizon.
+- **Due date / timing:** unchanged. Advance is due on the period start, and Arrears is
+ due on the period end.
+- **Sales-type lease (ASC 842):** valued like Calendar Month. The payment is the month
+ rate, there is one period per whole month of the term (`wholeMonthsInTerm` already
+ counts anniversary months), and the rate is the annual rate. A `Sale` line needs a
+ Monthly unit and a term of whole months from the start (end date = start + n months
+ − 1 day). It does not need to start on the 1st, which removes a Calendar Month
+ limit.
+- **Invoice line text:** the same as Calendar Month (" · Month rate").
+
+## Tasks
+
+- [x] **1. Migration.** `pnpm db:migrate:new rental-monthly-billing-cycle` →
+ `ALTER TYPE "rentalBillingCycle" ADD VALUE IF NOT EXISTS 'Monthly';`. Then run
+ `pnpm db:migrate` and `pnpm run generate:types`.
+- [x] **2. Billing math (TDD).** In `packages/utils/src/rental-periods.ts`:
+ `RentalBillingCycle` gets `"Monthly"`. Add `anniversaryPeriodEnd(startDate, from)`,
+ which computes from the start date. `naturalEnd`, `billingHorizon` and
+ `periodCharge` get the new branch: a Monthly unit's charge is the rate × days ÷
+ days in the anniversary period. Write the tests first in `rental-periods.test.ts`:
+ the 7th → 6th grid; the same amount every month; the 31 Jan clamp; return and end
+ cuts; holdover; Arrears due dates; horizon.
+- [x] **3. Lease valuation (TDD).** In `packages/utils/src/lessor-lease.ts`:
+ `leasePaymentTerms` treats Monthly like Calendar Month, and
+ `salesTypeRequirementError` gets the Monthly whole-months rule. Add tests in the
+ lessor-lease tests and `post-rental-agreement/lessor.test.ts`: a mid-month 12-month
+ term schedules 12 periods.
+- [x] **4. Server functions.** `create-rental-invoices/index.ts` `rentLineDescription`:
+ Monthly + Month gives " · Month rate". Add a test to
+ `rent-line-description.test.ts`. `post-rental-agreement` and `return-unit` already
+ pass `cycle` through; only their types need checking.
+- [x] **5. ERP.** In `sales.models.ts`, add `"Monthly"` to `rentalBillingCycles`.
+ Replace the literal `"Calendar Month" | "28 Days"` unions in `sales.utils.ts` and
+ `RentalLeaseClassification.tsx` with `RentalBillingCycle`. Update
+ `RentalAgreementBilling.tsx` (cards + checkbox, copied from `ContractBillTo.tsx`)
+ and the `RentalAgreementProperties.tsx` select labels. Then run `lingui:extract`
+ and `/translate`.
+- [x] **6. Docs.** Update `docs/content/docs/reference/rental-agreements.mdx` (cycles,
+ example, sales-type requirements, the error text), the glossary `billing-cycle`
+ term, and the Rentals section of `apps/erp/app/modules/sales/AGENTS.md`. Then
+ regenerate swagger (`packages/database/src/swagger-docs-schema.ts`, via
+ generate:types).
+- [x] **7. Verify.** Run `pnpm --filter @carbon/utils test`,
+ `pnpm --filter @carbon/server-functions test` (rental files), the scoped typecheck
+ for `@carbon/utils`, `@carbon/server-functions` and `erp`, Biome,
+ `pnpm db:check:datasets` and `pnpm db:check:backups`. Then browser-test with /test:
+ create an agreement starting on the 7th, untick the box, activate, generate
+ invoices, and check that the periods run 7th–6th at the full month rate.
+
+## Deviations from the plan
+
+- The helper is named `monthlyPeriodEnd`, not `anniversaryPeriodEnd`. It reuses
+ `leaseMonthsAt` / `leaseMonthEnd` from `@carbon/database/lease-months`, which
+ already clamp from the start date.
+- A Monthly term counts its months with `leaseMonthsThrough`, not
+ `wholeMonthsInTerm`. `wholeMonthsInTerm` counts 31 Jan → 27 Feb as 0 months,
+ but billing cuts it as one whole period.
+- The two sales-type troubleshooting headings in the rental agreements page are
+ shorter. The longer headings pushed the page past the agent's read budget
+ (`agent.kb.test.ts`).
diff --git a/.ai/playbooks/rental-agreement-setup-wizard.md b/.ai/playbooks/rental-agreement-setup-wizard.md
index 69c7860491..76989b1982 100644
--- a/.ai/playbooks/rental-agreement-setup-wizard.md
+++ b/.ai/playbooks/rental-agreement-setup-wizard.md
@@ -1,6 +1,6 @@
# Rental Agreement Setup Wizard
-Last tested: 2026-10-07
+Last tested: 2026-10-16 (Monthly billing cycle)
Routes: /x/rental-agreement/new, /x/rental-agreement/:id/setup/{details,units,billing,accounting,review},
/x/part/:itemId/inventory, /x/fixed-asset/capitalize
@@ -13,7 +13,12 @@ Routes: /x/rental-agreement/new, /x/rental-agreement/:id/setup/{details,units,bi
Storage Units card shows a building-icon link per serial
(`a[href*="fixed-asset/capitalize"]`); its page "Capitalize as Fixed Asset"
defaults the class to Rental Fleet — requestSubmit the form whose button
- contains "Capitalize". RW-010 in the dev company works.
+ contains "Capitalize". RW-010 in the dev company works. In "Update
+ Inventory", requestSubmit the DIALOG's form (`[role=dialog] form`) — a
+ page-wide search for a "Save" submit button finds the wrong form. If the
+ Storage Units card shows no building-icon link, open
+ `/x/fixed-asset/capitalize?itemId=…&trackedEntityId=…&locationId=…&storageUnitId=…`
+ directly (ids from the serial's `itemLedger` row).
- A customer (NovaSat Networks has no sales contact → no invoice email sent).
- Isolated session: `export AGENT_BROWSER_SESSION=<workspace>`; set
`agent-browser set viewport 1440 1000` (the sticky footer covers fields at the
@@ -38,6 +43,12 @@ menuitem "Remove Unit" → requestSubmit the dialog form ("Delete") → stays on
/setup/units.
### 3. Billing
+Billing Cycle cards: "Monthly" and "28 Days", with the "Align to calendar
+periods" checkbox under them (enabled for Monthly only). A new agreement is
+Monthly + ticked (`billingCycle = 'Calendar Month'`); click the checkbox to
+untick it → `billingCycle = 'Monthly'` (each period from the start date's day).
+Picking "Monthly" from "28 Days" restores the alignment it had before 28 Days
+(ticked when the page has not seen one, e.g. after a reload).
Click text "Arrears"; Deposit / Tax Percent textboxes (`8.25%`) fill + Tab. Each
saves on its own (`rental-agreement/update`).
@@ -50,7 +61,11 @@ the unit's row (Fair Value) → textbox → fill → Tab.
A unit at rate 0 is listed red ("… has no rate.") and Activate is disabled; a
direct POST to `/activate` is refused too (status stays Draft). With every unit
priced: footer "Activate" → dialog button "Activate MOD+ENTER" → lands on
-`/details`, status Active, billing periods cut.
+`/details`, status Active, billing periods cut. On a Monthly agreement from
+2026-10-07 to 2027-10-06 at 1,500 a month: 12 periods, 7th → 6th, each 1,500,
+due on the 7th; the header "Invoice" button → dialog "Invoice MOD+ENTER" bills
+the first one ("… · 31 days · Month rate"). Properties shows Billing Cycle
+"Monthly" ("Monthly (calendar)" for Calendar Month).
### 6. Redirects
A Draft opened from the list or at `/details` lands on `/setup/units`; an Active
diff --git a/.ai/specs/implemented/2026-09-22-revenue-recognition-rentals-and-contracts.md b/.ai/specs/implemented/2026-09-22-revenue-recognition-rentals-and-contracts.md
index efffa33171..a632239603 100644
--- a/.ai/specs/implemented/2026-09-22-revenue-recognition-rentals-and-contracts.md
+++ b/.ai/specs/implemented/2026-09-22-revenue-recognition-rentals-and-contracts.md
@@ -199,7 +199,7 @@ Selling profit = PVpay − (C − PVres), stored on the line. Balanced by constr
| 7 | Rental revenue timing | `Rental` lines always defer; the run releases and accrues unbilled rent to contract assets | One rule for advance and arrears; period-correct regardless of invoice posting date |
| 8 | Recognition vehicle | `revenueRecognitionRun` Draft → Posted batch (depreciation-run pattern) | Propose-only posture (close-automation decision, Brad 2026-07-04); no hook into `postJournalEntry`; approvable batch |
| 9 | Schedule rows carry accounts | `debitAccountId` / `creditAccountId` captured at creation | The run stays a pure poster; new methods add rows, not branches |
-| 10 | Billing | Calendar Month (prorated month tier) or 28 Days (thirteen per year, day / week / month ladder), advance or arrears, Draft invoices proposed daily, one invoice per agreement per cycle | Texada / point-solution convention (research §4); anniversary cycles later. **Propose-only superseded by Part II** (Draft Only / Post / Post and Email; charges split onto a held invoice when automating) |
+| 10 | Billing | Calendar Month (prorated month tier) or 28 Days (thirteen per year, day / week / month ladder), advance or arrears, Draft invoices proposed daily, one invoice per agreement per cycle | Texada / point-solution convention (research §4); anniversary cycles later — **added 2026-10-16 as the `Monthly` cycle** (months from the start date, the contract Anniversary grid; `.ai/plans/2026-10-16-rental-monthly-anniversary-billing.md`). **Propose-only superseded by Part II** (Draft Only / Post / Post and Email; charges split onto a held invoice when automating) |
| 11 | Rates | One frequency and one rate per line, starting from customer → customer type → item rate cards (`customerItemRentalRate`, `itemRentalRate`) and editable while Draft — not pricing rules, which price one unit with quantity breaks; Best Rate removed; a Daily / Weekly unit on a Calendar Month agreement bills the days / whole weeks (amended 2026-09-28); fixed at activation; best rate per billing period with ties to the larger unit; level for the term, escalations later | Odoo cheapest-line rule + Texada single-tier rule; per-period evaluation keeps every charge non-negative and known when cut; level payments ⇒ straight-line = billing, no straight-line receivable in v1 |
| 12 | Revenue account | Company default `rentalIncomeAccount` (+ lease accounts), fleet asset accounts per class | Flat defaults + per-entity assignment (lesson: no N×M matrix); the class already owns the balance-sheet accounts |
| 13 | Deposits | `payment.rentalAgreementId` / `salesOrderId` → 2110 via the deposit branch; refund via existing Disbursement refund | Reuses AR/AP payment machinery; #1048's design generalized |
diff --git a/apps/erp/app/modules/sales/AGENTS.md b/apps/erp/app/modules/sales/AGENTS.md
index 2c01ceee1c..f24a646080 100644
--- a/apps/erp/app/modules/sales/AGENTS.md
+++ b/apps/erp/app/modules/sales/AGENTS.md
@@ -128,7 +128,7 @@ Rental of serialized fleet units (fixed assets with an `itemId`), each line's ac
|---|---|
| `itemRentalRate` | Day / week / month rate ladder per item AND currency (unique `(companyId, itemId, currencyCode)`, CHECK ≥ 1 tier). Edited on the part Sales tab ("Rental Rates" card, serial-tracked parts, base currency only) |
| `customerItemRentalRate` | A ladder agreed with ONE customer or ONE customer type (`num_nonnulls(customerId, customerTypeId) = 1`) for an item and currency, optional `validFrom` / `validTo` (inclusive, gated on the agreement's `startDate`), `notes`. Partial unique indexes: one row per (customer, item, currency) and per (type, item, currency). Migration `20261006220501_rental-agreements.sql`; RLS `company("sales", { read: "sales_view" })`. Edited on the part Sales tab ("Customer Rental Rates" card, `CustomerRentalRates` + `CustomerRentalRateForm` in `modules/items/ui/Item/`, routes `x+/part+/$itemId.sales.rental-rates.{new,$rateId,delete.$rateId}.tsx`). A separate table from `customerItemPriceOverride` on purpose: a rental price is a rate per frequency with no quantity breaks, and pricing rules (percent / fixed on one unit price, quantity ranges) do not apply to rentals |
-| `rentalAgreement` / `rentalAgreements` (view) | Header, readable `rentalAgreementId` (sequence `RA`, drawn in `new.tsx` via `getNextSequence`). `status` Draft / Active / Closed / Cancelled; `billingCycle` Calendar Month / 28 Days; `billingTiming` Advance / Arrears; `taxPercent` (0–1 fraction, the rent lines' tax); `depositAmount`; lease-classification inputs `discountRate` (annual %, prefilled in `new.tsx` from `companySettings.leaseDefaultDiscountRate`), `ownershipTransfers`, `specializedAsset`, `purchaseOptionAmount`, `purchaseOptionReasonablyCertain` (the validator refuses it without `endDate`). View adds `customerName`, `lineCount`, `onRentCount`, `nextDueOn`, `unbilledAmount` |
+| `rentalAgreement` / `rentalAgreements` (view) | Header, readable `rentalAgreementId` (sequence `RA`, drawn in `new.tsx` via `getNextSequence`). `status` Draft / Active / Closed / Cancelled; `billingCycle` Calendar Month / Monthly / 28 Days (the Billing card shows Monthly + 28 Days, and an "Align to calendar periods" box under Monthly stores Calendar Month when ticked, Monthly when not — the contract Billing card's pattern; Properties reads "Monthly (calendar)" for Calendar Month); `billingTiming` Advance / Arrears; `taxPercent` (0–1 fraction, the rent lines' tax); `depositAmount`; lease-classification inputs `discountRate` (annual %, prefilled in `new.tsx` from `companySettings.leaseDefaultDiscountRate`), `ownershipTransfers`, `specializedAsset`, `purchaseOptionAmount`, `purchaseOptionReasonablyCertain` (the validator refuses it without `endDate`). View adds `customerName`, `lineCount`, `onRentCount`, `nextDueOn`, `unbilledAmount` |
| `rentalAgreementLine` | One fleet unit (`fixedAssetId`, `quantity` CHECK = 1). `status` Pending / On Rent / Returned / Sold (no Cancelled). `rateUnit` (Day / Week / Month, NOT NULL — the "Rate Frequency") and `rate` (NOT NULL, ≥ 0) = the unit's ONE rate, what billing and classification read. The line form starts `rate` from `getDefaultRentalRates` for the chosen frequency (customer → customer type → item, per frequency, effective on `startDate`) and re-starts it when the unit's item or the frequency changes; the value is the user's to overwrite. `upsertRentalAgreementLine` fills an omitted `rate` the same way (API / the fleet Rent action) and refuses `RENTAL_LINE_NO_RATE` when nothing is on file, `deliveredAt` + `meterOut` (written by a posted rental shipment), `returnedAt` + `meterIn` + `returnNotes` (written by a posted rental receipt; Release unit writes `returnedAt` only). Lease: inputs `fairValue`, `economicLifeMonths`, `guaranteedResidualValue`, `unguaranteedResidualValue`; set at activation `lessorClassification` (`Rental` / `Sale`; null on a Draft line; `Financing` has no input), `classificationInputs` (JSON `ClassificationInputs` from `lessor-lease` in `@carbon/utils`), `initialNetInvestment` / `sellingProfit` / `commencementJournalId` (`Sale` only); `classificationOverride` + `classificationOverrideReason` (the override route, Draft only). Partial unique index `rentalAgreementLine_asset_live_idx`: one live (Pending / On Rent) line per asset |
| `rentalAgreementCharge` | Variable charges per line (`chargeType` from enum `rentalInvoiceLineType`, default Charge — set server-side only: `upsertRentalAgreementCharge` always writes `Charge`, `insertRentalPurchaseOptionCharge` writes `Purchase Option`), `chargeDate`, `amount`, `taxPercent`, `invoiceSeparately` (default false; a `Charge` with it set is drafted on the held charges invoice instead of the rent invoice — ignored on a `Purchase Option`, which is always separate), `salesInvoiceLineId` stamp when billed, `voidedSalesInvoiceId` (set by VOID; makes the re-bill a held draft; sticky across a deleted draft, overwritten by a later VOID) |
| `rentalBillingPeriod` | Persisted periods per line: `periodStart/End`, `days`, `rateUnitApplied`, `amount`, `isAdjustment`, `dueOn`, `status` Pending / Invoiced, `salesInvoiceLineId`, `memoId` (an `isAdjustment` row is billed by a credit memo, never an invoice line — CHECK `rentalBillingPeriod_memo_check`; FK `ON DELETE RESTRICT`, so a Draft rental credit is deleted only through `deleteRentalCreditMemoReleasingPeriods`), `voidedSalesInvoiceId` (set by VOID; makes the re-bill a held draft; sticky across a deleted draft, overwritten by a later VOID). Unique `(companyId, rentalAgreementLineId, periodStart, isAdjustment)` |
@@ -136,7 +136,7 @@ Rental of serialized fleet units (fixed assets with an `itemId`), each line's ac
RLS on all seven: `sales_view` to read, `sales_create/update/delete` to write — each a `company("sales", { read: "sales_view" })` rule in `packages/database/src/authz/manifest.ts`, shipped by `20261006221501_revenue-recognition-rentals-contracts-rls.sql` (the schedule is written only by service-role posting paths).
-- **Billing math** — `packages/utils/src/rental-periods.ts` (pure, `@carbon/utils`). Every amount is billed, so `rateCharge`, `calendarMonthCharge`, `periodCharge` and `generateRentalBillingPeriods` take `decimals` (the agreement currency's `decimalPlaces`, read from `currency` by `post-rental-agreement` and `create-rental-invoices`, `useCurrencyDecimals` in the ERP) and round to it — a part month, an early-return credit and a rate carrying the storage scale; `leasePaymentTerms` (`lessor-lease`) values a sales-type unit on the same rounded payment. `rateCharge` (whole units of the frequency × rate — Month = 28 days), `periodCharge` (a Monthly unit on a Calendar Month agreement is `calendarMonthCharge`, month rate × days ÷ days in month; every other frequency / cycle is `rateCharge`, so a Daily unit bills the days and a Weekly unit the whole weeks of a calendar month), `defaultRentalRates` (a unit's starting rate per frequency), `billingHorizon` (end of next month / today + 28; activation cuts to it through `activationBillingThrough` in `lessor.ts`, capped at `endDate` for a `Sale` line), `generateRentalBillingPeriods` (cuts from the AGREEMENT start date, never delivery; fixed term cut in full; open-ended rolls one period past `through`; holdover keeps billing past `endDate` (`Rental` only — a `Sale` line never gets a period past `endDate`); a return re-cuts the Pending period, and an Advance-billed period past the return gets one negative `isAdjustment` row = billed − charge(days used) priced by the line's own frequency and rate, never positive). Pinned by `packages/utils/src/rental-periods.test.ts`.
+- **Billing math** — `packages/utils/src/rental-periods.ts` (pure, `@carbon/utils`). Every amount is billed, so `rateCharge`, `calendarMonthCharge`, `periodCharge` and `generateRentalBillingPeriods` take `decimals` (the agreement currency's `decimalPlaces`, read from `currency` by `post-rental-agreement` and `create-rental-invoices`, `useCurrencyDecimals` in the ERP) and round to it — a part month, an early-return credit and a rate carrying the storage scale; `leasePaymentTerms` (`lessor-lease`) values a sales-type unit on the same rounded payment. `rateCharge` (whole units of the frequency × rate — Month = 28 days), `periodCharge` (a Monthly unit on a Calendar Month agreement is `calendarMonthCharge`, month rate × days ÷ days in month; on a Monthly agreement it is `monthlyCharge`, month rate × days ÷ days in its anniversary period, so a whole period is the rate; every other frequency / cycle is `rateCharge`, so a Daily unit bills the days and a Weekly unit the whole weeks of a calendar month), `defaultRentalRates` (a unit's starting rate per frequency), `billingHorizon` (Calendar Month: end of next month / Monthly: today + 1 month / 28 Days: today + 28; activation cuts to it through `activationBillingThrough` in `lessor.ts`, capped at `endDate` for a `Sale` line), `generateRentalBillingPeriods` (cuts from the AGREEMENT start date, never delivery; fixed term cut in full; open-ended rolls one period past `through`; holdover keeps billing past `endDate` (`Rental` only — a `Sale` line never gets a period past `endDate`); a return re-cuts the Pending period, and an Advance-billed period past the return gets one negative `isAdjustment` row = billed − charge(days used) priced by the line's own frequency and rate, never positive). Pinned by `packages/utils/src/rental-periods.test.ts`.
- **Lifecycle** — server function `post-rental-agreement` (`packages/server-functions/src/post-rental-agreement/`; `activate` / `release` / `close` / `cancel`, permissions `update: "sales"`, called by the routes through `serverFns.system`, validators + pure blockers in `validators.ts`). Activate: Draft only, refuses a unit at rate 0 (`unpricedUnitError`), refuses a non-base currency ("Rental agreements in a foreign currency are not supported yet"), checks every unit via the `fleetAssets` view (Available, or Reserved by this same agreement; asset Active / Fully Depreciated; not In Maintenance), bills each line at its own `rateUnit` + `rate` (activation reads no rate card), classifies every line (below), cuts periods to `billingHorizon(today)` (a `Sale` line only up to `endDate`), leaves undelivered lines Pending. No journal for a `Rental` line; a `Sale` line books its commencement. Release (`rentalAgreementLineId`, `returnedAt`): ends a `Pending` unit that never left the yard through `returnRentalUnit` with no location, so its billing stops at the release date (an Advance period gets the early-return adjustment), the line goes Returned and `fixedAsset.locationId` is unchanged; refused for a date after company today ("The release date cannot be in the future"), a line that is not Pending, a `Sale` line ("UNIT is treated as a sale; return it on a rental receipt instead" — plan decision P1; the UI hides Release unit for it) and a unit on an open (Draft / Pending) rental shipment or receipt ("UNIT is on shipment SHP…; remove it there before releasing the unit"). Close: refused FIRST while a Draft or Pending rental shipment or receipt of the agreement still has a line (`openRentalDocumentBlocker`: "Shipment SHP… is still open; post or delete it before closing the agreement"), then needs every line Returned/Sold, no Pending period, no unbilled charge. Cancel: Draft, or Active with no commenced `Sale` line and nothing On Rent/Sold/invoiced/recognized — DELETES the Pending lines (frees the units) and their Pending periods. `fixed-asset+/$fixedAssetId.out-of-service.tsx` likewise reads `getOnRentLineForAsset` with the service role (an accountant may lack `sales_view`).
- **Deliver and return** — a unit leaves on a rental shipment and comes back on a rental receipt: ordinary `shipment` / `receipt` documents with `sourceDocument` `'Rental Agreement'` (`sourceDocumentId` = the agreement), one unit per `shipmentFixedAssetLine` / `receiptFixedAssetLine` row through `rentalAgreementLineId` (see inventory AGENTS). The `create` server function builds them with types `shipmentFromRentalAgreement` / `receiptFromRentalAgreement` (`{ rentalAgreementId, rentalAgreementLineId? }`, Active agreement only, location = the agreement's, `postingDate` left null because a set `postingDate` reads as posted). Without a line id, a shipment holds every `Pending` unit not on another open rental shipment, ticked; a receipt holds every `On Rent` unit ticked and every `Pending` unit unticked (spec Q8: ticking a Pending unit returns it, and its billing stops at the return date). With a line id, the unit is added ticked to the agreement's Draft (or ticked when it sits there unticked), else a one-unit Draft is created. Refusals: "No units to deliver" / "No units to return", "The unit is already on an open shipment" / "… receipt". Partial unique indexes `shipment_oneOpenDraftPerRentalAgreement_idx` / `receipt_oneOpenDraftPerRentalAgreement_idx` allow one Draft of each per agreement. `post-shipment` and `post-receipt` own the `'Rental Agreement'` source (`post-shipment/rental-agreement.ts`, `post-receipt/rental-agreement.ts`) and take an optional `postingDate` (`YYYY-MM-DD`; the post modal's **Delivered on** / **Returned on**, default company today; a future date is refused; other sources ignore it). Posting a shipment locks the agreement and the ticked lines, refuses a line that is not Pending or a unit out of service (the message names the unit), sets `On Rent` + `deliveredAt` + `meterOut` and writes a `Rental Delivery` `trackedActivity`; no `itemLedger`, `costLedger` or journal, for a `Rental` and a `Sale` line alike. Its void is allowed while every unit is still On Rent and no `Accrual` row of its lines is Posted or claimed by a Draft run: the lines go back to Pending with `deliveredAt` / `meterOut` cleared, and their unclaimed Planned `Accrual` rows are deleted. Posting a receipt runs `returnRentalUnit` for each ticked line (Pending or On Rent), sets the unit's `fixedAsset.locationId` to the receipt's location (for a `Sale` line returned to Fleet, the new asset) and writes a `Rental Return` activity for a `Rental` line. A rental receipt is never voided ("A rental return cannot be voided. Correct the unit by hand."). Posting either needs `update: inventory`.
- **Per-unit shortcuts** — `$id.$lineId.deliver.tsx` / `$id.$lineId.return.tsx` (`update: sales` + `create: inventory`) invoke `create` with the line id and redirect into the shipment or receipt, so a counter pickup is the shortcut, then **Post**. `shipment+/new` / `receipt+/new` take the `'Rental Agreement'` source from the header buttons and redirect to the agreement's Draft when one exists. The inventory `$id.details` actions refuse a change of source on a rental document.
@@ -147,8 +147,8 @@ RLS on all seven: `sales_view` to read, `sales_create/update/delete` to write
- **The `Rental` invoice line** — `salesInvoiceLineType` value `Rental`, no item; columns `rentalAgreementId`, `rentalAgreementLineId`, `rentalBillingPeriodId`, `rentalAgreementChargeId`, `rentalLineType` (enum `rentalInvoiceLineType`: Rent / Charge / Purchase Option), CHECK `salesInvoiceLine_rental_check`. Rendered read-only by `SalesInvoiceLineForm`; `salesInvoiceLineValidator` accepts but never offers it. Posting (`post-sales-invoice`, decisions in `rental-posting.ts`): Rent → Cr Contract Assets for unbilled accruals, rest Cr Deferred Revenue + Deferral schedule rows; negative Rent (an early-return credit on an invoice drafted before credits became memos; new ones are credit memos, above) → Dr Deferred Revenue (negative Deferral rows) / Dr Rental Income for the recognized part; Charge → Cr Rental Income; on a `Sale` line Rent and Purchase Option → Cr Net Investment in Leases (no schedule rows, no accrual consumption; a negative Rent line is refused) and Charge → Cr Rental Income; Purchase Option on a `Rental` line → refused ("Purchase option billing requires a line treated as a sale"). A `Sale` line's Purchase Option line also posts the NI settlement (below). Posting a Purchase Option line flips its agreement line to `Sold` (only a `Sale` line `On Rent`, in the posting transaction, regardless of accounting); VOID returns a still-`Sold` line to `On Rent`. Revenue legs carry `documentType 'Rental Agreement'`.
- **Rental rows post in the lease run** — every `revenueRecognitionSchedule` row of a rental agreement (rent `Deferral` rows from `post-sales-invoice` and `post-memo`, `Accrual` rows from `synthesizeRentalAccruals`, a `Sale` line's `Interest` rows) carries `rentalAgreementLineId`, so the **Lease** run claims it (`runTypeFilter`, `packages/server-functions/src/lib/run-type.ts`) and posts it as `sourceType 'Lease Run'`; the revenue recognition run never sees it. Accounting → Closing → Leases lists them; close task "Post lease journals". `20261011163211_lessee-leases.sql` released these rows from Draft revenue runs (Posted runs keep theirs) and `20261011192957_lease-run-sync-policy.sql` gave each accounting integration's `Lease Run` the sync setting its `Revenue Recognition` had. The rental refusals name it: "A draft lease run holds accrued rent for UNIT; delete the run before voiding the shipment", "A posted run holds accrued rent for UNIT; the shipment cannot be voided", "A draft lease run includes this lease's interest; post or delete the run before returning the unit", "This rental credit is already part of a lease run; reverse or delete the run before voiding it". See accounting AGENTS → Run types.
- **Deposits** — `payment.rentalAgreementId` / `payment.salesOrderId` (at most one). The Deposits card lists `getRentalAgreementDeposits`; "Record Deposit" links to `payments/new?customerId&rentalAgreementId&amount`. Posting is in `post-payment` (see accounting AGENTS, Payments).
-- **Lease classification** — pure math in `packages/utils/src/lessor-lease.ts` (`@carbon/utils`): `presentValue` (`pvRent`, `pvPayments` incl. a reasonably certain option + guaranteed residual, `pvResidual`, `netInvestment`), `classifyLessorLease` (tests a–e; any true ⇒ `Sale`; `termMonths` null ⇒ always `Rental`), `buildLessorSchedule` (last line closes on option + residuals), `wholeMonthsInTerm`, `leasePaymentTerms` (Calendar Month: the month rate over whole months — a Daily or Weekly unit at its average month over a 365-day year; 28 Days: the unit's 28-day charge over whole 28-day periods at annual × 28/365), `salesTypeRequirementError` (also refuses a Daily / Weekly unit treated as a sale on a Calendar Month agreement: its invoices would not match a level payment, and — given `today` — an agreement starting before the activation month: commencement posts on the activation day while interest is dated from the start), `netInvestmentExceedsFairValue` (a WARNING, shown on the unit's Accounting treatment panel and in `RentalCommencementPreview`: payments + residual discounted at the entered rate are worth more than the fair value, i.e. the rate is below the rate implicit in the lease), `classifyRentalLine` (the stored `ClassificationInputs` record). Thresholds from `companySettings.leaseMajorPartThresholdPercent` / `leaseSubstantiallyAllThresholdPercent`. The Draft preview (`sales.utils.ts`: `leaseTermMonths`, `draftLeasePaymentTerms`, `previewLeaseClassification`, `readLeaseClassification`, `leaseCommencementPreview`) calls the same functions; UI `ui/Rentals/RentalLeaseClassification.tsx` (`LeaseClassificationPanel` on the line form, headed "Accounting treatment" with Rental / Sale cards and the ASC 842 names as secondary text (Financing has no input and is not shown), `LeaseClassificationOverrideModal`, `RentalCommencementPreview` in the Activate confirmation — the `$id.tsx` loader reads the units' cost and accumulated depreciation with the user's client, so `fixedAsset` RLS hides them from a user without accounting view and the preview shows only the NI / revenue legs). Override route `$id.$lineId.classification.tsx`: `update: accounting`, Draft only, reason required, reads and writes with the service role (an accountant may lack sales RLS), best-effort audit entry (`entityType "rentalAgreement"`, `tableName "rentalAgreementLine"`, reason as a `classificationOverrideReason` diff entry).
-- **Sales-type commencement / end of term** — `post-rental-agreement` (`lessor.ts` holds the pure decisions, pinned by `lessor.test.ts`). Activation, per `Sale` line (`salesTypeRequirementError`, `lessor-lease` in `@carbon/utils`: needs `endDate`, `fairValue` > 0, and WHOLE billing periods — Calendar Month starts on the 1st and ends on a month end, 28 Days is a multiple of 28 days — so the rent billed equals payment × periods the NI was valued on; messages read "UNIT is treated as a sale, which …"; `RentalCommencementPreview` shows the same message in the Activate confirmation): asset `Disposed` by `Sale` + `fixedAssetDisposal` (`saleProceeds` NI, `netBookValueAtDisposal` C, `gainLoss` selling profit); a `'Lease'` journal, Provisional before the accounting cutover (Dr NI, Dr COGS C − PVres, Dr class accumulated depreciation / Cr Lease Revenue PVpay, Cr class asset at cost); tracked entity `Consumed` with `Rental Agreement` + `Customer` attributes and a `Lease Commencement` activity; `rentalLeaseScheduleLine` rows and Planned `Interest` recognition rows (Dr NI / Cr lease interest income), which refuse when their account defaults are empty (a schedule row has no stand-in). Fleet units only (activation already refuses an asset-less line). Return of a `Sale` line (on a rental receipt; `residualDestination` Fleet / Inventory, not before `endDate`, not in the future, not while a Draft run holds its Interest rows dated after the return): closing NI = `netInvestmentAt` — the `closingNetInvestment` of the last schedule line dated on or before `returnedAt` (the closing target at/after `endDate`; `initialNetInvestment` when there are no lines); Fleet → new `fixedAsset` in the class named "Rental Fleet" (else the class the unit left) at that cost + a Posted `Capitalization` `fixedAssetTransfer`; Inventory → `bookAdjustment` +1 at that unit cost; `'Lease'` journal Dr asset / inventory, Cr NI; only unposted Interest rows and schedule lines dated AFTER the return are deleted — those on or before it stay and post through lease runs, bringing NI to zero. **Sell to Customer** (`$id.$lineId.sell.tsx`, `create: [sales, invoicing]` + `update: sales`): an Active agreement's `Sale` line `On Rent` with `purchaseOptionAmount`, once per line, not before `endDate` (early exercise is an early termination — a manual journal) — inserts a `Purchase Option` charge dated company today through the server-only `insertRentalPurchaseOptionCharge` (`sales.server.ts`) and calls `generateRentalInvoicesNow`; the invoice's posting marks the line Sold and settles the line's remaining NI against the schedule's closing balance (`purchaseOptionSettlement` in `post-sales-invoice/rental-posting.ts`: shortfall Dr `costOfGoodsSoldAccount` / Cr NI, excess Dr NI / Cr `leaseRevenueAccount`, same journal line reference so VOID reverses it; each default required only when its leg is). On a rental receipt, `ReceiptRentalLineItem` shows the **Return To** radios for a `Sale` line (saved to `receiptFixedAssetLine.residualDestination`), `ReceiptPostModal` blocks a ticked `Sale` line without one, and the post re-reads the classification.
+- **Lease classification** — pure math in `packages/utils/src/lessor-lease.ts` (`@carbon/utils`): `presentValue` (`pvRent`, `pvPayments` incl. a reasonably certain option + guaranteed residual, `pvResidual`, `netInvestment`), `classifyLessorLease` (tests a–e; any true ⇒ `Sale`; `termMonths` null ⇒ always `Rental`), `buildLessorSchedule` (last line closes on option + residuals), `wholeMonthsInTerm`, `leasePaymentTerms` (Calendar Month and Monthly: the month rate over whole months — Monthly counts them as billing cuts them, `leaseMonthsThrough` — a Daily or Weekly unit at its average month over a 365-day year; 28 Days: the unit's 28-day charge over whole 28-day periods at annual × 28/365), `salesTypeRequirementError` (also refuses a Daily / Weekly unit treated as a sale on a Calendar Month or Monthly agreement: its invoices would not match a level payment, and — given `today` — an agreement starting before the activation month: commencement posts on the activation day while interest is dated from the start), `netInvestmentExceedsFairValue` (a WARNING, shown on the unit's Accounting treatment panel and in `RentalCommencementPreview`: payments + residual discounted at the entered rate are worth more than the fair value, i.e. the rate is below the rate implicit in the lease), `classifyRentalLine` (the stored `ClassificationInputs` record). Thresholds from `companySettings.leaseMajorPartThresholdPercent` / `leaseSubstantiallyAllThresholdPercent`. The Draft preview (`sales.utils.ts`: `leaseTermMonths`, `draftLeasePaymentTerms`, `previewLeaseClassification`, `readLeaseClassification`, `leaseCommencementPreview`) calls the same functions; UI `ui/Rentals/RentalLeaseClassification.tsx` (`LeaseClassificationPanel` on the line form, headed "Accounting treatment" with Rental / Sale cards and the ASC 842 names as secondary text (Financing has no input and is not shown), `LeaseClassificationOverrideModal`, `RentalCommencementPreview` in the Activate confirmation — the `$id.tsx` loader reads the units' cost and accumulated depreciation with the user's client, so `fixedAsset` RLS hides them from a user without accounting view and the preview shows only the NI / revenue legs). Override route `$id.$lineId.classification.tsx`: `update: accounting`, Draft only, reason required, reads and writes with the service role (an accountant may lack sales RLS), best-effort audit entry (`entityType "rentalAgreement"`, `tableName "rentalAgreementLine"`, reason as a `classificationOverrideReason` diff entry).
+- **Sales-type commencement / end of term** — `post-rental-agreement` (`lessor.ts` holds the pure decisions, pinned by `lessor.test.ts`). Activation, per `Sale` line (`salesTypeRequirementError`, `lessor-lease` in `@carbon/utils`: needs `endDate`, `fairValue` > 0, and WHOLE billing periods — Calendar Month starts on the 1st and ends on a month end, Monthly ends the day before `start + n months` on any start day, 28 Days is a multiple of 28 days — so the rent billed equals payment × periods the NI was valued on; messages read "UNIT is treated as a sale, which …"; `RentalCommencementPreview` shows the same message in the Activate confirmation): asset `Disposed` by `Sale` + `fixedAssetDisposal` (`saleProceeds` NI, `netBookValueAtDisposal` C, `gainLoss` selling profit); a `'Lease'` journal, Provisional before the accounting cutover (Dr NI, Dr COGS C − PVres, Dr class accumulated depreciation / Cr Lease Revenue PVpay, Cr class asset at cost); tracked entity `Consumed` with `Rental Agreement` + `Customer` attributes and a `Lease Commencement` activity; `rentalLeaseScheduleLine` rows and Planned `Interest` recognition rows (Dr NI / Cr lease interest income), which refuse when their account defaults are empty (a schedule row has no stand-in). Fleet units only (activation already refuses an asset-less line). Return of a `Sale` line (on a rental receipt; `residualDestination` Fleet / Inventory, not before `endDate`, not in the future, not while a Draft run holds its Interest rows dated after the return): closing NI = `netInvestmentAt` — the `closingNetInvestment` of the last schedule line dated on or before `returnedAt` (the closing target at/after `endDate`; `initialNetInvestment` when there are no lines); Fleet → new `fixedAsset` in the class named "Rental Fleet" (else the class the unit left) at that cost + a Posted `Capitalization` `fixedAssetTransfer`; Inventory → `bookAdjustment` +1 at that unit cost; `'Lease'` journal Dr asset / inventory, Cr NI; only unposted Interest rows and schedule lines dated AFTER the return are deleted — those on or before it stay and post through lease runs, bringing NI to zero. **Sell to Customer** (`$id.$lineId.sell.tsx`, `create: [sales, invoicing]` + `update: sales`): an Active agreement's `Sale` line `On Rent` with `purchaseOptionAmount`, once per line, not before `endDate` (early exercise is an early termination — a manual journal) — inserts a `Purchase Option` charge dated company today through the server-only `insertRentalPurchaseOptionCharge` (`sales.server.ts`) and calls `generateRentalInvoicesNow`; the invoice's posting marks the line Sold and settles the line's remaining NI against the schedule's closing balance (`purchaseOptionSettlement` in `post-sales-invoice/rental-posting.ts`: shortfall Dr `costOfGoodsSoldAccount` / Cr NI, excess Dr NI / Cr `leaseRevenueAccount`, same journal line reference so VOID reverses it; each default required only when its leg is). On a rental receipt, `ReceiptRentalLineItem` shows the **Return To** radios for a `Sale` line (saved to `receiptFixedAssetLine.residualDestination`), `ReceiptPostModal` blocks a ticked `Sale` line without one, and the post re-reads the classification.
- **Fleet** — `fleetAssets` derives Reserved (live Pending line) and On Rent (a commenced `Sale` unit reads Sold: its asset is Disposed); the fleet table's **Rent** row action (Available units) opens `newRentalAgreement?fixedAssetId=`. `post-asset-transfer` `return` refuses a unit on a live line. A posted rental receipt moves the unit's `fixedAsset.locationId` to the receipt's location; a release does not move it.
Service functions (`sales.service.ts`): `getRentalAgreements` / `getRentalAgreement` / `insertRentalAgreement` / `updateRentalAgreement` / `deleteRentalAgreement`, `getRentalAgreementLines` / `getRentalAgreementLine` / `upsertRentalAgreementLine` / `insertRentalAgreementLines` (the wizard's Add Units; not an MCP tool) / `deleteRentalAgreementLine`, `getRentalAgreementCharges` / `upsertRentalAgreementCharge` / `deleteRentalAgreementCharge`, (these are MCP tools, so they carry their own guards: `updateRentalAgreement` and line upsert/delete only while the agreement is Draft, a line never moves agreements and its fleet unit is read under the line's company; a charge insert only on a Draft/Active agreement's line and always as charge type `Charge` — `rentalAgreementChargeValidator` has no `chargeType`; a charge update only while unbilled; refusals are PostgrestError-shaped `RENTAL_*` codes; every writer picks its fields explicitly rather than spreading the payload, so `status`, lifecycle timestamps, the rate snapshot, the classification columns, a charge's `chargeType` and its billing stamp cannot be set through them), `getRentalBillingPeriods`, `getRentableFleetAssets` (`fleetStatus = 'Available'`), `getItemRentalRate` (takes the currency) / `upsertItemRentalRate` / `deleteItemRentalRate`, `getDefaultRentalRates` (batch over `itemIds`, one query per table, keyed by item → per frequency `{ rate, source }` with `source` Customer / Customer Type / Item; used by the line upsert for an omitted rate, the line form on unit change, and the `$id.$lineId.details` loader while Draft for the "where did this rate come from" hint and frequency changes), `getCustomerItemRentalRates` / `getCustomerItemRentalRate` / `upsertCustomerItemRentalRate` / `deleteCustomerItemRentalRate`, `getRentalAgreementDeposits`, `getRentalAgreementRelatedDocuments` (the agreement's rental shipments and receipts with their asset lines, for the header dropdowns and `rentalLineDocuments`). Validators: `rentalAgreementValidator`, `rentalAgreementLineValidator`, `rentalAgreementLinesAddValidator`, `rentalAgreementChargeValidator`, `rentalAgreementReleaseValidator` (`rentalAgreementLineId` + `returnedAt`), `rentalAgreementLineClassificationValidator`, `itemRentalRateValidator`, `customerItemRentalRateValidator`, const arrays `lessorClassificationOverrides`, `rentalResidualDestinations`, `rentalAgreementStatuses`, `rentalAgreementLineStatuses`, `rentalBillingCycles`, `rentalBillingTimings`, `rentalRateUnits`, `rentalInvoiceLineTypes`.
diff --git a/apps/erp/app/modules/sales/sales.models.ts b/apps/erp/app/modules/sales/sales.models.ts
index 138bfe3076..004777bff8 100644
--- a/apps/erp/app/modules/sales/sales.models.ts
+++ b/apps/erp/app/modules/sales/sales.models.ts
@@ -1374,7 +1374,11 @@ export const rentalAgreementLineStatuses = [
"Sold"
] as const;
-export const rentalBillingCycles = ["Calendar Month", "28 Days"] as const;
+export const rentalBillingCycles = [
+ "Calendar Month",
+ "Monthly",
+ "28 Days"
+] as const;
export const rentalBillingTimings = ["Advance", "Arrears"] as const;
diff --git a/apps/erp/app/modules/sales/sales.utils.test.ts b/apps/erp/app/modules/sales/sales.utils.test.ts
index f3b8e27c40..86da3370ba 100644
--- a/apps/erp/app/modules/sales/sales.utils.test.ts
+++ b/apps/erp/app/modules/sales/sales.utils.test.ts
@@ -200,15 +200,22 @@ describe("decideRecalcPricing", () => {
describe("leaseTermMonths", () => {
it("counts whole months with both ends inclusive", () => {
// The same pins as post-rental-agreement's `wholeMonthsInTerm`.
- expect(leaseTermMonths("2027-01-01", "2029-12-31")).toBe(36);
- expect(leaseTermMonths("2027-01-15", "2028-01-14")).toBe(12);
- expect(leaseTermMonths("2026-01-15", "2026-02-14")).toBe(1);
- expect(leaseTermMonths("2026-01-15", "2026-02-13")).toBe(0);
- expect(leaseTermMonths("2026-01-31", "2026-02-27")).toBe(0);
+ const cycle = "Calendar Month";
+ expect(leaseTermMonths(cycle, "2027-01-01", "2029-12-31")).toBe(36);
+ expect(leaseTermMonths(cycle, "2027-01-15", "2028-01-14")).toBe(12);
+ expect(leaseTermMonths(cycle, "2026-01-15", "2026-02-14")).toBe(1);
+ expect(leaseTermMonths(cycle, "2026-01-15", "2026-02-13")).toBe(0);
+ expect(leaseTermMonths(cycle, "2026-01-31", "2026-02-27")).toBe(0);
+ });
+
+ it("counts a Monthly term the way its billing cuts it", () => {
+ // 31 Jan + 1 month clamps to 28 Feb: 31 Jan – 27 Feb is one period.
+ expect(leaseTermMonths("Monthly", "2026-01-31", "2026-02-27")).toBe(1);
+ expect(leaseTermMonths("Monthly", "2027-01-15", "2028-01-14")).toBe(12);
});
it("is null when open-ended", () => {
- expect(leaseTermMonths("2026-01-01", null)).toBeNull();
+ expect(leaseTermMonths("Calendar Month", "2026-01-01", null)).toBeNull();
});
});
diff --git a/apps/erp/app/modules/sales/sales.utils.ts b/apps/erp/app/modules/sales/sales.utils.ts
index 194830acd2..3f057f0817 100644
--- a/apps/erp/app/modules/sales/sales.utils.ts
+++ b/apps/erp/app/modules/sales/sales.utils.ts
@@ -3,14 +3,19 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import type { Database, Json } from "@carbon/database";
-import type { LeasePaymentTerms, RateUnit, Timing } from "@carbon/utils";
+import type {
+ LeasePaymentTerms,
+ RateUnit,
+ RentalBillingCycle,
+ Timing
+} from "@carbon/utils";
import {
classifyLessorLease,
classifyRentalLine,
equals,
leasePaymentTerms,
- round,
- wholeMonthsInTerm
+ rentalTermMonths,
+ round
} from "@carbon/utils";
import { z } from "zod";
import type {
@@ -219,19 +224,21 @@ export type LeasePolicy = {
substantiallyAllPercent: number;
};
-/** Whole calendar months of the term; null when open-ended. */
+/** Whole months of the term, as activation counts them
+ * (`rentalTermMonths`); null when open-ended. */
export function leaseTermMonths(
+ cycle: RentalBillingCycle,
startDate: string,
endDate: string | null | undefined
): number | null {
- return endDate ? wholeMonthsInTerm(startDate, endDate) : null;
+ return rentalTermMonths(cycle, startDate, endDate || null);
}
/** `leasePaymentTerms` from @carbon/utils — the same function activation
* prices a line with — or null when the line cannot be priced (a rate that
* is not a finite number). */
export function draftLeasePaymentTerms(args: {
- cycle: "Calendar Month" | "28 Days";
+ cycle: RentalBillingCycle;
rateUnit: RateUnit;
rate: number;
discountRate: number;
@@ -256,7 +263,7 @@ export function previewLeaseClassification(args: {
agreement: {
startDate: string;
endDate: string | null;
- billingCycle: "Calendar Month" | "28 Days";
+ billingCycle: RentalBillingCycle;
billingTiming: Timing;
discountRate: number;
ownershipTransfers: boolean;
@@ -308,7 +315,11 @@ export function previewLeaseClassification(args: {
const inputs = {
ownershipTransfers: agreement.ownershipTransfers,
purchaseOptionReasonablyCertain: agreement.purchaseOptionReasonablyCertain,
- termMonths: leaseTermMonths(agreement.startDate, agreement.endDate),
+ termMonths: leaseTermMonths(
+ agreement.billingCycle,
+ agreement.startDate,
+ agreement.endDate
+ ),
economicLifeMonths: line.economicLifeMonths,
pvPayments: 0,
fairValue: line.fairValue,
diff --git a/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementBilling.tsx b/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementBilling.tsx
index c37948836b..6fa21780ff 100644
--- a/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementBilling.tsx
+++ b/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementBilling.tsx
@@ -2,9 +2,10 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
-import { ChoiceCardGroup } from "@carbon/react";
+import { Checkbox, ChoiceCardGroup } from "@carbon/react";
import { INPUT_FORMAT, INPUT_STEP } from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
+import { useState } from "react";
import {
LuCalendarCheck,
LuCalendarClock,
@@ -23,6 +24,9 @@ import { useRentalTermSave } from "./RentalSetupSteps";
import type { RentalAgreement } from "./types";
type BillingCycle = (typeof rentalBillingCycles)[number];
+/** The cycle card: Monthly covers both Calendar Month and Monthly, which the
+ * "Align to calendar periods" box tells apart (as on a contract). */
+type CycleCard = Extract<BillingCycle, "Monthly" | "28 Days">;
type BillingTiming = (typeof rentalBillingTimings)[number];
/** The Select's value for "no override": Radix refuses an empty item value. */
@@ -51,6 +55,12 @@ const RentalAgreementBilling = ({
const { save, saveInvoiceAutomation } = useRentalTermSave(id);
const isDisabled =
rentalAgreement.status !== "Draft" || !permissions.can("update", "sales");
+ const billingCycle: BillingCycle =
+ rentalAgreement.billingCycle ?? "Calendar Month";
+ // The Monthly alignment the user left behind by picking 28 Days, so picking
+ // Monthly again restores it rather than re-ticking the box.
+ const [monthlyCycle, setMonthlyCycle] =
+ useState<Exclude<BillingCycle, "28 Days">>();
const onChange = (
field: Parameters<typeof save>[0],
@@ -87,17 +97,24 @@ const RentalAgreementBilling = ({
}
>
<div className="grid w-full grid-cols-1 gap-x-8 gap-y-6 md:grid-cols-2">
- <ChoiceCardGroup<BillingCycle>
+ <ChoiceCardGroup<CycleCard>
className="md:col-span-2"
direction="row"
label={t`Billing Cycle`}
- value={rentalAgreement.billingCycle ?? "Calendar Month"}
- onChange={(value) => onChange("billingCycle", value)}
+ value={billingCycle === "28 Days" ? "28 Days" : "Monthly"}
+ onChange={(value) => {
+ if (value === "28 Days") {
+ if (billingCycle !== "28 Days") setMonthlyCycle(billingCycle);
+ onChange("billingCycle", value);
+ } else {
+ onChange("billingCycle", monthlyCycle ?? "Calendar Month");
+ }
+ }}
options={[
{
- value: "Calendar Month",
- title: t`Calendar Month`,
- description: t`Each period is a calendar month, with a part month first.`,
+ value: "Monthly",
+ title: t`Monthly`,
+ description: t`Each period is one month, for the month rate.`,
icon: <LuCalendarDays />,
disabled: isDisabled
},
@@ -110,6 +127,33 @@ const RentalAgreementBilling = ({
}
]}
/>
+ <div className="flex items-start gap-3">
+ <Checkbox
+ id="billingCycleAlignment"
+ isChecked={billingCycle === "Calendar Month"}
+ disabled={isDisabled || billingCycle === "28 Days"}
+ onCheckedChange={(checked) =>
+ onChange(
+ "billingCycle",
+ checked === true ? "Calendar Month" : "Monthly"
+ )
+ }
+ />
+ <label
+ htmlFor="billingCycleAlignment"
+ className="flex flex-col gap-1"
+ >
+ <span className="text-sm font-medium">
+ <Trans>Align to calendar periods</Trans>
+ </span>
+ <span className="text-xs text-muted-foreground">
+ <Trans>
+ Bill calendar months, with a part month first. Off, each
+ period starts on the start date's day of the month.
+ </Trans>
+ </span>
+ </label>
+ </div>
<ChoiceCardGroup<BillingTiming>
className="md:col-span-2"
direction="row"
diff --git a/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementProperties.tsx b/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementProperties.tsx
index 9eb5b0ea2c..b123b8b45c 100644
--- a/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/Rentals/RentalAgreementProperties.tsx
@@ -176,6 +176,16 @@ const RentalAgreementProperties = () => {
if (!agreement) return null;
+ // As the Billing card reads: Monthly, with "Align to calendar periods"
+ // telling Calendar Month apart.
+ const billingCycleLabels: Record<
+ (typeof rentalBillingCycles)[number],
+ string
+ > = {
+ Monthly: t`Monthly`,
+ "Calendar Month": t`Monthly (calendar)`,
+ "28 Days": t`28 Days`
+ };
const invoiceAutomationLabels: Record<
(typeof invoiceAutomations)[number],
string
@@ -357,11 +367,17 @@ const RentalAgreementProperties = () => {
name="billingCycle"
label={t`Billing Cycle`}
termId="billing-cycle"
- inline={(value) => <span>{value}</span>}
+ inline={(value) => (
+ <span>
+ {billingCycleLabels[
+ value as (typeof rentalBillingCycles)[number]
+ ] ?? value}
+ </span>
+ )}
isReadOnly={isDisabled}
options={rentalBillingCycles.map((cycle) => ({
value: cycle,
- label: cycle
+ label: billingCycleLabels[cycle]
}))}
onChange={(option) => {
if (option?.value) onUpdate("billingCycle", option.value);
diff --git a/apps/erp/app/modules/sales/ui/Rentals/RentalLeaseClassification.tsx b/apps/erp/app/modules/sales/ui/Rentals/RentalLeaseClassification.tsx
index 3553e09cfa..130cf29b77 100644
--- a/apps/erp/app/modules/sales/ui/Rentals/RentalLeaseClassification.tsx
+++ b/apps/erp/app/modules/sales/ui/Rentals/RentalLeaseClassification.tsx
@@ -33,6 +33,7 @@ import {
import {
formatPercent,
netInvestmentExceedsFairValue,
+ type RentalBillingCycle,
salesTypeRequirementError
} from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -220,7 +221,7 @@ const TEST_KEYS: (keyof LeaseClassificationTests)[] = ["a", "b", "c", "d", "e"];
export type LeaseTermsDraft = {
startDate: string;
endDate: string | null;
- billingCycle: "Calendar Month" | "28 Days";
+ billingCycle: RentalBillingCycle;
billingTiming: "Advance" | "Arrears";
discountRate: number;
ownershipTransfers: boolean;
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
index 5d10bbda8e..19dca72290 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
@@ -1291,13 +1291,13 @@
{"name":"sales_getQuotesList","classification":"READ","paramCount":0,"schema":"efddc7bd8bbc","response":"0ff25946068c","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRelatedPricesForQuoteLine","classification":"READ","paramCount":2,"schema":"71f31780bb98","response":"935691b285a7","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRentableFleetAssets","classification":"READ","paramCount":0,"schema":"efddc7bd8bbc","response":"18707409983d","injectAuth":"companyId","permission":"sales:view","paginates":false},
- {"name":"sales_getRentalAgreement","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"bab51585fc7b","injectAuth":"companyId","permission":"sales:view","paginates":false},
+ {"name":"sales_getRentalAgreement","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"2ab46243420d","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRentalAgreementCharges","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"49b56d3a2f77","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRentalAgreementDeposits","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"d1712908bacb","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRentalAgreementLine","classification":"READ","paramCount":1,"schema":"9729319c460e","response":"241639dc09ac","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRentalAgreementLines","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"3ed7f3538cc6","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getRentalAgreementRelatedDocuments","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"e6faf3cc340a","injectAuth":"companyId","permission":"sales:view","paginates":false},
- {"name":"sales_getRentalAgreements","classification":"READ","paramCount":3,"schema":"c61cae75d189","response":"e6c6ed5e084e","injectAuth":"companyId","permission":"sales:view","paginates":true,"defaults":"always"},
+ {"name":"sales_getRentalAgreements","classification":"READ","paramCount":3,"schema":"c61cae75d189","response":"b02eb9e8bf70","injectAuth":"companyId","permission":"sales:view","paginates":true,"defaults":"always"},
{"name":"sales_getRentalBillingPeriods","classification":"READ","paramCount":1,"schema":"ac265594426e","response":"10915ab32ad5","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getReturnableLinesForCustomer","classification":"READ","paramCount":2,"schema":"e9ef772b4706","response":"8b3d2e7917fd","injectAuth":"companyId","permission":"sales:view","paginates":false},
{"name":"sales_getReturnReason","classification":"READ","paramCount":1,"schema":"937e7a95a060","response":"784c9ecc581f","injectAuth":"companyId","permission":"sales:view","paginates":false},
@@ -1340,7 +1340,7 @@
{"name":"sales_insertCustomerContact","classification":"WRITE","paramCount":4,"schema":"c5775e935035","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
{"name":"sales_insertCustomerLocation","classification":"WRITE","paramCount":4,"schema":"c30fcaea26e0","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
{"name":"sales_insertQuote","classification":"WRITE","paramCount":16,"schema":"a6c40455c9f1","response":"9e29b49e1dc8","injectAuth":"companyGroupId+companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
- {"name":"sales_insertRentalAgreement","classification":"WRITE","paramCount":22,"schema":"ebd937b5bb2c","response":"83a132e7dfec","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
+ {"name":"sales_insertRentalAgreement","classification":"WRITE","paramCount":22,"schema":"1ba69424695e","response":"83a132e7dfec","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
{"name":"sales_insertSalesOrder","classification":"WRITE","paramCount":17,"schema":"b76b79d52d88","response":"dbfc22813350","injectAuth":"companyGroupId+companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
{"name":"sales_insertSalesReturnOrder","classification":"WRITE","paramCount":12,"schema":"307356313ba5","response":"c32485518acd","injectAuth":"companyGroupId+companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
{"name":"sales_insertSalesRFQ","classification":"WRITE","paramCount":13,"schema":"5a54a12e500f","response":"0c1a1b93cca3","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create","paginates":false},
@@ -1370,7 +1370,7 @@
{"name":"sales_updateQuoteMaterialOrder","classification":"WRITE","paramCount":1,"schema":"c822495a7892","response":"646de62ab761","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false,"result":"envelopes"},
{"name":"sales_updateQuoteOperationOrder","classification":"WRITE","paramCount":1,"schema":"c822495a7892","response":"646de62ab761","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false,"result":"envelopes"},
{"name":"sales_updateQuoteStatus","classification":"WRITE","paramCount":3,"schema":"db2529b2f9b5","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},
- {"name":"sales_updateRentalAgreement","classification":"WRITE","paramCount":22,"schema":"ea42378f3633","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},
+ {"name":"sales_updateRentalAgreement","classification":"WRITE","paramCount":22,"schema":"ffc475da95c4","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},
{"name":"sales_updateRentalAgreementInvoiceAutomation","classification":"WRITE","paramCount":2,"schema":"321dd5c5e689","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},
{"name":"sales_updateSalesOrder","classification":"WRITE","paramCount":9,"schema":"d9b815fe7f4c","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},
{"name":"sales_updateSalesOrderExchangeRate","classification":"WRITE","paramCount":2,"schema":"bca4d06461aa","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},
diff --git a/docs/content/docs/reference/rental-agreements.mdx b/docs/content/docs/reference/rental-agreements.mdx
index a2ddabef93..64391b7394 100644
--- a/docs/content/docs/reference/rental-agreements.mdx
+++ b/docs/content/docs/reference/rental-agreements.mdx
@@ -101,14 +101,18 @@ Each billing period bills the whole days, weeks, or months it covers at the unit
| 10 | 10 days, 1,000 | 2 weeks, 1,000 | 1 month, 1,500 |
| 28 | 28 days, 2,800 | 4 weeks, 2,000 | 1 month, 1,500 |
-On a **Calendar Month** agreement each period is a calendar month. A Monthly unit bills its rate times the days used divided by the days in that month: at 1,500 a month, a start on October 15 bills 17 of 31 days, 822.58, and a full month bills 1,500. A Daily unit bills the days in the period, and a Weekly unit the whole weeks: at 500 a week, a 31-day month is five weeks, 2,500.
+On a **Monthly** agreement each period is one month from the start date: a start on October 7 bills October 7 to November 6, then November 7 to December 6, and is invoiced on the 7th every month. A Monthly unit bills its rate for every whole period, so twelve periods a year bill twelve times the rate. A start on the 29th to the 31st moves to the last day of a shorter month and returns to its own day after it: a start on January 31 bills January 31 to February 27, then February 28 to March 30.
+
+With **"Align to calendar periods"** ticked, a Monthly agreement bills calendar months instead (shown as *Monthly (calendar)* in the Properties panel). A Monthly unit bills its rate times the days used divided by the days in that month: at 1,500 a month, a start on October 15 bills 17 of 31 days, 822.58, and a full month bills 1,500.
+
+On either kind of Monthly agreement, a period cut short by the end date or a return bills the month rate times the days used divided by the days in its whole period. A Daily unit bills the days in the period, and a Weekly unit the whole weeks: at 500 a week, a 31-day period is five weeks, 2,500.
## Billing
-<Term id="cycle-billing">Billing periods</Term> follow the **"Billing Cycle"** from the start date, and the **"Billing Timing"** decides when each one falls due: *Advance* on its first day, *Arrears* on its last. The **Billing Periods** section of the agreement shows every period with its days, frequency, amount, and invoice.
+<Term id="cycle-billing">Billing periods</Term> follow the **"Billing Cycle"** from the start date: *Monthly* (with or without **"Align to calendar periods"**) or *28 Days*. The **"Billing Timing"** decides when each one falls due: *Advance* on its first day, *Arrears* on its last. The **Billing Periods** section of the agreement shows every period with its days, frequency, amount, and invoice.
- **Fixed term.** With an **"End Date"**, the whole term is cut at activation.
-- **Open-ended.** Leave the end date empty and periods roll forward. Every billing pass cuts the periods up to the end of next month (Calendar Month) or 28 days ahead (28 Days), plus one more period after that.
+- **Open-ended.** Leave the end date empty and periods roll forward. Every billing pass cuts the periods up to one month ahead (Monthly), the end of next month (Monthly, aligned to calendar periods), or 28 days ahead (28 Days), plus one more period after that.
- **Holdover.** A unit treated as a rental that is still out after the end date keeps billing at the same rate until it is returned. A unit treated as a sale never bills past its end date: activation cuts its periods only up to the end date, and the daily billing pass never rolls it forward.
- **Return.** On a unit treated as a rental, the unbilled period the return falls inside is cut to the return date, and unbilled periods after it are dropped. The billing of a unit treated as a sale is left alone.
@@ -195,7 +199,8 @@ A unit treated as a sale is a sales-type lease. Take a unit rented for 36 months
A unit treated as a sale is sold to the lease when the agreement activates, not when it is delivered. Activation refuses such a unit without an end date or a fair value, one whose agreement starts before the month of activation, and one whose term is not a whole number of billing periods:
-- **Calendar Month**: the agreement starts on the first of a month and ends on the last day of a month.
+- **Monthly**: the agreement ends on the day before a monthly anniversary of its start date, on any start day. A 12-month term from January 15 ends on January 14.
+- **Monthly, aligned to calendar periods**: the agreement starts on the first of a month and ends on the last day of a month.
- **28 Days**: the term is a whole number of 28-day periods.
The rent billed then equals the rent stream the lease was valued on. A start in an earlier month is refused because the commencement posts on the day of activation, while interest is dated from the start: those months would show interest on a net investment the books did not hold yet. The **"Activate"** confirmation shows any of these problems for each unit before you activate.
@@ -316,8 +321,8 @@ The asset is Draft, Under Construction, or Disposed.
### "No week rate is set for this item; enter the rate"
A unit was added without a rate (from the Fleet register's **"Rent"** action, or through the API) and no customer, customer type, or item rate is on file for its frequency. Enter the rate on the unit, or set one on the part's Sales tab.
-### "UNIT is treated as a sale, which on a Calendar Month agreement needs a monthly rate"
-A Daily or Weekly unit bills a different amount each calendar month, and a sale is valued as a level monthly payment that its invoices must match. Make the unit Monthly, or use a 28 Days agreement.
+### "UNIT is treated as a sale, which on a CYCLE agreement needs a monthly rate"
+CYCLE is Monthly or Calendar Month. A Daily or Weekly unit bills a different amount each month, and a sale is valued as a level monthly payment that its invoices must match. Make the unit Monthly, or use a 28 Days agreement. *Calendar Month* is a Monthly agreement with **"Align to calendar periods"** ticked.
### "UNIT has no rate; enter its rate before activating"
A unit at a rate of zero would go on rent and bill nothing. Set its **"Rate"** on the setup's Units step, or on the unit's page.
@@ -388,8 +393,8 @@ After the accounting cutover, activation or the return of a unit treated as a sa
### "UNIT is treated as a sale, which needs an agreement end date" / "UNIT is treated as a sale; enter the unit's fair value"
Activation refuses a line that classifies (or is overridden to) `Sale` without `rentalAgreement.endDate` or `rentalAgreementLine.fairValue` > 0. Set the end date on the agreement or the Fair Value on the unit, or override the treatment to Rental.
-### "UNIT is treated as a sale, which runs whole billing periods: start on the first of a month and end on a month end" / "UNIT is treated as a sale, which runs whole billing periods: the term must be a whole number of 28-day periods (it is N days)"
-A unit treated as a sale (a sales-type lease) must bill exactly the rent stream it was valued on (`salesTypeRequirementError`, `lessor-lease` in `@carbon/utils`). Calendar Month: start date on the 1st and end date on a month end. 28 Days: start to end inclusive is a multiple of 28 days. The Activate confirmation (`RentalCommencementPreview`) shows the same message per unit before activation refuses it. Fix the dates or override the treatment to Rental.
+### "UNIT is treated as a sale, which runs whole billing periods: …"
+The message ends, by billing cycle: Monthly, "end it the day before a monthly anniversary of its start date, such as DATE"; Calendar Month, "start on the first of a month and end on a month end"; 28 Days, "the term must be a whole number of 28-day periods (it is N days)". A unit treated as a sale (a sales-type lease) must bill exactly the rent stream it was valued on (`salesTypeRequirementError`, `lessor-lease` in `@carbon/utils`). Monthly: the end date is the day before `start + n months` (`leaseMonthEnd`), any start day; the message names the next such date. Calendar Month: start date on the 1st and end date on a month end. 28 Days: start to end inclusive is a multiple of 28 days. The Activate confirmation (`RentalCommencementPreview`) shows the same message per unit before activation refuses it. Fix the dates or override the treatment to Rental.
### "UNIT is treated as a sale, which commences when the agreement is activated: start it in YYYY-MM or later (it starts DATE)"
A unit treated as a sale whose agreement starts before the first of the activation month (company timezone) is refused (`salesTypeRequirementError`). The commencement journal is dated the activation day, while the schedule's interest is dated from the start date. Move the start date into the current month, or override the treatment to Rental.
diff --git a/docs/content/src/glossary/terms.ts b/docs/content/src/glossary/terms.ts
index abe93a0859..8dd8f657d6 100644
--- a/docs/content/src/glossary/terms.ts
+++ b/docs/content/src/glossary/terms.ts
@@ -539,12 +539,12 @@ export const terms = {
},
"cycle-billing": {
term: msg`Cycle billing`,
- definition: msg`Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears).`,
+ definition: msg`Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears).`,
href: "/docs/reference/rental-agreements#billing"
},
"billing-cycle": {
term: msg`Billing cycle`,
- definition: msg`How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days.`,
+ definition: msg`How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days.`,
href: "/docs/reference/rental-agreements#billing"
},
"billing-timing": {
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index e06ad9d2db..a86568f28d 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -125365,7 +125365,7 @@ export default {
type: "string"
},
billingCycle: {
- enum: ["Calendar Month", "28 Days"],
+ enum: ["Calendar Month", "28 Days", "Monthly"],
format: 'public."rentalBillingCycle"',
type: "string"
},
@@ -128319,7 +128319,7 @@ export default {
},
billingCycle: {
default: "Calendar Month",
- enum: ["Calendar Month", "28 Days"],
+ enum: ["Calendar Month", "28 Days", "Monthly"],
format: 'public."rentalBillingCycle"',
type: "string"
},
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index f5a4b1ce0c..dd29609670 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -95553,7 +95553,7 @@ export type Database = {
reimbursementStatus: "Draft" | "Posted" | "Voided"
rentalAgreementLineStatus: "Pending" | "On Rent" | "Returned" | "Sold"
rentalAgreementStatus: "Draft" | "Active" | "Closed" | "Cancelled"
- rentalBillingCycle: "Calendar Month" | "28 Days"
+ rentalBillingCycle: "Calendar Month" | "28 Days" | "Monthly"
rentalBillingPeriodStatus: "Pending" | "Invoiced"
rentalBillingTiming: "Advance" | "Arrears"
rentalInvoiceLineType: "Rent" | "Charge" | "Purchase Option"
@@ -97119,7 +97119,7 @@ export const Constants = {
reimbursementStatus: ["Draft", "Posted", "Voided"],
rentalAgreementLineStatus: ["Pending", "On Rent", "Returned", "Sold"],
rentalAgreementStatus: ["Draft", "Active", "Closed", "Cancelled"],
- rentalBillingCycle: ["Calendar Month", "28 Days"],
+ rentalBillingCycle: ["Calendar Month", "28 Days", "Monthly"],
rentalBillingPeriodStatus: ["Pending", "Invoiced"],
rentalBillingTiming: ["Advance", "Arrears"],
rentalInvoiceLineType: ["Rent", "Charge", "Purchase Option"],
diff --git a/packages/database/supabase/migrations/20261016144058_rental-monthly-billing-cycle.sql b/packages/database/supabase/migrations/20261016144058_rental-monthly-billing-cycle.sql
new file mode 100644
index 0000000000..b6d234b074
--- /dev/null
+++ b/packages/database/supabase/migrations/20261016144058_rental-monthly-billing-cycle.sql
@@ -0,0 +1,5 @@
+-- A rental agreement billed monthly from its start date: a start on the 7th
+-- bills the 7th to the 6th, invoiced on the same day every month for the
+-- month rate. Calendar Month aligns every agreement to the 1st; 28 Days bills
+-- thirteen periods a year. See .ai/plans/2026-10-16-rental-monthly-anniversary-billing.md.
+ALTER TYPE "rentalBillingCycle" ADD VALUE IF NOT EXISTS 'Monthly';
diff --git a/packages/jobs/manifests/schema.json b/packages/jobs/manifests/schema.json
index 3b4662c266..189f17f0e0 100644
--- a/packages/jobs/manifests/schema.json
+++ b/packages/jobs/manifests/schema.json
@@ -1,11 +1,11 @@
{
"kind": "carbon-company-backup",
"version": 1,
- "schemaVersion": "20261015161847",
+ "schemaVersion": "20261016144058",
"sourceCompanyId": "schema-baseline",
"sourceCompanyGroupId": null,
"sourceCompanyName": null,
- "exportedAt": "2026-10-15T15:58:36.181Z",
+ "exportedAt": "2026-10-16T14:45:48.480Z",
"exportedBy": "schema-baseline",
"label": "schema baseline",
"includeStorage": "none",
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index ad9a7f28dd..4954c286e7 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Größte Ursachen für Ausschuss nach Grund, Artikel oder Arbeitsplatz"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Abrechnung nach Kalendermonaten mit Teilmonat zuerst. Aus: Jeder Zeitraum beginnt am Monatstag des Startdatums."
+
msgid "Bill of Material"
msgstr "Stückliste"
@@ -4058,8 +4061,8 @@ msgstr "Abgerechnet:"
msgid "Billing"
msgstr "Abrechnung"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Abrechnung einer Miete in festen Perioden, entweder Kalendermonate oder aufeinanderfolgende 28-Tage-Perioden, jede am ersten Tag (Im Voraus) oder am letzten Tag (Im Nachhinein) fakturiert."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Abrechnung einer Miete in festen Perioden, entweder in Monaten vom Startdatum an, Kalendermonaten oder aufeinanderfolgenden 28-Tage-Perioden, wobei jede Periode am ersten Tag (Vorauszahlung) oder am letzten Tag (Nachzahlung) fakturiert wird."
msgid "Billing Address"
msgstr "Rechnungsadresse"
@@ -4318,9 +4321,6 @@ msgstr "Berechnungsmethode"
msgid "Calendar"
msgstr "Kalender"
-msgid "Calendar Month"
-msgstr "Kalendermonat"
-
msgid "Calibration"
msgstr "Kalibrierung"
@@ -8277,9 +8277,6 @@ msgstr "Jede Zahlung ist am letzten Tag ihrer Periode fällig."
msgid "Each period is 28 days from the start date."
msgstr "Jede Periode beträgt 28 Tage vom Startdatum an."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Jede Periode ist ein Kalendermonat, mit einem Teilmonat zuerst."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Jeder Zeitraum wird an seinem ersten Tag in Rechnung gestellt, bevor die Leistung erbracht wird."
@@ -8292,6 +8289,9 @@ msgstr "Jeder Zeitraum wird an seinem letzten Tag in Rechnung gestellt, nachdem
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Jede Periode wird am letzten Tag fakturiert, nachdem die Einheiten verwendet wurden."
+msgid "Each period is one month, for the month rate."
+msgstr "Jeder Zeitraum ist ein Monat zum Monatssatz."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Jede physische Einheit erhält ihre eigene verfolgte Einheit und eine eindeutige Nummer – eine verfolgte Einheit, ein Stück."
@@ -10876,8 +10876,8 @@ msgstr "Wie eine Vertragsposition ihre Umsatzerlöse über ihre Umsatzdaten verd
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Wie ein Vertrag oder eine Änderung für Berichte über wiederkehrende Umsatzerlöse klassifiziert wird: Neuer Verkauf, Bestehend, Erweiterung, Reaktivierung oder Kontraktion. Carbon schlägt das vor und Sie können es ändern."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Wie eine Mietvereinbarung Abrechnungsperioden ab ihrem Startdatum abschneidet: Kalendermonat schneidet Kalendermonate ab, und 28 Tage schneidet aufeinanderfolgende 28-Tage-Perioden ab. Jede Einheit berechnet einen Tarif gemäß ihrer eigenen Häufigkeit für alle ganzen Tage, Wochen oder Monate, die eine Periode abdeckt; ein monatlicher Tarif in einem Kalendermonat wird tageweise anteilig berechnet."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Wie eine Mietvereinbarung Abrechnungsperioden ab dem Startdatum schneidet: Monatlich schneidet ab dem Tag des Startdatums jeweils einen Monat ab (z. B. bei Beginn am 7.: Abrechnung vom 7. bis 6.), Kalendermonat (Monatlich, an Kalenderperioden ausgerichtet) schneidet Kalendermonate ab, und 28 Tage schneidet jeweils 28-Tage-Perioden ab. Jeder Abrechnungszeitraum rechnet einen Satz ab, in seiner eigenen Häufigkeit, für alle Tage, Wochen oder Monate, die er umfasst; ein monatlicher Satz in einer Teilperiode wird tageweise anteilig berechnet."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Wie ein Artikel insgesamt aufgefüllt wird (Fremdbeschaffung, Eigenfertigung oder Fremdbeschaffung und Eigenfertigung), pro Artikel festgelegt, anders als die Bereitstellungsart pro Position."
@@ -13537,6 +13537,9 @@ msgstr "Monatssatz"
msgid "Monthly"
msgstr "Monatlich"
+msgid "Monthly (calendar)"
+msgstr "Monatlich (Kalender)"
+
msgid "Monthly Depreciation"
msgstr "Monatliche Abschreibung"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 5aa6d9b318..de0e193a7d 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Biggest causes of scrap by reason, item, or work center"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+
msgid "Bill of Material"
msgstr "Bill of Material"
@@ -4058,8 +4061,8 @@ msgstr "Billed:"
msgid "Billing"
msgstr "Billing"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
msgid "Billing Address"
msgstr "Billing Address"
@@ -4318,9 +4321,6 @@ msgstr "Calculation Method"
msgid "Calendar"
msgstr "Calendar"
-msgid "Calendar Month"
-msgstr "Calendar Month"
-
msgid "Calibration"
msgstr "Calibration"
@@ -8277,9 +8277,6 @@ msgstr "Each payment is due on the last day of its period."
msgid "Each period is 28 days from the start date."
msgstr "Each period is 28 days from the start date."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Each period is a calendar month, with a part month first."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Each period is invoiced on its first day, before the service is delivered."
@@ -8292,6 +8289,9 @@ msgstr "Each period is invoiced on its last day, after the service is delivered.
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Each period is invoiced on its last day, after the units are used."
+msgid "Each period is one month, for the month rate."
+msgstr "Each period is one month, for the month rate."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
@@ -10876,8 +10876,8 @@ msgstr "How a contract line earns its revenue over its revenue dates: Daily, the
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
@@ -13537,6 +13537,9 @@ msgstr "Month Rate"
msgid "Monthly"
msgstr "Monthly"
+msgid "Monthly (calendar)"
+msgstr "Monthly (calendar)"
+
msgid "Monthly Depreciation"
msgstr "Monthly Depreciation"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index f20fdec8db..0ecb5520fc 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Las principales causas de desperdicio por motivo, artículo o centro de trabajo"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Facturar en meses de calendario, con un mes parcial primero. Desactivado, cada período comienza el día del mes de la fecha de inicio."
+
msgid "Bill of Material"
msgstr "Lista de Materiales"
@@ -4058,8 +4061,8 @@ msgstr "Facturado:"
msgid "Billing"
msgstr "Facturación"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Facturación de alquiler en períodos fijos, ya sean meses calendario o períodos consecutivos de 28 días, cada uno facturado en su primer día (Anticipado) o su último día (Vencido)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Facturación de un alquiler en períodos fijos, ya sean meses desde la fecha de inicio, meses naturales o períodos consecutivos de 28 días, cada uno facturado en su primer día (Por adelantado) o su último día (Al vencimiento)."
msgid "Billing Address"
msgstr "Dirección de Facturación"
@@ -4318,9 +4321,6 @@ msgstr "Método de Cálculo"
msgid "Calendar"
msgstr "Calendario"
-msgid "Calendar Month"
-msgstr "Mes de Calendario"
-
msgid "Calibration"
msgstr "Calibración"
@@ -8277,9 +8277,6 @@ msgstr "Cada pago vence el último día de su período."
msgid "Each period is 28 days from the start date."
msgstr "Cada período es 28 días desde la fecha de inicio."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Cada período es un mes calendario, con un mes parcial primero."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Cada período se factura el primer día, antes de prestar el servicio."
@@ -8292,6 +8289,9 @@ msgstr "Cada período se factura el último día, después de prestar el servici
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Cada período se factura el último día, después de que se usen las unidades."
+msgid "Each period is one month, for the month rate."
+msgstr "Cada período es un mes, para la tarifa mensual."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Cada unidad física obtiene su propia entidad rastreada y número único — una entidad, una unidad."
@@ -10876,8 +10876,8 @@ msgstr "Cómo una línea de contrato genera sus ingresos por ventas durante sus
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Cómo se clasifica un contrato o una enmienda para la presentación de ingresos recurrentes: Nuevas Ventas, Existente, Expansión, Reactivación o Contracción. Carbon lo sugiere y puedes cambiarlo."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Cómo un acuerdo de arrendamiento corta períodos de facturación desde su fecha de inicio: Mes de calendario corta meses de calendario, y 28 Días corta períodos consecutivos de 28 días. Cada unidad factura una tarifa a su propia frecuencia para los días, semanas o meses completos que cubre un período; una tarifa mensual en un mes de calendario se prorratea por días."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Cómo un acuerdo de alquiler divide períodos de facturación desde su fecha de inicio: Mensual divide un mes desde el día de la fecha de inicio (un inicio el 7 factura del 7 al 6), Mes Natural (Mensual, alineado a períodos de calendario) divide meses naturales, y 28 Días divide períodos consecutivos de 28 días. Cada unidad factura una tarifa a su propia frecuencia por todos los días, semanas o meses que cubre un período; una tarifa mensual en un período parcial se prorratea por días."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Cómo se repone un Artículo en general (Compra, Fabricación, o Compra y fabricación), establecido por Artículo, a diferencia del Tipo de suministro por Línea."
@@ -13537,6 +13537,9 @@ msgstr "Tarifa mensual"
msgid "Monthly"
msgstr "Mensual"
+msgid "Monthly (calendar)"
+msgstr "Mensual (calendario)"
+
msgid "Monthly Depreciation"
msgstr "Depreciación Mensual"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 7cc54695b4..9b973a6c3c 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Bêta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Principales causes de rebut par raison, article ou poste de travail"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Facturer par mois civils, avec un mois partiel en premier. Désactivé, chaque période commence le jour du mois de la date de début."
+
msgid "Bill of Material"
msgstr "Nomenclature"
@@ -4058,8 +4061,8 @@ msgstr "Facturé :"
msgid "Billing"
msgstr "Facturation"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Facturation d'une location en périodes fixes, soit des mois civils, soit des périodes consécutives de 28 jours, chacune facturée le premier jour (Anticipé) ou le dernier jour (Arriéré)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Facturation d'une location en périodes fixes, soit des mois à partir de la date de début, des mois calendaires, ou des périodes consécutives de 28 jours, chacune facturée à son premier jour (Anticipée) ou à son dernier jour (Différée)."
msgid "Billing Address"
msgstr "Adresse de facturation"
@@ -4318,9 +4321,6 @@ msgstr "Méthode de calcul"
msgid "Calendar"
msgstr "Calendrier"
-msgid "Calendar Month"
-msgstr "Mois Calendaire"
-
msgid "Calibration"
msgstr "Étalonnage"
@@ -8277,9 +8277,6 @@ msgstr "Chaque paiement est dû le dernier jour de sa période."
msgid "Each period is 28 days from the start date."
msgstr "Chaque période est de 28 jours à partir de la date de début."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Chaque période est un mois calendaire, avec un mois partiel en premier."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Chaque période est facturée le premier jour, avant la prestation du service."
@@ -8292,6 +8289,9 @@ msgstr "Chaque période est facturée le dernier jour, après la prestation du s
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Chaque période est facturée le dernier jour, après que les unités ont été utilisées."
+msgid "Each period is one month, for the month rate."
+msgstr "Chaque période dure un mois, pour le tarif mensuel."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Chaque unité physique obtient sa propre entité suivie et un numéro unique — une entité, une unité."
@@ -10876,8 +10876,8 @@ msgstr "Comment une ligne de contrat génère ses revenus sur ses dates de reven
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Comment un contrat ou un amendement est classé pour la déclaration des revenus récurrents : Nouvelles Ventes, Existant, Expansion, Réactivation ou Contraction. Carbon le suggère et vous pouvez le modifier."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Comment un accord de location découpe les périodes de facturation à partir de sa Date de début : Mois calendaire découpe les mois calendaires, et 28 jours découpe les périodes consécutives de 28 jours. Chaque Unité facture un taux à sa propre fréquence pour les jours, semaines ou mois entiers qu'une période couvre ; un taux Mensuel dans un mois calendaire est réparti au prorata des jours."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Comment un accord de location coupe les périodes de facturation à partir de sa date de début : Mensuel coupe un mois à partir du jour de la date de début (un démarrage le 7 facture du 7 au 6), Mois calendaire (Mensuel, aligné sur les périodes calendaires) coupe les mois calendaires, et 28 Jours coupe les périodes consécutives de 28 jours. Chaque unité facture un taux à sa propre fréquence pour la durée complète (jours, semaines ou mois) qu'une période couvre; un taux mensuel dans une période partielle est au prorata par jour."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Comment un article est approvisionné globalement (Achat, Fabrication ou Achat et fabrication), défini par article, contrairement au type d'approvisionnement par ligne."
@@ -13537,6 +13537,9 @@ msgstr "Tarif mensuel"
msgid "Monthly"
msgstr "Mensuel"
+msgid "Monthly (calendar)"
+msgstr "Mensuel (calendrier)"
+
msgid "Monthly Depreciation"
msgstr "Amortissement mensuel"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 69f896a7f9..31554122f7 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -4022,6 +4022,9 @@ msgstr "बीटा"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "कारण, आइटम या वर्क सेंटर के अनुसार स्क्रैप के सबसे बड़े कारण"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "कैलेंडर महीनों के अनुसार बिल करें, पहले आंशिक महीने के साथ। बंद होने पर, प्रत्येक अवधि प्रारंभ तिथि के दिन से शुरू होती है।"
+
msgid "Bill of Material"
msgstr "सामग्री की बिल"
@@ -4058,8 +4061,8 @@ msgstr "बिल भेजा गया:"
msgid "Billing"
msgstr "बिलिंग"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "किराये को निश्चित अवधियों में बिल करना, या तो कैलेंडर महीने या लगातार 28-दिन की अवधि, प्रत्येक को इसके पहले दिन (अग्रिम) या इसके अंतिम दिन (बकाया) पर चालान किया जाता है।"
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "किराये को निर्धारित अवधि में बिल करना - प्रारंभ तिथि से महीने, कैलेंडर महीने, या लगातार 28 दिन की अवधि - प्रत्येक को पहले दिन (अग्रिम) या अंतिम दिन (बकाया) चालान किया जाता है।"
msgid "Billing Address"
msgstr "बिलिंग पता"
@@ -4318,9 +4321,6 @@ msgstr "गणना विधि"
msgid "Calendar"
msgstr "कैलेंडर"
-msgid "Calendar Month"
-msgstr "कैलेंडर माह"
-
msgid "Calibration"
msgstr "अंशांकन"
@@ -8277,9 +8277,6 @@ msgstr "प्रत्येक भुगतान अपनी अवधि
msgid "Each period is 28 days from the start date."
msgstr "प्रत्येक अवधि प्रारंभ तिथि से 28 दिन है।"
-msgid "Each period is a calendar month, with a part month first."
-msgstr "प्रत्येक अवधि एक कैलेंडर महीना है, पहले एक आंशिक महीना है।"
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "प्रत्येक अवधि का चालान उसके पहले दिन, सेवा दिए जाने से पहले बनाया जाता है।"
@@ -8292,6 +8289,9 @@ msgstr "प्रत्येक अवधि का चालान उसक
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "प्रत्येक अवधि को इसके अंतिम दिन चालान दिया जाता है, इकाइयों के उपयोग के बाद।"
+msgid "Each period is one month, for the month rate."
+msgstr "प्रत्येक अवधि एक महीना है, मासिक दर के लिए।"
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "प्रत्येक भौतिक इकाई को अपनी खुद की ट्रैक की गई इकाई और अद्वितीय संख्या मिलती है — एक इकाई, एक इकाई।"
@@ -10876,8 +10876,8 @@ msgstr "अनुबंध की पंक्ति अपने राजस
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "अनुबंध या संशोधन को आवर्ती-राजस्व रिपोर्टिंग के लिए कैसे वर्गीकृत किया जाता है: नई बिक्री, मौजूदा, विस्तार, पुनः सक्रियण, या संकुचन। Carbon इसका सुझाव देता है और आप इसे बदल सकते हैं।"
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "एक किराया समझौता अपनी प्रारंभ तिथि से बिलिंग अवधि को कैसे काटता है: कैलेंडर माह कैलेंडर महीनों को काटता है, और 28 दिन लगातार 28-दिन की अवधि को काटते हैं। प्रत्येक इकाई एक दर पर अपनी आवृत्ति पर बिल करती है जो एक अवधि द्वारा कवर किए जाने वाले पूरे दिन, सप्ताह, या महीने के लिए है; कैलेंडर माह में एक मासिक दर दिनों द्वारा आनुपातिक है।"
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "किराया समझौता अपनी प्रारंभ तिथि से बिलिंग अवधि को कैसे विभाजित करता है: मासिक विकल्प प्रारंभ तिथि के दिन से एक महीना निर्धारित करता है (7 तारीख को शुरू होने पर 7वीं से 6वीं तक का बिल), कैलेंडर माह (मासिक, कैलेंडर अवधि के साथ संरेखित) कैलेंडर महीनों को निर्धारित करता है, और 28 दिन का विकल्प लगातार 28 दिन की अवधि निर्धारित करता है। प्रत्येक विकल्प अपनी आवृत्ति पर एक दर से बिल करता है जो अवधि के सभी दिनों, हफ्तों, या महीनों को कवर करता है; एक आंशिक अवधि में महीने की दर दिनों के आधार पर समानुपाती होती है।"
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "किसी आइटम को समग्र रूप से कैसे आपूर्ति किया जाता है (खरीद, निर्माण, या खरीद और निर्माण), प्रति आइटम सेट किया जाता है, प्रति-पंक्ति आपूर्ति प्रकार के विपरीत।"
@@ -13537,6 +13537,9 @@ msgstr "माह दर"
msgid "Monthly"
msgstr "मासिक"
+msgid "Monthly (calendar)"
+msgstr "मासिक (कैलेंडर)"
+
msgid "Monthly Depreciation"
msgstr "मासिक मूल्यह्रास"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index ab89e3b08f..4581612957 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Cause principali di scarto per motivo, articolo o centro di lavoro"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Fatturare i mesi di calendario, con un mese parziale per primo. Disattivato, ogni periodo inizia il giorno del mese della data di inizio."
+
msgid "Bill of Material"
msgstr "Distinta Base"
@@ -4058,8 +4061,8 @@ msgstr "Fatturato:"
msgid "Billing"
msgstr "Fatturazione"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Fatturazione di un noleggio in periodi fissi, mesi di calendario o periodi consecutivi di 28 giorni, ciascuno Fatturato nel primo giorno (Anticipato) o nell'ultimo giorno (Posticipato)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Fatturazione di un noleggio in periodi fissi, sia mesi dalla data di inizio, mesi del calendario, o periodi consecutivi di 28 giorni, ognuno fatturato il primo giorno (Anticipato) o l'ultimo giorno (Posticipato)."
msgid "Billing Address"
msgstr "Indirizzo di Fatturazione"
@@ -4318,9 +4321,6 @@ msgstr "Metodo di Calcolo"
msgid "Calendar"
msgstr "Calendario"
-msgid "Calendar Month"
-msgstr "Mese Calendario"
-
msgid "Calibration"
msgstr "Taratura"
@@ -8277,9 +8277,6 @@ msgstr "Ogni pagamento è dovuto l'ultimo giorno del suo periodo."
msgid "Each period is 28 days from the start date."
msgstr "Ogni periodo è di 28 giorni dalla data di inizio."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Ogni periodo è un mese di calendario, con un mese parziale per primo."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Ogni periodo viene fatturato il primo giorno, prima che il servizio sia erogato."
@@ -8292,6 +8289,9 @@ msgstr "Ogni periodo viene fatturato l'ultimo giorno, dopo che il servizio è st
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Ogni periodo viene fatturato l'ultimo giorno, dopo che le unità sono state utilizzate."
+msgid "Each period is one month, for the month rate."
+msgstr "Ogni periodo è un mese, per la tariffa mensile."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Ogni unità fisica ottiene la propria entità tracciata e numero univoco — un'entità, un'unità."
@@ -10876,8 +10876,8 @@ msgstr "Come una riga del contratto guadagna i suoi ricavi nel corso delle sue d
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Come un contratto o un emendamento viene classificato per la rendicontazione ricorrente dei ricavi: Nuove vendite, Esistente, Espansione, Riattivazione o Contrazione. Carbon lo suggerisce e puoi cambiarlo."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Come un contratto di noleggio divide i periodi di fatturazione dalla sua data di inizio: il mese di calendario divide i mesi di calendario, e 28 giorni divide periodi di 28 giorni consecutivi. Ogni unità fattura un tasso alla sua frequenza per i giorni, settimane o mesi interi che un periodo copre; un tasso mensile in un mese di calendario è ripartito per giorni."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Come un contratto di noleggio divide i periodi di fatturazione dalla sua data di inizio: Mensile divide un mese dal giorno della data di inizio (un inizio il 7 fattura dal 7 al 6), Mese di calendario (Mensile, allineato ai periodi del calendario) divide i mesi del calendario, e 28 giorni divide periodi consecutivi di 28 giorni. Ogni unità fattura un tasso alla sua frequenza propria per i giorni, le settimane, o i mesi interi che un periodo copre; un tasso mensile in un periodo parziale è ripartito per giorni."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Come viene rifornito complessivamente un articolo (Acquisto, Produzione, o Acquisto e produzione), impostato per articolo, diversamente dal tipo di fornitura per riga."
@@ -13537,6 +13537,9 @@ msgstr "Tariffa mensile"
msgid "Monthly"
msgstr "Mensile"
+msgid "Monthly (calendar)"
+msgstr "Mensile (calendario)"
+
msgid "Monthly Depreciation"
msgstr "Ammortamento mensile"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index cb0bd161f8..3926ed656a 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -4022,6 +4022,9 @@ msgstr "ベータ"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "理由、品目、または作業区別の最大スクラップ原因"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "暦月で請求し、最初は端数月。オフの場合、各期間は開始日の月の日から始まります。"
+
msgid "Bill of Material"
msgstr "材料表"
@@ -4058,8 +4061,8 @@ msgstr "請求済み:"
msgid "Billing"
msgstr "請求"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "固定期間でのレンタル請求。カレンダー月または連続する28日間の各期間が、最初の日(前払い)または最後の日(後払い)に請求済となります。"
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "レンタル請求は固定期間で行われ、開始日からの月、カレンダー月、または連続する28日間のいずれかを期間とします。各期間は最初の日(前払い)または最後の日(後払い)に請求済です。"
msgid "Billing Address"
msgstr "請求先住所"
@@ -4318,9 +4321,6 @@ msgstr "計算方法"
msgid "Calendar"
msgstr "カレンダー"
-msgid "Calendar Month"
-msgstr "暦月"
-
msgid "Calibration"
msgstr "校正"
@@ -8277,9 +8277,6 @@ msgstr "各支払は期間の末日に支払期日になります。"
msgid "Each period is 28 days from the start date."
msgstr "各期間は開始日から28日間です。"
-msgid "Each period is a calendar month, with a part month first."
-msgstr "各期間はカレンダー月であり、最初は一部月です。"
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "各期間はサービス提供前の初日に請求されます。"
@@ -8292,6 +8289,9 @@ msgstr "各期間はサービス提供後の最終日に請求されます。"
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "各期間は最後の日に請求され、個が使用された後です。"
+msgid "Each period is one month, for the month rate."
+msgstr "各期間は1ヶ月で、月額レートが適用されます。"
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "各物理的な個が独自の追跡対象と一意番号を取得します。1 追跡対象 = 1 個。"
@@ -10876,8 +10876,8 @@ msgstr "契約明細が売上高日にわたって売上高を獲得する方法
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "契約または修正が継続売上高レポート用にどのように分類されるか:新規販売、既存、拡張、再開始、または縮小。Carbonが提案し、変更できます。"
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "レンタル契約が開始日から請求期間をどのように切り分けるかです。カレンダー月はカレンダー月を、28日は連続する28日周期を切り分けます。各個はその頻度で1つのレートで請求され、期間がカバーする全日数、週数、または月数に対して請求されます。カレンダー月内の月次レートは日割計算されます。"
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "レンタル契約がその開始日から請求期間をどのように区切るかについて:毎月は開始日からの1か月を期間とします(例:開始日が7日の場合は毎月7日から翌月6日まで)。カレンダー月(毎月をカレンダー期間に合わせたもの)はカレンダー月ごとに期間を区切ります。28日は連続した28日間の期間に区切ります。各期間は、独自の頻度で、全体の日、週、または月に対して1つのレートを請求します。一部期間での月額レートは日数で按分されます。"
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "品目全体がどのように補充されるか(購入、内製、または購入・内製)。品目ごとに設定され、行ごとの供給方式とは異なります"
@@ -13537,6 +13537,9 @@ msgstr "月額レート"
msgid "Monthly"
msgstr "月次"
+msgid "Monthly (calendar)"
+msgstr "毎月(暦月)"
+
msgid "Monthly Depreciation"
msgstr "毎月減価償却"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 4a6296690f..b7fbaa960b 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -4022,6 +4022,9 @@ msgstr "베타"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "이유, 품목 또는 작업장별 스크랩의 가장 큰 원인"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "달력 월 단위로 청구하며, 첫 달은 부분 월입니다. 비활성화된 경우 각 기간은 시작일의 월별 날짜부터 시작됩니다."
+
msgid "Bill of Material"
msgstr "자재명세서"
@@ -4058,8 +4061,8 @@ msgstr "청구됨:"
msgid "Billing"
msgstr "결제"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "임차를 역월 또는 연속 28일 기간과 같은 고정 기간으로 청구하며, 각각은 첫 날(선행)에 또는 마지막 날(후행)에 송장 발행됩니다."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "임대료를 고정된 기간으로 청구: 시작일로부터의 월, 달력월, 또는 연속 28일 기간 중 선택하며, 각 기간은 첫날(선입금) 또는 마지막날(후불금)에 송장 발행됨."
msgid "Billing Address"
msgstr "청구지 주소"
@@ -4318,9 +4321,6 @@ msgstr "계산 방법"
msgid "Calendar"
msgstr "달력"
-msgid "Calendar Month"
-msgstr "달력 월"
-
msgid "Calibration"
msgstr "교정"
@@ -8277,9 +8277,6 @@ msgstr "각 지불은 해당 기간의 마지막 날에 만기됩니다."
msgid "Each period is 28 days from the start date."
msgstr "각 기간은 시작일부터 28일입니다."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "각 기간은 달력 월이며, 부분 월이 먼저 옵니다."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "각 기간은 서비스 제공 전 첫날에 청구됩니다."
@@ -8292,6 +8289,9 @@ msgstr "각 기간은 서비스 제공 후 마지막 날에 청구됩니다."
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "각 기간은 마지막 날에 송장이 발행되며, 단위를 사용한 후입니다."
+msgid "Each period is one month, for the month rate."
+msgstr "각 기간은 1개월이며, 월별 요금으로 청구됩니다."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "각 물리적 개는 자신의 추적 대상과 고유 번호를 받습니다 — 하나의 추적 대상, 하나의 개."
@@ -10876,8 +10876,8 @@ msgstr "계약 라인이 수익 인식 기간에 수익을 인식하는 방식:
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "계약 또는 수정안이 반복 수익 보고를 위해 어떻게 분류되는지: 신규 영업, 기존, 확대, 재활성화, 또는 축소. Carbon이 제안하며 변경할 수 있습니다."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "임차 계약이 시작일부터 청구 기간을 생성하는 방식: Calendar Month는 달력 월을 생성하고, 28 Days는 연속 28일 기간을 생성합니다. 각 단위는 기간이 포함하는 전체 일, 주 또는 월 동안 자체 빈도로 하나의 요금을 청구합니다. 달력 월의 월간 요금은 일 단위로 비례합니다."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "임대료 계약이 시작일로부터 청구 기간을 어떻게 분할하는지: 매월은 시작일의 날로부터 한 달을 분할합니다 (예: 7일 시작은 7일부터 6일까지 청구), 달력월(매월, 달력 기간에 맞춤)은 달력월을 분할하고, 28일은 연속 28일 기간을 분할합니다. 각 개는 기간이 포함하는 전체 날짜, 주, 또는 월에 대해 자신의 빈도로 하나의 료율로 청구됩니다; 부분 기간의 월별 료율은 일수로 비례 배분됩니다."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "품목을 전체적으로 재보충하는 방법(구매, 사내 생산 또는 구매 및 사내 생산)입니다. 라인별 공급 방식과 달리 품목별로 설정됩니다."
@@ -13537,6 +13537,9 @@ msgstr "월간 요금"
msgid "Monthly"
msgstr "월간"
+msgid "Monthly (calendar)"
+msgstr "매월 (달력)"
+
msgid "Monthly Depreciation"
msgstr "매월 감가상각"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index a4b23d5e06..5063092d01 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Największe przyczyny braków z powodu, artykułu lub stanowiska roboczego"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Rozliczaj miesiące kalendarzowe z częściowym miesiącem na początku. Wyłączone - każdy okres rozpoczyna się w dniu miesiąca daty rozpoczęcia."
+
msgid "Bill of Material"
msgstr "Zestawienie Materiałów"
@@ -4058,8 +4061,8 @@ msgstr "Rozliczono:"
msgid "Billing"
msgstr "Rozliczenia"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Rozliczanie wynajmu w ustalonych okresach, albo w miesiącach kalendarzowych, albo w kolejnych okresach 28-dniowych, każdy Zafakturowany w jego pierwszym dniu (Advance) lub ostatnim dniu (Arrears)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Naliczanie wynajmu w stałych okresach — miesiące od daty rozpoczęcia, miesiące kalendarzowe lub kolejne okresy 28-dniowe — każdy z nich zafakturowany w jego pierwszym dniu (Z góry) lub ostatnim dniu (Z dołu)."
msgid "Billing Address"
msgstr "Adres rozliczeniowy"
@@ -4318,9 +4321,6 @@ msgstr "Metoda Obliczania"
msgid "Calendar"
msgstr "Kalendarz"
-msgid "Calendar Month"
-msgstr "Miesiąc Kalendarzowy"
-
msgid "Calibration"
msgstr "Wzorcowanie"
@@ -8277,9 +8277,6 @@ msgstr "Każda płatność jest należna ostatniego dnia okresu."
msgid "Each period is 28 days from the start date."
msgstr "Każdy okres to 28 dni od daty rozpoczęcia."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Każdy okres to miesiąc kalendarzowy, ze wstępną częścią miesiąca."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Każdy okres jest fakturowany pierwszego dnia, przed wykonaniem usługi."
@@ -8292,6 +8289,9 @@ msgstr "Każdy okres jest fakturowany ostatniego dnia, po wykonaniu usługi."
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Każdy okres jest fakturowany ostatniego dnia, po użyciu sztuk."
+msgid "Each period is one month, for the month rate."
+msgstr "Każdy okres to jeden miesiąc, za stawką miesięczną."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Każda jednostka fizyczna otrzymuje swoją własną jednostkę śledzenia i unikalny numer — jedna jednostka, jedna jednostka."
@@ -10876,8 +10876,8 @@ msgstr "Jak pozycja umowy zarabia swoje przychody ze sprzedaży w okresach przyc
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Jak umowa lub zmiana są klasyfikowane do raportowania przychodu cyklicznego: Nowa Sprzedaż, Istniejące, Ekspansja, Reaktywacja lub Kontrakcja. Carbon sugeruje to, a ty możesz to zmienić."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Jak umowa wynajmu wyznacza okresy rozliczeniowe od jej daty rozpoczęcia: Miesiąc kalendarny wyznacza miesiące kalendarowe, a 28 Dni wyznacza kolejne 28-dniowe okresy. Każda jednostka rozlicza się jedną stawką przy własnej częstotliwości przez całe dni, tygodnie lub miesiące, które okres obejmuje; miesięczna stawka w miesiącu kalendarnym jest przeliczana proporcjonalnie do dni."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Jak umowa wynajmu dzieli okresy rozliczeniowe od jej daty rozpoczęcia: Co miesiąc dzieli jeden miesiąc od dnia daty rozpoczęcia (start w dniu 7. obejmuje okres od 7. do 6.), Miesiąc kalendarzowy (wyrównany do okresów kalendarzowych) dzieli miesiące kalendarzowe, a 28 dni dzieli kolejne okresy 28-dniowe. Każdy okres nalicza jedną stawkę z właściwą częstotliwością dla całych dni, tygodni lub miesięcy, które okres obejmuje; stawka miesięczna w okresie częściowym jest rozliczana proporcjonalnie do liczby dni."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Jak artykuł jest uzupełniany ogółem (Zakup, Produkcja lub Zakup i produkcja), ustawione na artykuł, w odróżnieniu od typu zasilania dla każdej pozycji."
@@ -13537,6 +13537,9 @@ msgstr "Stawka miesięczna"
msgid "Monthly"
msgstr "Miesięcznie"
+msgid "Monthly (calendar)"
+msgstr "Co miesiąc (kalendarzowo)"
+
msgid "Monthly Depreciation"
msgstr "Miesięczna amortyzacja"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 336b091809..887b8b9c7e 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Maiores causas de refugo por motivo, item ou centro de trabalho"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Faturar meses do calendário, com um mês parcial primeiro. Desativado, cada período inicia no dia do mês da data de início."
+
msgid "Bill of Material"
msgstr "Lista de Materiais"
@@ -4058,8 +4061,8 @@ msgstr "Faturado:"
msgid "Billing"
msgstr "Faturação"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Faturamento de um aluguel em períodos fixos, meses civis ou períodos consecutivos de 28 dias, cada um sendo faturado no seu primeiro dia (Antecipado) ou no seu último dia (Em Atraso)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Faturação de um aluguel em períodos fixos, meses a partir da data de início, meses do calendário ou períodos consecutivos de 28 dias, cada um faturado no seu primeiro dia (Antecipado) ou último dia (Atrasado)."
msgid "Billing Address"
msgstr "Endereço de Cobrança"
@@ -4318,9 +4321,6 @@ msgstr "Método de Cálculo"
msgid "Calendar"
msgstr "Calendário"
-msgid "Calendar Month"
-msgstr "Mês do Calendário"
-
msgid "Calibration"
msgstr "Calibração"
@@ -8277,9 +8277,6 @@ msgstr "Cada pagamento vence no último dia do seu período."
msgid "Each period is 28 days from the start date."
msgstr "Cada período tem 28 dias a partir da data de início."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Cada período é um mês do calendário, com um mês parcial primeiro."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Cada período é faturado no primeiro dia, antes da prestação do serviço."
@@ -8292,6 +8289,9 @@ msgstr "Cada período é faturado no último dia, após a prestação do serviç
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Cada período é faturado em seu último dia, após as unidades serem usadas."
+msgid "Each period is one month, for the month rate."
+msgstr "Cada período dura um mês, com taxa mensal."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Cada unidade física obtém sua própria entidade rastreada e número único — uma entidade, uma unidade."
@@ -10876,8 +10876,8 @@ msgstr "Como uma linha de contrato aufere sua receita ao longo de suas datas de
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Como um contrato ou uma emenda é classificado para relatórios de receita recorrente: Novas Vendas, Existente, Expansão, Reativação ou Contração. O Carbon sugere e você pode alterar."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Como um contrato de aluguel corta períodos de cobrança a partir de sua data de início: Mês de Calendário corta meses de calendário e 28 Dias corta períodos consecutivos de 28 dias. Cada unidade cobra uma taxa em sua própria frequência pelos dias, semanas ou meses inteiros que um período abrange; uma taxa mensal em um mês de calendário é rateada por dias."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Como um contrato de aluguel corta períodos de faturação a partir da sua data de início: Mensal corta um mês a partir do dia da data de início (um início no 7º fatura do 7º ao 6º), Mês do Calendário (Mensal, alinhado a períodos do calendário) corta meses do calendário, e 28 Dias corta períodos consecutivos de 28 dias. Cada unidade fatura uma taxa em sua própria frequência pelos dias, semanas ou meses inteiros que um período cobre; uma taxa mensal em um período parcial é rateada por dias."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Como um item é reabastecido em geral (Compra, Fabricação ou Compra e fabricação), definido por item, diferentemente do tipo de suprimento por linha."
@@ -13537,6 +13537,9 @@ msgstr "Taxa Mensal"
msgid "Monthly"
msgstr "Mensal"
+msgid "Monthly (calendar)"
+msgstr "Mensal (calendário)"
+
msgid "Monthly Depreciation"
msgstr "Depreciação Mensal"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 2ca5334d31..e7ee673ba3 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Бета"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Основные причины брака по типу, номенклатуре или рабочему центру"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Выставлять счета по календарным месяцам с неполным месяцем в начале. Отключено: каждый период начинается в число даты начала."
+
msgid "Bill of Material"
msgstr "Спецификация материалов"
@@ -4058,8 +4061,8 @@ msgstr "Счет выставлен:"
msgid "Billing"
msgstr "Выставление счетов"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Выставление счетов за аренду в фиксированные периоды (календарные месяцы или последовательные 28-дневные периоды), каждый счет выставляется в его первый день (Авансово) или его последний день (По факту)."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Выставление счета за аренду в фиксированные периоды: либо месяцы от даты начала, либо календарные месяцы, либо последовательные 28-дневные периоды, каждый счет выставлен в первый день (авансово) или в последний день (постфактум)."
msgid "Billing Address"
msgstr "Адрес выставления счета"
@@ -4318,9 +4321,6 @@ msgstr "Метод расчета"
msgid "Calendar"
msgstr "Календарь"
-msgid "Calendar Month"
-msgstr "Календарный месяц"
-
msgid "Calibration"
msgstr "Калибровка"
@@ -8277,9 +8277,6 @@ msgstr "Каждый платеж подлежит оплате в послед
msgid "Each period is 28 days from the start date."
msgstr "Каждый период составляет 28 дней от даты начала."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Каждый период — это календарный месяц с частичным месяцем вначале."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Каждый период выставляется в счёт в первый день, до оказания услуги."
@@ -8292,6 +8289,9 @@ msgstr "Каждый период выставляется в счёт в пос
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "На каждый период выставляется счет в его последний день, после того как единицы используются."
+msgid "Each period is one month, for the month rate."
+msgstr "Каждый период — один месяц, по месячной ставке."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Каждая физическая единица получает свой отслеживаемый объект и уникальный номер — один объект, одна единица."
@@ -10876,8 +10876,8 @@ msgstr "Как строка контракта генерирует выручк
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Как контракт или поправка классифицируются для отчетности по повторяющейся выручке: Новые продажи, Существующий, Расширение, Реактивация или Сокращение. Carbon предлагает это, и вы можете это изменить."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Как договор аренды разделяет периоды выставления счетов с даты начала: календарный месяц разделяет периоды по календарным месяцам, а 28 дней разделяет последовательные 28-дневные периоды. Каждая единица выставляет счет по одной ставке с собственной периодичностью за все дни, недели или месяцы, охватываемые периодом; месячная ставка за календарный месяц рассчитывается пропорционально дням."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Как договор аренды отсчитывает периоды выставления счетов от своей даты начала: ежемесячно отсчитывает один месяц, начиная с дня даты начала (начало 7-го числа означает выставление счета с 7-го по 6-е число), календарный месяц (ежемесячно, согласованный с календарными периодами) отсчитывает календарные месяцы, и 28 дней отсчитывает последовательные 28-дневные периоды. Каждый период выставляет счет по одной ставке в своей периодичности за полные дни, недели или месяцы, охватываемые периодом; месячная ставка в частичном периоде рассчитывается пропорционально дням."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Как номенклатура пополняется в целом (Закупка, Производство или Закупка и производство), устанавливается на номенклатуру, в отличие от способа обеспечения по строкам."
@@ -13537,6 +13537,9 @@ msgstr "Месячный тариф"
msgid "Monthly"
msgstr "Ежемесячно"
+msgid "Monthly (calendar)"
+msgstr "Ежемесячно (календарный)"
+
msgid "Monthly Depreciation"
msgstr "Ежемесячная амортизация"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index b4ef89f070..207424e70a 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -4022,6 +4022,9 @@ msgstr "Beta"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "Fire'in nedene, stok kartına veya iş merkezine göre en büyük nedenleri"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "Takvim aylarını faturalandır, kısmi aydan başlayarak. Kapalı, her dönem başlangıç tarihinin ayın gününde başlar."
+
msgid "Bill of Material"
msgstr "Malzeme Listesi"
@@ -4058,8 +4061,8 @@ msgstr "Faturalandı:"
msgid "Billing"
msgstr "Faturalandırma"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "Kiralamayı sabit dönemlerde, takvim ayları veya ardışık 28 günlük dönemler olarak, her birinin ilk gününde (Avans) veya son gününde (Ödeme vadeli) faturalandırılması."
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "Bir kiralama işleminin sabit dönemlerle faturalandırılması: başlangıç tarihinden itibaren aylar, takvim ayları veya ardışık 28 günlük dönemler halinde, her biri ilk gününde (Peşin) veya son gününde (Sonradan) faturalandırılır."
msgid "Billing Address"
msgstr "Faturalama Adresi"
@@ -4318,9 +4321,6 @@ msgstr "Hesaplama Yöntemi"
msgid "Calendar"
msgstr "Takvim"
-msgid "Calendar Month"
-msgstr "Takvim Ayı"
-
msgid "Calibration"
msgstr "Kalibrasyon"
@@ -8277,9 +8277,6 @@ msgstr "Her ödeme, döneminin son gününde vadesi gelir."
msgid "Each period is 28 days from the start date."
msgstr "Her dönem başlangıç tarihinden itibaren 28 gündür."
-msgid "Each period is a calendar month, with a part month first."
-msgstr "Her dönem bir takvim ayı olup, ilk olarak kısmi bir ay vardır."
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "Her dönem, hizmet verilmeden önce ilk gününde faturalandırılır."
@@ -8292,6 +8289,9 @@ msgstr "Her dönem, hizmet verildikten sonra son gününde faturalandırılır."
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "Her dönem son gününde faturalandırılır, adetler kullanıldıktan sonra."
+msgid "Each period is one month, for the month rate."
+msgstr "Her dönem bir aydır, aylık oran için."
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "Her fiziksel birim kendi izlenen varlığını ve benzersiz numarasını alır — bir varlık, bir birim."
@@ -10876,8 +10876,8 @@ msgstr "Bir sözleşme satırının hasılatını gelir tarihlerine göre nasıl
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "Bir sözleşme veya değişikliğin yinelenen gelir raporlaması için nasıl sınıflandırıldığı: Yeni Satış, Mevcut, Genişleme, Reaktivasyon veya Daralma. Carbon bunu önerir ve siz bunu değiştirebilirsiniz."
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "Bir kira sözleşmesinin başlangıç tarihinden faturalama dönemlerini nasıl kestiği: Takvim Ayı takvim aylarını keser ve 28 Gün ardışık 28 günlük dönemleri keser. Her adet, bir dönemin kapsadığı tüm gün, hafta veya ay için kendi frekansında bir tarife faturalandırır; takvim ayında aylık tarife gün sayısı oranında hesaplanır."
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "Bir kiralama anlaşmasının başlangıç tarihinden faturalandırma dönemlerini nasıl kestiği: Aylık, başlangıç tarihinin gününden bir ayı keser (7. gün başlangıçlı bir anlaşma 7'den 6'sına kadarını faturalandırır), Takvim Ayı (Aylık, takvim dönemleriyle uyumlu) takvim aylarını keser, ve 28 Gün ardışık 28 günlük dönemleri keser. Her dönem, kendi frekansıyla bir oranı, dönemin kapsadığı tamamlanmış gün, hafta veya aylar için faturalandırır; kısmi bir dönemde aylık oran güne orantılı olarak hesaplanır."
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "Bir stok kartının genel olarak nasıl tamamlandığı (Satın alma, Üretim veya Satın alma ve üretim), stok kartı başına ayarlanır, satır başına tedarik şeklinden farklı."
@@ -13537,6 +13537,9 @@ msgstr "Aylık Oran"
msgid "Monthly"
msgstr "Aylık"
+msgid "Monthly (calendar)"
+msgstr "Aylık (takvim)"
+
msgid "Monthly Depreciation"
msgstr "Aylık Amortisman"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 4e1ebebb5c..a3d311104d 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -4022,6 +4022,9 @@ msgstr "测试版"
msgid "Biggest causes of scrap by reason, item, or work center"
msgstr "按原因、物料或工作中心显示最大报废原因"
+msgid "Bill calendar months, with a part month first. Off, each period starts on the start date's day of the month."
+msgstr "按日历月计费,首月包含部分月份。关闭时,每个周期从开始日期的该日期开始。"
+
msgid "Bill of Material"
msgstr "物料清单"
@@ -4058,8 +4061,8 @@ msgstr "已计费:"
msgid "Billing"
msgstr "账单"
-msgid "Billing a rental in fixed periods, either calendar months or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
-msgstr "按固定周期对租赁进行计费,可以是日历月或连续28天周期,每个周期在其第一天(提前)或最后一天(滞后)开具发票。"
+msgid "Billing a rental in fixed periods, either months from the start date, calendar months, or consecutive 28-day periods, each invoiced on its first day (Advance) or its last day (Arrears)."
+msgstr "租赁按固定期间计费,可以是从开始日期开始的月份、日历月份或连续的28天期间,每个期间在其第一天(提前)或最后一天(后付)已开票。"
msgid "Billing Address"
msgstr "账单地址"
@@ -4318,9 +4321,6 @@ msgstr "计算方法"
msgid "Calendar"
msgstr "日历"
-msgid "Calendar Month"
-msgstr "日历 月"
-
msgid "Calibration"
msgstr "校准"
@@ -8277,9 +8277,6 @@ msgstr "每个付款在其期间的最后一天到期。"
msgid "Each period is 28 days from the start date."
msgstr "每个周期从开始日期起28天。"
-msgid "Each period is a calendar month, with a part month first."
-msgstr "每个周期是一个日历月,首先是部分月。"
-
msgid "Each period is invoiced on its first day, before the service is delivered."
msgstr "每个期间在第一天开具发票,即在提供服务之前。"
@@ -8292,6 +8289,9 @@ msgstr "每个期间在最后一天开具发票,即在提供服务之后。"
msgid "Each period is invoiced on its last day, after the units are used."
msgstr "每个周期在其最后一天开具发票,在单位使用之后。"
+msgid "Each period is one month, for the month rate."
+msgstr "每个周期为一个月,按月费率计算。"
+
msgid "Each physical unit gets its own tracked entity and unique number — one entity, one unit."
msgstr "每个物理件获得其自己的追踪实体和唯一编号——一个实体,一个件。"
@@ -10876,8 +10876,8 @@ msgstr "合同行如何在其收入日期内获得收入:每日,每天金额
msgid "How a contract or an amendment is classified for recurring-revenue reporting: New Sales, Existing, Expansion, Reactivation, or Contraction. Carbon suggests it and you can change it."
msgstr "合同或修订如何为经常性收入报告分类:新销售、现有、扩展、重新激活或缩减。Carbon 会建议分类,您可以更改。"
-msgid "How a rental agreement cuts billing periods from its start date: Calendar Month cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a calendar month is prorated by days."
-msgstr "租赁协议如何从其开始日期生成计费周期:日历月生成日历月,28 天生成连续的 28 天周期。每个单元按其自身的频率计费一个费率,用于一个周期涵盖的整个天数、周数或月数;日历月中的月费率按天数按比例分配。"
+msgid "How a rental agreement cuts billing periods from its start date: Monthly cuts one month from the start date's day (a start on the 7th bills the 7th to the 6th), Calendar Month (Monthly, aligned to calendar periods) cuts calendar months, and 28 Days cuts consecutive 28-day periods. Each unit bills one rate at its own frequency for the whole days, weeks, or months a period covers; a monthly rate in a part period is prorated by days."
+msgstr "租赁协议如何从开始日期开始划分计费期间:每月从开始日期的那一天划分一个月(例如,从7日开始计费到6日),日历月(每月,与日历期间对齐)划分日历月,28天则划分连续的28天期间。每件按其自身频率对周期所涵盖的整个天数、周或月计费一个费率;在部分期间内的月费率按天分摊。"
msgid "How an item is replenished overall (Buy, Make, or Buy and Make), set per item, unlike the per-line method type."
msgstr "物料整体的补货方式(采购、自制或采购与自制),按物料设定,与按行的供料方式不同"
@@ -13537,6 +13537,9 @@ msgstr "月费率"
msgid "Monthly"
msgstr "每月"
+msgid "Monthly (calendar)"
+msgstr "每月(日历)"
+
msgid "Monthly Depreciation"
msgstr "每月折旧"
diff --git a/packages/server-functions/src/create-rental-invoices/index.ts b/packages/server-functions/src/create-rental-invoices/index.ts
index 8a373adf5e..c69008740a 100644
--- a/packages/server-functions/src/create-rental-invoices/index.ts
+++ b/packages/server-functions/src/create-rental-invoices/index.ts
@@ -777,8 +777,8 @@ async function rollBillingPeriodsForward(
/** "2026-10-01 – 2026-10-28 · 28 days · 1 × Month rate — Skid Steer 4
* SN-1001", "… · 31 days · Month rate — …" (a Monthly unit on a Calendar
- * Month agreement is its month rate prorated by days, so it names no unit
- * count), or for an early-return credit "Early return credit — 3 days used". */
+ * Month or Monthly agreement is its month rate prorated by days, so it names
+ * no unit count), or for an early-return credit "Early return credit — 3 days used". */
export function rentLineDescription(period: {
cycle: Database["public"]["Enums"]["rentalBillingCycle"];
periodStart: string;
@@ -802,7 +802,7 @@ export function rentLineDescription(period: {
const tier =
period.rateUnitApplied === null
? ""
- : period.cycle === "Calendar Month" && period.rateUnitApplied === "Month"
+ : period.cycle !== "28 Days" && period.rateUnitApplied === "Month"
? " · Month rate"
: ` · ${wholeRateUnits(period.days, period.rateUnitApplied)} × ${period.rateUnitApplied} rate`;
return `${period.periodStart} – ${period.periodEnd} · ${period.days} days${tier}${unit ? ` — ${unit}` : ""}`;
diff --git a/packages/server-functions/src/create-rental-invoices/monthly-cycle.test.ts b/packages/server-functions/src/create-rental-invoices/monthly-cycle.test.ts
new file mode 100644
index 0000000000..74b2e2813a
--- /dev/null
+++ b/packages/server-functions/src/create-rental-invoices/monthly-cycle.test.ts
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
+// including ports, remain AGPLv3; serving them over a network requires releasing their source.
+
+// A Monthly rental agreement against the live database: periods run from the
+// start date's day (7 Sep – 6 Oct, 7 Oct – 6 Nov, …) when the daily billing
+// pass rolls them forward and when a return re-cuts them, and every whole
+// period bills the month rate.
+
+import { sql } from "kysely";
+import { expect } from "vitest";
+import create from "../create";
+import { databaseTest } from "../local-database-test-fixture";
+import postReceipt from "../post-receipt";
+import { rentalFixture } from "../post-rental-agreement/rental-test-fixture";
+import createRentalInvoices from "./index";
+
+type Fixture = Awaited<ReturnType<typeof rentalFixture>>;
+
+async function putOnRent(f: Fixture) {
+ await f.db
+ .updateTable("rentalAgreementLine")
+ .set({ status: "On Rent", deliveredAt: "2026-09-07" })
+ .where("id", "=", f.lineIds[0]!)
+ .where("companyId", "=", f.companyId)
+ .execute();
+}
+
+async function billingPeriods(f: Fixture) {
+ const rows = await f.db
+ .selectFrom("rentalBillingPeriod")
+ .select([
+ sql<string>`"periodStart"::text`.as("periodStart"),
+ sql<string>`"periodEnd"::text`.as("periodEnd"),
+ "days",
+ "amount",
+ "status",
+ "rateUnitApplied",
+ "isAdjustment"
+ ])
+ .where("rentalAgreementLineId", "=", f.lineIds[0]!)
+ .where("companyId", "=", f.companyId)
+ .orderBy("periodStart")
+ .orderBy("isAdjustment")
+ .execute();
+ return rows.map((row) => [
+ row.periodStart,
+ row.periodEnd,
+ row.days,
+ Number(row.amount),
+ row.rateUnitApplied,
+ row.status
+ ]);
+}
+
+databaseTest(
+ "the daily pass rolls a Monthly agreement forward from its start day and bills the month rate",
+ async () => {
+ const f = await rentalFixture({ billingCycle: "Monthly" });
+ try {
+ await putOnRent(f);
+ // The fixture seeds its periods without a tier; activation records one.
+ await f.db
+ .updateTable("rentalBillingPeriod")
+ .set({ rateUnitApplied: "Month" })
+ .where("rentalAgreementLineId", "=", f.lineIds[0]!)
+ .where("companyId", "=", f.companyId)
+ .execute();
+
+ const result = await createRentalInvoices(f.ctx, {
+ asOf: "2026-10-20",
+ rentalAgreementId: f.agreementId
+ });
+ expect(result.error).toBeNull();
+ expect(result.data!.failures).toEqual([]);
+
+ // The horizon is today + 1 month (20 Nov): the 7 Nov period, plus one
+ // beyond it. 7 Oct – 6 Nov fell due on the 7th and is billed.
+ expect(await billingPeriods(f)).toEqual([
+ ["2026-09-07", "2026-10-06", 30, 300, "Month", "Invoiced"],
+ ["2026-10-07", "2026-11-06", 31, 300, "Month", "Invoiced"],
+ ["2026-11-07", "2026-12-06", 30, 300, "Month", "Pending"],
+ ["2026-12-07", "2027-01-06", 31, 300, "Month", "Pending"]
+ ]);
+
+ const lines = await f.db
+ .selectFrom("salesInvoiceLine")
+ .select(["description", "unitPrice"])
+ .where("companyId", "=", f.companyId)
+ .where("rentalAgreementId", "=", f.agreementId)
+ .execute();
+ expect(lines).toHaveLength(1);
+ expect(lines[0]!.description).toContain(
+ "2026-10-07 – 2026-11-06 · 31 days · Month rate"
+ );
+ expect(Number(lines[0]!.unitPrice)).toBe(300);
+ } finally {
+ await f.cleanup();
+ }
+ }
+);
+
+databaseTest(
+ "a return cuts a Monthly period to the days used, prorated by that period's length",
+ async () => {
+ const f = await rentalFixture({ billingCycle: "Monthly" });
+ try {
+ await putOnRent(f);
+ const receipt = await create(f.ctx, {
+ type: "receiptFromRentalAgreement",
+ rentalAgreementId: f.agreementId,
+ rentalAgreementLineId: f.lineIds[0]!
+ });
+ expect(receipt.error).toBeNull();
+ const posted = await postReceipt(f.ctx, {
+ type: "post",
+ receiptId: receipt.data!.id,
+ postingDate: "2026-10-15"
+ });
+ expect(posted.error).toBeNull();
+
+ // 7 – 15 Oct is 9 of the period's 31 days: 300 × 9 ÷ 31 = 87.10.
+ expect(await billingPeriods(f)).toEqual([
+ ["2026-09-07", "2026-10-06", 30, 300, null, "Invoiced"],
+ ["2026-10-07", "2026-10-15", 9, 87.1, "Month", "Pending"]
+ ]);
+ } finally {
+ await f.cleanup();
+ }
+ }
+);
diff --git a/packages/server-functions/src/create-rental-invoices/rent-line-description.test.ts b/packages/server-functions/src/create-rental-invoices/rent-line-description.test.ts
index 1563b758a5..40bc19cfac 100644
--- a/packages/server-functions/src/create-rental-invoices/rent-line-description.test.ts
+++ b/packages/server-functions/src/create-rental-invoices/rent-line-description.test.ts
@@ -37,3 +37,20 @@ it("does not repeat a serial number the asset's name already carries", () => {
"2026-10-07 – 2026-10-31 · 25 days · 4 × Week rate — Reaction Wheel 0.010 Nm RW-SN-T2"
);
});
+
+it("a Monthly unit on a Monthly agreement names the month rate, not a unit count", () => {
+ expect(
+ rentLineDescription({
+ ...period,
+ cycle: "Monthly",
+ periodStart: "2026-10-07",
+ periodEnd: "2026-11-06",
+ days: 31,
+ rateUnitApplied: "Month",
+ assetName: "Skid Steer 4",
+ serialNumber: "SN-1001"
+ })
+ ).toBe(
+ "2026-10-07 – 2026-11-06 · 31 days · Month rate — Skid Steer 4 SN-1001"
+ );
+});
diff --git a/packages/server-functions/src/post-rental-agreement/lessor.test.ts b/packages/server-functions/src/post-rental-agreement/lessor.test.ts
index 9c58791ecf..581b7e4b23 100644
--- a/packages/server-functions/src/post-rental-agreement/lessor.test.ts
+++ b/packages/server-functions/src/post-rental-agreement/lessor.test.ts
@@ -75,6 +75,42 @@ it("a Calendar Month line pays the month rate once per whole month at the agreem
).toEqual({ termMonths: 36, payment: 1000, periods: 36, annualRate: 6 });
});
+it("a Monthly line pays the month rate once per whole month from its start", () => {
+ expect(
+ leasePaymentTerms({
+ decimals: DECIMALS,
+ cycle: "Monthly",
+ ...MONTHLY,
+ discountRate: 6,
+ startDate: "2027-01-15",
+ endDate: "2028-01-14"
+ })
+ ).toEqual({ termMonths: 12, payment: 1000, periods: 12, annualRate: 6 });
+ // A start on the 31st: its first period ends on 27 February, one month.
+ expect(
+ leasePaymentTerms({
+ decimals: DECIMALS,
+ cycle: "Monthly",
+ ...MONTHLY,
+ discountRate: 6,
+ startDate: "2027-01-31",
+ endDate: "2027-07-30"
+ })
+ ).toEqual({ termMonths: 6, payment: 1000, periods: 6, annualRate: 6 });
+ // A Daily unit is valued at its average month, as on Calendar Month.
+ expect(
+ leasePaymentTerms({
+ decimals: DECIMALS,
+ cycle: "Monthly",
+ rateUnit: "Day",
+ rate: 50,
+ discountRate: 6,
+ startDate: "2027-01-15",
+ endDate: "2028-01-14"
+ }).payment
+ ).toEqual(1520.83);
+});
+
it("an open-ended or sub-month line is valued over one period", () => {
const openEnded = leasePaymentTerms({
decimals: DECIMALS,
@@ -390,6 +426,37 @@ it("a Calendar Month sales-type lease starts on the first and ends on a month en
);
});
+it("a Monthly sales-type lease runs whole months from its start, on any day", () => {
+ const base = {
+ name: "FA-1",
+ cycle: "Monthly" as const,
+ rateUnit: "Month" as const,
+ startDate: "2027-01-15",
+ endDate: "2028-01-14",
+ fairValue: 38000,
+ today: "2026-12-15"
+ };
+ expect(salesTypeRequirementError(base)).toEqual(null);
+ expect(
+ salesTypeRequirementError({
+ ...base,
+ startDate: "2027-01-31",
+ endDate: "2027-02-27"
+ })
+ ).toEqual(null);
+ // A day short of the twelfth month bills a part period at the end.
+ expect(salesTypeRequirementError({ ...base, endDate: "2028-01-13" })).toEqual(
+ "FA-1 is treated as a sale, which runs whole billing periods: end it the day before a monthly anniversary of its start date, such as 2028-01-14"
+ );
+ // Shorter than one month.
+ expect(salesTypeRequirementError({ ...base, endDate: "2027-01-20" })).toEqual(
+ "FA-1 is treated as a sale, which runs whole billing periods: end it the day before a monthly anniversary of its start date, such as 2027-02-14"
+ );
+ expect(salesTypeRequirementError({ ...base, rateUnit: "Day" })).toEqual(
+ "FA-1 is treated as a sale, which on a Monthly agreement needs a monthly rate"
+ );
+});
+
it("a 28 Days sales-type lease runs a whole number of 28-day periods", () => {
const base = {
name: "FA-1",
@@ -501,6 +568,20 @@ it("a whole-period sales-type lease bills exactly payment × periods", () => {
startDate: "2027-02-01",
endDate: "2028-03-31"
},
+ {
+ cycle: "Monthly" as const,
+ ...MONTHLY,
+ // Mid-month: twelve periods, where Calendar Month would cut thirteen.
+ startDate: "2027-01-15",
+ endDate: "2028-01-14"
+ },
+ {
+ cycle: "Monthly" as const,
+ ...MONTHLY,
+ // From the 31st, through short months.
+ startDate: "2027-01-31",
+ endDate: "2027-07-30"
+ },
{
cycle: "28 Days" as const,
...MONTHLY,
diff --git a/packages/server-functions/src/post-rental-agreement/rental-test-fixture.ts b/packages/server-functions/src/post-rental-agreement/rental-test-fixture.ts
index 4baf71046a..19beb1a521 100644
--- a/packages/server-functions/src/post-rental-agreement/rental-test-fixture.ts
+++ b/packages/server-functions/src/post-rental-agreement/rental-test-fixture.ts
@@ -3,8 +3,10 @@
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
// A live-database rental agreement for the rental tests: one Active agreement
-// that started 2026-09-01, billed monthly, with N serial fleet units on
-// Pending lines. September is invoiced, October is not.
+// billed monthly at 300, with N serial fleet units on Pending lines. Calendar
+// Month (the default) starts 2026-09-01: September is invoiced, October is
+// not. Monthly starts 2026-09-07: 7 Sep – 6 Oct is invoiced, 7 Oct – 6 Nov is
+// not.
import type { Kysely, KyselyDatabase } from "@carbon/database/client";
import { sql } from "kysely";
@@ -16,6 +18,7 @@ const USER = "system";
export async function rentalFixture(options?: {
units?: number; // default 1
billingTiming?: "Advance" | "Arrears"; // default "Advance"
+ billingCycle?: "Calendar Month" | "Monthly"; // default "Calendar Month"
}): Promise<{
db: Kysely<KyselyDatabase>;
ctx: ServerFnContext;
@@ -33,6 +36,17 @@ export async function rentalFixture(options?: {
}> {
const units = options?.units ?? 1;
const billingTiming = options?.billingTiming ?? "Advance";
+ const billingCycle = options?.billingCycle ?? "Calendar Month";
+ const periods =
+ billingCycle === "Monthly"
+ ? [
+ { start: "2026-09-07", end: "2026-10-06", days: 30 },
+ { start: "2026-10-07", end: "2026-11-06", days: 31 }
+ ]
+ : [
+ { start: "2026-09-01", end: "2026-09-30", days: 30 },
+ { start: "2026-10-01", end: "2026-10-31", days: 31 }
+ ];
const db = await connectLocalTestDatabase();
const prefix = `rentfx-${crypto
@@ -97,6 +111,12 @@ export async function rentalFixture(options?: {
await trx
.insertInto("sequence")
.values([
+ {
+ table: "salesInvoice",
+ name: "Sales Invoice",
+ prefix: "INV-",
+ companyId
+ },
{ table: "shipment", name: "Shipment", prefix: "SHP-", companyId },
{ table: "receipt", name: "Receipt", prefix: "RCV-", companyId },
{ table: "fixedAsset", name: "Fixed Asset", prefix: "FA", companyId },
@@ -209,9 +229,9 @@ export async function rentalFixture(options?: {
locationId,
currencyCode: "USD",
discountRate: 0,
- startDate: "2026-09-01",
+ startDate: periods[0]!.start,
endDate: null,
- billingCycle: "Calendar Month",
+ billingCycle,
billingTiming,
status: "Active",
companyId,
@@ -239,30 +259,19 @@ export async function rentalFixture(options?: {
await trx
.insertInto("rentalBillingPeriod")
.values(
- lineIds.flatMap((lineId) => [
- {
- rentalAgreementLineId: lineId,
- periodStart: "2026-09-01",
- periodEnd: "2026-09-30",
- days: 30,
- amount: 300,
- dueOn: "2026-09-01",
- status: "Invoiced" as const,
- companyId,
- createdBy: USER
- },
- {
+ lineIds.flatMap((lineId) =>
+ periods.map((period, i) => ({
rentalAgreementLineId: lineId,
- periodStart: "2026-10-01",
- periodEnd: "2026-10-31",
- days: 31,
+ periodStart: period.start,
+ periodEnd: period.end,
+ days: period.days,
amount: 300,
- dueOn: "2026-10-01",
- status: "Pending" as const,
+ dueOn: period.start,
+ status: i === 0 ? ("Invoiced" as const) : ("Pending" as const),
companyId,
createdBy: USER
- }
- ])
+ }))
+ )
)
.execute();
});
diff --git a/packages/utils/AGENTS.md b/packages/utils/AGENTS.md
index 8dd22016d3..94850b7bd8 100644
--- a/packages/utils/AGENTS.md
+++ b/packages/utils/AGENTS.md
@@ -17,7 +17,7 @@ Pure utility functions shared across all Carbon packages and apps. Covers accoun
## Never
-- Import server-only packages (`@carbon/auth`, `@carbon/database`, `@carbon/kv`) at runtime from here — `@carbon/utils` must remain client-safe (type-only `@carbon/database` imports for the generated `Database` types are fine). The one exception is the pure `@carbon/database` subpaths `./precision`, `./accounting-currency`, `./accounting-posting`, `./sales-posting-amounts` and `./ledger`, which the index re-exports: they live in `@carbon/database` because its posting journal builders need them and `@carbon/database` cannot import this package (the two would form a turbo cycle). Keep their dependency graphs pure.
+- Import server-only packages (`@carbon/auth`, `@carbon/database`, `@carbon/kv`) at runtime from here — `@carbon/utils` must remain client-safe (type-only `@carbon/database` imports for the generated `Database` types are fine). The one exception is the pure `@carbon/database` subpaths `./precision`, `./accounting-currency`, `./accounting-posting`, `./sales-posting-amounts`, `./ledger` and `./lease-months` (lease months from a commencement day, read by `lease-math` and the Monthly rental cycle), which the index re-exports: they live in `@carbon/database` because its posting journal builders need them and `@carbon/database` cannot import this package (the two would form a turbo cycle). Keep their dependency graphs pure.
- Add IO — no network, file, or database access (the one exception is `supabase.ts`, typed wrappers around a client the caller passes in). The `async` helpers orchestrate promises the caller supplies; they perform no IO themselves. File/image handling lives in `@carbon/files`, not here.
- Duplicate what already exists — check the barrel export (`src/index.ts`) before adding a new utility.
@@ -47,8 +47,8 @@ pnpm --filter @carbon/utils typecheck
| `short-close` | Short-close-aware billable / remaining-to-invoice PO line quantities |
| `calculate-due-date` | `calculateDueDate` / `DEFAULT_PAYMENT_TERM` — an invoice's due date from its payment term (shared by the ERP and invoice posting) |
| `revenue-schedule` | Re-exports `@carbon/database/revenue-schedule` (moved there so the contract revenue planner and the demo dataset share it): ISO-date arithmetic on `YYYY-MM-DD` strings (`parseIsoDate`, `formatIsoDate`, `daysInMonth`, `monthEnd`, `daysBetweenInclusive`, `addDays`) and `spreadStraightLine` (a revenue schedule spread over days with cumulative rounding) — used by the `post-sales-invoice` server function's deferrals and the rental/lease modules |
-| `rental-periods` | Rental billing period math: `rateCharge`, `periodCharge`, `calendarMonthCharge`, `defaultRentalRates` (a unit's starting rate per frequency: customer → customer type → item), `billingHorizon`, `generateRentalBillingPeriods` (create / recut / early-return adjustments against persisted periods). Shared by the `post-rental-agreement` and `create-rental-invoices` server functions and the ERP |
-| `lessor-lease` | ASC 842 lessor math: `presentValue`, `classifyLessorLease`, `buildLessorSchedule`, `wholeMonthsInTerm`, `leasePaymentTerms`, `certainPurchaseOption`, `classifyRentalLine`, `salesTypeRequirementError` (end date, fair value, whole billing periods), `earnsInterest` (whether a lease schedule month books interest — the recognition run reads it). One function for the ERP's Draft preview and what activation stores |
+| `rental-periods` | Rental billing period math for the three cycles (Calendar Month, Monthly from the start date, 28 Days): `rateCharge`, `periodCharge`, `calendarMonthCharge`, `monthlyCharge` / `monthlyPeriodEnd` (Monthly periods from `@carbon/database/lease-months`, added from the start so a 31st clamps and returns), `defaultRentalRates` (a unit's starting rate per frequency: customer → customer type → item), `billingHorizon`, `generateRentalBillingPeriods` (create / recut / early-return adjustments against persisted periods). Shared by the `post-rental-agreement` and `create-rental-invoices` server functions and the ERP |
+| `lessor-lease` | ASC 842 lessor math: `presentValue`, `classifyLessorLease`, `buildLessorSchedule`, `wholeMonthsInTerm`, `rentalTermMonths` (term months by cycle — a Monthly term counts the months its billing cuts), `leasePaymentTerms`, `certainPurchaseOption`, `classifyRentalLine`, `salesTypeRequirementError` (end date, fair value, whole billing periods), `earnsInterest` (whether a lease schedule month books interest — the recognition run reads it). One function for the ERP's Draft preview and what activation stores |
| `rental-invoice-plan` | Invoice automation's pure planner: `planRentalInvoices` (one combined invoice under `Draft Only`, else rent + a held charges invoice; holds for early-return credits and re-bills of a voided invoice), `effectiveInvoiceAutomation`, the hold messages, and the `InvoiceAutomation` type. Used by the `create-rental-invoices` server function and the invoice automation job |
| `async` | The `async` object: `Promise.all`, `Promise.allSettled` and `items.map` with a limit on how many run at once (`DEFAULT_CONCURRENCY`, 8, unless `{ concurrency }` says otherwise). `map(items, mapper)` follows p-map, `all(tasks)` and `allSettled(tasks)` take FUNCTIONS (a promise is already running) and keep the tuple's types, `limit(n)` follows p-limit. After a failure `map` / `all` start nothing further. Database calls inside a request need no limit of their own — the client `requirePermissions` returns has at most 8 in flight. `background(task, onError)` is fire-and-forget with a required error handler. `onBackground(hook)` registers what keeps the process alive for that work — both apps register Vercel's `waitUntil` in `entry.server.tsx` — so use `background` (never a bare unawaited promise) for anything a request leaves running |
| `errors` | `getErrorMessage(error, fallback)` — the error's own message, else the caller's copy (server functions leave `message` empty for data-layer failures so the fallback wins); `isUniqueViolation(error)` / `isForeignKeyViolation(error)` — the Postgres SQLSTATE checks (23505 / 23503) on a Supabase result or a thrown Kysely error; `getDatabaseErrorMessage(error, fallback, { duplicate?, referenced? })` — the caller's copy for the constraint Postgres named |
diff --git a/packages/utils/src/lessor-lease.ts b/packages/utils/src/lessor-lease.ts
index cd2b2267e6..61fea62c9a 100644
--- a/packages/utils/src/lessor-lease.ts
+++ b/packages/utils/src/lessor-lease.ts
@@ -2,6 +2,10 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
+import {
+ leaseMonthEnd,
+ leaseMonthsThrough
+} from "@carbon/database/lease-months";
import { RoundingMode, round, SCALE } from "@carbon/database/precision";
import {
type RateUnit,
@@ -233,7 +237,7 @@ const DAYS_PER_28_DAY_PERIOD = 28;
const DAYS_PER_YEAR = 365;
const MONTHS_PER_YEAR = 12;
/** The calendar months of a 365-day year, for a Daily or Weekly unit's
- * average month on a Calendar Month agreement. */
+ * average month on a Calendar Month or Monthly agreement. */
const MONTH_LENGTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
/** Whole calendar months from `startDate` through `endDate` (both inclusive:
@@ -249,6 +253,30 @@ export function wholeMonthsInTerm(startDate: string, endDate: string): number {
return after.day < start.day ? months - 1 : months;
}
+/** Whole `Monthly` billing periods from `startDate` through `endDate` (both
+ * inclusive), counted the way billing cuts them: 2027-01-31 → 2027-02-27
+ * is 1, because 31 Jan + 1 month clamps to 28 Feb. */
+function monthlyPeriodsInTerm(startDate: string, endDate: string): number {
+ // Validates both dates and refuses an end before the start.
+ daysBetweenInclusive(startDate, endDate);
+ return leaseMonthsThrough(startDate, endDate);
+}
+
+/** Whole months of a rental agreement's term, as its classification counts
+ * them; null when it is open-ended. A Monthly cycle counts the months its
+ * billing cuts (`monthlyPeriodsInTerm`); the others count calendar months
+ * (`wholeMonthsInTerm`). The two differ only for a start on the 29th–31st. */
+export function rentalTermMonths(
+ cycle: RentalBillingCycle,
+ startDate: string,
+ endDate: string | null
+): number | null {
+ if (endDate === null) return null;
+ return cycle === "Monthly"
+ ? monthlyPeriodsInTerm(startDate, endDate)
+ : wholeMonthsInTerm(startDate, endDate);
+}
+
export type LeasePaymentTerms = {
/** Whole months of the term; null when the agreement is open-ended. */
termMonths: number | null;
@@ -258,7 +286,7 @@ export type LeasePaymentTerms = {
periods: number;
/** The annual percentage passed to `presentValue` / `buildLessorSchedule`.
* Those derive the PERIOD rate as annualRate / 100 / 12, which is right
- * for a Calendar Month cycle. A 28 Days cycle's period rate must be
+ * for a Calendar Month or Monthly cycle. A 28 Days cycle's period rate must be
* annual × 28 / 365, so its rate is passed scaled by 12 × 28 / 365 —
* (annual × 12 × 28 / 365) / 12 = annual × 28 / 365. */
annualRate: number;
@@ -276,6 +304,11 @@ export type LeasePaymentTerms = {
* month covers), so it is valued at its average month over a 365-day year
* — the classification tests need a level payment; a unit treated as a
* sale must be Monthly (`salesTypeRequirementError`).
+ * - Monthly: the same, with months counted from the start date — every
+ * period of a whole-month term is a whole month, so a mid-month start
+ * bills exactly the periods it is valued over. A start on the 29th–31st
+ * clamps in a short month (31 Jan → 27 Feb is one month), so the months
+ * are counted the way billing cuts them (`leaseMonthsThrough`).
* - 28 Days: the unit's charge for 28 days (whole units of its frequency)
* per period, one period per WHOLE 28 days of the term; a trailing partial
* period is not part of the level-payment stream.
@@ -298,10 +331,9 @@ export function leasePaymentTerms(args: {
decimals: number;
}): LeasePaymentTerms {
const { cycle, rateUnit, rate, startDate, endDate, decimals } = args;
- const termMonths =
- endDate === null ? null : wholeMonthsInTerm(startDate, endDate);
+ const termMonths = rentalTermMonths(cycle, startDate, endDate);
- if (cycle === "Calendar Month") {
+ if (cycle === "Calendar Month" || cycle === "Monthly") {
const payment =
rateUnit === "Month"
? round(rate, decimals)
@@ -450,10 +482,11 @@ export function classifyRentalLine(args: {
* as a level payment over `leasePaymentTerms().periods`, and every sales-type
* Rent invoice credits Net Investment in Leases in full — so the rent billed
* must be exactly payment × periods, or the account never closes on the
- * schedule. Billing prices a partial calendar month pro rata and cuts a
- * trailing partial 28-day period, neither of which the valuation contains:
- * a Calendar Month term starts on the first of a month and ends on a month
- * end; a 28 Days term is a whole number of 28-day periods.
+ * schedule. Billing prices a partial month pro rata and cuts a trailing
+ * partial 28-day period, neither of which the valuation contains: a Calendar
+ * Month term starts on the first of a month and ends on a month end; a
+ * Monthly term ends the day before a monthly anniversary of its start; a 28
+ * Days term is a whole number of 28-day periods.
*
* A sales-type lease also commences no earlier than the month it is
* activated in. Activation books the commencement (lease revenue, cost of
@@ -485,12 +518,21 @@ export function salesTypeRequirementError(args: {
if (args.fairValue === null || !(args.fairValue > 0)) {
return `${name} is treated as a sale; enter the unit's fair value`;
}
- if (args.cycle === "Calendar Month") {
+ if (args.cycle === "Calendar Month" || args.cycle === "Monthly") {
// A Daily or Weekly unit bills a different amount each month, and a sale
// is valued as a level payment that the invoices must match.
if (args.rateUnit !== "Month") {
- return `${name} is treated as a sale, which on a Calendar Month agreement needs a monthly rate`;
+ return `${name} is treated as a sale, which on a ${args.cycle} agreement needs a monthly rate`;
+ }
+ }
+ if (args.cycle === "Monthly") {
+ const months = monthlyPeriodsInTerm(startDate, endDate);
+ if (months === 0 || leaseMonthEnd(startDate, months - 1) !== endDate) {
+ return `${name} is treated as a sale, which runs whole billing periods: end it the day before a monthly anniversary of its start date, such as ${leaseMonthEnd(startDate, months)}`;
}
+ return null;
+ }
+ if (args.cycle === "Calendar Month") {
if (parseIsoDate(startDate).day !== 1 || monthEnd(endDate) !== endDate) {
return `${name} is treated as a sale, which runs whole billing periods: start on the first of a month and end on a month end`;
}
diff --git a/packages/utils/src/rental-periods.test.ts b/packages/utils/src/rental-periods.test.ts
index 2025c19dfe..cbb719dfc3 100644
--- a/packages/utils/src/rental-periods.test.ts
+++ b/packages/utils/src/rental-periods.test.ts
@@ -4,10 +4,12 @@
import { expect, it } from "vitest";
import {
+ billingHorizon,
calendarMonthCharge,
defaultRentalRates,
type ExistingBillingPeriod,
generateRentalBillingPeriods,
+ monthlyCharge,
type PeriodSpec,
type RateLadder,
type RateUnit,
@@ -548,6 +550,142 @@ it("Calendar Month: a Daily unit bills the days, a Weekly unit the whole weeks",
]);
});
+it("Monthly: periods run from the start day to the day before it, each the month rate", () => {
+ const plan = generate({
+ cycle: "Monthly",
+ startDate: "2026-10-07",
+ through: "2026-10-20"
+ });
+ expect(plan.create).toEqual([
+ period("2026-10-07", "2026-11-06", 31, 1500, "Month", "2026-10-07"),
+ period("2026-11-07", "2026-12-06", 30, 1500, "Month", "2026-11-07")
+ ]);
+ // A year is twelve periods, each invoiced on the 7th for the same amount.
+ const year = generate({
+ cycle: "Monthly",
+ startDate: "2026-10-07",
+ endDate: "2027-10-06",
+ through: "2026-10-07"
+ });
+ expect(year.create.length).toEqual(12);
+ expect(
+ year.create.every(
+ (row) => row.periodStart.endsWith("-07") && row.amount === 1500
+ )
+ ).toEqual(true);
+ expect(year.create[11]?.periodEnd).toEqual("2027-10-06");
+});
+
+it("Monthly: a start on the 31st clamps to a short month and returns to the 31st", () => {
+ const plan = generate({
+ cycle: "Monthly",
+ startDate: "2027-01-31",
+ endDate: "2027-04-29",
+ through: "2027-01-31"
+ });
+ // Each start is added from the agreement's start: 31 Jan + 3 months is
+ // 30 Apr, so March's period ends on 29 Apr.
+ expect(plan.create).toEqual([
+ period("2027-01-31", "2027-02-27", 28, 1500, "Month", "2027-01-31"),
+ period("2027-02-28", "2027-03-30", 31, 1500, "Month", "2027-02-28"),
+ period("2027-03-31", "2027-04-29", 30, 1500, "Month", "2027-03-31")
+ ]);
+});
+
+it("Monthly: dueOn is the period end in arrears", () => {
+ const plan = generate({
+ cycle: "Monthly",
+ timing: "Arrears",
+ startDate: "2026-10-07",
+ endDate: "2026-12-06",
+ through: "2026-10-07"
+ });
+ expect(plan.create.map((row) => row.dueOn)).toEqual([
+ "2026-11-06",
+ "2026-12-06"
+ ]);
+});
+
+it("Monthly: a part period is the month rate by the days of the period it belongs to", () => {
+ // 7 Nov – 6 Dec is 30 days; a return on 20 Nov used 14 of them.
+ const returned = generate({
+ cycle: "Monthly",
+ startDate: "2026-10-07",
+ returnedAt: "2026-11-20",
+ through: "2026-11-20"
+ });
+ expect(returned.create).toEqual([
+ period("2026-10-07", "2026-11-06", 31, 1500, "Month", "2026-10-07"),
+ period("2026-11-07", "2026-11-20", 14, 700, "Month", "2026-11-07")
+ ]);
+ // A mid-period end date is a hard cut: the holdover runs to the next
+ // anniversary, and the two halves add up to the month.
+ const holdover = generate({
+ cycle: "Monthly",
+ startDate: "2026-10-07",
+ endDate: "2026-11-20",
+ through: "2026-11-25"
+ });
+ expect(
+ holdover.create.map((row) => [row.periodStart, row.periodEnd, row.amount])
+ ).toEqual([
+ ["2026-10-07", "2026-11-06", 1500],
+ ["2026-11-07", "2026-11-20", 700],
+ ["2026-11-21", "2026-12-06", 800]
+ ]);
+});
+
+it("Monthly: an advance-billed period is credited for the unused days", () => {
+ const plan = generate({
+ cycle: "Monthly",
+ startDate: "2026-10-07",
+ endDate: "2027-10-06",
+ returnedAt: "2026-10-16",
+ through: "2026-10-16",
+ existing: [invoiced("2026-10-07", "2026-11-06", 1500)]
+ });
+ // 10 of the period's 31 days used: 483.87.
+ expect(plan.adjustments.map((row) => [row.days, row.amount])).toEqual([
+ [10, -1016.13]
+ ]);
+});
+
+it("Monthly: a Daily unit bills the days, a Weekly unit the whole weeks", () => {
+ const terms = {
+ cycle: "Monthly",
+ startDate: "2026-10-07",
+ endDate: "2026-12-06",
+ through: "2026-10-07"
+ } as const;
+ expect(generate({ ...terms, ...DAILY }).create).toEqual([
+ period("2026-10-07", "2026-11-06", 31, 3100, "Day", "2026-10-07"),
+ period("2026-11-07", "2026-12-06", 30, 3000, "Day", "2026-11-07")
+ ]);
+ expect(generate({ ...terms, ...WEEKLY }).create).toEqual([
+ period("2026-10-07", "2026-11-06", 31, 2500, "Week", "2026-10-07"),
+ period("2026-11-07", "2026-12-06", 30, 2500, "Week", "2026-11-07")
+ ]);
+});
+
+it("monthlyCharge prorates the month rate by the days of its period, inside one period", () => {
+ expect(
+ monthlyCharge("2026-10-07", "2026-11-07", "2026-11-20", 1500, DECIMALS)
+ ).toEqual(700);
+ expect(
+ monthlyCharge("2026-10-07", "2026-10-07", "2026-11-06", 1500, DECIMALS)
+ ).toEqual(1500);
+ expect(() =>
+ monthlyCharge("2026-10-07", "2026-10-20", "2026-11-10", 1500, DECIMALS)
+ ).toThrow("one billing period");
+});
+
+it("billingHorizon: one cycle ahead of today", () => {
+ expect(billingHorizon("Monthly", "2026-10-16")).toEqual("2026-11-16");
+ expect(billingHorizon("Monthly", "2027-01-31")).toEqual("2027-02-28");
+ expect(billingHorizon("Calendar Month", "2026-10-16")).toEqual("2026-11-30");
+ expect(billingHorizon("28 Days", "2026-10-16")).toEqual("2026-11-13");
+});
+
it("a fixed term is generated in full up front, whatever `through` is", () => {
const plan = generate({
cycle: "Calendar Month",
diff --git a/packages/utils/src/rental-periods.ts b/packages/utils/src/rental-periods.ts
index c65a32c608..e46bd60d92 100644
--- a/packages/utils/src/rental-periods.ts
+++ b/packages/utils/src/rental-periods.ts
@@ -2,6 +2,11 @@
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
+import {
+ addMonths,
+ leaseMonthEnd,
+ leaseMonthsAt
+} from "@carbon/database/lease-months";
import { RoundingMode, round } from "@carbon/database/precision";
import {
addDays,
@@ -83,7 +88,10 @@ export function defaultRentalRates(args: {
}
export type RateUnit = "Day" | "Week" | "Month";
-export type RentalBillingCycle = "Calendar Month" | "28 Days";
+/** Calendar Month: calendar months, a part month first. Monthly: months
+ * counted from the start date (a start on the 7th bills the 7th to the 6th).
+ * 28 Days: consecutive 28-day windows. */
+export type RentalBillingCycle = "Calendar Month" | "Monthly" | "28 Days";
export type RentalBillingTiming = "Advance" | "Arrears";
/** What one period bills: the frequency applied and how many whole units. */
@@ -200,35 +208,80 @@ export function calendarMonthCharge(
return round((monthRate * days) / daysInMonth(year, month), decimals);
}
+/** The last day of the `Monthly` period that `date` falls in, for an
+ * agreement starting on `startDate`. Period k runs from `startDate + k
+ * months` to the day before `startDate + (k + 1) months`, always added from
+ * the start, so a start on the 31st clamps to 28 Feb and returns to 31 Mar
+ * (the contract Anniversary grid). */
+export function monthlyPeriodEnd(startDate: string, date: string): string {
+ return leaseMonthEnd(startDate, leaseMonthsAt(startDate, date));
+}
+
+/** A month rate prorated by the days of the `Monthly` period the span sits
+ * in: `monthRate × days ÷ days in that period`, so a whole period is exactly
+ * the rate whatever its length. The span must sit inside one period.
+ * Rounded to `decimals` (the currency's settlement precision). */
+export function monthlyCharge(
+ startDate: string,
+ periodStart: string,
+ periodEnd: string,
+ monthRate: number,
+ decimals: number
+): number {
+ if (!Number.isFinite(monthRate)) {
+ throw new Error(`Month rate must be finite, got ${monthRate}`);
+ }
+ // Validates both dates and refuses an end before the start.
+ const days = daysBetweenInclusive(periodStart, periodEnd);
+ const month = leaseMonthsAt(startDate, periodStart);
+ const fullEnd = leaseMonthEnd(startDate, month);
+ if (periodEnd > fullEnd) {
+ throw new Error(
+ `"${periodStart}" to "${periodEnd}" is not within one billing period`
+ );
+ }
+ const fullDays = daysBetweenInclusive(addMonths(startDate, month), fullEnd);
+ return round((monthRate * days) / fullDays, decimals);
+}
+
/** How far ahead billing periods are cut: today plus one billing cycle, so an
* open-ended (or held-over) line always has its current period and the next
* one. Activation generates to it, and the daily billing pass rolls every
* live line forward to it before billing. Calendar Month runs to the end of
- * next month; 28 Days to today + 28. */
+ * next month; Monthly to today + 1 month; 28 Days to today + 28. */
export function billingHorizon(
cycle: RentalBillingCycle,
today: string
): string {
- return cycle === "Calendar Month"
- ? monthEnd(addDays(monthEnd(today), 1))
- : addDays(today, DAYS_PER_UNIT.Month);
+ switch (cycle) {
+ case "Calendar Month":
+ return monthEnd(addDays(monthEnd(today), 1));
+ case "Monthly":
+ return addMonths(today, 1);
+ case "28 Days":
+ return addDays(today, DAYS_PER_UNIT.Month);
+ }
}
/** What a unit bills for one period of its agreement's cycle. A Monthly unit
* on a Calendar Month agreement is its month rate prorated by calendar days
- * (`calendarMonthCharge`); every other combination is whole units of the
+ * (`calendarMonthCharge`), and on a Monthly agreement by the days of its
+ * period (`monthlyCharge`); every other combination is whole units of the
* unit's frequency (`rateCharge`): a Daily unit bills the days, a Weekly
* unit the whole weeks the period covers. */
export function periodCharge(args: {
cycle: RentalBillingCycle;
rateUnit: RateUnit;
rate: number;
+ /** The agreement's start date: a Monthly cycle's periods count from it. */
+ startDate: string;
periodStart: string;
periodEnd: string;
/** The agreement currency's `decimalPlaces`. */
decimals: number;
}): Pick<PeriodSpec, "days" | "amount" | "rateUnitApplied"> {
- const { cycle, rateUnit, rate, periodStart, periodEnd, decimals } = args;
+ const { cycle, rateUnit, rate, startDate, periodStart, periodEnd, decimals } =
+ args;
const days = daysBetweenInclusive(periodStart, periodEnd);
if (cycle === "Calendar Month" && rateUnit === "Month") {
return {
@@ -237,6 +290,13 @@ export function periodCharge(args: {
rateUnitApplied: "Month"
};
}
+ if (cycle === "Monthly" && rateUnit === "Month") {
+ return {
+ days,
+ amount: monthlyCharge(startDate, periodStart, periodEnd, rate, decimals),
+ rateUnitApplied: "Month"
+ };
+ }
const { amount, rateUnitApplied } = rateCharge(
days,
rateUnit,
@@ -250,7 +310,8 @@ export function periodCharge(args: {
* rows already persisted.
*
* Periods follow the cycle from `startDate`: calendar months (the first and
- * last partial) or consecutive 28-day windows, each priced by
+ * last partial), months counted from the start date, or consecutive 28-day
+ * windows, each priced by
* `periodCharge` from the unit's own frequency and rate. `endDate` is a hard cut and the
* last day of a fixed term, generated in full up front; a unit still out
* past it keeps billing at the same rate from the day after (holdover).
@@ -299,12 +360,30 @@ export function generateRentalBillingPeriods(args: {
if (returnedAt !== null) daysBetweenInclusive(startDate, returnedAt);
const price = (periodStart: string, periodEnd: string) =>
- periodCharge({ cycle, rateUnit, rate, periodStart, periodEnd, decimals });
+ periodCharge({
+ cycle,
+ rateUnit,
+ rate,
+ startDate,
+ periodStart,
+ periodEnd,
+ decimals
+ });
- const naturalEnd = (from: string): string =>
- cycle === "Calendar Month"
- ? monthEnd(from)
- : addDays(from, DAYS_PER_UNIT.Month - 1);
+ // Calendar Month and Monthly snap to the cycle's grid, so a period that
+ // starts mid-grid (a holdover after a mid-period end date) runs only to the
+ // next boundary. 28 Days has no grid: every period is 28 days from its own
+ // start.
+ const naturalEnd = (from: string): string => {
+ switch (cycle) {
+ case "Calendar Month":
+ return monthEnd(from);
+ case "Monthly":
+ return monthlyPeriodEnd(startDate, from);
+ case "28 Days":
+ return addDays(from, DAYS_PER_UNIT.Month - 1);
+ }
+ };
const cut = (periodStart: string): PeriodSpec => {
let periodEnd = naturalEnd(periodStart);