Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to proper calendars #409

Merged
merged 2 commits into from
May 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/stylesheets/proper/service_calendars.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,5 @@ li:not(.ui-tabs-active)
width: 20px
height: 20px

.status_header
min-width: 50px
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- if @portal || !@review
- if (@sub_service_request.nil? ? @service_request.has_one_time_fee_services? : @sub_service_request.has_one_time_fee_services?) or @merged
%table.service_calendar{:class => @review ? 'review_totals' : ''}
%thead{:class => @review ? thead_class : 'default_calendar'}
= render :partial => "/service_calendars/master_calendar/otf_header"
%tbody.cell-border
= render :partial => "/service_calendars/master_calendar/otf_line_items", :locals =>{:current_request => @service_request}
- unless @study_tracker and !@merged
= render :partial => "/service_calendars/master_calendar/otf_totals", :locals =>{:current_request => @service_request}

- if (@sub_service_request.nil? ? @service_request.has_one_time_fee_services? : @sub_service_request.has_one_time_fee_services?) or @merged
%table.service_calendar{:class => @review ? 'review_totals' : ''}
%thead{:class => @review ? thead_class : 'default_calendar'}
= render :partial => "/service_calendars/master_calendar/otf_header"
%tbody.cell-border
= render :partial => "/service_calendars/master_calendar/otf_line_items", :locals =>{:current_request => @service_request}
- unless @study_tracker and !@merged
= render :partial => "/service_calendars/master_calendar/otf_totals", :locals =>{:current_request => @service_request}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%tr.table_header
%th{ rowspan: 2, style: @review ? '' : 'height: 88px', class: @review ? '' : 'services_header' }= t(:calendar_page)[:headers][:services]
%th{ rowspan: 2 }= t(:calendar_page)[:headers][:status]


- if @study_tracker && !@merged # display study tracker otf header
Expand All @@ -30,7 +31,7 @@


- elsif @review # display review otf header
%th{ rowspan: 2 }= t(:calendar_page)[:headers][:your_cost]
%th.your_cost_header= t(:calendar_page)[:headers][:your_cost]
%th{ colspan: 6 }
%th{ rowspan: 2 }= t(:calendar_page)[:headers][:total_per_study]

Expand All @@ -50,7 +51,7 @@
%span
= t(:calendar_page)[:headers][:qty_type]
= t(:calendar_page)[:headers][:number]
%th{ rowspan: 2, colspan: 5, height: 40, width: 250 }
%th{ rowspan: 2, colspan: 7, height: 40, width: 250 }
- if @merged
%th.total_per_study{ rowspan: 2 }= t(:calendar_page)[:headers][:total_per_study]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

%tr.section_header

- if @merged # display merged calendar otf line items
%th{ colspan: 13 }= t(:calendar_page)[:headers][:other_services]
%th{ colspan: 17 }= t(:calendar_page)[:headers][:other_services]

- @protocol.service_requests.each do |service_request|
- if %w('first_draft' 'draft').include?(service_request.status)
Expand All @@ -30,26 +29,24 @@
- service_request.service_list(true).each do |_, value| # get only one time fee services
- value[:line_items].each do |line_item|
%tr.line_item.otfs{ class: cycle('odd', '', name: 'otfs'), :"data-unit_factor" => line_item.service.displayed_pricing_map.unit_factor }
%td.service_name
= line_item.service.name
%td.service_name= line_item.service.name
%td.status= display_line_items_status(line_item)
- unless @portal || @study_tracker
%td.service_rate{ class: "service_rate_#{line_item.id}" }= display_service_rate line_item
%td.your_cost{ :"data-your_cost" => line_item.applicable_rate }= display_your_cost line_item
- unless @portal || @study_tracker
- if line_item.service.try(:displayed_pricing_map).otf_unit_type == 'N/A'
%td
%td
%td.units_per_quantity.center.width-50
%td.units_per_quantity.center.width-50{ colspan: 2 }
= line_item.quantity
%td= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
%td{ colspan: 2 }= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
- else
%td.line_item_quantity.center= line_item.units_per_quantity
%td= line_item.service.try(:displayed_pricing_map).try(:otf_unit_type).try(:humanize)
%td.units_per_quantity.center.width-50
%span.padding-right-5 /
= line_item.quantity
%td= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
%td{ colspan: (@portal || @study_tracker) ? 7 : 5 }
%td{ colspan: 7 }
%td{ class: "otf_total total_#{line_item.id}" }= display_one_time_fee_direct_cost line_item


Expand All @@ -59,10 +56,11 @@
- @service_request.service_list(true).each do |_, value| # get only one time fee services and group them
- next unless @sub_service_request.nil? || @sub_service_request.organization.name == value[:process_ssr_organization_name]
%tr.sub_section_header
%th{ colspan: 9 }= value[:name]
%th{ colspan: 12 }= value[:name]
- value[:line_items].each do |line_item|
%tr.line_item
%td.service_name= line_item.service.name
%td.status= display_line_items_status(line_item)
%td.your_cost= display_your_cost line_item
%td{ colspan: 6 }
%td= display_one_time_fee_direct_cost line_item
Expand Down Expand Up @@ -114,7 +112,7 @@


- else # display default calendar otf line items
%th{ colspan: 14 }
%th{ colspan: 16 }
= t(:calendar_page)[:headers][:other_services]

#nan_error
Expand All @@ -139,19 +137,18 @@
- @service_request.service_list(true).each do |_, value| # get only one time fee services and group them
- next unless @sub_service_request.nil? || @sub_service_request.organization.name == value[:process_ssr_organization_name]
%tr.sub_section_header
%th.otf{ colspan: (@study_tracker) ? 13 : 14 }= value[:name]
%th.otf{ colspan: (@study_tracker) ? 13 : 16 }= value[:name]
- value[:line_items].each do |line_item|
%tr.line_item.otfs{ class: cycle('odd', '', name: 'otfs'), :"data-unit_factor" => line_item.service.displayed_pricing_map.unit_factor }
%td.service_name
= line_item.service.name
- unless @tab == 'calendar'
= hidden_field_tag "service_request[line_items_attributes][#{line_item.id}][id]", line_item.id
%td.status= display_line_items_status(line_item)
%td.service_rate{ class: "service_rate_#{line_item.id}" }= display_service_rate line_item
%td.your_cost{ :"data-your_cost" => line_item.applicable_rate }= display_your_cost line_item
- if @tab == 'calendar'
- if line_item.service.try(:displayed_pricing_map).otf_unit_type == 'N/A'
%td
%td
%td.units_per_quantity.center.width-50
= line_item.quantity
%td= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
Expand All @@ -164,13 +161,11 @@
%td= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
- else
- if line_item.service.try(:displayed_pricing_map).otf_unit_type == 'N/A'
%td= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
%td.width-50
%td{ colspan: 2 }= line_item.service.try(:displayed_pricing_map).try(:quantity_type).try(:humanize)
%td.width-50{ colspan: 2 }
= text_field_tag "service_request[line_items_attributes][#{line_item.id}][quantity]", line_item.quantity, |
unit_minimum: line_item.service.displayed_pricing_map.quantity_minimum, units_per_qty_max: line_item.service.displayed_pricing_map.units_per_qty_max, class: 'line_item_quantity', current_quantity: line_item.quantity, previous_quantity: line_item.quantity, |
update: update_otf_qty_and_units_per_qty_service_request_service_calendars_path(@service_request, line_item_id: line_item.id, type: 'qty') |
%td
%td
- else
%td{ colspan: 2 }
%span
Expand All @@ -184,5 +179,5 @@
= text_field_tag "service_request[line_items_attributes][#{line_item.id}][quantity]", line_item.quantity, |
unit_minimum: line_item.service.displayed_pricing_map.quantity_minimum, class: 'line_item_quantity', current_quantity: line_item.quantity, previous_quantity: line_item.quantity, |
update: update_otf_qty_and_units_per_qty_service_request_service_calendars_path(@service_request, line_item_id: line_item.id, type: 'qty') |
%td{ colspan: 5 }
%td{ colspan: 7 }
%td{ class: "otf_total total_#{line_item.id}" }= display_one_time_fee_direct_cost line_item
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
- unless @review
- if @merged #display merged calendar otf totals
%tr.totals_section.grand-totals{:class => cycle('odd', '', :name => 'otfs')}
%td{:colspan => 3}= t(:calendar_page)[:labels][:total_costs_other]
%td{:colspan => (@portal or @study_tracker) ? 6 : 9}
%td{:colspan => 15}= t(:calendar_page)[:labels][:total_costs_other]
%td.otf_total_direct_cost= display_protocol_total_otfs @protocol, current_request, @portal


Expand All @@ -46,8 +45,7 @@

- else #display default calendar otf totals
%tr.totals_section.begin_totals{:class => cycle('odd', '', :name => 'otfs')}
%td{:colspan => 5}= t(:calendar_page)[:labels][:total_direct_other]
%td{:colspan => 7}
%td{:colspan => 15}= t(:calendar_page)[:labels][:total_direct_other]
%td.otf_total_direct_cost= display_total_direct_cost_per_study_otfs @service_request, (@line_items.nil? ? @service_request.line_items : @line_items)
- if @study_tracker
%td
%td
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%tr.table_header
%th.services_header{:rowspan => 2}= t(:calendar_page)[:headers][:services]
%th.status_header{ rowspan: 2 }= t(:calendar_page)[:headers][:status]


- if @review #display review calendar pppv header
%th{:rowspan => 2}= t(:calendar_page)[:headers][:status]
%th.your_cost_header{:rowspan => 2}= t(:calendar_page)[:headers][:your_cost]
%th.number_of_subjects_header{:rowspan => 2}= t(:calendar_page)[:headers][:subjects]
%th{:colspan => 5, :height => 40, :width => 375}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- line_items_visits = []
%tr.section_header
%th{:colspan => (@portal and !@merged) ? 11 : 13}= t(:calendar_page)[:per_patient] + " -- " + arm.name
- unless @merged || (@tab == 'billing_strategy') || (@tab == 'quantity') || (@review)
%th{:colspan => @merged ? 15 : 13}= t(:calendar_page)[:per_patient] + " -- " + arm.name
- unless @merged || (@review)
%th{:colspan => 3}

- if @merged #display merged calendar pppv line items
Expand All @@ -34,6 +34,7 @@
- line_items_visits << line_items_visit
%tr.line_item{:class => cycle('odd', '', :name => 'pppvs')}
%td.service_name= line_item.service.display_service_name
%td.status= display_line_items_status(line_item)
- unless @portal
%td.service_rate{:class => "service_rate_#{line_items_visit.id}"}= display_service_rate line_item
%td.your_cost= display_your_cost line_item
Expand Down Expand Up @@ -79,25 +80,24 @@
- next unless @sub_service_request.nil? or @sub_service_request.organization.name == value[:process_ssr_organization_name]
- if @tab == 'billing_strategy'
%tr.sub_section_header
%th{:colspan => @portal ? 3 : 5}= value[:name]
%th{:colspan => @portal ? 3 : 6}= value[:name]
- if @portal
%th{:colspan => 1}
%th
-5.times do
%th.billing_type_list{:style => "text-align:center"}
%span.billing_type R
%span.billing_type T
%span.billing_type %
- unless @portal
%th &nbsp;
%th &nbsp;
%th{ colspan: 5 } &nbsp;
- else
%tr.sub_section_header
- if @portal
%th{:colspan => 11}= value[:name]
- elsif @tab == 'quantity'
%th{:colspan => 16}= value[:name]
- else
%th{:colspan => 13}= value[:name]
- unless (@tab == 'quantity')
%th
%th{:colspan => 14}= value[:name]
%th{ colspan: 2 }

- arm.line_items_visits.each do |line_items_visit|
- line_item = line_items_visit.line_item
Expand All @@ -120,6 +120,7 @@
= text_field_tag 'line_item_displayed_cost', number_with_precision(Service.cents_to_dollars(line_item.applicable_rate), :precision => 2), :'data-line_item_id' => line_item.id, :class => 'fulfillment_data fulfillment_your_cost'
- else
%td.service_name= line_item.service.display_service_name
%td.status= display_line_items_status(line_item)
%td.service_rate{:class => "service_rate_#{line_items_visit.id}"}= display_service_rate line_item
%td.your_cost= display_your_cost line_item
%td.unit_type= pricing_map.unit_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

- if @merged || !@portal
- colspan = (@merged and @portal) ? 4 : 5
- colspan = (@merged and @portal) ? 4 : 6
%tr.totals_section.begin_totals{:class => cycle('odd', '', :name => 'pppvs')}
%td{:colspan => colspan}= t(:calendar_page)[:labels][:maximum_direct]
- unless @merged || @tab != 'template'
Expand Down Expand Up @@ -53,4 +53,7 @@
-unless @merged || @tab != 'template'
%td{:colspan => 2} &nbsp;
%td{:colspan => 6}
%td{:class => "pp_total arm_#{arm.id}"}= display_total_cost_per_arm arm, line_items_visits
- if @tab == 'billing_strategy' || @tab == 'quantity'
%td{:colspan => 2, :class => "pp_total arm_#{arm.id}"}= display_total_cost_per_arm arm, line_items_visits
- else
%td{:class => "pp_total arm_#{arm.id}"}= display_total_cost_per_arm arm, line_items_visits
53 changes: 15 additions & 38 deletions app/views/service_requests/review/_review_totals.html.haml
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
- if @review
%table.service_calendar.review_totals
- if (@sub_service_request.nil? ? @service_request.has_one_time_fee_services? : @sub_service_request.has_one_time_fee_services?)
%thead{:class => thead_class}
%tr.table_header
%th{:rowspan => 2}= t(:sr_review)[:calendar][:headers][:services]
%th{:rowspan => 2}= t(:sr_review)[:calendar][:headers][:cost]
%th{:colspan => 6}
%th{:rowspan => 2}= t(:sr_review)[:calendar][:headers][:total_per_study]
%tbody.cell-border
- if (@sub_service_request.nil? ? @service_request.has_one_time_fee_services? : @sub_service_request.has_one_time_fee_services?)
%tr.section_header
%th{:colspan => @portal ? 11 : 12}= t("calendar_page.headers.other_services")
- @service_request.service_list(true).each do |key, value| # get only one time fee services and group them
- next unless @sub_service_request.nil? or @sub_service_request.organization.name == value[:process_ssr_organization_name]
%tr.sub_section_header
%th{:colspan => 9}= value[:name]
- value[:line_items].each do |line_item|
%tr.line_item
%td.service_name= line_item.service.name
%td.your_cost= display_your_cost line_item
%td{:colspan => 6}
%td= display_one_time_fee_direct_cost line_item
%table.service_calendar.review_totals
%tr.section_header
%tr.totals_section
%td{:colspan => 7}
%td.total_cell= t(:sr_review)[:calendar][:totals][:direct_cost]
%td.total_cell{:id => 'grand_total_direct'}= display_grand_total_direct_costs @service_request, @line_items

%tr.section_header
%tr.totals_section
%td{:colspan => 7}
%td.total_cell= t(:sr_review)[:calendar][:totals][:direct_cost]
%td.total_cell{:id => 'grand_total_direct'}= display_grand_total_direct_costs @service_request, @line_items
- if USE_INDIRECT_COST
%tr.totals_section
%td{:colspan => 7}
%td.total_cell= t(:sr_review)[:calendar][:totals][:indirect_cost]
%td.total_cell{:id => 'grand_total_indirect'}= display_grand_total_indirect_costs @service_request, @line_items

- if USE_INDIRECT_COST
%tr.totals_section
%td{:colspan => 7}
%td.total_cell= t(:sr_review)[:calendar][:totals][:indirect_cost]
%td.total_cell{:id => 'grand_total_indirect'}= display_grand_total_indirect_costs @service_request, @line_items

%tr.totals_section
%td{:colspan => 7}
%td.total_cell= t(:sr_review)[:calendar][:totals][:grand]
%td.total_cell{:id => 'grand_total'}= display_grand_total @service_request, @line_items
%tr.totals_section
%td{:colspan => 7}
%td.total_cell= t(:sr_review)[:calendar][:totals][:grand]
%td.total_cell{:id => 'grand_total'}= display_grand_total @service_request, @line_items