Sha256: b9423a332cbf48c273bf0bb1fa40559e0308fb4047dbf334804c961325ec6fed

Contents?: true

Size: 1.44 KB

Versions: 17

Compression:

Stored size: 1.44 KB

Contents

# Revenue: Individual Transactions

module Admin
  class ReportTransactionsDatatable < Effective::Datatable
    filters do
      filter_date_range :current_month
    end

    datatable do
      order :id, :desc
      length 250

      col :created_at, visible: false

      col :id, label: 'Order' do |order|
        link_to(order.to_param, effective_orders.admin_order_path(order))
      end

      col :purchased_at
      col :user
      col :order_items
      col :payment_provider, search: EffectiveOrders.payment_providers
      col :payment_method

      col :subtotal, as: :price
      col :tax, as: :price
      col(:tax_rate) { |order| rate_to_percentage(order.tax_rate) }.aggregate { nil }

      col :amount_owing, as: :price

      if EffectiveOrders.surcharge?
        col :surcharge, as: :price
        col(:surcharge_percent) { |order| rate_to_percentage(order.surcharge_percent) }.aggregate { nil }
      end

      col :total, as: :price

      col :filtered_start_date, as: :date, search: false, sort: false, visible: false do
        date_range.begin&.strftime('%F')
      end

      col :filtered_end_date, as: :date, search: false, sort: false, visible: false do
        date_range.end&.strftime('%F')
      end

      aggregate :total

      actions_col
    end

    collection do
      Effective::Order.purchased
        .where(purchased_at: date_range)
        .where('total != 0')
        .includes(:user, [order_items: :purchasable])
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
effective_orders-6.6.0 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.9 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.8 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.7 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.6 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.5 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.4 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.3 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.2 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.1 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.5.0 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.4.4 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.4.3 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.4.2 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.4.1 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.4.0 app/datatables/admin/report_transactions_datatable.rb
effective_orders-6.3.2 app/datatables/admin/report_transactions_datatable.rb