update conflict oragimi.scss
This commit is contained in:
@@ -34,12 +34,10 @@ class BaseReportController < ActionController::Base
|
||||
to = params[:to]
|
||||
day_ref = Time.now.utc.getlocal
|
||||
|
||||
if params[:report_type] == "daily_sale" || params[:report_type] == "sale_item"
|
||||
if from.present? && to.present?
|
||||
|
||||
if from != "" && to != ""
|
||||
|
||||
f_date = DateTime.parse(params[:from])
|
||||
t_date = DateTime.parse(params[:to])
|
||||
f_date = DateTime.parse(from)
|
||||
t_date = DateTime.parse(to)
|
||||
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
|
||||
@@ -83,59 +81,6 @@ class BaseReportController < ActionController::Base
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
else # end daily sale report
|
||||
if period_type.to_i == 1
|
||||
|
||||
if params[:from] != "" && params[:to] !=""
|
||||
|
||||
f_date = DateTime.parse(params[:from])
|
||||
t_date = DateTime.parse(params[:to])
|
||||
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
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
end
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
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
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ class Crm::CustomersController < BaseCrmController
|
||||
# GET /crm/customers.json
|
||||
def index
|
||||
filter = params[:filter]
|
||||
|
||||
if filter.nil?
|
||||
@crm_customers = Customer.all
|
||||
else
|
||||
@@ -49,21 +48,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
# get member information
|
||||
total = Customer.get_member_account(@customer)
|
||||
|
||||
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
if total["status"]==true
|
||||
total["data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
# @accountable_type = res["accountable_type"]
|
||||
@accountable_type = "Rebate Balance"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
@@ -95,10 +80,10 @@ class Crm::CustomersController < BaseCrmController
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
paypar_account_no = customer_params[:paypar_account_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if member_group_id.present?
|
||||
puts "aaaaaaaaa"
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
@@ -109,6 +94,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
paypar_account_no: paypar_account_no,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
@@ -119,18 +105,18 @@ class Crm::CustomersController < BaseCrmController
|
||||
)
|
||||
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Can't open membership server "}
|
||||
response = {"status" => false, "message" => "Can't open membership server "}
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
|
||||
response = { status: false , message: "Can't open membership server "}
|
||||
response = {"status" => false, "message" => "Can't open membership server "}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
response = {"status" => false, "message" => "Can't open membership server "}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
end
|
||||
response = {"status" => false, "message" => "Can't open membership server "}
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
@@ -145,9 +131,9 @@ class Crm::CustomersController < BaseCrmController
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_type:member_group_id )
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response[:message]}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response["message"]}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response[:message] }
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' + response["message"] }
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -186,6 +172,7 @@ end
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
paypar_account_no = customer_params[:paypar_account_no]
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
@@ -201,6 +188,7 @@ end
|
||||
response = HTTParty.post(url,
|
||||
:body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
paypar_account_no: paypar_account_no,
|
||||
card_no:card_no,member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
@@ -245,6 +233,7 @@ end
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
paypar_account_no: paypar_account_no,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
@@ -301,6 +290,6 @@ end
|
||||
def customer_params
|
||||
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
|
||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
table_id = params[:table_id]
|
||||
|
||||
status = queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
status = DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
# status = DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
|
||||
|
||||
if status == true
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class Crm::HomeController < BaseCrmController
|
||||
def index
|
||||
|
||||
# @booking = Booking.all
|
||||
# @customer = Customer.all
|
||||
# from = Time.now.beginning_of_day.utc
|
||||
# to = Time.now.end_of_day.utc
|
||||
# @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
|
||||
redirect_to crm_customers_path
|
||||
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
@booking = Booking.all
|
||||
@customer = Customer.all
|
||||
from = Time.now.beginning_of_day.utc
|
||||
to = Time.now.end_of_day.utc
|
||||
@queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
|
||||
redirect_to crm_customers_path
|
||||
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ class HomeController < ApplicationController
|
||||
session[:session_token] = @employee.token_session
|
||||
route_by_role(@employee)
|
||||
else
|
||||
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
||||
flash[:notice] ="Invalid PIN for Employee. Please try again!"
|
||||
render :show
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,9 +42,12 @@ class HomeController < ApplicationController
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "accountant"
|
||||
elsif @employee.role == "supervisour"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "account"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to reports_dailysale_index_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
@@ -65,6 +69,8 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
# clear in employee session
|
||||
Employee.logout(session[:session_token])
|
||||
session[:session_token] = nil
|
||||
redirect_to root_path
|
||||
end
|
||||
@@ -93,12 +99,15 @@ class HomeController < ApplicationController
|
||||
redirect_to new_origami_shift_path
|
||||
end
|
||||
elsif employee.role == "manager"
|
||||
redirect_to oqs_root_path
|
||||
redirect_to dashboard_path
|
||||
elsif employee.role == "waiter"
|
||||
redirect_to oqs_root_path
|
||||
elsif employee.role == "crm"
|
||||
redirect_to crm_root_path
|
||||
|
||||
elsif @employee.role == "supervisour"
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "account"
|
||||
redirect_to reports_dailysale_index_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,6 +26,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||
end
|
||||
|
||||
# @queue_items_details = @queue_items_details.paginate(:per_page => 10, :page => params[:page])
|
||||
@queue_stations_items
|
||||
end
|
||||
|
||||
@@ -99,6 +100,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
.order("assigned_order_items.created_at")
|
||||
end
|
||||
|
||||
# Completed Order
|
||||
@@ -112,8 +114,10 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
.group("assigned_order_items.order_id")
|
||||
.limit(20)
|
||||
.order("assigned_order_items.created_at")
|
||||
|
||||
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
|
||||
@@ -50,12 +50,22 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
def update_sale_by_customer
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
customer_id = params[:customer_id]
|
||||
|
||||
# Check and find with card no
|
||||
if(!customer_id.include? "CUS")
|
||||
customer = Customer.find_by_paypar_account_no(customer_id)
|
||||
if(customer != nil)
|
||||
customer_id = customer.customer_id
|
||||
end
|
||||
end
|
||||
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
status = sale.update_attributes(customer_id: customer_id)
|
||||
sale.sale_orders.each do |sale_order|
|
||||
order = Order.find(sale_order.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
status = order.update_attributes(customer_id: customer_id)
|
||||
end
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@@ -63,7 +73,7 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
|
||||
@orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
status = order.update_attributes(customer_id: customer_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@accounts = Account.all
|
||||
end
|
||||
|
||||
@@ -42,6 +42,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale_item.unit_price = di["price"]
|
||||
sale_item.taxable_price = di["price"]
|
||||
sale_item.is_taxable = 0
|
||||
sale_item.account_id = origin_sale_item.account_id
|
||||
|
||||
sale_item.price = di["price"]
|
||||
sale_item.save
|
||||
@@ -49,11 +50,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
render :json => dining.to_json
|
||||
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
# Remove selected discount Items
|
||||
@@ -78,11 +82,12 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.save
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
||||
end
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
|
||||
render :json => dining.to_json
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
# Remove all discount Items
|
||||
@@ -92,13 +97,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
discount_items = []
|
||||
#destroy all discount sale item
|
||||
sale.sale_items.each do |si|
|
||||
if si.remark == "Discount" && si.price < 0
|
||||
sale.total_amount = (sale.total_amount + si.price.abs)
|
||||
si.destroy
|
||||
sale.sale_items.each do |si|
|
||||
if si.remark == "Discount" && si.price < 0
|
||||
sale.total_amount = (sale.total_amount + si.price.abs)
|
||||
discount_items.push(si)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -106,13 +112,99 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||
# sale.save
|
||||
|
||||
#destroy in sale.sale_items
|
||||
sale.sale_items.destroy(discount_items)
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
# Member Discount
|
||||
def member_discount
|
||||
sale_id = params[:sale_id]
|
||||
# account_types = JSON.parse(params[:account_types])
|
||||
account_types = Account.where("discount=?",true)
|
||||
sub_total = params[:sub_total]
|
||||
sale = Sale.find(sale_id)
|
||||
price = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
|
||||
arr = Array.new;
|
||||
|
||||
account_types.each do |at|
|
||||
price.each do |pc|
|
||||
if pc[:name] == at.title && pc[:price]>0
|
||||
str={type:pc[:name],amount:pc[:price]}
|
||||
arr.push(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
generic_customer_id = sale.customer.membership_id
|
||||
|
||||
render :json => dining.to_json
|
||||
receipt_no = sale.receipt_no
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("member_discount")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => { account_no: nil,
|
||||
generic_customer_id:generic_customer_id ,
|
||||
campaign_type_id: campaign_type_id,
|
||||
receipt_no: receipt_no,
|
||||
merchant_uid:merchant_uid,
|
||||
campaign_method:arr.to_json,
|
||||
total_sale_transaction_amount: sale.grand_total,
|
||||
auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}, :timeout => 10)
|
||||
rescue HTTParty::Error
|
||||
response = {:status=> false, :message => "Can't open membership server " }
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
response = {:status=> false, :message => "Can't open membership server " }
|
||||
rescue OpenURI::HTTPError
|
||||
response = {:status=> false, :message => "Can't open membership server " }
|
||||
|
||||
rescue SocketError
|
||||
response = {:status=> false, :message => "Can't open membership server " }
|
||||
end
|
||||
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
if response["status"] == true
|
||||
discount_amount = response["discount_earned"]
|
||||
if response["discount_bonus_earned"]
|
||||
discount_amount = discount_amount + response["discount_bonus_earned"]
|
||||
end
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount')
|
||||
result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
|
||||
if response["status"] == "500"
|
||||
result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
if !response.nil?
|
||||
if response[:status] == false
|
||||
result = {:status=> response[:message],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
#discount for selected order
|
||||
|
||||
@@ -4,7 +4,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
def index
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@complete = Sale.where("sale_status != 'new'")
|
||||
@orders = Order.all.order('date desc')
|
||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
@@ -13,7 +13,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@complete = Sale.where("sale_status != 'new'")
|
||||
@orders = Order.all.order('date desc')
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
|
||||
@@ -44,12 +44,14 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
change_to = params[:change_to] #new
|
||||
change_from = params[:change_from] #original
|
||||
bookings = Booking.where('dining_facility_id=?',change_from)
|
||||
|
||||
booking_array = Array.new
|
||||
bookings.each do | booking |
|
||||
if booking.sale_id.nil? || booking.sale.sale_status != 'completed' || booking.booking_status != 'moved'
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
booking_array.push(booking)
|
||||
end
|
||||
end
|
||||
|
||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@complete = Sale.where("sale_status != 'new'")
|
||||
@orders = Order.all.order('status desc')
|
||||
@order = Order.find(params[:order_id])
|
||||
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
||||
|
||||
@@ -37,6 +37,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_item.unit_price = di["price"]
|
||||
sale_item.taxable_price = 0
|
||||
sale_item.is_taxable = 0
|
||||
sale_item.account_id = 0
|
||||
|
||||
sale_item.price = di["price"]
|
||||
sale_item.save
|
||||
|
||||
@@ -6,6 +6,8 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
||||
@sale_id = params[:sale_id]
|
||||
@payment_method_setting = PaymentMethodSetting.all
|
||||
|
||||
@rebate = MembershipSetting.find_by_rebate(1)
|
||||
|
||||
# @sale_id = params[:sale_id]
|
||||
# sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
customer= Customer.find(sale_data.customer_id)
|
||||
# get member information
|
||||
if customer.membership_id != nil
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
end
|
||||
# get printer info
|
||||
@@ -55,7 +56,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
if customer.membership_id != nil
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
end
|
||||
@@ -67,10 +69,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||
|
||||
|
||||
end
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -87,12 +87,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
@table_no = ''
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
# get member information
|
||||
if @customer.membership_id != nil
|
||||
if @customer.membership_id != nil && rebate
|
||||
response = Customer.get_member_account(@customer)
|
||||
if response["status"]==true
|
||||
response["data"].each do |res|
|
||||
@@ -107,6 +108,12 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
#end customer amount
|
||||
|
||||
@sale_data.bookings.each do |sbk|
|
||||
df = DiningFacility.find(sbk.dining_facility_id)
|
||||
@table_no = df.type + ' ' + df.name
|
||||
break
|
||||
end
|
||||
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
@cash = spay.payment_amount
|
||||
@@ -140,7 +147,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
if customer.membership_id != nil
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
end
|
||||
|
||||
@@ -5,19 +5,24 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
order_id = params[:id] # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
# puts "current_login_employee"
|
||||
# puts current_login_employee.name
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
if ShiftSale.current_open_shift(current_user.id)
|
||||
order_id = params[:id] # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
# puts "current_login_employee"
|
||||
# puts current_login_employee.name
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||
end
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift for This Employee"
|
||||
end
|
||||
|
||||
# Not Use for these printed bill cannot give customer
|
||||
|
||||
@@ -3,7 +3,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@complete = Sale.where("sale_status != 'new'")
|
||||
@orders = Order.all.order('date desc')
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@sale_array = Array.new
|
||||
@@ -31,9 +31,6 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
puts "hhhhhhhhhh"
|
||||
puts @status
|
||||
puts @obj.to_json
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem.is_taxable = 1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
# def item_edit
|
||||
@@ -56,6 +60,10 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# saleitemObj.remark = 'edit'
|
||||
saleitemObj.product_name = saleitemObj.product_name + " - updated"
|
||||
saleitemObj.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
|
||||
@@ -71,13 +79,17 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
saleitemObj.destroy
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
# remove all void items
|
||||
def cancel_all_void
|
||||
sale_id = params[:sale_id]
|
||||
saleobj = Sale.find(sale_id)
|
||||
saleobj.sale_items.each do |item|
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.sale_items.each do |item|
|
||||
if item.qty.to_i < 0
|
||||
item.destroy
|
||||
else
|
||||
@@ -85,6 +97,9 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
end
|
||||
item.save
|
||||
end
|
||||
|
||||
# re-calc tax
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
def apply_void
|
||||
|
||||
@@ -3,7 +3,7 @@ class Origami::SalesController < BaseOrigamiController
|
||||
def show
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@complete = Sale.where("sale_status != 'new'")
|
||||
@orders = Order.all.order('date desc')
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
end
|
||||
|
||||
@@ -4,8 +4,6 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def show
|
||||
puts ">>>>>"
|
||||
puts current_user.id
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
|
||||
@@ -32,18 +30,29 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
|
||||
unique_code = "CloseCashierPdf"
|
||||
shop_details = Shop.find(1)
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
printer.print_close_cashier(print_settings,@shift,shop_details)
|
||||
printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes)
|
||||
|
||||
|
||||
end
|
||||
|
||||
Employee.logout(session[:session_token])
|
||||
session[:session_token] = nil
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def sale_summary
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -3,12 +3,21 @@ class Origami::VoidController < BaseOrigamiController
|
||||
def overall_void
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
# update count for shift sale
|
||||
if(sale.sale_status == "void")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
end
|
||||
|
||||
bookings = sale.bookings
|
||||
bookings.each do |booking|
|
||||
orders = booking.orders
|
||||
|
||||
19
app/controllers/reports/bksaleitem_controller.rb
Normal file
19
app/controllers/reports/bksaleitem_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Reports::SaleitemController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,9 +2,12 @@ class Reports::DailysaleController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
|
||||
def index
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
from, to = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
@tax = SaleTax.get_tax(from,to)
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
class Reports::ReceiptNoController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
from, to = get_date_range_from_params
|
||||
puts "from..."
|
||||
puts from
|
||||
puts "to..."
|
||||
puts to
|
||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@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)
|
||||
else
|
||||
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
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)
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
if @shift.present?
|
||||
@shift.each do |sh|
|
||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = sh
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
@@ -15,6 +39,25 @@ authorize_resource :class => false
|
||||
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
|
||||
@@ -2,9 +2,43 @@ class Reports::SaleitemController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
from, to = get_date_range_from_params
|
||||
shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
||||
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)
|
||||
else
|
||||
|
||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
@sale_data, @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)
|
||||
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
|
||||
|
||||
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
||||
|
||||
@menu_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
@sale_data.each {|cate| @menu_cate_count[cate.menu_category_id] += 1}
|
||||
|
||||
|
||||
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
if shift.present?
|
||||
shift.each do |sh|
|
||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = sh
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
@@ -13,7 +47,26 @@ class Reports::SaleitemController < BaseReportController
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
from, to, report_type = 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
|
||||
|
||||
@@ -3,16 +3,48 @@ class Reports::ShiftsaleController < BaseReportController
|
||||
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
@sale_data = Sale.get_by_shiftsales(from,to)
|
||||
respond_to do |format|
|
||||
from, to = get_date_range_from_params
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
@shift = ShiftSale.find(params[:shift_name])
|
||||
end
|
||||
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
|
||||
@from = from
|
||||
@to = to
|
||||
if @shift.present?
|
||||
|
||||
@shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = @shift
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -70,6 +70,6 @@ class Settings::MembershipSettingsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_membership_setting_params
|
||||
params.require(:membership_setting).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by)
|
||||
params.require(:membership_setting).permit(:membership_type, :is_active,:discount,:rebate,:bonus,:point, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user