stock_check report template
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
class Inventory::StockChecksController < BaseInventoryController
|
||||
|
||||
def index
|
||||
@check = StockCheck.new
|
||||
@inventory_definitions = InventoryDefinition.active.all
|
||||
@@ -29,87 +28,86 @@ class Inventory::StockChecksController < BaseInventoryController
|
||||
stockcheck = StockCheck.find(stock_id)
|
||||
stockcheck_items = stockcheck.stock_check_items
|
||||
member_info = nil
|
||||
unique_code = "StockPrint"
|
||||
|
||||
unique_code = 'StockPrint'
|
||||
|
||||
shop_details = Shop.find(1)
|
||||
checker = Employee.find(stockcheck.check_by)
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_stock_check_result(print_settings,stockcheck, stockcheck_items,checker.name, shop_details)
|
||||
|
||||
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, shop_details)
|
||||
end
|
||||
|
||||
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /stock_checks
|
||||
# GET /stock_checks.json
|
||||
# def index
|
||||
# @stock_checks = StockCheck.all
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1
|
||||
# # GET /stock_checks/1.json
|
||||
# def show
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/new
|
||||
# def new
|
||||
# @stock_check = StockCheck.new
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1/edit
|
||||
# def edit
|
||||
# end
|
||||
#
|
||||
# # POST /stock_checks
|
||||
# # POST /stock_checks.json
|
||||
# def create
|
||||
# @stock_check = StockCheck.new(stock_check_params)
|
||||
#
|
||||
# respond_to do |format|
|
||||
# if @stock_check.save
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully created.' }
|
||||
# format.json { render :show, status: :created, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :new }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # PATCH/PUT /stock_checks/1
|
||||
# # PATCH/PUT /stock_checks/1.json
|
||||
# def update
|
||||
# respond_to do |format|
|
||||
# if @stock_check.update(stock_check_params)
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully updated.' }
|
||||
# format.json { render :show, status: :ok, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :edit }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # DELETE /stock_checks/1
|
||||
# # DELETE /stock_checks/1.json
|
||||
# def destroy
|
||||
# @stock_check.destroy
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to stock_checks_url, notice: 'Stock check was successfully destroyed.' }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# private
|
||||
# # Use callbacks to share common setup or constraints between actions.
|
||||
# def set_stock_check
|
||||
# @stock_check = StockCheck.find(params[:id])
|
||||
# end
|
||||
#
|
||||
# # Never trust parameters from the scary internet, only allow the white list through.
|
||||
# def stock_check_params
|
||||
# params.fetch(:stock_check, {})
|
||||
# end
|
||||
# def index
|
||||
# @stock_checks = StockCheck.all
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1
|
||||
# # GET /stock_checks/1.json
|
||||
# def show
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/new
|
||||
# def new
|
||||
# @stock_check = StockCheck.new
|
||||
# end
|
||||
#
|
||||
# # GET /stock_checks/1/edit
|
||||
# def edit
|
||||
# end
|
||||
#
|
||||
# # POST /stock_checks
|
||||
# # POST /stock_checks.json
|
||||
# def create
|
||||
# @stock_check = StockCheck.new(stock_check_params)
|
||||
#
|
||||
# respond_to do |format|
|
||||
# if @stock_check.save
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully created.' }
|
||||
# format.json { render :show, status: :created, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :new }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # PATCH/PUT /stock_checks/1
|
||||
# # PATCH/PUT /stock_checks/1.json
|
||||
# def update
|
||||
# respond_to do |format|
|
||||
# if @stock_check.update(stock_check_params)
|
||||
# format.html { redirect_to @stock_check, notice: 'Stock check was successfully updated.' }
|
||||
# format.json { render :show, status: :ok, location: @stock_check }
|
||||
# else
|
||||
# format.html { render :edit }
|
||||
# format.json { render json: @stock_check.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # DELETE /stock_checks/1
|
||||
# # DELETE /stock_checks/1.json
|
||||
# def destroy
|
||||
# @stock_check.destroy
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to stock_checks_url, notice: 'Stock check was successfully destroyed.' }
|
||||
# format.json { head :no_content }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# private
|
||||
# # Use callbacks to share common setup or constraints between actions.
|
||||
# def set_stock_check
|
||||
# @stock_check = StockCheck.find(params[:id])
|
||||
# end
|
||||
#
|
||||
# # Never trust parameters from the scary internet, only allow the white list through.
|
||||
# def stock_check_params
|
||||
# params.fetch(:stock_check, {})
|
||||
# end
|
||||
end
|
||||
|
||||
50
app/controllers/reports/stock_check_controller.rb
Normal file
50
app/controllers/reports/stock_check_controller.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
class Reports::StockCheckController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
|
||||
def index
|
||||
from_date = DateTime.now.beginning_of_day.utc.getlocal
|
||||
to_date = DateTime.now.end_of_day.utc.getlocal
|
||||
unless params[:daterange].blank?
|
||||
from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day.utc.getlocal
|
||||
to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day.utc.getlocal
|
||||
@daterange = params[:daterange]
|
||||
end
|
||||
commissioner = params[:commissioner].to_i
|
||||
@com_id = commissioner
|
||||
@commissioner = Commissioner.active.all
|
||||
@inventory_definitions = InventoryDefinition.active.all
|
||||
|
||||
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
|
||||
@from = from_date
|
||||
@to = to_date
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: out }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user