diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 4606b049..e74f9c7a 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -115,7 +115,7 @@ class Crm::CustomersController < BaseCrmController 'Content-Type' => 'application/json', 'Accept' => 'application/json' }, - :timeout => 100 + :timeout => 10 ) rescue HTTParty::Error @@ -209,8 +209,6 @@ end }, :timeout => 10 ) - puts "hhhhhhhhh" - puts response.to_json rescue Net::OpenTimeout response = { status: false } diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 03e0931e..5c725aca 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -50,7 +50,7 @@ class Origami::PaymentsController < BaseOrigamiController unique_code = "ReceiptBillPdf" customer= Customer.find(saleObj.customer_id) - rebate_amount = Customer.get_membership_transactions(customer) + rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) #shop detail shop_details = Shop.find(1) # get member information @@ -133,7 +133,7 @@ class Origami::PaymentsController < BaseOrigamiController shop_details = Shop.find(1) # get member information member_info = Customer.get_member_account(customer) - rebate_amount = Customer.get_membership_transactions(customer) + rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index c25e0e1f..e5728f99 100644 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -6,6 +6,7 @@ class Origami::RoomsController < BaseOrigamiController @complete = Sale.all @orders = Order.all.order('date desc') @room = DiningFacility.find(params[:room_id]) + @sale_array = Array.new @room.bookings.each do |booking| if booking.sale_id.nil? @order_items = Array.new @@ -23,12 +24,16 @@ class Origami::RoomsController < BaseOrigamiController sale = Sale.find(booking.sale_id) if sale.sale_status != "completed" + @sale_array.push(sale) @status = 'sale' @obj = sale @customer = sale.customer end end end + puts "hhhhhhhhhh" + puts @status + puts @obj.to_json end diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index 19803c0d..eb058cac 100644 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -51,6 +51,7 @@ class Transactions::SalesController < ApplicationController end @sale_receivables = SalePayment.where('sale_id = ?', @sale.id) + @sale_audits = SaleAudit.where('sale_id = ?', @sale.id) #get customer amount @customer = Customer.find(@sale.customer_id) diff --git a/app/models/customer.rb b/app/models/customer.rb index 60cf8b14..f5a37164 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -46,7 +46,7 @@ class Customer < ApplicationRecord end - def self.get_membership_transactions(customer) + def self.get_membership_transactions(customer,receipt_no = nil) membership = MembershipSetting.find_by_membership_type("paypar_url") memberaction = MembershipAction.find_by_membership_type("get_member_transactions") merchant_uid = memberaction.merchant_account_id.to_s @@ -55,13 +55,17 @@ class Customer < ApplicationRecord # urltest =self.url_exist?(url) begin - response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - }, - :timeout => 10 - ) + response = HTTParty.get(url, + :body => { membership_id: customer.membership_id, + receipt_no:receipt_no, + 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 , message: "Server Time out"} diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index fb1e58d8..3fd5118b 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -337,7 +337,7 @@ class SalePayment < ApplicationRecord :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' - }, :timeout => 100) + }, :timeout => 10) rescue Net::OpenTimeout response = { status: false , message: "Server Time out"} diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 52cdf586..9807b2d5 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -269,20 +269,19 @@ class ReceiptBillPdf < Prawn::Document if rebate_amount["status"] == true stroke_horizontal_rule - rebate = 0 + balance = 0 redeem = 0 rebate_amount["data"].each do |res| - + #total redeem amount if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem" redeem = redeem + res["redeem"] - + balance = balance + res["balance"] end - - - + #end Total redem + #total Rebate Earn if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate" - rebate = rebate + res["rebate"] + # balance = balance + res["balance"] move_down 5 y_position = cursor @@ -294,11 +293,9 @@ class ReceiptBillPdf < Prawn::Document end end - + # Total Rebate Amount if birthday if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate" - - rebate = rebate + res["rebate"] - + # balance = balance + res["balance"] move_down 5 y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do @@ -307,21 +304,33 @@ class ReceiptBillPdf < Prawn::Document bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{number_with_precision(res["balance"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right end - end + #end Total rebate if birthday end move_down 5 - y_position = cursor - bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do - text "Redeem Amount", :size => self.item_font_size,:align => :left - end - bounding_box([self.item_description_width,y_position], :width =>self.label_width) do - text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right - end + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Redeem Amount", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right + end + + # old = balance + redeem + + # move_down 5 + # y_position = cursor + # bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + # text "Old Balance", :size => self.item_font_size,:align => :left + # end + # bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + # text "#{number_with_precision(old, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right + # end end end + if member_info["status"] == true && member_info["data"].present? balance = 0 member_info["data"].each do |res| diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index d52c0456..66a16b2b 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -1,4 +1,4 @@ -
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 72e402e8..a1d359e8 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -10,7 +10,7 @@
-
+
@@ -71,7 +71,7 @@ -
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index faa48c05..5eb4afe6 100644 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -17,7 +17,7 @@

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

-
+
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 99fa713e..6bdadd85 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -19,9 +19,9 @@ -
+
-
+
<% @complete.each do |sale| %>
@@ -35,7 +35,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %> @@ -67,7 +67,7 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> @@ -88,7 +88,7 @@
-
+
<% @orders.each do |order| %>
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index baad1a0a..fd211ccc 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -6,7 +6,7 @@ -
+
-
+
<% @complete.each do |sale| %>
@@ -38,7 +38,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %> @@ -71,7 +71,7 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> @@ -98,7 +98,7 @@
-
+
<% @orders.each do |order| %> @@ -150,7 +150,7 @@ <%end%>
-
+
diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index 109bc418..a8620d6e 100644 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -21,7 +21,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %>
@@ -42,7 +42,7 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %>
@@ -95,7 +95,7 @@
-
+
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index c8254d42..d64b71f0 100644 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -21,7 +21,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %>
@@ -42,7 +42,7 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %>
@@ -95,7 +95,7 @@
-
+
diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index e0448009..40388847 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -19,9 +19,9 @@ -
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %> @@ -60,7 +60,7 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> @@ -86,7 +86,7 @@
-
+
<% @orders.each do |order| %>
@@ -140,7 +140,7 @@
-
+
diff --git a/app/views/origami/other_charges/index.html.erb b/app/views/origami/other_charges/index.html.erb index 129aa0e0..20bb5a4b 100644 --- a/app/views/origami/other_charges/index.html.erb +++ b/app/views/origami/other_charges/index.html.erb @@ -17,7 +17,7 @@

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

-
+
diff --git a/app/views/origami/room_invoices/show.html.erb b/app/views/origami/room_invoices/show.html.erb index 4b507526..b44340d4 100644 --- a/app/views/origami/room_invoices/show.html.erb +++ b/app/views/origami/room_invoices/show.html.erb @@ -41,7 +41,7 @@ -
+
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 1329bc8d..9b681fe1 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -19,9 +19,9 @@ -
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %> @@ -65,20 +65,27 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> -
-
- <%= room.name %> - <% if room.get_booking.nil? %> - billed - <% else %> - new - <% end %> -
-
+ + <% if room.get_booking.nil? %> +
+
+ <%= room.name %> + billed +
+
+
+ <% else %> +
+
+ <%= room.name %> + new +
+
+ <% end %> <% else %>
@@ -91,7 +98,7 @@
-
+
<% @orders.each do |order| %>
@@ -114,7 +121,7 @@
<% if @status == 'order' %>
ORDER DETAILS | Table <%= @room.name rescue "" %>
- <% elsif @status_sale == 'sale' %> + <% elsif @status == 'sale' %>
INVOICE DETAILS | Table <%= @room.name rescue "" %>
<% end %> @@ -141,7 +148,7 @@
-
+
@@ -218,7 +225,7 @@
<% - if @status_sale == 'sale' + if @status == 'sale' unless @order_items.nil? %> Pending New Order @@ -272,10 +279,10 @@
- <% if @dining.bookings.length >= 1 %> + <% if @room.bookings.length >= 1 %> - <% if @status_order == 'order' && @status_sale != 'sale' %> + <% if @status == 'order' && @status != 'sale' %> @@ -332,7 +339,7 @@ $(document).ready(function(){ // }) $('.invoicedetails').on('click',function(){ - var dining_id = "<%= @dining.id %>"; + var dining_id = "<%= @room.id %>"; var sale_id = this.id; window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id; }) @@ -431,7 +438,7 @@ $("#first_bill").on('click', function(){ $('#pay').on('click',function() { var sale_id = $('#sale_id').val(); var url = '/origami/sale/'+ sale_id + "/rounding_adj" ; - alert(url) + $.ajax({ type: "POST", url: '/origami/sale/'+ sale_id + "/rounding_adj", @@ -466,8 +473,8 @@ $('#back').on('click',function(){ }) $('#add_invoice').on('click',function(){ - var dining_id = "<%= @dining.id %>" - var sale_id = "<%= @obj_sale.sale_id rescue "" %>" + var dining_id = "<%= @room.id %>" + var sale_id = "<%= @obj.sale_id rescue "" %>" var ajax_url = "/origami/sale/append_order"; $.ajax({ type: "POST", @@ -549,8 +556,8 @@ $('#add_invoice').on('click',function(){ } $('#edit').on('click',function(){ - var dining_id = "<%= @dining.id %>" - var sale_id = "<%= @obj_sale.sale_id rescue "" %>" + var dining_id = "<%= @room.id %>" + var sale_id = "<%= @obj.sale_id rescue "" %>" window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; }); diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb index 13812e59..d604e654 100644 --- a/app/views/origami/sale_edit/edit.html.erb +++ b/app/views/origami/sale_edit/edit.html.erb @@ -22,7 +22,7 @@
-
+
diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index 86a82053..ad8a73aa 100644 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -19,9 +19,9 @@ -
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %> <% if table.status == 'occupied' %> @@ -60,7 +60,7 @@
-
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> @@ -86,7 +86,7 @@
-
+
<% @orders.each do |order| %>
@@ -126,7 +126,7 @@
-
+
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index de43e654..c49ddfbc 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -41,7 +41,7 @@ -
+
diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb index 4dd15755..cbd07c41 100644 --- a/app/views/transactions/sales/show.html.erb +++ b/app/views/transactions/sales/show.html.erb @@ -39,9 +39,9 @@ - + @@ -205,15 +205,16 @@ + - + - + @@ -226,7 +227,7 @@ - + @@ -244,15 +245,24 @@
<%= @customer.address%> <%= @customer.date_of_birth %>
Membership TransactionsMembership Transactions
Date Redeem Rebate BalanceFrom Account Status Receipt No
<%= transaction["redeem"]%> <%= transaction["rebate"] %> <%= transaction["balance"] %><%= transaction["account_status"] %> <%= transaction["status"] %> <%= transaction["receipt_no"] %>
- + - + - + + <% @sale_audits.each do |audit| %> + + + + + + + + <% end %>
StatusAction Action AtApproved ByApproved At Remark
<%= audit.action%><%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%><%= audit.approved_by.to_datetime.strftime("%m-%d-%Y %H:%M %p")%><%= audit.remark%>
diff --git a/config/puma.rb b/config/puma.rb index 1f3e9159..c8e0145e 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -44,4 +44,5 @@ environment ENV.fetch("RAILS_ENV") { "development" } # end # Allow puma to be restarted by `rails restart` command. -plugin :tmp_restart \ No newline at end of file + +plugin :tmp_restart