Add total waste and spoil in close cashier and Closing Balance မွာ Character ေတြ ရိုက္လို႕ရေန

This commit is contained in:
San Wai Lwin
2018-05-14 15:31:00 +06:30
parent 49319d80cc
commit 8fda04372d
32 changed files with 549 additions and 205 deletions

View File

@@ -8,5 +8,7 @@ COPY Gemfile /sxrestaurant/Gemfile
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
RUN bundle install --without development test
RUN bundle exec rails assets:precompile
RUN echo "Asia/Rangoon" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
COPY . /sxrestaurant

View File

@@ -5,6 +5,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
received: function(data) {
var order = data.data;
var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
@@ -18,30 +19,33 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
});
// alert(order_lists);
// swal({
// title: 'Information',
// target: document.getElementById("notify_new_order"),
// text: "You have new orders <br/>"+
// "Are you accept or reject for these orders <b>"+order_lists+"</b>?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// swal.close();
// }
// });
$("#notify_new_order_lists").text(order_lists);
$("#notify_new_order").on('show.bs.modal', function(e){
$("#notify_order_send_to_kitchen").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
}).on('shown.bs.modal', function(e){
$("#notify_new_order").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_new_order").modal("hide");
}).modal({show: true, keyboard: false, backdrop: false});
swal({
title: 'Information',
target: document.getElementById(shop_code+"_notify_new_order"),
text: "You have new orders <br/>"+
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
swal.close();
}
});
// $("#notify_new_order_lists").text(order_lists);
// if($("#notify_new_order").hasClass("hidden")){
// $("#notify_new_order").removeClass("hidden");
// }
// $("#notify_new_order").on('show.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_new_order").focus();
// }).on('hide.bs.modal', function (e) {
// $("#notify_new_order").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -5,6 +5,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
received: function(data) {
var order = data.data;
var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
@@ -18,30 +19,33 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
});
// alert(order_lists);
// swal({
// title: 'Information',
// target: document.getElementById("notify_order_ready_to_delivery"),
// text: "You have orders that are ready to deliver <br/>"+
// "Could you ready these orders <b>"+order_lists+"</b> to deliver?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// swal.close();
// }
// });
$("#notify_order_ready_to_delivery_lists").text(order_lists);
$("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_send_to_kitchen").modal('hide');
}).on('shown.bs.modal', function(e){
$("#notify_order_ready_to_delivery").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_order_ready_to_delivery").modal("hide");
}).modal({show: true, keyboard: false, backdrop: false});
swal({
title: 'Information',
target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
text: "You have orders that are ready to deliver <br/>"+
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
swal.close();
}
});
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
// $("#notify_order_ready_to_delivery").removeClass("hidden");
// }
// $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_send_to_kitchen").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_order_ready_to_delivery").focus();
// }).on('hide.bs.modal', function (e) {
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -5,6 +5,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
received: function(data) {
var order = data.data;
var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
@@ -18,30 +19,33 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
});
// alert(order_lists);
// swal({
// title: 'Information',
// target: document.getElementById("notify_order_send_to_kitchen"),
// text: "You have to send order to kitchen <br/>"+
// "Could you send these orders <b>"+order_lists+"</b> to kitchen?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// swal.close();
// }
// });
$("#notify_order_send_to_kitchen_lists").text(order_lists);
$("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
}).on('shown.bs.modal', function(e){
$("#notify_order_send_to_kitchen").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_order_send_to_kitchen").modal("hide");
}).modal({show: true, keyboard: false, backdrop: false});
swal({
title: 'Information',
target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
text: "You have to send order to kitchen <br/>"+
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
swal.close();
}
});
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
// $("#notify_order_send_to_kitchen").removeClass("hidden");
// }
// $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").focus();
// }).on('hide.bs.modal', function (e) {
// $("#notify_order_send_to_kitchen").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -3,16 +3,17 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
disconnected: function() {},
received: function(data) {
received: function(data) {
var shop_code = data.shop_code;
var order = data.data;
if(order.length > 0){
$('.order_reserve_cable tbody').html("");
$(".nav-item.red > a > p.num").text(order.length);
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').html("");
$("."+shop_code+" > .nav-item.red > a > p.num").text(order.length);
$.each(order, function(key,value){
var active_class = "";
if(key==0){
active_class = "tr-active";
showNewOrder(order[key]);
showNewOrder(order[key],shop_code);
}
var rowCount = key+1;
var date = new Date(value.created_at);
@@ -20,9 +21,9 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
var created_at = date.getFullYear() +'-'+ (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >=10?date.getDate() : '0'+date.getDate());
var delivery_type = "";
if(value.delivery_type == "service"){
if(value.provider == "food2u" || value.provider == "yangondoor2door"){
delivery_type = "DELIVERY";
}else if(value.delivery_type == "pick_up"){
}else if(value.provider == "pick_up"){
delivery_type = "PICK-UP";
}else{
delivery_type = "DIRECT DELIVERY";
@@ -42,7 +43,7 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
+'</td>'
+' </tr>';
$('.custom-table.order_reserve_cable tbody').append(row);
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').append(row);
});
}

View File

@@ -54,7 +54,17 @@ $(document).ready(function() {
});
$('#modal-set-slimscroll').slimScroll({
height: height-$('#modal-slimscroll').attr('data-height'),
height: height-$('#modal-set-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
$('#customer-info-slimscroll').slimScroll({
height: height-$('#customer-info-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,

View File

@@ -5,6 +5,7 @@ $(function() {
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
$(function() {
$('.first-1').click();
});
@@ -17,6 +18,7 @@ $(function() {
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("ACCEPT");
@@ -36,6 +38,7 @@ $(function() {
$('#accepted').attr("data-value","completed");
}else if(type == "processed"){
$(".fifth-1").click();
$(".order_close_cashier").show();
// $('#accepted').hide();
// $('#cancel').hide();
}
@@ -119,6 +122,12 @@ $(function() {
callback_url(callback,ref_no,order_id,status,type,minutes);
});
$('#order_close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/ordering/close';
warnBeforeRedirect(linkURL);
});
$(document).on('click','.access_number', function(event){
if(event.handled !== true) {
var original_value = $('#access_code').val();
@@ -147,8 +156,40 @@ $(function() {
return false;
}
});
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){
// var code = $(this).attr("data-value");
// $("#"+code+"_doemal_new_order").modal("hide");
// });
// $("[data-dismiss='modal']").on('click', function() {
// $('body').addClass('modal-open-fix');
// if($('body').css("padding-right") == '15px') {
// $('body').addClass('modal-open-fix-pad');
// }
// setTimeout(function() {
// if($('body').hasClass('modal-open-fix-pad')) {
// $('body').css('padding-right', '15px');
// }
// $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
// }, 1000);
// });
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
@@ -193,6 +234,8 @@ function refreshDetailData(){
$('#discount_amount').text("0.00");
$('#total_tax').text("0.00");
$('#grand_total').text("0.00");
$(".tbl_customer").hide();
$(".order_close_cashier").hide();
}
//show order list
@@ -280,19 +323,21 @@ function show_order_detail(url,sr_no){
$('#customer_name').text(data.customer_name);
$('#phone').text(data.phone);
$('#address').text(address);
$('#delivery_to').text(delivery.provider);
$('#ref_no').text(data.transaction_ref);
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
$("#trans_ref").text(data.transaction_ref);
if(delivery.delivery_type == "service"){
if(delivery.provider == "food2u" || delivery.provider == "yangondoor2door"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "pick_up"){
$("#delivery_to").text("DELIVERY");
}else if(delivery.provider == "pick_up"){
$("#delivery_info").text("(PICK-UP)");
$("#delivery_to").text("PICK-UP");
}else{
$("#delivery_info").text("(DIRECT DELIVERY)");
$("#delivery_to").text("DIRECT DELIVERY");
}
if(data.order_remark!=null && data.order_remark!=""){
@@ -375,6 +420,18 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
}, function () {
window.location.href = '/origami/order_reservation';
});
}else{
swal({
title: 'Oops',
text: data.message,
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
}
}
});
@@ -404,27 +461,47 @@ function timeFormat(date){
return time;
}
function showNewOrder(order_reservation){
// console.log(order_reservation);
function showNewOrder(order_reservation,shop_code){
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
var date = new Date(order_reservation.requested_time);
var time = timeFormat(date);
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
//audio play
var audio = new Audio('/beep.wav'); // define your audio
var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
// $("#new_order").text(order_reservation.order_reservation_id);
// $("#new_order_date").text(requested_date);
// if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
// $("#"+shop_code+"_doemal_new_order").removeClass("hidden");
// }
// $("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#"+shop_code+"_doemal_new_order").focus();
// }).on('hide.bs.modal', function (e) {
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
swal({
html: true,
title: 'Information',
text: "You have new order <b>" + order_reservation.order_reservation_id + "</b> at <b>"+requested_date+"</b>",
target: document.getElementById(shop_code+"_notify_new_order"),
text: "You have new order "+
"<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
audio.pause();
swal.close();
}
});
}
}

View File

@@ -32,31 +32,31 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
def create
status = false
if !params[:cus_info]
render :json => { :status => false, :message => "cus_info is required!" }
result = { :status => false, :message => "cus_info is required!" }
elsif !params[:requested_time]
render :json => { :status => false, :message => "requested_time is required!" }
result = { :status => false, :message => "requested_time is required!" }
elsif !params[:callback_url]
render :json => { :status => false, :message => "callback_url is required!" }
result = { :status => false, :message => "callback_url is required!" }
elsif !params[:reference]
render :json => { :status => false, :message => "reference is required!" }
result = { :status => false, :message => "reference is required!" }
elsif !params[:order_type]
render :json => { :status => false, :message => "order_type is required!" }
result = { :status => false, :message => "order_type is required!" }
elsif params[:order_type] == ORDER || params[:order_type] == ORDER_RESERVATION
if !params[:order_info]
render :json => { :status => false, :message => "order_info is required!" }
result = { :status => false, :message => "order_info is required!" }
else
status = true
end
elsif params[:order_type] == RESERVATION || params[:order_type] == ORDER_RESERVATION
if !params[:reservation_info]
render :json => { :status => false, :message => "reservation_info is required!" }
result = { :status => false, :message => "reservation_info is required!" }
else
status = true
end
elsif !params[:payment_info]
render :json => { :status => false, :message => "payment_info is required!" }
result = { :status => false, :message => "payment_info is required!" }
elsif !params[:delivery_info]
render :json => { :status => false, :message => "delivery_info is required!" }
result = { :status => false, :message => "delivery_info is required!" }
end
if status == true
@@ -64,16 +64,27 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
if flag #&& ENV["SERVER_MODE"] != 'cloud'
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
end
if flag
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation,shop_code: shop_code
else
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
end
end
puts "!!! send doemal ::"
puts result
Rails.logger.debug "send status to doemal"
Rails.logger.debug result
render :json => result
end
def update_status

View File

@@ -18,7 +18,7 @@ module TokenVerification
# Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
from = "local" #request.subdomain.downcase + "." + request.domain.downcase
from = request.subdomain.downcase + "." + request.domain.downcase #"local"
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
end

View File

@@ -89,7 +89,6 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with delivery status
def queue_items_query(status)
byebug
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id

View File

@@ -67,6 +67,8 @@ class Origami::AddordersController < BaseOrigamiController
end
def get_menu()
puts "sssssssssssssss"
puts params[:id]
if (params[:id])
#Pull this menu
@menu = Menu.find_by_id(params[:id])

View File

@@ -4,6 +4,7 @@ class Origami::OrderReservationController < BaseOrigamiController
@order = OrderReservation.latest_order #.active
@count_on_order = OrderReservation.get_count_on_order
@count_on_completed = OrderReservation.get_count_on_completed
@shop = Shop.find_by_id(1)
end
def update

View File

@@ -81,8 +81,8 @@ class Origami::ShiftsController < BaseOrigamiController
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
byebug
@total_waste = Sale.get_total_waste(@shift)
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
@@ -96,10 +96,9 @@ class Origami::ShiftsController < BaseOrigamiController
# get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code)
#byebug
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges)
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile)
end
end
Employee.logout(session[:session_token])

View File

@@ -64,7 +64,7 @@ class MyAesCrypt
shop_json["data"].each do |j|
if j["lookup"] == from
# add [0...44] for production cloud for remove \n
if(j["value"]["key"] == token)
if(j["value"]["key"].gsub(/\s+/, "") == token)
return true
end
end

View File

@@ -93,9 +93,6 @@ class OrderReservation < ApplicationRecord
count += 1
items_arr.push(items)
}
puts items_arr.to_json
puts "sssssssssssssssssssssss"
customer_id = order.customer_id
@order = Order.new
@@ -125,8 +122,11 @@ class OrderReservation < ApplicationRecord
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
return result
else
result = {:status=> @status, :message => "No current shift open for this employee!" }
end
return result
end
def self.update_doemal_payment(order,current_user)
@@ -178,10 +178,9 @@ class OrderReservation < ApplicationRecord
end
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
if !waiting_time.nil?
if waiting_time != ""
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
elsif !reason.nil?
elsif reason != ""
send_params = {id: ref_no, status: status, reason: reason}
else
send_params = {id: ref_no, status: status}
@@ -290,28 +289,46 @@ class OrderReservation < ApplicationRecord
end
def self.check_new_order
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
order_reservation = OrderReservation.where("status='new'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
end
end
end
def self.check_order_send_to_kitchen
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
end
end
end
def self.check_order_ready_to_delivery
shop = Shop.find_by_id(1)
if !shop.shop_code.nil?
shop_code = shop.shop_code
else
shop_code = ''
end
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
end
end
end

View File

@@ -38,7 +38,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
# self.print(filename, cashier_terminal.printer_name)
# end
def print_close_cashier(printer_settings,cashier_terminal,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
def print_close_cashier(printer_settings,cashier_terminal,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile)
#Use CUPS service
#Generate PDF
@@ -46,7 +46,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
cashier = shift_sale.employee.name
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_waste,total_spoile)
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
if !close_cashier_pdf.empty?
@@ -55,7 +55,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
if close_cashier[1] == '1'
pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
else
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_waste,total_spoile)
end
end
end

View File

@@ -1092,6 +1092,14 @@ end
return sale_arr
end
def self.get_total_waste(shift_id)
query = Sale.where("sale_status = 'waste' and shift_sale_id = ?", shift_id)
end
def self.get_total_spoile(shift_id)
query = Sale.where("sale_status = 'spoile' and shift_sale_id = ?", shift_id)
end
def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
# wrong amount tax for service and commercial tax

View File

@@ -94,11 +94,6 @@ class ShiftSale < ApplicationRecord
end
end
def self.get_total_waste(shift)
total_waste = Sale.select(" SUM(grand_total) as total_waste")
.where("sales.payment_status ='waste' and sale_status = 'waste'", shift.id)
end
def get_closing_balance(shift)
shiftobj = ShiftSale.find(shift)
closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash

View File

@@ -70,7 +70,7 @@ class CloseCashierCustomisePdf < Prawn::Document
stroke_horizontal_rule
end
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges)
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_spoile)
move_down 7
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do

View File

@@ -2,7 +2,7 @@ class CloseCashierPdf < Prawn::Document
include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_waste,total_spoile)
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i
@@ -54,7 +54,7 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter)
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter,total_waste,total_spoile)
end
def header (shop_details)
@@ -70,7 +70,7 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
end
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter)
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile)
move_down 7
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
@@ -333,7 +333,7 @@ class CloseCashierPdf < Prawn::Document
text "(#{ number_with_precision(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
end
y_position = cursor
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Void :", :size => self.item_font_size, :align => :right
end
@@ -341,6 +341,22 @@ class CloseCashierPdf < Prawn::Document
text "(#{shift_sale.total_void})", :size => self.item_font_size, :align => :right
end
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Waste :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "(#{ number_with_precision(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
end
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Waste :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "(#{ number_with_precision(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
end
# y_position = cursor
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
# text "Grand Total :", :size => self.item_font_size, :align => :right

View File

@@ -650,11 +650,58 @@
$(document).on('click', '.menu_click', function(event){
var menu_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url);
var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
menu_click_cache_append(name,menus,menu_id);
}else{
var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url);
}
});
//End menu category Click
function menu_click_cache_append(name,menus,menu_id) {
var menu_list = $('.menu_items_list');
menu_list.empty();
var menu_cat = $('.category_list');
menu_cat.empty();
$(".main_menu").text(name);
for(var i in menus) {
console.log(menus)
console.log(menus[i]["id"]);
console.log(menus[i]["is_active"]);
console.log(menu_id);
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
// menu_list_template(menus[i]);
var category = menus[i]["categories"];
for(var ii in category) {
if (category[ii]["is_available"]== true){
if (category[ii]["valid_time"]== true){
if (category[ii]["parent_id"] == null ){
if(type){
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}
}else{
if ($("#table_get_current").text()) {
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}else {
category_list_template(category[ii]);
}
}
}
}
}
}
}
}
}
}
//show menu item list when click menu category
function show_menu_cat_list(name, url_item){
var menu_list = $('.menu_items_list');
@@ -663,15 +710,18 @@
var menu_cat = $('.category_list');
menu_cat.empty();
$(".main_menu").text(name)
if (modify_order=="true" && type =="true") {
$(".main_menu").text(name);
cashier_type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
if (cashier_type != -1 && modify_order != -1) {
url_item = '../../../addorders/'+url_item;
}if(modify_order=="false" && type =="true"){
url_item = 'addorders/'+url_item
}else{
url_item = url_item;
}
if(modify_order == -1 && cashier_type != -1){
url_item = 'addorders/'+url_item
}
if (cashier_type ==-1 && modify_order == -1){
url_item = url_item;
}
//Start Ajax
$.ajax({
type: "GET",
@@ -679,10 +729,8 @@
data: {},
dataType: "json",
success: function(data) {
for(var i in data) {
if (data[i].is_available == true) {
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
+' <div class="card-block custom-card-block">'
+' <p>'+ data[i].name +'<p>'

View File

@@ -30,7 +30,7 @@
<!-- end count function -->
<div class="row m-t--10">
<div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<ul class="nav nav-tabs tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist">
<li class="nav-item red m-b-5" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab">
<p class="num p-t-5">
@@ -67,7 +67,7 @@
<div class="tab-pane active" id="pending" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table order_reserve_cable">
<table class="table table-stripe custom-table <%= @shop.shop_code ? @shop.shop_code : '' %>_order_reserve_cable">
<tbody>
<% i=1
@order.each do |order| %>
@@ -389,34 +389,36 @@
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
<tr>
<td width ="" class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td>
</tr>
</table>
</div>
<div class="card-block" style="height: 520px">
<div class="card-block" id="customer-info-slimscroll" data-height="95">
<table class="table tbl_customer">
<tbody>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">REF.</span><br>
<b id="trans_ref"></b>
</td>
<td class="body-td align-right">
<span class="font-13">REQUESTED TIME</span><br>
<b id="requested_time"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
<span class="font-13">REQUESTED TIME</span><br>
<b id="requested_time"></b>
</td>
<td class="body-td align-right expected_time">
<span class="font-13">COOKING TIME</span><br>
<b><span id="expected_time"></span> MINS</b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">PHONE</span><br>
@@ -449,12 +451,23 @@
</tbody>
</table>
</div>
<div class="card-footer order_close_cashier">
<% if current_user.role != "waiter" %>
<div class="row">
<div class="col-sm-7 col-xs-7 col-md-7 col-lg-7"></div>
<div class="col-sm-4 col-xs-4 col-md-4 col-lg-4">
<button id="order_close_cashier" class="align-right text-center btn btn-md btn-link btn-primary waves-effect"><%= t("views.btn.close_cashier") %></button>
</div>
</div>
<% end %>
</div>
</div>
</div>
<!-- <div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div> -->
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_new_order"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
</div>
<p id="ref_no" class="hidden"></p>
@@ -571,6 +584,28 @@
</div>
</div>
<!-- <div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="doemal_new_orderLabel">New Order</h4><hr>
</div>
<div class="modal-body doemal_new_orderBody">
<div class="form-group text-center">
You have new order <b><span id="new_order"></span></b> requested for <b><span id="new_order_date"></span></b>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect new_order_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
@@ -636,4 +671,4 @@
</div>
</div>
</div>
</div>
</div> -->

View File

@@ -457,7 +457,7 @@
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button> -->
<% end %>
@@ -519,6 +519,29 @@
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -979,22 +1002,58 @@ $('#add_invoice').on('click',function(){
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/cashier/edit";
});
$('#void').on('click',function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
// $('#void').on('click',function () {
// var sure = confirm("Are you sure want to Void");
// if (sure == true) {
// var sale_id = $('#sale_id').val();
// var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
// $.ajax({
// type: 'POST',
// url: ajax_url,
// success: function () {
// window.location.href = '/origami/';
// }
// })
// } else {
// }
// });
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
var remark = $("#remark").val();
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/';
}
});
}
});
}else{
swal("Opps","You are not authorized for void","warning")
}
});
});
$('#commissions').on('click', function () {
var dining_id = "<%= @room.id %>"
@@ -1081,6 +1140,12 @@ $('#add_invoice').on('click',function(){
});
}
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({

View File

@@ -24,14 +24,14 @@
<span style='font-size:20px;'><b><%= t :closing_balance %></b></span>
</div>
<div class='col-md-6'>
<span style='font-size:20px;'><b><input type='text' class="form-control" id='closing_balance_amount' value=''></b></span>
<span style='font-size:20px;'><b><input type='number' class="form-control" id='closing_balance_amount' value='' onkeypress="return isNumberKey(event);" onkeyup="notNegative(this.value);"></b></span>
</div>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button>
<% if @bank_integration == '1' %>
<% if @bank_integration == '1' && @cashier_type!="ordering" %>
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
<% end %>
</div>
@@ -58,6 +58,20 @@
</div>
</div>
<script>
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
function greaterThanOne(val){
if(parseInt(val)==0) $("#closing_balance_amount").val(1);
}
var cashier_type = '<%= @cashier_type %>';
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();
@@ -73,10 +87,12 @@
});
$('#back').on('click',function(){
if(cashier_type!='quick_service'){
if(cashier_type=='cashier'){
window.location.href = '/origami';
}else{
}else if(cashier_type=='quick_service'){
window.location.href = '/origami/quick_service';
}else{
window.location.href = '/origami/order_reservation';
}
});

View File

@@ -9,7 +9,7 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
@@ -67,29 +67,29 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
<%= f.input :child , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :adult , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
<%= f.input :adult , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :male , input_html: { class: 'col-md-10' }%>
<%= f.input :male , input_html: { min:'1',class: 'col-md-10' }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :female , input_html: { class: 'col-md-10' }%>
<%= f.input :female , input_html: { min:'1',class: 'col-md-10' }%>
</div>
</div>
</div>
<%= f.input :total_customer, input_html: { :readonly => true, class: 'col-md-11'} %>
<%= f.input :local , input_html: { class: 'col-md-11' }%>
<%= f.input :total_customer, input_html: { :readonly => true,min:'1', class: 'col-md-11'} %>
<%= f.input :local , input_html: { min:'1',class: 'col-md-11' }%>
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>

View File

@@ -151,23 +151,23 @@
<% total_tax = 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_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% @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_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
<% end %>
<% net = total - 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_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
</tbody>
</tbody>
<% end %>
</table>
</div>

View File

@@ -59,16 +59,18 @@
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<!-- all total qty sum -->
<!--
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
-->
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<!-- end all total qty -->
<!--
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
@@ -76,7 +78,7 @@
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
-->
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
@@ -103,7 +105,12 @@
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<% if sale.status_type != "Discount" %>
<td><%= sale.total_item rescue '-' %></td>
<%else%>
<td><%= sale.total_item*(-1) rescue '-' %></td>
<% end %>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
@@ -114,10 +121,12 @@
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>

7
config/cable.yml Executable file
View File

@@ -0,0 +1,7 @@
redis: &redis
adapter: redis
url: redis://localhost:6379/1
production: *redis
development: *redis
test: *redis

View File

@@ -13,6 +13,20 @@
"key": "634W2ioj6QA88vafKamHBRu5aKX/BLIPdTWuuXGFBsA=\n",
"iv": "QqpO/h7o60dYTbNETRbZ4g==\n"
}
},
{
"lookup": "order-111.pos-myanmar.test",
"value": {
"key": "7NA6WkE58MZ56w6CUPEyUN5ZlWzuidRDkc2ao6LeHTs=\n",
"iv": "B94kSYIdH6ff8s1ltQzB1Q==\n"
}
},
{
"lookup": "aungcafe-212.pos-myanmar.test",
"value": {
"key": "DvPxzB6QjHNnfuxBz6rdOuSn0/5TkckwCu3jNv0geHY=\n",
"iv": "pJ5k8JKbfti70KQoLZCm/Q==\n"
}
}
]
}

View File

@@ -4,7 +4,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.string :order_reservation_id, :limit => 16, :primary_key => true
t.string :order_reservation_type, :null => false
t.string :customer_id, :null => false
t.datetime :requested_time, :null => false
t.string :requested_time, :null => false
t.string :callback_url, :null => false
t.string :transaction_ref, :null => false
t.string :sale_id
@@ -21,7 +21,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :status, :null => false, :default => "new"
t.string :order_remark
t.string :reservation_remark
t.string :remark
t.timestamps
end
end

BIN
public/beep.mp3 Normal file

Binary file not shown.

Binary file not shown.