diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js
index 746923d0..7acdb485 100644
--- a/app/assets/javascripts/origami.js
+++ b/app/assets/javascripts/origami.js
@@ -1,15 +1,3 @@
-// This is a manifest file that'll be compiled into application.js, which will include all the files
-// listed below.
-//
-// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
-// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
-//
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// compiled file. JavaScript code in this file should be added after the last require_* statement.
-//
-// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
-// about supported directives.
-//
//= require jquery
//= require tether
//= require bootstrap
@@ -304,49 +292,9 @@ $(document).ready(function(){
$(this).addClass('selected-item');
});
+ // $(".orders").on('click', function(){
+ // var dining_id = $(this).attr("data-id");
+ // window.location.href = '/origami/' + dining_id;
+ // })
+
});
-
-/* Button Control by Status */
-function control_button(order_status){
- if(order_status=="billed"){
- $("#customer").prop('disabled', false);
- $("#request_bills").prop('disabled', true);
- $("#discount").prop('disabled', false);
- $("#pay-bill").prop('disabled', false);
- $("#re-print").prop('disabled', true);
- }
- else if(order_status=="new") {
- $("#customer").prop('disabled', false);
- $("#request_bills").prop('disabled', false);
- $("#discount").prop('disabled', true);
- $("#pay-bill").prop('disabled', true);
- $("#re-print").prop('disabled', true);
- }else if(order_status=="completed"){
- $("#re-print").prop('disabled', false);
- }
- else {
- $("#customer").prop('disabled', true);
- $("#request_bills").prop('disabled', true);
- $("#discount").prop('disabled', true);
- $("#pay-bill").prop('disabled', true);
- $("#re-print").prop('disabled', true);
- }
-
-}
-
-/* For Receipt - Update Balance */
-function update_balance(){
- var discount_type = $('#discount-type').val();
- var discount_amount = $('#discount-amount').val();
- var sub_total = $('#order-sub-total').text();
- var tax = $('#order-Tax').text();
-
- // For Percentage Discount
- if(discount_type == 1){
- discount_amount=(sub_total*discount_amount)/100;
- }
-
- var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
- $('#order-discount').text(discount_amount);
- $('#order-grand-total').text(total);
-}
diff --git a/app/assets/javascripts/origami_bk.js b/app/assets/javascripts/origami_bk.js
new file mode 100644
index 00000000..d4071432
--- /dev/null
+++ b/app/assets/javascripts/origami_bk.js
@@ -0,0 +1,352 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file. JavaScript code in this file should be added after the last require_* statement.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require tether
+//= require bootstrap
+//= require jquery_ujs
+//= require turbolinks
+//= require cable
+//= require jquery-ui
+//= require bootstrap-datepicker
+
+$(document).ready(function(){
+ // auto refresh every 60 seconds
+ // setTimeout(function(){
+ // window.location.reload(1);
+ // }, 60000);
+
+ // For selected order return
+ var order_status = "";
+ order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
+
+ // Enable/Disable Button
+ control_button(order_status);
+
+ $(".orders").on('click', function(){
+ $("#order-sub-total").text('');
+ // $("#order-food").text('');
+ // $("#order-beverage").text('');
+ $("#order-discount").text('');
+ $("#order-Tax").text('');
+ $("#order-grand-total").text('');
+
+ var zone_name=$(this).find(".orders-table").text();
+ var receipt_no=$(this).find(".orders-receipt-no").text();
+ var unique_id = $(this).find(".orders-id").text();
+ var order_status=$(this).find(".orders-order-status").text().trim();
+
+ // Enable/Disable Button
+ control_button(order_status);
+
+ var customer_id=$(this).find(".customer-id").text();
+ show_customer_details(customer_id);
+
+ $("#re-print").val(unique_id);
+
+ var cashier="";
+ var receipt_date="";
+ var sub_total=0.0;
+ var discount_amount=0;
+ var tax_amount=0;
+ var grand_total_amount=0;
+
+ $("#order-title").text("ORDER DETAILS - " + zone_name);
+ // clear order items
+ $("#order-items-table").children("tbody").empty();
+
+ // AJAX call for order
+ $.ajax({
+ type: "POST",
+ url: "/origami/" + unique_id,
+ data: { 'booking_id' : unique_id },
+ success:function(result){
+ for (i = 0; i < result.length; i++) {
+ var data = JSON.stringify(result[i]);
+ var parse_data = JSON.parse(data);
+ var show_date = "";
+
+ // Receipt Header
+ receipt_no = result[i].receipt_no;
+ cashier = result[i].cashier_name;
+ if(result[i].receipt_date != null){
+ receipt_date = new Date(result[i].receipt_date);
+ show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
+ }
+
+ //Receipt Charges
+ sub_total += parseFloat(parse_data.price);
+
+ discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
+ tax_amount = parse_data.tax_amount;
+ grand_total_amount = parse_data.grand_total_amount;
+
+ // Ordered Items
+ var order_items_rows = "
" +
+ "| " + parse_data.item_name + " | " +
+ "" + parse_data.qty + " | " +
+ "" + parse_data.price + " | " +
+ "
";
+
+ $("#order-items-table").children("tbody").append(order_items_rows);
+ }
+
+ // Cashier Info
+ $("#receipt_no").text(receipt_no);
+ $("#cashier").text(cashier == null ? "" : cashier);
+ $("#receipt_date").text(show_date);
+
+ // Payment Info
+ $("#order-sub-total").text(sub_total);
+ // $("#order-food").text('');
+ // $("#order-beverage").text('');
+ $("#order-discount").text(discount_amount);
+ $("#order-Tax").text(tax_amount);
+ $("#order-grand-total").text(grand_total_amount);
+ }
+ });
+ // End AJAX Call
+
+ $('.orders').removeClass('selected-item');
+ $(this).addClass('selected-item');
+ });
+
+ // Bill Request
+ $('#request_bills').click(function() {
+ var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
+ if(order_id!=""){
+ window.location.href = '/origami/' + order_id + '/request_bills'
+ }
+ else {
+ alert("Please select an order!");
+ }
+ return false;
+ });
+
+ // Discount for Payment
+ $('#discount').click(function() {
+ var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
+
+ if(order_id!=""){
+ window.location.href = '/origami/' + order_id + '/discount'
+ }
+ else {
+ alert("Please select an order!");
+ }
+
+ return false;
+ });
+
+ // Pay Discount for Payment
+ $("#pay-discount").on('click', function(e){
+ e.preventDefault();
+ var sale_id = $('#sale-id').text();
+ var sale_item_id = $('.selected-item').attr('id').substr(0,16);
+ var sub_total = $('#order-sub-total').text();
+ var grand_total = $('#order-grand-total').text();
+ var discount_type = $('#discount-type').val();
+ var discount_value = $('#discount-amount').val();
+ var discount_amount = discount_value;
+ var ajax_url = "/origami/" + sale_id + "/discount";
+
+ if(sale_item_id != null){
+ ajax_url = "/origami/" + sale_item_id + "/discount";
+ sub_total = $("#"+sale_item_id).children().find("#item-total-price").text();
+ }
+
+ // For Percentage Discount
+ if(discount_type == 1){
+ discount_amount=(sub_total*discount_value)/100;
+ }
+
+ var params = {'sale_id': sale_id, 'sale_item_id': sale_item_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
+ $.ajax({
+ type: "POST",
+ url: ajax_url,
+ data: params,
+ success:function(result){ }
+ });
+ });
+
+
+ // Payment for Bill
+ $('#pay-bill').click(function() {
+ var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16);
+ if(sale_id!=""){
+ window.location.href = '/origami/sale/'+ sale_id + "/payment"
+ }
+ else {
+ alert("Please select an order!");
+ }
+
+ return false;
+ });
+
+ $('#customer').click(function() {
+ var sale = $(".selected-item").find(".orders-id").text().substr(0,16);
+ if (sale.substring(0, 3)=="SAL") {
+ var sale_id = sale
+ }else{
+ var sale_id = $(".selected-item").find(".order-cid").text();
+ }
+ window.location.href = '/origami/'+ sale_id + "/customers"
+
+ return false;
+ });
+
+ $('#re-print').click(function() {
+ var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16);
+
+ window.location.href = '/origami/'+ sale_id + "/reprint"
+
+ return false;
+ });
+
+ function show_customer_details(customer_id){
+
+ if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
+ var url = customer_id+"/get_customer/"
+ }else{
+ var url = "origami/"+customer_id+"/get_customer/"
+ }
+
+ $('.customer_detail').removeClass('hide');
+
+ //Start Ajax
+ $.ajax({
+ type: "GET",
+ url: url,
+ data: {},
+ dataType: "json",
+ success: function(data) {
+ $("#customer_name").text(data["customer"].name);
+ if (data["response_data"]["data"].length) {
+ $.each(data["response_data"]["data"], function (i) {
+ if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
+ var balance = data["response_data"]["data"][i]["balance"];
+ if (data["response_data"]["status"]==true) {
+ $('.rebate_amount').removeClass('hide');
+ row =
+ '' + data["response_data"]["data"][i]["accountable_type"] +' | '
+ +'' + balance + ' | ';
+
+ $(".rebate_amount").html(row);
+ }
+
+ }
+ });
+ }else{
+ $('.rebate_amount').addClass('hide');
+ }
+ }
+ });
+ //End Ajax
+ }
+
+ /* For Receipt - Calculate discount or tax */
+ $('.cashier_number').on('click', function(event){
+ if(event.handled !== true) {
+ var original_value=0;
+ original_value = $('#discount-amount').val();
+
+ var input_type = $(this).attr("data-type");
+
+ switch (input_type) {
+ case 'num':
+ var input_value = $(this).attr("data-value");
+ if (original_value == "0.0"){
+ $('#discount-amount').val(input_value);
+ update_balance();
+ }
+ else{
+ $('#discount-amount').val(original_value + '' + input_value);
+ update_balance();
+ }
+ break;
+
+ case 'add':
+ var input_value = $(this).attr("data-value");
+ amount = parseInt(input_value);
+ $('#discount-amount').val(amount);
+ $('#discount-type').val(1);
+ update_balance();
+ break;
+
+ case 'del' :
+ var discount_text=$('#discount-amount').val();
+ $('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
+ update_balance();
+ break;
+
+ case 'clr':
+ $('#discount-amount').val("0.0");
+ update_balance();
+ break;
+ }
+
+ event.handled = true;
+ } else {
+ return false;
+ }
+ });
+
+ $('.discount-item-row').on('click',function(){
+ $('.discount-item-row').removeClass('selected-item');
+ $(this).addClass('selected-item');
+ });
+
+});
+
+/* Button Control by Status */
+function control_button(order_status){
+ if(order_status=="billed"){
+ $("#customer").prop('disabled', false);
+ $("#request_bills").prop('disabled', true);
+ $("#discount").prop('disabled', false);
+ $("#pay-bill").prop('disabled', false);
+ $("#re-print").prop('disabled', true);
+ }
+ else if(order_status=="new") {
+ $("#customer").prop('disabled', false);
+ $("#request_bills").prop('disabled', false);
+ $("#discount").prop('disabled', true);
+ $("#pay-bill").prop('disabled', true);
+ $("#re-print").prop('disabled', true);
+ }else if(order_status=="completed"){
+ $("#re-print").prop('disabled', false);
+ }
+ else {
+ $("#customer").prop('disabled', true);
+ $("#request_bills").prop('disabled', true);
+ $("#discount").prop('disabled', true);
+ $("#pay-bill").prop('disabled', true);
+ $("#re-print").prop('disabled', true);
+ }
+
+}
+
+/* For Receipt - Update Balance */
+function update_balance(){
+ var discount_type = $('#discount-type').val();
+ var discount_amount = $('#discount-amount').val();
+ var sub_total = $('#order-sub-total').text();
+ var tax = $('#order-Tax').text();
+
+ // For Percentage Discount
+ if(discount_type == 1){
+ discount_amount=(sub_total*discount_amount)/100;
+ }
+
+ var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
+ $('#order-discount').text(discount_amount);
+ $('#order-grand-total').text(total);
+}
diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss
index 71a9915e..7c27b267 100644
--- a/app/assets/stylesheets/origami.scss
+++ b/app/assets/stylesheets/origami.scss
@@ -47,11 +47,29 @@
font-size:20px;
color:white;
}
+.payment{
+ height:70px;line-height:70px;align:center;color:white;font-size:16px;margin-bottom:1px;
+}
+
+.cash-color{
+ background-color:#80CBC4;
+}
+
+.credit-color{
+ background-color:#FFCCBC;
+}
+.other-payment-color{
+ background-color:#E1BEE7;
+}
.cashier_number:hover{
background:#A9F5F2;
}
+.style2 {
+ border-top: 3px double #8c8b8b;
+}
+
.long{
width:49%;
}
@@ -89,6 +107,13 @@
text-align: right;
}
+.display-none{
+ display: none;
+}
+
+.text-white{
+ color: #fff;
+}
/* Colors */
.purple {
@@ -103,6 +128,10 @@
background-color: #009900
}
+.orange{
+ background-color: #FF8C00
+}
+
.left{
margin-left:1px;
}
diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb
index 14d79857..b4d564f2 100644
--- a/app/controllers/oqs/home_controller.rb
+++ b/app/controllers/oqs/home_controller.rb
@@ -30,14 +30,14 @@ class Oqs::HomeController < BaseOqsController
dining = DiningFacility.find_by_name(table_name);
# oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
# if status == ""
- # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
- # oi = OrderItem.find_by_item_code(aoi.item_code)
- # items.push(oi)
+ # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
+ # oi = OrderItem.find_by_item_code(aoi.item_code)
+ # items.push(oi)
# end
# else
- # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
- # oi = OrderItem.find_by_item_code(aoi.item_code)
- # items.push(oi)
+ # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
+ # oi = OrderItem.find_by_item_code(aoi.item_code)
+ # items.push(oi)
# end
# end
@@ -49,7 +49,7 @@ class Oqs::HomeController < BaseOqsController
end
end
- # booking_id = dining.get_new_booking
+ # booking_id = dining.get_new_booking
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
# order=Order.find(bo.order_id);
# order.order_items.each do |oi|
@@ -81,6 +81,8 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with status
def queue_items_query(status)
+ puts status
+ puts "put what is status"
# AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
# .joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
# left join dining_facilities as df on df.zone_id = oqpz.zone_id
@@ -88,9 +90,9 @@ class Oqs::HomeController < BaseOqsController
# left join orders as od ON od.order_id = assigned_order_items.order_id
# left join order_items as odt ON odt.item_code = assigned_order_items.item_code
# left join customers as cus ON cus.customer_id = od.customer_id")
- # .where("assigned_order_items.delivery_status = #{status}")
+ # .where("assigned_order_items.delivery_status = #{status}")
# .group("assigned_order_items.assigned_order_item_id")
- # .order("odt.item_name DESC")
+ # .order("odt.item_name DESC")
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join orders as od ON od.order_id = assigned_order_items.order_id
@@ -99,7 +101,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}")
- .group("assigned_order_items.assigned_order_item_id")
+ .where("assigned_order_items.delivery_status = #{status}")
+ .group("assigned_order_items.assigned_order_item_id,oqs.station_name,oqs.is_active,df.name,odt.item_code,odt.item_name,odt.price, odt.qty, odt.item_order_by,cus.name,odt.created_at")
end
end
diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb
index 1aca9b2d..3246ea44 100644
--- a/app/controllers/origami/home_controller.rb
+++ b/app/controllers/origami/home_controller.rb
@@ -1,84 +1,50 @@
class Origami::HomeController < BaseOrigamiController
+ before_action :set_dining, only: [:show]
+
def index
- if params[:booking_id] != nil
- type=params[:booking_id].split('-')[0];
- # Sale
- if type == "SAL"
- @selected_item = Sale.find(params[:booking_id])
- @selected_item_type="Sale"
- # Booking
- else
- @selected_item = Order.find(params[:booking_id])
- @selected_item_type="Order"
- end
- end
-
- @completed_orders = Order.get_completed_order()
- @booking_orders = Order.get_booking_order_table()
- @booking_rooms = Order.get_booking_order_rooms()
- @orders = Order.get_orders()
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
end
- def item_show
- selection(params[:booking_id],1)
- end
-
- def selection(selected_id, is_ajax)
- str = []
- 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|
- str.push(ord_detail)
- end
- # Booking
- else
- @order_details = OrderItem.get_order_items_details(params[:booking_id])
- @order_details.each do |ord_detail|
- str.push(ord_detail)
- end
- end
-
- if is_ajax == 1
- render :json => str.to_json
- else
- str
+ # origami table detail
+ def show
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
+ @status_order = ""
+ @dining.bookings.each do |booking|
+ if booking.sale_id.nil?
+ @order_items = Array.new
+ booking.booking_orders.each do |booking_order|
+ order = Order.find(booking_order.order_id)
+ @obj_order = order
+ @date = order.created_at
+ order.order_items.each do |item|
+ @order_items.push(item)
+ end
+ end
+ @status_order = 'order'
+ else
+ sale = Sale.find(booking.sale_id)
+ if sale.sale_status != "completed"
+ if @status_order == 'order'
+ @status_order = 'sale'
+ end
+ @date = sale.created_at
+ @status_sale = 'sale'
+ @obj_sale = sale
+ end
+ end
end
end
- def update_sale_by_customer
+private
- id = params[:sale_id][0,3]
- if(id == "SAL")
- sale = Sale.find(params[:sale_id])
- 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
-
- def get_customer
-
- @customer = Customer.find(params[:customer_id])
-
- response = Customer.get_member_account(@customer)
-
- respond_to do |format|
- format.js do
- render :json => {
- :response_data => response.as_json,
- :customer => @customer}
- end
- end
- end
+def set_dining
+ @dining = DiningFacility.find(params[:dining_id])
+end
end
diff --git a/app/controllers/origami/home_controller_bk.rb b/app/controllers/origami/home_controller_bk.rb
new file mode 100644
index 00000000..1aca9b2d
--- /dev/null
+++ b/app/controllers/origami/home_controller_bk.rb
@@ -0,0 +1,84 @@
+class Origami::HomeController < BaseOrigamiController
+ def index
+ if params[:booking_id] != nil
+ type=params[:booking_id].split('-')[0];
+ # Sale
+ if type == "SAL"
+ @selected_item = Sale.find(params[:booking_id])
+ @selected_item_type="Sale"
+ # Booking
+ else
+ @selected_item = Order.find(params[:booking_id])
+ @selected_item_type="Order"
+ end
+ end
+
+ @completed_orders = Order.get_completed_order()
+ @booking_orders = Order.get_booking_order_table()
+ @booking_rooms = Order.get_booking_order_rooms()
+ @orders = Order.get_orders()
+ end
+
+ def item_show
+ selection(params[:booking_id],1)
+ end
+
+ def selection(selected_id, is_ajax)
+ str = []
+ 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|
+ str.push(ord_detail)
+ end
+ # Booking
+ else
+ @order_details = OrderItem.get_order_items_details(params[:booking_id])
+ @order_details.each do |ord_detail|
+ str.push(ord_detail)
+ end
+ end
+
+ if is_ajax == 1
+ render :json => str.to_json
+ else
+ str
+ end
+ end
+
+ def update_sale_by_customer
+
+ id = params[:sale_id][0,3]
+ if(id == "SAL")
+ sale = Sale.find(params[:sale_id])
+ 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
+
+ def get_customer
+
+ @customer = Customer.find(params[:customer_id])
+
+ response = Customer.get_member_account(@customer)
+
+ respond_to do |format|
+ format.js do
+ render :json => {
+ :response_data => response.as_json,
+ :customer => @customer}
+ end
+ end
+ end
+
+end
diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb
new file mode 100644
index 00000000..c51fcbb1
--- /dev/null
+++ b/app/controllers/origami/moveroom_controller.rb
@@ -0,0 +1,37 @@
+class Origami::MoveroomController < BaseOrigamiController
+
+ def move_dining
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
+
+ @status_order = ""
+ @dining = DiningFacility.find(params[:dining_id])
+ @dining.bookings.each do |booking|
+ if booking.sale_id.nil?
+ @order_items = Array.new
+ booking.booking_orders.each do |booking_order|
+ order = Order.find(booking_order.order_id)
+ @obj_order = order
+ @date = order.created_at
+ order.order_items.each do |item|
+ @order_items.push(item)
+ end
+ end
+ @status_order = 'order'
+ else
+ sale = Sale.find(booking.sale_id)
+ if sale.sale_status != "completed"
+ if @status_order == 'order'
+ @status_order = 'sale'
+ end
+ @date = sale.created_at
+ @status_sale = 'sale'
+ @obj_sale = sale
+ end
+ end
+ end
+ end
+
+end
diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb
new file mode 100644
index 00000000..8199411c
--- /dev/null
+++ b/app/controllers/origami/movetable_controller.rb
@@ -0,0 +1,49 @@
+class Origami::MovetableController < BaseOrigamiController
+
+ def move_dining
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
+
+ @status_order = ""
+ @dining = DiningFacility.find(params[:dining_id])
+ @dining.bookings.each do |booking|
+ if booking.sale_id.nil?
+ @order_items = Array.new
+ booking.booking_orders.each do |booking_order|
+ order = Order.find(booking_order.order_id)
+ @obj_order = order
+ @date = order.created_at
+ order.order_items.each do |item|
+ @order_items.push(item)
+ end
+ end
+ @status_order = 'order'
+ else
+ sale = Sale.find(booking.sale_id)
+ if sale.sale_status != "completed"
+ if @status_order == 'order'
+ @status_order = 'sale'
+ end
+ @date = sale.created_at
+ @status_sale = 'sale'
+ @obj_sale = sale
+ end
+ end
+ end
+ end
+
+ def moving
+ change_to = params[:change_to] #new
+ change_from = params[:change_from] #original
+ bookings = Booking.where('dining_facility_id=?',change_from)
+ booking_array = Array.new
+ bookings.each do | booking |
+ if booking.sale_id.nil? || booking.sale.sale_status != 'completed'
+ booking_array.push(booking)
+ end
+ end
+ @get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
+ end
+end
diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb
new file mode 100644
index 00000000..09e0c541
--- /dev/null
+++ b/app/controllers/origami/orders_controller.rb
@@ -0,0 +1,10 @@
+class Origami::OrdersController < BaseOrigamiController
+
+ def show
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
+ @order = Order.find(params[:order_id])
+ end
+end
diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb
index 98951661..360274fa 100644
--- a/app/controllers/origami/request_bills_controller.rb
+++ b/app/controllers/origami/request_bills_controller.rb
@@ -4,8 +4,9 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale = Sale.new
sale_order=SaleOrder.new
- booking_id = params[:id]
- check_booking = Booking.find_by_booking_id(booking_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)
if check_booking.sale_id.nil?
# Create Sale if it doesn't exist
puts "current_login_employee"
@@ -34,7 +35,9 @@ class Origami::RequestBillsController < BaseOrigamiController
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,member_info)
redirect_to origami_path(@sale_data.sale_id)
+
end
end
diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb
new file mode 100644
index 00000000..1ac7f41a
--- /dev/null
+++ b/app/controllers/origami/rooms_controller.rb
@@ -0,0 +1,32 @@
+class Origami::RoomsController < BaseOrigamiController
+
+ def show
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
+ @room = DiningFacility.find(params[:room_id])
+ @room.bookings.each do |booking|
+ if booking.sale_id.nil?
+ @order_items = Array.new
+ booking.booking_orders.each do |booking_order|
+ order = Order.find(booking_order.order_id)
+ @obj = order
+ order.order_items.each do |item|
+ @order_items.push(item)
+ end
+ end
+ @status = 'order'
+ else
+
+ sale = Sale.find(booking.sale_id)
+ if sale.sale_status != "completed"
+ @status = 'sale'
+ @obj = sale
+ end
+ end
+ end
+ end
+
+
+end
diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb
new file mode 100644
index 00000000..e9eb2edc
--- /dev/null
+++ b/app/controllers/origami/sales_controller.rb
@@ -0,0 +1,10 @@
+class Origami::SalesController < BaseOrigamiController
+
+ def show
+ @tables = Table.all.active.order('status desc')
+ @rooms = Room.all.active.order('status desc')
+ @complete = Sale.all
+ @orders = Order.all.order('date desc')
+ @sale = Sale.find(params[:sale_id])
+ end
+end
diff --git a/app/controllers/settings/order_queue_stations_controller.rb b/app/controllers/settings/order_queue_stations_controller.rb
index bc7766a7..5a540ddb 100644
--- a/app/controllers/settings/order_queue_stations_controller.rb
+++ b/app/controllers/settings/order_queue_stations_controller.rb
@@ -27,6 +27,7 @@ class Settings::OrderQueueStationsController < ApplicationController
def create
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
@settings_order_queue_station.created_by = current_login_employee.name
+ @settings_order_queue_station.processing_items = "[]"
respond_to do |format|
if @settings_order_queue_station.save
format.html { redirect_to settings_order_queue_stations_path, notice: 'Order queue station was successfully created.' }
diff --git a/app/models/booking.rb b/app/models/booking.rb
index 01cf0f46..79fbad4a 100644
--- a/app/models/booking.rb
+++ b/app/models/booking.rb
@@ -10,6 +10,19 @@ class Booking < ApplicationRecord
has_many :booking_orders
has_many :orders, :through => :booking_orders
+ def self.update_dining_facility(booking_arr, newd, old)
+ booking_arr.each do |booking|
+ booking.dining_facility_id = newd
+ booking.save
+ end
+ new_dining = DiningFacility.find(newd)
+ new_dining.make_occupied
+ old_dining = DiningFacility.find(old)
+ old_dining.make_available
+
+ return new_dining.type
+ end
+
private
def generate_custom_id
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
diff --git a/app/models/booking_order.rb b/app/models/booking_order.rb
index ddf5ed18..c9f748f0 100644
--- a/app/models/booking_order.rb
+++ b/app/models/booking_order.rb
@@ -1,5 +1,5 @@
class BookingOrder < ApplicationRecord
- #primary key - need to be unique
+ #primary key - need to be unique
belongs_to :booking
belongs_to :order
diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb
index 6f898989..c699a534 100644
--- a/app/models/dining_facility.rb
+++ b/app/models/dining_facility.rb
@@ -8,9 +8,19 @@ class DiningFacility < ApplicationRecord
scope :active, -> {where(is_active: true)}
+ def make_available
+ self.status = 'available'
+ self.save
+ end
+
+ def make_occupied
+ self.status = 'occupied'
+ self.save
+ end
+
def get_current_booking
- puts "enter booking"
- booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
+ puts "enter booking"
+ booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
if booking.count > 0 then
return booking[0].booking_id
@@ -21,10 +31,10 @@ class DiningFacility < ApplicationRecord
def get_new_booking
# query for new
- # if status
+ # if status
# to ask when req bill booking_status?
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is null").limit(1)
- # else
+ # else
# booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id not null").limit(1)
# end
diff --git a/app/models/order.rb b/app/models/order.rb
index a4328d76..7ab39a4c 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -11,7 +11,7 @@ class Order < ApplicationRecord
#internal references attributes for business logic control
attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id
-
+ scope :active, -> { where("date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
#Main Controller method to create new order - validate all inputs and generate new order
# order_item : {
# order_item_code : "",
@@ -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
@@ -246,7 +246,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("sales.sale_status='completed'")
- .group("sales.sale_id")
+ .group("sales.sale_id,bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
# For PG
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
end
@@ -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
diff --git a/app/models/room.rb b/app/models/room.rb
index d99708a3..87f232e9 100644
--- a/app/models/room.rb
+++ b/app/models/room.rb
@@ -1,3 +1,4 @@
class Room < DiningFacility
+ has_many :bookings, :foreign_key => 'dining_facility_id'
end
diff --git a/app/models/sale.rb b/app/models/sale.rb
index b70f6019..d1606c51 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -15,6 +15,7 @@ class Sale < ApplicationRecord
has_many :bookings
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
+ scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
REPORT_TYPE = {
"daily" => 0,
@@ -31,7 +32,7 @@ class Sale < ApplicationRecord
if (booking)
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
#get all order attached to this booking and combine into 1 invoice
-
+
booking.booking_orders.each do |order|
if booking.sale_id
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
@@ -289,15 +290,15 @@ class Sale < ApplicationRecord
end
end
- def self.daily_sales_list(from,to)
+ def self.daily_sales_list(from,to)
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
- SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
- SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
- SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
- SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
- SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount,
- SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
- SUM(case when (sale_payments.payment_method='credit') then sale_payments.payment_amount else 0 end) as credit_amount,
+ SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
+ SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
+ SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
+ SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
+ SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount,
+ SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
+ SUM(case when (sale_payments.payment_method='credit') then sale_payments.payment_amount else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
.where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to)
@@ -312,27 +313,27 @@ class Sale < ApplicationRecord
from_date = sale_date.beginning_of_day.utc - diff
to_date = sale_date.end_of_day.utc - diff
- total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
- IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
- IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
+ total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
+ IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
+ IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj")
.where("(sale_status = ? OR sale_status = ?) AND receipt_date between ? and ? AND total_amount != 0", 'completed', 'void', from_date, to_date)
-
+
total_sale.each do |sale|
grand_total = sale.grand_total
total_discount = sale.total_discount
- void_amount = sale.void_amount
- total = {:sale_date => pay.sale_date,
+ void_amount = sale.void_amount
+ total = {:sale_date => pay.sale_date,
:mpu_amount => pay.mpu_amount,
:master_amount => pay.master_amount,
:visa_amount => pay.visa_amount,
:jcb_amount => pay.jcb_amount,
:paypar_amount => pay.paypar_amount,
- :cash_amount => pay.cash_amount,
- :credit_amount => pay.credit_amount,
+ :cash_amount => pay.cash_amount,
+ :credit_amount => pay.credit_amount,
:foc_amount => pay.foc_amount,
- :total_discount => total_discount,
- :grand_total => grand_total,
+ :total_discount => total_discount,
+ :grand_total => grand_total,
:void_amount => void_amount,
:rounding_adj => sale.rounding_adj}
daily_total.push(total)
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index 72b97925..2ed4ebba 100644
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -67,7 +67,7 @@ class SalePayment < ApplicationRecord
end
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
- # Control for Paypar Cloud
+ # Control for Paypar Cloud
begin
response = HTTParty.get(url,
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
@@ -93,25 +93,23 @@ class SalePayment < ApplicationRecord
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
sale_data = Sale.find_by_sale_id(sale_id)
- if sale_data
- # Control for Paypar Cloud
- begin
- response = HTTParty.post(url,
- :body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
- :headers => {
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/json'
- },
- :timeout => 10
- )
- puts "vvvvvvvvv"
- puts response.to_json
- rescue Net::OpenTimeout
- response = false
- end
- else
- response = false;
- end
+ if sale_data
+ # Control for Paypar Cloud
+ begin
+ response = HTTParty.post(url,
+ :body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
+ :headers => {
+ 'Content-Type' => 'application/json',
+ 'Accept' => 'application/json'
+ },
+ :timeout => 10
+ )
+ rescue Net::OpenTimeout
+ response = false
+ end
+ else
+ response = false;
+ end
else
response =false;
@@ -247,10 +245,17 @@ class SalePayment < ApplicationRecord
end
def table_update_status(sale_obj)
- booking = Booking.find_by_sale_id(sale_obj.id)
+ status = true
+ booking = Booking.find_by_sale_id(sale_obj.id)
if booking
table = DiningFacility.find(booking.dining_facility_id)
- if table
+ bookings = table.bookings
+ bookings.each do |tablebooking|
+ if tablebooking.sale.sale_status != 'completed'
+ status = false
+ end
+ end
+ if status
table.status = "available"
table.save
end
@@ -283,7 +288,7 @@ class SalePayment < ApplicationRecord
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
- # Control for Paypar Cloud
+ # Control for Paypar Cloud
begin
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
receipt_no: receipt_no,auth_token:auth_token}.to_json,
diff --git a/app/models/table.rb b/app/models/table.rb
index 31614e12..db953c27 100644
--- a/app/models/table.rb
+++ b/app/models/table.rb
@@ -1,4 +1,4 @@
class Table < DiningFacility
has_many :dining_ins
-
+ has_many :bookings, :foreign_key => 'dining_facility_id'
end
diff --git a/app/models/table_booking.rb b/app/models/table_booking.rb
index 4b76f158..3f2b42d7 100644
--- a/app/models/table_booking.rb
+++ b/app/models/table_booking.rb
@@ -1,3 +1,2 @@
class TableBooking < Booking
-
end
diff --git a/app/views/layouts/_header_orgiami.html.erb b/app/views/layouts/_header_orgiami.html.erb
index 894e7a1f..9fc53f02 100644
--- a/app/views/layouts/_header_orgiami.html.erb
+++ b/app/views/layouts/_header_orgiami.html.erb
@@ -1,7 +1,7 @@
-
-
CASHIER STATION 1 - CLOCK
+
+ Cashier Station 1 - <%= Time.now.strftime('%a, %d %b %Y %H:%M:%S %p') %>
<% if current_login_employee %>
diff --git a/app/views/layouts/origami.html.erb b/app/views/layouts/origami.html.erb
index 179d9ae1..ea2c0ce4 100644
--- a/app/views/layouts/origami.html.erb
+++ b/app/views/layouts/origami.html.erb
@@ -10,7 +10,7 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
- <%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
@@ -23,7 +23,7 @@
<%=message%>
<% end %>
-
+
<% end %>
<%= yield %>
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb
index d1584f4a..db3b7413 100644
--- a/app/views/origami/customers/index.html.erb
+++ b/app/views/origami/customers/index.html.erb
@@ -2,12 +2,6 @@
@@ -15,11 +9,11 @@
-
+
-
+
<%= paginate @crm_customers %>
@@ -145,7 +139,6 @@
">
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
-
<% flash.each do |name, msg| %>
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
@@ -174,7 +167,7 @@
<%end %>
-
+
@@ -91,7 +91,7 @@
-
+
diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb
index 8099473d..09fe02b1 100644
--- a/app/views/origami/master/index.html.erb
+++ b/app/views/origami/master/index.html.erb
@@ -68,9 +68,9 @@
00
-
Nett
+
Nett
Del
-
Clr
+
Clr
@@ -91,7 +91,7 @@
-
+
@@ -133,6 +133,9 @@ $(document).on('click', '.cashier_number', function(event){
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
+ case 'nett':
+ var remain_amount = $('#validamount').val();
+ $('#amount').text(remain_amount);
break;
}
diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb
new file mode 100644
index 00000000..495e1514
--- /dev/null
+++ b/app/views/origami/moveroom/move_dining.html.erb
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @tables.each do |table| %>
+ <% if table.status == 'occupied' %>
+
+
+ <%= table.name %>
+
+
+ <% else %>
+
+
+ <%= table.name %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @rooms.each do |room| %>
+ <% if room.status == 'occupied' %>
+
+ <% else %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Receipt No:
+ <% if @status_sale == 'sale' %>
+ <%= @obj_sale.receipt_no rescue '' %>
+ <% end %>
+
+
+
+
Date: <%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+
+
+
+
+
+
+
+ | Items |
+ QTY
+ | Price
+ |
+
+
+ <%
+ sub_total = 0
+ if @status_sale == "sale"
+ @obj_sale.sale_items.each do |sale_item|
+ sub_total = sub_total + sale_item.price
+ %>
+
+ <% unless sale_item.price <= 0 %>
+
+ | <%= sale_item.product_name %> |
+ <%= sale_item.qty %> |
+ <%= sale_item.price %> |
+
+ <%
+ end
+ end
+ end
+
+ if @status_order == 'order'
+ unless @order_items.nil?
+ @order_items.each do |order_item |
+ sub_total = sub_total + order_item.price
+
+ unless order_item.price <= 0 %>
+
+ | <%= order_item.item_name %> |
+ <%= order_item.qty %> |
+ <%= order_item.qty*order_item.price %> |
+
+ <%
+ end
+ end
+ end
+ end
+ %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb
new file mode 100644
index 00000000..ad69b653
--- /dev/null
+++ b/app/views/origami/movetable/move_dining.html.erb
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @tables.each do |table| %>
+ <% if table.status == 'occupied' %>
+
+
+ <%= table.name %>
+
+
+ <% else %>
+
+
+ <%= table.name %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @rooms.each do |room| %>
+ <% if room.status == 'occupied' %>
+
+ <% else %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Receipt No:
+ <% if @status_sale == 'sale' %>
+ <%= @obj_sale.receipt_no rescue '' %>
+ <% end %>
+
+
+
+
Date: <%= @date.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+
+
+
+
+
+
+
+ | Items |
+ QTY
+ | Price
+ |
+
+
+ <%
+ sub_total = 0
+ if @status_sale == "sale"
+ @obj_sale.sale_items.each do |sale_item|
+ sub_total = sub_total + sale_item.price
+ %>
+
+ <% unless sale_item.price <= 0 %>
+
+ | <%= sale_item.product_name %> |
+ <%= sale_item.qty %> |
+ <%= sale_item.price %> |
+
+ <%
+ end
+ end
+ end
+
+ if @status_order == 'order'
+ unless @order_items.nil?
+ @order_items.each do |order_item |
+ sub_total = sub_total + order_item.price
+
+ unless order_item.price <= 0 %>
+
+ | <%= order_item.item_name %> |
+ <%= order_item.qty %> |
+ <%= order_item.qty*order_item.price %> |
+
+ <%
+ end
+ end
+ end
+ end
+ %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/movetable/moving.json.jbuilder b/app/views/origami/movetable/moving.json.jbuilder
new file mode 100644
index 00000000..8030f9fe
--- /dev/null
+++ b/app/views/origami/movetable/moving.json.jbuilder
@@ -0,0 +1,2 @@
+json.status true
+json.get_type @get_type
diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb
index ed176375..eb2267e7 100644
--- a/app/views/origami/mpu/index.html.erb
+++ b/app/views/origami/mpu/index.html.erb
@@ -68,9 +68,9 @@
00
-
Nett
+
Nett
Del
-
Clr
+
Clr
@@ -91,7 +91,7 @@
-
+
diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb
new file mode 100644
index 00000000..dccb3401
--- /dev/null
+++ b/app/views/origami/orders/show.html.erb
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @complete.each do |sale| %>
+
+
+ <%= sale.receipt_no %>
+
+
+ <% end %>
+
+
+
+
+
+
+ <% @tables.each do |table| %>
+ <% if table.status == 'occupied' %>
+
+
+ <%= table.name %>
+
+
+ <% else %>
+
+
+ <%= table.name %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @rooms.each do |room| %>
+ <% if room.status == 'occupied' %>
+
+ <% else %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @orders.each do |order| %>
+
+
+ <%= order.order_id %>
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Date: <%= @order.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+
+
+
+
+
+
+
+ | Items |
+ QTY
+ | Price
+ |
+
+
+ <%
+ sub_total = 0
+ @order.order_items.each do |sale_item|
+ sub_total = sub_total + sale_item.price
+ %>
+ <% unless sale_item.price <= 0 %>
+
+ | <%= sale_item.item_name %> |
+ <%= sale_item.qty %> |
+ <%= sale_item.price %> |
+
+ <%
+
+ end
+ end
+
+ %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/others_payments/index.html.erb b/app/views/origami/others_payments/index.html.erb
index 4b2397a2..9ca152ac 100644
--- a/app/views/origami/others_payments/index.html.erb
+++ b/app/views/origami/others_payments/index.html.erb
@@ -1,5 +1,5 @@
-
+
<% @payment_method_setting.each do |payment_method|%>
@@ -8,6 +8,10 @@
+
+
+
+
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index 91d5b6b2..fe36277b 100644
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -90,31 +90,30 @@
Amount Due
<%= @sale_data.grand_total %>
-
-
+
+
-
-
+
+
-
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
-
+
Other Payments
<%= @other %>
<% else %>
-
+
<% end %>
<% if @other != 0.0 %>
-
+
MPU
<%= @other %>
@@ -182,12 +181,12 @@
0.0
<% end %>
-
+
Balance
<%= @sale_data.grand_total %>
-
+
-
Nett
+
Nett
Del
-
Clr
+
Clr
@@ -235,7 +234,7 @@
-
+
diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb
index 83b24213..7789480f 100644
--- a/app/views/origami/redeem_payments/index.html.erb
+++ b/app/views/origami/redeem_payments/index.html.erb
@@ -66,9 +66,9 @@
00
-
Nett
+
Nett
Del
-
Clr
+
Clr
@@ -91,7 +91,7 @@
-
+
diff --git a/app/views/origami/request_bills/print.json.jbuilder b/app/views/origami/request_bills/print.json.jbuilder
new file mode 100644
index 00000000..08bf292c
--- /dev/null
+++ b/app/views/origami/request_bills/print.json.jbuilder
@@ -0,0 +1 @@
+json.status true
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
new file mode 100644
index 00000000..c1797158
--- /dev/null
+++ b/app/views/origami/rooms/show.html.erb
@@ -0,0 +1,274 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @complete.each do |sale| %>
+
+
+ <%= sale.receipt_no %>
+
+
+ <% end %>
+
+
+
+
+
+
+ <% @tables.each do |table| %>
+ <% if table.status == 'occupied' %>
+
+
+ <%= table.name %>
+
+
+ <% else %>
+
+
+ <%= table.name %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @rooms.each do |room| %>
+ <% if room.status == 'occupied' %>
+
+ <% else %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @orders.each do |order| %>
+
+
+ <%= order.order_id %>
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Receipt No:
+ <% if @status == 'sale' %>
+ <%= @obj.receipt_no rescue '' %>
+ <% end %>
+
+
+
+
Date: <%= @obj.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+
+
+
+
+
+
+
+ | Items |
+ QTY
+ | Price
+ |
+
+
+ <%
+ sub_total = 0
+ if @status == "sale"
+ @obj.sale_items.each do |sale_item|
+ sub_total = sub_total + sale_item.price
+ %>
+
+ <% unless sale_item.price <= 0 %>
+
+ | <%= sale_item.product_name %> |
+ <%= sale_item.qty %> |
+ <%= sale_item.price %> |
+
+ <%
+ end
+ end
+ end
+
+ if @status == 'order'
+ unless @order_items.nil?
+ @order_items.each do |order_item |
+ sub_total = sub_total + order_item.price
+
+ unless order_item.price <= 0 %>
+
+ | <%= order_item.item_name %> |
+ <%= order_item.qty %> |
+ <%= order_item.qty*order_item.price %> |
+
+ <%
+ end
+ end
+ end
+ end
+ %>
+
+
+
+
+
+
+ <%
+ if @status == 'sale'
+ unless @order_items.nil?
+ %>
+ Added New Order
+
+ <%
+ @order_items.each do |order_item |
+ %>
+
+
+ | <%= order_item.item_name %> |
+ <%= order_item.qty %> |
+ <%= order_item.qty*order_item.price %> |
+
+
+ <%
+ end
+ %>
+
+
+ <%
+ end
+ end
+ %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb
new file mode 100644
index 00000000..81face96
--- /dev/null
+++ b/app/views/origami/sales/show.html.erb
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ <% @complete.each do |sale| %>
+
+
+ <%= sale.receipt_no %>
+
+
+ <% end %>
+
+
+
+
+
+
+ <% @tables.each do |table| %>
+ <% if table.status == 'occupied' %>
+
+
+ <%= table.name %>
+
+
+ <% else %>
+
+
+ <%= table.name %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @rooms.each do |room| %>
+ <% if room.status == 'occupied' %>
+
+ <% else %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+ <% @orders.each do |order| %>
+
+
+ <%= order.order_id %>
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Receipt No:
+ <%= @sale.receipt_no rescue '' %>
+
+
+
+
Date: <%= @sale.created_at.utc.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
+
+
+
+
+
+
+
+ | Items |
+ QTY
+ | Price
+ |
+
+
+ <%
+ sub_total = 0
+ @sale.sale_items.each do |sale_item|
+ sub_total = sub_total + sale_item.price
+ %>
+
+ <% unless sale_item.price <= 0 %>
+
+ | <%= sale_item.product_name %> |
+ <%= sale_item.qty %> |
+ <%= sale_item.price %> |
+
+ <%
+
+ end
+ end
+
+ %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb
index 5eaf2e28..49f1290a 100644
--- a/app/views/origami/visa/index.html.erb
+++ b/app/views/origami/visa/index.html.erb
@@ -68,9 +68,9 @@
00
-
Nett
+
Nett
Del
-
Clr
+
Clr
@@ -91,7 +91,7 @@
-
+
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 9952a7bc..3a596cee 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -12,7 +12,7 @@ Rails.application.config.assets.version = '1.0'
# --- Waiter/ Cashier - Orgiami ----
Rails.application.config.assets.precompile += %w( origami.css )
-Rails.application.config.assets.precompile += %w( origami.js )
+# Rails.application.config.assets.precompile += %w( origami.js )
# -- Order Queue Station -----
Rails.application.config.assets.precompile += %w( OQS.css )
Rails.application.config.assets.precompile += %w( OQS.js )
diff --git a/config/routes.rb b/config/routes.rb
index 7bb463ee..90c7b0e8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -72,17 +72,24 @@ Rails.application.routes.draw do
#--------- Cashier ------------#
namespace :origami do
root "home#index"
- get "/:booking_id" => "home#index" do #origami/:booking_id will show
+ get "table/:dining_id" => "home#show" do #origami/:booking_id will show
# resources :discounts, only: [:index,:new, :create ] #add discount type
resources :customers #add customer type
end
+ post 'moving' => "movetable#moving"
+
+ get 'table/:dining_id/movetable' => "movetable#move_dining"
+ get 'table/:dining_id/moveroom' => "moveroom#move_dining"
+ get 'sale/:sale_id' => 'sales#show'
+ get 'room/:room_id' => 'rooms#show'
+ get 'order/:order_id' => "orders#show"
post '/:booking_id' => 'home#item_show'
get "/:id/discount" => "discounts#index"
post "/:id/discount" => "discounts#create"
- get "/:id/request_bills" => "request_bills#print"
+ post "/:id/request_bills" => "request_bills#print"
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
#--------- Payment ------------#
get 'sale/:sale_id/payment' => 'payments#show'