Skip to content

Instantly share code, notes, and snippets.

View radoAngelov's full-sized avatar

Radoslav Angelov radoAngelov

  • ReceiptBank
  • Sofia, Bulgaria
View GitHub Profile

Line Items in MYOB Essentials

Background

When we are sending a bill to MYOB Essentials, they expect it to have line items. Every line item contains a unit price, quantity and the ID of its tax rate. This means we are neither sending the tax amount nor the total amount to MYOB Essentials. Calculation of the tax amount is done by their system based on the sent ID. Total amount is also calculated by them based on the unit price and the quantity of each line item. The unit price sent by us calculated via a simple formula - line_item.total_amount / line_item.quantity. As you can notice the unit price is not affected by the net amount but only the total. This means every line item generated by us has to contain information for 3 attributes - total amount, quantity, tax rate ID.

Generation of line items explained with pseudo code

Used terminology:

  • used_defined_lines - line items defined by the user in the monolith interface

Case 8: NO VAT Registered + Manual Line Items + NO Remaining Amount

Generated line items:

[
  {
    "use_tax_rate"=>false,
    "use_net"=>false,
    "description"=>"superman",

Case 1: VAT Registered + Manual Line Items + NO Remaining Amount

Generated line items:

[
  {
    "use_tax_rate"=>true,
    "use_net"=>false,
    "description"=>"superman",