diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 2804583a..34c93405 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -339,13 +339,14 @@ $(function(){ $(".sx_item_set_detailModal").css({ 'display': "none" }); }else{ $(".sx_item_set_detailModal").css({ 'display': "block" }); - $.alert({ - title: 'Alert!', - content: 'Please Select Minimum ' + min_qty + " items", - type: 'red', - typeAnimated: true, - btnClass: 'btn-danger', - }); + swal("Alert !", 'Please Select Minimum ' + min_qty + " items", "warning"); + // $.alert({ + // title: 'Alert!', + // content: 'Please Select Minimum ' + min_qty + " items", + // type: 'red', + // typeAnimated: true, + // btnClass: 'btn-danger', + // }); } }); //End add order Click @@ -420,7 +421,7 @@ $(function(){ for(var field in attributes) { value = attributes[field]["values"]; type = attributes[field]["type"] - row = "

"+attributes[field]["type"]+"

"; + row = "
"+attributes[field]["type"]+"
"; $(value).each(function(i){ disabled = "" @@ -794,11 +795,10 @@ $(function(){ // Get Selected Class function change_qty_plus_minus(id,plus,minus) { - var count = 1; + var count = parseInt($('#'+id).val()) var countEl = document.getElementById(id); $('#'+plus).on("click", function(){ - count++; countEl.value = count; @@ -852,6 +852,37 @@ $(function(){ } }) } + + + $('.keypress_qty').keyup(function(e){ + + id = $(this).attr('id'); + value = $(this).val(); + + if (id=="count") { + price = $("#unit_price").text(); + $("#total_price").text(value*price); + }else{ + var item_row = $('.selected-instance'); + price = $("#set_unit_price").text(); + set_total_price = $("#set_total_price").text(); + $("#set_count").val(value); + if (item_row.length > 1) { + total = 0 ; + $(item_row).each(function(i){ + total += value * $(item_row[i]).attr('data-price'); + total_price = total; + }); + }else{ + total_price = value*price; + } + $("#set_total_price").text(total_price); + } + }); + + /* $("input").keypress(function(){ + $("span").text(i += 1); +});*/ // $("#set_change_qty").change(function(){ // qty = $(this).val(); // price = $("#set_total_price").text(); diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 50529aea..18bdca31 100755 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -87,3 +87,29 @@ } +.cashier_number{ + width: 33%; + height:58px; + line-height:58px; + text-align:center; + background:#54A5AF; + // float:left; + // margin:2px; + font-size:20px; + color:white; + // cursor:pointer; +} + +.red { + background-color:#F44336; +} + +.green{ + background-color: #009900; +} +.left{ + margin-left:1px; +} +.bottom{ + margin-bottom:1px; +} diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index b14895df..970532f7 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -152,6 +152,10 @@ section.content{ } -#count { +#count ,#set_count{ text-align: center; +} + +.add_icon{ + cursor: pointer; } \ No newline at end of file diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index d8ee10fb..2a277144 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -33,7 +33,7 @@ class Crm::CustomersController < BaseCrmController end end end - @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) + @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(15) @crm_customer = Customer.new @count_customer = Customer.count_customer @@ -70,7 +70,7 @@ class Crm::CustomersController < BaseCrmController #get customer amount @customer = Customer.find(params[:id]) @response = Customer.get_membership_transactions(@customer) - + puts @response.to_json # @response = "" #end customer amount diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index a48e03a7..480ad08e 100755 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -7,6 +7,7 @@ class Crm::DiningQueuesController < BaseCrmController def index today = DateTime.now.strftime('%Y-%m-%d') @dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and status is NULL ", today).order("queue_no asc") + @complete_queue = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and status = 'Assign' ", today).order("queue_no asc") end # GET /crm/dining_queues/1 diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 82e878bd..c1319bfe 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -215,7 +215,7 @@ class Origami::DiscountsController < BaseOrigamiController else response = {"status": false, "message": "You have no selected discount item" } end - puts "discount" + puts "discountttttttttttt" puts response.to_json # Re-calc All Amount in Sale if response["status"] == true diff --git a/app/controllers/transactions/shift_sales_controller.rb b/app/controllers/transactions/shift_sales_controller.rb new file mode 100644 index 00000000..1f765d21 --- /dev/null +++ b/app/controllers/transactions/shift_sales_controller.rb @@ -0,0 +1,61 @@ +class Transactions::ShiftSalesController < ApplicationController + load_and_authorize_resource except: [:create] + before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy] + + def index + + filter = params[:filter] + from = params[:from] + to = params[:to] + + if filter.nil? && from.nil? && to.nil? + @shift_sales = ShiftSale.all.order("id desc") + @shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20) + else + shift_sale = ShiftSale.search(filter,from,to) + if shift_sale.count > 0 + @shift_sales = shift_sale + @shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20) + else + @shift_sales = 0 + end + end + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @shift_sales } + end + + end + + # GET /transactions/shift_sales/1 + # GET /transactions/shift_sales/1.json + def show + + @shift = ShiftSale.find(params[:id]) + + #get tax + shift_obj = ShiftSale.where('id =?',@shift.id) + @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') + #other payment details for mpu or visa like card + @other_payment = ShiftSale.get_by_shift_other_payment(@shift) + + # Calculate price_by_accounts + @total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount') + @total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount') + @total_member_discount = ShiftSale.get_total_member_discount(@shift) + + + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @shift } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_transactions_shift_sale + @transactions_shift_sale = ShiftSale.find(params[:id]) + end +end diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index e9a6dd44..7546daa5 100755 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -135,4 +135,20 @@ class ShiftSale < ApplicationRecord end + def self.search(filter,from,to) + if filter.blank? + keyword = '' + else + keyword = "booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%" + end + + if from.present? && to.present? + booking = ShiftSale.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ? and NOT booking_status = 'void' ", from,to) + query = booking.where(keyword) + else + where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%") + end + + end + end diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index 300603a3..992512f2 100755 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -22,7 +22,7 @@ str="[\"#{msg['name']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end -%> @@ -45,7 +45,7 @@ <% str="[\"#{msg['company']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end -%>
"> @@ -55,7 +55,7 @@ <% str="[\"#{msg['contact_no']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end %>
@@ -66,7 +66,7 @@ <% str="[\"#{msg['email']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end %> @@ -107,7 +107,7 @@ <% str="[\"#{msg['card_no']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end %> diff --git a/app/views/crm/customers/show.html.erb b/app/views/crm/customers/show.html.erb index 640e8ef6..6027eec6 100755 --- a/app/views/crm/customers/show.html.erb +++ b/app/views/crm/customers/show.html.erb @@ -36,6 +36,7 @@ + <%= @customer.card_no rescue '-'%> @@ -43,9 +44,9 @@ <%= @customer.company rescue '-' %> <%= @customer.contact_no %> <%= @customer.email %> - <%= @customer.nrc_no %> - <%= @customer.address%> - <%= @customer.date_of_birth %> + <%= @customer.nrc_no rescue '-' %> + <%= @customer.address rescue '-'%> + <%= @customer.date_of_birth rescue '-'%> <% if @customer.membership_type.to_f > 0%> <%lookup= Lookup.find_by_value(@customer.membership_type) %> <%= lookup.name %> @@ -80,7 +81,7 @@ <%= transaction["date"]%> - <%= transaction["rebate"] %> + <%= transaction["deposit"] %> <%= transaction["account_status"] %> <%= transaction["status"] %> @@ -104,7 +105,6 @@ <%= t("views.right_panel.detail.order_id") %> <%= t("views.right_panel.detail.type") %> - <%= t("views.right_panel.detail.type") %> <%= t("views.right_panel.detail.order_status") %> <%= t("views.right_panel.detail.order_date") %> <%= t("views.right_panel.detail.items_count") %> @@ -114,10 +114,10 @@ <% @orders.each do |order| %> - <%= order.order_id %> + <%= link_to order.order_id, transactions_order_path(order) %> <%= order.order_type %> <%= order.status %> - <%= order.date.strftime("%d-%m-%Y") %> + <%= order.date.strftime("%d-%m-%Y %I:%m %p") %> <%= order.item_count %> <% end %> @@ -146,13 +146,13 @@ <% @sales.each do |sale| %> - <%= sale.sale_id %> + <%= link_to sale.sale_id, transactions_sale_path(sale) %> <%= sale.receipt_no %> <%= sale.grand_total rescue '-' %> <%= sale.total_tax %> <%= sale.cashier_name rescue '-' %> <%= sale.sale_status %> - <%= sale.receipt_date.strftime("%d-%m-%Y") %> + <%= sale.receipt_date.strftime("%d-%m-%Y %I:%m %p") %> <% end %> diff --git a/app/views/crm/dining_queues/_form.html.erb b/app/views/crm/dining_queues/_form.html.erb index 2fb01b44..f20b2a57 100755 --- a/app/views/crm/dining_queues/_form.html.erb +++ b/app/views/crm/dining_queues/_form.html.erb @@ -1,27 +1,83 @@
-
+
<%= simple_form_for([:crm,@dining_queue]) do |f| %> <%= f.error_notification %> -
+
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%> <%= f.input :name %> <%= f.input :contact_no %> <%= f.input :seater %> <%= f.input :remark %> - -

- <%= f.button :submit,"Create Queue" ,:class=>"btn btn-primary bg-blue btn-lg waves-effect"%> + <%= f.submit t('views.btn.submit'),:class => 'btn btn-primary btn-lg waves-effect' %>
-
+ <% end %>
-
+
+
+
+
+
+
+
+
1
+
2
+
3
+
+
+
+ +
+
+
+
4
+
5
+
6
+
+
+
+ +
+
+
+
7
+
8
+
9
+
+
+
+ +
+
+
+
0
+
.
+
00
+
+
+
+ +
+
+
+
+
DEL
+
CLR
+
+
+
+
+
+
+
+ +
view_headline <%= t("views.right_panel.header.page_detail") %>
@@ -50,9 +106,55 @@ diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index a02cc36d..fab41cdc 100755 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -11,42 +11,79 @@
-
+
-
- - -
-
-
- - <% @dining_queues.each do |queue| %> - <% if queue.status == "Assign" - @bg_color = "assign" - elsif queue.status == "Cancel" - @bg_color = "cancel" - else - @bg_color = "normal" - end - %> -
-
- - - Queue No : <%= queue.queue_no %> - Seater : <%= queue.seater %>
- Name : <%= queue.name %>
- Contact No : <%= queue.contact_no %> - Remark : <%= queue.remark %> -
-
- - <% end %> -
-
+
+
+
+ <% if @dining_queues.count > 0 %> +
+ + <% @dining_queues.each do |queue| %> + <% if queue.status == "Assign" + @bg_color = "assign" + elsif queue.status == "Cancel" + @bg_color = "cancel" + else + @bg_color = "normal" + end + %> +
+
+ + + Queue No : <%= queue.queue_no %> + Seater : <%= queue.seater %>
+ Name : <%= queue.name %>
+ Contact No : <%= queue.contact_no %>
+ Remark : <%= queue.remark %> +
+
+ <% end %> +
-
+ <% else %> +

There is no queue Now !

+ <% end %> +
+
+
+
+
+
+
+
view_headline QUEUE DETAILs
+

+ 1) Latest Queue No - <%= @complete_queue.last.queue_no%>
+ 2) Next Queue No - <% @next = @complete_queue.last.queue_no.to_i + 1%> + <%= @next%>
+ 3) Today Completed Queue - <%= @complete_queue.count %>
+ +

list <%= t("views.right_panel.header.button_lists") %>
+

+ 1) <%= t("views.right_panel.button.cancel") %> + <%= t("views.right_panel.button.queue") %> - + <%= t("views.right_panel.detail.cancel_btn_txt") %> + <%= t("views.right_panel.detail.queue_txt") %>
+ + 2) <%= t("views.btn.new") %> + <%= t("views.right_panel.button.queue") %> - + <%= t("views.right_panel.detail.create_btn_txt") %> + <%= t("views.right_panel.detail.queue_txt") %>
+ + 2) <%= t("views.btn.assign") %> + <%= t("views.right_panel.button.queue") %> - + <%= t("views.right_panel.detail.assign_txt") %> + <%= t("views.right_panel.detail.queue_txt") %>
+

+
list <%= t("views.right_panel.header.link_lists") %>
+

+ 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
+ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.home_txt") %>
+

+
+
<%= link_to t("views.btn.new"),new_crm_dining_queue_path,:class => 'btn bg-green btn-block btn-lg btn-block', 'data-no-turbolink' => true %> @@ -112,3 +149,10 @@ function cancel_queue(id,url) { } + \ No newline at end of file diff --git a/app/views/layouts/_left_sidebar.html.erb b/app/views/layouts/_left_sidebar.html.erb index 25b196af..1ec77487 100755 --- a/app/views/layouts/_left_sidebar.html.erb +++ b/app/views/layouts/_left_sidebar.html.erb @@ -77,12 +77,12 @@ <%= t :transactions %>
  • diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 8fa1b640..095036fa 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -33,7 +33,7 @@
    - ORDER DETAILS | Table<%=@table.name%> + ORDER DETAILS | Table-<%=@table.name%> @@ -62,7 +62,7 @@ 0.00 - +
  • @@ -98,8 +98,16 @@
    @@ -110,7 +118,7 @@
    @@ -173,7 +193,7 @@