Skip to content

Instantly share code, notes, and snippets.

@nickmc
Created May 9, 2011 21:27
Show Gist options
  • Select an option

  • Save nickmc/963453 to your computer and use it in GitHub Desktop.

Select an option

Save nickmc/963453 to your computer and use it in GitHub Desktop.
= render :partial => 'project_heading', :locals => { :project => @project }
- popuparray = ['new_window_name', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,height=600,width=800']
= link_to 'View wiki page', 'http://wiki.askhelios.com/index.php/' + @project.number, :popup => popuparray
%h2 Overview
%p
%span.lbl
%b Project Manager
= format_name @project.manager
%p
%span.lbl
%b Project Director
= format_name @project.director
%p
%span.lbl
%b Bid Manager
= format_name @project.bid_manager
%p
%span.lbl
%b Bid Director
= format_name @project.bid_director
%p
%span.lbl
%b Service team
= @project.service_team.name
%p
%span.lbl
%b Account
= @project.account.name
%p
%span.lbl
%b Date opened
= format_date @project.date_opened
%p
%span.lbl
%b Date closed
= format_date @project.date_closed
%p
%span.lbl
%b Customer
= format_string @project.customer
 
%p
%span.lbl
%b Customer reference
= format_string @project.customer_reference
 
%p
%span.lbl
%b Notes
.notes
= format_string @project.notes
= link_to 'Edit these fields', :controller => 'projects', :action => 'edit', :id => @project
%br
%h2 Totals
%table
%thead
%tr
%td.l500 Type
%td.c100 Value
%td.c100 Subco value
%td.c100 Fee value
%tbody
%tr
%td.l500 Contracts
%td.c100= format_price @project.contracted_total
%td.c100= format_price @project.subcontracted_total
%td.c100= format_price @project.contracted_fee_total
%tr
%td.l500 Milestone invoices
%td.c100= format_price @project.milestone_invoice_total
%td.c100= format_price @project.subco_milestone_invoice_total
%td.c100= format_price @project.milestone_invoice_fee_total
%table
%thead
%tr
%td.l500 Type
%td.c100 Value
%tbody
%tr
%td.l500 Total value of recoverable expenses budgets
%td.c100= format_price @project.recoverable_expenses_total
%tr
%td.l500 Total value of all recoverable expenses invoiced to customer
%td.c100= format_price @project.recoverable_expense_invoice_total
%h2 Contracts
%table
%thead
%tr
%td.c100 Number
%td.c100 Status
%td.c100 Probability
%td.c100 Start date
%td.c100 End date
%td.r100 Value
%td.r100 Subco value
%td.c100 Action
- @project.contracts.each do |contract|
%tr
%td.c100= link_to "#{contract.number} - Edit", :controller => 'contracts', :action => 'edit', :id => contract
%td.c100= contract.status_name
%td.c100= contract.display_probability
%td.c100= format_date contract.start_date
%td.c100= format_date contract.end_date
%td.r100
= format_price contract.value_in_sterling
= "("+ format_price(contract.value_in_currency, {:unit => contract.currency.display_symbol} )+ ")" if contract.currency.name != "GBP"
%td.r100= link_to "#{format_price(contract.subcontract_total)}", :controller => 'subcontracts', :action => 'list', :id => contract
%td.c100
- if contract.tasks.count > 0
Cannot delete while tasks exist
- else
= button_to 'delete', {:controller => 'contracts', :action => 'destroy', :id => contract }, |
:confirm => 'Are you sure?', |
:method => :delete, |
:class => 'delete_button' |
= link_to 'Add contract', :controller => 'contracts', :action => 'new', :id => @project
%br
%h1 Invoices
%h2 Milestone invoices
- if @project.invoices.milestone.size > 0
%table.sortable
%thead
%tr
%td.l450 Description
%td.c100 Date
%td.sorttable_numeric Amount
%td.c100 Status
%td.c175.sorttable_nosort Action
%tbody
- @project.invoices.milestone.each do |mi|
%tr
%td.l450
- if mi.status == "Planned" || current_user.is_admin?
= link_to "#{format_invoice_description( mi )}", :controller => 'invoices', :action => 'edit', :id => mi
- else
= format_invoice_description mi
%td.c100= format_date mi.date
%td.r100
= format_price mi.amount_in_sterling
= "(" + format_price(mi.amount_in_currency, {:unit => mi.currency.display_symbol}) + ")" if mi.currency.name != "GBP"
%td.c100= mi.status
%td.c175
- if mi.status == "Planned" then
= button_to 'delete', { :controller => 'invoices', :action => 'destroy', :id => mi, :redirect_to => { :controller => 'projects', :action => 'show', :id => @project } }, |
:confirm => 'Are you sure?', |
:method => :delete, |
:class => 'delete_button' |
- else
- if current_user.is_admin? then
= button_to 'delete', { :controller => 'invoices', :action => 'destroy', :id => mi, :redirect_to => { :controller => 'projects', :action => 'show', :id => @project } }, |
:confirm => 'This is an MYOB imported invoice, are you sure?', |
:method => :delete, |
:class => 'delete_button' |
= "imported (ref:#{mi.myob_id})"
- else
%p (No milestone invoices to display)
= link_to 'Add milestone invoice', :controller => 'invoices', :action => 'new_sales', :id => @project
%h2 Subcontractor milestone invoices
- if @project.invoices.subco_milestone.size > 0
%table.sortable
%thead
%tr
%td.l450 Description
%td.c100 Date
%td.sorttable_numeric Amount
%td.c100 Status
%td.c175.sorttable_nosort Action
%tbody
- @project.invoices.subco_milestone.each do |smi|
%tr
%td.l280
- if smi.status == "Planned" || current_user.is_admin?
= link_to "#{format_invoice_description( smi )}", :controller => 'invoices', :action => 'edit', :id => smi
- else
= format_invoice_description smi
%td.c100= format_date smi.date
%td.r100
= format_price(smi.amount_in_sterling)
= "(" + format_price(smi.amount_in_currency, {:unit => smi.currency.display_symbol}) + ")" if smi.currency.name != "GBP"
%td.c100= smi.status
%td.c175
- if smi.status == "Planned" then
= button_to 'delete', { :controller => 'invoices', :action => 'destroy', :id => smi, :redirect_to => { :controller => 'projects', :action => 'show', :id => @project } }, |
:confirm => 'Are you sure?', |
:method => :delete, |
:class => 'delete_button' |
- else
- if current_user.is_admin? then
= button_to 'delete', { :controller => 'invoices', :action => 'destroy', :id => smi, :redirect_to => { :controller => 'projects', :action => 'show', :id => @project } }, |
:confirm => 'This is an MYOB imported invoice, are you sure?', |
:method => :delete, |
:class => 'delete_button' |
= "imported (ref:#{smi.myob_id})"
- else
%p (No subcontractor milestone invoices to display)
= link_to 'Add subcontractor milestone invoice', :controller => 'invoices', :action => 'new_purchase', :id => @project
%h2 Recoverable expense invoices
- if @project.invoices.recoverable_expenses.size > 0
%table.sortable
%thead
%tr
%td.l450 Description
%td.c100 Date
%td.sorttable_numeric Amount
%td.c100 Status
%td.c175.sorttable_nosort Action
%tbody
- @project.invoices.recoverable_expenses.each do |re|
%tr
%td.l450
- if re.status == "Planned" || current_user.is_admin? then
= link_to "#{format_invoice_description( re )}", :controller => 'invoices', :action => 'edit', :id => re
- else
= format_invoice_description re
%td.c100= format_date re.date
%td.r100= format_price re.amount_in_sterling
%td.c100= re.status
%td.c175
- if re.status == "Planned" then
= button_to 'delete', { :controller => 'invoices', :action => 'destroy', :id => re }, |
:confirm => 'Are you sure?', |
:method => :delete, |
:class => 'delete_button' |
- else
- if current_user.is_admin? then
= button_to 'delete', { :controller => 'invoices', :action => 'destroy', :id => re, :redirect_to => { :controller => 'projects', :action => 'show', :id => @project } }, |
:confirm => 'This is an MYOB imported invoice, are you sure?', |
:method => :delete, |
:class => 'delete_button' |
= "imported (ref:#{re.myob_id})"
- else
%p (No recoverable expense invoices to display)
%br
= link_to 'Create a new project', :action => 'new'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment