diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb
index d8731ecb..cef7c6b6 100644
--- a/app/controllers/oqs/home_controller.rb
+++ b/app/controllers/oqs/home_controller.rb
@@ -98,7 +98,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} AND odt.price <> 0")
+ .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
.group("assigned_order_items.assigned_order_item_id")
.order("assigned_order_items.created_at")
end
diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb
index 687c872f..7fa51da4 100644
--- a/app/controllers/origami/request_bills_controller.rb
+++ b/app/controllers/origami/request_bills_controller.rb
@@ -5,7 +5,7 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale = Sale.new
sale_order=SaleOrder.new
- if ShiftSale.current_open_shift(current_user.id)
+ if shift = ShiftSale.current_open_shift(current_user.id)
order_id = params[:id] # order_id
bk_order = BookingOrder.find_by_order_id(order_id)
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
@@ -20,6 +20,10 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
end
+
+ # Bind shift sale id to sale
+ @sale_data.shift_sale_id = shift.id
+ @sale_data.save
else
@status = false
@error_message = "No Current Open Shift for This Employee"
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 00bb5b2c..1938fb45 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -37,6 +37,8 @@ class Ability
can :index, :saleitem
can :index, :receipt_no
can :index, :shiftsale
+ can :index, :credit_payment
+ can :index, :void_sale
can :get_customer, Customer
can :add_customer, Customer
@@ -113,6 +115,8 @@ class Ability
can :index, :saleitem
can :index, :receipt_no
can :index, :shiftsale
+ can :index, :credit_payment
+ can :index, :void_sale
elsif user.role == "supervisour"
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 2a328cc9..904749e6 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -43,6 +43,8 @@
<%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %>
<%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %>
<%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %>
+ <%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %>
+ <%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %>
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb
index 206c8f20..726194d1 100644
--- a/app/views/origami/home/show.html.erb
+++ b/app/views/origami/home/show.html.erb
@@ -132,6 +132,7 @@
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
+
<% end %>
@@ -143,7 +144,10 @@
- <%if @customer %>
+ <% if @status_sale == 'sale' %>
+
<%= @sale_array[0].customer_id rescue '' %>
+
Customer : <%= @sale_array[0].customer.name rescue '' %>
+ <%else%>
<%= @customer.customer_id rescue "" %>
Customer : <%= @customer.name rescue "" %>
<%end%>
@@ -302,10 +306,10 @@
Back
<% if @dining.bookings.length >= 1 %>
-
Customer
<% if @status_order == 'order' && @status_sale != 'sale' %>
+
Customer
Edit
Discount
Charges
@@ -316,6 +320,7 @@
Void
<% else %>
+
Customer
Edit
Discount
Charges
diff --git a/app/views/origami/room_invoices/index.html.erb b/app/views/origami/room_invoices/index.html.erb
index 3d88622e..60baf85f 100644
--- a/app/views/origami/room_invoices/index.html.erb
+++ b/app/views/origami/room_invoices/index.html.erb
@@ -26,9 +26,15 @@
Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
-
Customer :
+ <% if @status_sale == 'sale' %>
+
<%= @sale.customer_id rescue '' %>
+
Customer : <%= @sale.customer.name rescue '-' %>
+ <%else%>
+
<%= @customer.customer_id rescue "" %>
+
Customer : <%= @customer.name rescue "-" %>
+ <%end%>
diff --git a/app/views/origami/room_invoices/show.html.erb b/app/views/origami/room_invoices/show.html.erb
index 86cb1789..c300d00f 100644
--- a/app/views/origami/room_invoices/show.html.erb
+++ b/app/views/origami/room_invoices/show.html.erb
@@ -32,12 +32,15 @@
Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
-
-
<%= @customer.customer_id rescue "" %>
-
Customer : <%= @customer.name rescue "" %>
-
+ <% if @status_sale == 'sale' %>
+
<%= @sale.customer_id rescue '' %>
+
Customer : <%= @sale.customer.name rescue '-' %>
+ <%else%>
+
<%= @customer.customer_id rescue "" %>
+
Customer : <%= @customer.name rescue "-" %>
+ <%end%>
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
index d115b765..2a069af9 100644
--- a/app/views/origami/rooms/show.html.erb
+++ b/app/views/origami/rooms/show.html.erb
@@ -132,6 +132,7 @@
Receipt No:
<% if @status == 'sale' %>
<%= @obj.receipt_no rescue '' %>
+
<% end %>
@@ -139,12 +140,15 @@
Date: <%= @obj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
- <%if @customer %>
-
<%= @customer.customer_id %>
-
Customer : <%= @customer.name %>
- <%end%>
+ <% if @status == 'sale' %>
+
<%= @obj.customer_id rescue '' %>
+
Customer : <%= @obj.customer.name rescue '-' %>
+ <%else%>
+
<%= @customer.customer_id rescue "" %>
+
Customer : <%= @customer.name rescue "-" %>
+ <%end%>
@@ -284,10 +288,10 @@
Back
<% if @room.bookings.length >= 1 %>
-
Customer
<% if @status == 'order' && @status != 'sale' %>
+
Customer
Edit
Discount
Move
@@ -297,6 +301,7 @@
Void
<% else %>
+
Customer
Edit
Discount
Move
diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb
index dd58a577..4d4d1edb 100644
--- a/app/views/origami/sales/show.html.erb
+++ b/app/views/origami/sales/show.html.erb
@@ -120,9 +120,11 @@
Date: <%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
-
Customer :
+
+
Customer : <%= @sale.customer.name rescue "-" %>
+
diff --git a/app/views/origami/table_invoices/index.html.erb b/app/views/origami/table_invoices/index.html.erb
index 834d5f36..5df7d18c 100644
--- a/app/views/origami/table_invoices/index.html.erb
+++ b/app/views/origami/table_invoices/index.html.erb
@@ -26,9 +26,15 @@
Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
-
Customer :
+ <% if @status_sale == 'sale' %>
+
<%= @sale.customer_id rescue '' %>
+
Customer : <%= @sale.customer.name rescue '-' %>
+ <%else%>
+
<%= @customer.customer_id rescue "" %>
+
Customer : <%= @customer.name rescue "-" %>
+ <%end%>
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb
index b5769e02..aa087c9b 100644
--- a/app/views/origami/table_invoices/show.html.erb
+++ b/app/views/origami/table_invoices/show.html.erb
@@ -32,12 +32,15 @@
Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
-
-
<%= @customer.customer_id rescue "" %>
-
Customer : <%= @customer.name rescue "" %>
-
+ <% if @status_sale == 'sale' %>
+
<%= @sale.customer_id rescue '' %>
+
Customer : <%= @sale.customer.name rescue '-' %>
+ <%else%>
+
<%= @customer.customer_id rescue "" %>
+
Customer : <%= @customer.name rescue "-" %>
+ <%end%>
diff --git a/app/views/reports/void_sale/index.html.erb b/app/views/reports/void_sale/index.html.erb
index 4e33c27d..d5d3c806 100644
--- a/app/views/reports/void_sale/index.html.erb
+++ b/app/views/reports/void_sale/index.html.erb
@@ -44,8 +44,7 @@
Grand Total
Rounding Adj.
Grand Total + Rounding Adj.
-
Sale Status
-
Remarks
+
@@ -62,8 +61,8 @@
<%= item.grand_total.to_f rescue '-'%>
<%= item.rounding_adjustment.to_f rescue '-' %>
<%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%>
- <%= item.sales_status rescue '-' %>
- <%= item.remarks rescue '-' %>
+
+
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
diff --git a/app/views/reports/void_sale/index.xls.erb b/app/views/reports/void_sale/index.xls.erb
index 9597e3d9..40d8d956 100644
--- a/app/views/reports/void_sale/index.xls.erb
+++ b/app/views/reports/void_sale/index.xls.erb
@@ -1,39 +1,63 @@
- <% unless @sale_data.blank? %>
-
-
-
- <% if !params[:from].blank?%>
-
- From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%>
-
- <% end %>
-
- Shift Name
- Receive No
- Cashier Name
- Customer Name
- Credit Amount
-
-
-
- <% @sale_data.each do |credit| %>
-
-
- <% if @shift_from.nil? && @shift_to.nil? %>
- <%= credit.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%>
- <% else %>
- <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%>
- <% end %>
- <%= credit.receipt_no rescue '-' %>
- <%= credit.cashier_name rescue '-' %>
- <%= credit.sale.customer.name rescue '-' %>
- <%= credit.payment_amount rescue '-' %>
-
- <% end %>
-
-
+ <% if @sale_data.count > 0 %>
+
+
+ <% if !params[:from].blank?%>
+
+ From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%>
+
+ <% end %>
+ <% if @shift_from %>
+
+ <% if @shift %>
+ <% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
+ <% end %>
+ Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )
+
+ <% end %>
+
+ Receipt No
+ Sale Date
+ Total Amount
+ Grand Total
+ Rounding Adj.
+ Grand Total + Rounding Adj.
+
+
+
+
+ <% total_amount = 0.0 %>
+ <% grand_total = 0.0 %>
+ <% rounding_adjustment = 0.0 %>
+ <% grand_rounding_adjustment = 0.0 %>
+ <% @sale_data.each do |result| %>
+ <% result[:items].each do |item| %>
+
+ <%= item.receipt_no rescue '-' %>
+ <%= item.date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %>
+ <%= item.total_amount.to_f rescue '-'%>
+ <%= item.grand_total.to_f rescue '-'%>
+ <%= item.rounding_adjustment.to_f rescue '-' %>
+ <%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%>
+
+
+
+ <% total_amount = total_amount.to_f + item.total_amount.to_f %>
+ <% grand_total = grand_total.to_f + item.grand_total.to_f %>
+ <% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
+ <% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
+ <% end %>
<% end %>
+
+ Total Void Amount :
+ <%= total_amount rescue '-' %>
+ <%= grand_total rescue '-' %>
+ <%= rounding_adjustment rescue '-'%>
+ <%= grand_rounding_adjustment rescue '-'%>
+
+
+
+<% end %>
\ No newline at end of file