<%= render :partial => 'title', :locals => {:contract => resource} %> <% if resource.orphaned_time && resource.orphaned_time > 0 %>

<%= l(:text_error_message_orphaned_time, :amount => format_value_field_for_contracts(resource.orphaned_time, :unit => '$')) %> <%= link_to_issue_list_with_filter(l(:text_error_message_update_orphaned_time), :deliverable_id => '!*') %>

<% end %> <% div_for(resource) do %> <%= avatar(resource.account_executive, :size => 40) %>
<%= show_field(resource, :status, :html_options => {:class => 'contract-status'}) %> <%= show_field(resource, :account_executive, :html_options => {:class => 'contract-account-manager'}) %> <%# show_field(resource, :contract_type, :html_options => {:class => 'contract-type'}) %>
<%= release(5, "Contract type") %>
<%= show_field(resource, :start_date, :format => :format_date, :html_options => {:class => 'contract-start-date'}) %> <%= show_field(resource, :end_date, :format => :format_date, :html_options => {:class => 'contract-end-date'}) %>
<%= show_budget_field(resource, :labor_spent, :labor_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '49%'}) %> <%= show_budget_field(resource, :overhead_spent, :overhead_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-overhead'}) %> <%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %>
<%= l(:text_terms_and_financial_overview) %>
<%= show_field(resource, :client_point_of_contact, :format => :textilizable, :raw => true, :html_options => {:class => 'contract-client-point-of-contact padd wiki'}, :label_html_options => {:width => '25%'}) %> <%= show_field(resource, :executed, :format => :format_as_yes_or_no, :html_options => {:class => 'contract-executed'}) %> <%= show_field(resource, :discount_note, :format => :textilizable, :raw => true, :html_options => {:class => 'contract-discount-note wiki'}) %> <%= show_field(resource, :payment_term, :format => :format_payment_terms, :html_options => {:class => 'contract-payment-terms'}) %> <%= show_field(resource, :client_ap_contact_information, :format => :textilizable, :raw => true, :html_options => {:class => 'contract-client-ap-contact-information wiki'}) %> <%= show_field(resource, :po_number, :html_options => {:class => 'contract-po-number'}) %> <%= show_field(resource, :details, :format => :textilizable, :raw => true, :html_options => {:class => 'contract-details wiki'}) %>
<%= show_budget_field(resource, :labor_spent, :labor_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '46%'}) %> <%= show_budget_field(resource, :overhead_spent, :overhead_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-overhead'}) %> <%= show_budget_field(resource, :fixed_spent, :fixed_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-fixed'}) %> <% if show_markup_for?(resource) %> <%= show_budget_field(resource, :fixed_markup_spent, :fixed_markup_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-markup'}) %> <% end %> <%= show_budget_field(resource, :profit_spent, :profit_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-profit'}) %> <%# show_budget_field(resource, :discount_spent, :discount_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-discount'}) %> <%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %> <%= show_budget_field(resource, :billable_rate, 'nil?', :format => :format_hourly_rate, :html_options => {:class => 'contract-billable-rate total'}) %> <%= show_budget_field(resource, :labor_hour_spent, :labor_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-labor-hour'}) %> <%= show_budget_field(resource, :overhead_hour_spent, :overhead_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-overhead-hour'}) %> <%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-total-hour total'}) %>
<%= release(4, "Discount") %>
<%= content_tag(:h3, l(:field_deliverable_plural)) %>
<%= release(2, "CSV") %> <%= release(5, "View All/Pagination") %> <%= link_to(l(:button_add_new), new_contract_deliverable_path(@project, resource), :id => 'new-deliverable') if resource.open? %>
<% if resource.deliverables.empty? %>

<%= l(:label_no_data) %>

<% else %> <% resource.deliverables.each do |deliverable| %> <% content_tag_for(:tr, deliverable, :class => 'click ' + cycle('even','')) do %> <%= format_budget_for_deliverable(deliverable, deliverable.labor_budget_spent, deliverable.labor_budget_total, :class => 'labor') %> <%= format_budget_for_deliverable(deliverable, deliverable.overhead_spent, deliverable.overhead_budget_total, :class => 'overhead') %> <%= format_budget_for_deliverable(deliverable, deliverable.fixed_budget_total_spent, deliverable.fixed_budget_total, :class => 'fixed') %> <%= format_budget_for_deliverable(deliverable, deliverable.total_spent, deliverable.total, :class => 'total') %> <% end %> <%= render :partial => 'deliverables/details_row', :locals => {:deliverable => deliverable, :contract => resource, :period => deliverable.current_date} %> <% end %>
<%= l(:field_end_date) %>   <%= l(:field_title) %> <%= l(:field_status) %> <%= l(:field_manager) %> <%= l(:field_labor) %> <%= l(:field_overhead) %> <%= l(:field_fixed) %> <%= l(:field_total) %>
<%= h format_date(deliverable.end_date) %> <%= h deliverable.short_type %> <%= h deliverable.title %> <%= h deliverable.status %> <%= h deliverable.manager.try(:name) %>
<% end %>
<% end %> <%# div_for(resource) %>

<%= release(4, "Milestones") %>

<%= release(3, "history") %>

<% html_title "#{l(:text_contracts)} - #{h(resource.name)}" %>