Ranking your success
I found a good quote for all people who worry that they are not good enough to run a successful business.
Your success is never relative to someone else’s, because there’s always someone who’s making more, running faster, driving harder. Your success is a function of exceeding your life goals, which are uniquely yours.
– by Alan Weiss, PhD in Getting Started in Consulting
Are you a Technician or an Entrepreneur?
I just read a great post by Shane Pearlman titled The Technician and the Entrepreneur. In it he describes two different types of independent contractors, the Technician and the Entrepreneur. It gives a great overview to what happens to independent contractors as they become successful and start to question what they are really doing in business.
At Little Stream Software I am still very much the Technician but I am looking at ways to move to become an Entrepreneur.
Eric
Customizing Bamboo Invoice
In a previous entry, I wrote about using Bamboo Invoice to create and mange the invoicing for my small software company. Now I want to walk through customizing the invoice to include some extra things.
The Problem
The base invoice is nice, but I really want to have the invoice due date printed on the invoice. Sure the default invoice has the payment terms and the invoice date but I did not want my customers to have to guess when their payment was due. What would be great is if there was a line on the invoice that said "Due" and had a date based off of the payment terms I already set.
Getting the Date
Luckily, all of the data needed to display the due date is already included with Bamboo Invoice. All I need to do is to display it. Bamboo Invoice uses two files to display the invoice, view.php and pdf.php. Both of these files are pretty similar, one shows an HTML version of the invoice and the other shows a PDF version.
First I need to get the date the invoice was created and then add in the number of days from the payment terms. Since the views each have an invoice object called $row I can just access the attribute dateIssued to get when the invoice was created.
$row->dateIssued
This data is stored as a MYSQL DATE field so I needed to convert it back into a unix date and time in order to display it. Bamboo Invoice provides a useful function mysql_to_unix that does this exact thing.
mysql_to_unix($row->dateIssued)
The next step I had to do was to format the Due Date in a human readable format, such as August 16, 2007 and not as the unix time of '1187308680'. To do this I hacked some date conversions using the PHP date and mktime functions.
<?php echo date("F d, Y", mktime(0,0,0,
date("m",mysql_to_unix($row->dateIssued)),
date("d",mysql_to_unix($row->dateIssued)),
date("Y",mysql_to_unix($row->dateIssued))));
?>
Basically this is taking the Month (date "m"), Day (date "d"), and Year (date "Y") of the invoice and creating a new date in unix time but formatted as "Month day, four digit year". Now some PHP hacker might ask why am I converting the date from unix to a number and back to unix again instead of just using the date from mysql_to_unix like so:
echo date("F d, Y", mysql_to_unix($row->dateIssued));
The reason is we need to now add in the number of days that a payment is due in. By converting the unix time to an integer we can easily add in our days, which are stored as an integer in Bamboo Invoice.
<?php echo date("F d, Y", mktime(0,0,0,
date("m",mysql_to_unix($row->dateIssued)),
date("d",mysql_to_unix($row->dateIssued)) + $this->settings_model->getSetting('daysPaymentDue'),
date("Y",mysql_to_unix($row->dateIssued))));
?>
Now we just need to add some pretty HTML and we have a nice snippet to show the due date.
<p><strong>Due:
<?php echo date("F d, Y", mktime(0,0,0,
date("m",mysql_to_unix($row->dateIssued)),
date("d",mysql_to_unix($row->dateIssued)) + $this->settings_model->getSetting('daysPaymentDue'),
date("Y",mysql_to_unix($row->dateIssued))));?>
</strong></p>
Since we want this to be included in both the HTML and PDF versions, it would be best to extract this snippet into a separate file to include into the view files. This will also make upgrade easier because we are not putting as much logic in the source files distributed by the Bamboo Invoice team. If you save this snippet into a file in the bamboo_system_files/application/views/includes/ directory you will have an easy way to add this to each view. I named mine eric-add-due-date.inc.php.
HTML View
The HTML view file is called bamboo_system_files/application/views/invoices/view.php. Open this file and look for a good place that you want to display your due date, I chose to put mine right under the Payment Terms. Since we setup the code in an include file all we have to add to this is the line:
<?php $this->load->view('includes/eric-add-due-date.inc.php'); ?>
Now we should have a Due Date on our invoices in the web browser.
PDF View
The last step is to modify the PDF view. This process is exactly like the HTML view but using the file bamboo_system_files/application/views/invoices/pdf.php.
Conclusion
We have now added a simple Due Date calculation to our invoices for Bamboo Invoices. Although it was simple, there are a lot of other things we can now do this these simple concepts.

Another customization I added to my invoices is a link to an online form that will display the amount and invoice number for my customers to pay.
If you have any questions, feel free to ask me and I can help.
Eric Davis
Rails Rumble - September 8-9
Rails Rumble, a Ruby on Rails programming contest, has been officially announced. Basically it is a groups of 1-4 people who are given 48 hours to build and deploy a Ruby on Rails application.
Simple and easy to use invoices - Bamboo Invoice
As much fun as it is cutting your code on a new freelance project, there is a side to the business that we freelancers tend to forget, or just hope it will go away if we ignore it. Invoicing customers. We can work as much as we want for a customer, but unless we invoice them for our work we will never get get paid. Not getting paid is bad.
Luckily, invoicing does not have to be hard. I use an open source invoicing program called Bamboo Invoice. The thing I like most about it is that it provides just what I need to invoice my customers; it does not try to provide accounting, supply chain management, or any other “total business solution”.

Installation was easy, it is written in PHP5 and uses the LAMP web stack every is familiar with. The installation instructions were pretty easy to follow. Once installed there are a few settings in the “Setting” panel that you need to customize for your business. Now you are ready to add in your customers and start to invoice them for all the time you have been “forgetting” to bill.
Once you have an invoice, the Bamboo Invoice allows you to create a PDF of the invoice and will even email your customers with the PDF attached if you want. I ran into some issues emailing the invoice to multiple people at a time so you should test it out a little bit on one of your email accounts first. The issues are probably just the way my email server is setup.
So if you are looking for a simple and open source invoicing program that you can use in your freelancing business, I would recommend Bamboo Invoice. There is an online demo that you can try at it’s homepage.
Eric Davis
