diff --git a/Gemfile b/Gemfile index 22275707..8f16e924 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0' gem 'mysql2', '>= 0.3.18', '< 0.5' #Use PosgreSQL -# gem 'pg' +#gem 'pg' # redis server for cable # gem 'redis', '~> 3.0' diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 7acdb485..0886d04e 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -37,7 +37,7 @@ $(document).ready(function(){ control_button(order_status); var customer_id=$(this).find(".customer-id").text(); - //show_customer_details(customer_id); + show_customer_details(customer_id); $("#re-print").val(unique_id); diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 2670dcc4..3606dadc 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -9,6 +9,8 @@ // min-height: 75rem; // padding-top: 4.5rem; // } +.card-columns { + font-size: 18px !important;} .others-payment{ line-height:100px; @@ -128,6 +130,11 @@ text-align: right; } +.item-attr-edit{ + width: 10%; + text-align: left; +} + .display-none{ display: none; } @@ -186,4 +193,4 @@ tr.discount-item-row:hover { .jconfirm-box-container{ margin-left:-40px !important -} \ No newline at end of file +} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 50278d71..d0a8ca9e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base # redirect_to root_path # end + def current_user @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] end diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 17012ad1..43b0618e 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -63,61 +63,62 @@ class Crm::CustomersController < BaseCrmController def edit end - # POST /crm/customers + # POST /crm/customers # POST /crm/customers.json def create @crm_customers = Customer.new(customer_params) respond_to do |format| - puts @crm_customers.errors.to_json if @crm_customers.save - name = customer_params[:name] - phone = customer_params[:contact_no] - email = customer_params[:email] - dob = customer_params[:date_of_birth] - address = customer_params[:address] - nrc = customer_params[:nrc_no] - member_group_id = params[:member_group_id] - - membership = MembershipSetting.find_by_membership_type("paypar_url") - memberaction = MembershipAction.find_by_membership_type("create_membership_customer") - merchant_uid = memberaction.merchant_account_id.to_s - auth_token = memberaction.auth_token.to_s - url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - - begin - response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, - dob: dob,address: address,nrc:nrc, - member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - }, - :timeout => 10 - ) - rescue Net::OpenTimeout - response = { status: false } - end - - if response["status"] == true + name = customer_params[:name] + phone = customer_params[:contact_no] + email = customer_params[:email] + dob = customer_params[:date_of_birth] + address = customer_params[:address] + nrc = customer_params[:nrc_no] + member_group_id = params[:member_group_id] - customer = Customer.find(@crm_customers.customer_id) - status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) - - if params[:sale_id] - format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' } - else - format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'} - end - # format.json { render :index, status: :created, location: @crm_customers } - else - - # @crm_customers.destroy - if params[:sale_id] - format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} + if !member_group_id.nil? + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("create_membership_customer") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + begin + response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, + dob: dob,address: address,nrc:nrc, + member_group_id: member_group_id, + merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + if response["status"] == true + + customer = Customer.find(@crm_customers.customer_id) + status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id ) + + if params[:sale_id] + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' } + else + format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'} + end + # format.json { render :index, status: :created, location: @crm_customers } else - format.html { redirect_to crm_customers_path, notice: response["message"] } + # @crm_customers.destroy + if params[:sale_id] + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} + else + format.html { redirect_to crm_customers_path, notice: response["message"] } + end end end else @@ -135,7 +136,6 @@ class Crm::CustomersController < BaseCrmController end end - # PATCH/PUT /crm/customers/1 # PATCH/PUT /crm/customers/1.json def update @@ -152,26 +152,66 @@ end id = @crm_customer.membership_id member_group_id = params[:member_group_id] - membership = MembershipSetting.find_by_membership_type("paypar_url") - memberaction = MembershipAction.find_by_membership_type("update_membership_customer") - merchant_uid = memberaction.merchant_account_id.to_s - auth_token = memberaction.auth_token.to_s - url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - begin - response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, - dob: dob,address: address,nrc:nrc, - id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - }, - :timeout => 10 - ) - rescue Net::OpenTimeout - response = { status: false } - end - format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' } - format.json { render :show, status: :ok, location: @crm_customer } + if id.nil? && !member_group_id.nil? + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("create_membership_customer") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + begin + response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, + dob: dob,address: address,nrc:nrc, + member_group_id: member_group_id, + merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + if response["status"] == true + + customer = Customer.find(@crm_customer.customer_id) + status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id ) + + format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'} + else + format.html { redirect_to crm_customers_path, notice: response["message"] } + end + + else + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("update_membership_customer") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + begin + response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, + dob: dob,address: address,nrc:nrc, + id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + if response["status"] == true + format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' } + format.json { render :show, status: :ok, location: @crm_customer } + else + format.html { redirect_to crm_customers_path, notice: response["message"] } + end + + end else diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 734793b3..dbcc4046 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -104,6 +104,6 @@ class Crm::DiningQueuesController < BaseCrmController # Never trust parameters from the scary internet, only allow the white list through. def dining_queue_params - params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status) + params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status,:seater,:remark) end end diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index c05e7cf3..6866ddf1 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,12 +1,12 @@ class Crm::HomeController < BaseCrmController def index - @booking = Booking.all - @customer = Customer.all - from = Time.now.beginning_of_day.utc - to = Time.now.end_of_day.utc - @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC') - + # @booking = Booking.all + # @customer = Customer.all + # from = Time.now.beginning_of_day.utc + # to = Time.now.end_of_day.utc + # @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC') + redirect_to crm_customers_path # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) end diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 373dc2f5..f15b8545 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -12,8 +12,17 @@ class Origami::CustomersController < BaseOrigamiController def add_customer - @sale_id = params[:sale_id] - filter = params[:filter] + @sale_id = params[:sale_id] + if(@sale_id[0,3] == "SAL") + @booking = Booking.find_by_sale_id(@sale_id) + @dining_facility = DiningFacility.find(@booking.dining_facility_id) + else + @booking_order = BookingOrder.find_by_order_id(@sale_id) + @booking = Booking.find(@booking_order.booking_id) + @dining_facility = DiningFacility.find(@booking.dining_facility_id) + end + + filter = params[:filter] filter = params[:filter] diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 13c528ab..c4edcc0b 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -23,8 +23,9 @@ class Origami::HomeController < BaseOrigamiController @order_items = Array.new booking.booking_orders.each do |booking_order| order = Order.find(booking_order.order_id) - if (order.status == "new") + if (order.status == "new") @obj_order = order + @customer = order.customer @date = order.created_at order.order_items.each do |item| @order_items.push(item) @@ -43,6 +44,7 @@ class Origami::HomeController < BaseOrigamiController @date = sale.created_at @status_sale = 'sale' @obj_sale = sale + @customer = sale.customer end end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 00abc9aa..0119953f 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -11,7 +11,7 @@ class Origami::PaymentsController < BaseOrigamiController saleObj = Sale.find(sale_id) sale_payment = SalePayment.new sale_payment.process_payment(saleObj, @user, cash, "cash") - + rebate_amount = nil unique_code = "ReceiptBillPdf" @@ -53,7 +53,8 @@ class Origami::PaymentsController < BaseOrigamiController response["data"].each do |res| if res["accountable_type"] == "RebateAccount" @balance = res["balance"] - @accountable_type = res["accountable_type"] + # @accountable_type = res["accountable_type"] + @accountable_type = "Rebate Balance" end end end diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index 1ac7f41a..c25e0e1f 100644 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -9,9 +9,11 @@ class Origami::RoomsController < BaseOrigamiController @room.bookings.each do |booking| if booking.sale_id.nil? @order_items = Array.new + booking.booking_orders.each do |booking_order| order = Order.find(booking_order.order_id) @obj = order + @customer = order.customer order.order_items.each do |item| @order_items.push(item) end @@ -23,6 +25,7 @@ class Origami::RoomsController < BaseOrigamiController if sale.sale_status != "completed" @status = 'sale' @obj = sale + @customer = sale.customer end end end diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb new file mode 100644 index 00000000..93e98d03 --- /dev/null +++ b/app/controllers/origami/sale_edit_controller.rb @@ -0,0 +1,8 @@ +class Origami::SaleEditController < BaseOrigamiController + + def edit + sale_id = params[:sale_id] + @table_id = params[:table_id] + @saleobj = Sale.find(sale_id) + end +end diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index 0a069b1b..54432c38 100644 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -53,7 +53,7 @@ class Transactions::SalesController < ApplicationController #get customer amount @customer = Customer.find(@sale.customer_id) - @response = Customer.get_membership_transactions(@customer) + @response = Customer.get_membership_transactions(@customer) #end customer amount respond_to do |format| diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index f8cb639c..0e10307b 100644 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -20,8 +20,6 @@ class DiningFacility < ApplicationRecord def get_booking booking = self.get_current_booking - puts "is bookig?" - puts booking if booking if booking.dining_facility_id.to_i == self.id if booking.booking_status == 'assign' diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index 968d2ca9..eb121c14 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -104,6 +104,7 @@
<%= @i += 1 %> <%= crm_customer.name %> - <%= crm_customer.company rescue '-' %> + <%= crm_customer.card_no rescue '-' %> <%= crm_customer.contact_no %> <%= crm_customer.email %> <%= link_to 'Show', crm_customer_path(crm_customer) %> @@ -126,7 +127,7 @@ $(document).on('click',".customer_tr",function(){ $('#customer_address').val(data.address); $('#customer_date_of_birth').val(data.date_of_birth); $('#customer_membership_type').val(data.membership_type); - + $('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected'); if (data.gender == 'Male') { $('.male').prop( "checked", true ) }else{ @@ -142,7 +143,7 @@ $(document).on('click',".customer_tr",function(){ }else{ $('.mdm').prop( "checked", true ) } - // $('.selectpicker > option[value="'+data.membership_id+'"]').attr('selected','selected'); + $('.membership_authentication_code').val(data.membership_authentication_code); $('#update_customer').removeAttr('disabled').val(''); @@ -150,11 +151,14 @@ $(document).on('click',".customer_tr",function(){ $('#submit_customer').attr('disabled','disabled'); $("#new_customer").attr('class', 'simple_form edit_customer'); - var id = "edit_customer_"+$('#customer_id').val(); + var id = "edit_customer_"+customer_id; + alert(id) $("#new_customer").attr('id', id); + + $(".edit_customer").attr('id', id); $(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val()); $(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val()); - $(".patch_method").append(''); + $(".patch_method").html(''); //$(".edit_customer").attr('method', 'PATCH'); } }); diff --git a/app/views/crm/customers/show.html.erb b/app/views/crm/customers/show.html.erb index 5bdb9703..0dead477 100644 --- a/app/views/crm/customers/show.html.erb +++ b/app/views/crm/customers/show.html.erb @@ -1,126 +1,166 @@
-
- -
-
-
-
- -
-
- - - - - - - - - - - - - +
+ -
- - - - - - - - - - - - - - - - - - - - - - - - <% - if @response["status"] == true %> - <% @response["data"].each do |transaction| %> - - - - - - - - - - - <% end %> - <% end %> - -
Card NoNameCompanyContact noEmailNRC/Passport NoAddressDOB
<%= @customer.card_no rescue '-'%><%= @customer.name %><%= @customer.company rescue '-' %><%= @customer.contact_no %><%= @customer.email %><%= @customer.nrc_no %><%= @customer.address%><%= @customer.date_of_birth %>
Membership Transactions
DateRedeemRebateBalanceStatusReceipt No
<%= transaction["date"]%><%= transaction["redeem"]%><%= transaction["rebate"] %><%= transaction["balance"] %><%= transaction["status"] %><%= transaction["receipt_no"] %>
-
- -
- - - -
-
-

Order Details

+ + + + +
+ +
+
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Card NoNameCompanyContact noEmailNRC/Passport NoAddressDOB
<%= @customer.card_no rescue '-'%><%= @customer.name %><%= @customer.company rescue '-' %><%= @customer.contact_no %><%= @customer.email %><%= @customer.nrc_no %><%= @customer.address%><%= @customer.date_of_birth %>
+
+ +
+ + + + + <% if @response["status"] == true %> + + <% end %> + + + + + + + + + + + + + <% if @response["status"] == true %> + <% @response["data"].each do |transaction| %> + + + + + + + + + + + <% end %> + <% end %> + +
Membership TransactionsCurrent Balance : <%= @response["data"][0]["balance"]%>
DateRedeemRebateBalanceStatusReceipt No
<%= transaction["date"]%><%= transaction["redeem"]%><%= transaction["rebate"] %><%= transaction["balance"] %><%= transaction["status"] %><%= transaction["receipt_no"] %>
+
+ +
+ +
+ +

Order Details

+
+ + + + + + + + + + + + + + + + <% @order_items.each do |order_item| %> + + + + + + + + + + + <% end %> + +
Order IDMenu ItemQTYUnit Price OptionStatusWaiterCreated at
<%= order_item.order_id %><%= order_item.item_name %><%= order_item.qty %><%= order_item.price %><%= order_item.options %><%= order_item.order_item_status %><%= order_item.item_order_by %> <%= order_item.created_at.strftime("%d-%m-%y") %>
+
+ +
+ +
+

Sale Details

- + - - - - + + - <% @order_items.each do |order_item| %> + <% @sale_items.each do |sale_item| %> - - - - - - - - + + + + + + + <% end %>
Order IDSale ID Menu Item QTY Unit Price OptionStatusWaiterCreated at Tax PriceCreated At
<%= order_item.order_id %><%= order_item.item_name %><%= order_item.qty %><%= order_item.price %><%= order_item.options %><%= order_item.order_item_status %><%= order_item.item_order_by %> <%= order_item.created_at.strftime("%d-%m-%y") %><%= sale_item.sale_id %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.unit_price %><%= sale_item.taxable_price %><%= sale_item.created_at %>
-
-
-
+
+
+

Sale Details

@@ -150,18 +190,17 @@
-
+
- - diff --git a/app/views/crm/customers/showbackup.html.erb b/app/views/crm/customers/showbackup.html.erb deleted file mode 100644 index 936192cf..00000000 --- a/app/views/crm/customers/showbackup.html.erb +++ /dev/null @@ -1,85 +0,0 @@ -
-
- -
-
- - -
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - -
NameEmailContact noCompanyDate Of BirthMembership Account
<%= @crm_customer.name %><%= @crm_customer.email %><%= @crm_customer.contact_no %><%= @crm_customer.company %><%= @crm_customer.date_of_birth %>
-
- - -

Sale Items

- - - - - - - - - - - - - - - <% @sale_items.each do |sale_item| %> - - - - - - - - - - <% end %> - -
Sale ID Menu ItemQTYUnit Price Tax PriceCreated At
<%= sale_item.sale_id %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.unit_price %><%= sale_item.taxable_price %><%= sale_item.created_at %>
-
-
- -
- - -
-
- - - - diff --git a/app/views/crm/dining_queues/_form.html.erb b/app/views/crm/dining_queues/_form.html.erb index 320bac40..ad2d0283 100644 --- a/app/views/crm/dining_queues/_form.html.erb +++ b/app/views/crm/dining_queues/_form.html.erb @@ -2,15 +2,20 @@ <%= simple_form_for([:crm,@dining_queue]) do |f| %> <%= f.error_notification %> -
- <%= f.input :name %> - <%= f.input :contact_no %> - <%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%> +
+
+ <%= 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" %> +
+
+
+ <%= f.button :submit,"Create Queue" %> +
<% end %> diff --git a/app/views/crm/dining_queues/assign.html.erb b/app/views/crm/dining_queues/assign.html.erb index 9310844b..cc36e1a9 100644 --- a/app/views/crm/dining_queues/assign.html.erb +++ b/app/views/crm/dining_queues/assign.html.erb @@ -24,6 +24,7 @@

<%= table.name %>

+

Seat : <%= table.seater %>

diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index ac247771..813be2cf 100644 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -26,6 +26,7 @@ <%= @i += 1 %> . Queue No + Seater : <%= queue.seater %>

<%= queue.queue_no %>

diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index e862ea7f..0cd7d85b 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -73,6 +73,8 @@ + + <%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %>
"> @@ -171,6 +173,7 @@
- <% + <% # Can't check for discount unless sale_item.price == 0 %> @@ -259,22 +271,24 @@ <% if @dining.bookings.length >= 1 %> - - - - + <% if @status_order == 'order' && @status_sale != 'sale' %> - - - - - <% else %> + + + + + + + + <% else %> + + + - - - + + <% end %> @@ -285,23 +299,39 @@ diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index 495e1514..109bc418 100644 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -86,7 +86,7 @@

-

Date: <%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+

Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index fd2e78cb..c8254d42 100644 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -86,7 +86,7 @@

-

Date: <%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+

Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index a480593a..92ffc7f1 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -41,6 +41,11 @@
<%= table.name %> + <% if table.get_booking.nil? %> + billed + <% else %> + new + <% end %>
<% else %> @@ -62,6 +67,11 @@
<%= room.name %> + <% if room.get_booking.nil? %> + billed + <% else %> + new + <% end %>
<% else %> @@ -119,7 +129,7 @@

-

Date: <%= @order.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+

Date: <%= @order.created_at.utc.getlocal.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 1bbe5ce7..381edb25 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -41,6 +41,11 @@
<%= table.name %> + <% if table.get_booking.nil? %> + billed + <% else %> + new + <% end %>
<% else %> @@ -62,6 +67,11 @@
<%= room.name %> + <% if room.get_booking.nil? %> + billed + <% else %> + new + <% end %>
<% else %> @@ -97,11 +107,12 @@
- <% if @status == "order" %> + <% if @status == 'order' %>
ORDER DETAILS
- <% else %> + <% elsif @status_sale == 'sale' %>
INVOICE DETAILS
<% end %> +
@@ -113,12 +124,13 @@

-

Date: <%= @obj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+

Date: <%= @obj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

-

Customer :

+ +

Customer : <%= @customer.name %>

@@ -244,24 +256,36 @@ diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb new file mode 100644 index 00000000..f04561e0 --- /dev/null +++ b/app/views/origami/sale_edit/edit.html.erb @@ -0,0 +1,120 @@ +
+ +
+
+
+
INVOICE DETAILS
+
+
+
+
+

Receipt No: + <%= @saleobj.receipt_no rescue '' %> +

+
+
+

Date: <%= @saleobj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+
+
+
+
+

Customer :

+
+ +
+
+ + + + + + + + + + <% + count = 0 + sub_total = 0 + @saleobj.sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% + # Can't check for discount + unless sale_item.price == 0 + %> + + + + + + + + <% + end + end + %> + +
#ItemsQTY + Price + Action
<%= count %><%= sale_item.product_name %> +
+
+ +
+
+
+ + +
+ + +
+
+ diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index e896a50a..cd716052 100644 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -41,6 +41,11 @@
<%= table.name %> + <% if table.get_booking.nil? %> + billed + <% else %> + new + <% end %>
<% else %> @@ -62,6 +67,11 @@
<%= room.name %> + <% if room.get_booking.nil? %> + billed + <% else %> + new + <% end %>
<% else %> @@ -107,7 +117,7 @@

-

Date: <%= @sale.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+

Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

diff --git a/app/views/reports/receipt_no/index.xls.erb b/app/views/reports/receipt_no/index.xls.erb index 2191d814..8bdee23c 100644 --- a/app/views/reports/receipt_no/index.xls.erb +++ b/app/views/reports/receipt_no/index.xls.erb @@ -2,27 +2,27 @@
<% unless @sale_data.empty? %> -

<%=current_active_location.name%>

-

Sales Summary Report (BreadTalk)

-<% if params[:from]%> -

From Date : <%= params[:from] %> , To Date : <%= params[:to] %>

-<% end %> +

<%=current_active_location.name%>

+

Sales Summary Report (BreadTalk)

+<% if params[:from]%> +

From Date : <%= params[:from] %> , To Date : <%= params[:to] %>

+<% end %> - - + + - + - + - + @@ -35,101 +35,101 @@ <% foc = 0 %> <% discount = 0 %> <% total = 0 %> - <% count = 1 %> + <% count = 1 %> <% discount_rev = 0 %> <% total_rev = 0 %> <% grand_rev = 0 %> <% total_other_charges=0 %> <% total_tax=0 %> <% cash_received = 0 %> - <% total_cash_received = 0 %> + <% total_cash_received = 0 %> <% today_credit_payment_amount = 0 %> - <% old_location_id = 0%> - <% sub_total = 0 %> - <% count_of_void = 0 %> + <% old_location_id = 0%> + <% sub_total = 0 %> + <% count_of_void = 0 %> <% flag = false %> - <% @sale_data.each do |sale| %> + <% @sale_data.each do |sale| %> <% credit_payment += sale[:credit_payment].to_f %> <% card += sale[:card_amount].to_f %> <% cash += sale[:cash_amount].to_f %> - <% credit += sale[:credit_amount].to_f %> + <% credit += sale[:credit_amount].to_f %> <% foc += sale[:foc_amount].to_f %> <% discount += sale[:total_discount].to_f %> - <% total += sale[:grand_total].to_f %> + <% total += sale[:grand_total].to_f %> <% total_other_charges +=sale[:other_charges].to_f %> <% total_tax +=sale[:total_tax].to_f %> <% cash_received = sale[:cash_amount].to_f + sale[:credit_payment].to_f%> <% total_cash_received = cash.to_f + credit_payment.to_f%> <% today_credit_payment_amount += sale[:today_credit_payment].to_f %> - + - - - - + + + + - - + + - - <% total_void_amount = 0 %> + + <% total_void_amount = 0 %> <% if !@daily_void.nil? %> <% @daily_void.each do |d_v|%> - - <% if d_v[:daily_void_amt].to_i > 0 %> - <% if d_v[:location_id] == sale[:location_id] %> - <% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%> - <%count_of_void+=1%> - <%total_void_amount += d_v[:daily_void_amt].to_f%> + <% if d_v[:daily_void_amt].to_i > 0 %> + <% if d_v[:location_id] == sale[:location_id] %> + <% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%> + <%count_of_void+=1%> + + <%total_void_amount += d_v[:daily_void_amt].to_f%> <% flag = true %> - - - - <%end %> - <% end%> - <% end%> - <% end%> - <% end%> + + + + <%end %> + <% end%> + <% end%> + <% end%> + <% end%> <% if flag == true%> <% void += total_void_amount.to_f %> - - <% flag = false %> + + <% flag = false %> <% end%> - <%if count_of_void == 0%> - + <%if count_of_void == 0%> + <%end %> + <%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %> + -<%count_of_void= 0%> +<%count_of_void= 0%> <% count = count + 1 %> <% end %> - + - - - - + + + + - - + + <% end %>
Location Name DateCash SalesCash Sales Credit Sales Credit Received Card PaymentCard Payment Total Discount Total Taxes Total Other Charges FOC SalesVoid SalesVoid Sales Grand Total
<%= sale[:location].to_s rescue '-' %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %><%= sale[:location].to_s rescue '-' %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %> - <%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %> -
Grand Total <%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %>
-
\ No newline at end of file +
diff --git a/app/views/settings/employees/index.html.erb b/app/views/settings/employees/index.html.erb index e680eb91..1112f72b 100644 --- a/app/views/settings/employees/index.html.erb +++ b/app/views/settings/employees/index.html.erb @@ -22,7 +22,7 @@ <% @employees.each do |employee| %> - <%= link_to employee.name, employee[:setting] %> + <%= link_to employee.name,settings_employee_path(employee) %> <%= employee.role %> <%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %> diff --git a/app/views/settings/employees/show.html.erb b/app/views/settings/employees/show.html.erb index 084887dc..753298e6 100644 --- a/app/views/settings/employees/show.html.erb +++ b/app/views/settings/employees/show.html.erb @@ -9,3 +9,8 @@ Role: <%= @employee.role %>

+ +

+ Employee ID: + <%= @employee.emp_id %> +

diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb index 04343380..b62289b1 100644 --- a/app/views/transactions/sales/show.html.erb +++ b/app/views/transactions/sales/show.html.erb @@ -110,14 +110,14 @@   - Pay Amount + Total Pay Amount <%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%> <% @sale_receivables.each do |r|%> - Payment <%= r.payment_method rescue ' '%> + <%= r.payment_method.capitalize rescue ' '%> Payment <%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%> diff --git a/config/routes.rb b/config/routes.rb index 0bf24ce7..c93beb92 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -76,7 +76,7 @@ Rails.application.routes.draw do resources :customers #add customer type end post 'moving' => "movetable#moving" - + get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit" get 'table/:dining_id/movetable' => "movetable#move_dining" get 'table/:dining_id/moveroom' => "moveroom#move_dining" get 'sale/:sale_id' => 'sales#show' @@ -112,7 +112,7 @@ Rails.application.routes.draw do #---------Add Customer --------------# #resources :customers get '/:sale_id/customers', to: "customers#add_customer" - get '/:customer_id/get_customer' => 'home#get_customer' + get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details" post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer"#update customer id in sale table end diff --git a/db/migrate/20170617163811_create_dining_queues.rb b/db/migrate/20170623101708_create_dining_queues.rb similarity index 86% rename from db/migrate/20170617163811_create_dining_queues.rb rename to db/migrate/20170623101708_create_dining_queues.rb index d4b3eacd..dd2ea134 100644 --- a/db/migrate/20170617163811_create_dining_queues.rb +++ b/db/migrate/20170623101708_create_dining_queues.rb @@ -6,7 +6,8 @@ class CreateDiningQueues < ActiveRecord::Migration[5.1] t.string :queue_no t.string :status t.references :dining_facility, foreign_key: true - + t.integer :seater + t.string :remark t.timestamps end end