Added support for marking time entries as 'to bill'.

This commit is contained in:
Paul van Tilburg 2011-11-03 23:07:42 +01:00
parent 8f2eff9410
commit b5609956b8
2 changed files with 24 additions and 3 deletions

2
TODO
View File

@ -1,8 +1,6 @@
ToDo
====
* handmatige entries (gekocht item/opdrachtbasis) op factuur
* factureervlag per entry
* factuur vastleggen, met samenvatting commentaar
* uurtarief per project (inherit klant)
* (configureerbare) factuurnummering (op jaarbasis)

View File

@ -118,6 +118,16 @@ module StopTime::Models
end
end
class BilledFlagSupport < V 1.2
def self.up
add_column(TimeEntry.table_name, :bill, :boolean)
end
def self.down
remove_column(TimeEntry.table_name, :bill)
end
end
end # StopTime::Models
module StopTime::Controllers
@ -257,7 +267,8 @@ module StopTime::Controllers
:task_id => @input.task,
:start => @input.start,
:end => @input.end,
:comment => @input.comment)
:comment => @input.comment,
:bill => @input.has_key?("bill"))
@entry.save
if @entry.invalid?
@errors = @entry.errors
@ -347,6 +358,7 @@ module StopTime::Views
th "End time"
th "Comment"
th "Total time"
th "Bill?"
end
form :action => R(Timereg), :method => :post do
tr do
@ -358,6 +370,8 @@ module StopTime::Views
:value => DateTime.now.to_date.to_formatted_s + " " }
td { input :type => :text, :name => "comment" }
td { "N/A" }
td { input :type => :checkbox, :name => "bill",
:checked => "checked" }
td do
input :type => :submit, :name => "enter", :value => "Enter"
input :type => :reset, :name => "clear", :value => "Clear"
@ -372,6 +386,15 @@ module StopTime::Views
td { entry.end }
td { entry.comment }
td { "%.2fh" % ((entry.end - entry.start)/3600.0) }
td do
if entry.bill?
input :type => :checkbox, :name => "bill",
:checked => "checked", :disabled => "disabled"
else
input :type => :checkbox, :name => "bill",
:disabled => "disabled"
end
end
td do
form :action => R(TimeregN, entry.id), :method => :post do
input :type => :submit, :name => "delete", :value => "Delete"