Merge branch 'foodcourt' of https://gitlab.com/code2lab/SXRestaurant into foodcourt

This commit is contained in:
Nweni
2019-11-27 09:36:39 +06:30
26 changed files with 281 additions and 260 deletions

View File

@@ -98,7 +98,7 @@ class Origami::ShiftsController < BaseOrigamiController
other_charges = Sale.get_other_charges()
@total_other_charges_info = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",@shift)
end
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card
@@ -143,7 +143,7 @@ class Origami::ShiftsController < BaseOrigamiController
if @shift
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)

View File

@@ -2,21 +2,14 @@ class Reports::CommissionController < 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
from_date, to_date = get_date_range_from_params
commissioner = params[:commissioner].to_i
@com_id = commissioner
@commissioner = Commissioner.active.all
@commissioner = Commissioner.active.where("shop_code='#{@shop.shop_code}'")
@transaction = ProductCommission.get_transaction(from_date, to_date, commissioner)
@from = from_date
@to = to_date
# get printer info
@@ -30,7 +23,7 @@ class Reports::CommissionController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -49,6 +42,5 @@ class Reports::CommissionController < BaseReportController
format.json { render json: out }
end
end
end
end

View File

@@ -1,27 +1,27 @@
class Reports::CreditPaymentController < BaseReportController
class Reports::CreditPaymentController < BaseReportController
authorize_resource :class => false
def index
@filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']]
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
from, to = get_date_range_from_params
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@filter = params[:filter_check]
@order_source = params[:order_source]
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to,@filter,@order_source)
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to,@filter,@order_source,@shop.shop_code)
@from = from
@to = to
@@ -58,10 +58,10 @@ authorize_resource :class => false
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -3,11 +3,11 @@ class Reports::DailysaleController < BaseReportController
def index
from, to = get_date_range_from_params
@sale_data = Sale.daily_sales_list(from,to)
@tax = SaleTax.get_tax(from,to)
@sale_data = Sale.daily_sales_list(from,to,@shop.shop_code)
@tax = SaleTax.get_tax(from,to,@shop.shop_code)
@from = from
@to = to
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
@payment_methods = PaymentMethodSetting.where("is_active='1' and shop_code='#{@shop.shop_code}'").pluck("payment_method")
# get printer info

View File

@@ -2,7 +2,7 @@ class Reports::HourlySaleitemController < BaseReportController
authorize_resource :class => false
def index
@account = Account.all
@account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
shift_sale_range = ''
@@ -10,25 +10,25 @@ class Reports::HourlySaleitemController < BaseReportController
shift = ''
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
end
account_type = params[:account_type]
@type = params[:sale_type]
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type,@shop.shop_code)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
@@ -57,7 +57,7 @@ class Reports::HourlySaleitemController < BaseReportController
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
respond_to do |format|
format.html
format.xls

View File

@@ -1,25 +1,25 @@
class Reports::IndutyController < BaseReportController
authorize_resource :class => false
def index
@commissioners = Commissioner.all #.where("is_active='1'")
@commissioners = Commissioner.where("shop_code='#{@shop.shop_code}'") #.where("is_active='1'")
from, to = get_date_range_from_params
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}' ",shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}' ",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@commissioner = params[:commissioner]
@induty_data = InDuty.get_induty_by_shift(@shift_sale_range,@shift,from,to,@commissioner)
@induty_data = InDuty.get_induty_by_shift(@shift_sale_range,@shift,from,to,@commissioner).where("sales.shop_code='#{@shop.shop_code}'")
@from = from
@to = to
@@ -43,9 +43,9 @@ class Reports::IndutyController < BaseReportController
def show
from, to = get_date_range_from_params
@induty_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@induty_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@commissioner = params[:commissioner]
date_arr = Array.new
@induty_data.each do |induty|
local_opening_date = induty.opening_date.nil? ? '-' : induty.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
@@ -58,7 +58,7 @@ class Reports::IndutyController < BaseReportController
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end

View File

@@ -1,4 +1,4 @@
class Reports::OrderReservationController < BaseReportController
class Reports::OrderReservationController < BaseReportController
# authorize_resource :class => false
def index
@providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["TURBO","turbo"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
@@ -11,23 +11,23 @@ class Reports::OrderReservationController < BaseReportController
@shift = ''
if params[:shift_name].to_i != 0
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
end
provider = params[:provider]
payment_type = params[:payment_type]
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider,payment_type)
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@from = from
@to = to
# get printer info
@@ -49,7 +49,7 @@ class Reports::OrderReservationController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -63,10 +63,10 @@ class Reports::OrderReservationController < BaseReportController
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -1,28 +1,28 @@
class Reports::PaymentMethodController < BaseReportController
class Reports::PaymentMethodController < BaseReportController
# authorize_resource :class => false
def index
@payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"],
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
["Alipay Payment","alipay"],["Paymal Payment", "paymal"],["Dinga Payment","dinga"],
["JunctionPay","junctionpay"],["Redeem Payment","paypar"],["Gift Voucher","giftvoucher"]]
from, to = get_date_range_from_params
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@payment_type = params[:payment_type]
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type,@shop.shop_code)
@from = from
@to = to
# get printer info
@@ -44,7 +44,7 @@ class Reports::PaymentMethodController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -58,10 +58,10 @@ class Reports::PaymentMethodController < BaseReportController
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -2,7 +2,7 @@ class Reports::ReceiptNoController < BaseReportController
authorize_resource :class => false
def index
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.all
@payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
@shift_sale_range = ''
@@ -10,16 +10,16 @@ authorize_resource :class => false
@shift = ''
if params[:shift_name].to_i != 0
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",@shift_sale.shift_started_at)
else
if @shift_sale.shift_closed_at.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",@shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}' ",@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
end
end
end
@@ -30,9 +30,9 @@ authorize_resource :class => false
end
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.group('name').order('order_by asc') #.limit(2)
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@tax_profiles = TaxProfile.where("shop_code='#{@shop.shop_code}'").group('name').order('order_by asc') #.limit(2)
@from = from
@to = to
@@ -55,7 +55,7 @@ authorize_resource :class => false
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -1,8 +1,8 @@
class Reports::ReceiptNoDetailController < BaseReportController
class Reports::ReceiptNoDetailController < BaseReportController
authorize_resource :class => false
def index
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.all
@payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
@shift_sale_range = ''
@@ -10,22 +10,22 @@ authorize_resource :class => false
@shift = ''
if params[:shift_name].to_i != 0
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",@shift_sale.shift_started_at)
else
if @shift_sale.shift_closed_at.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",@shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
end
end
end
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type)
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@from = from
@to = to
@@ -48,7 +48,7 @@ authorize_resource :class => false
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -62,10 +62,10 @@ authorize_resource :class => false
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -2,7 +2,7 @@ class Reports::SaleitemController < BaseReportController
authorize_resource :class => false
def index
@account = Account.all
@account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
shift_sale_range = ''
@@ -10,26 +10,25 @@ class Reports::SaleitemController < BaseReportController
shift = ''
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}' ",shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
end
account_type = params[:account_type]
@type = params[:sale_type]
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type,@shop.shop_code)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
@@ -62,7 +61,7 @@ class Reports::SaleitemController < BaseReportController
def show
from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -94,16 +93,16 @@ class Reports::SaleitemController < BaseReportController
shift_name = 'All Shift'
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'" ,shift_sale.shift_started_at)
else
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@@ -112,36 +111,30 @@ class Reports::SaleitemController < BaseReportController
shift_name = employee.nil? ? sh_name : "#{sh_name} (#{employee.name})"
end
shop_details = shop_detail
account_type = params[:account_type]
@type = params[:period_type]
period_name = get_period_name(params[:period])
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type,@shop.shop_code)
other_charges = Sale.get_other_charges()
if shift.present?
@total_other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
@total_other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed' and sales.shop_code='#{@shop.shop_code}'",shift.to_a)
else
@total_other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
@total_other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed' and sales.shop_code='#{@shop.shop_code}'",from,to)
end
# get printer info
print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf
print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf')
# if print_settings.nil? && print_settings_star.nil?
# @print_setting = PrintSetting.new(name: "SaleItemsPdf", unique_code: "SaleItemsPdf", template: "",font: "Zawgyi-One", header_font_size: "10", item_font_size: "8", printer_name: "", api_settings: "", brand_name: nil, printer_type: nil, page_width: "210", page_height: "1450", print_copies: "1", precision: "0", delimiter: "0", heading_space: "5" )
# @print_setting.save
# end
print_settings = PrintSetting.find_by_unique_code_and_shop_code('SaleItemsPdf',@shop.shop_code) # SaleItemsPdf
print_settings_star = PrintSetting.find_by_unique_code_and_shop_code('SaleItemsStarPdf',@shop.shop_code)
if print_settings.nil?
if !print_settings_star.nil?
printer = Printer::CashierStationPrinter.new(print_settings_star)
printer.print_sale_items_report(print_settings_star, shop_details, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges)
printer.print_sale_items_report(print_settings_star, @shop, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges)
end
else
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_sale_items_report(print_settings, shop_details, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges)
printer.print_sale_items_report(print_settings, @shop, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges)
end
respond_to do |format|

View File

@@ -8,7 +8,7 @@ class Reports::ShiftsaleController < BaseReportController
if params[:shift_name].to_i != 0
@shift = ShiftSale.find(params[:shift_name])
end
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
@sale_data = Sale.get_by_shiftsales(from,to,@shift,@shop.shop_code)
@from = from
@to = to
if @shift.present?
@@ -28,7 +28,7 @@ class Reports::ShiftsaleController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -56,7 +56,7 @@ class Reports::ShiftsaleController < BaseReportController
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
close_cashier_pdf = Lookup.collection_of("print_settings")
close_cashier_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings")
unique_code = "CloseCashierPdf"
@@ -75,7 +75,7 @@ class Reports::ShiftsaleController < BaseReportController
shop_details = shop_detail
cashier_terminal = @shift.cashier_terminal
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card
@@ -91,12 +91,12 @@ class Reports::ShiftsaleController < BaseReportController
@total_credit_payments = ShiftSale.get_shift_sales_with_credit_payment(shift_id).total_credit_payments
# get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code)
print_settings = PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
printer = Printer::CashierStationPrinter.new(print_settings)
# printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, @shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
respond_to do |format|
format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'}
format

View File

@@ -2,7 +2,7 @@ class Reports::StaffMealController < BaseReportController
authorize_resource :class => false
def index
@account = Account.all
@account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
shift_sale_range = ''
@@ -10,16 +10,16 @@ class Reports::StaffMealController < BaseReportController
shift = ''
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',shift_sale.shift_started_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at)
else
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}'",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
end
@@ -32,9 +32,9 @@ class Reports::StaffMealController < BaseReportController
account_type = params[:account_type]
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_staff_meal_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,account_type,customer_id)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_staff_meal_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,account_type,customer_id,@shop.shop_code)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}

View File

@@ -11,9 +11,9 @@ class Reports::StockCheckController < BaseReportController
# end
from_date, to_date = get_date_range_from_params
@item_code = params[:item_code]
@inventory_definitions = InventoryDefinition.active.all
@inventory_definitions = InventoryDefinition.active.where("shop_code='#{@shop.shop_code}'")
@transaction = StockCheckItem.get_transaction(from_date, to_date, @item_code)
@transaction = StockCheckItem.where("shop_code='#{@shop.shop_code}'").get_transaction(from_date, to_date, @item_code)
@from = from_date
@to = to_date
# get printer info
@@ -27,7 +27,7 @@ class Reports::StockCheckController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -1,4 +1,4 @@
class Reports::VoidSaleController < BaseReportController
class Reports::VoidSaleController < BaseReportController
authorize_resource :class => false
def index
@@ -8,16 +8,16 @@ authorize_resource :class => false
@shift = ''
if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#@shop.shop_code' ",shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#@shop.shop_code' ",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
@sale_data = Sale.get_void_sale(@shift,from,to)
@sale_data = Sale.get_void_sale(@shift,from,to,@shop.shop_code)
@from = from
@to = to
# get printer info
@@ -39,7 +39,7 @@ authorize_resource :class => false
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
date_arr = Array.new
@sale_data.each do |sale|
@@ -53,10 +53,10 @@ authorize_resource :class => false
end
out = {:status => 'ok', :message => date_arr}
respond_to do |format|
format.json { render json: out }
end
end
end
end

View File

@@ -1,9 +1,9 @@
class Reports::WasteAndSpoilageController < BaseReportController
class Reports::WasteAndSpoilageController < BaseReportController
authorize_resource :class => false
def index
from, to = get_date_range_from_params
@sale_type = params[:sale_type]
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type)
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'")
@from = from
@to = to
# get printer info
@@ -15,5 +15,5 @@ authorize_resource :class => false
end
end
end
end

View File

@@ -1,5 +1,5 @@
class Transactions::CreditNotesController < ApplicationController
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
before_action :check_user
@@ -17,22 +17,22 @@ class Transactions::CreditNotesController < ApplicationController
if filter.nil? && from.nil? && to.nil? && customer.nil? && order_source.nil?
order_source_query = "(select orders.source FROM orders JOIN sale_orders so ON so.order_id=orders.order_id WHERE so.sale_id=sales.sale_id GROUP BY so.sale_id)"
@credit_notes = Sale.select("sales.*, #{order_source_query} as source")
.joins("JOIN sale_payments sp on sp.sale_id = sales.sale_id")
.where("(CASE WHEN (sales.grand_total + sales.amount_changed)=(select SUM(sale_payments.payment_amount)
FROM sale_payments WHERE sale_payments.sale_id=sales.sale_id AND sale_payments.payment_method!='creditnote')
THEN NULL ELSE payment_method='creditnote' END)")
THEN NULL ELSE payment_method='creditnote' END) and sales.shop_code='#{@shop.shop_code}'")
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
else
sale = Sale.search_credit_sales(customer,filter,from,to,order_source)
sale = Sale.search_credit_sales(customer,filter,from,to,order_source).where("sales.shop_code='#{@shop.shop_code}'")
if !sale.nil?
@credit_notes = sale
@credit_notes = sale
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
else
@credit_notes = 0
end
end
end
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @credit_notes }
@@ -45,5 +45,5 @@ class Transactions::CreditNotesController < ApplicationController
redirect_to root_path
end
end
end
end

View File

@@ -12,17 +12,17 @@ class Transactions::OrderReservationsController < ApplicationController
if from.nil? && to.nil?
@order_reservations = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee")
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
.where("NOT order_reservation_status='new'")
.where("NOT order_reservation_status='new' and order_reservations.shop_code='#{@shop.shop_code}'")
.order("order_reservation_id desc")
@order_reservations = Kaminari.paginate_array(@order_reservations).page(params[:page]).per(20)
else
order_reservation = OrderReservation.search(filter,from,to)
order_reservation = OrderReservation.search(filter,from,to).where("order_reservations.shop_code='#{@shop.shop_code}'")
if order_reservation.length > 0
@order_reservations = order_reservation
@order_reservations = order_reservation
@order_reservations = Kaminari.paginate_array(@order_reservations).page(params[:page]).per(20)
else
@order_reservations = 0
end
end
end
@from = from
@to = to
@@ -38,7 +38,7 @@ class Transactions::OrderReservationsController < ApplicationController
# GET /transactions/order_reservations/1
# GET /transactions/order_reservations/1.json
def show
@order_reservation = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee")
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
.where("order_reservations.order_reservation_id = ?", params[:id])
@@ -73,7 +73,7 @@ class Transactions::OrderReservationsController < ApplicationController
period_type = params[:period_type]
period = params[:period]
from = params[:from]
to = params[:to]
to = params[:to]
day_ref = Time.now.utc.getlocal
if from.present? && to.present?
@@ -82,8 +82,8 @@ class Transactions::OrderReservationsController < ApplicationController
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
from = f_time.beginning_of_day.utc.getlocal
to = t_time.end_of_day.utc.getlocal
else
to = t_time.end_of_day.utc.getlocal
else
case period.to_i
when PERIOD["today"]
from = day_ref.beginning_of_day.utc
@@ -117,10 +117,10 @@ class Transactions::OrderReservationsController < ApplicationController
when PERIOD["last_year"]
from = (day_ref - 1.year).beginning_of_year.utc
to = (day_ref - 1.year).end_of_year.utc
end
end
end
return from, to
return from, to
end
def check_user
@@ -128,7 +128,7 @@ class Transactions::OrderReservationsController < ApplicationController
redirect_to root_path
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_order_reservation

View File

@@ -9,11 +9,11 @@ class Transactions::OrdersController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil?
orders = Order.order("order_id desc")
orders = Order.where("shop_code='#{@shop.shop_code}'").order("order_id desc")
else
orders = Order.search(filter,from,to)
end
orders = Order.search(filter,from,to).where("orders.shop_code='#{@shop.shop_code}'")
end
if !orders.nil?
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(20)
else
@@ -23,14 +23,14 @@ class Transactions::OrdersController < ApplicationController
@receipt_no = filter
@from = from
@to = to
respond_to do |format|
format.html
format.json { render json: @orders }
# format.csv { send_data OrdersCsvExport.generate }
end
end
def show
@order = Order.find(params[:id])

View File

@@ -18,13 +18,13 @@ class Transactions::SalesController < ApplicationController
if receipt_no.nil? && from.nil? && to.nil?
if @shift.blank?
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shop_code='#{@shop.shop_code}'").order("sale_id desc")
else
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}' and shop_code='#{@shop.shop_code}'").order("sale_id desc")
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
sale = Sale.search(receipt_no,from,to,@shift)
sale = Sale.search(receipt_no,from,to,@shift).where("sales.shop_code='#{@shop.shop_code}'")
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)

View File

@@ -10,16 +10,16 @@ class Transactions::ShiftSalesController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil?
@shift_sales = ShiftSale.all.order("id desc")
@shift_sales = ShiftSale.where("shop_code='#{@shop.shop_code}'").order("id desc")
@shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20)
else
shift_sale = ShiftSale.search(filter,from,to)
shift_sale = ShiftSale.search(filter,from,to).where("shift_sales.shop_code='#{@shop.shop_code}'")
if shift_sale.count > 0
@shift_sales = shift_sale
@shift_sales = shift_sale
@shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20)
else
@shift_sales = 0
end
end
end
respond_to do |format|
@@ -32,12 +32,12 @@ class Transactions::ShiftSalesController < ApplicationController
# GET /transactions/shift_sales/1
# GET /transactions/shift_sales/1.json
def show
@shift = ShiftSale.find(params[:id])
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
@@ -46,7 +46,7 @@ class Transactions::ShiftSalesController < ApplicationController
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
respond_to do |format|
format.html # show.html.erb
@@ -59,7 +59,7 @@ class Transactions::ShiftSalesController < ApplicationController
redirect_to root_path
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_shift_sale

View File

@@ -5,15 +5,15 @@ class Transactions::SurveysController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil?
@surveys = Survey.all
@surveys = Survey.where("shop_code='#{@shop.shop_code}'")
else
@surveys = Survey.search(filter,from,to)
end
@surveys = Survey.search(filter,from,to).where("shop_code='#{@shop.shop_code}'")
end
@filter = filter
@from = from
@to = to
respond_to do |format|
format.html # index.html.erb
format.xls