create_invoice
Make an invoice in a space: who it is from and to, its number (given for you), the day issued and the day due, price lines with quantities and unit prices (Artifacts adds up the subtotal, discount, tax and total), how to pay (bank details) and a note. The client reads it on its published page; when the money arrives, update_invoice with paid marks it paid. When the space lists its invoices in a sheet or database (list_invoices_in), its row is written there. Read guide topic "invoices" first; check it with render_invoice; publish_item gives the link to send.
Parameters
space_idstringrequiredtitlestringrequirednumberstringfromobjectShow child attributes
companystringcontactstringemailstringaddressstringclientobjectShow child attributes
companystringcontactstringemailstringaddressstringissuedstringduestringlinesobject[]Show child attributes
itemstringrequireddescriptionstringquantitynumberunit_pricenumberrequiredunitstringcurrencystringdiscount_percentnumbertax_percentnumberpaymentstringnotesstringread_invoice
An invoice as it is now: its status (draft, sent, overdue, paid), number, who it is from and to, the days issued and due, its price lines with their ids (what update_invoice and comment take), the totals, how to pay, the note, when it was paid (the day, the amount, who marked it), where the space lists its invoices, its published link and whether that page shows the latest version, and checks: what to fix.
Parameters
item_idstringrequiredupdate_invoice
Change an invoice: the title, number, who it is from and to, the days issued and due, currency, discount, tax, how to pay and the note; add price lines (after a given id, or at the end), change them (only the parts given; null or "" clears one), remove them (only when the person asked), order them (every id once). paid marks it paid when the person says the money arrived (the day, default today, and a note such as the transfer reference): its terms then stop changing. paid: null undoes it (a mistake). Its row in the space's invoice list follows. A published invoice's page keeps the version published last: after a change, the client sees it only once it is published again (publish_item, when the person asks).
Parameters
item_idstringrequiredtitlestringnumberstringfromobjectShow child attributes
companystring | nullcontactstring | nullemailstring | nulladdressstring | nullclientobjectShow child attributes
companystring | nullcontactstring | nullemailstring | nulladdressstring | nullissuedstringduestringcurrencystringdiscount_percentnumber | nulltax_percentnumber | nullpaymentstring | nullnotesstring | nulladd_linesobject[]Show child attributes
itemstringrequireddescriptionstringquantitynumberunit_pricenumberrequiredunitstringafterstringchange_linesobject[]Show child attributes
linestringrequireditemstringdescriptionstring | nullquantitynumberunit_pricenumberunitstring | nullremove_linesstring[]order_linesstring[]paidobject | nullShow child attributes
paid_onstringnotestringlist_invoices_in
Where a space lists its invoices, one row each — Number, Client, Amount, Due, Status (Draft, Sent, Paid) — kept up to date as invoices change, are published and are marked paid. Give nothing for a new database named Invoices; sheet for a spreadsheet of the space (its Invoices tab, made if missing); or database (and table) for a database of the space (the table given gets the missing fields; without table, a new Invoices table). Every invoice of the space is written there at once. off: true stops listing (the rows stay). Only when the person asks where invoices should be listed.
Parameters
space_idstringrequiredsheetstringdatabasestringtablestringoffbooleanrender_invoice
See an invoice as people do: a screenshot of the page (its sender, client, dates, lines, totals and how to pay), plus checks — no sender, client or payment details, no price lines, a total of 0, overdue, an invoice list that cannot be written, not published yet or changed since — and errors the page hit.
Parameters
item_idstringrequired