fix for shift sale query and prepare rounding adj

This commit is contained in:
Yan
2017-06-29 15:20:40 +06:30
parent 769509adec
commit fd857146e8
3 changed files with 8 additions and 3 deletions

View File

@@ -300,7 +300,7 @@ class Order < ApplicationRecord
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
.joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id")
.where("(orders.status = 'new' or orders.status = 'billed')")
.where("(orders.status = 'new' or orders.status = 'billed') AND orders.date between #{ from } and #{ to }")
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id

View File

@@ -21,7 +21,7 @@ class ShiftSale < ApplicationRecord
#find open shift where is open today and is not closed and login by current cashier
today_date = DateTime.now.strftime("%Y-%m-%d")
puts today_date
shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
return shift
#end

View File

@@ -228,6 +228,10 @@
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
@@ -411,10 +415,11 @@ $(document).ready(function(){
$("#first_bill").on('click', function(){
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success:function(result){
success:function(result){
location.reload();
}
});