client_management/app/models/request_contract.rb

39 lines
1.2 KiB
Ruby
Raw Normal View History

2017-03-07 09:37:28 +00:00
class RequestContract
include Mongoid::Document
include Mongoid::Timestamps
include Slug
2017-03-07 09:37:28 +00:00
field :new_site_cost, type: Integer, :default => 0
field :hosting_with_rulingdigital_cost, type: Integer, :default => 0
field :service_cost, type: Integer, :default => 0
field :option_module_cost, type: Integer, :default => 0
field :customized_module_cost, type: Integer, :default => 0
field :template_cost, type: Integer, :default => 0
field :customized_template_cost, type: Integer, :default => 0
field :rwd_cost, type: Integer, :default => 0
2017-03-29 07:09:14 +00:00
field :other
field :other_cost, type: Integer, :default => 0
field :confirmed, type: Boolean, :default => false
mount_uploader :contract_file, AssetUploader
mount_uploader :signed_contract_file, AssetUploader
2017-03-07 09:37:28 +00:00
has_one :site_request
2017-03-29 07:09:14 +00:00
has_one :contract_purchase
def total_amount
2017-03-29 07:09:14 +00:00
self.new_site_cost + self.hosting_with_rulingdigital_cost + self.service_cost + self.option_module_cost + self.customized_module_cost + self.template_cost + self.customized_template_cost + self.rwd_cost + self.other_cost
end
def is_confirmed?
self.confirmed
end
def contract_user
self.site_request.c_panel_user
end
def get_site
self.site_request.get_site
end
2017-03-07 09:37:28 +00:00
end