Pull from master

This commit is contained in:
San Wai Lwin
2018-04-19 10:49:25 +06:30
parent 70ec80a1d5
commit 0241d209ac
28 changed files with 529 additions and 220 deletions

View File

@@ -52,6 +52,7 @@ gem 'rubyzip', '= 1.0.0'
gem 'axlsx', '= 2.0.1' gem 'axlsx', '= 2.0.1'
gem 'axlsx_rails' gem 'axlsx_rails'
gem 'roo' gem 'roo'
gem 'pdfjs_viewer-rails'
#Reporting gem #Reporting gem
#gem 'compendium' #gem 'compendium'
#gem "cancan" #gem "cancan"

View File

@@ -125,6 +125,7 @@ GEM
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1) jquery-ui-rails (6.0.1)
railties (>= 3.2.16) railties (>= 3.2.16)
json (2.1.0)
kaminari (1.0.1) kaminari (1.0.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.0.1) kaminari-actionview (= 1.0.1)
@@ -168,6 +169,10 @@ GEM
nokogiri (1.8.1) nokogiri (1.8.1)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
pdf-core (0.7.0) pdf-core (0.7.0)
pdfjs_viewer-rails (0.2.0)
json (> 1.8.4)
rails (> 4.2.0)
sass-rails (~> 5.0)
pg (0.21.0) pg (0.21.0)
prawn (2.2.2) prawn (2.2.2)
pdf-core (~> 0.7.0) pdf-core (~> 0.7.0)
@@ -333,6 +338,7 @@ DEPENDENCIES
momentjs-rails momentjs-rails
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
nested_form nested_form
pdfjs_viewer-rails
pg pg
prawn prawn
prawn-table prawn-table

Binary file not shown.

View File

@@ -2,37 +2,56 @@
$(function() { $(function() {
$(".nav-item").on("click", function(){ $(".nav-item").on("click", function(){
type = $(this).attr("data-type"); type = $(this).attr("data-type");
if (type == "pending") { refreshDetailData();
$('#accepted').text("Accepted"); if (type == "pending") {
$('#accepted').attr("data-value","accepted"); $(".first-1").click();
}else if(type == "processing"){ $('#accepted').text("Accepted");
$('#accepted').text("SEND TO KITCHEN"); $('#accepted').attr("data-value","accepted");
$('#accepted').attr("data-value","processed"); }else if(type == "processing"){
}else if(type == "delivery"){ $(".second-1").click();
$('#accepted').text("READY TO DELIVERY"); $('#accepted').text("SEND TO KITCHEN");
$('#accepted').attr("data-value","delivery"); $('#accepted').attr("data-value","processed");
}else if(type == "completed"){ }else if(type == "delivery"){
$('#accepted').text("PICK-UP"); $(".third-1").click();
$('#accepted').attr("data-value","completed"); $('#accepted').text("READY TO DELIVERY");
} $('#accepted').attr("data-value","delivery");
console.log(type) }else if(type == "completed"){
$(".fourth-1").click();
$('#accepted').text("PICK-UP");
$('#accepted').attr("data-value","completed");
}
// console.log(type);
}); });
jQuery(function(){ jQuery(function(){
jQuery('.first-1').click(); jQuery('.first-1').click();
});
$(".custom-tr").on("click", function(){
$(".custom-tr").removeClass("tr-active");
$(this).addClass("tr-active");
var order_id = $(this).attr("data-id");
var url = "order_reservation/get_order/"+order_id;
show_order_detail(url);
}); });
//show order list $(".custom-tr").on("click", function(){
function show_order_detail(url){ $(".custom-tr").removeClass("tr-active");
$(this).addClass("tr-active");
var order_id = $(this).attr("data-id");
var sr_no = $(this).attr("data-sr-no");
var url = "order_reservation/get_order/"+order_id;
show_order_detail(url,sr_no);
});
function refreshDetailData(){
$("#sr_number").text("");
$("#delivery_info").text("");
$("#contact_info").text("");
$('.summary-items').html("");
$('#sub_total').text("0.00");
$('#delivery_fee').text("0.00");
$('#total_charges').text("0.00");
$('#total_tax').text("0.00");
$('#grand_total').text("0.00");
}
//show order list
function show_order_detail(url,sr_no){
$('.summary-items').html("");
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
@@ -40,96 +59,131 @@ $(function() {
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
var delivery = data["delivery"] // console.log(data);
var items = data["order_items"] var delivery = data["delivery"];
var items = data["order_items"];
var item_list = $('.summary-items'); var item_list = $('.summary-items');
item_list.empty(); item_list.empty();
for(var i in items) { if(items!=undefined && items!=""){
var total = items[i].qty*items[i].unit_price; if(items.length > 0){
row = '<tr>' for(var i in items) {
+'<td width ="70%" class="body-td align-left">'+items[i].item_name var item_price = 0;
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>' if(items[i].price > 0){
+'</td>' item_price = items[i].price;
+'<td width ="30%" class="body-td align-right">'+ total +'</td>' }else{
+'</tr>'; item_price = items[i].unit_price;
$('.summary-items').append(row); }
var total = items[i].qty * item_price;
row = '<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
+'</td>'
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
+'</tr>';
$('.summary-items').append(row);
}
$('#sub_total').text(data.total_amount);
$('#delivery_fee').text(delivery.delivery_fee);
$('#total_charges').text(0);
$('#total_tax').text(data.total_tax);
$('#grand_total').text(data.grand_total);
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
$('#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);
if(delivery.provider == "direct_delivery"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.provider == "self_pick_up"){
$("#delivery_info").text("(PICK-UP)");
}
if(data.order_remark!=null && data.order_remark!=""){
$("#order_remark").text(data.order_remark);
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
$("#order_remark").text(data.reservation_remark);
}
$("#sr_number").text("No."+sr_no);
$("#contact_info").text();
}
} }
$('#sub_total').text(data.total_amount);
$('#delivery_fee').text(delivery.delivery_fee);
$('#total_charges').text(0);
$('#total_tax').text(data.total_tax);
$('#grand_total').text(data.grand_total);
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
$('#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);
} }
}); });
//end Ajax //end Ajax
} }
$("#accepted").on("click", function(){ $("#accepted").on("click", function(){
var status = $(this).attr("data-value"); var status = $(this).attr("data-value");
var order_id = $('#order_id').text(); var order_id = $('#order_id').text();
var url = 'order_reservation/update'; var ref_no = $('#ref_no').text();
var callback = $('#callback_url').text(); var callback = $('#callback_url').text();
$.ajax({ callback_url(callback,ref_no,order_id,status);
type: "POST",
url: url,
data: {'order_id': order_id, 'status': status},
dataType: "json",
success: function(data) {
console.log(data)
if (data.status) {
// callback_url(callback,data.message)
swal("Information","Order has been +'data.status'+","success");
window.location.href = '/origami/order_reservation';
}
}
});
}); });
$("#cancel").on("click", function(){ $("#cancel").on("click", function(){
var status = $(this).attr("data-value"); var status = $(this).attr("data-value");
var order_id = $('#order_id').text(); var order_id = $('#order_id').text();
var url = 'order_reservation/update';
var callback = $('#callback_url').text(); var callback = $('#callback_url').text();
$.ajax({ var ref_no = $('#ref_no').text();
type: "POST", callback_url(callback,ref_no,order_id,status);
url: url,
data: {'order_id': order_id, 'status': status},
dataType: "json",
success: function(data) {
console.log(data)
if (data.status) {
console.log(data)
// callback_url(callback,data.message)
swal("Information","Order has been +'data.status'+","warning");
window.location.href = '/origami/order_reservation';
}
}
});
}); });
function callback_url(url,message){ function callback_url(callback,ref_no,order_id,status){
var url = 'order_reservation/update';
var post_url = "order_reservation/send_status";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: url, url: post_url,
data: {}, data: {url: callback, ref_no: ref_no, status: status},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
if(data.status){
$.ajax({
type: "POST",
url: url,
data: {'order_id': order_id, 'status': status},
dataType: "json",
success: function(data) {
console.log(data);
if (data.status) {
swal({
title: 'Information',
text: "Order has been "+data.message,
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, 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';
});
}
} }
}); });
} }
});
});

View File

@@ -1,7 +1,7 @@
class Api::ApiController < ActionController::API class Api::ApiController < ActionController::API
include TokenVerification include TokenVerification
before_action :lookup_domain # before_action :lookup_domain
helper_method :current_token, :current_login_employee, :get_cashier helper_method :current_token, :current_login_employee, :get_cashier
private private

View File

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

View File

@@ -169,6 +169,8 @@ class Origami::CustomersController < BaseOrigamiController
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"PAYBYACCOUNT" ) sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"PAYBYACCOUNT" )
end end
@out = membership_data @out = membership_data
render json: JSON.generate({:status => membership_data["status"], :message => membership_data["message"]})
end end
end end
end end

View File

@@ -4,32 +4,32 @@ class Origami::DingaController < BaseOrigamiController
payment_method = params[:payment_method] payment_method = params[:payment_method]
@cashier_type = params[:type] @cashier_type = params[:type]
@membership_rebate_balance=0 @membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id) @sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no @receipt_no = @sale_data.receipt_no
@shop = Shop.first @shop = Shop.first
# if @shop.is_rounding_adj # if @shop.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total) # new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
# else # else
# new_total = sale_data.grand_total # new_total = @sale_data.grand_total
# end # end
# @rounding_adj = new_total-sale_data.grand_total # @rounding_adj = new_total-@sale_data.grand_total
@rounding_adj = sale_data.rounding_adjustment @rounding_adj = @sale_data.rounding_adjustment
@payparcount = 0 @payparcount = 0
others = 0 others = 0
sale_data.sale_payments.each do |sale_payment| @sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "dinga" if sale_payment.payment_method == "dinga"
@payparcount = @payparcount + sale_payment.payment_amount @payparcount = @payparcount + sale_payment.payment_amount
else else
others = others + sale_payment.payment_amount others = others + sale_payment.payment_amount
end end
end end
@payment_prices = sale_data.grand_total - @payparcount -others @payment_prices = @sale_data.grand_total - @payparcount -others
if sale_data if @sale_data
if sale_data.customer_id if @sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id) customer_data= Customer.find_by_customer_id(@sale_data.customer_id)
if customer_data if customer_data
@membership_id = customer_data.membership_id @membership_id = customer_data.membership_id
if !@membership_id.nil? if !@membership_id.nil?
@@ -73,6 +73,7 @@ def create
cash = params[:payment_amount] cash = params[:payment_amount]
sale_id = params[:sale_id] sale_id = params[:sale_id]
transaction_ref = params[:transaction_ref] transaction_ref = params[:transaction_ref]
account_no = params[:account_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop.first shop_details = Shop.first
@@ -85,7 +86,7 @@ def create
# saleObj = Sale.find(sale_id) # saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",transaction_ref) status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
if status == true if status == true
@out = true, "Success!" @out = true, "Success!"
else else

View File

@@ -7,22 +7,29 @@ class Origami::OrderReservationController < BaseOrigamiController
def update def update
@id = params[:order_id] @id = params[:order_id]
@status = params[:status] @status = params[:status]
@order = OrderReservation.find(@id) @order_reservation = OrderReservation.find(@id)
status = true status = true
if status if status
if @status == "processed" if @status == "processed"
OrderReservation.create_doemal_order(@order) result = OrderReservation.create_doemal_order(@order_reservation,current_user)
else elsif @status == "delivery"
OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery")
response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery")
result = {:status=> true, :message => "ready for delivery" }
elsif @status == "completed"
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
else
if @status == "cancel" if @status == "cancel"
result = {:status=> true, :message => "cancelled" } OrderReservation.update_order_reservation(@id, nil, "cancelled")
result = {:status=> true, :message => "rejected" }
else else
OrderReservation.update_order_reservation(@id, nil, "accepted")
result = {:status=> true, :message => "accepted" } result = {:status=> true, :message => "accepted" }
end end
render :json => result.to_json
end end
render :json => result.to_json
else else
result = {:status=> false, :message => "Order not accepted !" } result = {:status=> false, :message => "Order not accepted !" }
render :json => result.to_json render :json => result.to_json
@@ -36,5 +43,16 @@ class Origami::OrderReservationController < BaseOrigamiController
end end
end end
def send_status
if params[:status] == "cancel"
status = "rejected"
else
status = params[:status]
end
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
render :json => response
end
end end

View File

@@ -73,6 +73,8 @@ def create
cash = params[:payment_amount] cash = params[:payment_amount]
sale_id = params[:sale_id] sale_id = params[:sale_id]
transaction_ref = params[:transaction_ref] transaction_ref = params[:transaction_ref]
account_no = params[:account_no]
puts params.to_json
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop.first shop_details = Shop.first
@@ -86,7 +88,7 @@ def create
# saleObj = Sale.find(sale_id) # saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",transaction_ref) status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
if status == true if status == true
@out = true, "Success!" @out = true, "Success!"
else else

View File

@@ -167,8 +167,9 @@ class Settings::MenusController < ApplicationController
# end # end
end end
p.serialize("tmp/menus/" + menu.name + ".xlsx") file_path = "public/menus/" + menu.name + ".xlsx"
render :json => {status: true} p.serialize(file_path)
render :json => { status: true, path: file_path }
end end
def import def import

View File

@@ -354,6 +354,11 @@ class Customer < ApplicationRecord
#new customer for doemal #new customer for doemal
def self.addCustomer(params) def self.addCustomer(params)
if params[:gender] == "female"
gender = "Female"
else
gender = "Male"
end
customer = Customer.new customer = Customer.new
customer.name = params[:name] customer.name = params[:name]
customer.email = params[:email] customer.email = params[:email]

View File

@@ -160,7 +160,7 @@ class Menu < ApplicationRecord
account = Account.create({title: row["Account"], account_type: "0"}) account = Account.create({title: row["Account"], account_type: "0"})
end end
menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", account_id: account_id, is_sub_item: 0, is_available: 1, created_by: created_by) menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", is_sub_item: 0, is_available: 1, created_by: created_by)
# else # else
# status = status + "Item Code already exists for " + row["Item Name"] + "." # status = status + "Item Code already exists for " + row["Item Name"] + "."
end end

View File

@@ -7,13 +7,18 @@ class OrderReservation < ApplicationRecord
has_many :order_reservation_items has_many :order_reservation_items
belongs_to :delivery belongs_to :delivery
SEND_TO_KITCHEN = "send_to_kitchen"
READY_TO_DELIVERY = "ready_to_deliver"
DELIVERED = "delivered"
COMPLETED = "completed"
def self.addOrderReservationInfo(params) def self.addOrderReservationInfo(params)
check_order_reservation = OrderReservation.where("transaction_ref = ?",params[:reference]) check_order_reservation = OrderReservation.where("transaction_ref = ?",params[:reference])
if check_order_reservation.empty? if check_order_reservation.empty?
order_reservation = OrderReservation.new order_reservation = OrderReservation.new
order_reservation.order_reservation_type = params[:order_type] order_reservation.order_reservation_type = params[:order_type]
order_reservation.customer_id = params[:cus_info] order_reservation.customer_id = params[:cus_info]
order_reservation.requested_time = Time.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S") order_reservation.requested_time = DateTime.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.callback_url = params[:callback_url] order_reservation.callback_url = params[:callback_url]
order_reservation.transaction_ref = params[:reference] order_reservation.transaction_ref = params[:reference]
if params[:order_info] if params[:order_info]
@@ -48,53 +53,204 @@ class OrderReservation < ApplicationRecord
end end
end end
def self.create_doemal_order(order) def self.create_doemal_order(order,current_user)
is_extra_time = false
is_extra_time = false extra_time = ''
extra_time = ''
items_arr = [] items_arr = []
count = 1 count = 1
order.order_reservation_items.each { |i| order.order_reservation_items.each { |i|
i.item_instance_code = i.item_instance_code.downcase.to_s i.item_instance_code = i.item_instance_code.downcase.to_s
items = {"order_item_id": count,"item_instance_code": i.item_instance_code,"quantity": i.qty,"options": []}
items = {"order_item_id": count,"item_instance_code": i.item_instance_code,"quantity": i.qty,"options": []} count += 1
count += 1 items_arr.push(items)
items_arr.push(items) }
}
puts items_arr.to_json puts items_arr.to_json
puts "sssssssssssssssssssssss" puts "sssssssssssssssssssssss"
customer_id = order.customer_id customer_id = order.customer_id
@order = Order.new @order = Order.new
@order.source = "doemal_order" @order.source = "doemal_order"
@order.order_type = "delivery" @order.order_type = "delivery"
@order.customer_id = customer_id @order.customer_id = customer_id
@order.items = items_arr @order.items = items_arr
@order.guest = '' @order.guest = ''
@order.table_id = nil # this is dining facilities's id @order.table_id = nil # this is dining facilities's id
@order.new_booking = true @order.new_booking = true
@order.waiters = current_login_employee.name @order.waiters = current_user.name
@order.employee_name = current_login_employee.name @order.employee_name = current_user.name
@order.is_extra_time = is_extra_time @order.is_extra_time = is_extra_time
@order.extra_time = extra_time @order.extra_time = extra_time
@status, @booking = @order.generate @status, @booking = @order.generate
# Order.send_customer_view(@booking) # Order.send_customer_view(@booking)
if @status && @booking if @status && @booking
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee) @status, @sale = Sale.request_bill(@order,current_user,current_user)
# for second display
result = {:status=> @status, :data => @sale } #order status send to doemal
render :json => result.to_json callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN)
#order reservation status updated
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "created" }
return result
end end
end
def self.update_doemal_payment(order,current_user)
if(Sale.exists?(order.sale_id))
saleObj = Sale.find(order.sale_id)
shop_details = Shop.first
# rounding adjustment
if shop_details.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
end
#end rounding adjustment
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, current_user.name, saleObj.grand_total, "cash")
#order status send to doemal
callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED)
#order reservation status updated
update_order_reservation(order.id, saleObj.sale_id, DELIVERED)
result = {:status=> true, :message => DELIVERED }
return result
# rebate_amount = nil
# For Cashier by Zone
# bookings = Booking.where("sale_id='#{sale_id}'")
# if bookings[0].dining_facility_id.to_i > 0
# table = DiningFacility.find(bookings[0].dining_facility_id)
# cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
# cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
# else
# shift = ShiftSale.find(saleObj.shift_sale_id)
# cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
# end
# For Print
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
# unique_code = "ReceiptBillPdf"
# if !receipt_bill_a5_pdf.empty?
# receipt_bill_a5_pdf.each do |receipt_bilA5|
# if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
# if receipt_bilA5[1] == '1'
# unique_code = "ReceiptBillA5Pdf"
# else
# unique_code = "ReceiptBillPdf"
# end
# end
# end
# end
# customer= Customer.find(saleObj.customer_id)
# get member information
# rebate = MembershipSetting.find_by_rebate(1)
# credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
# if customer.membership_id != nil && rebate && credit_data.nil?
# member_info = Customer.get_member_account(customer)
# if member_info["status"] == true
# rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
# current_balance = SaleAudit.paymal_search(sale_id)
# end
# end
#orders print out
# if params[:type] == "quick_service"
# booking = Booking.find_by_sale_id(sale_id)
# if booking.dining_facility_id.to_i>0
# table_id = booking.dining_facility_id
# else
# table_id = 0
# end
# booking.booking_orders.each do |order|
# # Order.pay_process_order_queue(order.order_id, table_id)
# oqs = OrderQueueStation.new
# oqs.pay_process_order_queue(order.order_id, table_id)
# end
# end
#for card sale data
# card_data = Array.new
# card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
# if !card_sale_trans_ref_no.nil?
# card_sale_trans_ref_no.each do |cash_sale_trans|
# card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
# card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
# card_no = cash_sale_trans.pan.last(4)
# card_no = card_no.rjust(19,"**** **** **** ")
# card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
# end
# end
# get printer info
# print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
# printer = Printer::ReceiptPrinter.new(print_settings)
# filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
# render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
#end
end
end
def self.send_status_to_ordering(url,ref_no,status)
base_url = "http://192.168.1.186:3002"
post_url = base_url + url
begin
response = HTTParty.post(post_url,
:body => { id: ref_no, status: status}.to_json,
:headers => {
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
}, :timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
Rails.logger.debug "Get Doemal Status "
Rails.logger.debug response.to_json
return response
end
def self.update_order_reservation(id, sale_id, status)
order_reservation = OrderReservation.find(id)
if sale_id.present?
order_reservation.sale_id = sale_id
end
order_reservation.status = status
order_reservation.save
end end
private private

View File

@@ -197,13 +197,14 @@ class SalePayment < ApplicationRecord
def self.create_payment(paypar_url,token,membership_id,received_amount,sale_id) def self.create_payment(paypar_url,token,membership_id,received_amount,sale_id)
membership_actions_data = MembershipAction.find_by_membership_type("create_payment"); membership_actions_data = MembershipAction.find_by_membership_type("create_payment");
sale_data = Sale.find_by_sale_id(sale_id)
customer_data = Customer.find_by_customer_id(sale_data.customer_id)
if !membership_actions_data.nil? if !membership_actions_data.nil?
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
merchant_uid = membership_actions_data.merchant_account_id merchant_uid = membership_actions_data.merchant_account_id
auth_token = membership_actions_data.auth_token auth_token = membership_actions_data.auth_token
sale_data = Sale.find_by_sale_id(sale_id)
if sale_data if sale_data
others = 0 others = 0
@@ -211,14 +212,27 @@ class SalePayment < ApplicationRecord
others = others + sale_payment.payment_amount others = others + sale_payment.payment_amount
end end
payment_prices = sale_data.grand_total - others payment_prices = sale_data.grand_total - others
# Control for Paypar Cloud
begin if membership_id.to_i <= 0
response = HTTParty.post(url, membership_id = customer_data.membership_id
:body => { membership_id:membership_id, params = { membership_id:membership_id,
amount:received_amount, amount:received_amount,
receipt_no:sale_data.receipt_no, receipt_no:sale_data.receipt_no,
merchant_uid:merchant_uid, merchant_uid:merchant_uid,
auth_token:auth_token}.to_json, auth_token:auth_token}.to_json
else
params = { account_no:membership_id,
amount:received_amount,
receipt_no:sale_data.receipt_no,
merchant_uid:merchant_uid,
auth_token:auth_token}.to_json
end
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
:body => params,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3' 'Accept' => 'application/json; version=3'
@@ -242,7 +256,7 @@ class SalePayment < ApplicationRecord
response =false; response =false;
end end
Rails.logger.debug "Payment response" Rails.logger.debug "Create Payment response"
Rails.logger.debug response.to_json Rails.logger.debug response.to_json
return response; return response;
@@ -390,9 +404,13 @@ class SalePayment < ApplicationRecord
payment_status = false payment_status = false
#Next time - validate if the vochure number is valid - within #Next time - validate if the vochure number is valid - within
customer_data = Customer.find_by_customer_id(self.sale.customer_id) # customer_data = Customer.find_by_customer_id(self.sale.customer_id)
account_no = self.payment_reference
# if account_no.to_i <= 0
# account_no = customer_data.membership_id
# end
membership_setting = MembershipSetting.find_by_membership_type("paypar_url") membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id)
#record an payment in sale-audit #record an payment in sale-audit
remark = "#{membership_data} PayMal Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " remark = "#{membership_data} PayMal Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
@@ -433,9 +451,16 @@ class SalePayment < ApplicationRecord
payment_status = false payment_status = false
#Next time - validate if the vochure number is valid - within #Next time - validate if the vochure number is valid - within
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
# customer_data = Customer.find_by_customer_id(self.sale.customer_id)
account_no = self.payment_reference
# if account_no == 0
# account_no = customer_data.customer_id
# end
membership_setting = MembershipSetting.find_by_membership_type("paypar_url") membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id)
#record an payment in sale-audit #record an payment in sale-audit
remark = "#{membership_data} Dinga Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " remark = "#{membership_data} Dinga Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "

View File

@@ -46,6 +46,8 @@
</div> </div>
</div> </div>
</div> </div>
<p class="hidden" name="sale_id" id="sale_id" ><%=@sale_id %></p>
<p class="hidden" name="receipt_no" id="receipt_no" ><%=@sale_data.receipt_no %></p>
<!-- <% if @payparcount > 0 %> <!-- <% if @payparcount > 0 %>
<p class="">Last time rebate amount is <%= @payparcount %></p> <p class="">Last time rebate amount is <%= @payparcount %></p>
<% end %> <% end %>
@@ -203,7 +205,7 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_dinga_path%>", url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""}, data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:"",account_no:0},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
@@ -239,6 +241,7 @@
var membership_id = ''; var membership_id = '';
var membership_type = ''; var membership_type = '';
var sale_id = $("#sale_id").text() || 0; var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").text() || 0;
var customer_mamber_card_no = 0; var customer_mamber_card_no = 0;
$("#is_paymemberModal").hide(); $("#is_paymemberModal").hide();
@@ -247,7 +250,6 @@
getCardNo(); getCardNo();
$("#sxModal").hide(); $("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val(); customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){ if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({ $.ajax({
type: "POST", type: "POST",
@@ -255,6 +257,7 @@
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no}, data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
console.log(data)
if (data.status == true) { if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount); var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val(parseFloat(valid_amount)); $("#valid_amount").val(parseFloat(valid_amount));
@@ -262,8 +265,9 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_dinga_path%>", url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref}, data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no :customer_mamber_card_no},
success: function(result){ success: function(result){
console.log(result)
if(result.status == true){ if(result.status == true){
swal({ swal({
title: "Information!", title: "Information!",
@@ -273,7 +277,7 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"; window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
}); });
}else{ }else{
@@ -291,14 +295,14 @@
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA"; window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
}); });
} }
} }
}); });
} }
},100); },100);
}); });
// Read NFC card no from java // Read NFC card no from java
@@ -321,9 +325,10 @@
var customer_name = ''; var customer_name = '';
var membership_id = ''; var membership_id = '';
var membership_type = ''; var membership_type = '';
var receipt_no = $("#receipt_no").text() || 0;
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
if(sale_id != 0 && code != ""){ if(sale_id != 0 && code != ""){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/send_account" , url: "/origami/"+sale_id+"/send_account" ,
@@ -337,8 +342,9 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_paymal_path%>", url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref}, data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
title: "Information!", title: "Information!",

View File

@@ -5,13 +5,13 @@
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px 0px 0px -5px !important "> <div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px 0px 0px -5px !important ">
<ul class="nav nav-tabs tab-col-teal" role="tablist"> <ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item active" data-color="#F44336" data-type="pending" style="background-color: #F44336;"> <li class="nav-item active" data-color="#F44336" data-type="pending" style="background-color: #F44336;">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">4</p> <%= t :pending %></a> <a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">1</p> <%= t :pending %></a>
</li> </li>
<li class="nav-item" data-color="#673AB7" data-type="processing" style="background-color: #673AB7;"> <li class="nav-item" data-color="#673AB7" data-type="processing" style="background-color: #673AB7;">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">4</p> <%= t :process %></a> <a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">2</p> <%= t :processing %></a>
</li> </li>
<li class="nav-item" data-color="#009688" data-type="delivery" style="background-color: #009688;"> <li class="nav-item" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">4</p> <%= t :delivery %></a> <a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">3</p> <%= t :delivering %></a>
</li> </li>
<li class="nav-item" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;"> <li class="nav-item" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num">4</p> <%= t :completed %></a> <a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num">4</p> <%= t :completed %></a>
@@ -27,9 +27,9 @@
<% i=1 <% i=1
@order.each do |order| %> @order.each do |order| %>
<% if order.status == 'new' %> <% if order.status == 'new' %>
<tr class="custom-tr first-<%=i%>" style="" data-id="<%=order.order_reservation_id%>"> <tr class="custom-tr first-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left"> <td width ="5%" class="align-left">
<%=i%> <%=i%>
</td> </td>
<td width ="30%" class="align-center"> <td width ="30%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %> <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
@@ -38,7 +38,7 @@
<%=order.grand_total%> <%=order.grand_total%>
</td> </td>
<td width ="30%" class="align-center"> <td width ="30%" class="align-center">
<span class="font-10 col-blue"><%=order.status%></span> <span class="font-10 col-blue"><%= order.status %></span>
</td> </td>
</tr> </tr>
<%i+=1%> <%i+=1%>
@@ -59,9 +59,9 @@
<% i=1 <% i=1
@order.each do |order| %> @order.each do |order| %>
<% if order.status == 'accepted' %> <% if order.status == 'accepted' %>
<tr class="custom-tr " style="" data-id="<%=order.order_reservation_id%>"> <tr class="custom-tr second-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left"> <td width ="5%" class="align-left">
<%=i%> <%=i%>
</td> </td>
<td width ="30%" class="align-center"> <td width ="30%" class="align-center">
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %> <%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
@@ -89,8 +89,8 @@
<tbody> <tbody>
<% i=1 <% i=1
@order.each do |order| %> @order.each do |order| %>
<% if order.status == 'processed' %> <% if order.status == 'send_to_kitchen' %>
<tr class="custom-tr" style="" data-id="<%=order.order_reservation_id%>"> <tr class="custom-tr third-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left"> <td width ="5%" class="align-left">
<%=i%> <%=i%>
</td> </td>
@@ -113,15 +113,15 @@
</div> </div>
</div> </div>
<!--- Panel 3 - Orders --> <!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="delivery" role="tabpanel"> <div class="tab-pane dining" id="completed" role="tabpanel">
<div class="card-block font-13"> <div class="card-block font-13">
<div id="menu-slimscroll" data-height="50"> <div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table"> <table class="table table-stripe custom-table">
<tbody> <tbody>
<% i=1 <% i=1
@order.each do |order| %> @order.each do |order| %>
<% if order.status == 'completed' %> <% if order.status == 'ready_to_delivery' %>
<tr class="custom-tr" style="" data-id="<%=order.order_reservation_id%>"> <tr class="custom-tr fourth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left"> <td width ="5%" class="align-left">
<%=i%> <%=i%>
</td> </td>
@@ -153,10 +153,10 @@
<table class="table"> <table class="table">
<tr> <tr>
<td width ="70%" class="header-td align-left"> <td width ="70%" class="header-td align-left">
<b class="col-pink font-16">No.11</b> <b class="col-pink font-16"><span id="sr_number"></span> </b>
<span class="font-13">(DELIVERY)</span> <span class="font-13"><span id="delivery_info"></span></span>
</td> </td>
<td width ="30%" class="header-td font-16 align-right"><b>0065 4321</b></td> <td width ="30%" class="header-td font-16 align-right"><b><span id="contact_info">0065 4321</span></b></td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -214,6 +214,9 @@
</td> </td>
<td width ="30%" class="footer-td align-right col-blue" id="grand_total">0.00</td> <td width ="30%" class="footer-td align-right col-blue" id="grand_total">0.00</td>
</tr> </tr>
<tr>
<td colspan="2" id="order_remark"></td>
</tr>
<tr> <tr>
<td width ="50%" class="footer-td align-left col-blue"> <td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel"> <button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
@@ -285,10 +288,10 @@
</div> </div>
</div> </div>
</div> </div>
<p id="ref_no"></p> <p id="ref_no" class="hidden"></p>
<p id="callback_url"></p> <p id="callback_url" class="hidden"></p>
<p id="order_id"></p> <p id="order_id" class="hidden"></p>
<p id="status"></p> <p id="status" class="hidden"></p>
<script type="text/javascript"> <script type="text/javascript">
jQuery(function(){ jQuery(function(){
jQuery('.first-1').click(); jQuery('.first-1').click();

View File

@@ -14,6 +14,8 @@
<div class="card m-l-10 m-t-10" style="padding:0px 20px;"> <div class="card m-l-10 m-t-10" style="padding:0px 20px;">
<div class="rebate-form"> <div class="rebate-form">
<input type="hidden" name="receipt_no" id="receipt_no" value="<%= @receipt_no%>"> <input type="hidden" name="receipt_no" id="receipt_no" value="<%= @receipt_no%>">
<p class="hidden" name="sale_id" id="sale_id" ><%=@sale_id %></p>
<p class="hidden" name="membership_id" id="membership_id" ><%=@membership_id %></p>
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">You can pay up to </label> <label class="">You can pay up to </label>
@@ -204,7 +206,7 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_paymal_path%>", url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""}, data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:"",account_no:0},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
@@ -237,6 +239,7 @@
var cardNo = ""; var cardNo = "";
var sale_id = $("#sale_id").text() || 0; var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").val() || ""; var receipt_no = $("#receipt_no").val() || "";
var customer_mamber_card_no = 0; var customer_mamber_card_no = 0;
var payment_amount = parseFloat($("#used_amount").text()); var payment_amount = parseFloat($("#used_amount").text());
@@ -246,8 +249,10 @@
getCardNo(); getCardNo();
$("#sxModal").hide(); $("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val(); customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
if(sale_id != 0 && customer_mamber_card_no != 0){ customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/origami/"+sale_id+"/send_account" , url: "/origami/"+sale_id+"/send_account" ,
@@ -261,7 +266,7 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_paymal_path%>", url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref}, data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
@@ -296,8 +301,10 @@
} }
}); });
}else{
swal("Opp","Please Check Member","warning")
} }
},100); },100);
}); });
// Read NFC card no from java // Read NFC card no from java
@@ -321,6 +328,7 @@
var payment_amount = parseFloat($("#used_amount").text()); var payment_amount = parseFloat($("#used_amount").text());
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
alert(code)
if(sale_id != 0 && code != ""){ if(sale_id != 0 && code != ""){
$.ajax({ $.ajax({
type: "POST", type: "POST",
@@ -335,8 +343,9 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_paymal_path%>", url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref}, data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){ success: function(result){
alert(result)
if(result.status == true){ if(result.status == true){
swal({ swal({
title: "Information!", title: "Information!",

View File

@@ -168,15 +168,15 @@
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div> <div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div> </div>
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 %> <% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 %>
<div class="row payment other-payment-color" id="card_payment" > <div class="row payment other-payment-color" id="card_payment" >
<div class="col-md-8">Other Payments</div> <div class="col-md-8">Other Payments</div>
<div class="col-md-4" id="others"><%= number_with_precision(@other, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div> <div class="col-md-4" id="others"><%= number_with_precision(@other, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div>
</div> </div>
<% else %> <% else %>
<div class="row payment other-payment-color" id="card_payment" > <div class="row payment other-payment-color" id="card_payment" >
<div class="col-md-8">Other Payments</div> <div class="col-md-8">Other Payments</div>
<div class="col-md-4" id=""><%= number_with_precision(@other_payment, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div> <div class="col-md-4" id=""><%= number_with_precision(@other_payment, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %></div>
</div> </div>
<% end %> <% end %>
</div> </div>
<div class="card-block"> <div class="card-block">
@@ -269,12 +269,11 @@
<div class="col-md-4" id="paymalcount"><%= number_with_precision(0, precision: precision.to_i ) %></div> <div class="col-md-4" id="paymalcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
<% end %> <% end %>
</div> </div>
<!-- DINGA --> <!-- DINGA -->
<div class="row <%= @dingacount!=0.0 ? 'payment others-color' : 'hidden'%>"> <div class="row <%= @dingacount!=0.0 ? 'payment others-color' : 'hidden'%>">
<div class="col-md-5"></div> <div class="col-md-5"></div>
<div class="col-md-3">DINGA</div> <div class="col-md-3">DINGA</div>
<% if @paymalcount != 0.0 %> <% if @dingacount != 0.0 %>
<div class="col-md-4 master is_card" id="dingacount"><%= number_with_precision(@dingacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div> <div class="col-md-4 master is_card" id="dingacount"><%= number_with_precision(@dingacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
<% else %> <% else %>
<div class="col-md-4" id="dingacount"><%= number_with_precision(0, precision: precision.to_i ) %></div> <div class="col-md-4" id="dingacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
@@ -635,6 +634,8 @@ var customer_name = "<%= @customer.name %>";
if (credit <= 0) { if (credit <= 0) {
calculate_member_discount(sale_id); calculate_member_discount(sale_id);
} }
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>", url: "<%= origami_payment_cash_path %>",
@@ -655,13 +656,14 @@ var customer_name = "<%= @customer.name %>";
var msg = ''; var msg = '';
} }
$("#loading_wrapper" ).hide(); $("#loading_wrapper" ).hide();
//PDF lightbox data //PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no); $("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename); $("#filename").val(result.filename);
$("#printer_name").val(result.printer_name); $("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename.substring(6)); $("#receipt_pdf").attr("src", pdfPath);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); $("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed"); $("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text(""); $("#changed_amount").text("");

View File

@@ -115,7 +115,8 @@
url: "/settings/menus/" + menu_id + "/export", url: "/settings/menus/" + menu_id + "/export",
success: function(result){ success: function(result){
if(result.status){ if(result.status){
swal("Success", "Export Success...", "success"); location.href = result.path.substring(6);
// swal("Success", "Export Success...", "success");
} }
} }
}); });

View File

@@ -75,6 +75,10 @@ en:
dine_in_cashier: "Dine-in Cashier" dine_in_cashier: "Dine-in Cashier"
quick_service: "Quick Service" quick_service: "Quick Service"
order_reservation: "Order & Reservation" order_reservation: "Order & Reservation"
pending: "Pending"
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
views: views:
btn: btn:

View File

@@ -70,6 +70,10 @@ mm:
dine_in_cashier: "Dine-in Cashier" dine_in_cashier: "Dine-in Cashier"
quick_service: "Quick Service" quick_service: "Quick Service"
order_reservation: "Order & Reservation" order_reservation: "Order & Reservation"
pending: "Pending"
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
views: views:
btn: btn:

View File

@@ -6,6 +6,8 @@ scope "(:locale)", locale: /en|mm/ do
root 'home#index' root 'home#index'
mount Sidekiq::Web => '/kiq' mount Sidekiq::Web => '/kiq'
mount PdfjsViewer::Rails::Engine => "/pdfjs", as: 'pdfjs'
# Action Cable Creation # Action Cable Creation
# if ENV["SERVER_MODE"] != "cloud" # if ENV["SERVER_MODE"] != "cloud"
mount ActionCable.server => "/cable" mount ActionCable.server => "/cable"
@@ -268,7 +270,7 @@ scope "(:locale)", locale: /en|mm/ do
resources :order_reservation resources :order_reservation
get 'order_reservation/get_order/:id' => "order_reservation#get_order",:as => "get_order", :defaults => { :format => 'json' } get 'order_reservation/get_order/:id' => "order_reservation#get_order",:as => "get_order", :defaults => { :format => 'json' }
post 'order_reservation/update', to: "order_reservation#update" , :defaults => { :format => 'json' } post 'order_reservation/update', to: "order_reservation#update" , :defaults => { :format => 'json' }
post 'order_reservation/send_status', to: "order_reservation#send_status", :defaults => { :format => 'json' }
end end
#--------- Waiter/Ordering Station ------------# #--------- Waiter/Ordering Station ------------#

View File

@@ -24,7 +24,7 @@ test:
# instead read values from the environment. # instead read values from the environment.
production: production:
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22 secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
sx_provision_url: connect.smartsales.asia/api #192.168.1.147:3002/api sx_provision_url: https://connect.pos-myanmar.com/api #192.168.1.147:3002/api
server_mode: application server_mode: application
cipher_type: AES-256-CBC cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L sx_key: Wh@t1$C2L

View File

@@ -3,8 +3,15 @@
{ {
"lookup": "local", "lookup": "local",
"value": { "value": {
"key": "999d675168d813d5e1c7", "key": "999d675168d813d5e1c7",
"iv": "999d675168d813d5e1c7" "iv": "999d675168d813d5e1c7"
}
},
{
"lookup": "demo10.pos-myanmar.com",
"value": {
"key": "634W2ioj6QA88vafKamHBRu5aKX/BLIPdTWuuXGFBsA=\n",
"iv": "QqpO/h7o60dYTbNETRbZ4g==\n"
} }
} }
] ]

View File

@@ -21,7 +21,7 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
t.integer :dining_count, :default => 0 t.integer :dining_count, :default => 0
t.integer :takeaway_count, :default => 0 t.integer :takeaway_count, :default => 0
t.integer :member_count, :default => 0 t.integer :member_count, :default => 0
t.decimal :total_rounding,, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :total_rounding, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.integer :total_receipt, :default => 0 t.integer :total_receipt, :default => 0
t.decimal :total_void, :default => 0 t.decimal :total_void, :default => 0
t.timestamps t.timestamps

BIN
public/menus/Main Menu.xlsx Normal file

Binary file not shown.

Binary file not shown.