Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -265,6 +265,7 @@ function show_order_detail(url,sr_no){
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
|
$("#order_remark").text("");
|
||||||
$(".tbl_customer").show();
|
$(".tbl_customer").show();
|
||||||
if(data.status != "delivered"){
|
if(data.status != "delivered"){
|
||||||
$('#accepted').show();
|
$('#accepted').show();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
if status
|
if status
|
||||||
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
|
check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal')
|
||||||
if !check_customer.nil?
|
if !check_customer.nil?
|
||||||
customer_id = check_customer.customer_id
|
customer_id = check_customer.customer_id
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ class Api::SurveyController < Api::ApiController
|
|||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
|
|
||||||
if params[:survey_id]
|
if params[:id]
|
||||||
survey = Survey.find(params[:survey_id])
|
survey = Survey.find(params[:id])
|
||||||
else
|
else
|
||||||
survey = Survey.new
|
survey = Survey.new
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
def first_bill
|
def first_bill
|
||||||
sale_id = params[:sale_id] # sale_id
|
sale_id = params[:sale_id] # sale_id
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||||
member_info = nil
|
member_info = nil
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
@@ -99,7 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||||
shop_details = Shop.first
|
shop_details = Shop.first
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
|
|||||||
@@ -30,10 +30,19 @@ class OrderReservation < ApplicationRecord
|
|||||||
customer.address = params[:address] ? params[:address] : ''
|
customer.address = params[:address] ? params[:address] : ''
|
||||||
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||||
customer.membership_id = params[:membership_id]
|
customer.membership_id = params[:membership_id]
|
||||||
customer.customer_type = "Takeaway"
|
customer.customer_type = "Doemal"
|
||||||
customer.tax_profiles = ["2"]
|
customer.tax_profiles = ["2"]
|
||||||
customer.save
|
customer.save
|
||||||
|
|
||||||
|
# unless customer.valid?
|
||||||
|
# render json: {
|
||||||
|
# status: 422,
|
||||||
|
# message: "Validation error",
|
||||||
|
# errors: customer.errors
|
||||||
|
# }.to_json
|
||||||
|
# return
|
||||||
|
# end
|
||||||
|
|
||||||
return customer
|
return customer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,20 @@ class SaleItem < ApplicationRecord
|
|||||||
# return price
|
# return price
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
def self.get_all_sale_items(sale_id)
|
||||||
|
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
||||||
|
product_name,product_alt_name,account_id,status,remark,
|
||||||
|
(CASE WHEN qty > 0 AND remark IS NULL THEN SUM(qty) ELSE qty END) as qty,
|
||||||
|
unit_price,
|
||||||
|
taxable_price,
|
||||||
|
(CASE WHEN price > 0 AND remark IS NULL THEN SUM(price) ELSE price END) as price,
|
||||||
|
is_taxable")
|
||||||
|
.where("sale_id = ?",sale_id)
|
||||||
|
.order("product_name asc")
|
||||||
|
.group("status,product_name,item_instance_code,unit_price")
|
||||||
|
return sale_items
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ if (menu.menu_categories)
|
|||||||
|
|
||||||
if category.menu_items
|
if category.menu_items
|
||||||
json.items category.menu_items do |item|
|
json.items category.menu_items do |item|
|
||||||
|
if item.is_available
|
||||||
json.partial! 'origami/addorders/menu_item', item: item
|
json.partial! 'origami/addorders/menu_item', item: item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -151,14 +151,24 @@
|
|||||||
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0
|
||||||
|
tax_amount = 0
|
||||||
|
tax_name = ''
|
||||||
|
tax_arr = [] %>
|
||||||
<% net = 0 %>
|
<% net = 0 %>
|
||||||
<% unless @tax.empty? %>
|
<% unless @tax.empty? %>
|
||||||
<% @tax.each do |tax| %>
|
<% @tax.each do |tax| %>
|
||||||
<% total_tax += tax.tax_amount.to_f %>
|
<% if tax.tax_name.downcase == tax_name.downcase
|
||||||
|
tax_amount += tax.tax_amount
|
||||||
|
else
|
||||||
|
tax_amount = tax.tax_amount
|
||||||
|
end
|
||||||
|
tax_name = tax.tax_name
|
||||||
|
total_tax += tax.tax_amount.to_f
|
||||||
|
%>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
<td colspan="17" style='text-align:right;'><%= tax_name rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -171,7 +181,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% net = grand_total %>
|
<% net = grand_total %>
|
||||||
<% net = grand_total- discount%>
|
<% net = grand_total + discount%>
|
||||||
<% net = net - rounding_adj%>
|
<% net = net - rounding_adj%>
|
||||||
<% net = net - total_tax %>
|
<% net = net - total_tax %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
|
|||||||
Reference in New Issue
Block a user