From e09dbb095c6582c8947951d30e57c117f7bf2ba1 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 27 Jun 2017 10:15:22 +0630 Subject: [PATCH 01/12] not to show price 0 and 10 --- app/models/order_queue_station.rb | 4 +- app/models/printer/order_queue_printer.rb | 71 +++++++++++++---------- app/pdf/order_item_pdf.rb | 2 +- app/pdf/order_summary_pdf.rb | 52 ++++++++--------- app/views/origami/home/show.html.erb | 4 +- app/views/origami/rooms/show.html.erb | 4 +- 6 files changed, 74 insertions(+), 63 deletions(-) diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index bd2e85ca..7a220e0f 100644 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -38,7 +38,9 @@ class OrderQueueStation < ApplicationRecord # else AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) - oqs_order_items.push(order_item) + if (order_item.price != 10 || order_item.price != 0) + oqs_order_items.push(order_item) + end # end end end diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index bbeafecf..363d9b38 100644 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -6,19 +6,23 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker #Print order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code) - filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf" - pdf = OrderItemPdf.new(order_item[0], print_status, options) - pdf.render_file filename + filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf" - if oqs.print_copy - self.print(filename, oqs.printer_name) + # check for item not to show + if order_item[0].price == 0 || order_item[0].price == 10 + pdf = OrderItemPdf.new(order_item[0], print_status, options) + pdf.render_file filename - #For print copy - pdf.render_file filename.gsub(".","-copy.") - self.print(filename.gsub(".","-copy."), oqs.printer_name) - else - self.print(filename, oqs.printer_name) - end + if oqs.print_copy + self.print(filename, oqs.printer_name) + + #For print copy + pdf.render_file filename.gsub(".","-copy.") + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end + end end # Query for per order @@ -33,14 +37,18 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker filename = "tmp/order_item_#{odi.item_name}" + ".pdf" # For Item Options options = odi.options == "[]"? "" : odi.options - pdf = OrderItemPdf.new(odi, print_status, options) - # pdf.render_file "tmp/order_item.pdf" - pdf.render_file filename - if oqs.print_copy - self.print(filename, oqs.printer_name) - self.print(filename.gsub(".","-copy."), oqs.printer_name) - else - self.print(filename, oqs.printer_name) + + # check for item not to show + if odi.price == 0 || odi.price == 10 + pdf = OrderItemPdf.new(odi, print_status, options) + # pdf.render_file "tmp/order_item.pdf" + pdf.render_file filename + if oqs.print_copy + self.print(filename, oqs.printer_name) + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end end end # For Print Order Summary @@ -69,19 +77,22 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker filename = "tmp/order_item_#{odi.item_name}" + ".pdf" # For Item Options options = odi.options == "[]"? "" : odi.options - pdf = OrderItemPdf.new(odi, print_status, options) - - pdf.render_file filename - if oqs.print_copy - self.print(filename, oqs.printer_name) + # check for item not to show + if odi.price == 0 || odi.price == 10 + pdf = OrderItemPdf.new(odi, print_status, options) + pdf.render_file filename - #For print copy - pdf.render_file filename.gsub(".","-copy.") - self.print(filename.gsub(".","-copy."), oqs.printer_name) - else - self.print(filename, oqs.printer_name) - end + if oqs.print_copy + self.print(filename, oqs.printer_name) + + #For print copy + pdf.render_file filename.gsub(".","-copy.") + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end + end end # For Print Order Summary else diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 6d6346f9..b6c821fc 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -60,7 +60,7 @@ class OrderItemPdf < Prawn::Document def order_items(order_item, options) y_position = cursor - #Add Order Item + #Add Order Item add_order_items(order_item, options) dash(1, :space => 1, :phase => 1) diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index d85a5916..504bbc51 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -86,38 +86,36 @@ class OrderSummaryPdf < Prawn::Document move_down 5 order_item.each do|odi| - y_position = cursor - - # pad_top(15) { - # text_box "#{odi.item_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix - # text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix - # } - bounding_box([0,y_position], :width => self.item_width) do - text "#{odi.item_name}", :size => self.item_font_size,:align => :left - end - - bounding_box([self.item_width,y_position], :width => self.qty_width) do - text "#{odi.qty}", :size => self.item_font_size,:align => :left - end - - move_down 5 - - # add option - options = odi.options == "[]"? "" : odi.options - - if options != "" + # check for item not to show + if odi.price == 0 || odi.price == 10 y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "#{options}", :size => self.item_font_size,:align => :left + + bounding_box([0,y_position], :width => self.item_width) do + text "#{odi.item_name}", :size => self.item_font_size,:align => :left + end + + bounding_box([self.item_width,y_position], :width => self.qty_width) do + text "#{odi.qty}", :size => self.item_font_size,:align => :left end move_down 5 + + # add option + options = odi.options == "[]"? "" : odi.options + + if options != "" + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "#{options}", :size => self.item_font_size,:align => :left + end + + move_down 5 + end + + dash(1, :space => 1, :phase => 1) + stroke_horizontal_line 0, (self.page_width - self.margin) + move_down 5 end - - dash(1, :space => 1, :phase => 1) - stroke_horizontal_line 0, (self.page_width - self.margin) - move_down 5 end - end end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2e852b7c..efbb3e10 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -163,7 +163,7 @@ <% # Can't check for discount - unless sale_item.price == 0 + unless sale_item.price == 0 || sale_item.price == 10 %> <%= count %> @@ -183,7 +183,7 @@ count += 1 sub_total = sub_total + (order_item.price * order_item.qty) - unless order_item.price == 0 %> + unless order_item.price == 0 || order_item.price == 10 %> <%= count %> <%= order_item.item_name %> diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 584410d6..0ddaff7a 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -158,7 +158,7 @@ sub_total = sub_total + sale_item.price %> - <% unless sale_item.price == 0 %> + <% unless sale_item.price == 0 || sale_item.price == 10 %> <%= sale_item.product_name %> <%= sale_item.qty %> @@ -174,7 +174,7 @@ @order_items.each do |order_item | sub_total = sub_total + (order_item.price * order_item.qty) - unless order_item.price == 0 %> + unless order_item.price == 0 || order_item.price == 10 %> <%= order_item.item_name %> <%= order_item.qty %> From 535a5825fb8d9fb9f974847ec0a2aac1aa466d53 Mon Sep 17 00:00:00 2001 From: Nweni Date: Tue, 27 Jun 2017 10:28:47 +0630 Subject: [PATCH 02/12] get update --- app/controllers/origami/orders_controller.rb | 6 ++++-- app/views/origami/orders/show.html.erb | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb index cc5fac3f..ef213ddd 100644 --- a/app/controllers/origami/orders_controller.rb +++ b/app/controllers/origami/orders_controller.rb @@ -8,8 +8,10 @@ class Origami::OrdersController < BaseOrigamiController @order = Order.find(params[:order_id]) sale_order = SaleOrder.find_by_order_id(@order.order_id) if sale_order - sale = Sale.find(sale_order.sale_id) - @sale_status = sale.sale_status + unless sale_order.sale_id.nil? + sale = Sale.find(sale_order.sale_id) + @sale_status = sale.sale_status + end end end end diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index d2c065a1..5ecb56d1 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -95,10 +95,12 @@ order_status = "" sale_order = SaleOrder.find_by_order_id(order) if sale_order - sale = Sale.find(sale_order.sale_id) - order_status = sale.sale_status - if order_status == 'new' - order_status = order.status + unless sale_order.sale_id.nil? + sale = Sale.find(sale_order.sale_id) + order_status = sale.sale_status + if order_status == 'new' + order_status = order.status + end end else order_status = order.status From 37da55610f584c21921ad886c0c52803c66fec2a Mon Sep 17 00:00:00 2001 From: Phyo Date: Tue, 27 Jun 2017 11:32:10 +0630 Subject: [PATCH 03/12] Shop View --- app/views/home/dashboard.html.erb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index f77959cd..c695ff14 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -1,7 +1,7 @@
- <%= current_login_employee.name %> +
Welcome <%= current_login_employee.name %> !

<% if current_login_employee.role = "admin" %> <% elsif current_login_employee.role = "cashier" %> <%= link_to "Cashier Station", origami_path %> @@ -13,7 +13,23 @@ <%= link_to "Cashier Station", oishi_path %> <% end %> + <% shop = Shop.first %> + + + +
+ +
+ <%= shop.address %> +
+
+ <%= shop.phone_no %> +
+ +
From 2f8c6e25a142c304eec9509a85b21bb965072877 Mon Sep 17 00:00:00 2001 From: Phyo Date: Tue, 27 Jun 2017 11:33:03 +0630 Subject: [PATCH 04/12] Shop View --- app/views/home/dashboard.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index c695ff14..6b49c880 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -1,7 +1,7 @@
-
Welcome <%= current_login_employee.name %> !

+ <% if current_login_employee.role = "admin" %> <% elsif current_login_employee.role = "cashier" %> <%= link_to "Cashier Station", origami_path %> From b5518c2ddb782cb162c7c3424f3f401970c529ef Mon Sep 17 00:00:00 2001 From: Phyo Date: Tue, 27 Jun 2017 11:35:10 +0630 Subject: [PATCH 05/12] rake task fix --- lib/tasks/menu_import.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/menu_import.rake b/lib/tasks/menu_import.rake index 8ec56ea6..fffe37b3 100644 --- a/lib/tasks/menu_import.rake +++ b/lib/tasks/menu_import.rake @@ -30,7 +30,7 @@ menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base" menu_item0_instance = MenuItemInstance.create([{item_instance_name:"VIP Room Individual Pot",item_instance_code:"II0031", menu_item: menu_category1_menu_item2, price:10.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0053", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0063", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0073", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0073", menu_item: menu_category1_menu_item2, price:8000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0083", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0093", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0103", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) @@ -39,8 +39,8 @@ menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base" menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Quart Pot",item_instance_code:"II0041", menu_item: menu_category1_menu_item3, price:10.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0054", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0064", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0074", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0084", menu_item: menu_category1_menu_item3, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0074", menu_item: menu_category1_menu_item3, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0084", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0094", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0104", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) @@ -48,7 +48,7 @@ menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base" # Assorted Platter menu_category2 = MenuCategory.create({menu: menu, code:"C002", name: "Specialty Assorted Platter", alt_name: "Assorted Platter", order_by: 2, created_by: "SYSTEM DEFAULT"}) # Pork Platter - menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"01004", name: "Pork Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"01048", name: "Pork Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Pork Platter",item_instance_code:"II0111", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false}]) # Beef Platter menu_category1_menu_item4 = SimpleMenuItem.create({item_code:"01005", name: "Beef Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) From bcd44db9a2cdd97f44ee9adbc5d81505ce061037 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Tue, 27 Jun 2017 11:35:36 +0630 Subject: [PATCH 06/12] multiple invoice void --- .idea/workspace.xml | 615 ++++++++++++++---- .../origami/table_invoices_controller.rb | 2 +- app/controllers/origami/void_controller.rb | 8 + app/views/origami/home/index.html.erb | 1 + app/views/origami/home/show.html.erb | 33 +- app/views/origami/orders/show.html.erb | 2 +- app/views/origami/payments/show.html.erb | 22 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/origami/sales/show.html.erb | 6 +- .../origami/table_invoices/show.html.erb | 19 +- dump.rdb | Bin 18261 -> 17895 bytes 11 files changed, 568 insertions(+), 142 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4d3242d5..b5dfb1c3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,16 +2,17 @@ - - - - - - - - - + + + + + + + + + + @@ -27,21 +28,73 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50,33 +103,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -85,8 +113,18 @@ - - + + + + + + + + + + + + @@ -97,6 +135,8 @@ origami + table_invoice + sale_id @@ -105,11 +145,17 @@ @@ -168,6 +214,264 @@ - @@ -672,38 +998,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -712,22 +1006,6 @@ - - - - - - - - - - - - - - - - @@ -760,16 +1038,27 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -781,34 +1070,124 @@ - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 32e0ef7f..4571ba87 100644 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -25,7 +25,7 @@ class Origami::TableInvoicesController < BaseOrigamiController else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" + if sale.sale_status != "completed" && sale.sale_status != 'void' @sale_array.push(sale) end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index bea37a21..3515b010 100644 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -9,6 +9,14 @@ class Origami::VoidController < BaseOrigamiController sale.sale_status = 'void' sale.save + bookings = sale.bookings + bookings.each do |booking| + orders = booking.orders + orders.each do |order| + # order.status = 'void' + end + end + table_avaliable = true table = sale.bookings[0].dining_facility table.bookings.each do |booking| diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 5888bb3e..cd451e68 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2e852b7c..84f606f8 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> @@ -287,7 +288,7 @@ - + <% else %> @@ -474,23 +475,23 @@ $('#edit').on('click',function(){ window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; }) - $('#void').on('click',function () { - var sure = confirm("Are you sure want to Void"); - if (sure == true) { - var sale_id = $('#sale_id').val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; - $.ajax({ - type: 'POST', - url: ajax_url, - success: function () { - window.location.href = '/origami/'; - } - }) - } else { +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').val(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { - } + } - }) +}) diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index d2c065a1..b386a86d 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index cef27145..4d9089b5 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -11,7 +11,7 @@ Table No <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %> - Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> + Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> Customer : <%= @sale_data.customer.name%> @@ -244,7 +244,7 @@ - +
@@ -354,6 +354,23 @@ $( document ).ready(function() { } }); +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').text(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { + + } +}); + }); function update_balance(){ @@ -369,4 +386,5 @@ function update_balance(){ var result = amount_due - total; $('#balance').text(result.toFixed(2)); } + diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 584410d6..77b35a40 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index cd716052..8e660261 100644 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> @@ -185,7 +185,9 @@
- + <% if @sale.sale_status != 'void' %> + + <% end %>
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index ee66f9a3..ade1f021 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -128,6 +128,7 @@
+
diff --git a/dump.rdb b/dump.rdb index acef6aa79d6c19cf0bb0d215a80225ad58500e81..989b20db9eb66d7ef6d034695caac9e1fa5f72fb 100644 GIT binary patch delta 1616 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 U7WB;Ep@yq_Ui&27bM}k>0awo~Z~y=R From e38886790c56a4e5713c5677117564c5ad5c1ab8 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 27 Jun 2017 11:52:51 +0630 Subject: [PATCH 07/12] not show price 0 fixed --- app/controllers/oqs/home_controller.rb | 2 +- app/models/order.rb | 9 +++++++ app/models/order_queue_station.rb | 6 ++--- app/models/printer/order_queue_printer.rb | 12 ++++----- app/pdf/order_summary_pdf.rb | 6 +++-- app/pdf/receipt_bill_pdf.rb | 29 ++++++++++++---------- app/views/oqs/home/index.html.erb | 14 +++++++---- app/views/origami/discounts/index.html.erb | 12 ++++++--- app/views/origami/home/show.html.erb | 4 +-- app/views/origami/rooms/show.html.erb | 4 +-- 10 files changed, 61 insertions(+), 37 deletions(-) diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 692b9c4a..0d4d07dc 100644 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -117,7 +117,7 @@ class Oqs::HomeController < BaseOqsController left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.delivery_status = #{status}") + .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0") .group("assigned_order_items.assigned_order_item_id") end end diff --git a/app/models/order.rb b/app/models/order.rb index 018013e4..b3a70f37 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -82,6 +82,15 @@ class Order < ApplicationRecord set_order_items end + # not insert with price 0 + # puts item[:price] + # puts item + # if(item[:price] != 0 ) + # OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id], + # item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, + # self.employee_name) + # end + OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id], item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, self.employee_name) diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 7a220e0f..7e3352d1 100644 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -36,9 +36,9 @@ class OrderQueueStation < ApplicationRecord # #Same Order_items can appear in two location. # AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) # else - - AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) - if (order_item.price != 10 || order_item.price != 0) + + if (order_item.price != 0) + AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) oqs_order_items.push(order_item) end # end diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 363d9b38..f80ee72d 100644 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -9,7 +9,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf" # check for item not to show - if order_item[0].price == 0 || order_item[0].price == 10 + if order_item[0].price != 0 pdf = OrderItemPdf.new(order_item[0], print_status, options) pdf.render_file filename @@ -39,7 +39,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker options = odi.options == "[]"? "" : odi.options # check for item not to show - if odi.price == 0 || odi.price == 10 + if odi.price != 0 || odi.price != 10 pdf = OrderItemPdf.new(odi, print_status, options) # pdf.render_file "tmp/order_item.pdf" pdf.render_file filename @@ -79,7 +79,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker options = odi.options == "[]"? "" : odi.options # check for item not to show - if odi.price == 0 || odi.price == 10 + if odi.price != 0 pdf = OrderItemPdf.new(odi, print_status, options) pdf.render_file filename @@ -120,7 +120,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join bookings AS b ON b.booking_id = bo.booking_id left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id") - .where("order_items.item_code = '#{ id }'") + .where("order_items.item_code = '#{ id }' AND order_items.price != 0") .group("order_items.item_code") elsif type == "order_summary" OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining") @@ -129,7 +129,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join bookings AS b ON b.booking_id = bo.booking_id left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id") - .where("orders.order_id = '#{ id }'") + .where("orders.order_id = '#{ id }' AND order_items.price != 0") .group("order_items.order_items_id") else # order summary for booking @@ -139,7 +139,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join bookings AS b ON b.booking_id = bo.booking_id left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id") - .where("b.booking_id = '#{ id }'") + .where("b.booking_id = '#{ id }' AND order_items.price != 0") end end diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 504bbc51..89eac43c 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -87,7 +87,7 @@ class OrderSummaryPdf < Prawn::Document order_item.each do|odi| # check for item not to show - if odi.price == 0 || odi.price == 10 + if odi.price != 0 y_position = cursor bounding_box([0,y_position], :width => self.item_width) do @@ -105,13 +105,15 @@ class OrderSummaryPdf < Prawn::Document if options != "" y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + bounding_box([0,y_position], :width => self.item_width) do text "#{options}", :size => self.item_font_size,:align => :left end move_down 5 end + move_down 5 + dash(1, :space => 1, :phase => 1) stroke_horizontal_line 0, (self.page_width - self.margin) move_down 5 diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index b156e2c2..27c08b80 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -119,22 +119,25 @@ class ReceiptBillPdf < Prawn::Document move_down 5 sub_total = 0.0 sale_items.each do |item| - sub_total += (item.qty*item.unit_price) - qty = item.qty - total_price = item.qty*item.unit_price - price = item.unit_price - product_name = item.product_name + # check for item not to show + if item.price != 0 + sub_total += (item.qty*item.unit_price) + qty = item.qty + total_price = item.qty*item.unit_price + price = item.unit_price + product_name = item.product_name - y_position = cursor + y_position = cursor - pad_top(15) { - text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix - text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - 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 1 + pad_top(15) { + text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix + text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix + 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 1 + end end stroke_horizontal_rule diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb index ed704dcb..0f387dad 100644 --- a/app/views/oqs/home/index.html.erb +++ b/app/views/oqs/home/index.html.erb @@ -34,7 +34,8 @@
<% - @queue_completed_item.each do |qid| + @queue_completed_item.each do |qid| + if qid.price != 0 %>
@@ -69,7 +70,8 @@
- <% + <% + end end %>
@@ -85,8 +87,9 @@
<% - @queue_items_details.each do |qid| - if qid.station_name == qsi[:station_name] + @queue_items_details.each do |qid| + if qid.price != 0 + if qid.station_name == qsi[:station_name] %>
@@ -121,7 +124,8 @@
- <% + <% + end end end %> diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index e3cca128..9979c32f 100644 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -29,7 +29,10 @@ <% sub_total = 0 %> <% @sale_data.sale_items.each do |sale_item| %> - <% sub_total += sale_item.qty*sale_item.unit_price%> + <% + sub_total += sale_item.qty*sale_item.unit_price + unless sale_item.price == 0 + %> > @@ -42,7 +45,10 @@ <%=(sale_item.qty*sale_item.unit_price)%> - <%end %> + <% + end + end + %>
@@ -166,7 +172,7 @@
- +
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index efbb3e10..2e852b7c 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -163,7 +163,7 @@ <% # Can't check for discount - unless sale_item.price == 0 || sale_item.price == 10 + unless sale_item.price == 0 %> <%= count %> @@ -183,7 +183,7 @@ count += 1 sub_total = sub_total + (order_item.price * order_item.qty) - unless order_item.price == 0 || order_item.price == 10 %> + unless order_item.price == 0 %> <%= count %> <%= order_item.item_name %> diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 0ddaff7a..584410d6 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -158,7 +158,7 @@ sub_total = sub_total + sale_item.price %> - <% unless sale_item.price == 0 || sale_item.price == 10 %> + <% unless sale_item.price == 0 %> <%= sale_item.product_name %> <%= sale_item.qty %> @@ -174,7 +174,7 @@ @order_items.each do |order_item | sub_total = sub_total + (order_item.price * order_item.qty) - unless order_item.price == 0 || order_item.price == 10 %> + unless order_item.price == 0 %> <%= order_item.item_name %> <%= order_item.qty %> From 9f44ac0031beaababc81d3af2ab6c331bb0b0d45 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 27 Jun 2017 12:03:17 +0630 Subject: [PATCH 08/12] update page height bill pdf --- app/pdf/receipt_bill_pdf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 27c08b80..4ae0a67d 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -2,7 +2,7 @@ class ReceiptBillPdf < Prawn::Document attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details) self.page_width = 210 - self.page_height = 2500 + self.page_height = 7000 self.margin = 5 self.price_width = 40 self.qty_width = 20 From f8062cec643247f0f749218fa53bf0b47eba9220 Mon Sep 17 00:00:00 2001 From: Phyo Date: Tue, 27 Jun 2017 12:05:45 +0630 Subject: [PATCH 09/12] Credit payment --- app/models/sale_payment.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index e4ad5364..8b28c946 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -97,7 +97,7 @@ class SalePayment < ApplicationRecord sale_data.sale_payments.each do |sale_payment| others = others + sale_payment.payment_amount end - redeem_prices = sale_data.grand_total -others + redeem_prices = sale_data.grand_total - others # Control for Paypar Cloud begin response = HTTParty.post(url, @@ -232,11 +232,19 @@ class SalePayment < ApplicationRecord self.sale.amount_changed = self.sale.amount_received.to_f - self.sale.grand_total.to_f all_received_amount = 0.0 sObj = Sale.find(self.sale_id) + is_credit = 0 sObj.sale_payments.each do |spay| all_received_amount += spay.payment_amount.to_f + if spay.payment_method == "creditnote" + is_credit = 1 + end end if (self.sale.grand_total <= all_received_amount) - self.sale.payment_status = "paid" + if is_credit == 0 + self.sale.payment_status = "paid" + else + self.sale.payment_status = "outstanding" + end self.sale.sale_status = "completed" self.sale.save! table_update_status(sObj) From 7810fc693b94a2a05a6e486e40b9eded5a231ca5 Mon Sep 17 00:00:00 2001 From: Phyo Date: Tue, 27 Jun 2017 12:06:18 +0630 Subject: [PATCH 10/12] Pending Payment --- app/views/origami/home/show.html.erb | 6 ++- app/views/origami/rooms/show.html.erb | 68 +++++++++++++++++---------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2e852b7c..be13b58c 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -138,7 +138,7 @@ <%if @customer %>

Customer : <%= @customer.name rescue "" %>

- <%end%> + <%end%>
@@ -249,8 +249,10 @@ <% end %> + <% if @sale_array.size > 1 %>

Pending Payment + <% end %> <% @sale_array.each do |sale| if @sale_array.size > 1 unless sale.receipt_no == @sale_array[0].receipt_no @@ -473,7 +475,7 @@ $('#edit').on('click',function(){ var sale_id = "<%= @obj_sale.sale_id rescue "" %>" window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; }) - + $('#void').on('click',function () { var sure = confirm("Are you sure want to Void"); if (sure == true) { diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 584410d6..a3f52cec 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -155,7 +155,7 @@ sub_total = 0 if @status == "sale" @obj.sale_items.each do |sale_item| - sub_total = sub_total + sale_item.price + sub_total = sub_total + sale_item.price %> <% unless sale_item.price == 0 %> @@ -213,32 +213,52 @@

+ <% + if @status_sale == 'sale' + unless @order_items.nil? + %> + Pending New Order + + <% + count = 0 + @order_items.each do |order_item | + count += 1 + %> - <% - if @status == 'sale' - unless @order_items.nil? - %> - Added New Order -
- <% - @order_items.each do |order_item | + + + + + + + <% + end %> +
<%= count %> + <%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
+ + <% end %> + <% if @sale_array.size > 1 %> +

+ Pending Payment + <% end %> + <% @sale_array.each do |sale| + if @sale_array.size > 1 + unless sale.receipt_no == @sale_array[0].receipt_no + %> - - <%= order_item.item_name %> - <%= order_item.qty %> - <%= order_item.qty*order_item.price %> - - - <% - end - %> - - - <% - end - end - %> + + + + + +
Receipt No - <%= sale.receipt_no %>
+ <% + end + end + end + end + %> From 697bacf200fa09012a6aff0bc6fff18942d276f6 Mon Sep 17 00:00:00 2001 From: Phyo Date: Tue, 27 Jun 2017 12:06:39 +0630 Subject: [PATCH 11/12] rake task --- lib/tasks/menu_import.rake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/tasks/menu_import.rake b/lib/tasks/menu_import.rake index fffe37b3..1979d364 100644 --- a/lib/tasks/menu_import.rake +++ b/lib/tasks/menu_import.rake @@ -462,7 +462,7 @@ menu_category13 = MenuCategory.create({menu: menu, code:"C0012", name: "Vegetabl menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1122", menu_item: menu_category1_menu_item105, price:1200.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1121", menu_item: menu_category1_menu_item105, price:2400.00, is_on_promotion:false}]) # Bamboo Shoot - menu_category1_menu_item105 = SimpleMenuItem.create({item_code:"01106", name: "Kangkung", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_category1_menu_item105 = SimpleMenuItem.create({item_code:"01112", name: "Bamboo Shoot", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1132", menu_item: menu_category1_menu_item105, price:1200.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1131", menu_item: menu_category1_menu_item105, price:2400.00, is_on_promotion:false}]) # Others @@ -566,17 +566,17 @@ menu_category19 = MenuCategory.create({menu: menu, code:"C0018", name: "Beer", a menu_category1_menu_item132 = SimpleMenuItem.create({item_code:"01133", name: "Myanmar Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1392", menu_item: menu_category1_menu_item132, price:1500.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1391", menu_item: menu_category1_menu_item132, price:3000.00, is_on_promotion:false}]) -# Tiger Beer - menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01134", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) +# # Tiger Beer +# menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01134", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) +# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) +# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) # Heineken Beer menu_category1_menu_item134 = SimpleMenuItem.create({item_code:"01135", name: "Heineken Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1412", menu_item: menu_category1_menu_item134, price:1800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1411", menu_item: menu_category1_menu_item134, price:3600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item134, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item134, price:3600.00, is_on_promotion:false}]) # Tsing Tao Beer menu_category1_menu_item135 = SimpleMenuItem.create({item_code:"01136", name: "Tsing Tao Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1421", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II141", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) # ABC Stout menu_category1_menu_item136 = SimpleMenuItem.create({item_code:"01137", name: "ABC Stout ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1432", menu_item: menu_category1_menu_item136, price:2000.00, is_on_promotion:false}]) From df722de0e78decb5eb1e12563a946caf616a8a99 Mon Sep 17 00:00:00 2001 From: Nweni Date: Tue, 27 Jun 2017 14:02:44 +0630 Subject: [PATCH 12/12] billed --- app/controllers/api/bill_controller.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index f7a4070d..4fdd0c35 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -19,7 +19,7 @@ class Api::BillController < Api::ApiController @sale_id = booking.sale_id end end - + elsif (params[:order_id]) @sale = Sale.new @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee) @@ -29,12 +29,7 @@ class Api::BillController < Api::ApiController @sale_items = SaleItem.where("sale_id=?",@sale_id) unique_code = "ReceiptBillPdf" - #shop detail - shop_details = Shop.find(1) - - customer= Customer.where('customer_id=' + @sale_data.customer_id) - # get member information - member_info = Customer.get_member_account(customer) + customer= Customer.find(@sale_data.customer_id) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) @@ -43,7 +38,7 @@ class Api::BillController < Api::ApiController item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details) + printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts) end