Class: BudgetVersionsObject
- Inherits:
-
Object
- Object
- BudgetVersionsObject
- Includes:
- DataFactory, Foundry, Navigation, StringFactory
- Defined in:
- lib/kuality-coeus/data_objects/budget/budget_versions.rb
Instance Attribute Summary collapse
-
#budget_periods ⇒ Object
Returns the value of attribute budget_periods.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#cost_sharing ⇒ Object
Returns the value of attribute cost_sharing.
-
#direct_cost ⇒ Object
Returns the value of attribute direct_cost.
-
#document_id ⇒ Object
Returns the value of attribute document_id.
-
#f_and_a ⇒ Object
Returns the value of attribute f_and_a.
-
#f_and_a_rate_type ⇒ Object
Returns the value of attribute f_and_a_rate_type.
-
#final ⇒ Object
Returns the value of attribute final.
-
#last_updated ⇒ Object
Returns the value of attribute last_updated.
-
#last_updated_by ⇒ Object
Returns the value of attribute last_updated_by.
-
#name ⇒ Object
Returns the value of attribute name.
-
#on_off_campus ⇒ Object
Returns the value of attribute on_off_campus.
-
#personnel ⇒ Object
Returns the value of attribute personnel.
-
#project_end_date ⇒ Object
Returns the value of attribute project_end_date.
-
#project_start_date ⇒ Object
Returns the value of attribute project_start_date.
-
#residual_funds ⇒ Object
Returns the value of attribute residual_funds.
-
#status ⇒ Object
Returns the value of attribute status.
-
#subaward_budgets ⇒ Object
Returns the value of attribute subaward_budgets.
-
#submit_cost_sharing ⇒ Object
Returns the value of attribute submit_cost_sharing.
-
#total ⇒ Object
Returns the value of attribute total.
-
#total_cost_limit ⇒ Object
Returns the value of attribute total_cost_limit.
-
#total_direct_cost_limit ⇒ Object
Returns the value of attribute total_direct_cost_limit.
-
#unrecovered_fa ⇒ Object
Returns the value of attribute unrecovered_fa.
-
#unrecovered_fa_rate_type ⇒ Object
Returns the value of attribute unrecovered_fa_rate_type.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #add_period(opts = {}) ⇒ Object
- #add_project_personnel(opts = {}) ⇒ Object
- #add_subaward_budget(opts = {}) ⇒ Object
- #copy_all_periods(new_name) ⇒ Object
- #copy_one_period(new_name, version) ⇒ Object
- #create ⇒ Object
- #default_periods ⇒ Object
- #delete_period(number) ⇒ Object
-
#edit(opts = {}) ⇒ Object
Please note, this method is for VERY basic editing…
- #edit_period(number, opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ BudgetVersionsObject
constructor
A new instance of BudgetVersionsObject.
- #open_budget ⇒ Object
Methods included from Navigation
#doc_search, #fill_out, #fill_out_item, #on_document?, #on_page?, #open_document, #window_cleanup
Methods included from Utilities
#get, #make_role, #make_user, #random_percentage, #set, #snake_case
Constructor Details
#initialize(browser, opts = {}) ⇒ BudgetVersionsObject
Returns a new instance of BudgetVersionsObject.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 20 def initialize(browser, opts={}) @browser = browser defaults = { name: random_alphanums_plus(40), budget_periods: collection('BudgetPeriods'), subaward_budgets: collection('SubawardBudget'), personnel: collection('BudgetPersonnel') } (defaults.merge(opts)) requires :document_id, :doc_type end |
Instance Attribute Details
#budget_periods ⇒ Object
Returns the value of attribute budget_periods.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def budget_periods @budget_periods end |
#comments ⇒ Object
Returns the value of attribute comments.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def comments @comments end |
#cost_sharing ⇒ Object
Returns the value of attribute cost_sharing.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def cost_sharing @cost_sharing end |
#direct_cost ⇒ Object
Returns the value of attribute direct_cost.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def direct_cost @direct_cost end |
#document_id ⇒ Object
Returns the value of attribute document_id.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def document_id @document_id end |
#f_and_a ⇒ Object
Returns the value of attribute f_and_a.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def f_and_a @f_and_a end |
#f_and_a_rate_type ⇒ Object
Returns the value of attribute f_and_a_rate_type.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def f_and_a_rate_type @f_and_a_rate_type end |
#final ⇒ Object
Returns the value of attribute final.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def final @final end |
#last_updated ⇒ Object
Returns the value of attribute last_updated.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def last_updated @last_updated end |
#last_updated_by ⇒ Object
Returns the value of attribute last_updated_by.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def last_updated_by @last_updated_by end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def name @name end |
#on_off_campus ⇒ Object
Returns the value of attribute on_off_campus.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def on_off_campus @on_off_campus end |
#personnel ⇒ Object
Returns the value of attribute personnel.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def personnel @personnel end |
#project_end_date ⇒ Object
Returns the value of attribute project_end_date.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def project_end_date @project_end_date end |
#project_start_date ⇒ Object
Returns the value of attribute project_start_date.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def project_start_date @project_start_date end |
#residual_funds ⇒ Object
Returns the value of attribute residual_funds.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def residual_funds @residual_funds end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def status @status end |
#subaward_budgets ⇒ Object
Returns the value of attribute subaward_budgets.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def subaward_budgets @subaward_budgets end |
#submit_cost_sharing ⇒ Object
Returns the value of attribute submit_cost_sharing.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def submit_cost_sharing @submit_cost_sharing end |
#total ⇒ Object
Returns the value of attribute total.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def total @total end |
#total_cost_limit ⇒ Object
Returns the value of attribute total_cost_limit.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def total_cost_limit @total_cost_limit end |
#total_direct_cost_limit ⇒ Object
Returns the value of attribute total_direct_cost_limit.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def total_direct_cost_limit @total_direct_cost_limit end |
#unrecovered_fa ⇒ Object
Returns the value of attribute unrecovered_fa.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def unrecovered_fa @unrecovered_fa end |
#unrecovered_fa_rate_type ⇒ Object
Returns the value of attribute unrecovered_fa_rate_type.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def unrecovered_fa_rate_type @unrecovered_fa_rate_type end |
#version ⇒ Object
Returns the value of attribute version.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 8 def version @version end |
Instance Method Details
#add_period(opts = {}) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 67 def add_period opts={} defaults={ budget_name: @name, doc_type: @doc_header } @budget_periods.add defaults.merge(opts) return if on(Parameters).errors.size > 0 # No need to continue the method if we have an error @budget_periods.number! # This updates the number value of all periods, as necessary end |
#add_project_personnel(opts = {}) ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 154 def add_project_personnel(opts={}) open_budget on(Parameters).personnel person = make BudgetPersonnelObject, opts person.create @personnel << person end |
#add_subaward_budget(opts = {}) ⇒ Object
146 147 148 149 150 151 152 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 146 def add_subaward_budget(opts={}) open_budget on(Parameters).budget_actions sab = make SubawardBudgetObject, opts sab.create @subaward_budgets << sab end |
#copy_all_periods(new_name) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 116 def copy_all_periods(new_name) navigate new_version_number='x' on(BudgetVersions).copy @name on(Confirmation).copy_all_periods on BudgetVersions do |copy| copy.name_of_copy.set new_name copy.save new_version_number=copy.version(new_name) end new_bv = self.clone new_bv.name=new_name new_bv.version=new_version_number new_bv end |
#copy_one_period(new_name, version) ⇒ Object
132 133 134 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 132 def copy_one_period(new_name, version) # pending resolution of a bug end |
#create ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 34 def create navigate on BudgetVersions do |add| @doc_header=add.doc_title add.name.set @name add.add add.final(@name).fit @final add.budget_status(@name).pick! @status add.save break if parameters.compact==nil # No reason to continue if there aren't other things to do # Otherwise, go to parameters page and fill out the rest of the stuff... add.open(@name) end #TODO: This needs to be dealt with more intelligently. # It's clear that we need to learn more about how to set up # sponsors better, so that we can predict when this dialog # will show up and when it won't... confirmation on Parameters do |parameters| @project_start_date=parameters.project_start_date @project_end_date=parameters.project_end_date parameters.total_direct_cost_limit.fit @total_direct_cost_limit fill_out parameters, :comments, :modular_budget, :residual_funds, :total_cost_limit, :unrecovered_fa_rate_type, :f_and_a_rate_type, :submit_cost_sharing parameters.on_off_campus.fit @on_off_campus parameters.alert.ok if parameters.alert.exists? parameters.save end confirmation get_budget_periods end |
#default_periods ⇒ Object
136 137 138 139 140 141 142 143 144 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 136 def default_periods open_budget on Parameters do |page| page.parameters unless page..parent.class_name=='tabright tabcurrent' page.default_periods end @budget_periods.clear get_budget_periods end |
#delete_period(number) ⇒ Object
82 83 84 85 86 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 82 def delete_period number @budget_periods.period(number).delete @budget_periods.delete(@budget_periods.period(number)) @budget_periods.number! end |
#edit(opts = {}) ⇒ Object
Please note, this method is for VERY basic editing… Use it for editing the Budget Version while on the Proposal, but not the Periods
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 90 def edit opts={} navigate on(BudgetVersions).open @name confirmation on Parameters do |edit| edit.final.fit opts[:final] edit.budget_status.fit opts[:status] edit.total_direct_cost_limit.fit opts[:total_direct_cost_limit] # TODO: More to add here... edit.save end (opts) end |
#edit_period(number, opts = {}) ⇒ Object
77 78 79 80 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 77 def edit_period number, opts={} @budget_periods.period(number).edit opts @budget_periods.number! end |
#open_budget ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/kuality-coeus/data_objects/budget/budget_versions.rb', line 104 def open_budget navigate on BudgetVersions do |page| page.open @name end #TODO: This needs to be dealt with more intelligently. # It's clear that we need to learn more about how to set up # sponsors better, so that we can predict when this dialog # will show up and when it won't... confirmation end |