diff --git a/Gemfile b/Gemfile index fe865876..94c7f779 100644 --- a/Gemfile +++ b/Gemfile @@ -9,8 +9,7 @@ end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.0' # Use mysql as the database for Active Record - -#gem 'mysql2', '>= 0.3.18', '< 0.5' +gem 'mysql2', '>= 0.3.18', '< 0.5' #Use PosgreSQL #gem 'pg' diff --git a/app/assets/javascripts/orgiami.js b/app/assets/javascripts/orgiami.js index cd8622c3..fd7d8e88 100644 --- a/app/assets/javascripts/orgiami.js +++ b/app/assets/javascripts/orgiami.js @@ -90,6 +90,13 @@ $(document).ready(function(){ return false; }); + // Discount for Payment + $('#discount').click(function() { + var order_id=$(".selected-item").find(".orders-id").text(); + window.location.href = '/origami/discount/'+ order_id + return false; + }); + // Payment for Bill $('#pay').click(function() { var sale_id=$(".selected-item").find(".orders-id").text(); diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 09ab1103..717f4e09 100644 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -1,6 +1,15 @@ class Origami::DiscountsController < BaseOrigamiController + + #discount page show from origami index with selected order def index + sale_id = params[:id] + if Sale.exists?(sale_id) + @sale_data = Sale.find(sale_id) + end end + def create + end + end diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb new file mode 100644 index 00000000..4615a6aa --- /dev/null +++ b/app/views/origami/discounts/index.html.erb @@ -0,0 +1,155 @@ +
Receipt No: <%=@sale_data.receipt_no rescue ' '%>
+Cashier: <%=@sale_data.cashier_name rescue ' '%>
+Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+| Items | +QTY + | Price + |
|---|---|---|
| + <%=sale_item.product_name%>@<%=sale_item.unit_price%> + | ++ <%=sale_item.qty%> + | ++ <%=(sale_item.qty*sale_item.unit_price)%> + | +