edti dashboard

This commit is contained in:
Sunandar
2017-01-31 11:33:00 +06:30
parent 8085d311ab
commit 58dcf588df
6 changed files with 93 additions and 8 deletions

View File

@@ -5,6 +5,14 @@ class HomeController < ApplicationController
redirect_to new_member_session_path
end
def dashboard
today= Date.today.strftime("%Y-%m-%d")
@users=User.all
@batches=Batch.joins('inner join users on users.id=batches.user_id')
.where("to_char(batches.created_at,'YYYY-mm-dd')=?",today)
.select('batches.*,users.name as user_name').order('batches.id desc')
@batchLineItems=BatchLineItem.joins('inner join batches on batches.id=batch_line_items.batch_id').select('batch_line_items.*,batches.order_ref as batch_name')
.where("to_char(batches.created_at,'YYYY-mm-dd')=?",today)
.page(params[:page]).per(5)
end
end