Merge branch 'r-1902001-01' into foodcourt

This commit is contained in:
Thein Lin Kyaw
2020-07-21 12:04:17 +06:30
6 changed files with 25 additions and 8 deletions

View File

@@ -0,0 +1,8 @@
class Api::TaxProfilesController < Api::ApiController
def index
@tax_profiles = TaxProfile.where(nil)
@tax_profiles = @tax_profiles.filter_by_group_type(params[:group_type]) if params[:group_type].present?
end
end

View File

@@ -1243,7 +1243,7 @@ end
def self.get_shift_sales_by_receipt_no_detail(shift_sale_range, shift, from, to, payment_type, customer_filter) def self.get_shift_sales_by_receipt_no_detail(shift_sale_range, shift, from, to, payment_type, customer_filter)
## => left join -> show all sales although no orders ## => left join -> show all sales although no orders
puts customer_filter
query = Sale.includes([:survey, :sale_payments]) query = Sale.includes([:survey, :sale_payments])
.select("sales.*, SUM(sale_payments.payment_amount) AS payments_for_credits_amount") .select("sales.*, SUM(sale_payments.payment_amount) AS payments_for_credits_amount")
.select("dining_facilities.type AS table_type, dining_facilities.name AS table_name") .select("dining_facilities.type AS table_type, dining_facilities.name AS table_name")

View File

@@ -5,6 +5,8 @@ class TaxProfile < ApplicationRecord
# validations # validations
validates_presence_of :name, :rate, :group_type validates_presence_of :name, :rate, :group_type
scope :filter_by_group_type, -> (group_type) { where group_type: group_type }
def self.calculate_tax(group_type) def self.calculate_tax(group_type)
divided_value =0.0 divided_value =0.0
exclusive =0.0 exclusive =0.0

View File

@@ -0,0 +1,4 @@
json.status true
json.data do
json.tax_profiles @tax_profiles, :name, :group_type, :rate, :inclusive, :order_by
end

View File

@@ -18,7 +18,12 @@
<option value="9">Last year</option> <option value="9">Last year</option>
</select> </select>
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.customer_name") %></label>
<input type="text" placeholder="Customer name" class="form-control m-t-3" name="customer" value="<%= params[:customer] %>" id="customer_filter" style="height: 32px;">
</div>
<% if defined? @payment_methods %> <% if defined? @payment_methods %>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style"> <div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.select_payments") %></label>
@@ -31,11 +36,6 @@
</div> </div>
<% end %> <% end %>
<div class="col-lg-2 col-md-2 col-sm-2 mbl-style">
<label class="font-14"><%= t("views.right_panel.detail.customer_name") %></label>
<input type="text" placeholder="Customer name" class="form-control m-t-3" name="customer" id="customer_filter" >
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style"> <div class="col-lg-2 col-md-2 col-sm-2 col-mbl-view mbl-style">
<!-- <label class="">Select Shift Period</label> --> <!-- <label class="">Select Shift Period</label> -->
<label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label> <label class="font-14 mbl_lbl"><%= t("views.right_panel.detail.from") %></label>

View File

@@ -54,6 +54,10 @@ scope "(:locale)", locale: /en|mm/ do
get 'get_tax_profiles' => "shops#get_tax_profiles" get 'get_tax_profiles' => "shops#get_tax_profiles"
post 'verifications/update' => "verifications#update" post 'verifications/update' => "verifications#update"
scope '/(:group_type)', defaults: { group_type: nil } do
resources :tax_profiles, only: [:index]
end
namespace :restaurant do namespace :restaurant do
get 'zones' => "zones#index" get 'zones' => "zones#index"
resources :menu, only: [:index, :show] resources :menu, only: [:index, :show]
@@ -74,7 +78,6 @@ scope "(:locale)", locale: /en|mm/ do
post "bill/:booking_id" => "bill#create" post "bill/:booking_id" => "bill#create"
post "move" => "move#create" post "move" => "move#create"
#Order Controller #Order Controller
resources :orders, only: [:create, :show, :update] do resources :orders, only: [:create, :show, :update] do
post "bill" => "bill#create" post "bill" => "bill#create"