Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill

This commit is contained in:
phyusin
2018-02-22 09:43:13 +06:30
4 changed files with 17 additions and 5 deletions

View File

@@ -32,6 +32,18 @@ class Origami::SaleEditController < BaseOrigamiController
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id)
puts saleitemObj.to_json
order.order_items.each do |o|
if saleitemObj.product_code == o.item_code
o.qty = saleitemObj.qty * -1
o.price = saleitemObj.price * -1
o.save
end
end
action_by = current_user.id
remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMVOID" )

View File

@@ -242,7 +242,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
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
left join menu_items as item ON item.item_code = order_items.item_code")
.where("order_items.order_items_id = '#{ id }'")
.where("order_items.order_items_id = '#{ id }' and order_items.qty > 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, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
@@ -252,7 +252,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
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
left join menu_items as item ON item.item_code = order_items.item_code")
.where("orders.order_id = '#{ id }'")
.where("orders.order_id = '#{ id }' and order_items.qty > 0")
.group("order_items.order_items_id")
else
# order summary for booking
@@ -263,7 +263,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
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
left join menu_items as item ON item.item_code = order_items.item_code")
.where("b.booking_id = '#{ id }'")
.where("b.booking_id = '#{ id }' and order_items.qty > 0")
end
end

View File

@@ -36,7 +36,7 @@ class OrderSummaryPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
if order[0].dining.to_i > 0
if order[0].dining.present?
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
else
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20

View File

@@ -222,7 +222,7 @@
<button type="button" class="btn btn-primary action-btn create col-md-4" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
<%else%>
<button type="button" class="btn btn-primary action-btn create col-md-10" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Create Order</button>
<%end%>