24 lines
626 B
Ruby
24 lines
626 B
Ruby
|
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
|