fixed conflict
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
//= require cable
|
||||
|
||||
$(document).ready(function(){
|
||||
// auto refresh every 10 seconds
|
||||
setTimeout(function(){
|
||||
window.location.reload(1);
|
||||
}, 10000);
|
||||
|
||||
$('.queue_station').on('click',function(){
|
||||
var orderZone=$(this).children().children().children('.order-zone').text();
|
||||
var orderItem=$(this).children().children().children('.order-item').text();
|
||||
@@ -39,7 +44,8 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
// complete for queue item
|
||||
$('.order-complete').on('click',function(){
|
||||
$('.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 params = { 'id':assigned_item_id };
|
||||
@@ -72,8 +78,10 @@ $(document).ready(function(){
|
||||
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
|
||||
|
||||
alert("updated!");
|
||||
// Page reload
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#print_order_item').on('click',function(){
|
||||
|
||||
@@ -19,8 +19,17 @@
|
||||
//= 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("disabled");
|
||||
control_button(order_status);
|
||||
|
||||
$(".orders").on('click', function(){
|
||||
$("#order-sub-total").text('');
|
||||
@@ -38,10 +47,6 @@ $(document).ready(function(){
|
||||
// Enable/Disable Button
|
||||
control_button(order_status);
|
||||
|
||||
//for customer button
|
||||
$("#customer").removeAttr('disabled');
|
||||
|
||||
|
||||
var customer_id=$(this).find(".customer-id").text();
|
||||
show_customer_details(customer_id);
|
||||
|
||||
@@ -66,12 +71,15 @@ $(document).ready(function(){
|
||||
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;
|
||||
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()
|
||||
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_no").text(receipt_no);
|
||||
$("#cashier").text(cashier == null ? "" : cashier);
|
||||
@@ -198,11 +206,11 @@ $(document).ready(function(){
|
||||
var url = "origami/"+customer_id+"/get_customer/"
|
||||
}
|
||||
|
||||
$('.customer_detail').removeClass('hide');
|
||||
|
||||
$('.customer_detail').removeClass('hide');
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
@@ -212,15 +220,14 @@ $(document).ready(function(){
|
||||
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');
|
||||
console.log(balance);
|
||||
row =
|
||||
$('.rebate_amount').removeClass('hide');
|
||||
row =
|
||||
'<td class="charges-name">' + data["response_data"]["data"][i]["accountable_type"] +'</td>'
|
||||
+'<td class="item-attr">' + balance + '</td>';
|
||||
+'<td class="item-attr">' + balance + '</td>';
|
||||
|
||||
$(".rebate_amount").html(row);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -283,18 +290,21 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
/* Button Control by Status */
|
||||
function control_button(order_status){
|
||||
if(order_status=="billed"){
|
||||
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);
|
||||
}
|
||||
else if(order_status=="new") {
|
||||
$("#customer").prop('disabled', false);
|
||||
$("#request_bills").prop('disabled', false);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
}
|
||||
else {
|
||||
$("#customer").prop('disabled', true);
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
|
||||
40
app/assets/javascripts/payment.js
Normal file
40
app/assets/javascripts/payment.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// number key pad
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -16,5 +16,6 @@
|
||||
}
|
||||
|
||||
.selected-item {
|
||||
color: #fff !important;
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Api::InvoicesController < ActionController::API
|
||||
before :authenticate_token
|
||||
before :set_sale_params, only:[:show, :update, :destroy]
|
||||
# before :authenticate_token
|
||||
# before :set_sale_params, only:[:show, :update, :destroy]
|
||||
|
||||
#List open invoices for today.
|
||||
def index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Api::MembershipsController < ActionController::API
|
||||
before :authenticate_token
|
||||
#before :authenticate_token
|
||||
|
||||
|
||||
|
||||
#Add Membership to invoice
|
||||
def create
|
||||
|
||||
|
||||
@@ -29,56 +29,56 @@ class Api::PaymentsController < ActionController::API
|
||||
|
||||
#:received_amount, :card_payment_reference, :vochure_no, :giftcard_no,
|
||||
#:customer_id, :external_payment_status
|
||||
switch (payment_method)
|
||||
case "cash"
|
||||
case payment_method
|
||||
when "cash"
|
||||
sale_payment.payment_method = "cash"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "creditnote"
|
||||
when "creditnote"
|
||||
sale_payment.payment_method = "creditnote"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.customer_id = params[:customer_id]
|
||||
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "visa"
|
||||
when "visa"
|
||||
sale_payment.payment_method = "visa"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "master"
|
||||
when "master"
|
||||
sale_payment.payment_method = "master"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "jcb"
|
||||
when "jcb"
|
||||
sale_payment.payment_method = "jcb"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "mpu"
|
||||
when "mpu"
|
||||
sale_payment.payment_method = "mpu"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "unionpay"
|
||||
when "unionpay"
|
||||
sale_payment.payment_method = "unionpay"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "vochure"
|
||||
when "vochure"
|
||||
sale_payment.payment_method = "vochure"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.customer_id = params[:customer_id]
|
||||
sale_payment.payment_reference = params[:vochure_no]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "giftcard"
|
||||
when "giftcard"
|
||||
sale_payment.payment_method = "giftcard"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.customer_id = params[:customer_id]
|
||||
sale_payment.payment_reference = params[:giftcard_no]
|
||||
@status, @invoice = sale_payment.process_payment(sale_payment, current_login_employee.name)
|
||||
case "paypar"
|
||||
when "paypar"
|
||||
sale_payment.payment_method = "paypar"
|
||||
sale_payment.received_amount = params[:amount]
|
||||
sale_payment.payment_reference = params[:payment_reference]
|
||||
|
||||
@@ -10,9 +10,12 @@ class HomeController < ApplicationController
|
||||
@login_form.emp_id = params[:login_form][:emp_id]
|
||||
@login_form.password = params[:login_form][:password]
|
||||
@employee = Employee.login(@login_form.emp_id, @login_form.password)
|
||||
if @employee
|
||||
if @employee.role == "administrator"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "cashier"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
|
||||
@@ -6,10 +6,13 @@ class Oqs::PrintController < ApplicationController
|
||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# printer for each stations
|
||||
printer_name = assigned_item.order_queue_station.printer_name
|
||||
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings,assigned_item.order_id, assigned_item.item_code )
|
||||
order_queue_printer.print_order_item(printer_name,assigned_item.order_id, assigned_item.item_code )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
@@ -25,10 +28,13 @@ class Oqs::PrintController < ApplicationController
|
||||
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# printer for each stations
|
||||
printer_name = assigned_item.order_queue_station.printer_name
|
||||
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_summary(print_settings,assigned_item.order_id)
|
||||
order_queue_printer.print_order_summary(printer_name,assigned_item.order_id)
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
|
||||
@@ -11,12 +11,11 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@selected_item = Order.find(params[:booking_id])
|
||||
@selected_item_type="Order"
|
||||
end
|
||||
end
|
||||
puts params[:booking_id]
|
||||
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
|
||||
|
||||
|
||||
@@ -2,6 +2,21 @@ class Origami::JcbController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit jcb_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@jcbcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "jcb"
|
||||
@jcbcount = @jcbcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_jcb = total - @jcbcount - others
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -10,7 +25,7 @@ class Origami::JcbController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,20 @@ class Origami::MasterController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit master_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@mastercount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "master"
|
||||
@mastercount = @mastercount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_master = total - @mastercount - others
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -10,7 +24,7 @@ class Origami::MasterController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,21 @@ class Origami::MpuController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit mpu_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@mpucount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "mpu"
|
||||
@mpucount = @mpucount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_mpu = total - @mpucount - others
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -11,6 +11,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
|
||||
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.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,25 +34,18 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if Sale.exists?(sale_id)
|
||||
@cash = 0.0
|
||||
@other = 0.0
|
||||
@ppamount = 0.0
|
||||
@visacount= 0.0
|
||||
@jcbcount= 0.0
|
||||
@mastercount = 0.0
|
||||
@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)
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
# get member information
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
if response["data"]==true
|
||||
@@ -45,21 +53,28 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if res["accountable_type"] == "RebateAccount"
|
||||
@balance = res["balance"]
|
||||
@accountable_type = res["accountable_type"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#end customer amount
|
||||
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
@cash = spay.payment_amount
|
||||
end
|
||||
if spay.payment_method == "mpu" || spay.payment_method == "paypar"
|
||||
if spay.payment_method == "mpu"
|
||||
@other += spay.payment_amount
|
||||
elsif spay.payment_method == "paypar"
|
||||
@ppamount += spay.payment_amount
|
||||
elsif spay.payment_method == "visa"
|
||||
@visacount += spay.payment_amount
|
||||
elsif spay.payment_method == "jcb"
|
||||
@jcbcount += spay.payment_amount
|
||||
elsif spay.payment_method == "master"
|
||||
@mastercount += spay.payment_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
|
||||
# Print Request Bill and add to sale tables
|
||||
def print
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
@@ -9,7 +8,7 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
check_booking = Booking.find_by_booking_id(booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@@ -20,10 +19,11 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.where('customer_id=' + @sale_data.customer_id)
|
||||
|
||||
# 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)
|
||||
# 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)
|
||||
|
||||
@@ -2,6 +2,20 @@ class Origami::VisaController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@visacount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@visacount = @visacount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_visa = total - @visacount - others
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -10,7 +24,7 @@ class Origami::VisaController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class Transactions::OrdersController < ApplicationController
|
||||
|
||||
end
|
||||
end
|
||||
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
|
||||
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(2)
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#Form object to use during the installation process - will handle creation of shop model into db after verification from the cloud
|
||||
#provising service through license verification
|
||||
|
||||
class ShopForm < ActiveModel
|
||||
:attr_accessor :logo, :name, :address, :township, :city, :state, :country, :license, :base_currency, :password, :password_confirmation
|
||||
|
||||
end
|
||||
# class ShopForm < ActiveModel
|
||||
# # attr_accessor :logo, :name, :address, :township, :city, :state, :country, :license, :base_currency, :password, :password_confirmation
|
||||
#
|
||||
# end
|
||||
|
||||
@@ -33,7 +33,6 @@ class Customer < ApplicationRecord
|
||||
# end
|
||||
|
||||
def self.get_member_account(customer)
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
|
||||
@@ -25,7 +25,7 @@ class Order < ApplicationRecord
|
||||
booking = nil
|
||||
|
||||
if self.new_booking
|
||||
|
||||
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
@@ -230,20 +230,25 @@ class Order < ApplicationRecord
|
||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_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,orders.status")
|
||||
# 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
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view booking order Table
|
||||
def self.get_completed_order
|
||||
completed_orders = Booking.select("sales.receipt_no,orders.status as order_status,orders.order_id,
|
||||
completed_orders = Booking.select("sales.receipt_no, sales.sale_status, orders.status as order_status,orders.order_id,
|
||||
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id")
|
||||
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||
.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("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
|
||||
.group("sales.sale_id")
|
||||
# For PG
|
||||
#bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order type Room
|
||||
@@ -255,10 +260,12 @@ class Order < ApplicationRecord
|
||||
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,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")
|
||||
# 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
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order type Room
|
||||
@@ -271,31 +278,43 @@ class Order < ApplicationRecord
|
||||
left join order_items on order_items.order_id = orders.order_id")
|
||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no")
|
||||
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view orders
|
||||
def self.get_orders
|
||||
from = Time.now.beginning_of_day.utc
|
||||
to = Time.now.end_of_day.utc
|
||||
orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
||||
orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
||||
,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
left join order_items on order_items.order_id = orders.order_id
|
||||
left join sale_orders on sale_orders.order_id = orders.order_id
|
||||
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id")
|
||||
orders=Booking.select("sales.receipt_no, sales.sale_status as sale_status, orders.status as order_status,
|
||||
orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id,
|
||||
bookings.booking_id,orders.customer_id as customer_id,
|
||||
sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||
.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')")
|
||||
|
||||
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
||||
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
||||
# ,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
# .joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
# left join bookings on bookings.booking_id = booking_orders.order_id
|
||||
# left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
# left join order_items on order_items.order_id = orders.order_id
|
||||
# left join sale_orders on sale_orders.order_id = orders.order_id
|
||||
# left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
# .where("(orders.status = 'new' or orders.status = 'billed')")
|
||||
# .group("orders.order_id")
|
||||
# For PG
|
||||
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
# .group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id")
|
||||
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
where("order_id LIKE ?", "%#{search}%")
|
||||
where("order_id LIKE ?", "%#{search}%")
|
||||
else
|
||||
find(:all)
|
||||
end
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
def print_order_item(printer_settings,order_id, item_code)
|
||||
def print_order_item(printer_name,order_id, item_code)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_item= print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||
pdf = OrderItemPdf.new(order_item[0],printer_settings)
|
||||
pdf = OrderItemPdf.new(order_item[0])
|
||||
pdf.render_file "tmp/receipt.pdf"
|
||||
self.print("tmp/receipt.pdf")
|
||||
self.print("tmp/receipt.pdf", printer_name)
|
||||
end
|
||||
|
||||
def print_order_summary(printer_settings,order_id)
|
||||
def print_order_summary(printer_name,order_id)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order=print_query('order_summary',order_id)
|
||||
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(order,printer_settings)
|
||||
pdf = OrderSummaryPdf.new(order)
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
self.print(filename, printer_name)
|
||||
end
|
||||
|
||||
# Query for OQS with status
|
||||
|
||||
@@ -65,11 +65,11 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
end
|
||||
|
||||
#Bill Receipt Print
|
||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, food_total, beverage_total)
|
||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, food_total, beverage_total, member_info = nil)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total)
|
||||
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
|
||||
|
||||
@@ -13,7 +13,7 @@ class Sale < ApplicationRecord
|
||||
has_many :sale_payments
|
||||
has_many :sale_orders
|
||||
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}'") }
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by)
|
||||
@@ -56,7 +56,12 @@ class Sale < ApplicationRecord
|
||||
#Default Tax - Values
|
||||
self.tax_type = "exclusive"
|
||||
|
||||
# set cashier by current login
|
||||
# TODO: requested_by is string , can't cast to id. error occur. please fix
|
||||
# self.cashier_id = requested_by.id
|
||||
self.cashier_name = requested_by
|
||||
self.requested_by = requested_by
|
||||
|
||||
self.requested_at = DateTime.now.utc
|
||||
|
||||
Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}"
|
||||
@@ -252,7 +257,7 @@ class Sale < ApplicationRecord
|
||||
if self.receipt_no.nil?
|
||||
prefix = DateTime.now().utc
|
||||
#self.receipt_no = prefix.to_s + "/" + self.shit_id.to_s + "/" + SeedGenerator.new_receipt_no().to_s
|
||||
self.receipt_no = prefix.strftime("%Y%m%d") + "/" + SeedGenerator.new_receipt_no().to_s
|
||||
self.receipt_no = prefix.strftime("%Y%m%d") + "-" + SeedGenerator.new_receipt_no().to_s
|
||||
|
||||
self.receipt_date = prefix
|
||||
Rails.logger.debug "Receipt No #{self.receipt_no} | Date #{ self.receipt_date.to_s}"
|
||||
@@ -262,7 +267,7 @@ class Sale < ApplicationRecord
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
where("receipt_no LIKE ?", "%#{search}%",)
|
||||
where("receipt_no LIKE ?", "%#{search}%",)
|
||||
else
|
||||
find(:all)
|
||||
end
|
||||
|
||||
@@ -256,10 +256,11 @@ class SalePayment < ApplicationRecord
|
||||
receipt_no = sObj.receipt_no
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||
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,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
class OrderItemPdf < Prawn::Document
|
||||
attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width
|
||||
def initialize(order_item, print_settings)
|
||||
self.page_width = 300
|
||||
self.page_height = 400
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(order_item)
|
||||
self.page_width = 254
|
||||
self.page_height = 1450
|
||||
self.margin = 10
|
||||
self.price_width = 50
|
||||
self.qty_width = 50
|
||||
self.item_width = self.page_width - (self.price_width + self.qty_width)
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 34
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width + (self.margin*4))
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width)
|
||||
self.receipt_width=130
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=80
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
@@ -17,10 +18,10 @@ class OrderItemPdf < Prawn::Document
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
self.header_font_size = 14
|
||||
self.item_font_size = 12
|
||||
|
||||
text "#{order_item.dining}", :size => self.header_font_size,:align => :center
|
||||
text "#{order_item.dining}", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
@@ -35,36 +36,43 @@ class OrderItemPdf < Prawn::Document
|
||||
def order_info(order_by, order_at)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width - 50, :height => self.item_height) do
|
||||
text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 50,y_position], :width => self.item_width + 50, :height => self.item_height) do
|
||||
text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
move_down 20
|
||||
move_down 10
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Item", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# No Need for Order Item
|
||||
# bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
# text "Item", :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
text "Qty", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
# bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
# text "Qty", :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
# stroke_horizontal_rule
|
||||
# move_down 5
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, self.page_width
|
||||
move_down 5
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -78,7 +86,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
text "#{order_item.qty}", :size => self.item_font_size,:align => :right
|
||||
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
class OrderSummaryPdf < Prawn::Document
|
||||
attr_accessor :receipt_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:item_description_width
|
||||
def initialize(order, print_settings)
|
||||
self.page_width = 300
|
||||
self.page_height = 400
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(order)
|
||||
self.page_width = 254
|
||||
self.page_height = 1450
|
||||
self.margin = 10
|
||||
self.price_width = 60
|
||||
self.qty_width = 60
|
||||
self.item_width = self.page_width - (self.price_width + self.qty_width)
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 34
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width + (self.margin*4))
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width)
|
||||
self.receipt_width=130
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=100
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -19,7 +20,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
text "#{order[0].dining}", :size => self.header_font_size,:align => :center
|
||||
text "#{order[0].dining}", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
@@ -35,17 +36,19 @@ class OrderSummaryPdf < Prawn::Document
|
||||
def order_info(order_by, order_at)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width - 20, :height => self.item_height) do
|
||||
text "OrderBy:#{order_by} ", :size => self.item_font_size,:align => :left
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.item_width - 20,y_position], :width => self.item_width + 20, :height => self.item_height) do
|
||||
text "Date:#{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
move_down 20
|
||||
move_down 10
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
@@ -57,7 +60,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
text "Qty", :size => self.item_font_size,:align => :right
|
||||
text "Qty", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -79,7 +82,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :right
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class ReceiptBillPdf < Prawn::Document
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total)
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info = nil)
|
||||
self.page_width = 250
|
||||
self.page_height = 1450
|
||||
self.margin = 10
|
||||
@@ -8,9 +8,9 @@ class ReceiptBillPdf < Prawn::Document
|
||||
self.qty_width = 20
|
||||
self.total_width = 40
|
||||
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width)+(self.margin*4))
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=80
|
||||
self.label_width=80
|
||||
|
||||
# @item_width = self.page_width.to_i / 2
|
||||
# @qty_width = @item_width.to_i / 3
|
||||
@@ -31,7 +31,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
cashier_info(sale_data, customer_name)
|
||||
line_items(sale_items, food_total, beverage_total)
|
||||
all_total(sale_data)
|
||||
all_total(sale_data)
|
||||
|
||||
if member_info != nil
|
||||
member_info(member_info)
|
||||
end
|
||||
|
||||
footer
|
||||
end
|
||||
|
||||
@@ -96,7 +101,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
stroke_horizontal_rule
|
||||
|
||||
add_line_item_row(sale_items, food_total, beverage_total)
|
||||
|
||||
|
||||
end
|
||||
|
||||
def add_line_item_row(sale_items, food_total, beverage_total)
|
||||
@@ -110,17 +115,15 @@ class ReceiptBillPdf < Prawn::Document
|
||||
total_price = item.qty*item.unit_price
|
||||
price = item.unit_price
|
||||
product_name = item.product_name
|
||||
|
||||
|
||||
|
||||
y_position = cursor
|
||||
|
||||
pad_top(15) {
|
||||
# @item_width.to_i + @half_qty.to_i
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :overflow => :shrink_to_fix, :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.to_i}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{total_price}", :at =>[(item_name_width+2),y_position], :width =>self.total_width+2, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
}
|
||||
move_down 3
|
||||
end
|
||||
@@ -151,7 +154,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
|
||||
def all_total(sale_data)
|
||||
item_name_width = self.item_width
|
||||
item_name_width = self.item_width
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
|
||||
@@ -183,7 +186,24 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
move_down 5
|
||||
# stroke_horizontal_rule
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info)
|
||||
move_down 7
|
||||
if member_info["data"] == true
|
||||
member_info["data"].each do |res|
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "#{ res["accountable_type"] } : #{ res["balance"] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def footer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class MenuReport < Compendium::Report
|
||||
query :list, collect: :active_record do |params|
|
||||
Menu.all
|
||||
end
|
||||
end
|
||||
# class MenuReport < Compendium::Report
|
||||
# query :list, collect: :active_record do |params|
|
||||
# Menu.all
|
||||
# end
|
||||
# end
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
<nav class="pagination">
|
||||
<%= first_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag unless current_page.first? %>
|
||||
<% each_page do |page| -%>
|
||||
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
||||
<% each_page do |page| %>
|
||||
<% if page.left_outer? || page.right_outer? || page.inside_window? %>
|
||||
<%= page_tag page %>
|
||||
<% elsif !page.was_truncated? -%>
|
||||
<% elsif !page.was_truncated? %>
|
||||
<%= gap_tag %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= next_page_tag unless current_page.last? %>
|
||||
<%= last_page_tag unless current_page.last? %>
|
||||
</nav>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
@@ -31,28 +31,28 @@
|
||||
customer_id = ""
|
||||
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if cpo.order_status == 'new'
|
||||
unique_id=cpo.booking_id
|
||||
# sale_status=""
|
||||
# if cpo.order_status == 'new'
|
||||
# unique_id=cpo.booking_id
|
||||
|
||||
customer_id=cpo.order_customer_id
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if cpo.order_id == @selected_item.order_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
else
|
||||
unique_id=cpo.sale_id
|
||||
customer_id=cpo.sale_customer_id
|
||||
sale_status="paid"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
# customer_id=cpo.order_customer_id
|
||||
# # check selected item and assign
|
||||
# if @selected_item_type == "Sale"
|
||||
# if cpo.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
unique_id=cpo.sale_id
|
||||
customer_id=cpo.sale_customer_id
|
||||
sale_status="paid"
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if unique_id == @selected_item.sale_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
# end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
@@ -69,9 +69,7 @@
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= cpo.order_status %>
|
||||
</span>
|
||||
<span class="orders-order-status"><%= cpo.sale_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
@@ -84,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
|
||||
@@ -101,11 +99,11 @@
|
||||
unique_id=bko.booking_id
|
||||
customer_id=bko.order_customer_id
|
||||
# check selected item and assign
|
||||
if !@selected_item.nil?
|
||||
if bko.order_id == @selected_item.order_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
# if @selected_item != nil
|
||||
# if bko.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=bko.sale_id
|
||||
customer_id=bko.sale_customer_id
|
||||
@@ -132,9 +130,7 @@
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= bko.order_status %>
|
||||
</span>
|
||||
<span class="orders-order-status"><%= bko.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
@@ -165,11 +161,11 @@
|
||||
unique_id=rmo.booking_id
|
||||
customer_id=rmo.order_customer_id
|
||||
# check selected item and assign
|
||||
if @selected_item != nil
|
||||
if rmo.order_id == @selected_item.order_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
# if @selected_item != nil
|
||||
# if rmo.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=rmo.sale_id
|
||||
customer_id=rmo.sale_customer_id
|
||||
@@ -196,9 +192,7 @@
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= rmo.order_status %>
|
||||
</span>
|
||||
<span class="orders-order-status"><%= rmo.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
@@ -213,7 +207,7 @@
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@orders.each do |odr|
|
||||
@orders.each do |odr|
|
||||
# No Show completed
|
||||
if odr.sale_status == 'completed'
|
||||
next
|
||||
@@ -227,11 +221,11 @@
|
||||
if odr.order_status == 'new'
|
||||
unique_id=odr.booking_id
|
||||
customer_id = odr.order_customer_id
|
||||
if @selected_item != nil
|
||||
if odr.order_id == @selected_item.order_id
|
||||
sale_status = sale_status + " selected-item"
|
||||
end
|
||||
end
|
||||
# if @selected_item != nil
|
||||
# if odr.order_id == @selected_item.order_id
|
||||
# sale_status = sale_status + " selected-item"
|
||||
# end
|
||||
# end
|
||||
else
|
||||
unique_id=odr.sale_id
|
||||
customer_id = odr.sale_customer_id
|
||||
@@ -258,9 +252,7 @@
|
||||
</p>
|
||||
<p class="card-text">
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= odr.order_status %>
|
||||
</span>
|
||||
<span class="orders-order-status"><%= odr.order_status %></span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
@@ -308,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>
|
||||
@@ -327,8 +319,7 @@
|
||||
%>
|
||||
|
||||
<%
|
||||
# For Order Items
|
||||
sub_total = 0
|
||||
# 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)
|
||||
@@ -386,13 +377,12 @@
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-lg btn-block">Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">Req.Bill</button>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block">Discount</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
||||
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block" disabled>Pay</button>
|
||||
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block">Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,41 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>JCB</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="margin-top:10px;padding-top:20px;">
|
||||
<div class="rebate-form">
|
||||
<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">You can pay upto </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_jcb %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @jcbcount != 0 %>
|
||||
<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">Recent JCB paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@jcbcount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% 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">Valid Rebate Amount</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<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">Redeem Amount</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -21,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -61,23 +83,26 @@
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="pay purple" id="redeem">Pay</div>
|
||||
<div class="pay purple" id="jcb_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script>
|
||||
// number key pad
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
@@ -85,24 +110,24 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#used_amount').html("0.0");
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -112,33 +137,23 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
}
|
||||
});
|
||||
|
||||
$("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseFloat($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert("Please type valid amount");
|
||||
|
||||
}else if(valid_amount< redeem_amount){
|
||||
alert(" Insufficient Amount!")
|
||||
}else{
|
||||
if(redeem_amount <= "<%= @food_prices %>"){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paypar_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
alert("Redeem Amount is over!");
|
||||
$('#jcb_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
if(parseFloat(amount) <= "<%= @can_jcb %>"){
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_jcb_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("Paid Amount is over!");
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,19 +1,41 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>Master</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="margin-top:10px;padding-top:20px;">
|
||||
<div class="rebate-form">
|
||||
<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">You can pay upto </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_master %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @mastercount != 0 %>
|
||||
<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">Recent Master paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@mastercount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% 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">Valid Rebate Amount</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<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">Redeem Amount</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -21,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -61,23 +83,25 @@
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="pay purple" id="redeem">Pay</div>
|
||||
<div class="pay purple" id="master_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script>
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
@@ -85,24 +109,24 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#used_amount').html("0.0");
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -111,34 +135,22 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseFloat($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert("Please type valid amount");
|
||||
|
||||
}else if(valid_amount< redeem_amount){
|
||||
alert(" Insufficient Amount!")
|
||||
$('#master_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
if(parseFloat(amount) <= "<%= @can_master %>"){
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_master_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
if(redeem_amount <= "<%= @food_prices %>"){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paypar_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
alert("Redeem Amount is over!");
|
||||
}
|
||||
alert("Paid Amount is over!");
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,19 +1,41 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>MPU</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="margin-top:10px;padding-top:20px;">
|
||||
<div class="rebate-form">
|
||||
<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">Valid Rebate Amount</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay upto </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_mpu %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @mpucount != 0 %>
|
||||
<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">Recent MPU paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@mpucount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% 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">Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<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">Redeem Amount</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -21,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -61,23 +83,25 @@
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="pay purple" id="redeem">Pay</div>
|
||||
<div class="pay purple" id="mpu_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script>
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
@@ -85,24 +109,24 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#used_amount').html("0.0");
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -111,62 +135,22 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseFloat($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert("Please type valid amount");
|
||||
|
||||
}else if(valid_amount< redeem_amount){
|
||||
alert(" Insufficient Amount!")
|
||||
}else{
|
||||
if(redeem_amount <= "<%= @food_prices %>"){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paypar_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
alert("Redeem Amount is over!");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- -->
|
||||
<h2> MPU </h2>
|
||||
|
||||
|
||||
Amount :
|
||||
|
||||
<input type="text" name="amount" id="amount" value=""/>
|
||||
|
||||
<button type="submit" id="mpu_pay" > PAY </button>
|
||||
|
||||
<script>
|
||||
$('#mpu_pay').on('click',function(){
|
||||
var amount = $('#amount').val();
|
||||
var amount = $('#amount').text();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_mpu_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
if(parseFloat(amount) <= "<%= @can_mpu %>"){
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_mpu_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("Paid Amount is over!")
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -101,10 +101,87 @@
|
||||
<div class="col-md-4" id="credit">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" id="card_payment">
|
||||
<div class="col-md-8">Others Payment</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0%>
|
||||
<div class="row" id="card_payment">
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" id="card_payment">
|
||||
<div class="col-md-12">Other Payments</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- mpu -->
|
||||
<% if @other != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" style="display:none">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others">0.0</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- paypar -->
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Paypar</div>
|
||||
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" style="display:none">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Paypar</div>
|
||||
<div class="col-md-4" id="ppamount">0.0</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Visa -->
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Visa</div>
|
||||
<div class="col-md-4" id="visacount"><%= @visacount %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" style="display:none">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Visa</div>
|
||||
<div class="col-md-4" id="visacount">0.0</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- JCB -->
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount"><%= @jcbcount %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" style="display:none">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount">0.0</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Master -->
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="row">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Master</div>
|
||||
<div class="col-md-4" id="mastercount"><%= @mastercount %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row" style="display:none">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Master</div>
|
||||
<div class="col-md-4" id="mastercount">0.0</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-8">Balance</div>
|
||||
@@ -167,6 +244,7 @@
|
||||
$(document).ready(function(){
|
||||
update_balance();
|
||||
})
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
@@ -193,7 +271,10 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#cash').text();
|
||||
$('#cash').text(cash.substr(0,cash.length-1));
|
||||
if(cash.length == 1)
|
||||
$('#cash').text("0.0");
|
||||
else
|
||||
$('#cash').text(cash.substr(0,cash.length-1));
|
||||
update_balance();
|
||||
break;
|
||||
case 'clr':
|
||||
@@ -255,9 +336,13 @@ function update_balance(){
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#others').text();
|
||||
var paypar = $('#ppamount').text();
|
||||
var visa = $('#visacount').text();
|
||||
var jcb = $('#jcbcount').text();
|
||||
var master = $('#mastercount').text();
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card)
|
||||
var result = amount_due - total
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master)
|
||||
var result = amount_due - total;
|
||||
$('#balance').text(result.toFixed(2));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -5,7 +5,23 @@
|
||||
<div class="rebate-form">
|
||||
<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">Valid Rebate Amount</label>
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can redeem upto </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @food_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @payparcount > 0 %>
|
||||
<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">Recent Redeem Amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payparcount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% 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>
|
||||
<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>
|
||||
@@ -19,10 +35,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if @payparcount > 0 %>
|
||||
<!-- <% if @payparcount > 0 %>
|
||||
<p class="">Last time rebate amount is <%= @payparcount %></p>
|
||||
<% end %>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p> -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
@@ -115,7 +131,6 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
|
||||
@@ -1,19 +1,41 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>VISA</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="margin-top:10px;padding-top:20px;">
|
||||
<div class="rebate-form">
|
||||
<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">You can pay upto </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_visa %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @visacount != 0 %>
|
||||
<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">Recent Visa paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@visacount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% 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">Valid Rebate Amount</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<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">Redeem Amount</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -21,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
@@ -61,23 +83,25 @@
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="pay purple" id="redeem">Pay</div>
|
||||
<div class="pay purple" id="visa_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script>
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
@@ -85,24 +109,24 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#used_amount').html("0.0");
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -111,34 +135,22 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseFloat($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert("Please type valid amount");
|
||||
|
||||
}else if(valid_amount< redeem_amount){
|
||||
alert(" Insufficient Amount!")
|
||||
$('#visa_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
if(parseFloat(amount) <= "<%= @can_visa %>"){
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_visa_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
if(redeem_amount <= "<%= @food_prices %>"){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paypar_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
alert("Redeem Amount is over!");
|
||||
}
|
||||
alert("Paid Amount is over!");
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
<%= link_to 'Back', print_settings_path, :class => "btn btn-default" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<h1>Editing Print Setting</h1>
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= print_settings_path %>">Print Setting</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', print_setting: @print_setting %>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<%= render 'form', print_setting: @print_setting %>
|
||||
|
||||
<%= link_to 'Show', @print_setting %> |
|
||||
<%= link_to 'Back', print_settings_path %>
|
||||
|
||||
@@ -1,49 +1,55 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Print Settings</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_print_setting_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h1>Print Settings</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Unique code</th>
|
||||
<th>Template</th>
|
||||
<th>Db name</th>
|
||||
<th>Db type</th>
|
||||
<th>Db username</th>
|
||||
<th>Db password</th>
|
||||
<th>Printer name</th>
|
||||
<th>Api settings</th>
|
||||
<th>Page width</th>
|
||||
<th>Page height</th>
|
||||
<th>Print copies</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @print_settings.each do |print_setting| %>
|
||||
<br />
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><%= print_setting.name %></td>
|
||||
<td><%= print_setting.unique_code %></td>
|
||||
<td><%= print_setting.template %></td>
|
||||
<td><%= print_setting.db_name %></td>
|
||||
<td><%= print_setting.db_type %></td>
|
||||
<td><%= print_setting.db_username %></td>
|
||||
<td><%= print_setting.db_password %></td>
|
||||
<td><%= print_setting.printer_name %></td>
|
||||
<td><%= print_setting.api_settings %></td>
|
||||
<td><%= print_setting.page_width %></td>
|
||||
<td><%= print_setting.page_height %></td>
|
||||
<td><%= print_setting.print_copies %></td>
|
||||
<td><%= link_to 'Show', print_setting %></td>
|
||||
<td><%= link_to 'Edit', edit_print_setting_path(print_setting) %></td>
|
||||
<td><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
<th>Name</th>
|
||||
<th>Unique code</th>
|
||||
<th>Template</th>
|
||||
<!-- <th>Db name</th>
|
||||
<th>Db type</th>
|
||||
<th>Db username</th>
|
||||
<th>Db password</th> -->
|
||||
<th>Printer name</th>
|
||||
<th>Api settings</th>
|
||||
<th>Page width</th>
|
||||
<th>Page height</th>
|
||||
<th>Print copies</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Print Setting', new_print_setting_path %>
|
||||
<tbody>
|
||||
<% @print_settings.each do |print_setting| %>
|
||||
<tr>
|
||||
<td><%= print_setting.name %></td>
|
||||
<td><%= print_setting.unique_code %></td>
|
||||
<td><%= print_setting.template %></td>
|
||||
<!-- <td><%= print_setting.db_name %></td>
|
||||
<td><%= print_setting.db_type %></td>
|
||||
<td><%= print_setting.db_username %></td>
|
||||
<td><%= print_setting.db_password %></td> -->
|
||||
<td><%= print_setting.printer_name %></td>
|
||||
<td><%= print_setting.api_settings %></td>
|
||||
<td><%= print_setting.page_width %></td>
|
||||
<td><%= print_setting.page_height %></td>
|
||||
<td><%= print_setting.print_copies %></td>
|
||||
<td><%= link_to 'Show', print_setting %></td>
|
||||
<td><%= link_to 'Edit', edit_print_setting_path(print_setting) %></td>
|
||||
<td><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
<h1>New Print Setting</h1>
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= print_settings_path %>">Print Setting</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', print_setting: @print_setting %>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<%= render 'form', print_setting: @print_setting %>
|
||||
|
||||
<%= link_to 'Back', print_settings_path %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= print_settings_path %>">Print Setting</a></li>
|
||||
<li>Show</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @print_setting.name %>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_employees_path %>">Employees</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_employees_path %>">Employees</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', employee: @employee %>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_employees_path %>">Employees</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_employees_path %>">Employees</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', employee: @employee %>
|
||||
</div>
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
<tr>
|
||||
<!-- <th>Menu Item Id</th> -->
|
||||
<th>item_instance_code</th>
|
||||
<th>item_instance_name</th>
|
||||
<th>item_attributes</th>
|
||||
<th>price</th>
|
||||
<th>is_on_promotion</th>
|
||||
@@ -131,6 +132,7 @@
|
||||
<tr>
|
||||
<!-- <td><%= settings_menu_item.menu_item_id %></td> -->
|
||||
<td><%= settings_menu_item.item_instance_code %></td>
|
||||
<td><%= settings_menu_item.item_instance_name %></td>
|
||||
<td><%= settings_menu_item.item_attributes %></td>
|
||||
<td><%= settings_menu_item.price %></td>
|
||||
<td><%= settings_menu_item.is_on_promotion %></td>
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
<tr>
|
||||
<!-- <th>Menu Item Id</th> -->
|
||||
<th>item_instance_code</th>
|
||||
<th>Instances Name</th>
|
||||
<th>item_attributes</th>
|
||||
<th>price</th>
|
||||
<th>is_on_promotion</th>
|
||||
@@ -138,6 +139,7 @@
|
||||
<tr>
|
||||
|
||||
<td><%= settings_menu_item.item_instance_code %></td>
|
||||
<td><%= settings_menu_item.item_instance_name %></td>
|
||||
<td><%= settings_menu_item.item_attributes %></td>
|
||||
<td><%= settings_menu_item.price %></td>
|
||||
<td><%= settings_menu_item.is_on_promotion %></td>
|
||||
|
||||
@@ -166,12 +166,13 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
|
||||
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
|
||||
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
|
||||
<!-- Temporary No Needs -->
|
||||
<!-- <a href="<%= transactions_void_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||
|
||||
<i class="fa fa-trash fa-lg"></i> Void Sale
|
||||
</a>
|
||||
<a href="<%= transactions_manual_void_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||
|
||||
Reference in New Issue
Block a user