Good day
following from Split and create array - #9 by MutedJam
I have a workflow that queries a MySql database for invoice details.
One query gets the invoice header containing “customer details”, Invoice totals, etc.
The next query gets the invoice lines for the invoice… i can be multiple lines.
From the above results, I have to create an XML file like the example below:
1 <?xml version="1.0" encoding="utf-8"?>
2 <InvoicesDoc xmlns="http://www.aade.gr/myDATA/invoice/v1.0" xsi:schemaLocation="http://www.aade.gr/myDATA/invoice/v1.0 schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ic="https://www.aade.gr/myDATA/incomeClassificaton/v1.0">
3 <invoice>
4 <issuer>
5 <vatNumber>YOURVATNUMBERHERE</vatNumber>
6 <country>GR</country>
7 <branch>0</branch>
8 </issuer>
9 <counterpart>
10 <vatNumber>CLIENTVATNUMBERHERE</vatNumber>
11 <country>GR</country>
12 <branch>0</branch>
13 <address>
14 <postalCode>11133</postalCode>
15 <city>Αθήνα</city>
16 </address>
17 </counterpart>
18 <invoiceHeader>
19 <series>ΤΙΜΟΛΟΓΙΟ ΠΩΛΗΣΗΣ</series>
20 <aa>136</aa>
21 <issueDate>2022-07-21</issueDate>
22 <invoiceType>1.1</invoiceType>
23 <currency>EUR</currency>
24 </invoiceHeader>
25 <paymentMethods>
26 <paymentMethodDetails>
27 <type>5</type>
28 <amount>124.00</amount>
29 </paymentMethodDetails>
30 </paymentMethods>
31 <invoiceDetails>
32 <lineNumber>1</lineNumber>
33 <netValue>100.00</netValue>
34 <vatCategory>1</vatCategory>
35 <vatAmount>24.00</vatAmount>
36 <incomeClassification>
37 <icls:classificationType>E3_561_001</icls:classificationType>
38 <icls:classificationCategory>category1_1</icls:classificationCategory>
39 <icls:amount>100.00</icls:amount>
40 </incomeClassification>
41 </invoiceDetails>
42 <invoiceSummary>
43 <totalNetValue>100.00</totalNetValue>
44 <totalVatAmount>24.00</totalVatAmount>
45 <totalWithheldAmount>0</totalWithheldAmount>
46 <totalFeesAmount>0</totalFeesAmount>
47 <totalStampDutyAmount>0</totalStampDutyAmount>
48 <totalOtherTaxesAmount>0</totalOtherTaxesAmount>
49 <totalDeductionsAmount>0</totalDeductionsAmount>
50 <totalGrossValue>124.00</totalGrossValue>
51 <incomeClassification>
52 <icls:classificationType>E3_561_001</icls:classificationType>
53 <icls:classificationCategory>category1_1</icls:classificationCategory>
54 <icls:amount>100.00</icls:amount>
55 </incomeClassification>
56 </invoiceSummary>
57 </invoice>
58 </InvoicesDoc>
This is my workflow (not sure how to share it properly):
Here is my Invoice header data (from Function 1):
[{
"line_items": [{
"invoiceid": 109092,
"mod_by_internal": "Denis XXXXXXX",
"mod_date_internal": "2022-09-01T16:29:18.000Z",
"modifiedby": 5,
"createdtime": "2020-10-13T08:41:57.000Z",
"modifiedtime": "2022-09-01T13:29:18.000Z",
"invoicedate1": "2020-10-19T00:00:00.000Z",
"duedate1": "2020-11-19T00:00:00.000Z",
"invoice_no": "PRO-131",
"accountname": "BarXXXXXXXXXX",
"cf_1183": 0,
"cf_1184": null,
"inv_type": "1.3 Sales - Third Country",
"cf_1111": "19",
"cf_1107": 35,
"cf_1105": "",
"cf_1087": "",
"cf_1085": "",
"cf_859": "",
"inv_language": "EN",
"cf_703": "",
"inv_actt_name_gr": "BarkXXXXXXXX",
"inv_vat": "GB538XXXXXXXX",
"inv_doi": "",
"inv_acct_businesstype": "",
"cf_752": 0,
"cf_756": "barkXXX@XXXXX",
"cf_758": "",
"cf_1089": "TNT",
"cf_1101": "786.40000000",
"cf_1103": "375.00000000",
"cf_1109": "1161.4000",
"cf_1121": "",
"cf_1188": "",
"cf_1190": "",
"cf_1213": "",
"cf_1215": "0",
"cf_1219": null,
"cf_1221": "",
"cf_1245": "GB - United Kingdom",
"cf_1249": "375.0000",
"cf_2026": "",
"cf_2098": "",
"cf_2506": "",
"cf_2508": null,
"cf_2510": "",
"bill_city": "HXXXXXX",
"bill_code": "CXXXXXXX",
"bill_country": "Great Britain",
"bill_state": "",
"bill_street": "POXXXXXXXXXXXX",
"bill_pobox": null
}]
}]
And here my invoice lines(from “Function”):
[{
"line_items": [{
"id": 109092,
"productid": 109086,
"sequence_no": 1,
"quantity": "2.000",
"listprice": "35.00000000",
"discount_percent": null,
"discount_amount": null,
"comment": "GPS upgrade for Wave-4G series. (connectors + GPS antenna)",
"description": null,
"incrementondel": 0,
"lineitem_id": 4532,
"tax1": "0.000",
"tax2": null,
"tax3": null,
"tax4": null,
"image": null,
"purchase_cost": "0.00000000",
"margin": "0.00000000"
},
{
"id": 109092,
"productid": 6833,
"sequence_no": 2,
"quantity": "1.000",
"listprice": "12.00000000",
"discount_percent": null,
"discount_amount": null,
"comment": "12V-24V Car plug Power Adapter MW292",
"description": null,
"incrementondel": 0,
"lineitem_id": 4533,
"tax1": "0.000",
"tax2": null,
"tax3": null,
"tax4": null,
"image": null,
"purchase_cost": "0.00000000",
"margin": "0.00000000"
},
{
"id": 109092,
"productid": 109091,
"sequence_no": 3,
"quantity": "1.000",
"listprice": "210.00000000",
"discount_percent": null,
"discount_amount": null,
"comment": "Wave-4G GPS 1xSIM 1xLAN 1xWAN GPS - WiFi Router",
"description": null,
"incrementondel": 0,
"lineitem_id": 4534,
"tax1": "0.000",
"tax2": null,
"tax3": null,
"tax4": null,
"image": null,
"purchase_cost": "0.00000000",
"margin": "0.00000000"
},
{
"id": 109092,
"productid": 6391,
"sequence_no": 4,
"quantity": "1.000",
"listprice": "35.00000000",
"discount_percent": null,
"discount_amount": null,
"comment": "GPS tracker TR102",
"description": null,
"incrementondel": 0,
"lineitem_id": 4535,
"tax1": "0.000",
"tax2": null,
"tax3": null,
"tax4": null,
"image": null,
"purchase_cost": "0.00000000",
"margin": "0.00000000"
}
]
}]
The DB search is based on “Views” so i can modify the field names if needed…
But how can i get all that info into that XML structure?
Many thanks in advance.
DD