This commit is contained in:
Myat Zin Wai Maw
2020-01-22 14:26:14 +06:30
parent 0df7357cc9
commit fae91f701b
6 changed files with 18 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
class Api::ShopsController < Api::ApiController
skip_before_action :set_current_tenant_by_subdomain_or_first
skip_before_action :set_current_tenant_by_subdomain_or_first, only: [:index, :show]
def index
@shops = Shop.select('id,logo,name,shop_code,address,phone_no').all

View File

@@ -43,11 +43,12 @@ class Foodcourt::FoodCourtController < ApplicationController
end
end
@app_order_new_count = Booking.select("bookings.*,customers.*")
.joins(" JOIN sales ON bookings.sale_id=sales.sale_id")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and DATE(bookings.created_at) = '#{Date.today}' and bookings.booking_status='assign'").uniq.length
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','paid',Date.today).order("bookings.created_at desc").uniq.length
render "foodcourt/addorders/detail"
end

View File

@@ -71,7 +71,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("sales.sale_status !=? and orders.source='app' and DATE(bookings.created_at)=?",'void',Date.today).order("bookings.created_at desc").uniq
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','paid',Date.today).order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])

View File

@@ -462,7 +462,8 @@ class Sale < ApplicationRecord
tax_profiles = unique_tax_profiles(order_source, self.customer_id)
if tax_type.nil?
if tax_profiles.count == 2
#in previous >> if tax_profiles.count ==2
if tax_profiles.count >= 2
tax_type = "all"
elsif tax_profiles.count == 1
if tax_profiles.name.downcase == "service charges"

View File

@@ -5,7 +5,17 @@ if @status == true
json.order_items do
json.array! @order.order_items, :item_code, :item_name, :qty, :options, :remark,:price
end
json.sale_id @sale.sale_id
if @sale
json.sale_id @sale.sale_id
json.sale_items do
json.array! @sale.sale_items, :product_name, :qty, :remark,:price
end
json.grand_total @sale.grand_total
json.total_tax @sale.total_tax
json.taxes do
json.array! @sale.sale_taxes, :tax_name, :tax_rate, :tax_payable_amount, :inclusive
end
end
else
json.status :error
if @error_messages

View File

@@ -215,6 +215,7 @@ namespace :shop do
{membership_type:"member_discount",is_active:1,gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"get_member_campaign",is_active:1,gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"search_paypar_account_no",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"void",is_active:1,gateway_url:"/api/payments/payment_void",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"search_paypar_security_code",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_security_code",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code}])
puts " Finished member_actions Set Up Data"