Prev | Current Page 215 | Next

David Berube

"Practical Reporting with Ruby and Rails"

sql. You can create the table and insert the data as
follows:
mysql -u your_mysql_username sugarcrm < rewards_data.sql
The rewards table has just four rows and three fields: an artificial primary key, a number
of meetings that must be exceeded before the salesperson gets the reward, and a
description of the reward itself.
Now that you have a table populated with various rewards, let??™s take a look at how to
create a PDF report for it. For simplicity??™s sake, you??™ll use the data in Listing 8-1 coupled
with the sample data added during SugarCRM installation.
nTip The rewards data is stored in the database and not hard-coded into your script so that it??™s easy to
change. In fact, if your boss decides to change the rewards, you can just change the data and use the
code as is. You could even create a Rails application using a scaffolding framework like ActiveScaffold
(http://activescaffold.com/) to let him change the data himself, and you would need to write only a
few lines of code. (ActiveScaffold is designed to make administrative tasks like this??”simple create/read/
update/delete (CRUD) activities??”easy and require almost no code.


Pages:
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227