Changed invoice_select_form and CustomersNInvoicesX to actually set task invoice comments
This commit is contained in:
parent
e53374a713
commit
194b0033d1
2 changed files with 26 additions and 8 deletions
33
stoptime.rb
33
stoptime.rb
|
@ -786,13 +786,17 @@ module StopTime::Controllers
|
||||||
task.time_entries = task.time_entries - tasks[task]
|
task.time_entries = task.time_entries - tasks[task]
|
||||||
task.save
|
task.save
|
||||||
bill_task.time_entries = tasks[task]
|
bill_task.time_entries = tasks[task]
|
||||||
|
bill_task.invoice_comment = @input["task_#{task.id}_comment"]
|
||||||
bill_task.save
|
bill_task.save
|
||||||
invoice.tasks << bill_task
|
invoice.tasks << bill_task
|
||||||
end
|
end
|
||||||
|
|
||||||
# Then, handle the fixed cost tasks.
|
# Then, handle the fixed cost tasks.
|
||||||
@input["tasks"].each do |task|
|
@input["tasks"].each do |task|
|
||||||
invoice.tasks << Task.find(task)
|
task = Task.find(task)
|
||||||
|
task.invoice_comment = @input["task_#{task.id}_comment"]
|
||||||
|
task.save
|
||||||
|
invoice.tasks << task
|
||||||
end unless @input["tasks"].blank?
|
end unless @input["tasks"].blank?
|
||||||
invoice.save
|
invoice.save
|
||||||
|
|
||||||
|
@ -1603,9 +1607,10 @@ module StopTime::Views
|
||||||
# Form for selecting fixed cost tasks and registered time for tasks with
|
# Form for selecting fixed cost tasks and registered time for tasks with
|
||||||
# an hourly rate that need to be billed.
|
# an hourly rate that need to be billed.
|
||||||
def invoice_select_form
|
def invoice_select_form
|
||||||
form :action => R(CustomersNInvoices, @customer.id), :method => :post do
|
|
||||||
unless @hourly_rate_tasks.empty?
|
|
||||||
h2 "Registered Time"
|
h2 "Registered Time"
|
||||||
|
form :action => R(CustomersNInvoices, @customer.id), :method => :post do
|
||||||
|
h3 "Projects/Tasks with an Hourly Rate"
|
||||||
|
unless @hourly_rate_tasks.empty?
|
||||||
table.invoice_select do
|
table.invoice_select do
|
||||||
col.flag {}
|
col.flag {}
|
||||||
col.date {}
|
col.date {}
|
||||||
|
@ -1626,11 +1631,15 @@ module StopTime::Views
|
||||||
@hourly_rate_tasks.keys.each do |task|
|
@hourly_rate_tasks.keys.each do |task|
|
||||||
tr.task do
|
tr.task do
|
||||||
td { _form_input_checkbox("tasks[]", task.id) }
|
td { _form_input_checkbox("tasks[]", task.id) }
|
||||||
td task.name, :colspan => 6
|
td task.name, :colspan => 3
|
||||||
|
td do
|
||||||
|
input :type => :text, :name => "task_#{task.id}_comment",
|
||||||
|
:id => "tasks_#{task.id}_comment", :value => task.name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@hourly_rate_tasks[task].each do |entry|
|
@hourly_rate_tasks[task].each do |entry|
|
||||||
tr do
|
tr do
|
||||||
td { _form_input_checkbox("time_entries[]", entry.id) }
|
td.indent { _form_input_checkbox("time_entries[]", entry.id) }
|
||||||
td { label entry.date.to_date,
|
td { label entry.date.to_date,
|
||||||
:for => "time_entries[]_#{entry.id}" }
|
:for => "time_entries[]_#{entry.id}" }
|
||||||
td { entry.start.to_formatted_s(:time_only) }
|
td { entry.start.to_formatted_s(:time_only) }
|
||||||
|
@ -1645,22 +1654,28 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @fixed_cost_tasks.empty?
|
unless @fixed_cost_tasks.empty?
|
||||||
h2 "Fixed Cost Projects/Tasks"
|
h3 "Fixed Cost Projects/Tasks"
|
||||||
table.tasks do
|
table.tasks do
|
||||||
col.flag {}
|
col.flag {}
|
||||||
col.task {}
|
col.task {}
|
||||||
|
col.comment {}
|
||||||
col.hours {}
|
col.hours {}
|
||||||
col.amount {}
|
col.amount {}
|
||||||
tr do
|
tr do
|
||||||
th ""
|
th "Bill?"
|
||||||
th "Project/Task"
|
th "Project/Task"
|
||||||
th "Registered time"
|
th "Comment"
|
||||||
th "Amount"
|
th.right "Registered time"
|
||||||
|
th.right "Amount"
|
||||||
end
|
end
|
||||||
@fixed_cost_tasks.keys.each do |task|
|
@fixed_cost_tasks.keys.each do |task|
|
||||||
tr do
|
tr do
|
||||||
td { _form_input_checkbox("tasks[]", task.id) }
|
td { _form_input_checkbox("tasks[]", task.id) }
|
||||||
td { label task.name, :for => "tasks[]_#{task.id}" }
|
td { label task.name, :for => "tasks[]_#{task.id}" }
|
||||||
|
td do
|
||||||
|
input :type => :text, :name => "task_#{task.id}_comment",
|
||||||
|
:id => "tasks_#{task.id}_comment", :value => task.name
|
||||||
|
end
|
||||||
td.right { "%.2fh" % @fixed_cost_tasks[task] }
|
td.right { "%.2fh" % @fixed_cost_tasks[task] }
|
||||||
td.right { task.fixed_cost }
|
td.right { task.fixed_cost }
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,9 @@ $dark-red: #990000
|
||||||
.billed
|
.billed
|
||||||
text-decoration: line-through
|
text-decoration: line-through
|
||||||
|
|
||||||
|
.indent
|
||||||
|
padding-left: 20px
|
||||||
|
|
||||||
/* Basic elements */
|
/* Basic elements */
|
||||||
a
|
a
|
||||||
text-decoration: none
|
text-decoration: none
|
||||||
|
|
Loading…
Reference in a new issue