This code could be used to create bills based in the logic asked by this challenge: https://gist.github.com/safplatform/792314da6b54346594432f30d5868f36
You can clone or download the code, go to the directory and just type ruby main.rb
You can insert the products following the format suggested:
:quantity [imported] :product_name at :price
Where:
- quantity: is the number of products
- imported(optional): Specifies if the product is imported
- product-name: the product name or a short description
- price: the product unit price
You can insert products one by one or copy and paste a set of products, after you have done, just type end
and enter.
You will receive the bill with the sales taxes and total.