Neste artigo
Example adding an Invoice
the following example shows how to use document change to create invoices with Document Change in Banana. These rows can only be inserted in the Invoices table using the Estimates and Invoices application. The Invoice JSON object represents the data structure through which a new invoice can be created.
{
"format": "documentChange",
"error": "",
"data": [
{
"document": {
"dataUnits": [
{
"nameXml": "Invoices",
"data": {
"rowLists": [
{
"rows": [
{//Invoice 1
"operation": {
"name": "add"
},
"fields": {
(Invoice JSON Object)
},
{//Invoice 2
"operation": {
"name": "add"
},
"fields": {
(Invoice JSON Object)
}
]
}
]
}
}
]
},
"creator": {
"executionDate": "2021-09-13",
"name": "extension_name.js",
"version": "1.0"
}
}
]
}
Assure that the JSon Invoice Object is valid
It is advisable to check that the JSon Invoice Object is valid. Therefore:
- Create a Json Invoice Object.
- Pass the object to the function Calculate invoice.
- Add the object to the document change