Prev | Current Page 225 | Next

David Berube

"Practical Reporting with Ruby and Rails"

Chapter 7 includes an example of using
Markaby. Of course, you may find that entering HTML directly in your code is easier to understand.
The single variable you pass to your view is an array of users. You pass it to your
eruby_object variable, and it becomes a class variable @users for your view, in the same
way that Rails views work.
The users variable is created by using the User.find method to loop through all of
your users. You add a not is_admin condition, which means that only non-admin users
will be included in your report. (This is assuming that admin users are used to administrate
the system and not to do sales work; if that??™s not true, you can easily remove this
condition.) The order is set through the option :order=>'last_name ASC, first_name ASC',
which means that you sort first by the last name, and second by the first name, both in
alphabetic, A??“Z order. The second sort order kicks in only if two people have the same
last name. If you replaced ASC with DESC, it would sort in Z??“A order.
Let??™s take a look at the actual view (Listing 8-3):


Salesperson Reward Report








CHAPTER 8 n CREATING SALES PERFORMANCE REPORTS WITH SUGARCRM 164
<%@users.


Pages:
213214215216217218219220221222223224 225 226227228229230231232233234235236237
Namioty Mazury i interesująca cenaSzkoły policealne fryzjer w warszawieneed cash fast bad creditperfumy fmświnoujście noclegi
NameMeetingsReward