Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into r-1804001-01
This commit is contained in:
@@ -62,7 +62,7 @@ $(function() {
|
|||||||
// console.log(data);
|
// console.log(data);
|
||||||
var delivery = data["delivery"];
|
var delivery = data["delivery"];
|
||||||
var items = data["order_items"];
|
var items = data["order_items"];
|
||||||
|
console.log(data)
|
||||||
var item_list = $('.summary-items');
|
var item_list = $('.summary-items');
|
||||||
item_list.empty();
|
item_list.empty();
|
||||||
|
|
||||||
@@ -113,7 +113,12 @@ $(function() {
|
|||||||
$("#order_remark").text(data.reservation_remark);
|
$("#order_remark").text(data.reservation_remark);
|
||||||
}
|
}
|
||||||
$("#sr_number").text("No."+sr_no);
|
$("#sr_number").text("No."+sr_no);
|
||||||
$("#contact_info").text();
|
if (data["receipt_no"]) {
|
||||||
|
$("#contact_info").text(data["receipt_no"]);
|
||||||
|
}else{
|
||||||
|
$("#contact_info").text(data["order_reservation_id"]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,10 +285,10 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
'Accept' => 'application/json; version=3'
|
'Accept' => 'application/json; version=3'
|
||||||
}, :timeout => 10)
|
}, :timeout => 10)
|
||||||
rescue HTTParty::Error
|
rescue HTTParty::Error
|
||||||
response = {"status": false, "message": "Can't open membership server " }
|
response = {"status": false, "message": "Http party error" }
|
||||||
|
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = {"status": false, "message": "Can't open membership server " }
|
response = {"status": false, "message": "Connection TIme out " }
|
||||||
rescue OpenURI::HTTPError
|
rescue OpenURI::HTTPError
|
||||||
response = {"status": false, "message": "Can't open membership server " }
|
response = {"status": false, "message": "Can't open membership server " }
|
||||||
|
|
||||||
|
|||||||
@@ -2603,34 +2603,35 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.all_receipts
|
def self.all_receipts
|
||||||
query = Sale.select("sales.*, sale_payments.created_at as receipt_close_time,
|
query = Sale.select("sale_payments.created_at as receipt_close_time,
|
||||||
case when (sale_audits.action='SALEPAYMENT') then sale_audits.remark else 0 end as remark,
|
case when (sale_audits.action='SALEPAYMENT') then sale_audits.remark else 0 end as remark,
|
||||||
case when (sale_taxes.tax_name='Service Charges') then sale_taxes.tax_payable_amount else 0 end as service_charges,
|
case when (sale_taxes.tax_name='Service Charges') then sale_taxes.tax_payable_amount else 0 end as service_charges,
|
||||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||||
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
||||||
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
||||||
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
||||||
SUM(case when (sale_payments.payment_method='unionpay') then sale_payments.payment_amount else 0 end) as unionpay_amount,
|
SUM(case when (sale_payments.payment_method='unionpay') then sale_payments.payment_amount else 0 end) as unionpay_amount,
|
||||||
SUM(case when (sale_payments.payment_method='alipay') then sale_payments.payment_amount else 0 end) as alipay_amount,
|
SUM(case when (sale_payments.payment_method='alipay') then sale_payments.payment_amount else 0 end) as alipay_amount,
|
||||||
SUM(case when (sale_payments.payment_method='paymal') then sale_payments.payment_amount else 0 end) as paymal_amount,
|
SUM(case when (sale_payments.payment_method='paymal') then sale_payments.payment_amount else 0 end) as paymal_amount,
|
||||||
SUM(case when (sale_payments.payment_method='dinga') then sale_payments.payment_amount else 0 end) as dinga_amount,
|
SUM(case when (sale_payments.payment_method='dinga') then sale_payments.payment_amount else 0 end) as dinga_amount,
|
||||||
SUM(case when (sale_payments.payment_method='JunctionPay') then sale_payments.payment_amount else 0 end) as junctionpay_amount,
|
SUM(case when (sale_payments.payment_method='JunctionPay') then sale_payments.payment_amount else 0 end) as junctionpay_amount,
|
||||||
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
|
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||||
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount,
|
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount,
|
||||||
SUM(case when (sale_items.status='foc') then sale_items.price else 0 end) as item_foc,
|
SUM(case when (sale_items.status='foc') then sale_items.price else 0 end) as item_foc,
|
||||||
SUM(case when (sale_items.status='Discount') then sale_items.price else 0 end) as item_discount,
|
SUM(case when (sale_items.status='Discount') then sale_items.price else 0 end) as item_discount,
|
||||||
SUM(sale_items.qty) as qty,
|
SUM(sale_items.qty) as qty,
|
||||||
sales.cashier_name as cashier_name,
|
sales.cashier_name as cashier_name,
|
||||||
surveys.child as child,
|
surveys.child as child,
|
||||||
surveys.adult as adult")
|
surveys.adult as adult")
|
||||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||||
.joins("join sale_taxes on sale_taxes.sale_id = sales.sale_id")
|
.joins("join sale_taxes on sale_taxes.sale_id = sales.sale_id")
|
||||||
.joins("join sale_items on sale_items.sale_id = sales.sale_id")
|
.joins("join sale_items on sale_items.sale_id = sales.sale_id")
|
||||||
.joins("join sale_audits on sale_audits.sale_id = sales.sale_id")
|
.joins("join sale_audits on sale_audits.sale_id = sales.sale_id")
|
||||||
.joins("left join surveys on surveys.receipt_no = sales.receipt_no")
|
.joins("left join surveys on surveys.receipt_no = sales.receipt_no")
|
||||||
|
|
||||||
query = query.where("sale_status != 'new' && sale_payments.payment_amount > 0")
|
query = query.where("sales.sale_status != 'new' && sale_payments.payment_amount > 0")
|
||||||
.group("sale_id")
|
query = query.where("sales.created_at between ? and ?", '2017-11-01 00:00:00 +0630','2018-02-05 13:59:59 +0630')
|
||||||
|
.group("sales.sale_id")
|
||||||
return query
|
return query
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2640,7 +2641,8 @@ def self.all_receipt_details
|
|||||||
.joins("join sale_payments on sale_payments.sale_id = sale_items.sale_id")
|
.joins("join sale_payments on sale_payments.sale_id = sale_items.sale_id")
|
||||||
.joins("join sales on sales.sale_id = sale_items.sale_id")
|
.joins("join sales on sales.sale_id = sale_items.sale_id")
|
||||||
.group("sale_items.sale_item_id")
|
.group("sale_items.sale_item_id")
|
||||||
query = query.where("qty > 0 and sales.sale_status !='new'")
|
query = query.where("sale_itemsqty > 0 and sales.sale_status !='new'")
|
||||||
|
query = query.where("sale_items.created_at between ? and ?", '2017-11-01 00:00:00 +0630','2018-02-05 13:59:59 +0630')
|
||||||
return query
|
return query
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// QR Code Reader
|
// QR Code Reader
|
||||||
$("#qr_code").on('sclick', function(e){
|
$("#qr_code").on('click', function(e){
|
||||||
var code = "";
|
var code = "";
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
code=getQRCode();
|
code=getQRCode();
|
||||||
|
|||||||
@@ -368,35 +368,34 @@
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
code=getQRCode();
|
code=getQRCode();
|
||||||
setQRCode(code);
|
setQRCode(code);
|
||||||
|
}, 100);
|
||||||
|
|
||||||
customer_mamber_card_no = $("#search").val();
|
customer_mamber_card_no = $("#search").val();
|
||||||
|
|
||||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "/origami/"+sale_id+"/get_customer" ,
|
|
||||||
data: { filter : customer_mamber_card_no ,type :"card"},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
if (data[0].customer_id == false) {
|
|
||||||
swal("Alert!", data[0].message, "error");
|
|
||||||
// $.alert({
|
|
||||||
// title: 'Alert!',
|
|
||||||
// content: data[0].message,
|
|
||||||
// type: 'red',
|
|
||||||
// typeAnimated: true,
|
|
||||||
// btnClass: 'btn-danger',
|
|
||||||
// });
|
|
||||||
}else{
|
|
||||||
customer_id = data[0].customer_id;
|
|
||||||
customer_name = data[0].name;
|
|
||||||
update_sale(customer_id, customer_name,sale_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/"+sale_id+"/get_customer" ,
|
||||||
|
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data[0].customer_id == false) {
|
||||||
|
swal("Alert!", data[0].message, "error");
|
||||||
|
// $.alert({
|
||||||
|
// title: 'Alert!',
|
||||||
|
// content: data[0].message,
|
||||||
|
// type: 'red',
|
||||||
|
// typeAnimated: true,
|
||||||
|
// btnClass: 'btn-danger',
|
||||||
|
// });
|
||||||
|
}else{
|
||||||
|
customer_id = data[0].customer_id;
|
||||||
|
customer_name = data[0].name;
|
||||||
|
update_sale(customer_id, customer_name,sale_id);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
},100);
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Read qrcode from java
|
// Read qrcode from java
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ if @order
|
|||||||
:requested_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
|
:requested_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
|
||||||
:payment_status,:payment_ref,:total_amount,:total_tax,
|
:payment_status,:payment_ref,:total_amount,:total_tax,
|
||||||
:discount_amount,:grand_total,:status,:order_remark,
|
:discount_amount,:grand_total,:status,:order_remark,
|
||||||
:reservation_remark)
|
:reservation_remark,:sale_id)
|
||||||
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
|
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
|
||||||
if @delivery
|
if @delivery
|
||||||
json.delivery do |json|
|
json.delivery do |json|
|
||||||
@@ -22,4 +22,9 @@ if @order
|
|||||||
|
|
||||||
json.customer_name @customer.name
|
json.customer_name @customer.name
|
||||||
json.phone @customer.contact_no
|
json.phone @customer.contact_no
|
||||||
|
if @order.sale_id
|
||||||
|
@receipt_no = Sale.find(@order.sale_id).receipt_no
|
||||||
|
json.receipt_no @receipt_no
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -152,11 +152,12 @@
|
|||||||
<div class="card-header custom-card-header" style="color:">
|
<div class="card-header custom-card-header" style="color:">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<td width ="70%" class="header-td align-left">
|
<td width ="30%" class="header-td align-left">
|
||||||
<b class="col-pink font-16"><span id="sr_number"></span> </b>
|
<b class="col-pink font-16"><span id="sr_number"></span> </b>
|
||||||
<span class="font-13"><span id="delivery_info"></span></span>
|
<span class="font-13"><span id="delivery_info"></span></span>
|
||||||
</td>
|
</td>
|
||||||
<td width ="30%" class="header-td font-16 align-right"><b><span id="contact_info">0065 4321</span></b></td>
|
<td class="header-td align-left"></td>
|
||||||
|
<td width ="50%" class="header-td font- align-right"><b><span id="contact_info"></span></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1134,33 +1134,34 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
var membership_type = '';
|
var membership_type = '';
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
code=getQRCode();
|
code=getQRCode();
|
||||||
if(sale_id != 0 && code != ""){
|
$("#qr_code").val(code);
|
||||||
$.ajax({
|
});
|
||||||
type: "POST",
|
|
||||||
url: "/origami/"+sale_id+"/get_customer" ,
|
|
||||||
data: { filter : code ,type :"card"},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
if (data[0].customer_id == false) {
|
|
||||||
swal("Alert!", data[0].message, "error");
|
|
||||||
}else{
|
|
||||||
customer_id = data[0].customer_id;
|
|
||||||
customer_name = data[0].name;
|
|
||||||
membership_id = data[0].membership_id;
|
|
||||||
membership_type = data[0].membership_type;
|
|
||||||
update_sale(membership_id, customer_id, customer_name,sale_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(sale_id != 0 && code != ""){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/"+sale_id+"/get_customer" ,
|
||||||
|
data: { filter : code ,type :"card"},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data[0].customer_id == false) {
|
||||||
|
swal("Alert!", data[0].message, "error");
|
||||||
|
}else{
|
||||||
|
customer_id = data[0].customer_id;
|
||||||
|
customer_name = data[0].name;
|
||||||
|
membership_id = data[0].membership_id;
|
||||||
|
membership_type = data[0].membership_type;
|
||||||
|
update_sale(membership_id, customer_id, customer_name,sale_id);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},100);
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Read qrcode from java
|
// Read qrcode from java
|
||||||
function getQRCode(){
|
function getQRCode(){
|
||||||
return code2lab.readQRCode();
|
return code2lab.readQRCode();
|
||||||
$("#qr_code").val(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
#check for license file
|
#check for license file
|
||||||
if check_license
|
# if check_license
|
||||||
current_license(ENV["SX_PROVISION_URL"])
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
else
|
# else
|
||||||
redirect_to activate_path
|
# redirect_to activate_path
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
namespace :consolidate do
|
namespace :consolidate do
|
||||||
desc "Receipt"
|
desc "Receipt"
|
||||||
task :receipt => :environment do
|
task :receipt => :environment do
|
||||||
Receipt.delete_all
|
# Receipt.delete_all
|
||||||
sales = Sale.all_receipts
|
sales = Sale.all_receipts
|
||||||
|
puts sales.to_json
|
||||||
shop = Shop.find(1)
|
shop = Shop.find(1)
|
||||||
sales.each do |sale|
|
sales.each do |sale|
|
||||||
puts sale.to_json
|
puts sale.to_json
|
||||||
|
|||||||
Reference in New Issue
Block a user