Converting a Sales Quote or Order to an Invoice can be achieved using the MYOB AccountRight API.
To initiate conversion, GET data from
Quote:
{{company_file_uri}}/{{company_file_id}}/Sale/Quote/{{type}}
Order:
{{company_file_uri}}/{{company_file_id}}/Sale/Order/{{type}}
MYOB AccountRight supports 5 different {{type}} of invoice, these are: Item, Service, Professional, Time Billing and Miscellaneous.
To find out exactly what you can and can't post, read the full invoice documentation here.
A Quote to an Order
A new order creation by simply POSTing data to
{{company_file_uri}}/{{company_file_id}}/Sale/Order/{{type}}
Based on GET obtained quote data. Note: Order number can be unique or mirrored with the original quote number.
Once the order record is created, Delete to
{{company_file_uri}}/{{company_file_id}}/Sale/Quote/{{type}}
in order to remove the original quote, if necessary.
An Order to an Invoice
Obtain the order data with GET from
{{company_file_uri}}/{{company_file_id}}/Sale/Order/{{type}}
Example Json GET response for Service layout
{
"UID" : "ce2379d6-ab03-4b57-aac4-a393bafa5e47",
"Number" : "00000014",
"Date" : "2014-05-29T00:00:00",
"ShipToAddress" : "The Motor Company 63 Driveaway Road Edwardstown NSW 2112 Australia",
"CustomerPurchaseOrderNumber" : null,
"Customer" : {
"UID" : "f005d6df-eada-4a40-9908-1d982f047d05",
"Name" : "The Motor Company",
"DisplayID" : "CUS000010",
"URI" : "{cf_uri}/Contact/Customer/f005d6df-eada-4a40-9908-1d982f047d05"
},
"Terms" : {
"PaymentIsDue" : "DayOfMonthAfterEOM",
"DiscountDate" : 1,
"BalanceDueDate" : 30,
"DiscountForEarlyPayment" : 5,
"MonthlyChargeForLatePayment" : 7,
"DiscountExpiryDate" : "2014-06-01T00:00:00",
"Discount" : 5,
"DueDate" : "2014-06-30T00:00:00",
"FinanceCharge" : 6.08
},
"IsTaxInclusive" : true,
"Lines" : [
{
"RowID" : 1,
"Type" : "Header",
"Description" : "General Services",
"RowVersion" : "-4657084081930764299"
},
{
"RowID" : 2,
"Type" : "Transaction",
"Description" : "Planned service per due date",
"Total" : 100,
"Account" : {
"UID" : "89f2b352-c147-4e35-b4b5-7a4e21989e5e",
"Name" : "Sales - Water Cooler",
"DisplayID" : "4-1300",
"URI" : "{cf_uri}/GeneralLedger/Account/89f2b352-c147-4e35-b4b5-7a4e21989e5e"
},
"Job" : null,
"TaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
},
"RowVersion" : "-6148539391267569664"
}
],
"Subtotal" : 100,
"Freight" : 0,
"FreightTaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
},
"TotalTax" : 9.09,
"TotalAmount" : 100,
"Category" : {
"UID" : "b211a2a3-0be9-477c-940e-1c8bac139cf1",
"Name" : "Melbourne",
"DisplayID" : "CAT101",
"URI" : "{cf_uri}/GeneralLedger/Category/b211a2a3-0be9-477c-940e-1c8bac139cf1"
},
"Salesperson" : {
"UID" : "5383ff72-4bb6-4d8b-bcf0-8b10857455d8",
"Name" : "Mary Jones",
"DisplayID" : "EMP00001",
"URI" : "{cf_uri}/Contact/Employee/5383ff72-4bb6-4d8b-bcf0-8b10857455d8"
},
"Comment" : "Thank you!",
"ShippingMethod" : "Australia Post",
"JournalMemo" : "Sale; The Motor Company",
"PromisedDate" : "2014-06-06T00:00:00",
"DeliveryStatus" : "Print",
"ReferralSource" : "Yellow Pages",
"AppliedToDate" : 0,
"BalanceDueAmount" : 100,
"Status" : "Open",
"LastPaymentDate" : null,
"ForeignCurrency" : null,
"LastModified" : "2019-05-01T00:47:43.757",
"URI" : "{cf_uri}/Sale/Order/Service/ce2379d6-ab03-4b57-aac4-a393bafa5e47",
"RowVersion" : "-6292654579343425536"
}
Based on obtained Order data, a POST request to
{{company_file_uri}}/{{company_file_id}}/Sale/Invoice/{{type}}
and ensure the ‘Order’ property is added to contain the original order UID. Note: The original order and the new invoice layout should match.
Sample POST Code for service layout
{
"Number" : "00000014",
"Date" : "2014-05-29T00:00:00",
"ShipToAddress" : "The Motor Company 63 Driveaway Road Edwardstown NSW 2112 Australia",
"CustomerPurchaseOrderNumber" : null,
"Customer" : {
"UID" : "f005d6df-eada-4a40-9908-1d982f047d05",
"Name" : "The Motor Company",
"DisplayID" : "CUS000010",
"URI" : "{cf_uri}/Contact/Customer/f005d6df-eada-4a40-9908-1d982f047d05"
},
"Terms" : {
"PaymentIsDue" : "DayOfMonthAfterEOM",
"DiscountDate" : 1,
"BalanceDueDate" : 30,
"DiscountForEarlyPayment" : 5,
"MonthlyChargeForLatePayment" : 7,
"DiscountExpiryDate" : "2014-06-01T00:00:00",
"Discount" : 5,
"DueDate" : "2014-06-30T00:00:00",
"FinanceCharge" : 6.08
},
"IsTaxInclusive" : true,
"Lines" : [
{
"Type" : "Header",
"Description" : "General Services",
"RowVersion" : "-4657084081930764299"
},
{
"Type" : "Transaction",
"Description" : "Planned service per due date",
"Total" : 100,
"Account" : {
"UID" : "89f2b352-c147-4e35-b4b5-7a4e21989e5e",
"Name" : "Sales - Water Cooler",
"DisplayID" : "4-1300",
"URI" : "{cf_uri}/GeneralLedger/Account/89f2b352-c147-4e35-b4b5-7a4e21989e5e"
},
"Job" : null,
"TaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
}
}
],
"Subtotal" : 100,
"Freight" : 0,
"FreightTaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
},
"TotalTax" : 9.09,
"TotalAmount" : 100,
"Category" : {
"UID" : "b211a2a3-0be9-477c-940e-1c8bac139cf1",
"Name" : "Melbourne",
"DisplayID" : "CAT101",
"URI" : "{cf_uri}/GeneralLedger/Category/b211a2a3-0be9-477c-940e-1c8bac139cf1"
},
"Salesperson" : {
"UID" : "5383ff72-4bb6-4d8b-bcf0-8b10857455d8",
"Name" : "Mary Jones",
"DisplayID" : "EMP00001",
"URI" : "{cf_uri}/Contact/Employee/5383ff72-4bb6-4d8b-bcf0-8b10857455d8"
},
"Comment" : "Thank you!",
"ShippingMethod" : "Australia Post",
"JournalMemo" : "Sale; The Motor Company",
"PromisedDate" : "2014-06-06T00:00:00",
"DeliveryStatus" : "Print",
"ReferralSource" : "Yellow Pages",
"AppliedToDate" : 0,
"BalanceDueAmount" : 100,
"Status" : "Open",
"LastPaymentDate" : null,
"Order" : {
"UID" : "ce2379d6-ab03-4b57-aac4-a393bafa5e47"
},
"ForeignCurrency" : null,
"LastModified" : "2019-05-01T00:47:43.757"
}
Comments
0 comments
Article is closed for comments.