client_management/app/models/purchase_receipt.rb

24 lines
626 B
Ruby
Raw Normal View History

2017-03-29 07:09:14 +00:00
class PurchaseReceipt
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :receipt_file, AssetUploader
mount_uploader :received_receipt_file, AssetUploader
field :amount, type: Integer, :default => 0
field :amount_received, type: Integer, :default => 0
field :adjustable_amount, type: Integer, :default => 0
field :adjustable_amount_detail
field :amount_received_on, type: DateTime
field :receipt_number
belongs_to :contract_purchase
def amount_pending
self.amount - (self.amount_received + self.adjustable_amount)
end
def is_pending?
self.amount_pending > 0
end
end