posted to this is not a weblog
on dec 6th, 2006

tagged corduroy, nerd, quickbooks, rails, ruby, superblock, web
and never commented on

share this page

a long time ago i complained about the awful piece of software known as quickbooks and how i dreaded using it to manage my business. i closed the rant with "perhaps i'll just continue to create my own software in the future."

not long after getting into ruby on rails, i started working on a web-based replacement that would do the essential things i needed, like creating invoices, keeping track of hours worked on various projects, and download transactions from my bank's website so i could categorize them and know my daily balance.

i ditched quickbooks and that windows machine a while ago and have been using the ruby on rails-based system, named corduroy, exclusively since about april. i implemented project, customer, bank transaction, and invoice management first, and basically implemented other things as the need arose for them as the months went on; i got tired of manually e-mailing invoice pdf's to customers, so i used actionmailer to automatically e-mail them as attachments to the customer's billing contact. the system makes heavy (re-)use of rails' partials, so data is always accessible on the screen you're at instead of having to click through to so many different things, which i really hated about quickbooks. for example, a customer's detail page lists all of their invoices, projects, and recurring services right there, with enough detail for each item to usually not have to click off of that page. all lists throughout the site have totals at the end to quickly summarize numbers.

the last thing i was avoiding having to do was deal with checks. i was using my bank's website to send checks for bills but after getting too many late notices from companies that never received checks from my bank, i decided to go back to printing checks and mailing them myself (although i should have probably taken that as a sign to switch to another bank).

in the spirit of the svn weblog i thought i'd document how i developed this particular feature.

since corduroy is web-based, printing checks was not an easy task. i couldn't tell the printer what to do from the web page, and after creating a blank html file and using css to position text, i quickly realized that web browsers will print all kinds of extra junk on the page like the url and whatnot that can't be disabled easily. also, there's no way to easily insert a page break so multiple checks couldn't be printed in sequence without intervention. so my solution was to generate a pdf with the check data absolutely positioned on the page, which could then be printed with a check in the printer. this also allowed for multiple checks to be appended as extra pages, and each one would print on a new piece of check paper. i was already using pdf::writer for invoices, so adapting my code to print out an invoice was fairly easy. the only hard part was figuring out how to align the data correctly.

since the checks are kind of expensive, i didn't want to test on them, so i did the testing on plain paper and held it up to a light with the check behind it. i looked at where the data aligned, adjusted the ruby code a few pixels, printed it again, and did this over and over.

after lining up the payee, date, and amounts, i had to align the memo fields so that the address would show through on the envelopes that i have, while not showing the account number or other important information in the memo line, but again aligning it properly so it didn't interfere with the bank routing numbers.

eventually i had it working enough to try on a real check. the paper was a little tweaked in the printer so it wasn't lined up correctly, but after making some very tiny adjustments in the code, i was able to start printing real checks.

leave the first comment or contact me

if you want to be able to mark your comment as authentic or delete it later, include your e-mail address (it won't be shown on the site). you'll be e-mailed instructions with a copy of your comment.

basic html allowed; be nice
required


optional, gravatar-ized


optional