Here is where I am now. A render :partial at the **** would solve my
problem, but another render doesn't seem to be allowed. Render_pdf
uses the only one allowed. Is there another way to do this?
At the moment, it works fine, but only gives me 1 user, even though it
makes the collections for each user.
Controller
def print
@households = Household.find(:all, :order => "last_name,
first_name")
@households.each { |@household|
@today = Date.today
@year = @today.year
@churches = Church.find(:all, :order => "name").map {|u|
[u.name, u.id]}
@thisyear =
Visit.find_all_by_year_and_household_id(Date.today.year,
@household.id)
@lastyear =
Visit.find_all_by_year_and_household_id(Date.today.year-1,
@household.id)
@yearbefore =
Visit.find_all_by_year_and_household_id(Date.today.year-2,
@household.id)
****
}
date=`date +%Y%m%d-%H:%M`
respond_to do |format|
format.pdf { send_data render_to_pdf( :action => 'print',
:layout => 'pdf_report'),
:filename =>
"Household_List_for_" + date }
end
end
First view
<!---<style type="text/css">
td{ text-align: right;}
-->
<% javascript_include_tag :defaults %>
debugger
<% get_totals(@household) %>
<pre><h3 style="text-align:center;font-size:
24px;color:blue;width=100%">Food Shelf</h3>
<% form_for @household, :url => household_path(@household), :html =>
{ :method => 'put' } do |household| %>
<table border=1 width="100%">
<td colspan="2">
<table><td>Family Size </td><td style="color:red"><big><%= @family%></
big></td><td> 0-4 Years </td><td style="color:red"><big><%=
@under5 %></big></td><td> 5-17 Years </td><td
style="color:red"><big><%= @child %></big></td><td> 18-64 Years </
td><td style="color:red"><big><%= @adult %></big></td><td> 65 &
Over <td></td><td style="color:red"><big><%= @senior %></big></td></
table>
<tr><td width="70%" valign="top">
<%= render :partial => 'household', :object => @household %>
</td>
<td class="people " width="30%" valign="top">
<%= render :partial => 'people', :object => @household %>
</td>
</tr>
<tr>
debugger
<table>
<tr><h4>Visits to Foodshelf</h4></tr>
<tr><td class="visit" width="33%">
<b>Month of <%= Date.today.year %></b>
<table border=1 width="30%">
<tr><th width=30%>Monthly</th>
<th width=10%></th>
<th width=60%><b>Bread & Veg only for Week</b></th></tr>
<th width=5%>1</th>
<th width=5%>2</th>
<th width=5%>3</th>
<th width=5%>4</th>
<th width=5%>5</th>
</tr>
<%= render :partial => 'visit', :object => @thisyear %>
</table>
</td>
<td class="visit2" width="33%">
<b>Month of <%= Date.today.year-1 %></b>
<table border=1 width="30%">
<tr><th width=30%>Monthly</th>
<th width=10%></th>
<th width=60%><b>Bread & Veg only for Week</b></th></tr>
<th width=5%>1</th>
<th width=5%>2</th>
<th width=5%>3</th>
<th width=5%>4</th>
<th width=5%>5</th>
</tr>
<%= render :partial => 'visit', :object => @lastyear %>
</table>
</td>
<td class="visit" width="33%">
<b>Month of <%= Date.today.year-2 %></b>
<table border=1 width="30%">
<tr><th width=30%>Monthly</th>
<th width=10%></th>
<th width=60%><b>Bread & Veg only for Week</b></th></tr>
<th width=5%>1</th>
<th width=5%>2</th>
<th width=5%>3</th>
<th width=5%>4</th>
<th width=5%>5</th>
</tr>
<%= render :partial => 'visit', :object => @yearbefore %>
</table>
</td>
</pre>
<% end %>
</table>
<!-- PAGE BREAK -->
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.