merge with origin master

This commit is contained in:
Yan
2017-06-18 12:50:07 +06:30
12 changed files with 78 additions and 80 deletions

View File

@@ -17,6 +17,7 @@
//= require cable
$(document).ready(function(){
// auto refresh every 10 seconds
// setTimeout(function(){
// window.location.reload(1);
@@ -67,10 +68,10 @@ $(document).ready(function(){
});
// complete for queue item
$('.order-complete').on('click',function(e){
$('.order-complete').on('click',function(e){
//e.preventDefault();
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var params = { 'id':assigned_item_id };
// Call update_delivery_status() for changed delivery and move to delivery
@@ -79,8 +80,8 @@ $(document).ready(function(){
url: '/oqs/update_delivery',
data: params,
dataType: 'json',
success: function(data){
for (i = 0; i < data.length; i++) {
success: function(data){
for (i = 0; i < data.length; i++) {
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
var station = queue_station.parent().parent().attr('id');
@@ -89,7 +90,7 @@ $(document).ready(function(){
// Remove a queue card from current station
queue_station.children('.card-footer').remove();
// Add removed queue card from station to completed
$("#completed").children('.card-columns').append(queue_station);
@@ -97,35 +98,35 @@ $(document).ready(function(){
var station_count=parseInt($("#"+station+"_count").text()) - 1;
$("#"+station+"_count").text(station_count);
}
// update queue item count in completed station
// update queue item count in completed station
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
alert("updated!");
// Page reload
location.reload();
}
});
});
});
// Print Order Item
$('#print_order_item').on('click',function(){
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
$.ajax({
type: 'GET',
url: '/oqs/print/print/'+assigned_item_id,
url: '/oqs/print/print/'+assigned_item_id,
success: function(data){ }
});
});
// Print Order Summary
$('#print_order_summary').on('click',function(){
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
$.ajax({
type: 'GET',
url: '/oqs/print/print_order_summary/'+assigned_item_id,
url: '/oqs/print/print_order_summary/'+assigned_item_id,
success: function(data){ }
});
});

View File

@@ -32,15 +32,12 @@ class Api::BillController < Api::ApiController
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# find order id by sale id
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
# Calculate Food and Beverage Total
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
redirect_to origami_path(@sale_data.sale_id)
end

View File

@@ -1,22 +1,22 @@
class Oqs::HomeController < BaseOqsController
def index
queue_stations=OrderQueueStation.all
@queue_items_details = queue_items_query(0)
@queue_completed_item = queue_items_query(1)
@queue_completed_item = queue_items_query(1)
@queue_stations_items=Array.new
# Calculate Count for each station tab
queue_stations.each do |que|
queue_stations.each do |que|
i=0
@queue_items_details.each do |qid|
if qid.station_name == que.station_name
i=i+1
end
end
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
@queue_items_details.each do |qid|
if qid.station_name == que.station_name
i=i+1
end
end
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
end
@queue_stations_items
@@ -73,10 +73,10 @@ class Oqs::HomeController < BaseOqsController
# update delivery status for completed same order items
assigned_items.each do |ai|
ai.delivery_status=true
ai.save
ai.save
removed_item.push(ai.assigned_order_item_id)
end
render :json => removed_item.to_json
end
render :json => removed_item.to_json
end
# Query for OQS with status
@@ -103,4 +103,3 @@ class Oqs::HomeController < BaseOqsController
.group("assigned_order_items.assigned_order_item_id")
end
end

View File

@@ -1,8 +1,8 @@
class Origami::HomeController < BaseOrigamiController
def index
if params[:booking_id] != nil
type=params[:booking_id].split('-')[0];
# Sale
type=params[:booking_id].split('-')[0];
# Sale
if type == "SAL"
@selected_item = Sale.find(params[:booking_id])
@selected_item_type="Sale"
@@ -10,23 +10,23 @@ class Origami::HomeController < BaseOrigamiController
else
@selected_item = Order.find(params[:booking_id])
@selected_item_type="Order"
end
end
end
end
@completed_orders = Order.get_completed_order()
@booking_orders = Order.get_booking_order_table()
@booking_rooms = Order.get_booking_order_rooms()
@booking_rooms = Order.get_booking_order_rooms()
@orders = Order.get_orders()
end
end
def item_show
selection(params[:booking_id],1)
end
end
def selection(selected_id, is_ajax)
str = []
type=selected_id.split('-')[0];
# Sale
type=selected_id.split('-')[0];
# Sale
if type == "SAL"
@order_details = SaleItem.get_order_items_details(params[:booking_id])
@order_details.each do |ord_detail|
@@ -39,7 +39,7 @@ class Origami::HomeController < BaseOrigamiController
str.push(ord_detail)
end
end
if is_ajax == 1
render :json => str.to_json
else
@@ -55,21 +55,21 @@ class Origami::HomeController < BaseOrigamiController
else
sale = Order.find(params[:sale_id])
end
status = sale.update_attributes(customer_id: params[:customer_id])
if status == true
render json: JSON.generate({:status => true})
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end
end
end
def get_customer
@customer = Customer.find(params[:customer_id])
response = Customer.get_member_account(@customer)
respond_to do |format|

View File

@@ -12,7 +12,7 @@ class Origami::PaymentsController < BaseOrigamiController
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "cash")
unique_code = "ReceiptBillPdf"
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
# get member information
@@ -20,11 +20,10 @@ class Origami::PaymentsController < BaseOrigamiController
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
end
end
@@ -41,7 +40,7 @@ class Origami::PaymentsController < BaseOrigamiController
@sale_data = Sale.find_by_sale_id(sale_id)
#get customer amount
@customer = Customer.find(@sale_data.customer_id)
@customer = Customer.find(@sale_data.customer_id)
# get member information
response = Customer.get_member_account(@customer)
@@ -84,19 +83,19 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj = Sale.find(sale_id)
unique_code = "ReceiptBillPdf"
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
# get member information
member_info = Customer.get_member_account(customer)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
end

View File

@@ -231,7 +231,7 @@ class Order < ApplicationRecord
.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') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true)
.group("bookings.booking_id")
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
# For PG
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
@@ -262,7 +262,7 @@ class Order < ApplicationRecord
.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') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true)
.group("bookings.booking_id")
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id")
# For PG
# booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true
# sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id

View File

@@ -52,7 +52,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
self.print(filename)
end
def print_receipt_payment_by_foc(sale_id)
#Use CUPS service
#Generate PDF
@@ -70,6 +70,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Generate PDF
#Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info)
pdf.render_file "tmp/receipt_bill.pdf"
self.print("tmp/receipt_bill.pdf")
end

View File

@@ -11,7 +11,6 @@ class ReceiptBillPdf < Prawn::Document
self.item_height = 15
self.item_description_width = (self.page_width-20) / 2
self.label_width = 100
# @item_width = self.page_width.to_i / 2
# @qty_width = @item_width.to_i / 3
# @double = @qty_width * 1.3
@@ -36,7 +35,6 @@ class ReceiptBillPdf < Prawn::Document
if member_info != nil
member_info(member_info)
end
footer
end
@@ -206,10 +204,10 @@ class ReceiptBillPdf < Prawn::Document
# show member information
def member_info(member_info)
move_down 7
if member_info["status"] == true
member_info["data"].each do |res|
if member_info["status"] == true
member_info["data"].each do |res|
move_down 5
y_position = cursor
@@ -219,9 +217,9 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
end
end
end
end
end
end
def footer

View File

@@ -82,10 +82,10 @@
<!--- Panel 1 - Table Orders -->
<div class="tab-pane active" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_orders.each do |bko|
# No Show completed
# No Show completed
if bko.sale_status == 'completed'
next
end
@@ -146,7 +146,7 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_rooms.each do |rmo|
# No Show completed
# No Show completed
if rmo.sale_status == 'completed'
next
end
@@ -207,8 +207,8 @@
<div class="tab-pane" id="orders" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@orders.each do |odr|
# No Show completed
@orders.each do |odr|
# No Show completed
if odr.sale_status == 'completed'
next
end
@@ -289,7 +289,7 @@
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
@@ -300,14 +300,14 @@
<th class="item-attr">Price</td>
</tr>
</thead>
<tbody>
<tbody>
<%
# For Sale Items
sub_total = 0
if @selected_item_type == "Sale"
@selected_item.sale_items.each do |sale_item|
sub_total += (sale_item.qty*sale_item.unit_price)
%>
%>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
@@ -319,7 +319,7 @@
%>
<%
# For Order Items
# For Order Items
if @selected_item_type == "Order"
@selected_item.order_items.each do |order_item|
sub_total += (order_item.qty*order_item.unit_price)
@@ -354,6 +354,7 @@
<td class="charges-name"><strong>Discount:</strong></td>
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
</tr>
<!-- <tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%=@selected_item.total_tax rescue 0%></strong></td>
@@ -362,9 +363,8 @@
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%=@selected_item.grand_total rescue 0%></strong></td>
</tr> -->
<tr class="rebate_amount">
</tr>
<tr class="rebate_amount"></tr>
</table>
</div>
</div>

View File

@@ -21,7 +21,7 @@
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Available Redeem Amount</label>
<label class="col-lg-4 col-md-4 col-sm-4"> Rebat Balance </label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
@@ -66,7 +66,7 @@
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div>
<div class="row bottom">
<div class=" cashier_number del_cashier_number" data-type="nett" disable>Nett</div>
<div class=" cashier_number " data-type="nett">Nett</div>
<div class=" cashier_number red left" data-type="del">Del</div>
<div class=" cashier_number green left" data-type="clr">Clr</div>
</div>
@@ -123,6 +123,9 @@ $(document).on('click', '.cashier_number', function(event){
case 'del' :
var cash=$('#used_amount').text();
$('#used_amount').text(cash.substr(0,cash.length-1));
case 'nett':
alert($('#valid_amount').text())
$('#used_amount').text($('#valid_amount').text());
break;
}

View File

@@ -9,7 +9,7 @@ div.form-inputs span{
<div class="form-inputs">
<%= f.input :station_name %>
<%= f.input :is_active %>
<%= f.input :auto_print %>
<%= f.input :printer_name %>
<%= f.input :font_size %>
<%= f.input :print_copy %>
@@ -18,7 +18,7 @@ div.form-inputs span{
<%= f.input :cut_per_item %>
<%= f.input :use_alternate_name %>
<%= f.input :processing_items, as: :hidden %>
<%= f.input :auto_print %>
</div>
<div class="form-actions">