diff --git a/app/controllers/api/tax_profiles_controller.rb b/app/controllers/api/tax_profiles_controller.rb new file mode 100644 index 00000000..e1e13de0 --- /dev/null +++ b/app/controllers/api/tax_profiles_controller.rb @@ -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 diff --git a/app/models/sale.rb b/app/models/sale.rb index 8c6d7847..0041d00d 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1243,7 +1243,7 @@ end 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 - + puts customer_filter query = Sale.includes([:survey, :sale_payments]) .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") diff --git a/app/models/tax_profile.rb b/app/models/tax_profile.rb index f06270e6..daa894fb 100755 --- a/app/models/tax_profile.rb +++ b/app/models/tax_profile.rb @@ -5,6 +5,8 @@ class TaxProfile < ApplicationRecord # validations 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) divided_value =0.0 exclusive =0.0 diff --git a/app/views/api/tax_profiles/index.json.jbuilder b/app/views/api/tax_profiles/index.json.jbuilder new file mode 100644 index 00000000..e8edb04b --- /dev/null +++ b/app/views/api/tax_profiles/index.json.jbuilder @@ -0,0 +1,4 @@ +json.status true +json.data do + json.tax_profiles @tax_profiles, :name, :group_type, :rate, :inclusive, :order_by +end diff --git a/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb index f2370451..56daeb30 100755 --- a/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no_detail/_shift_sale_report_filter.html.erb @@ -18,7 +18,12 @@ - + +
+ + +
+ <% if defined? @payment_methods %>
@@ -31,11 +36,6 @@
<% end %> -
- - -
-
diff --git a/config/routes.rb b/config/routes.rb index c2fbcf77..421fd099 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -54,6 +54,10 @@ scope "(:locale)", locale: /en|mm/ do get 'get_tax_profiles' => "shops#get_tax_profiles" post 'verifications/update' => "verifications#update" + scope '/(:group_type)', defaults: { group_type: nil } do + resources :tax_profiles, only: [:index] + end + namespace :restaurant do get 'zones' => "zones#index" resources :menu, only: [:index, :show] @@ -74,7 +78,6 @@ scope "(:locale)", locale: /en|mm/ do post "bill/:booking_id" => "bill#create" post "move" => "move#create" - #Order Controller resources :orders, only: [:create, :show, :update] do post "bill" => "bill#create"