lib/xeroizer/models/line_item.rb in xeroizer-float-2.15.3.7 vs lib/xeroizer/models/line_item.rb in xeroizer-float-2.15.3.8

- old
+ new

@@ -16,10 +16,11 @@ decimal :unit_amount string :account_code string :tax_type decimal :tax_amount decimal :line_amount, :calculated => true + decimal :discount_rate has_many :tracking, :model_name => 'TrackingCategoryChild' def line_amount=(line_amount) @line_amount_set = true @@ -29,10 +30,10 @@ # Calculate the line_total (if there is a quantity and unit_amount). # Description-only lines have been allowed since Xero V2.09. def line_amount(summary_only = false) return attributes[:line_amount] if summary_only || @line_amount_set - BigDecimal((quantity * unit_amount).to_s).round(2) if quantity && unit_amount + BigDecimal((quantity * unit_amount * (100.0 - discount_rate)).to_s).round(2) if quantity && unit_amount end end end