diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index 4bec80a8..52780381 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -19,10 +19,18 @@ class Origami::MovetableController < BaseOrigamiController order = Order.find(booking_order.order_id) @obj_order = order + @customer = order.customer @date = order.created_at + @booking= booking order.order_items.each do |item| @order_items.push(item) end + accounts = @customer.tax_profiles + @account_arr =[] + accounts.each do |acc| + account = TaxProfile.find(acc) + @account_arr.push(account) + end end @status_order = 'order' else @@ -32,9 +40,17 @@ class Origami::MovetableController < BaseOrigamiController if @status_order == 'order' @status_order = 'sale' end + @booking= booking @date = sale.created_at @status_sale = 'sale' @obj_sale = sale + @customer = sale.customer + accounts = @customer.tax_profiles + @account_arr =[] + accounts.each do |acc| + account = TaxProfile.find(acc) + @account_arr.push(account) + end end end end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f162be5d..96e883ab 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -135,7 +135,7 @@
Receipt No: - <% if @status_sale == 'sale' %> - <%= @sale_array[0].receipt_no rescue '' %> - <% end %> -
-Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-<%= @sale_array[0].customer_id rescue '' %>
+ Customer : <%= @sale_array[0].customer.name rescue '' %> + <% elsif @status_order == 'order' + %> +<%= @customer.customer_id rescue "" %>
+ Customer : <%= @customer.name rescue "" %> + <% end %> + +| # | Items | QTY | -Price | - - - - <% - count = 0 - sub_total = 0 - if @status_sale == "sale" - puts @sale_array[0] - @sale_array[0].sale_items.each do |sale_item| - count += 1 - sub_total = sub_total + sale_item.price - %> - - <% unless sale_item.price <= 0 %> -|||
|---|---|---|---|---|---|---|
| <%= count %> | -<%= sale_item.product_name %> | -<%= sale_item.qty %> | -<%= sale_item.price %> | -Price | + + + + <% + count = 0 + sub_total = 0 + if @status_sale == "sale" + @sale_array[0].sale_items.each do |sale_item| count += 1 - sub_total = sub_total + order_item.price - - unless order_item.price <= 0 %> + sub_total = sub_total + sale_item.price + %> + + <% unless sale_item.price <= 0 %>||
| <%= count %> | -<%= order_item.item_name %> | -<%= order_item.qty %> | -<%= order_item.qty*order_item.price %> | +<%= sale_item.product_name %> | +<%= sale_item.qty %> | +<%= sale_item.price %> |
| <%= count %> | +<%= order_item.item_name %> | +<%= order_item.qty %> | +<%= order_item.qty*order_item.price %> | +