Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui

This commit is contained in:
Aung Myo
2017-12-28 18:05:44 +06:30
7 changed files with 26 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '2.4.0' ruby '2.4.1'
git_source(:github) do |repo_name| git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git" "https://github.com/#{repo_name}.git"

View File

@@ -11,6 +11,8 @@ class Api::CheckInProcessController < Api::ApiController
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
extra_minutes = (booking.checkout_at - booking.reserved_at) / 1.minutes
lookup_checkout_time = Lookup.collection_of("checkout_alert_time") lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
alert_time_min = 0 alert_time_min = 0
if !lookup_checkout_time.nil? if !lookup_checkout_time.nil?
@@ -21,7 +23,7 @@ class Api::CheckInProcessController < Api::ApiController
end end
end end
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min } render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes }
else else
render :json => { :status => false, :error_message => "No current booking!" } render :json => { :status => false, :error_message => "No current booking!" }
end end

View File

@@ -261,6 +261,11 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
if saleObj.discount_type == "member_discount"
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0)
end
sale_payment = SalePayment.new sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "foc") sale_payment.process_payment(saleObj, @user, cash, "foc")

View File

@@ -6,6 +6,10 @@ class Origami::VoidController < BaseOrigamiController
if Sale.exists?(sale_id) if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id) sale = Sale.find_by_sale_id(sale_id)
if sale.discount_type == "member_discount"
sale.update_attributes(total_discount: 0)
sale.compute_by_sale_items(sale_id, sale.sale_items,0)
end
# update count for shift sale # update count for shift sale
if(sale.sale_status == "completed") if(sale.sale_status == "completed")

View File

@@ -247,6 +247,7 @@ class Sale < ApplicationRecord
#compute - invoice total #compute - invoice total
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil) def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil)
sale = Sale.find(sale_id) sale = Sale.find(sale_id)
sales_items = sale_itemss sales_items = sale_itemss

View File

@@ -587,9 +587,9 @@
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
type = $('.payment_method').val(); type = $('.payment_method').val();
if (type != "Credit") {
calculate_member_discount(sale_id,type); calculate_member_discount(sale_id,type);
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({ $.ajax({
type: "GET", type: "GET",

View File

@@ -425,15 +425,15 @@
var sale_id = $('#sale_id').text(); var sale_id = $('#sale_id').text();
// var item_row = $('.is_card'); // var item_row = $('.is_card');
// if (item_row.length < 1) {
calculate_member_discount(sale_id);
// }
// payment // payment
var cash = $('#cash').text(); var cash = $('#cash').text();
var credit = $('#credit').text(); var credit = $('#credit').text();
var card = $('#card').text(); var card = $('#card').text();
if (credit <= 0) {
calculate_member_discount(sale_id);
}
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>", url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id, data: "cash="+ cash + "&sale_id=" + sale_id,