Prev | Current Page 203 | Next

David Berube

"Practical Reporting with Ruby and Rails"

0
PaypalTransaction.find_by_sql(sql).each do |week|
# First, if the weekday is the highest total spending we've seen so far,
# we'll keep that value to calibrate the size of the graph . . .
max_gross = week.weekday_amount.to_f if week.weekday_amount.to_f > max_gross
# . . . and if the weekend spending is the highest, we'll use that:
max_gross = week.weekend_amount.to_f if week.weekend_amount.to_f > max_gross
# We'll add a hash with the week number, the year,
# the weekday spending, and the weekend spending to the weeks array:
weeks << { :week_number=>week.week_number.to_i,
:year=>week.year.to_i,
:weekday_amount=>week.weekday_amount.to_f,
:weekend_amount=>week.weekend_amount.to_f
}
end
mab = Markaby::Builder.new() do
html do
head do
title 'PayPal Spending Report'
CHAPTER 7 n TRACKING EXPENDITURES WITH PAYPAL 146
style :type => "text/css" do %[
.weekday_bar { display:block; background-color: blue; }
.weekend_bar { display:block; background-color: red; }
%]
end
end
body do
h1 ''
table do
weeks.


Pages:
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
międzyzdroje tanie kwatery online loan for bad credit Powiększanie ust kraków Noclegi Władysławowo Noclegi Rowy