Merge branch 'master' into license

This commit is contained in:
Yan
2017-11-17 10:25:32 +06:30
46 changed files with 1380 additions and 206 deletions

View File

@@ -339,13 +339,14 @@ $(function(){
$(".sx_item_set_detailModal").css({ 'display': "none" });
}else{
$(".sx_item_set_detailModal").css({ 'display': "block" });
$.alert({
title: 'Alert!',
content: 'Please Select Minimum ' + min_qty + " items",
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal("Alert !", 'Please Select Minimum ' + min_qty + " items", "warning");
// $.alert({
// title: 'Alert!',
// content: 'Please Select Minimum ' + min_qty + " items",
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
}
}); //End add order Click
@@ -420,7 +421,7 @@ $(function(){
for(var field in attributes) {
value = attributes[field]["values"];
type = attributes[field]["type"]
row = "<h4>"+attributes[field]["type"]+"</h4>";
row = "<h5>"+attributes[field]["type"]+"</h5>";
$(value).each(function(i){
disabled = ""
@@ -794,11 +795,10 @@ $(function(){
// Get Selected Class
function change_qty_plus_minus(id,plus,minus) {
var count = 1;
var count = parseInt($('#'+id).val())
var countEl = document.getElementById(id);
$('#'+plus).on("click", function(){
count++;
countEl.value = count;
@@ -852,6 +852,37 @@ $(function(){
}
})
}
$('.keypress_qty').keyup(function(e){
id = $(this).attr('id');
value = $(this).val();
if (id=="count") {
price = $("#unit_price").text();
$("#total_price").text(value*price);
}else{
var item_row = $('.selected-instance');
price = $("#set_unit_price").text();
set_total_price = $("#set_total_price").text();
$("#set_count").val(value);
if (item_row.length > 1) {
total = 0 ;
$(item_row).each(function(i){
total += value * $(item_row[i]).attr('data-price');
total_price = total;
});
}else{
total_price = value*price;
}
$("#set_total_price").text(total_price);
}
});
/* $("input").keypress(function(){
$("span").text(i += 1);
});*/
// $("#set_change_qty").change(function(){
// qty = $(this).val();
// price = $("#set_total_price").text();

View File

@@ -2,8 +2,6 @@ $(document).ready(function() {
$('body').bootstrapMaterialDesign();
var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight()));
console.log(height);
console.log($('#order-detail-slimscroll').attr('data-height'))
$('#custom-slimscroll').slimScroll({
height: height,

View File

@@ -87,3 +87,29 @@
}
.cashier_number{
width: 33%;
height:58px;
line-height:58px;
text-align:center;
background:#54A5AF;
// float:left;
// margin:2px;
font-size:20px;
color:white;
// cursor:pointer;
}
.red {
background-color:#F44336;
}
.green{
background-color: #009900;
}
.left{
margin-left:1px;
}
.bottom{
margin-bottom:1px;
}

View File

@@ -152,6 +152,10 @@ section.content{
}
#count {
#count ,#set_count{
text-align: center;
}
.add_icon{
cursor: pointer;
}

View File

@@ -139,6 +139,13 @@ select.form-control {
background-color:#795548;
}
.others-color{
background-color:#E1BEE7;
height: 30px !important;
line-height: 30px !important;
}
.cashier_number:hover{
background:#A9F5F2;
}

View File

@@ -0,0 +1,78 @@
class Api::CheckInProcessController < Api::ApiController
def check_in_process
if params[:dining_id]
dining_facility = DiningFacility.find(params[:dining_id])
if dining_facility.status == "available"
dining_charge = DiningCharge.select('charge_type','charge_block')
.where('dining_facility_id = ?',params[:dining_id])
.first()
checkout_at = Time.now.utc
if !dining_charge.nil?
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
# if dining_charge.charge_type == 'hr'
checkout_at = checkout_at + hr.hour + min.minutes
# else
# end
end
dining_facility.status = "occupied"
dining_facility.save!
if dining_facility.type == "Table"
type = "TableBooking"
else
type = "RoomBooking"
end
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
booking.save!
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }
else
error_message = "#{dining_facility.type} is not available!"
render :json => { :status => false, :error_message => error_message }
end
else
error_message = "dining_id is required!"
render :json => { :status => false, :error_message => error_message }
end
end
def request_time
if !params[:booking_id].nil? && !params[:time].nil?
time = Time.parse(params[:time])
booking = Booking.find(params[:booking_id])
checkout_at = booking.checkout_at.utc
hr = (time.strftime("%H").to_i).to_int
min = (time.strftime("%M").to_i).to_int
checkout_at = checkout_at + hr.hour + min.minutes
booking.checkout_at = checkout_at
booking.save!
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }
elsif !params[:booking_id].nil? && params[:time].nil?
error_message = "time is required!"
render :json => { :status => false, :error_message => error_message }
elsif params[:booking_id].nil? && !params[:time].nil?
error_message = "booking_id is required!"
render :json => { :status => false, :error_message => error_message }
else
error_message = "booking_id and time are required!"
render :json => { :status => false, :error_message => error_message }
end
end
private
def check_in_process_params
params.permit(:dining_id,:booking_id,:time)
end
end

View File

@@ -33,7 +33,7 @@ class Crm::CustomersController < BaseCrmController
end
end
end
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(15)
@crm_customer = Customer.new
@count_customer = Customer.count_customer
@@ -70,7 +70,7 @@ class Crm::CustomersController < BaseCrmController
#get customer amount
@customer = Customer.find(params[:id])
@response = Customer.get_membership_transactions(@customer)
puts @response.to_json
# @response = ""
#end customer amount

View File

@@ -7,6 +7,7 @@ class Crm::DiningQueuesController < BaseCrmController
def index
today = DateTime.now.strftime('%Y-%m-%d')
@dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and status is NULL ", today).order("queue_no asc")
@complete_queue = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and status = 'Assign' ", today).order("queue_no asc")
end
# GET /crm/dining_queues/1

View File

@@ -68,24 +68,49 @@ class HomeController < ApplicationController
@sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
@top_products = Sale.top_products(today).sum('i.qty')
@bottom_products = Sale.bottom_products(today).sum('i.qty')
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
# .sum(:grand_total)
@employee_sales = Sale.employee_sales(today).sum(:grand_total)
@inventories = StockJournal.inventory_balances(today).sum(:balance)
#@employee_sales = Hash.new
#employee_sales.each do |key, value|
# if(@employee_sales.has_key? key[1])
# @employee_sales[key[1]].push({key[0] => value})
# else
# @employee_sales[key[1]] = [key[0] => value]
# end
#end
@total_sale = Sale.total_sale(today)
@total_count = Sale.total_count(today)
@total_card = Sale.total_card_sale(today)
@total_credit = Sale.credit_payment(today)
@total_credit = Sale.credit_payment(today)
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(today)
@total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
pay = Sale.payment_sale('card', today)
@sale_data.push({'card' => pay})
else
pay = Sale.payment_sale(payment.payment_method, today)
@sale_data.push({payment.payment_method => pay})
end
end
@summ_sale = Sale.summary_sale_receipt(today)
p @summ_sale
@total_customer = Sale.total_customer(today)
@total_dinein = Sale.total_dinein(today)
@total_takeaway = Sale.total_takeaway(today)
@total_other_customer = Sale.total_other_customer(today)
@total_membership = Sale.total_membership(today)
@total_order = Sale.total_order(today)
@total_accounts = Sale.total_account(today)
@account_data = Array.new
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
@top_items = Sale.top_items(today)
@total_foc_items = Sale.total_foc_items(today)
end
def destroy

View File

@@ -0,0 +1,38 @@
class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process
dining_charge = DiningCharge.select('charge_type','charge_block')
.where('dining_facility_id = ?',params[:dining_id])
.first()
checkout_at = Time.now.utc
if !dining_charge.nil?
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
# if dining_charge.charge_type == 'hr'
checkout_at = checkout_at + hr.hour + min.minutes
# else
# end
end
@dining_facility = DiningFacility.find(params[:dining_id])
@dining_facility.status = "occupied"
@dining_facility.save!
if @dining_facility.type == "Table"
type = "TableBooking"
else
type = "RoomBooking"
end
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
@booking.save!
respond = {:status => 'ok'}
respond_to do |format|
format.json { render json: respond }
end
end
end

View File

@@ -215,7 +215,7 @@ class Origami::DiscountsController < BaseOrigamiController
else
response = {"status": false, "message": "You have no selected discount item" }
end
puts "discount"
puts "discountttttttttttt"
puts response.to_json
# Re-calc All Amount in Sale
if response["status"] == true

View File

@@ -7,7 +7,7 @@ class Origami::HomeController < BaseOrigamiController
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc')
@shop = Shop.find_by_id(1)
# @shift = ShiftSale.current_open_shift(current_user.id)
end
@@ -23,10 +23,12 @@ class Origami::HomeController < BaseOrigamiController
@sale_array = Array.new
@dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
booking.booking_orders.each do |booking_order|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
if booking.booking_orders.empty?
@booking = booking
else
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if (order.status == "new")
@obj_order = order
@@ -43,29 +45,30 @@ class Origami::HomeController < BaseOrigamiController
@account_arr.push(account)
end
end
end
@status_order = 'order'
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" && sale.sale_status != 'void'
@sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'
end
@booking= booking
@date = sale.created_at
@status_sale = 'sale'
@obj_sale = sale
@customer = sale.customer
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end
end
end
@status_order = 'order'
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" && sale.sale_status != 'void'
@sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'
end
@booking= booking
@date = sale.created_at
@status_sale = 'sale'
@obj_sale = sale
@customer = sale.customer
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end
end
end
end

View File

@@ -9,6 +9,7 @@ class Origami::RequestBillsController < ApplicationController
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"

View File

@@ -10,12 +10,12 @@ class Transactions::BookingsController < ApplicationController
if filter.nil? && from.nil? && to.nil?
@bookings = Booking.all.order("sale_id desc")
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20)
else
sale = Sale.search(filter,from,to)
if sale.count > 0
@bookings = sale
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
booking = Booking.search(filter,from,to)
if booking.count > 0
@bookings = booking
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20)
else
@bookings = 0
end

View File

@@ -0,0 +1,61 @@
class Transactions::ShiftSalesController < ApplicationController
load_and_authorize_resource except: [:create]
before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy]
def index
filter = params[:filter]
from = params[:from]
to = params[:to]
if filter.nil? && from.nil? && to.nil?
@shift_sales = ShiftSale.all.order("id desc")
@shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20)
else
shift_sale = ShiftSale.search(filter,from,to)
if shift_sale.count > 0
@shift_sales = shift_sale
@shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20)
else
@shift_sales = 0
end
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @shift_sales }
end
end
# 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='')
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@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
format.json { render json: @shift }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_shift_sale
@transactions_shift_sale = ShiftSale.find(params[:id])
end
end

View File

@@ -45,14 +45,14 @@ class Booking < ApplicationRecord
if filter.blank?
keyword = ''
else
keyword = "booking_id LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%"
keyword = "booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%"
end
if from.present? && to.present?
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
query = sale.where(keyword)
booking = Booking.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ? and NOT booking_status = 'void' ", from,to)
query = booking.where(keyword)
else
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",)
where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
end
end

View File

@@ -32,7 +32,7 @@ class DiningFacility < ApplicationRecord
end
def get_current_booking
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_by is null").limit(1) #and checkout_at is null
if booking.count > 0 then
return booking[0]
else
@@ -65,4 +65,32 @@ class DiningFacility < ApplicationRecord
return nil
end
end
def get_current_checkout_booking
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is not null and checkout_by is null").limit(1)
if booking.count > 0 then
return booking[0]
else
return nil
end
end
def get_checkout_booking
booking = self.get_current_checkout_booking
if booking
now = Time.now.utc
hr = (now.strftime("%H").to_i).to_int
min = (now.strftime("%M").to_i).to_int
checkout_at = booking.checkout_at.utc
checkout_at = checkout_at - hr.hour
checkout_at = checkout_at - min.minutes
checkout_at = checkout_at.utc.strftime("%M").to_i
if checkout_at <= 15
return booking
end
end
end
end

View File

@@ -907,7 +907,17 @@ end
.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+
"and payment_status='paid' and sale_status= 'completed'")
.group('mi.name')
.order("SUM(i.qty) DESC").limit(5)
.order("SUM(i.qty) DESC").limit(10)
end
def self.bottom_products(today)
query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," +
" i.price as unit_price,mi.name as product_name")
.joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code")
.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+
"and payment_status='paid' and sale_status= 'completed'")
.group('mi.name')
.order("SUM(i.qty) ASC").limit(10)
end
def self.hourly_sales(today)
@@ -941,9 +951,9 @@ end
# .joins("join sale_payments on sale_id = sales.sale_id")
# .group("sales.sale_id")
query = SalePayment.where('s.sale_status = "completed" and payment_method = "mpu" or payment_method = "visa" or payment_method = "master" or payment_method = "jcb" and DATE_FORMAT(s.receipt_date,"%Y-%m-%d") = ?',today)
.joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id")
.sum("payment_amount")
query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb"',today)
.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
.sum("sp.payment_amount")
end
@@ -953,6 +963,99 @@ end
.sum("payment_amount")
end
def self.summary_sale_receipt(today)
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
.where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today)
.first()
end
def self.total_payment_methods(today)
query = Sale.select("sp.payment_method")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
end
def self.payment_sale(payment_method, today)
query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
if payment_method == 'card'
query = query.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb"',today)
else
query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
end
query.sum("sp.payment_amount")
end
def self.total_customer(today)
query = Sale.select("count(distinct sales.customer_id) as total_cus")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
.first()
end
def self.total_dinein(today)
query = Sale.select("count(distinct sales.customer_id) as total_dinein_cus")
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Dinein" and c.membership_id is null',today)
.first()
end
def self.total_takeaway(today)
query = Sale.select("count(distinct sales.customer_id) as total_take_cus")
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Takeaway" and c.membership_id is null',today)
.first()
end
def self.total_membership(today)
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Takeaway" and c.membership_id is not null',today)
.first()
end
def self.total_other_customer(today)
query = Sale.select("count(distinct sales.customer_id) as total_cus")
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
.first()
end
def self.total_order(today)
query = Sale.select("count(distinct a.order_id) as total_order")
.joins("JOIN sale_orders as a ON a.sale_id = sales.sale_id")
.joins("JOIN orders as b ON b.order_id = a.order_id")
.where('b.status = "billed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
.first()
end
def self.total_account(today)
query = Sale.select("distinct b.id as account_id, b.title as title")
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
.joins("JOIN accounts as b ON b.id = a.account_id")
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
end
def self.account_data(account_id, today)
query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc")
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
.first()
end
def self.top_items(today)
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
.where("sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
.group("a.product_code")
.order("SUM(a.price) DESC")
.first()
end
def self.total_foc_items(today)
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
.where("sales.sale_status = 'completed' and a.remark='foc' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
.count()
end
private
def generate_custom_id

View File

@@ -264,8 +264,6 @@ class SalePayment < ApplicationRecord
end
def sale_update_payment_status(paid_amount)
puts paid_amount
puts "parid Masssssssssssssssssssssssssssssssssssssssss"
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.save!
@@ -316,8 +314,6 @@ class SalePayment < ApplicationRecord
self.sale.rebate_status = nil
end
end
puts "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"
puts response.to_json
end
self.sale.save!
@@ -375,7 +371,8 @@ class SalePayment < ApplicationRecord
paypar.each do |pp|
if pp.payment_method == "paypar"
payparcost = payparcost + pp.payment_amount
elsif pp.payment_method == "creditnote"
end
if pp.payment_method == "creditnote"
credit = 1
end
end
@@ -410,7 +407,9 @@ class SalePayment < ApplicationRecord
rescue SocketError
response = { "status": false, "message": "Can't connect server"}
end
puts response.to_json
puts payparcost
puts overall_dis
redeem_amount = payparcost + overall_dis
total_percentage = 0
@@ -431,15 +430,19 @@ class SalePayment < ApplicationRecord
data = {:type => a[:type], :amount => a[:amount]}
type_arr.each do |si|
if si[:type] == a[:type]
amount = (redeem_amount / total_percentage)*si[:percentage]
actual = a[:amount] - amount
data[:amount] = actual
if credit == 1
data[:amount] = 0
else
amount = (redeem_amount / total_percentage)*si[:percentage]
actual = a[:amount] - amount
data[:amount] = actual
end
end
end
rebate_arr.push(data)
end
total_amount = rebate_prices - payparcost - overall_dis
if credit == 1
@@ -485,6 +488,7 @@ class SalePayment < ApplicationRecord
response = { "status": "no_member", "message": "Not membership"}
end
end

View File

@@ -135,4 +135,20 @@ class ShiftSale < ApplicationRecord
end
def self.search(filter,from,to)
if filter.blank?
keyword = ''
else
keyword = "booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%"
end
if from.present? && to.present?
booking = ShiftSale.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ? and NOT booking_status = 'void' ", from,to)
query = booking.where(keyword)
else
where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
end
end
end

View File

@@ -22,7 +22,7 @@
str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error" style="margin-top:-6px"><%= str %></lable>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end -%>
</div>
@@ -45,7 +45,7 @@
<% str="[\"#{msg['company']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error" style="margin-top:-6px"><%= str %></lable>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end -%>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
@@ -55,7 +55,7 @@
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error" style="margin-top:-6px"><%= str %></lable>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
@@ -66,7 +66,7 @@
<% str="[\"#{msg['email']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error" style="margin-top:-6px"><%= str %></lable>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
@@ -107,7 +107,7 @@
<% str="[\"#{msg['card_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error" style="margin-top:-6px"><%= str %></lable>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>

View File

@@ -36,6 +36,7 @@
</tr>
</thead>
<tbody>
<tr>
<td><%= @customer.card_no rescue '-'%></td>
@@ -43,9 +44,9 @@
<td><%= @customer.company rescue '-' %></td>
<td><%= @customer.contact_no %></td>
<td><%= @customer.email %></td>
<td><%= @customer.nrc_no %></td>
<td><%= @customer.address%></td>
<td><%= @customer.date_of_birth %></td>
<td><%= @customer.nrc_no rescue '-' %></td>
<td><%= @customer.address rescue '-'%></td>
<td><%= @customer.date_of_birth rescue '-'%></td>
<% if @customer.membership_type.to_f > 0%>
<td><%lookup= Lookup.find_by_value(@customer.membership_type) %>
<%= lookup.name %>
@@ -80,7 +81,7 @@
<tr>
<td><%= transaction["date"]%></td>
<!-- <td><%= transaction["redeem"]%></td> -->
<td><%= transaction["rebate"] %></td>
<td><%= transaction["deposit"] %></td>
<!-- <td><%= transaction["balance"] %></td> -->
<td><%= transaction["account_status"] %></td>
<td><%= transaction["status"] %></td>
@@ -104,7 +105,6 @@
<tr>
<th><%= t("views.right_panel.detail.order_id") %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.order_status") %></th>
<th><%= t("views.right_panel.detail.order_date") %></th>
<th><%= t("views.right_panel.detail.items_count") %></th>
@@ -114,10 +114,10 @@
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= order.order_id %></td>
<td><%= link_to order.order_id, transactions_order_path(order) %></td>
<td><%= order.order_type %></td>
<td><%= order.status %></td>
<td><%= order.date.strftime("%d-%m-%Y") %> </td>
<td><%= order.date.strftime("%d-%m-%Y %I:%m %p") %> </td>
<td><%= order.item_count %> </td>
</tr>
<% end %>
@@ -146,13 +146,13 @@
<tbody>
<% @sales.each do |sale| %>
<tr>
<td><%= sale.sale_id %></td>
<td><%= link_to sale.sale_id, transactions_sale_path(sale) %></td>
<td><%= sale.receipt_no %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.total_tax %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
<td> <%= sale.receipt_date.strftime("%d-%m-%Y %I:%m %p") %> </td>
</tr>
<% end %>
</tbody>

View File

@@ -1,27 +1,83 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<%= simple_form_for([:crm,@dining_queue]) do |f| %>
<%= f.error_notification %>
<p class="hidden generate_no"><%= @queue_no %></p>
<div class="col-md-6">
<!-- <div class="col-md-6"> -->
<div class="form-inputs">
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
<%= f.input :name %>
<%= f.input :contact_no %>
<%= f.input :seater %>
<%= f.input :remark %>
</div>
<br>
<div class="form-actions">
<%= f.button :submit,"Create Queue" ,:class=>"btn btn-primary bg-blue btn-lg waves-effect"%>
<%= f.submit t('views.btn.submit'),:class => 'btn btn-primary btn-lg waves-effect' %>
</div>
</div>
<!-- </div> -->
<% end %>
</div>
<div class="col-xs-12 col-sm-12 col-md-93 col-lg-3">
<div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="p-l-20 m-t-60">
<div class="row bottom">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 m-l--5">
<div class="row m-l--5">
<div class="col-md-3 left cashier_number" data-value="1" data-type="num">1</div>
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
</div>
</div>
</div>
<div class="row bottom">
<div class="col-md-12 m-l--5">
<div class="row m-l--5">
<div class="col-md-3 left cashier_number" data-value="4" data-type="num">4</div>
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
</div>
</div>
</div>
<div class="row bottom">
<div class="col-md-12 m-l--5">
<div class="row m-l--5">
<div class="col-md-3 left cashier_number" data-value="7" data-type="num">7</div>
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
</div>
</div>
</div>
<div class="row bottom">
<div class="col-md-12 m-l--5">
<div class="row m-l--5">
<div class="col-md-3 left cashier_number" data-value="0" data-type="num">0</div>
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
</div>
</div>
</div>
<div class="row bottom">
<div class="col-md-12 m-l--5">
<div class="row m-l--5">
<div class="col-md-3 left cashier_number"></div>
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<div class="card">
<div class="body">
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
@@ -50,9 +106,55 @@
<script type="text/javascript">
$(document).ready(function(){
if($('form').attr('id') == "new_dining_queue"){
if($('form').attr('id') == "new_dining_queue"){
var queue_no = $('.generate_no').text();
$('#dining_queue_queue_no').val(queue_no);
}
}
$( "input" ).focusin(function() {
$('.addfocus').removeClass('addfocus');
$( this ).addClass('addfocus');
});
$(".cashier_number").on('click', function(event){
if(event.handled !== true) {
var original_value='';
original_value = $('.addfocus').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('.addfocus').val(input_value);
}
else{
$('.addfocus').val(original_value + '' + input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value);
$('.addfocus').val(amount);
break;
case 'del' :
var discount_text=$('.addfocus').val();
$('.addfocus').val(discount_text.substr(0,discount_text.length-1));
break;
case 'clr':
$('.addfocus').val("");
break;
}
event.handled = true;
} else {
return false;
}
});
});
</script>

View File

@@ -11,42 +11,79 @@
<div class="row">
<!-- Column One -->
<div class="col-lg-11 col-md-11 col-sm-11">
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="tab-content" style="max-height:670px; overflow-y:auto">
<!--- Panel 1 - Table Orders -->
<div class="active" role="tabpanel">
<div class="tab-pane" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @dining_queues.each do |queue| %>
<% if queue.status == "Assign"
@bg_color = "assign"
elsif queue.status == "Cancel"
@bg_color = "cancel"
else
@bg_color = "normal"
end
%>
<div class="card select-queue <%= @bg_color %>" data-id="<%= queue.id %>" style="width: 21.5rem;">
<div class="card-block">
<p class="hidden queue-id"><%= queue.id %></p>
<p class="hidden queue-status"><%= queue.status %></p>
<span class="card-title"><strong> Queue No : <%= queue.queue_no %></strong></span>
<span class="card-title pull-right"><strong> Seater : <%= queue.seater %></strong></span><br>
<span class="card-title"> Name : <%= queue.name %></span><br>
<span class="card-title"> Contact No : <%= queue.contact_no %></span>
<span class="card-title"> Remark : <%= queue.remark %></span>
</div>
</div>
<% end %>
</div>
</div>
<div class="tab-content" style="" id="custom-slimscroll">
<div class="card">
<div class="body">
<% if @dining_queues.count > 0 %>
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @dining_queues.each do |queue| %>
<% if queue.status == "Assign"
@bg_color = "assign"
elsif queue.status == "Cancel"
@bg_color = "cancel"
else
@bg_color = "normal"
end
%>
<div class="card select-queue <%= @bg_color %>" data-id="<%= queue.id %>" style="">
<div class="card-block">
<p class="hidden queue-id"><%= queue.id %></p>
<p class="hidden queue-status"><%= queue.status %></p>
<span class="card-title"><strong> Queue No : <%= queue.queue_no %></strong></span>
<span class="card-title float-right"><strong> Seater : <%= queue.seater %></strong></span><br>
<span class="card-title"> Name : <%= queue.name %></span><br>
<span class="card-title"> Contact No : <%= queue.contact_no %></span><br>
<span class="card-title"> Remark : <%= queue.remark %></span>
</div>
</div>
<% end %>
</div>
</div>
<% else %>
<p>There is no queue Now !</p>
<% end %>
</div>
</div>
</div>
<!-- tabs - End -->
</div>
<div class="col-md-3">
<div class="card">
<div class="body">
<h6><i class="material-icons md-18">view_headline QUEUE DETAILs</i> </h6>
<p>
1) Latest Queue No - <%= @complete_queue.last.queue_no%> <br>
2) Next Queue No - <% @next = @complete_queue.last.queue_no.to_i + 1%>
<%= @next%> <br>
3) Today Completed Queue - <strong> <%= @complete_queue.count %> </strong><br>
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
<p>
1) <%= t("views.right_panel.button.cancel") %>
<%= t("views.right_panel.button.queue") %> -
<%= t("views.right_panel.detail.cancel_btn_txt") %>
<%= t("views.right_panel.detail.queue_txt") %> <br>
2) <%= t("views.btn.new") %>
<%= t("views.right_panel.button.queue") %> -
<%= t("views.right_panel.detail.create_btn_txt") %>
<%= t("views.right_panel.detail.queue_txt") %><br>
2) <%= t("views.btn.assign") %>
<%= t("views.right_panel.button.queue") %> -
<%= t("views.right_panel.detail.assign_txt") %>
<%= t("views.right_panel.detail.queue_txt") %><br>
</p>
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
<p>
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.home_txt") %> <br>
</p>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<%= link_to t("views.btn.new"),new_crm_dining_queue_path,:class => 'btn bg-green btn-block btn-lg btn-block', 'data-no-turbolink' => true %>
@@ -112,3 +149,10 @@ function cancel_queue(id,url) {
}
</script>
<style type="text/css">
.card-columns {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
</style>

View File

@@ -56,9 +56,9 @@
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="card">
<div class="body">
<h4><i class="material-icons md-24">dashboard</i><%= (t :top) + " " + (t :products) %></h4>
@@ -67,6 +67,15 @@
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="card">
<div class="body">
<h4><i class="material-icons md-24">dashboard</i><%= (t :bottom) + " " + (t :products) %></h4>
<!-- <canvas id="top_products" class="col-md-12"></canvas> -->
<%= pie_chart @bottom_products %>
</div>
</div>
</div>
</div>
<!-- <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
@@ -102,13 +111,152 @@
</div>
</div>
</div>
<!-- <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<div class="card">
<div class="body">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<% if !@summ_sale.nil? %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="card">
<div class="body">
<h6>Sale</h6>
<table class="table">
<tr>
<td>Total Receipt : </td>
<td align="right"><%= @summ_sale.total_receipt %></td>
</tr>
<tr>
<td>Total Sale : </td>
<td align="right"><%= @summ_sale.total_amount %></td>
</tr>
<tr>
<td>Total Discount : </td>
<td align="right"><%= @summ_sale.total_discount %></td>
</tr>
<tr>
<td>Tax (Services+Commercial) : </td>
<td align="right"><%= @summ_sale.total_tax %></td>
</tr>
<tr>
<td>Grand Total : </td>
<td align="right"><%= @summ_sale.grand_total %></td>
</tr>
</table>
<table class="table">
<% if !(@total_payment_methods.nil?) %>
<% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %>
<% if payment.payment_method == 'mpu' || payment.payment_method == 'visa' || payment.payment_method == 'master' || payment.payment_method == 'jcb' %>
<tr>
<td>Card Sale : </td>
<td align="right"><%= @sale_data[0]['card'] %></td>
</tr>
<% else %>
<tr>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= data[""+pay_mth+""] %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div> -->
<% end %>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="card">
<div class="body">
<h6>Customer</h6>
<table class="table">
<% if !@total_customer.nil? %>
<tr>
<td>Total Customer : </td>
<td align="right"><%= @total_customer.total_cus %></td>
</tr>
<% end %>
<% if !@total_dinein.nil? %>
<tr>
<td>Dine in : </td>
<td align="right"><%= @total_dinein.total_dinein_cus %></td>
</tr>
<% end %>
<% if !@total_takeaway.nil? %>
<tr>
<td>Takeaway : </td>
<td align="right"><%= @total_takeaway.total_take_cus %></td>
</tr>
<% end %>
<% if !@total_other_customer.nil? %>
<tr>
<td>Customer : </td>
<td align="right"><%= @total_other_customer.total_cus %></td>
</tr>
<% end %>
<% if !@total_membership.nil? %>
<tr>
<td>Membership : </td>
<td align="right"><%= @total_membership.total_memb_cus %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="card">
<div class="body">
<h6>Order</h6>
<table class="table">
<% if !@total_order.nil? %>
<tr>
<td>Total Order : </td>
<td align="right"><%= @total_order.total_order %></td>
</tr>
<% end %>
<% if !(@total_accounts.nil?) %>
<% @total_accounts.each do |account| %>
<tr>
<td><%= account.title %> (Account) : </td>
<td align="right">
<% @account_data.each do |data| %>
<% acc = account.title %>
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% if !@top_items.nil? %>
<tr>
<td>Top Item : </td>
<td align="right"><%= @top_items.item_name %>
<br>( <%= @top_items.item_total_price %> )</td>
</tr>
<% end %>
<% if !@total_foc_items.nil? %>
<tr>
<td>Total FOC Item : </td>
<td align="right"><%= @total_foc_items %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<% end %>
</div>

View File

@@ -77,12 +77,12 @@
<span><%= t :transactions %></span>
</a>
<ul class="ml-menu">
<% if can? :menage, Booking %>
<% if can? :menage, Booking %>
<li>
<a href="<%= transactions_bookings_path %>"><%= t :bookings %></a>
</li>
<% end %>
<% if can? :menage, Order %>
<% if can? :menage, Order %>
<li>
<a href="<%= transactions_orders_path %>"><%= t :orders %></a>
</li>
@@ -97,6 +97,11 @@
<a href="<%= transactions_credit_notes_path %>"><%= (t :credit) %></a>
</li>
<% end %>
<% if can? :menage, Sale %>
<li>
<a href="<%= transactions_shift_sales_path %>"><%= (t :shiftsale) %></a>
</li>
<% end %>
</ul>
</li>
<li>

View File

@@ -33,7 +33,7 @@
<br>
<div class="card-header">
<div>
<strong id="order-title">ORDER DETAILS </strong>| Table<%=@table.name%>
<strong id="order-title" class="font-14">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
@@ -62,7 +62,7 @@
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
</tr>
</table>
<button type="button" class="btn btn-success btn-block create" id="create_order" disabled="disabled">Create Order</button>
<button type="button" class="btn btn-primary btn-block create" id="create_order" disabled="disabled">Create Order</button>
</div>
</div>
</div>
@@ -98,8 +98,16 @@
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal" id="save">Update</button>
<div class="row">
<div class="col-md-5">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-primary " data-dismiss="modal" id="save">Update</button>
</div>
</div>
</div>
</div>
</div>
@@ -110,7 +118,7 @@
<div class="item-modal modal sx_item_detailModal" id="sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog custom-modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
@@ -131,7 +139,7 @@
</button>
</span>
<input type="text" value="1" id="count" class="change_qty form-control col-md-12 ">
<input type="number" value="1" id="count" class="change_qty keypress_qty form-control col-md-12 ">
<span class="input-group-btn">
<button type="button" class="btn btn-success btn-number" value="+" id="plus">
<i class="material-icons">add</i>
@@ -147,13 +155,15 @@
<p class="hidden" id="item_code"></p>
</div>
<div class="col-md-7 item-detail">
<strong style="font-size: 18px;">Attributes</strong>
<h5>Attributes</h5>
<div class="attributes-list">
</div>
<strong style="font-size: 18px;">Options</strong>
<hr>
<h5>Options</h5>
<div class="options-list">
</div>
<hr>
</div>
</div>
</div>
@@ -161,8 +171,18 @@
<div class="mr-auto">
<h4 class=" pull-left">Total : <span id="total_price"></span></h4>
</div>
<button type="button" class="btn btn-primary m-r-20" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success add_to_order m-r-10" data-dismiss="modal" id="add_to_order">Add to Order</button>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default " data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary add_to_order " data-dismiss="modal" id="add_to_order">Add to Order</button>
</div>
</div>
</div>
</div>
</div>
@@ -173,7 +193,7 @@
<div class=" modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
<div class="modal-dialog custom-modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
@@ -193,7 +213,7 @@
<i class="material-icons">remove</i>
</button>
</span>
<input type="text" value="1" id="set_count" class="set_change_qty form-control col-md-12 ">
<input type="number" value="1" id="set_count" class="set_change_qty keypress_qty form-control col-md-12 ">
<span class="input-group-btn">
<button type="button" class="btn btn-success btn-number" value="+" id="set_plus">
<i class="material-icons">add</i>
@@ -222,8 +242,17 @@
<div class="mr-auto">
<h4 class=" pull-left">Total : <span id="set_total_price"></span></h4>
</div>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success set_order" data-dismiss="modal" id="set_order">Add to Order</button>
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
</div>
<div class="col-md-6">
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
</div>
</div>
</div>
</div>
</div>

View File

@@ -48,17 +48,20 @@
</div>
</div>
<% else %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<div class="card-block">
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>
</div>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.get_booking %>
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
</div>

View File

@@ -5,16 +5,16 @@
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab"><%= t :tables %></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
<a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a>
</li>
</ul>
<!-- Nav tabs - End -->
@@ -37,9 +37,8 @@
<!--- Panel 1 - Table Orders -->
<div class="tab-pane dining active " id="tables" role="tabpanel">
<div class="card-columns">
<% @tables.each do |table| %>
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
@@ -49,12 +48,16 @@
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
</div>
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
@@ -119,7 +122,11 @@
<div class="card">
<div class="card-header">
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
</div>
@@ -132,29 +139,38 @@
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
<br>
</div>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-12 col-md-12 col-sm-12 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
<br>
</div>
<% end %>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
Customer : <%= @sale_array[0].customer.name rescue '' %>
<% else %>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
Customer : <%= @customer.name rescue "" %>
<% end %>
<% if !@sale_array.empty? %>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
Customer : <%= @sale_array[0].customer.name rescue '' %>
<% else %>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
Customer : <%= @customer.name rescue "" %>
<% end %>
<% end %>
</div>
</div>
</div>
@@ -328,10 +344,10 @@
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>
Back
<%= t("views.btn.back") %>
</button>
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect">Add Order</button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %>
<% if @status_order == 'order' %>
<!-- <button type="button" id="customer" class="btn btn-block bg-blue waves-effect" disabled>Customer</button> -->
@@ -360,6 +376,8 @@
<!-- Cashier Buttons -->
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
<% else %>
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
<% end %>
</div>
</div>
@@ -628,7 +646,24 @@
});
$('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>"
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/addorders/' + dining_id;
});
/* check in process */
$('#check_in').on('click',function(){
var dining_id = "<%= @dining.id %>";
$.ajax({
type: 'POST',
data: {dining_id : dining_id},
datatype: 'JSON',
url: '/origami/check_in',
success: function(data) {
if(data.status == 'ok'){
window.location.reload();
}
}
});
});
</script>

View File

@@ -148,7 +148,7 @@
<div class="card-title m-l-5 m-r-5">
<!-- mpu -->
<% if @other != 0.0 %>
<div class="row payment other-payment-color">
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">MPU</div>
<div class="col-md-4 mpu is_card" id="others"><%= @other %></div>
@@ -162,7 +162,7 @@
<% end %>
<!-- paypar -->
<% if @ppamount != 0.0 %>
<div class="row payment other-payment-color">
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">Redeem</div>
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
@@ -176,7 +176,7 @@
<% end %>
<!-- Visa -->
<% if @visacount != 0.0 %>
<div class="row payment other-payment-color">
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">Visa</div>
<div class="col-md-4 visa is_card" id="visacount"><%= @visacount %></div>
@@ -190,7 +190,7 @@
<% end %>
<!-- JCB -->
<% if @jcbcount != 0.0 %>
<div class="row payment other-payment-color">
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">JCB</div>
<div class="col-md-4 jcb is_card" id="jcbcount"><%= @jcbcount %></div>
@@ -204,7 +204,7 @@
<% end %>
<!-- Master -->
<% if @mastercount != 0.0 %>
<div class="row payment other-payment-color">
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">Master</div>
<div class="col-md-4 master is_card" id="mastercount"><%= @mastercount %></div>

View File

@@ -174,9 +174,10 @@
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
success: function(result){
if(result.status == true){
console.log(result)
swal({
title: "Information!",
text: result.status,
text: result.message,
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"
});

View File

@@ -3,7 +3,7 @@
<% if period_type != false %>
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14">Select Period<%= t("views.right_panel.detail.select_period") %></label>
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option>

View File

@@ -6,7 +6,7 @@
<div class="form-inputs p-l-15">
<%= f.input :name %>
<%= f.input :role, :collection => Lookup.collection_of("employee_roles"),:class=>'form-group' %>
<%= f.input :emp_id, :as => :integer, :label => "Employee Numberic ID (*Unique)" %>
<%= f.input :emp_id, :label => "Employee Numberic ID (*Unique)" %>
<%= f.input :password %>
</div>

View File

@@ -11,6 +11,7 @@
<%= f.input :gateway_url %>
<%= f.input :auth_token %>
<%= f.input :merchant_account_id %>
<%= f.input :additional_parameter, as: :text %>
<%= f.input :created_by %>
</div>

View File

@@ -15,7 +15,7 @@
<tbody>
<tr>
<td colspan="8">
<%= form_tag transactions_orders_path, :method => :get do %>
<%= form_tag transactions_bookings_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>

View File

@@ -0,0 +1,105 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t :shiftsale %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="main-box-body clearfix p-l-5 p-r-5">
<!-- <div class="table-responsive">
<table class="table table-">
<tbody>
<tr>
<td colspan="8">
<%= form_tag transactions_shift_sales_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
<input type="text" name="receipt_no" class="form-control" placeholder="" style="margin-right: 10px">
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="from date" type="text" placeholder="From date">
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.to") %></label>
<input class="form-control datepicker" name="to" id="to date" type="text" placeholder="To date">
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
<label></label>
<br><input type="submit" value="Search" class='btn btn-primary btn-md'>
</div>
</div>
<% end %>
</td>
</tr>
</tbody>
</table>
</div> -->
<div class="card">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Cashier Name</th>
<th>Cashier Terminal </th>
<th>Opening Time </th>
<th>Closing Time </th>
<th>Opening float </th>
<th>Closing Amount </th>
<th>Cast In </th>
<th>Cast Out </th>
<th>Total Receipt </th>
<th>Dining Count </th>
<th>Takeaway Count </th>
<th>Total Void</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% if @shift_sales != 0 %>
<% @shift_sales.each do |shift_sale| %>
<tr>
<td><%= shift_sale.employee.name%></td>
<td><%=shift_sale.cashier_terminal.name%></td>
<td><%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
</td>
<td><%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') rescue '-' %>
</td>
<td><%=shift_sale.opening_balance %></td>
<td><%=shift_sale.closing_balance %></td>
<td><%=shift_sale.cash_in %></td>
<td><%=shift_sale.cash_out %></td>
<th><%= shift_sale.total_receipt %></th>
<th><%= shift_sale.dining_count %></th>
<th><%= shift_sale.takeaway_count %></th>
<th>(<%= shift_sale.total_void.round(2) %>)</th>
<td><%= link_to t("views.btn.show"), transactions_shift_sale_path(shift_sale),:class => 'btn btn-info btn-sm waves-effect' %></td>
</tr>
<% end %>
<% else %>
<tr><td colspan="8"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
<% end %>
</tbody>
</table>
<br>
<% if @shift_sales != 0 %>
<%= paginate @shift_sales %>
<% end %>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.array! @transactions_sales, partial: 'transactions_sales/transactions_sale', as: :transactions_sale

View File

@@ -0,0 +1,59 @@
<p id="notice"><%= notice %></p>
<h1><%= t("views.right_panel.header.transactions_sales") %></h1>
<table>
<thead>
<tr>
<th><%= t :cashier %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name_txt2") %></th>
<th><%= t("views.right_panel.detail.requested_by") %></th>
<th><%= t("views.right_panel.detail.requested_at") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t("views.right_panel.detail.receipt_date") %></th>
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.payment_status") %></th>
<th><%= t("views.right_panel.detail.sale_status") %></th>
<th><%= t("views.right_panel.detail.total_amount") %></th>
<th><%= t("views.right_panel.detail.total_discount") %></th>
<th><%= t("views.right_panel.detail.total_tax") %></th>
<th><%= t("views.right_panel.detail.tax_type") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj") %></th>
<th><%= t("views.right_panel.detail.amt_received") %></th>
<th><%= t("views.right_panel.detail.amt_changed") %></th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @transactions_sales.each do |transactions_sale| %>
<tr>
<td><%= transactions_sale.cashier %></td>
<td><%= transactions_sale.cashier_name %></td>
<td><%= transactions_sale.requested_by %></td>
<td><%= transactions_sale.requested_at %></td>
<td><%= transactions_sale.receipt_no %></td>
<td><%= transactions_sale.receipt_date %></td>
<td><%= transactions_sale.customer %></td>
<td><%= transactions_sale.payment_status %></td>
<td><%= transactions_sale.sale_status %></td>
<td><%= transactions_sale.total_amount %></td>
<td><%= transactions_sale.total_discount %></td>
<td><%= transactions_sale.total_tax %></td>
<td><%= transactions_sale.tax_type %></td>
<td><%= transactions_sale.grand_total %></td>
<td><%= transactions_sale.rounding_adjustment %></td>
<td><%= transactions_sale.amount_received %></td>
<td><%= transactions_sale.amount_changed %></td>
<td><%= link_to t("views.btn.show"), transactions_sale %></td>
<td><%= link_to t("views.btn.edit"), edit_transactions_sale_path(transactions_sale) %></td>
<td><%= link_to t("views.btn.delete"), transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Transactions Sale', new_transactions_sale_path %>

View File

@@ -0,0 +1,196 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item"><a href="<%= transactions_shift_sales_path %>"><%= t :shiftsale %></a></li>
<li class="breadcrumb-item active"><%= t :details %></li>
<span class="float-right">
<%= link_to 'Back', transactions_shift_sales_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="main-box-body clearfix p-l-5 p-r-5">
<div class="card">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">
<tbody>
<tr>
<th>Cashier </th>
<th>Cashier Terminal </th>
<th>Opening Date </th>
<th>Opening float </th>
<th>Received Amount </th>
<th>Cast In </th>
<th>Cast Out </th>
<th>Total Receipt </th>
<th>Dining Count </th>
<th>Takeaway Count </th>
<th>Total Void</th>
</tr>
<tr style="border-bottom:2px solid #000">
<td><%= @shift.employee.name%></td>
<td><%=@shift.cashier_terminal.name%></td>
<td><%= @shift.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
</td>
<td><%=@shift.opening_balance %></td>
<td><%=@shift.closing_balance %></td>
<td><%=@shift.cash_in %></td>
<td><%=@shift.cash_out %></td>
<th><%= @shift.total_receipt %></th>
<th><%= @shift.dining_count %></th>
<th><%= @shift.takeaway_count %></th>
<th>(<%= @shift.total_void.round(2) %>)</th>
</tr>
<tr>
<td colspan="5">
<table width="100%">
<% @total_amount_by_account.each do |amount| %>
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Amount</td>
<td><%= amount.total_price.round(2) %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Net Sales</th>
<th><%=@shift.nett_sales %></th>
</tr>
<% @total_discount_by_account.each do |amount| %>
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Discount</td>
<td><%= amount.total_price.round(2) %></td>
</tr>
<%end%>
<% if !@total_member_discount[0].member_discount.nil?
@member_discount = @total_member_discount[0].member_discount rescue 0.0
@overall = @shift.total_discounts - @member_discount
%>
<tr>
<th></th>
<th style="text-align: right;"> Total Member Discount</th>
<th><%= @member_discount %></th>
</tr>
<%else @overall = @shift.total_discounts %>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Total Overall Discount</th>
<th><%= @overall %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Total Discount</th>
<th><%= @shift.total_discounts %></th>
</tr>
<% @sale_taxes.each do |tax| %>
<tr>
<th></th>
<td style="text-align: right;"> <%= tax.tax_name %> </td>
<td><%= tax.st_amount.round(2) %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Total Tax </th>
<th><%=@shift.total_taxes %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Rounding Adj </th>
<th><%= @shift.total_rounding.round(2) %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Grand Total </th>
<th><%= @shift.grand_total.round(2) %></th>
</tr>
</table>
</td>
<td colspan="6">
<table width="100%">
<tr>
<th></th>
<th style="text-align: right;">Cash Payment </th>
<th><%=@shift.cash_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Credit Payment </th>
<th><%=@shift.credit_sales %></th>
</tr>
<% @total_amount = 0
@other_payment.each do |other| %>
<tr>
<th></th>
<th style="text-align: right;">Other Payment Detail </th>
<th></th>
</tr>
<tr>
<th></th>
<td style="text-align: right;">MPU Payment </td>
<td><%=other.mpu_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.mpu_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">VISA Payment </td>
<td><%=other.visa_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.visa_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">JCB Payment </td>
<td><%=other.master_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.master_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Master Payment </td>
<td><%=other.jcb_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Reedem Payment </td>
<td><%=other.paypar_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.paypar_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;"><strong>FOC </strong></td>
<td><%=other.foc_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.foc_amount rescue 0.0 %>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;">Total Other Payment </th>
<th><%=@shift.other_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Total Payment </th>
<th><%= @total_amount+@shift.cash_sales+@shift.credit_sales %></th>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "transactions_sales/transactions_sale", transactions_sale: @transactions_sale

View File

@@ -28,6 +28,7 @@ en:
hourly: "Hourly"
top: "Top"
orders: "Orders"
shiftsale: "ShiftSale"
credit: "Credit"
bookings: "Booking"
home: "Home"
@@ -67,6 +68,7 @@ en:
booking_details: "Booking Details"
inventory_definitions: "Inventory Definitions"
sale_audits: "Sale Audits"
bottom: "Bottom"
views:
btn:
@@ -90,6 +92,7 @@ en:
filter: "Filter"
del: "DEL"
clr: "CLR"
assign: "ASSIGN"
print_order_summary: "Print Order Summary"
memeber_card: "Member Card"
@@ -124,6 +127,7 @@ en:
new_inventory_product: "NEW INVENTORY PRODUCT"
generate_report: "GENERATE REPORT"
exp_to_excel: "EXPORT TO EXCEL"
check_in: "Check In"
pagination:
first: "&laquo; First"

View File

@@ -28,6 +28,7 @@ mm:
hourly: "နာရီအလိုက်"
top: "အရောင်းရဆုံး"
orders: "အော်ဒါများ"
shiftsale: "အော်ဒါများ"
bookings: "အော်ဒါများ"
credit: "အကြွေး"
home: "မူလစာမျက်နှာ"

View File

@@ -65,10 +65,12 @@ scope "(:locale)", locale: /en|mm/ do
post "payment/:payment_method" => "payment#create"
put "payment/:id" => "payment#update"
resources :receipt, only: [:create, :show] #generate receipt, show receipt
end
namespace :origami do
post "check_in/:dining_id" => "check_in_process#check_in_process"
post "request_time" => "check_in_process#request_time"
end
end
#--------- Cashier ------------#
@@ -199,7 +201,8 @@ scope "(:locale)", locale: /en|mm/ do
post 'select_sale_item' => 'product_commissions#select_sale_item', as: 'select_sale_item'
post 'select_commissioner' => 'product_commissions#set_commissioner_to_sale_item', as: 'select_commissioner'
#check_in
post '/check_in' => "check_in_process#check_in_process"
end
@@ -336,6 +339,7 @@ scope "(:locale)", locale: /en|mm/ do
resources :orders
resources :credit_notes
resources :bookings
resources :shift_sales
get "/sales/:sale_id/manual_complete_sale" => "manual_sales#manual_complete_sale", :as => "manual_complete_sale"
get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"

View File

@@ -3,6 +3,7 @@ class CreateAssignedOrderItems < ActiveRecord::Migration[5.1]
create_table :assigned_order_items, :id => false do |t|
t.string :assigned_order_item_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
t.string :item_code, :null => false, :index => true
t.string :instance_code, :null => false, :index => true
t.references :order_queue_station, foreign_key: true
t.string :order_id, foreign_key: true, :limit => 16
t.boolean :print_status

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Api::CheckInProcessController, type: :controller do
end

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Origami::CheckInProcessController, type: :controller do
end