Listing 8-2. Salesperson Reward Report (calculate_rewards.rb)
require 'active_record'
require 'erubis'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:username => 'your_mysql_user_name',
:password => 'your_mysql_password',
:database => 'sugarcrm')
path_to_ps2pdf = '/some/path/to/ps2pdf' # Insert your path to ps2pdf here.
# Note that ps2pdf should be included
# with your Ghostscript distribution.
path_to_html2ps = '/some/path/to/html2ps' # Insert your path to html2ps here.
# Windows can't run Perl scripts directly,
# so Windows users should preface their html2ps
# path with their Perl path, so that it looks
# something like this:
# path_to_html2ps = 'C:\perl\bin\perl.exe" "c:\path\to\html2ps'
CHAPTER 8 n CREATING SALES PERFORMANCE REPORTS WITH SUGARCRM 158
#
# Note the double quotes after perl.exe and before the script file name.
# This ensures that the string is interpolated like this:
# "c:\perl\bin\perl.exe" "c:\path\to\html2ps"
#
# Without the extra double quotes, Windows will look for a program
# named "C:\perl\bin\perl c:\path\to\html2ps", and since that
# does not exist, it will cause problems.
Pages:
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230