This commit is contained in:
Moe Su
2017-06-11 13:58:34 +06:30
29 changed files with 232 additions and 334 deletions

View File

@@ -91,4 +91,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty', '~> 0.15.5'
gem 'bootstrap-datepicker-rails'
gem 'bootstrap-datepicker-rails'

View File

@@ -143,7 +143,7 @@ $(document).ready(function(){
});
// Payment for Bill
$('#pay').click(function() {
$('#pay-bill').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
if(sale_id!=""){
window.location.href = '/origami/sale/'+ sale_id + "/payment"
@@ -160,52 +160,53 @@ $(document).ready(function(){
window.location.href = '/crm/customers/'+ sale_id + "/assign_sale_id"
return false;
});
});
/* For Receipt - Calculate discount or tax */
$(document).on('click', '.cashier_number', function(event){
if(event.handled !== true) {
var original_value=0;
original_value = $('#discount-amount').val();
/* For Receipt - Calculate discount or tax */
$('.cashier_number').on('click', function(event){
if(event.handled !== true) {
var original_value=0;
original_value = $('#discount-amount').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#discount-amount').val(input_value);
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#discount-amount').val(input_value);
update_balance();
}
else{
$('#discount-amount').val(original_value + '' + input_value);
update_balance();
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#discount-amount').val(amount);
update_balance();
}
else{
$('#discount-amount').val(original_value + '' + input_value);
break;
case 'del' :
var discount_text=$('#discount-amount').val();
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
update_balance();
}
break;
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#discount-amount').val(amount);
update_balance();
break;
case 'clr':
$('#discount-amount').val("0.0");
update_balance();
break;
}
case 'del' :
var discount_text=$('#discount-amount').val();
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
update_balance();
break;
event.handled = true;
} else {
return false;
}
});
case 'clr':
$('#discount-amount').val("0.0");
update_balance();
break;
}
event.handled = true;
} else {
return false;
}
});
/* Button Control by Status */

View File

@@ -1,113 +0,0 @@
// $(document).on('touchstart click', '.keypad', function(event){
// event.stopPropagation();
// event.preventDefault();
// if(event.handled !== true) {
//
// // Do your magic here.
// var input_value = $(this).attr("data-value");
// switch (input_value) {
//
// case 'delete':
// process_delete_payment();
// break;
//
// case 'foc':
// remove_input_action();
// $(".foc").attr("data-action","true");
// if(customerName.toString() != " "){ //if already chosen customer
// if($("#foc_reason_lists").attr("foc_reason") == ' '){
// alert("Please! Choose or Add FOC reason");
// foc_additional_form();
// }
// else{
// process_foc_payment();
// }
// }
// else{
// alert("Please! Choose or Save Customer");
// foc_additional_form();
// }
// break;
//
// case 'nett':
// remove_input_action();
// $(".nett").attr("data-action","true");
// if($(".credit_note_payment").hasClass("payment_selected")){
// if(customerName == " "){
// alert("Please! Choose or Save Customer");
// showCustomer();
// }
// else{
// $("#accept_payment_btn").attr("data-payment","credit");
// process_nett_payment();
// }
// }
// else{
// process_nett_payment();
// }
// break;
//
// case 'edit':
// process_edit_invoice();
// break;
//
// case 'cancel':
// remove_input_action();
// var status = $("#label_amountdue").attr("data-status");
// if (status != 'completed' && status != 'void'){
// $(".cancel").attr("data-action","true");
// var message = confirm("Are you sure to void? Please, add reason!");
// if (message == true) {
// $(".additional_form").hide();
// $("#void_sale_additional_form").show();
// process_cancel_payment();
// }
// }
// else{
// $(".cancel").addClass("dim");
// }
// break;
//
// case 'ent':
// amount_due = parseFloat($("#label_amountdue").attr("data-original"));
// other_amt = parseFloat($("#label_cash_amount").attr("data-value"));
// credit_amount = parseFloat($("#label_credit_note").text());
// if ($(".credit_note_payment").hasClass("payment_selected") && credit_amount > 0){
// if(customerName.toString() != " "){
// if(credit_amount > (amount_due - other_amt)){
// alert("You shouldn't exceed the amount due.");
// }
// else{
// $("#accept_payment_btn").attr("data-payment","credit");
// update_balance_due();
// }
// }
// else{
// alert("Please! Choose or Save Customer");
// }
// }
// else{
// update_balance_due();
// }
//
// break;
// case 'clear':
// process_clear_payment();
// break;
//
// default:
//
// var existing_value = $(".payment_selected span").text();
//
// if (existing_value == "0" || existing_value == "0.00") { existing_value = ""; }
// existing_value = existing_value + input_value;
// $(".payment_selected span").text(existing_value);
//
// }
//
//
// event.handled = true;
// } else {
// return false;
// }
// });

View File

@@ -1,3 +0,0 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -1,3 +0,0 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -1,3 +0,0 @@
// Place all the styles related to the origami/paypar controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -1,3 +0,0 @@
// Place all the styles related to the origami/RequestBills controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -9,11 +9,11 @@ class Api::BillController < Api::ApiController
#create Bill by Booking ID
if (params[:booking_id])
@sale = Sale.new
@status = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
elsif (params[:order_id])
@sale = Sale.new
@status = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
end
end

View File

@@ -38,10 +38,10 @@ class Crm::CustomersController < ApplicationController
def create
@crm_customers = Customer.new(customer_params)
respond_to do |format|
if @crm_customers.save
name = customer_params[:name]
phone = customer_params[:contact_no]
@@ -63,12 +63,10 @@ class Crm::CustomersController < ApplicationController
)
if response["status"] == true
puts "hhhhhhhhhhhhhhhhhh"
puts params[:sale_id]
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
if params[:sale_id] != 0
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' }
if params[:sale_id] != 0
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' }
else
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: 'Customer was successfully created.' }
end
@@ -77,27 +75,27 @@ class Crm::CustomersController < ApplicationController
@crm_customers.destroy
if params[:sale_id] != 0
if params[:sale_id] != 0
format.html { redirect_to crm_customers_path, notice: response["message"] }
else
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: response["message"] }
end
end
# format.json { render :index, status: :created, location: @crm_customers }
else
if params[:sale_id] != 0
format.html { redirect_to crm_customers_path}
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
else
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: response["message"] }
end
end
end
end
@@ -105,7 +103,7 @@ class Crm::CustomersController < ApplicationController
# PATCH/PUT /crm/customers/1
# PATCH/PUT /crm/customers/1.json
def update
respond_to do |format|
if @crm_customer.update(customer_params)
@@ -118,7 +116,7 @@ class Crm::CustomersController < ApplicationController
membership = MembershipSetting.find_by_membership_type("paypar_url")
app_token = membership.auth_token.to_s
url = membership.gateway_url.to_s + "/api/update_membership_customer".to_s
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
date_of_birth: date_of_birth,
id: id}.to_json,
@@ -127,7 +125,7 @@ class Crm::CustomersController < ApplicationController
'Accept' => 'application/json'
}
)
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
@@ -153,7 +151,7 @@ class Crm::CustomersController < ApplicationController
# DELETE /crm/customers/1
# DELETE /crm/customers/1.json
def get_sale_id
@sale_id = params[:sale_id]
@crm_customers = Customer.all
@crm_customer = Customer.new
@@ -179,5 +177,3 @@ class Crm::CustomersController < ApplicationController
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_type, :membership_authentication_code)
end
end

View File

@@ -10,7 +10,7 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash)
sale_payment.process_payment(saleObj, @user, cash, "cash")
end
end
@@ -18,6 +18,11 @@ class Origami::PaymentsController < BaseOrigamiController
sale_id = params[:sale_id]
if Sale.exists?(sale_id)
@sale_data = Sale.find_by_sale_id(sale_id)
@sale_data.sale_payments.each do |spay|
if spay.payment_method == "cash"
@cash = spay.payment_amount
end
end
end
end

View File

@@ -18,4 +18,4 @@ class Origami::PayparPaymentsController < BaseOrigamiController
end
end
end
end

View File

@@ -14,13 +14,15 @@ class Settings::MembershipActionsController < ApplicationController
if !membership_actions_data.nil?
url = params[:gateway_url].to_s + membership_actions_data.gateway_url.to_s
puts url.to_json
sale_data = Sale.find_by_sale_id(@sale_id)
sale_data = Sale.find_by_sale_id(@sale_id)
if sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
puts customer_data.to_json
@membership_id = customer_data.membership_id
@campaign_type_id =1
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
puts membership_setting
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@@ -41,7 +43,7 @@ class Settings::MembershipActionsController < ApplicationController
end
render :json => @out.to_json
end
end
# GET /settings/membership_actions/1

View File

@@ -3,7 +3,6 @@ class Sale < ApplicationRecord
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
#before_create :generate_receipt_no
belongs_to :cashier, :optional => true
belongs_to :customer, :optional => true
@@ -17,7 +16,6 @@ class Sale < ApplicationRecord
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)
puts "get invoice from booking"
booking = Booking.find(booking_id)
status = false
Rails.logger.debug "Booking -> " + booking.id.to_s
@@ -33,7 +31,6 @@ class Sale < ApplicationRecord
booking.sale_id = sale_id
end
order = booking.booking_orders.take.order
puts "add sale order"
link_order_sale(order.id)
return status, sale_id
end
@@ -231,9 +228,10 @@ class Sale < ApplicationRecord
def link_order_sale(order_id)
#create if it doesn't exist
saleOrder = SaleOrder.where("sale_id=? and order_id=?", self.id, order_id).take
if saleOrder.nil?
SaleOrder.create(:sale_id => self.id, :order_id => order_id)
sale_order = SaleOrder.new
sale_order.create_sale_order(self.id, order_id)
end
# if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?)
# SaleOrder.create(:sale_id => self.id, :order_id => order_id)
@@ -261,6 +259,7 @@ class Sale < ApplicationRecord
end
private
def generate_custom_id
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
end

View File

@@ -2,13 +2,22 @@ class SaleOrder < ApplicationRecord
self.primary_key = "sale_order_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
before_create :generate_sale_order_id
belongs_to :sale
belongs_to :order
def create_sale_order(sale, order)
self.sale_id = sale
self.order_id = order
self.save
end
private
def generate_custom_id
self.sale_order_id = SeedGenerator.generate_id(self.class.name, "SOI")
def generate_sale_order_id
self.class.name
saleOrderId = SeedGenerator.generate_id(self.class.name, "SOI")
self.sale_order_id = saleOrderId
end
end

View File

@@ -8,7 +8,7 @@ class SalePayment < ApplicationRecord
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
def process_payment(invoice, action_by, cash_amount,payment_method)
def process_payment(invoice, action_by, cash_amount, payment_method)
self.sale = invoice
self.received_amount = cash_amount
@@ -75,7 +75,7 @@ class SalePayment < ApplicationRecord
}
)
return response;
end
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id,campaign_type_id)
@@ -93,9 +93,9 @@ class SalePayment < ApplicationRecord
else
response =false;
end
return response;
end
private
@@ -103,7 +103,7 @@ class SalePayment < ApplicationRecord
payment_status = false
self.payment_method = "cash"
self.payment_amount = self.received_amount
self.outstanding_amount = self.sale.grand_total - self.received_amount
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "paid"
payment_method = self.save!
@@ -195,21 +195,33 @@ class SalePayment < ApplicationRecord
if membership_data["status"]==true
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
sale_update_payment_status(self.received_amount.to_f)
else
sale_update_payment_status(0)
end
return payment_status
end
def sale_update_payment_status(paid_amount)
puts "sale update"
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received + paid_amount
self.sale.amount_changed = paid_amount - self.sale.amount_received
if (self.sale.grand_total <= self.sale.amount_received && self.sale.amount_changed > 0)
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.amount_changed = paid_amount.to_f - self.sale.amount_received.to_f
all_received_amount = 0.0
sObj = self.sale
sObj.sale_payments.each do |spay|
puts spay
puts spay.payment_amount
all_received_amount += spay.payment_amount.to_f
end
puts all_received_amount
puts self.sale.grand_total
if (self.sale.grand_total <= all_received_amount)
puts " sale update ......"
self.sale.payment_status = "paid"
self.sale.sale_status = "completed"
self.sale.save!

View File

@@ -1,7 +1,9 @@
class SeedGenerator < ApplicationRecord
def self.generate_id(model, prefix)
seed = SeedGenerator.find_by_model(model)
new_receipt_no = 0
if (seed.nil?)
seed = SeedGenerator.new()
seed.model = model
@@ -16,8 +18,8 @@ class SeedGenerator < ApplicationRecord
end
padding_len = 15 - prefix.length
return prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
saleOrderId = prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
return saleOrderId
end

View File

@@ -20,6 +20,7 @@
<li><%= link_to "Membership Setting",settings_membership_settings_path, :tabindex =>"-1" %></li>
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
</ul>
</li>
@@ -30,9 +31,14 @@
<li><%= link_to "Sales ", crm_root_path, :tabindex =>"-1" %></li>
</ul>
</li>
<!-- <li class="navbar-nav mr-auto">
Reports
</li> -->
<li class="navbar-nav mr-auto dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">&nbsp;&nbsp;&nbsp;Reports</a>
<ul class="dropdown-menu">
<li><%= link_to "Daily Sale Report", origami_root_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
<li><%= link_to "Receipt Report", origami_root_path, :tabindex =>"-1" %></li>
</ul>
</li>
</ul>
</div>

View File

@@ -9,8 +9,8 @@
<title>SmartSales : Restaurant</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'orgiami', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'orgiami', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %>
</head>
<body>

View File

@@ -21,23 +21,23 @@
<!--- Panel 0 - Table Orders -->
<div class="tab-pane active" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_orders.each do |bko|
<%
@booking_orders.each do |bko|
# Assigned Id for new Order? Sale?
unique_id=""
# For CSS- Class for Order? Sale?
sale_status=""
if bko.order_status == 'new'
if bko.order_status == 'new'
unique_id=bko.booking_id
else
else
unique_id=bko.sale_id
sale_status="sold"
end
end
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
<p class="hidden orders-id"><%= unique_id %></p>
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
<p class="card-text">
Receipt No :
<span class="orders-receipt-no">
@@ -48,12 +48,12 @@
Order Status :
<span class="orders-order-status">
<%= bko.order_status %>
</span>
</span>
</small>
</p>
</div>
</div>
<%
</p>
</div>
</div>
<%
end
%>
</div>
@@ -62,23 +62,23 @@
<!--- Panel 1 - Room Orders -->
<div class="tab-pane active" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@booking_rooms.each do |rmo|
<%
@booking_rooms.each do |rmo|
# Assigned Id for new Order? Sale?
unique_id=""
# For CSS- Class for Order? Sale?
sale_status=""
if rmo.order_status == 'new'
unique_id=rmo.booking_id
else
if rmo.order_status == 'new'
unique_id=rmo.booking_id
else
unique_id=rmo.sale_id
sale_status="sold"
end
end
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
<p class="hidden orders-id"><%= unique_id %></p>
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
<p class="card-text">
Receipt No :
<span class="orders-receipt-no">
@@ -89,12 +89,12 @@
Order Status :
<span class="orders-order-status">
<%= rmo.order_status %>
</span>
</span>
</small>
</p>
</div>
</div>
<%
</p>
</div>
</div>
<%
end
%>
</div>
@@ -103,23 +103,23 @@
<!--- Panel 2 - Orders -->
<div class="tab-pane active" id="orders" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@orders.each do |odr|
<%
@orders.each do |odr|
# Assigned Id for new Order? Sale?
unique_id=""
# For CSS- Class for Order? Sale?
sale_status=""
if odr.order_status == 'new'
if odr.order_status == 'new'
unique_id=odr.booking_id
else
else
unique_id=odr.sale_id
sale_status="sold"
end
end
%>
<div class="card orders <%= sale_status %>">
<div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p>
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
<p class="hidden orders-id"><%= unique_id %></p>
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
<p class="card-text">
Receipt No :
<span class="orders-receipt-no">
@@ -130,16 +130,16 @@
Order Status :
<span class="orders-order-status">
<%= odr.order_status %>
</span>
</span>
</small>
</p>
</div>
</div>
<%
</p>
</div>
</div>
<%
end
%>
</div>
</div>
</div>
<!-- tabs - End -->
@@ -157,10 +157,10 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Receipt No: <span id="receipt_no"></span></p>
<p>Cashier: <span id="cashier"></span></p>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date: <span id="receipt_date"></span></p>
</div>
</div>
</div>
<div class="card-text">
<table class="table table-striped" id="order-items-table">
@@ -205,7 +205,7 @@
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
@@ -215,13 +215,13 @@
<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" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-lg btn-block" disabled id="customer">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">Discount</button>
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button>
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >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>

View File

@@ -1,15 +1,15 @@
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-3">
<div class="card">
<% @payment_method_setting.each do |payment_method|%>
<div class="col-md-5">
<div class="col-md-12 long purple " id="<%= payment_method.payment_method%>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
</div>
<% end %>
<% end %>
</div>
</div>
<div class="col-lg-7 col-md-7 col-sm-7">
<div class="rebate-form" hidden="true">
<div class="row">
@@ -18,14 +18,14 @@
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="">
</div>
<hr>
</div>
</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">Used Amount</label>
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
</div>
<hr>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
@@ -86,16 +86,16 @@
</div>
</div>
<div class="col-md-5">
<div class="col-md-12 cashier_number long purple" id="redeem" data-member-value = "">PAY</div>
<div class="col-md-12 cashier_number long purple" id="redeem" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">PAY</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<script type="text/javascript">
$(document).on('click', '.cashier_number', function(event){
@@ -121,7 +121,7 @@ $(document).on('click', '.cashier_number', function(event){
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#used_amount').html(amount);
break;
case 'clr':
$('#used_amount').html("0.0");
@@ -133,7 +133,6 @@ $(document).on('click', '.cashier_number', function(event){
// return false;
// }
});
$("#REDIMREBATE").click(function(){
$('.rebate-form').removeAttr("hidden");
gateway_url = $(this).attr("data-url");
@@ -175,4 +174,4 @@ $("#redeem").click(function(){
})
}
});
</script>
</script>

View File

@@ -78,7 +78,7 @@
<hr>
<div class="row">
<div class="col-md-8">CASH</div>
<div class="col-md-4" id="cash" >0.0</div>
<div class="col-md-4" id="cash" ><%= @cash %></div>
</div>
<hr>
<div class="row" id="credit_payment">
@@ -165,42 +165,43 @@
<script>
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
if(event.handled !== true) {
var original_value;
original_value = $('#cash').text();
if(event.handled !== true) {
var original_value;
original_value = $('#cash').text();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#cash').text(input_value);
update_balance();
}else{
$('#cash').append(input_value);
update_balance();
}
break;
var input_type = $(this).attr("data-type");
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#cash').text(amount);
update_balance();
break;
case 'clr':
$('#cash').text("0.0");
update_balance();
break;
}
event.handled = true;
} else {
return false;
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#cash').text(input_value);
update_balance();
}else{
$('#cash').append(input_value);
update_balance();
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#cash').text(amount);
update_balance();
break;
case 'del' :
var cash=$('#cash').text();
$('#cash').text(cash.substr(0,cash.length-1));
update_balance();
break;
case 'clr':
$('#cash').text("0.0");
update_balance();
break;
}
event.handled = true;
} else {
return false;
}
});
$( document ).ready(function() {
@@ -221,19 +222,18 @@ $( document ).ready(function() {
if($('#balance').text() > 0){
alert(" Insufficient Amount!")
}else{
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var sale_id = $('#sale_id').text();
$.ajax({type: "POST",
url: "<%= origami_payment_process_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id,
success:function(result){
alert("THANK YOU")
}
});
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var sale_id = $('#sale_id').text();
$.ajax({type: "POST",
url: "<%= origami_payment_process_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id,
success:function(result){
alert("THANK YOU")
}
});
}
});

View File

@@ -11,10 +11,10 @@ Rails.application.config.assets.version = '1.0'
# Rails.application.config.assets.precompile += %w( search.js )
# --- Waiter/ Cashier - Orgiami ----
Rails.application.config.assets.precompile += %w( orgiami.css )
Rails.application.config.assets.precompile += %w( orgiami.js )
Rails.application.config.assets.precompile += %w( origami.css )
Rails.application.config.assets.precompile += %w( origami.js )
# -- Order Queue Station -----
Rails.application.config.assets.precompile += %w( OQS.css )
Rails.application.config.assets.precompile += %w( OQS.js )
Rails.application.config.assets.precompile += %w( OQS.js )
Rails.application.config.assets.precompile += %w( settings.css )

View File

@@ -13,6 +13,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1]
t.string :options
t.json :set_menu_items #this parameter is require to route the items correctly
t.boolean :taxable, :null => false, :default => true
t.string :completed_by
t.timestamps
end
end

View File

@@ -7,7 +7,7 @@ class CreatePaymentMethodSettings < ActiveRecord::Migration[5.1]
t.string :gateway_url
t.string :auth_token
t.string :merchant_account_id
t.string :additional_parameters
t.timestamps
end
end

View File

@@ -1,8 +1,8 @@
class CreateSaleOrders < ActiveRecord::Migration[5.1]
def change
create_table :sale_orders, :id => false do |t|
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
t.string :sale_order_id, :limit => 16, :primary_key => true
t.string :sale_id, foreign_key: true,:limit => 16
t.string :order_id, foreign_key: true, :limit => 16

View File

@@ -1,5 +0,0 @@
class AddCompanyAddressEmail < ActiveRecord::Migration[5.1]
def change
add_column :order_items, :completed_by, :string
end
end

View File

@@ -1,5 +0,0 @@
class Additionparametertopaymentsettings < ActiveRecord::Migration[5.1]
def change
add_column :payment_method_settings, :additional_parameters, :string
end
end

View File

@@ -142,6 +142,7 @@ beverage = Account.create({title: "Beverage", account_type: "1"})
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
# shop = Shop.create(
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",