Po creator
@dealdesk/po-creator
Turn a deal into a clean order form or purchase order, in markdown and printable HTML. Computes line totals, discounts, contract value, and a billing schedule, and lists what finance needs before signature. Works offline from a JSON file or a short text form.
- Activity
- New: be the first to try it
- Installs
- 0 installs
- Likes
- 0 likes
- Clones
- 0 clones
- 1---
- 2name: po-creator
- 3description: Turn a closed or closing deal into a clean order form or purchase order (markdown and printable HTML) with line totals, discount math, contract value, a billing schedule, and a checklist of what finance needs before signature. Use when the user says "make an order form", "draft the PO", "write up this deal for signature", "paperwork for the Northwind deal", or pastes deal terms (customer, products, prices, term, start date, payment terms). Works from a JSON file or a short text form, with any CRM.
- 4license: MIT
- 5---
- 7# Order form and PO creator
- 9Turns deal terms into a document a customer can sign and finance can bill from. The script does every calculation, so the numbers are exact and the same every time. You collect the terms, run it, and walk the user through the checklist.
- 11## When to use
- 13- A rep or deal desk needs an order form or purchase order for a deal.
- 14- The user pastes deal terms from a CRM, an email, or a quote and wants it "ready to sign".
- 15- Not for contracts or MSAs. Those are legal documents; this produces the commercial order that sits under them.
- 17## Inputs
- 19Ask for anything missing. Never invent a legal name, address, price, or PO number.
- 21| Field | Notes |
- 22| --- | --- |
- 23| Customer legal name | Exact registered name with suffix (Inc., LLC, Ltd., GmbH) |
- 24| Billing address and billing contact | Contact can be a team ("Accounts Payable") plus an email |
- 25| Products | SKU, description, quantity, list price, net price; mark one-time fees |
- 26| Term and start date | Months, and `YYYY-MM-DD` |
- 27| Billing frequency and payment terms | `annual` (default), `quarterly`, `monthly`, `semi-annual`, `upfront`; `Net 30` default |
- 28| PO required? PO number? | Many larger customers will not pay an invoice without their PO number on it |
- 29| Signer, tax ID, order number | Optional, but flagged when missing |
- 31Recurring prices are per unit per year. Add `"price_period": "month"` (or `| month` in the short form) for monthly unit prices.
- 33## Steps
- 351. **Collect the deal.** If the user gave a file in `data/`, use it. Otherwise write `data/deal.json` (shape: the kit's `examples/deal.json`) or `data/deal.txt` in the short form:
- 37 ```text
- 38 customer: Contoso Robotics Inc.
- 39 address: 22 Harbor Road, Bayview
- 40 billing contact: Finance Team, invoices@contoso.example
- 41 start: 2027-01-01
- 42 term: 24 months
- 43 billing: annual
- 44 payment terms: Net 30
- 45 po required: no
- 46 line: PLAT-SEAT | Platform seat | 120 | 600 | 510
- 47 line: ONB-PLUS | Onboarding plus training | 1 | 9000 | 9000 | one-time
- 48 ```
- 50 Show the user the terms you captured and ask them to confirm before generating.
- 522. **Generate.**
- 54 ```bash
- 55 node scripts/po-creator.mjs data/deal.json --out out --name order-form
- 56 ```
- 58 Use `--name` to give each deal its own files, for example `--name of-2026-0142`. Add `--today YYYY-MM-DD` only to reproduce an old run.
- 603. **Read the summary** in `out/<name>.json`: `totals`, `billing_schedule`, `checklist`, `blockers`.
- 614. **Report back** with the template below. Lead with blockers.
- 625. **Fix and rerun.** When the user supplies a missing item (PO number, signer), update the deal file and run step 2 again. Never hand-edit numbers in the output files.
- 636. **Hand off.** The HTML prints cleanly to PDF from any browser (File, Print, Save as PDF). The finance checklist prints on its own last page and is marked internal: remind the user to drop that page before sending.
- 65## Output to the user
- 67```markdown
- 68**Order Form OF-2026-0142** for Northwind Traders LLC: TCV $34,000.00, ACV $30,000.00, discount 17.1%.
- 69Files: out/order-form.md, out/order-form.html (print to PDF)
- 71Before signature (1 blocker):
- 72- BLOCKER: customer requires a PO and none is recorded.
- 73- Payment terms Net 45 are past Net 30: needs finance approval.
- 74- Signer name and title are missing.
- 76Billing: 4 quarterly invoices, first one $11,500.00 on 2026-12-01 (includes onboarding).
- 77```
- 79## Checks the script makes
- 81- Blockers: missing legal name, address, billing email, start date; PO required but no PO number; zero or negative quantities.
- 82- Warnings: no entity suffix on the legal name, start date in the past, payment terms past Net 30, overall discount above 20%, net above list, missing signer.
- 83- Info: no tax or VAT ID, no order number, vendor onboarding forms.
- 85If the discount or terms look non-standard, suggest running `discount-approval-check` (same deal file) before sending.
- 87## Guardrails
- 89- Never fill in a legal name, PO number, tax ID, or price the user did not give you. Leave it missing and let the checklist flag it.
- 90- Never send the document to anyone. The user sends it.
- 91- Do not add legal terms, warranties, or SLAs to the order form. If the user asks, say those belong in the contract and suggest they reference it by name.
- 92- Currency is one per document. If the deal mixes currencies, stop and ask.
