Sage 50 CA Purchase Invoice XML
The following tasks use the Sage 50 CA Purchase Invoice XML format.
Tasks
XML Overview
Any Sage fields not documented below are not supported with our imports/exports. Examples of where in the XML the fields should appear are shown in the samples below.
Minimal Purchase Invoice File
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<Vendor>
<Name>Zynk Software</Name>
</Vendor>
<LineItems>
<LineItem>
<Quantity>2</Quantity>
<Description>Computer Repair - No Warranty</Description>
<Price>5</Price>
</LineItem>
</LineItems>
</PurchaseInvoice>
</PurchaseInvoices>
Complete Purchase Invoice File
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<ExternalId>5230</ExternalId>
<InvoiceNumber>5230</InvoiceNumber>
<Vendor>
<ExternalId>124</ExternalId>
<Name>Zynk Software</Name>
<CurrencyCode>CAD</CurrencyCode>
<Contact>John Smith</Contact>
<Street1>i6</Street1>
<Street2>6-8 Charlotte Square</Street2>
<City>Newcastle</City>
<Province>Tyne & Wear</Province>
<PostalCode>NE1 4XF</PostalCode>
<Country>Great Britain</Country>
<Phone1>0191 820 1484</Phone1>
<Phone2>0191 820 1484</Phone2>
<Fax>0191 820 1484</Fax>
<Email>[email protected]</Email>
<Website>www.zynk.com</Website>
</Vendor>
<Date>2023-07-27</Date>
<LinkedDocumentNumber>DO-4</LinkedDocumentNumber>
<ItemsStoredAt>Ontario</ItemsStoredAt>
<JobSite>Askew Shopping Centre</JobSite>
<Payment>
<Method>Cheque</Method>
<Account>10600</Account>
<ChequeNumber>123456</ChequeNumber>
</Payment>
<VendorAddress>
<Address1>Teresa Green</Address1>
<Address2>i6</Address2>
<Address3>6-8 Charlotte Square</Address3>
<Address4>Newcastle, Tyne & Wear NE1 4XF</Address4>
<Address5>Great Britain</Address5>
</VendorAddress>
<LineItems>
<LineItem>
<ItemNumber>CR-10</ItemNumber>
<ItemExternalId>1234</ItemExternalId>
<Quantity>2</Quantity>
<Unit>Each</Unit>
<Description>Computer Repair - No Warranty</Description>
<BasePrice>5</BasePrice>
<DiscountPercentage>0</DiscountPercentage>
<Price>5</Price>
<Amount>10</Amount>
<TaxCode>GP</TaxCode>
<Account>42200</Account>
<JobSites>
<JobSite>
<Site>Askew Shopping Centre</Site>
<Percentage>50</Percentage>
</JobSite>
<JobSite>
<Site>Basement Renovation</Site>
<Amount>5</Amount>
</JobSite>
</JobSites>
</LineItem>
</LineItems>
<Freight>
<Amount>2.00</Amount>
<TaxCode>GP</TaxCode>
<Tax1Amount>0.10</Tax1Amount>
<Tax2Amount>0.14</Tax2Amount>
<JobSites>
<JobSite>
<Site>Askew Shopping Centre</Site>
<Amount>1.12</Amount>
<Percentage>50</Percentage>
</JobSite>
</JobSites>
</Freight>
<Terms>
<DiscountPercentage>2</DiscountPercentage>
<DiscountDays>30</DiscountDays>
<NetDays>60</NetDays>
</Terms>
<AdditionalInfo>
<AdditionalDate>2023-07-26</AdditionalDate>
<AdditionalField>Some additional info</AdditionalField>
</AdditionalInfo>
<AttachmentFile>inv-523.pdf</AttachmentFile>
<AttachmentUrl>https://www.zynk.com</AttachmentUrl>
</PurchaseInvoice>
</PurchaseInvoices>
In each of the following sections most of the XML has been omitted to make the samples easier to read. The whole structure of the PurchaseOrders schema is used below as a reference of where fields should be in the object model.
Header Information
The following fields can be populated at the header level of the purchase invoice record.
When importing purchase invoices into Sage, we recommend that the ExternalId
field be populated by the unique id of the purchase invoice from the external system. Zynk uses this field to track purchase invoices already imported into Sage, and it can be used in conjunction with the Prevent Reprocessing task setting to prevent duplicate purchase invoices being created in Sage.
The vendor name field acts as the unique identifier for vendors in Sage. The vendor can be specified by any of the following methods:
- Provide the vendor name via the Vendor/Name
element in the XML. If a vendor exists in Sage with this name, it will be selected. If not, a one-time vendor will be used with the name specified. Alternatively, you can explicitly set the name to <One-time vendor>
to use a one-time vendor.
- If the vendor has been imported into Sage by Zynk before, and an ExternalId
value was provided at the time, providing the same Vendor/ExternalId
value again will allow Zynk to determine the name via our truth table.
- Use the Vendor Match Fields task setting to search Sage for a matching vendor based on the value of one or more fields (such as email address or postal code).
| Sage Field | XML Field | Field Type | Input | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| - | ExternalId | string(255) | Optional | Provide the ID of the purchase invoice from the source system |
| Invoice No | InvoiceNumber | string(20) | Dependant | If auto numbering is not enabled in Sage, you must provide this value |
| Vendor | Vendor/Id | string(255) | Optional | Used to looked up the vendor name in Zynk's truth table |
| Vendor | Vendor/Name | string(52) | Required | The value can be looked up in Zynk's truth table via the Vendor/ExternalId
, or the 'Vendor Match Fields' task setting |
| Date | Date | datetime | Optional | Will default to the current date if not specified |
| GRN/Order/Quote No. | LinkedDocumentNumber | string(20) | Optional | |
| Items stored at | ItemsStoredAt | string(35) | Optional | |
| Job Site | JobSite | string(52) | Optional | If specified, you can't set job information at the line level |
| Payment Method | Payment/Method | string(30) | Optional | |
| Deposit To | Payment/Account | string(8) | Optional | |
| Cheque | Payment/ChequeNumber | string(20) | Optional | |
| Additional Information > Additional Date | AdditionalInfo/AdditionalDate | datetime | Optional | |
| Additional Information > Additional Field | AdditionalInfo/AdditionalField | string(75) | Optional | |
| Attachment > File | AttachmentFile | string(1023) | Optional | Can't be specified if AttachmentUrl
is provided |
| Attachment > Internet | AttachmentUrl | string(1023) | Optional | Can't be specified if AttachmentFile
is provided |
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<ExternalId>5230</ExternalId>
<InvoiceNumber>5230</InvoiceNumber>
<Vendor>
<ExternalId>124</ExternalId>
<Name>Zynk Software</Name>
</Vendor>
<Date>2023-07-27</Date>
<LinkedDocumentNumber>DO-4</LinkedDocumentNumber>
<ItemsStoredAt>Ontario</ItemsStoredAt>
<JobSite>Askew Shopping Centre</JobSite>
<Payment>
<Method>Cheque</Method>
<Account>10600</Account>
<ChequeNumber>123456</ChequeNumber>
</Payment>
<AdditionalInfo>
<AdditionalDate>2023-07-26</AdditionalDate>
<AdditionalField>Some additional info</AdditionalField>
</AdditionalInfo>
<AttachmentFile>inv-523.pdf</AttachmentFile>
<AttachmentUrl>https://www.zynk.com</AttachmentUrl>
</PurchaseInvoice>
</PurchaseInvoices>
Auto Creating Vendors
Zynk can automatically create new vendors in Sage where they don't already exist. To do this, you must enable the Auto Create Vendors task setting, and provide the vendor information described below in the XML.
| Sage Field | XML Field | Field Type | Input | Notes | | --- | --- | --- | --- | --- | --- | --- | | - | Vendor/ExternalId | string(255) | Optional | Provide the ID of the vendor from the source system | | Vendor | Vendor/Name | string(52) | Required | | | Currency | Vendor/CurrencyCode | string(3) | Optional | Specify the 3 letter currency ISO code | | Contact | Vendor/Contact | string(30) | Optional | | | Street1 | Vendor/Street1 | string(50) | Optional | | | Street2 | Vendor/Street2 | string(50) | Optional | | | City | Vendor/City | string(35) | Optional | | | Province | Vendor/Province | string(20) | Optional | | | PostalCode | Vendor/PostalCode | string(9) | Optional | | | Country | Vendor/Country | string(30) | Optional | | | Phone1 | Vendor/Phone1 | string(25) | Optional | | | Phone2 | Vendor/Phone2 | string(25) | Optional | | | Fax | Vendor/Fax | string(25) | Optional | | | Email | Vendor/Email | string(50) | Optional | | | Website | Vendor/Website | string(50) | Optional | | | Price List | Vendor/PriceList | string(25) | Optional | |
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<Vendor>
<ExternalId>123</ExternalId>
<Name>Zynk Software</Name>
<CurrencyCode>CAD</CurrencyCode>
<Contact>John Smith</Contact>
<Street1>i6</Street1>
<Street2>6-8 Charlotte Square</Street2>
<City>Newcastle</City>
<Province>Tyne & Wear</Province>
<PostalCode>NE1 4XF</PostalCode>
<Country>Great Britain</Country>
<Phone1>0191 820 1484</Phone1>
<Phone2>0191 820 1484</Phone2>
<Fax>0191 820 1484</Fax>
<Email>[email protected]</Email>
<Website>www.zynk.com</Website>
<PriceList>Preferred</PriceList>
</Vendor>
</PurchaseInvoice>
</PurchaseInvoices>
Address Information
The following fields can be populated in the vendor address section of the purchase invoice record.
If a vendor was selected, the vendor address will always be set to the address shown on the vendors account, and can't be overridden. You can only set the vendor address when the invoice is being raised against a one-time vendor.
| Sage Field | XML Field | Field Type | Input | Notes | | --- | --- | --- | --- | --- | --- | | Vendor Address > Line 1 | VendorAddress/Address1 | string(75) | Optional | Can only be populated when the vendor is a one-time vendor | | Vendor Address > Line 2 | VendorAddress/Address2 | string(75) | Optional | Can only be populated when the vendor is a one-time vendor | | Vendor Address > Line 3 | VendorAddress/Address3 | string(75) | Optional | Can only be populated when the vendor is a one-time vendor | | Vendor Address > Line 4 | VendorAddress/Address4 | string(75) | Optional | Can only be populated when the vendor is a one-time vendor | | Vendor Address > Line 5 | VendorAddress/Address5 | string(75) | Optional | Can only be populated when the vendor is a one-time vendor |
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<VendorAddress>
<Address1>Teresa Green</Address1>
<Address2>i6</Address2>
<Address3>6-8 Charlotte Square</Address3>
<Address4>Newcastle, Tyne & Wear NE1 4XF</Address4>
<Address5>Great Britain</Address5>
</VendorAddress>
</PurchaseInvoice>
</PurchaseInvoices>
Line Items
The following fields can be populated at the line level of the purchase invoice record.
| Sage Field | XML Field | Field Type | Input | Notes |
| --- | --- | --- | --- | --- | --- | --- |
| Item Number | ItemNumber | string(52) | Optional | |
| - | ItemExternalId | string(255) | Optional | Can be used to look up the ItemNumber
, if the item was created via the Import Items task, and an ExternalId
was specified. |
| Quantity | Quantity | double | Dependant | At least one of the following must be provided: Quantity
, Ordered
or BackOrdered
|
| Order | Ordered | double | Dependant | At least one of the following must be provided: Quantity
, Ordered
or BackOrdered
|
| Back Order | BackOrdered | double | Dependant | At least one of the following must be provided: Quantity
, Ordered
or BackOrdered
|
| Unit | Unit | string(15) | Optional | |
| Item Description | Description | string(75) | Optional | If not specified, will default to the description from the item |
| Base Price | BasePrice | double | Optional | |
| Discount | DiscountPercentage | double | Optional | |
| Price | Price | double | Optional | If not specified, will default to the price from the item |
| Amount | Amount | double | Optional | If not specified, will default to the price times the quantity |
| Tax | TaxCode | string(12) | Optional | |
| Account | Account | string(8) | Optional | |
| Job Sites > Job Site | JobSites/JobSite/Site | double | Optional | |
| Job Sites > Amount | JobSites/JobSite/Amount | double | Optional | |
| Job Sites > Percentage | JobSites/JobSite/Percentage | double | Optional | |
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<LineItems>
<LineItem>
<ItemNumber>CR-10</ItemNumber>
<ItemExternalId>1234</ItemExternalId>
<Quantity>2</Quantity>
<Ordered>2</Ordered>
<BackOrdered>2</BackOrdered>
<Unit>Each</Unit>
<Description>Computer Repair - No Warranty</Description>
<BasePrice>5</BasePrice>
<DiscountPercentage>0</DiscountPercentage>
<Price>5</Price>
<Amount>10</Amount>
<TaxCode>GP</TaxCode>
<Account>42200</Account>
<JobSites>
<JobSite>
<Site>Askew Shopping Centre</Site>
<Percentage>50</Percentage>
</JobSite>
<JobSite>
<Site>Basement Renovation</Site>
<Amount>5</Amount>
</JobSite>
</JobSites>
</LineItem>
</LineItems>
</PurchaseInvoice>
</PurchaseInvoices>
Footer Information
The following fields can be populated at the footer level of the purchase invoice record.
| Sage Field | XML Field | Field Type | Input | Notes | | --- | --- | --- | --- | --- | --- | | Freight | Freight/Amount | double | Optional | | | Freight | Freight/TaxCode | string(12) | Optional | | | Freight | Freight/Tax1Amount | double | Optional | | | Freight | Freight/Tax2Amount | double | Optional | | | Freight > Job Sites > Job Site | Freight/JobSites/JobSite/Site | double | Optional | | | Freight > Job Sites > Amount | Freight/JobSites/JobSite/Amount | double | Optional | | | Freight > Job Sites > Percentage | JobSites/JobSite/Percentage | double | Optional | | | Early Payment Terms > % | Terms/DiscountPercentage | double | Optional | | | Early Payment Terms > Days | Terms/DiscountDays | int | Optional | | | Early Payment Terms > Net Days | Terms/NetDays | int | Optional | |
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices>
<PurchaseInvoice>
<Freight>
<Amount>2.00</Amount>
<TaxCode>GP</TaxCode>
<Tax1Amount>0.10</Tax1Amount>
<Tax2Amount>0.14</Tax2Amount>
<JobSites>
<JobSite>
<Site>Askew Shopping Centre</Site>
<Amount>1.12</Amount>
<Percentage>50</Percentage>
</JobSite>
</JobSites>
</Freight>
<Terms>
<DiscountPercentage>2</DiscountPercentage>
<DiscountDays>30</DiscountDays>
<NetDays>60</NetDays>
</Terms>
</PurchaseInvoice>
</PurchaseInvoices>