One of the quick side projects I worked on in the past two weeks was a contract PHP programming job for a clubhouse in Marlborough, MA.
The business requirements:
- User to enter a cut-off date
- Print pages of labels for all members who
- Had been in attendance since the cut-off date, AND
- Belonged to a “certain” subset of members
- Labels need to be formatted for Avery 5160
The clubhouse data is stored in MySQL tables in a database on their Intranet. There are over 1,000 members listed in the members table. Some are active and some are no longer active. Those who attend the clubhouse are checked in with a barcode reader, and that data is stored in an attendance table on the Intranet.
Programming solution:
- User to enter a cut-off date
In order to avoid formatting and “real” date validations, instead of creating an open data entry field, a drop-down select field loaded with valid attendance dates was created. The user just scrolls the list. (Only the last 120 days are presented (a calendar presentation (i.e. jQuery datepicker) does not work for this client.)) - Print pages of labels
- Using the IDs of members in attendance from the cut-off date to the present date, a lookup on the members table indicates whether the member belongs in the “certain” subset mentioned above. If so, a label is formatted for that member. If not, the program skips to the next member ID.
- Once all the IDs have been processed, a precisely formatted PDF file is displayed to the user.
- The user can send it to the printer using the Adobe® Reader® print symbol (without having to adjust margins or orientation), and, can save it on the local system in order to have a record of recipients for that mailing.
The programming solution includes PHP, MySQL, and FPDF (for creating the PDF).
A fun diversion in the middle of creating WordPress websites!