diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js index ee1c6a41..fc535ff7 100644 --- a/app/assets/javascripts/CRM.js +++ b/app/assets/javascripts/CRM.js @@ -11,6 +11,7 @@ // about supported directives. // //= require jquery +//= require tether //= require bootstrap //= require jquery_ujs //= require turbolinks diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 3215f9e6..601055e5 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -28,11 +28,10 @@ class Origami::CustomersController < BaseOrigamiController @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customer = Customer.new - if flash["errors"] - @crm_customer.valid? - end + # if flash["errors"] + # @crm_customer.valid? + # end - respond_to do |format| # format.html { render :template => "crm/customers/index" } format.html { render action: "index"} diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 5239d121..e848366c 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -8,15 +8,17 @@ class Origami::RequestBillsController < BaseOrigamiController check_booking = Booking.find_by_booking_id(booking_id) if check_booking.sale_id.nil? # Create Sale if it doesn't exist + puts "current_login_employee" + puts current_login_employee.name @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee) @sale_data = Sale.find_by_sale_id(@sale_id) - @sale_items = SaleItem.where("sale_id=?",@sale_id) + @sale_items = SaleItem.where("sale_id=?",@sale_id) else @sale_data = Sale.find_by_sale_id(check_booking.sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id) end - unique_code = "ReceiptBillPdf" + unique_code = "ReceiptBillPdf" customer= Customer.where('customer_id=' + @sale_data.customer_id) # get printer info @@ -28,10 +30,8 @@ class Origami::RequestBillsController < BaseOrigamiController # Calculate Food and Beverage Total food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items) - printer = Printer::ReceiptPrinter.new(print_settings) + printer = Printer::ReceiptPrinter.new(print_settings) printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total) redirect_to origami_path(@sale_data.sale_id) end end - - diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index b1c28e98..82be6f59 100644 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -104,7 +104,19 @@ class Transactions::SalesController < ApplicationController end def manual_void_sale - sale_id = params[:sale_id] + + sale_id = params[:sale_id] + reason = params[:reason] + sale = Sale.find(sale_id) + sale.sales_status = 'void' + sale.remarks = reason + sale.void_by = current_user.id + if sale.save + sale =SaleAudit.record_audit_void(sale_id, current_user.id, current_user.id, reason) + end + respond_to do |format| + format.html { redirect_to transactions_sales_url, notice: 'Sale was successfully void.' } + end end diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 36008efb..f97de091 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -44,6 +44,7 @@ <% if @crm_customers.count > 0 %> <% @crm_customers.each do |crm_customer| %> + <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> @@ -54,6 +55,7 @@ <%= link_to 'Show', crm_customer_path(crm_customer) %> + <% end %> <% end %> <%else%>

There are no record for your search

@@ -101,13 +103,12 @@
- <%= f.text_field :date_of_birth,:class=>"form-control datepicker"%> + <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
- <% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %> @@ -120,6 +121,7 @@
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %> + <%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
<%end%>
@@ -229,5 +231,12 @@ $(function() { }); } + $('#reset').click(function() { + + window.location.href = '/crm/customers' + + return false; + }); + \ No newline at end of file diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index b58ca35a..dd2b1b99 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -2,9 +2,9 @@