2020-09-08 06:12:14 +00:00
|
|
|
require 'orbit_form_helper'
|
|
|
|
class VenueManagementBill
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include Mongoid::Enum
|
2020-09-08 08:32:08 +00:00
|
|
|
BILLTYPE = {'venue_fee'=>["usage_fee", "royalties", "admin_fee", "land_rent"],'utility_bill'=>['electricity','water'],'tax'=>['house_tax','land_tax'],'prejudgment_interest'=>["usage_fee", "royalties", "admin_fee", "land_rent",'electricity','water','house_tax','land_tax','other'],'other'=>['penalty','other']}
|
2020-09-08 06:12:14 +00:00
|
|
|
CACULATIONBASISTYPE = ['revenue','degree']
|
|
|
|
field :accounting_month, type: Date, default: Time.now
|
|
|
|
field :bill_typeA, type: String, default: ""
|
|
|
|
field :bill_typeB, type: String, default: ""
|
2020-09-08 08:32:08 +00:00
|
|
|
field :bill_other, type: String, default: "", localize: true
|
2020-09-08 06:12:14 +00:00
|
|
|
field :caculation_basis_type, type: String, default: ""
|
2020-09-08 08:32:08 +00:00
|
|
|
field :caculation_basis, type: String, default: ""
|
2020-09-08 06:12:14 +00:00
|
|
|
field :reason, type: String, default: "", localize: true
|
|
|
|
field :amount, type: Integer, default: 0
|
|
|
|
field :deadline, type: Date, default: Time.now
|
|
|
|
field :received_date, type: Date, default: Time.now
|
|
|
|
field :pay_method, type: String, default: "", localize: true
|
|
|
|
field :note, type: String, default: "", localize: true
|
|
|
|
belongs_to :venue_management_main
|
|
|
|
include VenueLinkFile
|
2020-09-08 08:32:08 +00:00
|
|
|
def case_no
|
|
|
|
return (self.contractor.case_no rescue "")
|
|
|
|
end
|
2020-09-08 06:12:14 +00:00
|
|
|
def contractor
|
|
|
|
return self.venue_management_main.venue_management_contracts.where(:contract_start_date.lte=>self.accounting_month,:contract_end_date.gte=>self.accounting_month).first
|
|
|
|
end
|
|
|
|
def pay_date
|
|
|
|
return "#{self.deadline}/#{self.received_date}"
|
|
|
|
end
|
|
|
|
end
|