As an independent contractor, I find that one of the most banal tasks required of me on a daily basis is the submission of my time entries. If you work as a contractor, then you know the drill: You’ve just finished some huge milestone. Everything works as expected even after rigorous testing. Time to go out and celebrate! Not quite yet. First you have to submit the time that you’ve spent that day working on it to the powers that be (ie: the nice folks who pay you). I suppose everyone has their own way of keeping track of their hours and of submitting them, but no matter what your way is, it’s probably not very much fun.

With this in mind, I’ve written a drupal module called ‘Hours’. The module creates a new content type called ‘hours’ which consists of all the usual node parts, plus a time entry, a date, and a client (those last three stored in a separate table and linked to node via an nid). Once an ‘hours’ node is created, the creating user has the option to ‘submit’ either just that node, or all non submitted ‘hours’ nodes that they’ve created. When the ‘hours’ node is “submitted”, its node id and a timestamp representing the time it was submitted is copied into a third table, and the ‘hours’ node is now available to an administrator to see in a nicely themed format.

 

 

There’s a settings page for admins where they can choose to alerted via email when new hours are submitted. I should mention however that I don’t really have a great way of testing this, so use it cautiously…

 

The other cool thing is that there’s an additional module that comes with the ‘hours’ package called ‘Invoice’. Invoice takes the data entered as ‘hours’ nodes and builds invoices from them. As you can see from the previous screen shot, there’s a link (if the invoice module is installed) on the hours user listing page to view the invoices of any user. Here’s what that looks like:

 

As you can see, there is a form there for filing the invoice away as paid. The invoice nodes themselves consist of all the usual node fields plus a start and end date. Once a user creates an invoice they can view the invoice at any time before or after actually submitting it. This way they can see how much money they’ll be owed at invoice time. Once ready to send the invoice, just click the ‘Submit Invoice’ tab for that invoice and it’s now visible in the invoice list to admins.

The invoice has a settings page where the user can set the ‘From’ and ‘To’ fields, the hourly pay rate and the currency symbol:

 

These fields are substituted in for the final invoice. Here’s mine:

 

There’s a version of the module on drupal.org at http://drupal.org/project/hours. It still needs some work (specifically on the UI front), and hasn’t been tested as well as I would like, so the release is tagged as beta. If you find any bugs, just put them in queue. If anyone has any suggestions for better/different features, and if they’d like to help out please let me know! Thanks, aj