Ruport for beginner

D

Dot Baiki

Dear Ruby community,

I am looking for a "simple" PDF output for monthly salaries. Input is a
CSV file and output should be a PDF file.

I just get more or less these fields from the CSV
id, name, valid_time and date

While creating the tables and preparing the output, there have are
several calculations to be done before PDF generation.

However, I am not yet there :(

Here is what I got so far:
-------------------------------------------------------------------
#!/usr/bin/ruby

require 'rubygems'
require 'ruport'

#csv_input = File.open('testtest.csv','r')

csv_input = <<-EOF
id,name,valid_time,date
1,baiki,5:00,9/10/2009
1,baiki,1:45,9/14/2009
2,lee,6:00,9/8/2009
2,lee,6:00,9/7/2009
2,lee,6:55,9/6/2009
2,lee,6:00,9/8/2009
1,baiki,5:00,9/11/2009
1,baiki,4:00,9/12/2009
1,baiki,2:00,9/13/2009
EOF

table = Table:)string => csv_input)

table = table.sub_table(%w[id name valid_time date])

table.rename_columns('id' => 'ID', 'name' => 'Name', 'valid_time' =>
'Hours worked', 'date' => 'Date')

grouped_by_id = Grouping(table, :by => 'ID', :eek:rder => :ID)

puts grouped_by_id

#csv_input.close
-------------------------------------------------------------------

My question for now. How can I sort within the grouping according to the
date. Basic sorting is asc ID.

Thanks
Baiki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top