title: How can I do breaks and subtotals in a report?
body: <p>I need to generate a business report using perl + Template Toookit and LaTeX.</p>
  
  <p>Things are working really well, but I am struggling with the problem of having breaks (for example page breaks, or special headers) and subtotals whenever a field changes.</p>
  
  <p>So, for example, every time the field "category" changes, I'd need to have a total of sales for that category, and a header showing that another category listing is starting; and then do the same when the field "group" - with the added interest that "group" is made up of categories, so the two things should nest.</p>
  
  <p>I guess anyone that has built reports with Microsoft Access (or probably any other business reporting application) should be familiar with the problem.</p>
  
  <p>Ideally this would be solved at a meta-level, so I don't have to rebuild the code every time, but only to specify what fields should generate breaks or subtotals. </p>
  
  <p>I am (voluntarily) constrained to LaTeX and TT: LaTeX because of the control it gives over typography, and the possibility of generating custom graphics, and TT (or anything else that works in perl) because of learning curves.</p>