Added product_id to monthly invoice items

This commit is contained in:
Sergei Tsõganov 2022-08-30 14:15:45 +03:00
parent 5d92442a48
commit 34f5347c1f
2 changed files with 4 additions and 4 deletions

View file

@ -18,10 +18,10 @@ GIT
GIT GIT
remote: https://github.com/internetee/e_invoice.git remote: https://github.com/internetee/e_invoice.git
revision: da18f3da3219315f732b94fbc165fe83cb828a99 revision: 590dcd3b769ea57edd4c4626547b37120a02b127
branch: master branch: master
specs: specs:
e_invoice (0.1.1) e_invoice (0.1.2)
builder (~> 3.2) builder (~> 3.2)
nokogiri nokogiri
savon savon

View file

@ -91,13 +91,13 @@ class Invoice
def generate_monthly_invoice_item(invoice, item) def generate_monthly_invoice_item(invoice, item)
EInvoice::InvoiceItem.new.tap do |i| EInvoice::InvoiceItem.new.tap do |i|
i.description = item.description i.description = item.description
i.description = "[#{item.product_id}] #{item.description}" if item.product_id i.product_id = item.product_id
i.unit = item.unit i.unit = item.unit
i.price = item.price i.price = item.price
i.quantity = item.quantity i.quantity = item.quantity
i.vat_rate = invoice.vat_rate
if item.price && item.quantity if item.price && item.quantity
i.subtotal = (item.price * item.quantity).round(3) i.subtotal = (item.price * item.quantity).round(3)
i.vat_rate = invoice.vat_rate
i.vat_amount = i.subtotal * (i.vat_rate / 100) i.vat_amount = i.subtotal * (i.vat_rate / 100)
i.total = i.subtotal + i.vat_amount i.total = i.subtotal + i.vat_amount
end end