diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb
index 4984150a..213a6229 100644
--- a/app/controllers/crm/customers_controller.rb
+++ b/app/controllers/crm/customers_controller.rb
@@ -47,7 +47,8 @@ class Crm::CustomersController < BaseCrmController
#get customer amount
@customer = Customer.find(params[:id])
- @response = Customer.get_membership_transactions(@customer)
+ @response = Customer.get_membership_transactions(@customer)
+ # @response = ""
#end customer amount
end
diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb
index f15b8545..0859694d 100644
--- a/app/controllers/origami/customers_controller.rb
+++ b/app/controllers/origami/customers_controller.rb
@@ -54,6 +54,10 @@ class Origami::CustomersController < BaseOrigamiController
if(id == "SAL")
sale = Sale.find(params[:sale_id])
status = sale.update_attributes(customer_id: params[:customer_id])
+ sale.sale_orders.each do |sale_order|
+ order = Order.find(sale_order.order_id)
+ status = order.update_attributes(customer_id: params[:customer_id])
+ end
else
@booking = BookingOrder.find_by_order_id(params[:sale_id])
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index 5a86ddfb..4689de9d 100644
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -30,7 +30,6 @@ class ReceiptBillPdf < Prawn::Document
cashier_info(sale_data, customer_name)
line_items(sale_items)
- items_account(item_price_by_accounts)
all_total(sale_data)
@@ -39,6 +38,8 @@ class ReceiptBillPdf < Prawn::Document
end
customer(customer_name)
+
+ items_account(item_price_by_accounts)
footer
end
@@ -61,19 +62,10 @@ class ReceiptBillPdf < Prawn::Document
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
- text "#{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
+ text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
end
move_down 5
- # y_position = cursor
- # bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
- # text "Customer:", :size => self.item_font_size,:align => :left
- # end
- # bounding_box([self.label_width,y_position], :width =>self.item_width) do
- # text "#{customer_name}" , :size => self.item_font_size,:align => :left
- # end
- # move_down 5
-
y_position = cursor
bounding_box([0, y_position], :width =>self.item_width) do
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
@@ -86,27 +78,26 @@ class ReceiptBillPdf < Prawn::Document
end
move_down 5
- # bounding_box([self.label_width,y_position], :width =>self.item_width) do
- # text "#{customer_name}" , :size => self.item_font_size,:align => :left
- # end
- # move_down 5
-
y_position = cursor
- bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
- text "Time In: #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }", :size => self.item_font_size,:align => :left
- end
- bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
- text "Time Out: #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') }" , :size => self.item_font_size,:align => :right
+ bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
+ text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
end
+
+ # bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
+ # text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
+ # - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
+ # :size => self.item_font_size,:align => :right
+ # end
+
move_down 5
stroke_horizontal_rule
- move_down 5
end
def line_items(sale_items)
+ move_down 5
y_position = cursor
-
+ move_down 5
pad_top(15) {
# @item_width.to_i + @half_qty.to_i
text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
@@ -114,10 +105,8 @@ class ReceiptBillPdf < Prawn::Document
text_box "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "Total", :at =>[(self.item_width+self.price_width+4),y_position], :width => self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
}
-
- move_down 5
+ move_down -5
stroke_horizontal_rule
-
add_line_item_row(sale_items)
end
@@ -142,7 +131,7 @@ class ReceiptBillPdf < Prawn::Document
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
text_box "#{total_price}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
}
- move_down 3
+ move_down 1
end
stroke_horizontal_rule
@@ -158,20 +147,6 @@ class ReceiptBillPdf < Prawn::Document
move_down 5
end
- def items_account(item_price_by_accounts)
- y_position = cursor
- item_price_by_accounts.each do |ipa|
- y_position = cursor
- bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
- text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
- end
- bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
- text "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right
- end
- move_down 5
- end
- end
-
def all_total(sale_data)
item_name_width = self.item_width
y_position = cursor
@@ -267,7 +242,7 @@ class ReceiptBillPdf < Prawn::Document
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
- text "Rebate Amount", :size => self.item_font_size,:align => :left
+ text "Current Rebate Amount", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right
@@ -278,10 +253,10 @@ class ReceiptBillPdf < Prawn::Document
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
+ text "Current Redeem Amount", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
- text "#{ res["redeem"] }" , :size => self.item_font_size,:align => :right
+ text "(#{ res["redeem"] })" , :size => self.item_font_size,:align => :right
end
end
@@ -317,7 +292,23 @@ class ReceiptBillPdf < Prawn::Document
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
- end
+ end
+ end
+
+ def items_account(item_price_by_accounts)
+ move_down 5
+ stroke_horizontal_rule
+ move_down 5
+ y_position = cursor
+ item_price_by_accounts.each do |ipa|
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
+ text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
+ text "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right
+ end
+ end
end
def footer
@@ -331,3 +322,4 @@ class ReceiptBillPdf < Prawn::Document
end
end
+
diff --git a/app/views/crm/customers/show.html.erb b/app/views/crm/customers/show.html.erb
index c6ec25c2..5c4bf7c8 100644
--- a/app/views/crm/customers/show.html.erb
+++ b/app/views/crm/customers/show.html.erb
@@ -55,7 +55,9 @@
- <% if @response["status"] == true && $response["data"] != "[]"%>
+ <% puts "'''''''''''''''''''"
+ puts @response
+ if @response["status"] == true %>
| Membership Transactions |
<% if @response["status"] == true %>
@@ -101,28 +103,22 @@
- | Order ID |
- Menu Item |
- QTY |
- Unit Price |
- Option |
- Status |
- Waiter |
- Created at |
+ Order ID |
+ Type |
+ Order status |
+ Order date |
+ Items Count |
- <% @order_items.each do |order_item| %>
+ <% @orders.each do |order| %>
- | <%= 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") %> |
+ <%= order.order_id %> |
+ <%= order.order_type %> |
+ <%= order.status %> |
+ <%= order.date.strftime("%d-%m-%Y") %> |
+ <%= order.item_count %> |
<% end %>
@@ -137,62 +133,33 @@
- | Sale ID |
- Menu Item |
- QTY |
- Unit Price |
- Tax Price |
- Created At |
+ Sale Id |
+ Receipt no |
+ Grand total |
+ Tax amount |
+ Cashier |
+ Sales status |
+ Receipt Date |
- <% @sale_items.each do |sale_item| %>
-
- | <%= sale_item.sale_id %> |
- <%= sale_item.product_name %> |
- <%= sale_item.qty %> |
- <%= sale_item.unit_price %> |
-
- <%= sale_item.taxable_price %> |
- <%= sale_item.created_at %> |
-
- <% end %>
+ <% @sales.each do |sale| %>
+
+ | <%= sale.sale_id %> |
+ <%= sale.receipt_no %> |
+ <%= sale.grand_total rescue '-' %> |
+ <%= sale.total_tax %> |
+ <%= sale.cashier_name rescue '-' %> |
+ <%= sale.sale_status %> |
+ <%= sale.receipt_date.strftime("%d-%m-%Y") %> |
+
+ <% end %>
-
-
Sale Details
-
-
-
-
- | Sale ID |
- Menu Item |
- QTY |
- Unit Price |
- Tax Price |
- Created At |
-
-
-
-
- <% @sale_items.each do |sale_item| %>
-
- | <%= sale_item.sale_id %> |
- <%= sale_item.product_name %> |
- <%= sale_item.qty %> |
- <%= sale_item.unit_price %> |
-
- <%= sale_item.taxable_price %> |
- <%= sale_item.created_at %> |
-
- <% end %>
-
-
-
-
+
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index c528003d..3d723782 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -49,10 +49,13 @@
<% if current_login_employee %>
+ <%if current_login_employee.role !="waiter" %>
- <%= current_login_employee.name %>
+
- |
- <%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%end%>
<% end %>
diff --git a/db/seeds.rb b/db/seeds.rb
index fc3e1bde..e02ba1d5 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -131,7 +131,8 @@ menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size"
menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size",name: "Medium", value: "medium"})
menu_item_attribute_size_large = MenuItemAttribute.create({attribute_type:"size", name: "Large", value: "large"})
-
+shop = Shop.create({id:1, name: "Beauty In the Pot", address:'No.3, 23 street', township:"Yankin",state:"Yangon",city:"Yangon", country:"Myanmar", phone_no:"09 99988888, 0912374734",reservation_no:"111",license:"123",
+activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111"})
#Default Order Queue stations
# order_queue_station1 = OrderQueueStation.create({station_name: "Queue Station 1", is_active: true,printer_name: "kitchen_printer", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
# order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})