Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -----------------
- # Controller.rb
- # -----------------
- gtbl = Calculations::GoogleTable.new()
- @data = gtbl.get_data(current_user.regio, @start_date, @end_date, @is_paid, @open)
- g = GoogleVisualr::DataTable.new()
- g.new_column('string', 'Fac. nr.')
- g.new_column('date', 'Fac. datum')
- g.new_column('boolean', 'Bet.')
- g.new_column('string', 'Bet. op')
- g.new_column('number', 'Klnr')
- g.new_column('string', 'Klant')
- g.new_column('string', 'Student')
- g.new_column('number', 'Uren')
- g.new_column('number', 'Marge')
- g.new_column('number', 'Bruto')
- g.new_column('number', 'BTW')
- g.new_column('number', 'Netto')
- g.new_column('number', 'Verg. St.')
- g.new_column('number', 'Bem.fee')
- g.new_column('number', 'Werving')
- g.add_rows(@data)
- options_g = {
- :width => "100%",
- :height => "560px",
- #:page => 'enable',
- #:pageSize => 20,
- }
- options_g[:sortColumn] = 1
- options_g[:sortColumn] = 3 if @is_paid
- @table = GoogleVisualr::Interactive::Table.new(g, options_g)
- @table.add_listener("select", "function(e) {tableRegiofactuursEventHandler(e, chart, data_table)}")
- # -----------------
- # google_table.rb
- # -----------------
- def get_data regio = 0, start_date = nil, end_date = nil, is_paid = false, is_open = false
- ret = []
- (0..1000).to_a.each do |i|
- ret.push [i, DateTime.now, true, DateTime.now + 2.days, i+1230000, 'John Doe', 'Foo Bar', i, i, i, i, i, i, i, i]
- end
- ret
- end
Advertisement
Add Comment
Please, Sign In to add comment