Cotton code
1 line · 1.6 KB · JSONRaw
{"id":"invoice","name":"Invoice","plural":"Invoices","picture":null,"builtin":false,"engine":null,"columns":[{"key":"title","type":"text"},{"key":"customer","type":"link","link_to":"person"},{"key":"kind","type":"choice","choices":["sale","refund"]},{"key":"net","type":"amount"},{"key":"tax","type":"amount"},{"key":"customer_name","type":"text","computed":{"lookup":{"through":"customer","column":"name"}}},{"key":"total","type":"amount","computed":{"formula":{"op":"sum","of":["net","tax"]}}},{"key":"owed","type":"amount","computed":{"formula":{"op":"signed","of":["total"],"flip_when":{"column":"kind","values":["refund"]}}}},{"key":"before_tax","type":"amount","computed":{"formula":{"op":"difference","of":["total","tax"]}}},{"key":"label","type":"text","computed":{"formula":{"op":"join","of":["title","customer_name"],"separator":" — "}}},{"key":"line_count","type":"number","readonly":true,"computed":{"rollup":{"table":"invoice_line","link":"invoice","op":"count"}}},{"key":"paid","type":"amount","computed":{"rollup":{"table":"payment","link":"invoice","op":"sum","column":"amount","where":{"column":"status","values":["posted"]}}}},{"key":"last_paid","type":"date","computed":{"rollup":{"table":"payment","link":"invoice","op":"latest","column":"paid_on","by":"paid_on"}}}],"title":"title","date":null,"project":null,"order":null,"slip":{"title":"title","subtitle":"customer_name","trailing":"total","photo":null,"toggle":null},"tile":{"face":"slip-list"},"page":[{"heading":null,"columns":["title","customer","total","paid"]}],"instructions":"A fixture of the three computed shapes: lookup, rollup and formula."}