Hmm this is quite a lot. If you send me a personal message I will be glad to send you the code
there are quit e view things that are set with special values .I took the settings gebnet uses
but for your confiniance here a bit on the CAC as youasked. Please use the namespace as I mentioned earlier then.
//First section of the invoice .Rememener ther are quit a view notes .This starting ones are easy As There is no N:M relation . For invoice rules there is as there can be many of them VAT and different percent used etc
Here some code:
IF fExeDir() <> "" THEN
//spath = fExeDir() + ["\"]+ Klanten.FirmaNaam + "_" + QRY_ubl_verkoopfactuur.Factuurnummer + ".xml"
sPath = fBuildPath( fExeDir(), "factuur\"+Klanten.FirmaNaam + "_" + QRY_ubl_verkoopfactuur.Factuurnummer + ".xml")
sPath_Pdf = fExeDir() + ["\"]+ Klanten.FirmaNaam + "_" + QRY_ubl_verkoopfactuur.Factuurnummer + ".pdf"
END
xmlfact.Invoice.'cbc:UBLVersionID' = "2.1"
xmlfact.Invoice.'cbc:CustomizationID' = " urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0:extended:urn:www.simplerinvoicing.org:si:si-ubl:ver1.1.x "
xmlfact.Invoice.'cbc

rofileID' = "urn:www.cenbii.eu:profile:bii04:ver2.0"
xmlfact.Invoice.'cbc:ID' = QRY_ubl_verkoopfactuur.Factuurnummer
xmlfact.Invoice.'cbc:IssueDate' = DateToString(QRY_ubl_verkoopfactuur.Factuurdatum,"YYYY-MM-DD")
xmlfact.Invoice.'cbc

ueDate' = DateToString(QRY_ubl_verkoopfactuur.Vervaldatum,"YYYY-MM-DD")
xmlfact.Invoice.'cbc:InvoiceTypeCode' = "380"
xmlfact.Invoice.'cbc:InvoiceTypeCode':listID = "UNCL1001"
xmlfact.Invoice.'cbc:InvoiceTypeCode':listAgencyID = "6"
xmlfact.Invoice.'cbc:Note' = QRY_ubl_verkoopfactuur.Omschrijving
xmlfact.Invoice.'cbc:TaxPointDate' = DateToString(QRY_ubl_verkoopfactuur.Factuurdatum,"YYYY-MM-DD")
xmlfact.Invoice.'cbc

ocumentCurrencyCode' = "EUR"
xmlfact.Invoice.'cbc

ocumentCurrencyCode':listID = "ISO 4217 Alpha"
xmlfact.Invoice.'cbc

ocumentCurrencyCode':listAgencyID = "6"
xmlfact.Invoice.'cbc:AccountingCost' = QRY_ubl_verkoopfactuur.referentie
xmlfact.Invoice.'cac:InvoicePeriod'.'cbc

tartDate' = DateToString(QRY_ubl_verkoopfactuur.Factuurdatum,"YYYY-MM-DD")
xmlfact.Invoice.'cac:InvoicePeriod'.'cbc:EndDate' = DateToString(QRY_ubl_verkoopfactuur.Factuurdatum,"YYYY-MM-DD")
IF QRY_ubl_verkoopfactuur.Ordernummer <> 0 THEN
xmlfact.Invoice.'cac:OrderReference'.'cbc:ID' = QRY_ubl_verkoopfactuur.Ordernummer
END
// billing reverence zou hier nog kunnen komen. Dat is bij een credit factuur de referentie naar het origineel
// project referentie </cac:AdditionalDocumentReference>
IF HReadFirst(Bedrijf,BedrijfID) THEN
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyName'.'cbc:Name' = Bedrijf.Naam
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cbc

treetName' = Bedrijf.Adres
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cbc:BuildingNumber' = Bedrijf.huisnummer
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cbc:CityName' = Bedrijf.Woonplaats
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cbc

ostalZone' = Bedrijf.Postcode
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cac:Country'.'cbc:IdentificationCode' = "NL"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cac:Country'.'cbc:IdentificationCode':listID = "ISO3166-1:Alpha2"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

ostalAddress'.'cac:Country'.'cbc:IdentificationCode':listAgencyID = "6"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyTaxScheme'.'cbc:CompanyID' = Bedrijf.BTW_nummer
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyTaxScheme'.'cbc:CompanyID':schemeID = "NL:VAT"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyTaxScheme'.'cbc:CompanyID':schemeAgencyID = "ZZZ"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyTaxScheme'.'cac:TaxScheme'.'cbc:ID' = "VAT"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyTaxScheme'.'cac:TaxScheme'.'cbc:ID':schemeID = "UN/ECE 5153"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyTaxScheme'.'cac:TaxScheme'.'cbc:ID':schemeAgencyID = "6"
xmlfact.invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyLegalEntity'.'cbc:CompanyID' = Bedrijf.kvknummer
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyLegalEntity'.'cbc:CompanyID':schemeID = "NL:KVK"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac

artyLegalEntity'.'cbc:CompanyID':schemeAgencyID = "ZZZ"
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac:Contact'.'cbc:Telephone' = Bedrijf.Telefoon
xmlfact.Invoice.'cac:AccountingSupplierParty'.'cac

arty'.'cac:Contact'.'cbc:ElectronicMail' = Bedrijf.Emailadres
END
I know this is a mess . Please send me a PM then I can give you all in a readable format. Any one else want this code Please send me a pm . I will give it to you as well.
regards