Converting a Purchase Order to a Bill can be achieved using the MYOB AccountRight API.
An Order to an Invoice
To initiate the conversion, Obtain the order data with a GET request from
Order:
{{company_file_uri}}/{{company_file_id}}/Purchase/Order/{{type}}
MYOB AccountRight supports 4 different {{type}} of purchases, these are: Item, Service, Professional and Miscellaneous.
To find out exactly what you can and can't post, read the full bill documentation here.
Example Json GET response for Service layout
{
"UID" : "974c3837-ef10-4277-ad4c-ab3298b39649",
"Number" : "00001095",
"Date" : "2014-08-21T00:00:00",
"SupplierInvoiceNumber" : "AAA000005899813",
"Supplier" : {
"UID" : "63b984e5-241e-4c1a-bfe1-7868a69f5e29",
"Name" : "Huston & Huston Packaging",
"DisplayID" : "SUPP000004",
"URI" : "{cf_uri}/Contact/Supplier/63b984e5-241e-4c1a-bfe1-7868a69f5e29"
},
"ShipToAddress" : "Clearwater Pty. Ltd. 25 Spring Street Blackburn VIC 3130",
"Terms" : {
"PaymentIsDue" : "DayOfMonthAfterEOM",
"DiscountDate" : 1,
"BalanceDueDate" : 30,
"DiscountForEarlyPayment" : 2,
"DiscountExpiryDate" : "2014-09-01T00:00:00",
"Discount" : 2,
"DueDate" : "2014-09-30T00:00:00"
},
"IsTaxInclusive" : true,
"Lines" : [
{
"RowID" : 1059,
"Type" : "Transaction",
"Description" : "Stationery",
"Total" : 29.70,
"Account" : {
"UID" : "3777c4f0-48f7-40ab-aaea-3cec1433eef0",
"Name" : "Office Supplies",
"DisplayID" : "6-1180",
"URI" : "{cf_uri}/GeneralLedger/Account/3777c4f0-48f7-40ab-aaea-3cec1433eef0"
},
"Job" : null,
"TaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
},
"RowVersion" : "6460283374982387352"
}
],
"IsReportable" : false,
"Subtotal" : 29.70,
"Freight" : 0,
"FreightTaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
},
"TotalTax" : 2.70,
"TotalAmount" : 29.70,
"Category" : null,
"Comment" : "Thank you!",
"ShippingMethod" : "Federal Express",
"JournalMemo" : "Purchase; Huston & Huston Packaging",
"PromisedDate" : null,
"AppliedToDate" : 0,
"OrderDeliveryStatus" : "Print",
"BalanceDueAmount" : 29.70,
"Status" : "Open",
"LastPaymentDate" : null,
"ForeignCurrency" : null,
"URI" : "{cf_uri}/Purchase/Order/Service/974c3837-ef10-4277-ad4c-ab3298b39649",
"RowVersion" : "-5359414524204284769"
}
Based on obtained Order data, a POST request to
Bill:
{{company_file_uri}}/{{company_file_id}}/Purchase/Bill/{{type}}
and ensure the ‘Order’ property is added to contain the original order UID. Note: The original order and the new bill layout should match.
Sample POST Code for service layout
{
"Number" : "00001095",
"Date" : "2014-08-21T00:00:00",
"SupplierInvoiceNumber" : "AAA000005899813",
"Supplier" : {
"UID" : "63b984e5-241e-4c1a-bfe1-7868a69f5e29",
"Name" : "Huston & Huston Packaging",
"DisplayID" : "SUPP000004",
"URI" : "{cf_uri}/Contact/Supplier/63b984e5-241e-4c1a-bfe1-7868a69f5e29"
},
"ShipToAddress" : "Clearwater Pty. Ltd. 25 Spring Street Blackburn VIC 3130",
"Terms" : {
"PaymentIsDue" : "DayOfMonthAfterEOM",
"DiscountDate" : 1,
"BalanceDueDate" : 30,
"DiscountForEarlyPayment" : 2,
"DiscountExpiryDate" : "2014-09-01T00:00:00",
"Discount" : 2,
"DueDate" : "2014-09-30T00:00:00"
},
"IsTaxInclusive" : true,
"Lines" : [
{
"Type" : "Transaction",
"Description" : "Stationery",
"Total" : 29.70,
"Account" : {
"UID" : "3777c4f0-48f7-40ab-aaea-3cec1433eef0",
"Name" : "Office Supplies",
"DisplayID" : "6-1180",
"URI" : "{cf_uri}/GeneralLedger/Account/3777c4f0-48f7-40ab-aaea-3cec1433eef0"
},
"Job" : null,
"TaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
}
}
],
"IsReportable" : false,
"Subtotal" : 29.70,
"Freight" : 0,
"FreightTaxCode" : {
"UID" : "38a37ae8-565c-46f8-ad4a-2a87069607f8",
"Code" : "GST",
"URI" : "{cf_uri}/GeneralLedger/TaxCode/38a37ae8-565c-46f8-ad4a-2a87069607f8"
},
"TotalTax" : 2.70,
"TotalAmount" : 29.70,
"Category" : null,
"Comment" : "Thank you!",
"ShippingMethod" : "Federal Express",
"JournalMemo" : "Purchase; Huston & Huston Packaging",
"PromisedDate" : null,
"AppliedToDate" : 0,
"OrderDeliveryStatus" : "Print",
"BalanceDueAmount" : 29.70,
"Status" : "Open",
"LastPaymentDate" : null,
"Order" : {
"UID" : "974c3837-ef10-4277-ad4c-ab3298b39649"
},
"ForeignCurrency" : null
}
Comments
0 comments
Article is closed for comments.