diff --git a/app/controllers/settings/menu_item_instances_controller.rb b/app/controllers/settings/menu_item_instances_controller.rb index a214ffec..60646323 100755 --- a/app/controllers/settings/menu_item_instances_controller.rb +++ b/app/controllers/settings/menu_item_instances_controller.rb @@ -67,7 +67,11 @@ class Settings::MenuItemInstancesController < ApplicationController respond_to do |format| if @settings_menu_item_instances.save +<<<<<<< HEAD + @settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split("") +======= @settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ") +>>>>>>> 7a28dc1ddc100e61789fae7f1f3503e2f703711e @settings_menu_item_instances.save format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' } format.json { render :show, status: :created, location: @settings_menu_item_instances } diff --git a/app/controllers/transactions/bookings_controller.rb b/app/controllers/transactions/bookings_controller.rb index 3b8e241e..63090c9c 100644 --- a/app/controllers/transactions/bookings_controller.rb +++ b/app/controllers/transactions/bookings_controller.rb @@ -4,7 +4,7 @@ class Transactions::BookingsController < ApplicationController def index - filter = params[:filter] + filter = params[:receipt_no] from = params[:from] to = params[:to] diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb index 09f48d66..e35baa77 100755 --- a/app/controllers/transactions/credit_notes_controller.rb +++ b/app/controllers/transactions/credit_notes_controller.rb @@ -14,7 +14,8 @@ class Transactions::CreditNotesController < ApplicationController to = params[:to] if filter.nil? && from.nil? && to.nil? && customer.nil? - @credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING) + @credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING) + @credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20) else sale = Sale.search_credit_sales(customer,filter,from,to) if sale.count > 0 diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index a76fa385..17a117bb 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -3,16 +3,13 @@ class Transactions::OrdersController < ApplicationController def index filter = params[:filter] - count = params[:count] from = params[:from] to = params[:to] - if filter.nil? && from.nil? && to.nil? && count.nil? + if filter.nil? && from.nil? && to.nil? orders = Order.order("order_id desc") - else - orders = Order.search(filter,from,to,count) - + orders = Order.search(filter,from,to) end if !orders.nil? diff --git a/app/models/order.rb b/app/models/order.rb index 33022eec..dd6f6d66 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -363,18 +363,18 @@ class Order < ApplicationRecord end - def self.search(filter,from,to,count) - if count.to_i > 0 - item_count = "and item_count = '#{count}'" + def self.search(filter,from,to) + if filter.blank? + keyword = '' else - item_count = '' + keyword = "order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%" end - if from.present? && to.present? - Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ? #{item_count}", from,to) - elsif !from.present? && !to.present? && count.present? - Order.where("item_count = '#{count}'") + + if from.present? && to.present? + order = Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to) + query = order.where(keyword) else - Order.where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",) + where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%") end end diff --git a/app/models/print_setting.rb b/app/models/print_setting.rb index c326f715..a13229dc 100755 --- a/app/models/print_setting.rb +++ b/app/models/print_setting.rb @@ -1,4 +1,4 @@ class PrintSetting < ApplicationRecord # validations - validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height + validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies end diff --git a/app/models/sale.rb b/app/models/sale.rb index 17f49a12..14ff6266 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -449,7 +449,7 @@ class Sale < ApplicationRecord sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to) query = sale.where(keyword) else - where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",) + where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%") end end diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 091d8e51..89900056 100755 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -11,7 +11,7 @@
-
+
@@ -83,7 +83,7 @@ -
+
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %> diff --git a/app/views/print_settings/_form.html.erb b/app/views/print_settings/_form.html.erb index b795c380..51ee0eaa 100755 --- a/app/views/print_settings/_form.html.erb +++ b/app/views/print_settings/_form.html.erb @@ -15,7 +15,7 @@ <%= f.input :api_settings %> <%= f.input :page_width %> <%= f.input :page_height %> - <%= f.input :print_copies %> + <%= f.input :print_copies, input_html: { min: '1', step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %> <%= f.input :precision %> <%= f.input :delimiter %> <%= f.input :heading_space %> @@ -58,4 +58,19 @@
-
\ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/transactions/bookings/index.html.erb b/app/views/transactions/bookings/index.html.erb index 8c667197..7c587d32 100755 --- a/app/views/transactions/bookings/index.html.erb +++ b/app/views/transactions/bookings/index.html.erb @@ -19,7 +19,7 @@
- +