diff --git a/app/assets/javascripts/origami/payment.js b/app/assets/javascripts/origami/payment.js new file mode 100644 index 00000000..e21a369e --- /dev/null +++ b/app/assets/javascripts/origami/payment.js @@ -0,0 +1,113 @@ +// $(document).on('touchstart click', '.keypad', function(event){ +// event.stopPropagation(); +// event.preventDefault(); +// if(event.handled !== true) { +// +// // Do your magic here. +// var input_value = $(this).attr("data-value"); +// switch (input_value) { +// +// case 'delete': +// process_delete_payment(); +// break; +// +// case 'foc': +// remove_input_action(); +// $(".foc").attr("data-action","true"); +// if(customerName.toString() != " "){ //if already chosen customer +// if($("#foc_reason_lists").attr("foc_reason") == ' '){ +// alert("Please! Choose or Add FOC reason"); +// foc_additional_form(); +// } +// else{ +// process_foc_payment(); +// } +// } +// else{ +// alert("Please! Choose or Save Customer"); +// foc_additional_form(); +// } +// break; +// +// case 'nett': +// remove_input_action(); +// $(".nett").attr("data-action","true"); +// if($(".credit_note_payment").hasClass("payment_selected")){ +// if(customerName == " "){ +// alert("Please! Choose or Save Customer"); +// showCustomer(); +// } +// else{ +// $("#accept_payment_btn").attr("data-payment","credit"); +// process_nett_payment(); +// } +// } +// else{ +// process_nett_payment(); +// } +// break; +// +// case 'edit': +// process_edit_invoice(); +// break; +// +// case 'cancel': +// remove_input_action(); +// var status = $("#label_amountdue").attr("data-status"); +// if (status != 'completed' && status != 'void'){ +// $(".cancel").attr("data-action","true"); +// var message = confirm("Are you sure to void? Please, add reason!"); +// if (message == true) { +// $(".additional_form").hide(); +// $("#void_sale_additional_form").show(); +// process_cancel_payment(); +// } +// } +// else{ +// $(".cancel").addClass("dim"); +// } +// break; +// +// case 'ent': +// amount_due = parseFloat($("#label_amountdue").attr("data-original")); +// other_amt = parseFloat($("#label_cash_amount").attr("data-value")); +// credit_amount = parseFloat($("#label_credit_note").text()); +// if ($(".credit_note_payment").hasClass("payment_selected") && credit_amount > 0){ +// if(customerName.toString() != " "){ +// if(credit_amount > (amount_due - other_amt)){ +// alert("You shouldn't exceed the amount due."); +// } +// else{ +// $("#accept_payment_btn").attr("data-payment","credit"); +// update_balance_due(); +// } +// } +// else{ +// alert("Please! Choose or Save Customer"); +// } +// } +// else{ +// update_balance_due(); +// } +// +// break; +// case 'clear': +// process_clear_payment(); +// break; +// +// default: +// +// var existing_value = $(".payment_selected span").text(); +// +// if (existing_value == "0" || existing_value == "0.00") { existing_value = ""; } +// existing_value = existing_value + input_value; +// $(".payment_selected span").text(existing_value); +// +// } +// +// +// event.handled = true; +// } else { +// return false; +// } +// }); diff --git a/app/assets/stylesheets/orgiami.scss b/app/assets/stylesheets/orgiami.scss index b0f802f1..70e1fe8b 100644 --- a/app/assets/stylesheets/orgiami.scss +++ b/app/assets/stylesheets/orgiami.scss @@ -7,3 +7,21 @@ // min-height: 75rem; // padding-top: 4.5rem; // } + +.cashier_number{ + height:76px; + line-height:80px; + text-align:center; + background:#54A5AF; + float:left; + margin:2px; + font-size:20px; + color:white; + cursor:pointer; +} +.cashier_number:hover{ + background:#A9F5F2; +} +.long{ + width:100% +} diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index d4940907..a98c8f3d 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -10,7 +10,7 @@ class Api::BillController < Api::ApiController if (params[:booking_id]) @sale = Sale.new @status = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name) - + elsif (params[:order_id]) @sale = Sale.new @status = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name) diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index cbca1424..be5045d9 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -4,12 +4,13 @@ class Origami::HomeController < BaseOrigamiController @order_rooms = Order.get_order_rooms() @orders = Order.get_orders() end + def show str = [] - @order_details = OrderItem.get_order_items_details(params[:order_id]) - @order_details.each do |ord_detail| + @order_details = OrderItem.get_order_items_details(params[:order_id]) + @order_details.each do |ord_detail| str.push(ord_detail) - end - render :json => str.to_json + end + render :json => str.to_json end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 447d1282..a09b81fe 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -1,6 +1,14 @@ class Origami::PaymentsController < BaseOrigamiController + + def index + end + def create end + + def show + + end end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 9f971289..40fc27f1 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -1,22 +1,33 @@ class Origami::RequestBillsController < BaseOrigamiController - def show + + def create @sale = Sale.new check_order = Order.find_by_id(params[:id]) + if check_order - @order_details = OrderItem.get_order_items_details(check_order.id) - @order_details = OrderItem.get_order_items_details(check_order.id) + @order_details = OrderItem.get_order_items_details(check_order.id) + @order_details = OrderItem.get_order_items_details(check_order.id) @status, @sale_id = @sale.generate_invoice_from_order(check_order.id, nil,current_login_employee.name) @sale_data = Sale.find_by_id(@sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_id) - end + end + unique_code="ReceiptBillPdf" + print_settings=PrintSetting.find_by_unique_code(unique_code) printer = Printer::ReceiptPrinter.new(print_settings) printer.print_receipt_bill(print_settings,@sale_items,@sale) - + end + + + def show + sale_id = params[:sale_id] + if Sale.exists?(sale_id) + @sale_data = Sale.find_by_id(sale_id) + end end end diff --git a/app/models/booking.rb b/app/models/booking.rb index c34ecf42..fcd0c909 100644 --- a/app/models/booking.rb +++ b/app/models/booking.rb @@ -1,6 +1,6 @@ class Booking < ApplicationRecord #primary key - need to be unique - + belongs_to :dining_facility, :optional => true belongs_to :sale, :optional => true has_many :booking_orders diff --git a/app/models/order.rb b/app/models/order.rb index f571faa9..dc969187 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -223,8 +223,7 @@ class Order < ApplicationRecord left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.id") .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true) - - .group("orders.id") + .group("orders.id, order_items.id,dining_facilities.name") end #Origami: Cashier : to view order type Room @@ -248,8 +247,7 @@ class Order < ApplicationRecord left join bookings on bookings.id = booking_orders.id left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join order_items on order_items.order_id = orders.id") - .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) - .group("orders.id") + .group("orders.id,order_items.id,dining_facilities.name") end end diff --git a/app/models/sale.rb b/app/models/sale.rb index ca3bd631..1a1c4b67 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -28,7 +28,8 @@ class Sale < ApplicationRecord end booking.sale_id = sale_id end - + order = booking.booking_orders.take.order + link_order_sale(order.id) return status end end diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 7dcc1ba8..cb11da1d 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -24,7 +24,7 @@
<%=order_table.total_price%>
@@ -40,9 +40,9 @@<%=order.total_price%>
@@ -110,8 +110,8 @@| @@ -36,9 +36,8 @@ | <%=(sale_item.qty*sale_item.unit_price)%> | -