Sha256: 8780da805af741f19a752453d85694d12b118d01dc3e7cfecbff2203ad52cd5e

Contents?: true

Size: 1002 Bytes

Versions: 1

Compression:

Stored size: 1002 Bytes

Contents

module Payday
  
  # Basically just an invoice. Stick a ton of line items in it, add some details, and then render it out!
  class Invoice
    include Payday::Invoiceable
    
    attr_accessor :invoice_number, :bill_to, :ship_to, :notes, :line_items, :tax_rate, :tax_description, :due_at, :paid_at, :currency
    
    def initialize(options =  {})
      self.invoice_number = options[:invoice_number] || nil
      self.bill_to = options[:bill_to] || nil
      self.ship_to = options[:ship_to] || nil
      self.notes = options[:notes] || nil
      self.line_items = options[:line_items] || []
      self.tax_rate = options[:tax_rate] || nil
      self.tax_description = options[:tax_description] || nil
      self.due_at = options[:due_at] || nil
      self.paid_at = options[:paid_at] || nil
      self.currency = options[:currency] || nil
    end
    
    # The tax rate that we're applying, as a BigDecimal    
    def tax_rate=(value)
      @tax_rate = BigDecimal.new(value.to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
payday-1.0.0beta6 lib/payday/invoice.rb