Sha256: 3f4d84193ac8157cd2a03e91cc00a2e7a4734032f2178782b0563284f466dfe6

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

# QueryReport
The purpose of this gem is to create reports with just the basic query with the built in following features,
*   Pagination (with Kaminari)
*   Basic filters (with Ransack)
*   Custom filter
*   Export with html, PDF (with Prawn PDF), CSV, JSON

The gem is still in infant stage. So I would just ask you to keep an eye on this for now.

## Installation

Add this line to your application's Gemfile:

    gem 'query_report'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install query_report

## Usage

In your controller add,
```ruby
require 'query_report/helper'
```

And include,
```ruby
include QueryReport::Helper
```

Then add

```ruby
def invoice
  query = Invoice.includes(:invoiced_to => {:user => :profile})
  reporter(query) do
    scope :unpaid

    filter :invoiced_on, type: :date
    filter :title, type: :text
    filter :invoiced_to, type: :user

    column :id, as: 'Invoice#'
    column :title
    column 'Invoiced to' do |invoice|
      invoice.invoiced_to.user.name
    end
    column :total_charged, as: 'Charged'
    column :total_paid, as: 'Paid'

    pie_chart('Charged VS Paid') do
      add 'Total un paid charge' do |query|
        query.sum(:total_charged) - query.sum(:total_paid)
      end
      add 'Total paid' do |query|
        query.sum(:total_paid)
      end
    end
  end
end
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
query_report-0.1.2 README.md
query_report-0.1.1 README.md
query_report-0.1.0 README.md
query_report-0.0.9 README.md
query_report-0.0.8 README.md
query_report-0.0.7 README.md
query_report-0.0.6 README.md
query_report-0.0.5 README.md
query_report-0.0.4 README.md
query_report-0.0.3 README.md
query_report-0.0.2 README.md