Pull from master
This commit is contained in:
@@ -1012,12 +1012,14 @@ $(function() {
|
|||||||
//calculate subtotal
|
//calculate subtotal
|
||||||
function calculate_sub_total(){
|
function calculate_sub_total(){
|
||||||
var total_price = 0;
|
var total_price = 0;
|
||||||
|
var total_qty = 0;
|
||||||
var taxable_amount = 0;
|
var taxable_amount = 0;
|
||||||
var item_row = $('.summary-items tbody tr');
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
$(item_row).each(function(i){
|
$(item_row).each(function(i){
|
||||||
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||||
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||||
|
total_qty += qty;
|
||||||
total_price += qty*unit_price;
|
total_price += qty*unit_price;
|
||||||
});
|
});
|
||||||
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||||
@@ -1026,6 +1028,9 @@ $(function() {
|
|||||||
$('#sub_total').empty();
|
$('#sub_total').empty();
|
||||||
$('#sub_total').append(fixed_total_price);
|
$('#sub_total').append(fixed_total_price);
|
||||||
|
|
||||||
|
$('#total_qty').empty();
|
||||||
|
$('#total_qty').append(total_qty);
|
||||||
|
|
||||||
if (item_row.length > 0) {
|
if (item_row.length > 0) {
|
||||||
$('.create').removeAttr("disabled", false);
|
$('.create').removeAttr("disabled", false);
|
||||||
}else{
|
}else{
|
||||||
@@ -1432,7 +1437,8 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
row = '<div class="col-md-3">'
|
||||||
|
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
|
||||||
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
|
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
|
||||||
+"<div class='col-md-2 "+menu_item_box+" ' data-item-code='"
|
+"<div class='col-md-2 "+menu_item_box+" ' data-item-code='"
|
||||||
@@ -1466,7 +1472,8 @@ $(function() {
|
|||||||
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
|
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
|
||||||
+'<span>'+ price +'</span>'
|
+'<span>'+ price +'</span>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
+'</div>';
|
+'</div>'
|
||||||
|
+'</div>'; ;
|
||||||
$('.menu_items_list').append(row);
|
$('.menu_items_list').append(row);
|
||||||
}
|
}
|
||||||
//end instances in menu-items alest 1 instance
|
//end instances in menu-items alest 1 instance
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(".processitems").click(function(event){
|
$(".processitems").click(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
console.log($(this).data("id"));
|
|
||||||
var item = $(this).data("id");
|
var item = $(this).data("id");
|
||||||
$(this).toggleClass("opi_selected");
|
$(this).toggleClass("opi_selected");
|
||||||
|
|
||||||
@@ -13,7 +12,6 @@ $(document).ready(function() {
|
|||||||
console.log($(this).data("id"));
|
console.log($(this).data("id"));
|
||||||
var group_id = $(this).data("id");
|
var group_id = $(this).data("id");
|
||||||
var selector = "#" + group_id + " li div";
|
var selector = "#" + group_id + " li div";
|
||||||
console.log ($(selector));
|
|
||||||
|
|
||||||
$(selector).removeClass("opi_selected");
|
$(selector).removeClass("opi_selected");
|
||||||
$(selector).addClass("opi_selected");
|
$(selector).addClass("opi_selected");
|
||||||
@@ -25,7 +23,6 @@ $(document).ready(function() {
|
|||||||
console.log($(this).data("id"));
|
console.log($(this).data("id"));
|
||||||
var group_id = $(this).data("id");
|
var group_id = $(this).data("id");
|
||||||
var selector = "#" + group_id + " li div";
|
var selector = "#" + group_id + " li div";
|
||||||
console.log ($(selector));
|
|
||||||
|
|
||||||
$(selector).removeClass("opi_selected");
|
$(selector).removeClass("opi_selected");
|
||||||
});
|
});
|
||||||
@@ -36,7 +33,6 @@ $(document).ready(function() {
|
|||||||
var items = new Array();
|
var items = new Array();
|
||||||
selected_div = $(".opi_selected");
|
selected_div = $(".opi_selected");
|
||||||
$.each( selected_div, function( key, value ) {
|
$.each( selected_div, function( key, value ) {
|
||||||
console.log($(value).attr("data-id"));
|
|
||||||
items.push($(value).attr("data-id"));
|
items.push($(value).attr("data-id"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ section .content{
|
|||||||
}
|
}
|
||||||
.custom-card {
|
.custom-card {
|
||||||
border: 2px solid rgba(0, 0, 0, 0.125) !important;
|
border: 2px solid rgba(0, 0, 0, 0.125) !important;
|
||||||
|
margin-bottom: 7px !important;
|
||||||
}
|
}
|
||||||
.custom-card-footer{
|
.custom-card-footer{
|
||||||
padding:0.35rem 1.25rem !important;
|
padding:0.35rem 1.25rem !important;
|
||||||
@@ -72,16 +73,26 @@ section .content{
|
|||||||
.nav-tabs {
|
.nav-tabs {
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
}
|
}
|
||||||
|
.nav-tabs li a.active{
|
||||||
|
border-bottom:1px solid #54A5AF !important;
|
||||||
|
}
|
||||||
.nav-tabs .nav-link {
|
.nav-tabs .nav-link {
|
||||||
padding: 0.7286rem 0.2575;
|
padding: 0.7286rem 0.2575;
|
||||||
border-top-left-radius: 0rem;
|
border-top-left-radius: 0rem;
|
||||||
border-top-right-radius: 0rem;
|
border-top-right-radius: 0rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-tabs .nav-link:focus, .nav-tabs .nav-link:hover {
|
||||||
|
color: #54A5AF #54A5AF #54A5AF;
|
||||||
|
}
|
||||||
|
.nav-tabs .nav-link.active:focus, .nav-tabs .nav-link.active:hover {
|
||||||
|
background-color: #009688;
|
||||||
|
}
|
||||||
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
||||||
background-color: #a1aade;
|
background-color: #fff !important;
|
||||||
border-left: 6px solid #111;
|
border-left: 6px solid #54A5AF !important;
|
||||||
color:#54A5AF;
|
color: #54A5AF !important;
|
||||||
font-weight: bold;
|
font-weight: bold !important;
|
||||||
border-color: #fff #fff #fff #54A5AF;
|
border-color: #fff #fff #fff #54A5AF;
|
||||||
}
|
}
|
||||||
.sub_category_list{
|
.sub_category_list{
|
||||||
|
|||||||
@@ -462,4 +462,9 @@ iframe {
|
|||||||
/* section class for webview */
|
/* section class for webview */
|
||||||
.section-margin {
|
.section-margin {
|
||||||
margin-top: -50px;
|
margin-top: -50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tax-btn-box {
|
||||||
|
width: 230px;
|
||||||
|
height: 80px;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
order_reservation = params
|
order_reservation = params
|
||||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||||
|
|
||||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
if flag
|
||||||
shop = Shop.find_by_id(1)
|
shop = Shop.find_by_id(1)
|
||||||
if !shop.shop_code.nil?
|
if !shop.shop_code.nil?
|
||||||
shop_code = shop.shop_code
|
shop_code = shop.shop_code
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
if @status && @booking
|
||||||
|
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||||
|
end
|
||||||
# # for parallel order
|
# # for parallel order
|
||||||
# remoteIP = ""
|
# remoteIP = ""
|
||||||
# begin
|
# begin
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ class Api::SurveyController < Api::ApiController
|
|||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
|
|
||||||
if params[:id]
|
if params[:survey][:id]
|
||||||
survey = Survey.find(params[:id])
|
survey = Survey.find(params[:survey][:id])
|
||||||
else
|
else
|
||||||
survey = Survey.new
|
survey = Survey.new
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,8 +48,16 @@ class Origami::OrderReservationController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def send_status
|
def send_status
|
||||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
|
order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no])
|
||||||
|
if !order_reservation.nil?
|
||||||
|
if !ShiftSale.current_shift.nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected')
|
||||||
|
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
|
||||||
|
else
|
||||||
|
response = { status: false, message: 'No current shift open for this employee!'}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
response = { status: false, message: 'There is no order for '+params[:ref_no]+'!'}
|
||||||
|
end
|
||||||
render :json => response
|
render :json => response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
member_info = nil
|
member_info = nil
|
||||||
|
type = params[:type]
|
||||||
|
tax_type = params[:tax_type]
|
||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
@@ -298,11 +300,18 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# accounts = @customer.tax_profiles
|
# accounts = @customer.tax_profiles
|
||||||
accounts = TaxProfile.where("group_type = ?",@cashier_type).order("order_by ASC")
|
accounts = TaxProfile.where("group_type = ?",@cashier_type).order("order_by ASC")
|
||||||
@account_arr =[]
|
@account_arr =[]
|
||||||
|
@tax_arr =[]
|
||||||
accounts.each do |acc|
|
accounts.each do |acc|
|
||||||
account = TaxProfile.find(acc.id)
|
account = TaxProfile.find(acc.id)
|
||||||
@account_arr.push(account)
|
# @account_arr.push(account)
|
||||||
|
@tax_arr.push(account.name)
|
||||||
|
end
|
||||||
|
sale_taxes = SaleTax.where("sale_id = ?", saleObj.sale_id)
|
||||||
|
if !sale_taxes.empty?
|
||||||
|
sale_taxes.each do |sale_tax|
|
||||||
|
@account_arr.push(sale_tax)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
# get member information
|
# get member information
|
||||||
if @customer.membership_id != nil && rebate
|
if @customer.membership_id != nil && rebate
|
||||||
@@ -571,4 +580,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
# render :json => {status: true}
|
# render :json => {status: true}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#changable tax for sale
|
||||||
|
def change_tax
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
order_source = params[:cashier_type]
|
||||||
|
tax_type = params[:tax_type]
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
|
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount,nil,order_source,tax_type)
|
||||||
|
|
||||||
|
render json: JSON.generate({:status => true})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -83,54 +83,66 @@ class Origami::ProductCommissionsController < BaseOrigamiController
|
|||||||
|
|
||||||
def set_commissioner_to_sale_item
|
def set_commissioner_to_sale_item
|
||||||
# byebug
|
# byebug
|
||||||
deselect = false
|
deselect = false
|
||||||
sale_item_id = params[:sale_item_id]
|
type = nil
|
||||||
|
sale_item_id = params[:sale_item_id]
|
||||||
commissioner_id = params[:commissioner_id]
|
commissioner_id = params[:commissioner_id]
|
||||||
@sale_item = SaleItem.find(sale_item_id)
|
@sale_item = SaleItem.find(sale_item_id)
|
||||||
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
||||||
# @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.item_code, true).take
|
# @commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.item_code, true).take
|
||||||
|
|
||||||
Commission.all.each do |com|
|
Commission.all.active.each do |com|
|
||||||
if com.product_code.include? @menu_item.item_code && com.is_active == true
|
if com.product_code != "[]"
|
||||||
@commission = Commission.find(com.id)
|
if com.product_code.to_s.include? @menu_item.item_code
|
||||||
break
|
@commission = Commission.find(com.id)
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
||||||
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
||||||
|
|
||||||
if !@commission.nil? && @commissioner.commission_id == @commission.commission_id
|
if !@commission.nil? && @commissioner.commission_id == @commission.commission_id
|
||||||
if !@product_commission.nil?
|
if !@product_commission.nil?
|
||||||
if @product_commission.commissioner_id == @commissioner.id
|
if @product_commission.commissioner_id == @commissioner.id
|
||||||
@product_commission.destroy
|
@product_commission.destroy
|
||||||
deselect = true
|
deselect = true
|
||||||
else
|
type = "remove"
|
||||||
@product_commission.commissioner_id = @commissioner.id
|
# render json: {status: true,deselect:deselect, message: "Remove Success !"}
|
||||||
deselect = false
|
else
|
||||||
end
|
@product_commission.commissioner_id = @commissioner.id
|
||||||
else
|
deselect = false
|
||||||
@product_commission = ProductCommission.new
|
|
||||||
@product_commission.product_code = @menu_item.item_code
|
|
||||||
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
|
|
||||||
unless @commission.nil?
|
|
||||||
@product_commission.commission_id = @commission.id
|
|
||||||
if @commission.commission_type == 'Percentage'
|
|
||||||
@product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0)
|
|
||||||
@product_commission.amount = @product_commission.price * @sale_item.qty
|
|
||||||
elsif @commission.commission_type == 'Net Amount'
|
|
||||||
@product_commission.price = @commission.amount
|
|
||||||
@product_commission.amount = @product_commission.price * @sale_item.qty
|
|
||||||
end
|
end
|
||||||
end
|
else
|
||||||
@product_commission.commissioner_id = @commissioner.id
|
@product_commission = ProductCommission.new
|
||||||
@product_commission.qty = @sale_item.qty
|
@product_commission.product_code = @menu_item.item_code
|
||||||
@product_commission.sale_id = @sale_item.sale_id
|
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
|
||||||
@product_commission.sale_item_id = @sale_item.sale_item_id
|
unless @commission.nil?
|
||||||
|
@product_commission.commission_id = @commission.id
|
||||||
|
if @commission.commission_type == 'Percentage'
|
||||||
|
@product_commission.price = @sale_item.unit_price * (@commission.amount / 100.0)
|
||||||
|
@product_commission.amount = @product_commission.price * @sale_item.qty
|
||||||
|
elsif @commission.commission_type == 'Net Amount'
|
||||||
|
@product_commission.price = @commission.amount
|
||||||
|
@product_commission.amount = @product_commission.price * @sale_item.qty
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@product_commission.commissioner_id = @commissioner.id
|
||||||
|
@product_commission.qty = @sale_item.qty
|
||||||
|
@product_commission.sale_id = @sale_item.sale_id
|
||||||
|
@product_commission.sale_item_id = @sale_item.sale_item_id
|
||||||
end
|
end
|
||||||
if @product_commission.save
|
if @product_commission.save
|
||||||
render json: {status: true, deselect: deselect}
|
message = "Success !"
|
||||||
|
if type == "remove"
|
||||||
|
message = "Remove Success !"
|
||||||
|
end
|
||||||
|
render json: {status: true, deselect:deselect,type:type,message: message}
|
||||||
else
|
else
|
||||||
render json: {status: false, deselect: deselect}
|
render json: {status: false, deselect:deselect,type:type,message: "No Commission"}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render json: {status: false, deselect:deselect,type:type,message: "No Commission"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ class Ability
|
|||||||
can :rounding_adj, :payment
|
can :rounding_adj, :payment
|
||||||
can :foc, :payment
|
can :foc, :payment
|
||||||
can :print, :payment
|
can :print, :payment
|
||||||
|
can :change_tax, :payment
|
||||||
|
|
||||||
can :move_dining, :movetable
|
can :move_dining, :movetable
|
||||||
can :moving, :movetable
|
can :moving, :movetable
|
||||||
@@ -154,6 +155,7 @@ class Ability
|
|||||||
can :rounding_adj, :payment
|
can :rounding_adj, :payment
|
||||||
can :foc, :payment
|
can :foc, :payment
|
||||||
can :print, :payment
|
can :print, :payment
|
||||||
|
can :change_tax, :payment
|
||||||
|
|
||||||
can :move_dining, :movetable
|
can :move_dining, :movetable
|
||||||
can :moving, :movetable
|
can :moving, :movetable
|
||||||
@@ -249,6 +251,7 @@ class Ability
|
|||||||
can :rounding_adj, :payment
|
can :rounding_adj, :payment
|
||||||
can :print, :payment
|
can :print, :payment
|
||||||
can :foc, :payment
|
can :foc, :payment
|
||||||
|
can :change_tax, :payment
|
||||||
|
|
||||||
can :manage, Commission
|
can :manage, Commission
|
||||||
can :manage, Commissioner
|
can :manage, Commissioner
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Commission < ApplicationRecord
|
|||||||
|
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :name, :commission_type, :amount
|
validates_presence_of :name, :commission_type, :amount
|
||||||
|
scope :active, -> {where(is_active: true)}
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
||||||
|
|||||||
@@ -301,13 +301,6 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_cup_status(status)
|
|
||||||
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
#send order items and send to order queue
|
#send order items and send to order queue
|
||||||
def send_order_broadcast(booking)
|
def send_order_broadcast(booking)
|
||||||
@@ -317,10 +310,10 @@ class Order < ApplicationRecord
|
|||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
# OrderBroadcastJob.perform_later(table,type)
|
# OrderBroadcastJob.perform_later(table,type)
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
from = request.subdomain + "." + request.domain
|
from = request.subdomain + "." + request.domain
|
||||||
else
|
else
|
||||||
from = ""
|
from = ""
|
||||||
end
|
end
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -485,68 +478,74 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Process order items and send to order queue
|
#Process order items and send to order queue
|
||||||
# def process_order_queue
|
def self.process_order_queue(order_id,table_id,source)
|
||||||
# print_status = nil
|
print_status = nil
|
||||||
# cup_status = nil
|
cup_status = nil
|
||||||
|
|
||||||
# #Send to background job for processing
|
#Send to background job for processing
|
||||||
# order = Order.find(self.id)
|
order = Order.find(order_id)
|
||||||
# sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||||
|
|
||||||
# if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
# cup_status = `#{"sudo service cups status"}`
|
cup_status = `#{"sudo service cups status"}`
|
||||||
# print_status = check_cup_status(cup_status)
|
print_status = check_cup_status(cup_status)
|
||||||
# end
|
end
|
||||||
|
|
||||||
# if print_status
|
if print_status
|
||||||
# if !sidekiq.nil?
|
if !sidekiq.nil?
|
||||||
# OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
OrderQueueProcessorJob.perform_later(order_id, table_id)
|
||||||
# else
|
else
|
||||||
# if order
|
if order
|
||||||
# oqs = OrderQueueStation.new
|
oqs = OrderQueueStation.new
|
||||||
# oqs.process_order(order, self.table_id, self.source)
|
oqs.process_order(order, table_id, source)
|
||||||
# end
|
end
|
||||||
# # assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
# # ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
# end
|
end
|
||||||
# else
|
else
|
||||||
# if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
# cup_start = `#{"sudo service cups start"}`
|
cup_start = `#{"sudo service cups start"}`
|
||||||
# cup_status = `#{"sudo service cups status"}`
|
cup_status = `#{"sudo service cups status"}`
|
||||||
# print_status = check_cup_status(cup_status)
|
print_status = check_cup_status(cup_status)
|
||||||
# end
|
end
|
||||||
|
|
||||||
# if print_status
|
if print_status
|
||||||
# if !sidekiq.nil?
|
if !sidekiq.nil?
|
||||||
# OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
OrderQueueProcessorJob.perform_later(order_id, table_id)
|
||||||
# else
|
else
|
||||||
# if order
|
if order
|
||||||
# oqs = OrderQueueStation.new
|
oqs = OrderQueueStation.new
|
||||||
# oqs.process_order(order, self.table_id, self.source)
|
oqs.process_order(order, table_id, source)
|
||||||
# end
|
end
|
||||||
# # assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
# # ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
# end
|
end
|
||||||
# else
|
else
|
||||||
# if ENV["SERVER_MODE"] != 'cloud'
|
if ENV["SERVER_MODE"] != 'cloud'
|
||||||
|
|
||||||
# msg = ' Print Error ! Please contact to service'
|
msg = ' Print Error ! Please contact to service'
|
||||||
# ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||||
# end
|
end
|
||||||
# if !sidekiq.nil?
|
if !sidekiq.nil?
|
||||||
# OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
OrderQueueProcessorJob.perform_later(order_id, table_id)
|
||||||
# else
|
else
|
||||||
# if order
|
if order
|
||||||
# oqs = OrderQueueStation.new
|
oqs = OrderQueueStation.new
|
||||||
# oqs.process_order(order, self.table_id, self.source)
|
oqs.process_order(order, table_id, source)
|
||||||
# end
|
end
|
||||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
||||||
|
def self.check_cup_status(status)
|
||||||
|
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -61,9 +61,10 @@ class ProductCommission < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_transaction(from, to, commissioner)
|
def self.get_transaction(from, to, commissioner)
|
||||||
transaction = all
|
transaction = ProductCommission.select("product_commissions.*,menu_items.name as porduct_name")
|
||||||
|
.joins("join menu_items on menu_items.item_code = product_commissions.product_code")
|
||||||
if !from.nil? && !to.nil?
|
if !from.nil? && !to.nil?
|
||||||
transaction = transaction.where('updated_at between ? and ?', from, to)
|
transaction = transaction.where('product_commissions.updated_at between ? and ?', from, to)
|
||||||
end
|
end
|
||||||
if commissioner != 0
|
if commissioner != 0
|
||||||
transaction = transaction.where(commissioner_id: commissioner)
|
transaction = transaction.where(commissioner_id: commissioner)
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ class Sale < ApplicationRecord
|
|||||||
if order_source.nil?
|
if order_source.nil?
|
||||||
order_source = order.source
|
order_source = order.source
|
||||||
end
|
end
|
||||||
puts "compute source"
|
|
||||||
compute(order_source)
|
compute(order_source)
|
||||||
|
|
||||||
#Update the order items that is billed
|
#Update the order items that is billed
|
||||||
@@ -346,7 +345,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#compute - invoice total
|
#compute - invoice total
|
||||||
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil)
|
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil,tax_type=nil)
|
||||||
sale = Sale.find(sale_id)
|
sale = Sale.find(sale_id)
|
||||||
sales_items = sale_itemss
|
sales_items = sale_itemss
|
||||||
|
|
||||||
@@ -365,7 +364,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
compute_tax(sale, total_taxable, total_discount, order_source)
|
compute_tax(sale, total_taxable, total_discount, order_source, tax_type)
|
||||||
|
|
||||||
sale.total_amount = subtotal_price
|
sale.total_amount = subtotal_price
|
||||||
sale.total_discount = total_discount
|
sale.total_discount = total_discount
|
||||||
@@ -412,7 +411,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Tax Re-Calculte
|
# Tax Re-Calculte
|
||||||
def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil)
|
def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil, tax_type=nil)
|
||||||
shop = Shop.first();
|
shop = Shop.first();
|
||||||
|
|
||||||
#if tax is not apply create new record
|
#if tax is not apply create new record
|
||||||
@@ -422,6 +421,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
total_tax_amount = 0
|
total_tax_amount = 0
|
||||||
|
tax_incl_exec = "exclusive"
|
||||||
#tax_profile - list by order_by
|
#tax_profile - list by order_by
|
||||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||||
customer = Customer.find(sale.customer_id)
|
customer = Customer.find(sale.customer_id)
|
||||||
@@ -429,11 +429,9 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
if sale.payment_status != 'foc'
|
if sale.payment_status != 'foc'
|
||||||
tax_profiles.each do |tax|
|
tax_profiles.each do |tax|
|
||||||
# customer.tax_profiles.each do |cus_tax|
|
|
||||||
# if cus_tax.to_i == tax.id
|
|
||||||
if tax.group_type.to_s == order_source.to_s
|
if tax.group_type.to_s == order_source.to_s
|
||||||
if customer.customer_type.downcase == 'takeaway'
|
if tax_type
|
||||||
if tax.name.downcase == 'commercial tax'
|
if tax_type.to_s == tax.name.to_s || tax_type == 'all'
|
||||||
sale_tax = SaleTax.new(:sale => sale)
|
sale_tax = SaleTax.new(:sale => sale)
|
||||||
sale_tax.tax_name = tax.name
|
sale_tax.tax_name = tax.name
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
@@ -442,6 +440,7 @@ class Sale < ApplicationRecord
|
|||||||
total_tax = total_taxable - total_discount
|
total_tax = total_taxable - total_discount
|
||||||
#include or execulive
|
#include or execulive
|
||||||
if tax.inclusive
|
if tax.inclusive
|
||||||
|
tax_incl_exec = "inclusive"
|
||||||
rate = tax.rate
|
rate = tax.rate
|
||||||
divided_value = (100 + rate)/rate
|
divided_value = (100 + rate)/rate
|
||||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
@@ -453,39 +452,41 @@ class Sale < ApplicationRecord
|
|||||||
if shop.calc_tax_order
|
if shop.calc_tax_order
|
||||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
end
|
end
|
||||||
|
|
||||||
sale_tax.inclusive = tax.inclusive
|
sale_tax.inclusive = tax.inclusive
|
||||||
sale_tax.save
|
sale_tax.save
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sale_tax = SaleTax.new(:sale => sale)
|
# customer.tax_profiles.each do |cus_tax|
|
||||||
sale_tax.tax_name = tax.name
|
# if cus_tax.to_i == tax.id
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax = SaleTax.new(:sale => sale)
|
||||||
|
sale_tax.tax_name = tax.name
|
||||||
|
sale_tax.tax_rate = tax.rate
|
||||||
|
|
||||||
# substract , to give after discount
|
# substract , to give after discount
|
||||||
total_tax = total_taxable - total_discount
|
total_tax = total_taxable - total_discount
|
||||||
#include or execulive
|
#include or execulive
|
||||||
if tax.inclusive
|
if tax.inclusive
|
||||||
rate = tax.rate
|
tax_incl_exec = "inclusive"
|
||||||
divided_value = (100 + rate)/rate
|
rate = tax.rate
|
||||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
divided_value = (100 + rate)/rate
|
||||||
else
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
else
|
||||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||||
end
|
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||||
#new taxable amount is standard rule for step by step
|
end
|
||||||
if shop.calc_tax_order
|
#new taxable amount is standard rule for step by step
|
||||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
if shop.calc_tax_order
|
||||||
end
|
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||||
sale_tax.inclusive = tax.inclusive
|
end
|
||||||
sale_tax.save
|
sale_tax.inclusive = tax.inclusive
|
||||||
|
sale_tax.save
|
||||||
|
# end
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# end
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
sale.tax_type = tax_incl_exec
|
||||||
sale.total_tax = total_tax_amount
|
sale.total_tax = total_tax_amount
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -500,6 +501,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
total_tax_amount = 0
|
total_tax_amount = 0
|
||||||
|
tax_incl_exec = "exclusive"
|
||||||
#tax_profile - list by order_by
|
#tax_profile - list by order_by
|
||||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||||
|
|
||||||
@@ -510,11 +512,9 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
#Create new tax records
|
#Create new tax records
|
||||||
tax_profiles.each do |tax|
|
tax_profiles.each do |tax|
|
||||||
# customer.tax_profiles.each do |cus_tax|
|
|
||||||
# if cus_tax.to_i == tax.id
|
|
||||||
if tax.group_type.to_s == order_source.to_s
|
if tax.group_type.to_s == order_source.to_s
|
||||||
if customer.customer_type.downcase == 'takeaway'
|
# customer.tax_profiles.each do |cus_tax|
|
||||||
if tax.name.downcase == 'commercial tax'
|
# if cus_tax.to_i == tax.id
|
||||||
sale_tax = SaleTax.new(:sale => self)
|
sale_tax = SaleTax.new(:sale => self)
|
||||||
sale_tax.tax_name = tax.name
|
sale_tax.tax_name = tax.name
|
||||||
sale_tax.tax_rate = tax.rate
|
sale_tax.tax_rate = tax.rate
|
||||||
@@ -523,6 +523,7 @@ class Sale < ApplicationRecord
|
|||||||
total_tax = total_taxable - self.total_discount
|
total_tax = total_taxable - self.total_discount
|
||||||
#include or execulive
|
#include or execulive
|
||||||
if tax.inclusive
|
if tax.inclusive
|
||||||
|
tax_incl_exec = "inclusive"
|
||||||
rate = tax.rate
|
rate = tax.rate
|
||||||
divided_value = (100 + rate)/rate
|
divided_value = (100 + rate)/rate
|
||||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||||
@@ -538,37 +539,12 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
sale_tax.inclusive = tax.inclusive
|
sale_tax.inclusive = tax.inclusive
|
||||||
sale_tax.save
|
sale_tax.save
|
||||||
end
|
# end
|
||||||
else
|
# end
|
||||||
sale_tax = SaleTax.new(:sale => self)
|
|
||||||
sale_tax.tax_name = tax.name
|
|
||||||
sale_tax.tax_rate = tax.rate
|
|
||||||
|
|
||||||
# substract , to give after discount
|
|
||||||
total_tax = total_taxable - self.total_discount
|
|
||||||
#include or execulive
|
|
||||||
if tax.inclusive
|
|
||||||
rate = tax.rate
|
|
||||||
divided_value = (100 + rate)/rate
|
|
||||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
|
||||||
else
|
|
||||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
|
||||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
|
||||||
end
|
|
||||||
|
|
||||||
#new taxable amount is standard rule for step by step
|
|
||||||
if shop.calc_tax_order
|
|
||||||
total_taxable = total_taxable + sale_tax.tax_payable_amount
|
|
||||||
end
|
|
||||||
|
|
||||||
sale_tax.inclusive = tax.inclusive
|
|
||||||
sale_tax.save
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
# end
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
self.total_tax = total_tax_amount
|
self.tax_type = tax_incl_exec
|
||||||
|
self.total_tax = total_tax_amount
|
||||||
end
|
end
|
||||||
|
|
||||||
def product_get_unit_price(item_code)
|
def product_get_unit_price(item_code)
|
||||||
|
|||||||
@@ -303,12 +303,16 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
if sale_data.sale_taxes.length > 0
|
if sale_data.sale_taxes.length > 0
|
||||||
|
incl_tax = ""
|
||||||
|
if sale_data.tax_type == "inclusive"
|
||||||
|
incl_tax = "Incl."
|
||||||
|
end
|
||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
move_down line_move
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.description_width, :height => self.item_height) do
|
||||||
text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
|||||||
@@ -290,12 +290,17 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
if sale_data.sale_taxes.length > 0
|
if sale_data.sale_taxes.length > 0
|
||||||
|
incl_tax = ""
|
||||||
|
if sale_data.tax_type == "inclusive"
|
||||||
|
incl_tax = "Incl."
|
||||||
|
end
|
||||||
|
|
||||||
sale_data.sale_taxes.each do |st|
|
sale_data.sale_taxes.each do |st|
|
||||||
move_down line_move
|
move_down line_move
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
text "#{ st.tax_name } (#{incl_tax} #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ json.id item.id
|
|||||||
json.code item.item_code
|
json.code item.item_code
|
||||||
json.name item.name
|
json.name item.name
|
||||||
json.alt_name item.alt_name
|
json.alt_name item.alt_name
|
||||||
if !request_url.nil? && request_url != ''
|
if !request_url.nil? && request_url != '' && !item.image_path.url.nil?
|
||||||
json.image request_url + item.image_path.url.to_s
|
json.image request_url + item.image_path.url.to_s
|
||||||
else
|
else
|
||||||
json.image item.image_path.url
|
json.image item.image_path.url
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-block" style="">
|
<div class="card-block" style="">
|
||||||
<div class="card-text" id="custom-slimscroll">
|
<div class="card-text" id="custom-slimscroll">
|
||||||
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
|
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
|
||||||
<!-- append data -->
|
<!-- append data -->
|
||||||
<% @menu.each do |menu| %>
|
<% @menu.each do |menu| %>
|
||||||
<% if !menu.valid_time.nil? %>
|
<% if !menu.valid_time.nil? %>
|
||||||
@@ -255,9 +255,9 @@
|
|||||||
|
|
||||||
<table class="table" id="order-charges-table" border="0">
|
<table class="table" id="order-charges-table" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding:2px;" width="5%"></td>
|
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||||
<td style="padding:2px;" width="15%"></td>
|
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
|
||||||
<td style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
|
||||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
|||||||
|
|
||||||
if (menu.menu_categories)
|
if (menu.menu_categories)
|
||||||
order_by = Lookup.find_by_lookup_type("order_by")
|
order_by = Lookup.find_by_lookup_type("order_by")
|
||||||
if !order_by.nil? && order_by.value == "name"
|
# if !order_by.nil? && order_by.value == "name"
|
||||||
categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
# categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
||||||
else
|
# else
|
||||||
categories = menu.menu_categories
|
# categories = menu.menu_categories
|
||||||
end
|
# end
|
||||||
|
categories = menu.menu_categories
|
||||||
json.categories categories do |category|
|
json.categories categories do |category|
|
||||||
|
|
||||||
menu_category = MenuCategory.find_by_menu_category_id(category.id)
|
menu_category = MenuCategory.find_by_menu_category_id(category.id)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
`<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div id="loading_wrapper" style="display:none;">
|
<div id="loading_wrapper" style="display:none;">
|
||||||
<div id="loading"></div>
|
<div id="loading"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,16 +97,23 @@
|
|||||||
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
|
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Tax
|
<td class="charges-name">
|
||||||
(<% @i = 0
|
<strong>
|
||||||
@account_arr.each do |ct| %>
|
<% if !@account_arr.empty? %>
|
||||||
<%=ct.name%>
|
Tax
|
||||||
<% if @account_arr.count != @i+1%>
|
(<% @i = 0
|
||||||
+ <% @i =+1 %>
|
@account_arr.each do |ct| %>
|
||||||
<%end%>
|
<%=ct.tax_name%>
|
||||||
<%end %>)
|
<% if @account_arr.count != @i+1%>
|
||||||
</strong></td>
|
+ <% @i =+1 %>
|
||||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
<%end%>
|
||||||
|
<%end %>)
|
||||||
|
<% else %>
|
||||||
|
No Tax
|
||||||
|
<% end %></strong><br>
|
||||||
|
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||||
|
</td>
|
||||||
|
<td class="item-attr"><strong><span id="total_tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
@@ -536,6 +543,61 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- change tax modal -->
|
||||||
|
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-md" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title" id="change_taxModalLabel">TAX</h1>
|
||||||
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<% if !@tax_arr.empty? %>
|
||||||
|
<% if @tax_arr.count > 1 %>
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||||
|
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="all">
|
||||||
|
<% @i = 0
|
||||||
|
@tax_arr.each do |tax| %>
|
||||||
|
<%= tax %>
|
||||||
|
<% if @tax_arr.count != @i+1%>
|
||||||
|
+ <% @i =+1 %><br>
|
||||||
|
<%end%>
|
||||||
|
<% end %>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% @tax_arr.each_with_index do |tax, tax_index| %>
|
||||||
|
<% if (tax_index+1)%2 == 0 %>
|
||||||
|
<div class="row clearfix"></div>
|
||||||
|
<% end %>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||||
|
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>">
|
||||||
|
<%= tax %>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<div class="row clearfix"></div>
|
||||||
|
<div class="row text-center">
|
||||||
|
<% @tax_arr.each do |tax| %>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||||
|
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>"><%= tax %></button>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||||
|
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="no_tax">No Tax</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="sxModal">
|
<div id="sxModal">
|
||||||
<div id="sxModal-Content">
|
<div id="sxModal-Content">
|
||||||
<h3>Card Tap</h3>
|
<h3>Card Tap</h3>
|
||||||
@@ -681,6 +743,8 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
|
|
||||||
|
var tax_type = $("input:radio[name=tax_type]:checked").val();
|
||||||
|
|
||||||
if (credit <= 0) {
|
if (credit <= 0) {
|
||||||
calculate_member_discount(sale_id);
|
calculate_member_discount(sale_id);
|
||||||
}
|
}
|
||||||
@@ -689,7 +753,7 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_cash_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
|
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
/* start delete receipt no in first bill*/
|
/* start delete receipt no in first bill*/
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
@@ -1346,4 +1410,41 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Start function for tax changable */
|
||||||
|
$(".change_tax").on("click",function(){
|
||||||
|
$("#change_taxModal").modal({show: true, backdrop: false, keyboard: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("button[name=tax_type]").on("click", function(){
|
||||||
|
var type = $(this).attr("data-value");
|
||||||
|
var cashier_type = '<%= @cashier_type %>';
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
console.log(type);
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to change tax?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, change it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||||
|
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
|
||||||
|
success:function(data){
|
||||||
|
if(data.status){
|
||||||
|
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
swal.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/* End function for tax changable */
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -126,7 +126,9 @@
|
|||||||
|
|
||||||
$('.sale_item').on('click', function () {
|
$('.sale_item').on('click', function () {
|
||||||
$('#order-items-table tr').siblings().css( "background-color", "white" );
|
$('#order-items-table tr').siblings().css( "background-color", "white" );
|
||||||
this.style.backgroundColor = 'lightgray';
|
$('#order-items-table tr').siblings().css( "color", "black" );
|
||||||
|
this.style.backgroundColor = 'blue';
|
||||||
|
this.style.color = 'white';
|
||||||
var sale_item_id = this.getAttribute('data-sale-item');
|
var sale_item_id = this.getAttribute('data-sale-item');
|
||||||
var ajax_url = "/origami/select_sale_item";
|
var ajax_url = "/origami/select_sale_item";
|
||||||
selected_sale_item = sale_item_id;
|
selected_sale_item = sale_item_id;
|
||||||
@@ -179,11 +181,17 @@
|
|||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: param_data,
|
data: param_data,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
console.log(selected_sale_item + "," +commissioner_id);
|
console.log(result);
|
||||||
if(result.deselect == true){
|
if(result.deselect == true){
|
||||||
$(commissioner).removeClass("blue").addClass("green");
|
$(commissioner).removeClass("blue").addClass("green");
|
||||||
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
|
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
|
||||||
}
|
}
|
||||||
|
if(result.status == true){
|
||||||
|
swal("Information",result.message,"success");
|
||||||
|
}else{
|
||||||
|
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
|
||||||
|
swal("Opps",result.message,"warning");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<td><%= result.sale_id rescue '-' %></td>
|
<td><%= result.sale_id rescue '-' %></td>
|
||||||
<td><%= result.sale_item_id rescue '-' %></td>
|
<td><%= result.sale_item_id rescue '-' %></td>
|
||||||
<td><%= result.commissioner.name rescue '-' %></td>
|
<td><%= result.commissioner.name rescue '-' %></td>
|
||||||
<td><%= result.commission.menu_item.name rescue '-' %></td>
|
<td><%= result.porduct_name rescue '-' %></td>
|
||||||
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
|
|||||||
@@ -1,158 +1,173 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
<div class="col-md-12 col-lg-12">
|
||||||
|
<div class="card" style="width:129%;">
|
||||||
<div class="row">
|
<div class="body table-responsive">
|
||||||
<div class="col-md-12 col-lg-12">
|
<table class="table table-bordered">
|
||||||
<div class="card" >
|
<thead>
|
||||||
<div class="body table-responsive">
|
<tr>
|
||||||
<table class="table table-bordered">
|
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
<thead>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
</tr>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
||||||
<tr>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.mpu_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.master_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.visa_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.mpu_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.jcb_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.master_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.visa_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.jcb_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.paymal_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.dinga_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.paymal_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.dinga_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.redeem_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<% unless @sale_data.empty? %>
|
|
||||||
|
|
||||||
<tbody>
|
</tr>
|
||||||
<% void = 0 %>
|
</thead>
|
||||||
<% mpu = 0 %>
|
<% if @print_settings.precision.to_i > 0
|
||||||
<% master = 0 %>
|
precision = @print_settings.precision
|
||||||
<% visa = 0 %>
|
else
|
||||||
<% jcb = 0 %>
|
precision = 0
|
||||||
<% unionpay = 0 %>
|
end
|
||||||
<% alipay = 0 %>
|
#check delimiter
|
||||||
<% paymal = 0 %>
|
if @print_settings.delimiter
|
||||||
<% dinga = 0 %>
|
delimiter = ","
|
||||||
<% junctionpay = 0 %>
|
else
|
||||||
<% paypar = 0 %>
|
delimiter = ""
|
||||||
<% cash = 0 %>
|
end
|
||||||
<% credit = 0 %>
|
%>
|
||||||
<% foc = 0 %>
|
<% unless @sale_data.empty? %>
|
||||||
<% discount = 0 %>
|
|
||||||
<% total = 0 %>
|
|
||||||
<% grand_total = 0 %>
|
|
||||||
<% old_grand_total = 0 %>
|
|
||||||
<% count = 1 %> <% rounding_adj = 0 %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% void += sale[:void_amount] %>
|
|
||||||
<% mpu += sale[:mpu_amount] %>
|
|
||||||
<% master += sale[:master_amount] %>
|
|
||||||
<% visa += sale[:visa_amount] %>
|
|
||||||
<% jcb += sale[:jcb_amount] %>
|
|
||||||
<% unionpay += sale[:unionpay_amount] %>
|
|
||||||
<% alipay += sale[:alipay_amount] %>
|
|
||||||
<% paymal += sale[:paymal_amount] %>
|
|
||||||
<% dinga += sale[:dinga_amount] %>
|
|
||||||
<% junctionpay += sale[:junctionpay_amount] %>
|
|
||||||
<% paypar += sale[:paypar_amount] %>
|
|
||||||
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
|
||||||
<% credit += sale[:credit_amount] %>
|
|
||||||
<% foc += sale[:foc_amount] %>
|
|
||||||
<% discount += sale[:total_discount] %>
|
|
||||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
|
||||||
<% grand_total += sale[:grand_total].to_f %>
|
|
||||||
<% old_grand_total += sale[:old_grand_total].to_f %>
|
|
||||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
|
||||||
<tr>
|
|
||||||
<td style='text-align:right;'><%= count %></td>
|
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
<tbody>
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
<% void = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%></td>
|
<% mpu = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
<% master = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
<% visa = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
<% jcb = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%></td>
|
<% unionpay = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
<% alipay = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
<% paymal = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
<% dinga = 0 %>
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
<% junctionpay = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
<% paypar = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
<% cash = 0 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
<% credit = 0 %>
|
||||||
</tr>
|
<% foc = 0 %>
|
||||||
|
<% discount = 0 %>
|
||||||
|
<% total = 0 %>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% old_grand_total = 0 %>
|
||||||
|
<% count = 1 %> <% rounding_adj = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% void += sale[:void_amount] %>
|
||||||
|
<% mpu += sale[:mpu_amount] %>
|
||||||
|
<% master += sale[:master_amount] %>
|
||||||
|
<% visa += sale[:visa_amount] %>
|
||||||
|
<% jcb += sale[:jcb_amount] %>
|
||||||
|
<% unionpay += sale[:unionpay_amount] %>
|
||||||
|
<% alipay += sale[:alipay_amount] %>
|
||||||
|
<% paymal += sale[:paymal_amount] %>
|
||||||
|
<% dinga += sale[:dinga_amount] %>
|
||||||
|
<% junctionpay += sale[:junctionpay_amount] %>
|
||||||
|
<% paypar += sale[:paypar_amount] %>
|
||||||
|
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
||||||
|
<% credit += sale[:credit_amount] %>
|
||||||
|
<% foc += sale[:foc_amount] %>
|
||||||
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
|
<% old_grand_total += sale[:old_grand_total].to_f %>
|
||||||
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:right;'><%= count %></td>
|
||||||
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), delimiter: delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<!-- <td style='text-align:right;'><%= number_with_delimiter(sale[:grand_total].to_f + sale[:rounding_adj].to_f ,delimiter => ',') rescue '-'%></td> -->
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f),delimiter => ',') rescue '-'%></td>
|
||||||
|
|
||||||
<% total_tax = 0 %>
|
</tr>
|
||||||
<% net = 0 %>
|
<% count = count + 1 %>
|
||||||
<% unless @tax.empty? %>
|
<% end %>
|
||||||
<% @tax.each do |tax| %>
|
|
||||||
<% total_tax += tax.tax_amount.to_f %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
<tr style="font-weight:600;">
|
||||||
<% net = grand_total %>
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
<% net = net - rounding_adj%>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu),delimiter => ',') rescue '-'%></td>
|
||||||
<% net = net - total_tax %>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master),delimiter => ',') rescue '-'%></td>
|
||||||
<tr style="font-weight:600;">
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), delimiter => ',') rescue '-'%></td>
|
||||||
<td colspan="12" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb),delimiter => ',') rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",unionpay),delimiter => ',') rescue '-'%></td>
|
||||||
<td colspan="2"> </td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",alipay),delimiter => ',') rescue '-'%></td>
|
||||||
</tr>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paymal),delimiter => ',') rescue '-'%></td>
|
||||||
<% end %>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",dinga),delimiter => ',') rescue '-'%></td>
|
||||||
</tbody>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",junctionpay),delimiter => ',') rescue '-'%></td>
|
||||||
<% end %>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar),delimiter => ',') rescue '-'%></td>
|
||||||
</table>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(discount,delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<!-- <td style='text-align:right;'><%= number_with_delimiter(total,delimiter => ',') rescue '-'%></td> -->
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj),delimiter => ',') rescue '-'%></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% net = 0 %>
|
||||||
|
<% unless @tax.empty? %>
|
||||||
|
<% @tax.each do |tax|
|
||||||
|
total_tax += tax.tax_amount.to_f %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% net = grand_total %>
|
||||||
|
<% net = net - rounding_adj%>
|
||||||
|
<% net = net - total_tax %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net),delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -199,6 +199,8 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post 'payment/junctionpay' => 'junctionpay#create'
|
post 'payment/junctionpay' => 'junctionpay#create'
|
||||||
post 'payment/dinga' => 'dinga#create'
|
post 'payment/dinga' => 'dinga#create'
|
||||||
|
|
||||||
|
post 'payment/:type/change_tax' => 'payments#change_tax', :defaults => {:format => 'json'}
|
||||||
|
|
||||||
get 'sale/:sale_id/:type/payment/credit_payment' => "credit_payments#index"
|
get 'sale/:sale_id/:type/payment/credit_payment' => "credit_payments#index"
|
||||||
get 'sale/:sale_id/:type/payment/others_payment' => "others_payments#index"
|
get 'sale/:sale_id/:type/payment/others_payment' => "others_payments#index"
|
||||||
get 'sale/:sale_id/:type/payment/others_payment/MPU' => "mpu#index"
|
get 'sale/:sale_id/:type/payment/others_payment/MPU' => "mpu#index"
|
||||||
|
|||||||
@@ -15,18 +15,19 @@ namespace :clear do
|
|||||||
ShiftSale.delete_all
|
ShiftSale.delete_all
|
||||||
PaymentJournal.delete_all
|
PaymentJournal.delete_all
|
||||||
Survey.delete_all
|
Survey.delete_all
|
||||||
|
ProductCommission.delete_all
|
||||||
DiningFacility.update_all(status:'available')
|
DiningFacility.update_all(status:'available')
|
||||||
CashierTerminal.update_all(is_currently_login: 0)
|
CashierTerminal.update_all(is_currently_login: 0)
|
||||||
SeedGenerator.where("id > 1").update(:current => 0, :next => 0)
|
SeedGenerator.where("id > 1").update(:current => 0, :next => 0)
|
||||||
Receipt.delete_all
|
# Receipt.delete_all
|
||||||
ReceiptDetail.delete_all
|
# ReceiptDetail.delete_all
|
||||||
OrderReservation.delete_all
|
OrderReservation.delete_all
|
||||||
OrderReservationItem.delete_all
|
OrderReservationItem.delete_all
|
||||||
Delivery.delete_all
|
Delivery.delete_all
|
||||||
puts "Clear Data Done."
|
puts "Clear Data Done."
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Clear Menu"
|
desc "Clear-- Menu"
|
||||||
task :menu => :environment do
|
task :menu => :environment do
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user