not show price 0 fixed

This commit is contained in:
Yan
2017-06-27 11:52:51 +06:30
parent 08e98409a5
commit e38886790c
10 changed files with 61 additions and 37 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -34,7 +34,8 @@
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_completed_item.each do |qid|
@queue_completed_item.each do |qid|
if qid.price != 0
%>
<div class="card queue_station">
<div class="card-block">
@@ -69,7 +70,8 @@
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<%
<%
end
end
%>
</div>
@@ -85,8 +87,9 @@
<!--- Order Items -->
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@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]
%>
<div class="card queue_station">
<div class="card-block">
@@ -121,7 +124,8 @@
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
</div>
</div>
<%
<%
end
end
end
%>

View File

@@ -29,7 +29,10 @@
<tbody>
<% 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
%>
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
<td style="width:60%; text-align:left">
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
@@ -42,7 +45,10 @@
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
</td>
</tr>
<%end %>
<%
end
end
%>
</tbody>
</table>
</div>
@@ -166,7 +172,7 @@
<div class="col-md-3">
<div class="form-group">
<button id="net" class="btn btn-warning fluid action-btn">Net</button>
<button id="net" class="btn btn-warning fluid action-btn">Nett</button>
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button>
</div>

View File

@@ -163,7 +163,7 @@
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0 || sale_item.price == 10
unless sale_item.price == 0
%>
<tr>
<td><%= count %></td>
@@ -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 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>

View File

@@ -158,7 +158,7 @@
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @obj.sale_id %>">
<% unless sale_item.price == 0 || sale_item.price == 10 %>
<% unless sale_item.price == 0 %>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
@@ -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 %>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>