fixed
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -48,3 +48,6 @@ config/deploy/config/*
|
||||
|
||||
# For Redis Server log file
|
||||
dump.rdb
|
||||
|
||||
# Fonts
|
||||
public/fonts/*
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
//= require_tree ./channels
|
||||
|
||||
// Temp Disable
|
||||
(function() {
|
||||
this.App || (this.App = {});
|
||||
// (function() {
|
||||
// this.App || (this.App = {});
|
||||
|
||||
App.cable = ActionCable.createConsumer();
|
||||
// App.cable = ActionCable.createConsumer();
|
||||
|
||||
}).call(this);
|
||||
// }).call(this);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
App.order_queue_station = App.cable.subscriptions.create("OrderQueueStationChannel", {
|
||||
connected: function() {},
|
||||
// App.order_queue_station = App.cable.subscriptions.create("OrderQueueStationChannel", {
|
||||
// connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
// disconnected: function() {},
|
||||
|
||||
received: function(message) {
|
||||
alert(message);
|
||||
},
|
||||
// received: function(message) {
|
||||
// alert(message);
|
||||
// },
|
||||
|
||||
order: function(message) {
|
||||
return this.perform('order', {
|
||||
message: message
|
||||
});
|
||||
}
|
||||
});
|
||||
// order: function(message) {
|
||||
// return this.perform('order', {
|
||||
// message: message
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// $(function(){
|
||||
// $("#submit_order").on('click', function(event) {
|
||||
|
||||
@@ -52,7 +52,10 @@
|
||||
}
|
||||
|
||||
.payment{
|
||||
height:70px;line-height:70px;align:center;color:white;font-size:16px;margin-bottom:1px;
|
||||
height:70px;line-height:70px;
|
||||
align:center;color:white;
|
||||
font-size:16px;
|
||||
margin-top:5px;
|
||||
}
|
||||
|
||||
.cash-color{
|
||||
@@ -205,5 +208,6 @@ tr.discount-item-row:hover {
|
||||
/* Jquery Confirm */
|
||||
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important
|
||||
margin-left:-40px !important;
|
||||
margin-top:-40px !important;
|
||||
}
|
||||
|
||||
@@ -115,21 +115,21 @@ class Crm::CustomersController < BaseCrmController
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 100
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Can't open embership server "}
|
||||
response = {status: false, message: "Can't open membership server "}
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
|
||||
response = { status: false , message: "Can't open embership server "}
|
||||
response = { status: false , message: "Can't open membership server "}
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't open embership server "}
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't open embership server "}
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
end
|
||||
if response["status"] == true
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
@@ -209,8 +209,6 @@ end
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
puts "hhhhhhhhh"
|
||||
puts response.to_json
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class HomeController < ApplicationController
|
||||
if !shift.nil?
|
||||
redirect_to origami_root_path
|
||||
else
|
||||
redirect_to new_origami_shift_path
|
||||
redirect_to dashboard_path
|
||||
end
|
||||
elsif employee.role == "cashier"
|
||||
#check if cashier has existing open cashier
|
||||
|
||||
@@ -11,6 +11,7 @@ class Oqs::EditController < BaseOqsController
|
||||
remarks = params[:remarks]
|
||||
|
||||
order_item = OrderItem.find(order_items_id);
|
||||
order_item.item_order_by = current_user.name
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
|
||||
@@ -17,7 +17,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
@queue_items_details.each do |qid|
|
||||
dining = DiningFacility.find_by_name(qid.zone)
|
||||
que.order_queue_process_by_zones.each do |qz|
|
||||
if qid.station_id == qz.order_queue_station_id && qid.zone_id == dining.zone_id
|
||||
if qid.station_id == qz.order_queue_station_id && qid.zone_id == qz.zone_id
|
||||
zone_id = qid.zone_id
|
||||
i=i+1
|
||||
end
|
||||
|
||||
@@ -42,6 +42,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale_item.unit_price = di["price"]
|
||||
sale_item.taxable_price = di["price"]
|
||||
sale_item.is_taxable = 0
|
||||
sale_item.account_id = origin_sale_item.account_id
|
||||
|
||||
sale_item.price = di["price"]
|
||||
sale_item.save
|
||||
@@ -49,11 +50,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
render :json => dining.to_json
|
||||
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
# Remove selected discount Items
|
||||
@@ -78,11 +82,12 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.save
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
||||
end
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
|
||||
render :json => dining.to_json
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
# Remove all discount Items
|
||||
@@ -108,11 +113,12 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
|
||||
end
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
|
||||
render :json => dining.to_json
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
#discount for selected order
|
||||
|
||||
@@ -8,6 +8,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sale_id = params[:sale_id] # sale_id
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||
member_info = nil
|
||||
|
||||
# Print for First Bill to Customer
|
||||
|
||||
@@ -17,7 +18,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
customer= Customer.find(sale_data.customer_id)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
if customer.membership_id != nil
|
||||
member_info = Customer.get_member_account(customer)
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
@@ -36,25 +39,26 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
def create
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
member_info = nil
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
|
||||
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
# rounding_adj = saleObj.grand_total - new_total
|
||||
|
||||
# saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
|
||||
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
||||
rebate_amount = nil
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
if customer.membership_id != nil
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
end
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
@@ -63,12 +67,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||
end
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
sale_id = params[:sale_id]
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
@cash = 0.0
|
||||
@other = 0.0
|
||||
@@ -78,16 +83,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@mastercount = 0.0
|
||||
@credit = 0.0
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
@table_no = ''
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
|
||||
# get member information
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
@balance = 0.00
|
||||
@accountable_type = ''
|
||||
if response["status"]==true
|
||||
if @customer.membership_id != nil
|
||||
response = Customer.get_member_account(@customer)
|
||||
if response["status"]==true
|
||||
response["data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
@@ -95,10 +101,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@accountable_type = "Rebate Balance"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#end customer amount
|
||||
|
||||
@sale_data.bookings.each do |sbk|
|
||||
df = DiningFacility.find(sbk.dining_facility_id)
|
||||
@table_no = df.type + ' ' + df.name
|
||||
break
|
||||
end
|
||||
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
@cash = spay.payment_amount
|
||||
@@ -121,8 +134,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def reprint
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
member_info = nil
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
|
||||
@@ -132,8 +145,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
if customer.membership_id != nil
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
|
||||
@@ -5,19 +5,24 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
order_id = params[:id] # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
# puts "current_login_employee"
|
||||
# puts current_login_employee.name
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
if ShiftSale.current_open_shift(current_user.id)
|
||||
order_id = params[:id] # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
# puts "current_login_employee"
|
||||
# puts current_login_employee.name
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||
end
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift for This Employee"
|
||||
end
|
||||
|
||||
# Not Use for these printed bill cannot give customer
|
||||
|
||||
@@ -6,6 +6,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
@@ -23,12 +24,16 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
@status = 'sale'
|
||||
@obj = sale
|
||||
@customer = sale.customer
|
||||
end
|
||||
end
|
||||
end
|
||||
puts "hhhhhhhhhh"
|
||||
puts @status
|
||||
puts @obj.to_json
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -23,26 +23,42 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem.save
|
||||
end
|
||||
|
||||
# def item_edit
|
||||
# saleitemId = params[:sale_item_id]
|
||||
# update_qty = params[:update_qty]
|
||||
# update_price = params[:update_price]
|
||||
# saleitemObj = SaleItem.find(saleitemId)
|
||||
# saleitemObj.remark = 'void'
|
||||
# saleitemObj.save
|
||||
# @newsaleitem = SaleItem.new
|
||||
# @newsaleitem = saleitemObj.dup
|
||||
# @newsaleitem.save
|
||||
# @newsaleitem.qty = update_qty
|
||||
# @newsaleitem.price = update_price
|
||||
# @newsaleitem.unit_price = update_price
|
||||
# @newsaleitem.taxable_price = update_price
|
||||
# @newsaleitem.is_taxable = 0
|
||||
# @newsaleitem.remark = 'edit'
|
||||
# @newsaleitem.product_name = saleitemObj.product_name + " - updated"
|
||||
# @newsaleitem.save
|
||||
# end
|
||||
|
||||
def item_edit
|
||||
saleitemId = params[:sale_item_id]
|
||||
update_qty = params[:update_qty]
|
||||
saleitemId = params[:sale_item_id]
|
||||
update_qty = params[:update_qty]
|
||||
update_price = params[:update_price]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
saleitemObj.remark = 'void'
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
|
||||
saleitemObj.qty = update_qty
|
||||
saleitemObj.price = update_qty.to_f * update_price.to_f
|
||||
saleitemObj.unit_price = update_price
|
||||
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
|
||||
# saleitemObj.remark = 'edit'
|
||||
saleitemObj.product_name = saleitemObj.product_name + " - updated"
|
||||
saleitemObj.save
|
||||
@newsaleitem = SaleItem.new
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = update_qty
|
||||
@newsaleitem.price = update_price
|
||||
@newsaleitem.unit_price = update_price
|
||||
@newsaleitem.taxable_price = update_price
|
||||
@newsaleitem.is_taxable = 0
|
||||
@newsaleitem.remark = 'edit'
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - updated"
|
||||
@newsaleitem.save
|
||||
end
|
||||
|
||||
|
||||
# make cancel void item
|
||||
def item_void_cancel
|
||||
saleitemId = params[:sale_item_id]
|
||||
|
||||
@@ -9,6 +9,12 @@ class Origami::VoidController < BaseOrigamiController
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
# update count for shift sale
|
||||
if(sale.sale_status == "completed")
|
||||
shift = ShiftSale.current_open_shift(sale.cashier_id)
|
||||
shift.calculate(sale, "void")
|
||||
end
|
||||
|
||||
bookings = sale.bookings
|
||||
bookings.each do |booking|
|
||||
orders = booking.orders
|
||||
|
||||
@@ -5,6 +5,9 @@ class Reports::DailysaleController < BaseReportController
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
@tax = SaleTax.get_tax(from,to)
|
||||
puts from
|
||||
puts to
|
||||
puts "sssssssss"
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
class Reports::ReceiptNoController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
from, to = get_date_range_from_params
|
||||
puts "from..."
|
||||
puts from
|
||||
puts "to..."
|
||||
puts to
|
||||
@sale_data = Sale.get_receipt_no_list(from,to)
|
||||
@sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50)
|
||||
from, to, report_type = get_date_range_from_params
|
||||
# if to.blank?
|
||||
# @shift = ShiftSale.where('shift_started_at <= ? and shift_closed_at is NULL',from).take
|
||||
# else
|
||||
# @shift = ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to).take
|
||||
# end
|
||||
# puts "2017-07-07T10:46:09.000Z - 2017-07-07T11:12:51.000Z"
|
||||
# puts "2017-06-25 17:30:00 UTC 2017-07-02 17:29:59 UTC"
|
||||
# puts params[:shift_name]
|
||||
# puts from.utc
|
||||
# puts to.utc
|
||||
|
||||
if params[:shift_name].to_i != 0
|
||||
@shift = ShiftSale.where('shift_started_at >= ? and shift_closed_at <= ?',from,to).take
|
||||
# puts @shift.to_json
|
||||
if @shift.present?
|
||||
@sale_data = Sale.where('shift_sale_id = ? ',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(from,to)
|
||||
end
|
||||
else
|
||||
@sale_data = Sale.where("sale_status=? and receipt_date between ? and ?","completed",from.utc,to.utc)
|
||||
@sale_taxes = Sale.get_separate_tax(from.utc,to.utc)
|
||||
end
|
||||
|
||||
|
||||
if @shift.present?
|
||||
@shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
@@ -15,6 +38,231 @@ authorize_resource :class => false
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
puts "hhhhhhhhhhhhhhhhhhhhh"
|
||||
puts @sale_data.to_json
|
||||
puts from
|
||||
puts to
|
||||
puts report_type
|
||||
puts params[:shift_name]
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
str = { :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: out }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_date_range_from_params
|
||||
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
|
||||
branch = params[:branch]
|
||||
report_type = params[:report_type]
|
||||
|
||||
shift_name = params[:shift_name]
|
||||
unless shift_name.nil?
|
||||
shift_arr = shift_name.split(' - ')
|
||||
shift_from = shift_arr[0]
|
||||
shift_to = shift_arr[1]
|
||||
end
|
||||
|
||||
day_ref = day_ref = Time.now.utc.getlocal
|
||||
|
||||
if period_type.to_i == 1
|
||||
|
||||
### =>search by from and to
|
||||
unless shift_name.nil?
|
||||
if shift_name.to_s == '0'
|
||||
### => all shift
|
||||
f_date = DateTime.parse(params[:from])
|
||||
t_date = DateTime.parse(params[:to])
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
|
||||
else
|
||||
unless shift_from == '-'
|
||||
f_date = DateTime.parse(shift_from)
|
||||
from = f_date
|
||||
else
|
||||
from = ''
|
||||
end
|
||||
|
||||
unless shift_to == '-'
|
||||
t_date = DateTime.parse(shift_to)
|
||||
to = t_date
|
||||
else
|
||||
to = ''
|
||||
end
|
||||
end
|
||||
else
|
||||
f_date = DateTime.parse(params[:from])
|
||||
t_date = DateTime.parse(params[:to])
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
end
|
||||
else
|
||||
### => search by Today or yesterday
|
||||
|
||||
unless shift_name.nil?
|
||||
if shift_name.to_s == '0'
|
||||
### => all shift
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
|
||||
else
|
||||
unless shift_from == '-'
|
||||
f_date = DateTime.parse(shift_from)
|
||||
#f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
from = f_date.utc
|
||||
else
|
||||
from = ''
|
||||
end
|
||||
|
||||
unless shift_to == '-'
|
||||
t_date = DateTime.parse(shift_to)
|
||||
#t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
to = t_date.utc
|
||||
else
|
||||
to = ''
|
||||
end
|
||||
end
|
||||
else
|
||||
if params[:report_type].to_i != 0
|
||||
r_type = params[:report_type].to_s
|
||||
|
||||
if r_type == 'shift_item'
|
||||
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
else
|
||||
### => report not shift
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return from, to,report_type
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -51,6 +51,7 @@ class Transactions::SalesController < ApplicationController
|
||||
end
|
||||
|
||||
@sale_receivables = SalePayment.where('sale_id = ?', @sale.id)
|
||||
@sale_audits = SaleAudit.where('sale_id = ?', @sale.id)
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale.customer_id)
|
||||
|
||||
@@ -27,7 +27,7 @@ class Customer < ApplicationRecord
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 100
|
||||
:timeout => 10
|
||||
)
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Server Error"}
|
||||
@@ -46,7 +46,7 @@ class Customer < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.get_membership_transactions(customer)
|
||||
def self.get_membership_transactions(customer,receipt_no = nil)
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("get_member_transactions")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
@@ -55,13 +55,17 @@ class Customer < ApplicationRecord
|
||||
# urltest =self.url_exist?(url)
|
||||
|
||||
begin
|
||||
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'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
response = HTTParty.get(url,
|
||||
:body => { membership_id: customer.membership_id,
|
||||
receipt_no:receipt_no,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false , message: "Server Time out"}
|
||||
|
||||
@@ -100,22 +104,90 @@ class Customer < ApplicationRecord
|
||||
'Accept' => 'application/json'
|
||||
})
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
response = { status: false, message: "Server Time out" }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
end
|
||||
|
||||
puts response.to_json
|
||||
|
||||
if response["status"] == true
|
||||
if response["status"] == true
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def self.update_rebate
|
||||
|
||||
sales = Sale.where("rebate_status = 'false'")
|
||||
sales.each do |sale|
|
||||
if sale.customer.membership_id
|
||||
response = self.rebat(Sale.find(sale.sale_id))
|
||||
puts response.to_json
|
||||
if response["status"] == true
|
||||
status = sale.update_attributes(rebate_status: "true")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.rebat(sObj)
|
||||
rebate_prices = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
if generic_customer_id.present?
|
||||
paypar = sObj.sale_payments
|
||||
payparcost = 0
|
||||
credit = 0
|
||||
paypar.each do |pp|
|
||||
if pp.payment_method == "paypar"
|
||||
payparcost = payparcost + pp.payment_amount
|
||||
elsif pp.payment_method == "creditnote"
|
||||
credit = 1
|
||||
end
|
||||
end
|
||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||
overall_dis = sObj.total_discount
|
||||
|
||||
total_amount = rebate_prices - payparcost - overall_dis
|
||||
if credit == 1
|
||||
total_amount = 0
|
||||
end
|
||||
if total_amount >= 0
|
||||
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
|
||||
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_sale_transaction_amount: sObj.grand_total,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',
|
||||
'Accept' => 'application/json'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { "status": false, "message": "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { "status": false, "message": "Can't connect server"}
|
||||
|
||||
end
|
||||
return response
|
||||
puts response.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
|
||||
@@ -9,7 +9,7 @@ class OrderItem < ApplicationRecord
|
||||
|
||||
#Validation
|
||||
validates_presence_of :item_code, :item_name, :qty
|
||||
validates :qty, numericality: { :greater_than => 0 }
|
||||
# validates :qty, numericality: { :greater_than => 0 }
|
||||
validates_associated :order
|
||||
|
||||
#This Method - handle how items is added into order
|
||||
|
||||
@@ -13,7 +13,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
def process_order (order, table_id)
|
||||
oqs_stations = OrderQueueStation.active
|
||||
dining=DiningFacility.find(table_id)
|
||||
oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||
# oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||
|
||||
order_items = order.order_items
|
||||
|
||||
@@ -47,12 +47,16 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
# Auto Printing
|
||||
# ToDo per item per printer
|
||||
if oqs.auto_print && is_auto_printed == false
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
OrderQueueProcessByZone.where("zone_id=#{dining.zone_id}").find_each do |oqpbz|
|
||||
if oqs.id == oqpbz.order_queue_station_id
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ class Sale < ApplicationRecord
|
||||
SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount,
|
||||
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount,
|
||||
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='credit') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
|
||||
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to)
|
||||
@@ -445,6 +445,7 @@ class Sale < ApplicationRecord
|
||||
total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total,
|
||||
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
|
||||
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
|
||||
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
|
||||
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount,
|
||||
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj")
|
||||
.where("(sale_status = ? OR sale_status = ?) AND receipt_date between ? and ? AND total_amount != 0", 'completed', 'void', from_date, to_date)
|
||||
@@ -454,6 +455,7 @@ class Sale < ApplicationRecord
|
||||
old_grand_total = sale.old_grand_total
|
||||
total_discount = sale.total_discount
|
||||
void_amount = sale.void_amount
|
||||
total_change_amount = sale.total_change_amount
|
||||
total = {:sale_date => pay.sale_date,
|
||||
:mpu_amount => pay.mpu_amount,
|
||||
:master_amount => pay.master_amount,
|
||||
@@ -464,6 +466,7 @@ class Sale < ApplicationRecord
|
||||
:credit_amount => pay.credit_amount,
|
||||
:foc_amount => pay.foc_amount,
|
||||
:total_discount => total_discount,
|
||||
:total_change_amount => total_change_amount,
|
||||
:grand_total => grand_total,
|
||||
:old_grand_total => old_grand_total,
|
||||
:void_amount => void_amount,
|
||||
@@ -493,7 +496,7 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||
|
||||
|
||||
query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status)
|
||||
query = query.where("(receipt_date between ? and ? and sale_status=?) AND i.unit_price <> 0",from,to,status)
|
||||
|
||||
|
||||
|
||||
@@ -514,7 +517,7 @@ def self.get_by_shiftsales(from,to)
|
||||
return ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to)
|
||||
end
|
||||
|
||||
# def self.get_by_shiftsales(employee,from,to)
|
||||
# def self.get_by_shiftsales(from,to)
|
||||
# shift_sales = ShiftSale.select('shift_sales.id, cs.name as cashier_station_name, shift_sales.shift_started_at as opening_date, shift_sales.shift_closeed_at as closing_date')
|
||||
# .joins(" INNER JOIN cashier_terminals cs ON cs.id = shift_sales.cashier_terminal_id")
|
||||
# .where("shift_sales.employee_id = ? and (shift_sales.shift_started_at between ? and ? OR shift_sales.shift_closeed_at between ? and ? )", employee, from, to, from, to)
|
||||
@@ -529,23 +532,23 @@ end
|
||||
|
||||
# void = Sale.select("SUM(sales.grand_total) AS grand_total")
|
||||
# .joins("join shift_sales sh on sh.id = sales.shift_sale_id")
|
||||
# .where('sales.sales_status = "void" and sales.total_amount != 0 and sales.shift_sale_id = ?', shift.id)
|
||||
# .where('sales.sale_status = "void" and sales.total_amount != 0 and sales.shift_sale_id = ?', shift.id)
|
||||
# .sum(:grand_total)
|
||||
# cash = all_total.select('sr.payment_type')
|
||||
# .where('sr.payment_type = "cash"')
|
||||
# .sum(:amount)
|
||||
|
||||
# credit = all_total.where('sr.payment_type = "credit"')
|
||||
# credit = all_total.where('sr.payment_type = "creditnote"')
|
||||
# .sum(:amount)
|
||||
|
||||
# accept_credit = all_total.select('ci.amout')
|
||||
# .joins("INNER JOIN credit_items ci ON ci.sale_id = sales.id")
|
||||
# .where('sr.payment_type = "credit"')
|
||||
# .where('sr.payment_type = "creditnote"')
|
||||
# .sum(:amout)
|
||||
|
||||
|
||||
|
||||
# foc = all_total.where('sales.payment_type = "foc" and sales.sales_status = "completed"')
|
||||
# foc = all_total.where('sales.payment_type = "foc" and sales.sale_status = "completed"')
|
||||
# .sum(:grand_total)
|
||||
|
||||
# card = all_total.select('payment_type')
|
||||
@@ -571,6 +574,31 @@ end
|
||||
# return sale_arr
|
||||
# end
|
||||
|
||||
# def self.get_receipt_no_list(from,to)
|
||||
# sale = Sale.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
||||
# end
|
||||
|
||||
def self.get_by_shift_sale(from,to,status)
|
||||
query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date,shift_closed_at As closing_date," +
|
||||
" grand_total AS grand_total, cash_sales AS cash," +
|
||||
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to)
|
||||
end
|
||||
|
||||
def self.get_separate_tax(from,to,payment_type=nil)
|
||||
|
||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
.joins("INNER JOIN sales ON sales.id = sale_taxes.sale_id")
|
||||
.group("sale_taxes.tax_name")
|
||||
|
||||
return query = query.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
||||
end
|
||||
|
||||
def grand_total_after_rounding
|
||||
return self.old_grand_total.to_f + self.rounding_adjustment.to_f
|
||||
end
|
||||
|
||||
def get_cash_amount
|
||||
cash = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
@@ -604,7 +632,7 @@ end
|
||||
def get_commerical_tax
|
||||
tax = 0.0
|
||||
self.sale_taxes.each do |taxobj|
|
||||
if taxobj.tax_name == "Commerical Tax"
|
||||
if taxobj.tax_name == "Commercial Tax"
|
||||
tax += taxobj.tax_payable_amount
|
||||
end
|
||||
end
|
||||
@@ -616,8 +644,4 @@ end
|
||||
def generate_custom_id
|
||||
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
|
||||
end
|
||||
|
||||
def self.get_receipt_no_list(from,to)
|
||||
sale = Sale.where("sale_status=? and receipt_date between ? and ?","completed",from,to)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ class SaleItem < ApplicationRecord
|
||||
# Check for actual sale items
|
||||
sale_items.where("is_taxable = false AND remark = 'Discount'").find_each do |si|
|
||||
if si.account_id == a.id
|
||||
discount_account[:price] = (discount_account[:price] + si.price) * -1
|
||||
discount_account[:price] = (discount_account[:price].abs + si.price.abs) * -1
|
||||
end
|
||||
end
|
||||
discount_accounts.push(discount_account)
|
||||
|
||||
@@ -260,9 +260,27 @@ class SalePayment < ApplicationRecord
|
||||
self.sale.payment_status = "outstanding"
|
||||
end
|
||||
self.sale.sale_status = "completed"
|
||||
|
||||
response = rebat(sObj)
|
||||
|
||||
if response["status"] == true
|
||||
self.sale.rebate_status = 'true'
|
||||
end
|
||||
if response["status"] == false
|
||||
self.sale.rebate_status = 'false'
|
||||
end
|
||||
|
||||
if response[:status] == false
|
||||
self.sale.rebate_status = 'false'
|
||||
end
|
||||
if response[:status] == "no_member"
|
||||
self.sale.rebate_status = nil
|
||||
end
|
||||
|
||||
self.sale.save!
|
||||
table_update_status(sObj)
|
||||
rebat(sObj)
|
||||
|
||||
|
||||
if paid_amount != "0.0"
|
||||
update_shift
|
||||
end
|
||||
@@ -270,6 +288,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
# update for cashier shift
|
||||
def update_shift
|
||||
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
|
||||
if !shift.nil?
|
||||
@@ -303,7 +322,7 @@ class SalePayment < ApplicationRecord
|
||||
rebate_prices = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||
if generic_customer_id.present?
|
||||
paypar = sObj.sale_payments
|
||||
payparcost = 0
|
||||
credit = 0
|
||||
@@ -337,20 +356,25 @@ class SalePayment < ApplicationRecord
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}, :timeout => 100)
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false , message: "Server Time out"}
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
|
||||
response = { "status": false, "message": "Can't connect server"}
|
||||
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
response = { "status": false, "message": "Can't connect server"}
|
||||
|
||||
end
|
||||
return response
|
||||
# puts response.to_json
|
||||
return response
|
||||
puts response.to_json
|
||||
end
|
||||
end
|
||||
else
|
||||
response = { "status": "no_member", "message": "Not membership"}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -52,10 +52,34 @@ class ShiftSale < ApplicationRecord
|
||||
self.cash_sales = self.cash_sales.to_f + cash.to_f
|
||||
self.credit_sales = self.credit_sales.to_i + credit.to_f
|
||||
self.other_sales = self.other_sales.to_i + other_sales.to_f
|
||||
self.nett_sales = self.grand_total.to_i - self.commercial_taxes
|
||||
self.nett_sales = self.nett_sales + saleobj.total_amount.to_f #self.grand_total.to_i - self.commercial_taxes
|
||||
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
|
||||
self.total_receipt = self.total_receipt + 1
|
||||
self.save
|
||||
end
|
||||
|
||||
# Calculate by type and update
|
||||
def calculate(sale, type)
|
||||
saleobj = Sale.find_by_sale_id(sale)
|
||||
cash = saleobj.get_cash_amount
|
||||
credit = saleobj.get_credit_amount
|
||||
other_sales = saleobj.get_other_amount
|
||||
tax = saleobj.get_commerical_tax
|
||||
if type == "void"
|
||||
self.total_revenue = self.total_revenue.to_f - saleobj.total_amount.to_f
|
||||
self.total_discounts = self.total_discounts - saleobj.total_discount
|
||||
self.total_taxes = self.total_taxes - saleobj.total_tax
|
||||
self.grand_total = self.grand_total - saleobj.grand_total
|
||||
self.cash_sales = self.cash_sales.to_f - cash.to_f
|
||||
self.credit_sales = self.credit_sales.to_i - credit.to_f
|
||||
self.other_sales = self.other_sales.to_i - other_sales.to_f
|
||||
self.nett_sales = self.nett_sales - saleobj.total_amount.to_f #self.grand_total.to_i - self.commercial_taxes
|
||||
self.commercial_taxes = self.commercial_taxes.to_i - tax.to_f
|
||||
self.total_rounding = self.total_rounding - saleobj.rounding_adjustment
|
||||
self.total_void = self.total_void + saleobj.grand_total
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
||||
def get_closing_balance(shift)
|
||||
|
||||
@@ -68,6 +68,22 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ shift_sale.cashier_terminal.name}" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Opening Date : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "Closing Date : ", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||
text "#{ shift_sale.shift_closed_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
@@ -88,6 +104,12 @@ class CloseCashierPdf < Prawn::Document
|
||||
|
||||
move_down 10
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.page_width - 10, :height => 20) do
|
||||
text "Shift Sale Summary", :size => self.header_font_size, :align => :center
|
||||
end
|
||||
move_down 10
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Received Amount :", :size => self.item_font_size, :align => :right
|
||||
@@ -96,6 +118,23 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.closing_balance}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash In:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.cash_in}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash Out:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.cash_out}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Net Sales:", :size => self.item_font_size, :align => :right
|
||||
@@ -168,6 +207,22 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Receipts :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_receipt}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Void:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{shift_sale.total_void})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
class OrderItemPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
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(print_settings,order_item, print_status, options, alt_name)
|
||||
self.page_width = 210
|
||||
self.page_width = 185
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 30
|
||||
self.qty_width = 35
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - self.qty_width
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=100
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
@@ -30,7 +31,7 @@ class OrderItemPdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options, alt_name)
|
||||
order_items(order_item, options, alt_name, print_settings.precision)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -58,11 +59,11 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item, options, alt_name)
|
||||
def order_items(order_item, options, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options, alt_name)
|
||||
add_order_items(order_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
@@ -70,7 +71,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, options, alt_name)
|
||||
def add_order_items(order_item, options, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
@@ -80,7 +81,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
|
||||
text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -90,7 +91,7 @@ class OrderItemPdf < Prawn::Document
|
||||
|
||||
if alt_name
|
||||
move_down 4
|
||||
font("public/fonts/Chinese.ttf") do
|
||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
class OrderSummaryPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
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(print_settings,order, print_status, order_items = nil,alt_name)
|
||||
self.page_width = 210
|
||||
self.page_width = 190
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 30
|
||||
self.qty_width = 35
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=100
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
@@ -29,9 +30,9 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
# order items
|
||||
if order_items == nil
|
||||
order_items(order, alt_name)
|
||||
order_items(order, alt_name, print_settings.precision)
|
||||
else
|
||||
order_items(order_items, alt_name)
|
||||
order_items(order_items, alt_name, print_settings.precision)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +61,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item, alt_name)
|
||||
def order_items(order_item, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
@@ -75,12 +76,12 @@ class OrderSummaryPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, alt_name)
|
||||
add_order_items(order_item, alt_name, precision)
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, alt_name)
|
||||
def add_order_items(order_item, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
@@ -96,7 +97,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
text "#{number_with_precision(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
@@ -106,7 +107,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
if alt_name
|
||||
move_down 4
|
||||
font("public/fonts/Chinese.ttf") do
|
||||
font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
end
|
||||
|
||||
|
||||
@@ -140,12 +140,12 @@ class ReceiptBillPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
|
||||
pad_top(15) {
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :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}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_name_width,y_position], :width => self.qty_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
}
|
||||
move_down 1
|
||||
move_down 5
|
||||
end
|
||||
end
|
||||
|
||||
@@ -269,20 +269,19 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
rebate = 0
|
||||
balance = 0
|
||||
redeem = 0
|
||||
rebate_amount["data"].each do |res|
|
||||
|
||||
#total redeem amount
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||
redeem = redeem + res["redeem"]
|
||||
|
||||
balance = balance + res["balance"]
|
||||
end
|
||||
|
||||
|
||||
|
||||
#end Total redem
|
||||
#total Rebate Earn
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
|
||||
|
||||
rebate = rebate + res["rebate"]
|
||||
# balance = balance + res["balance"]
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
@@ -290,38 +289,48 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["balance"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Total Rebate Amount if birthday
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
|
||||
|
||||
rebate = rebate + res["rebate"]
|
||||
|
||||
# balance = balance + res["balance"]
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["balance"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
#end Total rebate if birthday
|
||||
end
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Redeem Amount", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
old = balance + redeem
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(old, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if member_info["status"] == true && member_info["data"].present?
|
||||
balance = 0
|
||||
member_info["data"].each do |res|
|
||||
@@ -377,10 +386,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
item_price_by_accounts.each do |ipa|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
bounding_box([0,y_position], :width =>self.label_width) do
|
||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<div class='row bottom'>
|
||||
<div class="pin_pad orange" data-value="CLR">CLR</div>
|
||||
<div class="pin_pad left" data-value="8">0</div>
|
||||
<div class="pin_pad left" data-value="0">0</div>
|
||||
<div class="pin_pad left purple" data-value="ENT">ENT</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="main-box-body clearfix" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table table-default" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">15%</div>
|
||||
<div class="fluid cashier_number" data-value="15" data-type="add">15%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||
@@ -149,7 +149,7 @@
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">20%</div>
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||
@@ -160,7 +160,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="50" data-type="add">30%</div>
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number"></div>
|
||||
@@ -190,6 +190,8 @@
|
||||
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">RemoveItem Discount</button>
|
||||
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
|
||||
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
|
||||
<!-- <hr />
|
||||
<button id="member-discount" class="btn btn-success btn-block action-btn">Member Discount</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -281,7 +283,7 @@ $(document).ready(function(){
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var discount_value = parseFloat($('#discount-amount').val());
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
@@ -328,10 +330,15 @@ $(document).ready(function(){
|
||||
// Remove selected discount items
|
||||
$("#remove-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var total = 0;
|
||||
|
||||
$('.discount-item-row.selected-item').each(function(i){
|
||||
var amount = parseFloat($(this).find('#item-total-price').text());
|
||||
total = total + Math.abs(amount);
|
||||
$(this).remove();
|
||||
});
|
||||
$("#order-sub-total").text(origin_sub_total + total);
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
@@ -350,13 +357,24 @@ $(document).ready(function(){
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
alert("Successfully Discount!");
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -370,8 +388,19 @@ $(document).ready(function(){
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
if(sale_items.length == 0){
|
||||
alert("You have no selected item!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "You have no selected item!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
@@ -379,8 +408,19 @@ $(document).ready(function(){
|
||||
discount_items.push(sale_items[i]);
|
||||
}
|
||||
else {
|
||||
alert("You have selected no discount item!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "You have selected no discount item!!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,13 +430,24 @@ $(document).ready(function(){
|
||||
url: "/origami/" + sale_id + "/remove_discount_items",
|
||||
data: params,
|
||||
success: function(result){
|
||||
alert('Removed Discount');
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -408,16 +459,54 @@ $(document).ready(function(){
|
||||
type: "GET",
|
||||
url: "/origami/" + sale_id + "/remove_all_discount",
|
||||
success: function(result){
|
||||
alert('Removed All Discount');
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Pay Discount for membership
|
||||
// $("#member-discount").on('click', function(e){
|
||||
// e.preventDefault();
|
||||
// var sale_id = $('#sale-id').text();
|
||||
// var sub_total = $('#order-sub-total').text();
|
||||
// var ajax_url = "/origami/" + sale_id + "/member_discount";
|
||||
|
||||
// // Selected Account
|
||||
// var account_types = JSON.stringify(get_selected_account_types());
|
||||
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
|
||||
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: ajax_url,
|
||||
// data: params,
|
||||
// success:function(result){
|
||||
// alert("Successfully Discount!");
|
||||
// if(result.table_type == "Table"){
|
||||
// window.location.href = "/origami/table/" + result.table_id
|
||||
// }
|
||||
// else {
|
||||
// window.location.href = "/origami/room/" + result.table_id
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
});
|
||||
|
||||
/* Remove Selection */
|
||||
@@ -511,10 +600,23 @@ function calculate_overall_discount(type, amount){
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "Percentage Value over 100!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
total_discount = (origin_sub_total * amount)/100;
|
||||
}
|
||||
total_discount = (origin_sub_total * amount)/100;
|
||||
}
|
||||
|
||||
$("#order-discount").text(total_discount);
|
||||
@@ -531,42 +633,43 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
// No Needs For Auto Selected
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
sub_total = origin_sub_total - total_discount;
|
||||
}
|
||||
@@ -574,57 +677,67 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "Percentage Value over 100!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
|
||||
else{
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
}
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
}
|
||||
}
|
||||
|
||||
// No Needs For Auto Selected
|
||||
// Check account types exists
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
console.log(account_types);
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// console.log(account_types);
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content" >
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="Completed" role="tabpanel">
|
||||
<div class="tab-pane" id="Completed" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane active" id="tables" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
@@ -88,7 +88,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="max-height:670px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#Completed" role="tab">Completed</a>
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
@@ -21,10 +21,10 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
|
||||
<div class="tab-pane" id="completed" role="tabpanel">
|
||||
<div class="tab-pane" id="completed" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane active" id="tables" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
|
||||
<% @orders.each do |order| %>
|
||||
@@ -150,7 +150,7 @@
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -182,6 +182,7 @@
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
|
||||
end
|
||||
@@ -468,8 +469,24 @@ $('#request_bills').click(function() {
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
success:function(result){
|
||||
|
||||
location.reload();
|
||||
if(!result.status){
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.error_message,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " 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;min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" 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;min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<!--- 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;min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" 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;min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane " id="completed" role="tabpanel">
|
||||
<div class="tab-pane " id="completed" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="tab-pane " id="tables" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane active" id="orders" role="tabpanel">
|
||||
<div class="tab-pane active" id="orders" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
@@ -140,7 +140,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="max-height:500px; overflow:auto">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table table-default" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
json.status true
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
<td style="width:50%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
||||
<td><strong>Table No</strong> - <%=@table_no%></td>
|
||||
<td><strong>Sale Id</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||
<td style="width:50%;"><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||
<td style="width:50%;"><strong>Customer ID :</strong> <%= @sale_data.customer.customer_id%></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -42,7 +43,7 @@
|
||||
count += 1
|
||||
%>
|
||||
|
||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||
<% sub_total += sale_item.price%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td style="width:60%; text-align:left">
|
||||
@@ -52,7 +53,7 @@
|
||||
<span id="item-qty"><%=sale_item.qty%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||
<span id="item-total-price"><%=(sale_item.price)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<%end %>
|
||||
@@ -119,7 +120,7 @@
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" style="line-height:30px;height: 30px;margin-bottom: 0px;" >
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-12">Other Payments</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -320,6 +321,9 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
// Disable click event cash to prevent
|
||||
$(".payment .cash-color").off('click');
|
||||
|
||||
$('#credit_payment').click(function() {
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/credit_payment"
|
||||
@@ -338,28 +342,58 @@ $( 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();
|
||||
// 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_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
localStorage.removeItem("cash");
|
||||
if($('#balance').text() < 0){
|
||||
alert("Changed amount " + $('#balance').text() * (-1) )
|
||||
}else{
|
||||
$('#pay').text("Pay")
|
||||
alert("Thank you")
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
|
||||
if($('#balance').text() < 0){
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: 'Changed amount ' + $('#balance').text() * (-1),
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$('#pay').text("Pay")
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: 'Thank you !',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#void').on('click',function () {
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
json.status true
|
||||
if @status == true
|
||||
#show invoice number and stuff
|
||||
json.status @status
|
||||
else
|
||||
json.status @status
|
||||
json.error_message @error_message
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="max-height:600px; overflow:auto">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content" >
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane" id="completed" role="tabpanel">
|
||||
<div class="tab-pane" id="completed" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="tab-pane " id="tables" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
@@ -65,20 +65,27 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<% if room.get_booking.nil? %>
|
||||
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
|
||||
<% else %>
|
||||
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if room.get_booking.nil? %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
|
||||
<div style="font-size:12px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms blue text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
@@ -91,7 +98,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
@@ -114,7 +121,7 @@
|
||||
<div class="card-header">
|
||||
<% if @status == 'order' %>
|
||||
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
<% elsif @status == 'sale' %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @room.name rescue "" %></div>
|
||||
<% end %>
|
||||
|
||||
@@ -141,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -218,7 +225,7 @@
|
||||
</div>
|
||||
<br>
|
||||
<%
|
||||
if @status_sale == 'sale'
|
||||
if @status == 'sale'
|
||||
unless @order_items.nil?
|
||||
%>
|
||||
Pending New Order
|
||||
@@ -272,10 +279,10 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<% if @dining.bookings.length >= 1 %>
|
||||
<% if @room.bookings.length >= 1 %>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<% if @status == 'order' && @status != 'sale' %>
|
||||
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
|
||||
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
|
||||
@@ -332,7 +339,7 @@ $(document).ready(function(){
|
||||
// })
|
||||
|
||||
$('.invoicedetails').on('click',function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
var dining_id = "<%= @room.id %>";
|
||||
var sale_id = this.id;
|
||||
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
|
||||
})
|
||||
@@ -431,7 +438,7 @@ $("#first_bill").on('click', function(){
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
||||
alert(url)
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/origami/sale/'+ sale_id + "/rounding_adj",
|
||||
@@ -450,8 +457,24 @@ $('#request_bills').click(function() {
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
success:function(result){
|
||||
|
||||
location.reload();
|
||||
if(!result.status){
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.error_message,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -466,8 +489,8 @@ $('#back').on('click',function(){
|
||||
})
|
||||
|
||||
$('#add_invoice').on('click',function(){
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var dining_id = "<%= @room.id %>"
|
||||
var sale_id = "<%= @obj.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/append_order";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -549,8 +572,8 @@ $('#add_invoice').on('click',function(){
|
||||
}
|
||||
|
||||
$('#edit').on('click',function(){
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var dining_id = "<%= @room.id %>"
|
||||
var sale_id = "<%= @obj.sale_id rescue "" %>"
|
||||
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||
});
|
||||
|
||||
|
||||
@@ -22,15 +22,16 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table " id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th style="item-attr-edit">QTY</td>
|
||||
<th class="item-attr-edit">Price</td>
|
||||
<th class='item-attr'> Action </th>
|
||||
<th width="4%">#</th>
|
||||
<th class="" width="30%">Items</th>
|
||||
<th style="" width="13%">QTY</td>
|
||||
<th class="" width="13%">Price</td>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="17%"> Action </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -47,24 +48,46 @@
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td width="4%"><%= count %></td>
|
||||
<td class='' width="30%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
|
||||
<td class='item-attr-edit'><input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" /></td>
|
||||
<td class='item-attr-edit'><input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" /></td>
|
||||
<td class='item-attr'>
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm update'>Update</button>
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-sm void'>Void</button></td>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
</td> -->
|
||||
<td class='' width="17%">
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update
|
||||
</button>
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
|
||||
</td>
|
||||
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
||||
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td>
|
||||
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" disabled/></td>
|
||||
<td class='item-attr'>
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm cancel'>Cancel Void/Update</button>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td> -->
|
||||
<td class='' width="17%">
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel Void/Update</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td>
|
||||
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" disabled/></td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
@@ -99,20 +122,35 @@
|
||||
<script>
|
||||
// Bill Request
|
||||
$(document).ready(function(){
|
||||
|
||||
$(".update").on('click',function() {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#'+sale_item_id + "_qty").val();
|
||||
var price = $('#'+ sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#'+sale_item_id + "_qty").val();
|
||||
var price = $('#'+ sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
|
||||
success:function(result){
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'Qty and Price was successfully Updated',
|
||||
buttons: {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green btn-lg',
|
||||
action: function(){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.void').on('click',function(){
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||
<div class="tab-pane active" id="completed" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="tab-pane " id="tables" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel">
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
@@ -126,7 +126,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="max-height:400px; overflow:auto">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -222,6 +222,22 @@ $('#pay').on('click',function() {
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
|
||||
$('#void').on('click',function () {
|
||||
var sure = confirm("Are you sure want to Void");
|
||||
if (sure == true) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<div class="card-text" style="max-height:600px; overflow:auto">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Unique code</th>
|
||||
<th>Template</th>
|
||||
<!-- <th>Db name</th>
|
||||
<!--<th>Template</th>
|
||||
<th>Db name</th>
|
||||
<th>Db type</th>
|
||||
<th>Db username</th>
|
||||
<th>Db password</th> -->
|
||||
@@ -38,8 +38,8 @@
|
||||
<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.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> -->
|
||||
|
||||
@@ -1,70 +1,78 @@
|
||||
<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 %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Unique code:</strong>
|
||||
<%= @print_setting.unique_code %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Template:</strong>
|
||||
<%= @print_setting.template %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Db name:</strong>
|
||||
<%= @print_setting.db_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Db type:</strong>
|
||||
<%= @print_setting.db_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Db username:</strong>
|
||||
<%= @print_setting.db_username %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Db password:</strong>
|
||||
<%= @print_setting.db_password %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Printer name:</strong>
|
||||
<%= @print_setting.printer_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Api settings:</strong>
|
||||
<%= @print_setting.api_settings %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Page width:</strong>
|
||||
<%= @print_setting.page_width %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Page height:</strong>
|
||||
<%= @print_setting.page_height %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Print copies:</strong>
|
||||
<%= @print_setting.print_copies %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_print_setting_path(@print_setting) %> |
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= print_settings_path %>">Print Setting</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
<li>
|
||||
<%= link_to 'Edit', edit_print_setting_path(@print_setting) %> |
|
||||
<%= link_to 'Back', print_settings_path %>
|
||||
</li>
|
||||
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><%= @print_setting.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Unique code</th>
|
||||
<td><%= @print_setting.unique_code %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Template</th>
|
||||
<td><%= @print_setting.template %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db name</th>
|
||||
<td><%= @print_setting.db_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db type</th>
|
||||
<td><%= @print_setting.db_type %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db username</th>
|
||||
<td><%= @print_setting.db_username %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Db password</th>
|
||||
<td><%= @print_setting.db_password %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Printer name</th>
|
||||
<td><%= @print_setting.printer_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Api settings</th>
|
||||
<td><%= @print_setting.api_settings %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Page width</th>
|
||||
<td><%= @print_setting.page_width %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Page height</th>
|
||||
<td><%= @print_setting.page_height %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Print copies</th>
|
||||
<td><%= @print_setting.print_copies %></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,17 +19,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
||||
<!-- <div class="form-group col-md-2">
|
||||
<label>Select Type</label>
|
||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
||||
<option value="0">All Sale Type</option>
|
||||
<option value="1">Revenue Only</option>
|
||||
<option value="2">Discount Only</option>
|
||||
<option value="3">Void Only</option>
|
||||
<option value="4">Taxes Only</option>
|
||||
<option value="5">Other Amount Only</option>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="">From</label>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<% visa += sale[:visa_amount] %>
|
||||
<% jcb += sale[:jcb_amount] %>
|
||||
<% paypar += sale[:paypar_amount] %>
|
||||
<% cash += sale[:cash_amount] %>
|
||||
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
@@ -86,7 +86,7 @@
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="report_type" value="shift_item" id="sel_receipt_no">
|
||||
<div class="form-group col-md-2">
|
||||
<label>Select Type</label>
|
||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
||||
@@ -29,16 +30,20 @@
|
||||
<option value="5">Other Amount Only</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<div class="form-group col-md-2">
|
||||
<label class="">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
<div class="form-group col-md-2 margin-top-20">
|
||||
<div class="form-group col-md-2">
|
||||
<label class="">All Shift</label>
|
||||
<select name="shift_name" id="shift_name" class="form-control"></select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 margin-top-20">
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,11 +75,7 @@
|
||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||
<% end %>
|
||||
|
||||
<% if defined? shift_name %>
|
||||
<!-- Temporary no needs
|
||||
<select name="shift_name" id="shift_name"></select>
|
||||
-->
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if defined? cashiers %>
|
||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
||||
@@ -116,22 +117,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class = "row">
|
||||
|
||||
<div class = "span3">
|
||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
||||
</div>
|
||||
<div class = "span3">
|
||||
<select name="shift" id="shift">
|
||||
<option value="">All Shift</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class = "span3">
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
@@ -165,20 +150,12 @@ $(function(){
|
||||
}
|
||||
});
|
||||
|
||||
//Reset the form to pervious values
|
||||
$("#branch").val(<%=params[:branch]%>);
|
||||
$("#waiter").val("<%=params[:waiter]%>");
|
||||
$("#cashier").val(<%=params[:cashier]%>);
|
||||
$("#product").val(<%=params[:product]%>);
|
||||
$("#singer").val(<%=params[:singer]%>);
|
||||
$("#item").val('<%=params[:item]%>');
|
||||
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||
|
||||
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
$("#sel_period").val(<%=params[:period]%>);
|
||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||
// $("#from").val("<%=params[:from] rescue '-'%>");
|
||||
// $("#to").val("<%=params[:to] rescue '-'%>");
|
||||
// $("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||
// $("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||
|
||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||
$("#rd_period_type_1").attr("checked","checked");
|
||||
@@ -208,4 +185,4 @@ $('#item').change(function(){
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,115 +1,209 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<!-- <div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Receipt No</th>
|
||||
<th style='text-align:center;'>Cashier Name</th>
|
||||
<th style='text-align:center;'>Gross Sales</th>
|
||||
<th style='text-align:center;'>Discount</th>
|
||||
<th style='text-align:center;'>Total Sales</th>
|
||||
<% TaxProfile.all.each do |r|%>
|
||||
<th style='text-align:center;'><%=r.name%></th>
|
||||
<% end %>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
<% if !params[:from].blank?%>
|
||||
<tr>
|
||||
<th colspan="7">From Date : <%= params[:from] rescue '-' %> , To Date : <%= params[:to] rescue '-'%></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift.employee %>
|
||||
<% cashier_name = !@shift.nil? ? @shift.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tbody>
|
||||
<% total_sales = 0 %>
|
||||
<% net_sales = 0 %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
||||
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
||||
<tr>
|
||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||
<% sale.sale_taxes.each do |sale|%>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||
<% end %>
|
||||
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<tr>
|
||||
<th>Recipt No</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Discount Amount </th>
|
||||
<th>Tax Amount</th>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th>Grand Total</th>
|
||||
<th>Rounding Adj.</th>
|
||||
<th>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
<% discount_amt = 0 %>
|
||||
<% other_amt = 0 %>
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
|
||||
<%
|
||||
if @sale_data!=nil
|
||||
@sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<td><%= result.total_tax rescue '-' %></td>
|
||||
|
||||
|
||||
<td><%= result.grand_total %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||
<td><b><%= sprintf "%.2f",total_tax rescue '-'%></b></td><!--
|
||||
<td><b><%= sprintf "%.2f",service_charge rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= other_amt rescue '-'%></b></td> -->
|
||||
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td>Total Amount</td>
|
||||
<td>Discount Amount</td>
|
||||
<td>Tax Amount</td>
|
||||
<td>Grand Total</td>
|
||||
<td>Rounding Adj.</td>
|
||||
<td>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= paginate @sale_data %>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
var check_arr = [];
|
||||
var search = '<%= params[:period_type] %>';
|
||||
if(search){
|
||||
if(parseInt(search) == 0){
|
||||
search_by_period();
|
||||
$(function(){
|
||||
|
||||
var check_arr = [];
|
||||
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
search_by_period();
|
||||
|
||||
});
|
||||
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
|
||||
$('#from').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
$('#to').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
function search_by_date(){
|
||||
var from = $('#from').val();
|
||||
var to = $('#to').val();
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
|
||||
check_arr.push(to);
|
||||
|
||||
console.log(check_arr.length)
|
||||
if(check_arr.length == 1){
|
||||
show_shift_name(period,period_type,from,to,'shift_item');
|
||||
}
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
search_by_date();
|
||||
|
||||
function show_shift_name(period,period_type,from,to,shift_item){
|
||||
var shift = $('#shift_name');
|
||||
|
||||
shift.empty();
|
||||
|
||||
var str = '';
|
||||
var param_shift = '';
|
||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||
|
||||
url = '<%= reports_get_shift_by_date_path %>';
|
||||
|
||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||
|
||||
str = '<option value="0">--- All Shift ---</option>';
|
||||
$(data.message).each(function(index){
|
||||
|
||||
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
||||
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||
|
||||
if(param_shift != ''){
|
||||
if(sh_date == param_shift){
|
||||
selected = 'selected = "selected"';
|
||||
}
|
||||
else{
|
||||
selected = '';
|
||||
}
|
||||
}else{
|
||||
selected = '';
|
||||
}
|
||||
str += '<option value="'+ sh_date +'" '+ selected +'>' + local_date + '</option>';
|
||||
|
||||
// console.log(sh_date)
|
||||
})
|
||||
shift.append(str);
|
||||
});
|
||||
}
|
||||
}else{
|
||||
search_by_period();
|
||||
}
|
||||
$('#sel_period').change(function(){
|
||||
search_by_period();
|
||||
});
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
}
|
||||
|
||||
$('#from').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
$('#to').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
function search_by_date(){
|
||||
var from = $('#from').val();
|
||||
var to = $('#to').val();
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
check_arr.push(to);
|
||||
// console.log(check_arr.length)
|
||||
if(check_arr.length == 1){
|
||||
}
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -1,43 +1,91 @@
|
||||
<div class="span12">
|
||||
<div class="table-responsive">
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
<% if !params[:from].blank?%>
|
||||
<tr>
|
||||
<th colspan="7">From Date : <%= params[:from] rescue '-' %> , To Date : <%= params[:to] rescue '-'%></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
<% if @shift.employee %>
|
||||
<% cashier_name = !@shift.nil? ? @shift.employee.name : '-' %>
|
||||
<% end %>
|
||||
<th colspan="7">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Receipt No</th>
|
||||
<th style='text-align:center;'>Cashier Name</th>
|
||||
<th style='text-align:center;'>Gross Sales</th>
|
||||
<th style='text-align:center;'>Discount</th>
|
||||
<th style='text-align:center;'>Total Sales</th>
|
||||
<% TaxProfile.all.each do |r|%>
|
||||
<th style='text-align:center;'><%=r.name%></th>
|
||||
<% end %>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th>Recipt No</th>
|
||||
<th>Cashier Name</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Discount Amount </th>
|
||||
<th>Tax Amount</th>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th>Grand Total</th>
|
||||
<th>Rounding Adj.</th>
|
||||
<th>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
<% discount_amt = 0 %>
|
||||
<% other_amt = 0 %>
|
||||
<% total_nett = 0 %>
|
||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||
|
||||
<tbody>
|
||||
<% total_sales = 0 %>
|
||||
<% net_sales = 0 %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
||||
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
||||
<tr>
|
||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||
<% sale.sale_taxes.each do |sale|%>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||
<% end %>
|
||||
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f",result.total_tax rescue '-' %></td>
|
||||
|
||||
|
||||
<td><%= result.grand_total %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
<td><b><%= total_sum rescue '-'%></b></td>
|
||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||
<td><b><%= sprintf "%.2f",total_tax rescue '-'%></b></td><!--
|
||||
<td><b><%= sprintf "%.2f",service_charge rescue '-'%></b></td> -->
|
||||
<!-- <td><b><%= other_amt rescue '-'%></b></td> -->
|
||||
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td>Total Amount</td>
|
||||
<td>Discount Amount</td>
|
||||
<td>Tax Amount</td>
|
||||
<td>Grand Total</td>
|
||||
<td>Rounding Adj.</td>
|
||||
<td>Grand Total +<br/>
|
||||
Rounding Adj.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
115
app/views/reports/receipt_no/indexback.html.erb
Normal file
115
app/views/reports/receipt_no/indexback.html.erb
Normal file
@@ -0,0 +1,115 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Receipt List Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container margin-top-20">
|
||||
<div class="card row">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Receipt No</th>
|
||||
<th style='text-align:center;'>Cashier Name</th>
|
||||
<th style='text-align:center;'>Gross Sales</th>
|
||||
<th style='text-align:center;'>Discount</th>
|
||||
<th style='text-align:center;'>Total Sales</th>
|
||||
<% TaxProfile.all.each do |r|%>
|
||||
<th style='text-align:center;'><%=r.name%></th>
|
||||
<% end %>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% total_sales = 0 %>
|
||||
<% net_sales = 0 %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
||||
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
||||
<tr>
|
||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||
<% sale.sale_taxes.each do |sale|%>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||
<% end %>
|
||||
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= paginate @sale_data %>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
var check_arr = [];
|
||||
var search = '<%= params[:period_type] %>';
|
||||
if(search){
|
||||
if(parseInt(search) == 0){
|
||||
search_by_period();
|
||||
}
|
||||
else{
|
||||
search_by_date();
|
||||
}
|
||||
}else{
|
||||
search_by_period();
|
||||
}
|
||||
$('#sel_period').change(function(){
|
||||
search_by_period();
|
||||
});
|
||||
function search_by_period(){
|
||||
var period = $('#sel_period').val();
|
||||
var period_type = 0;
|
||||
var from = "";
|
||||
var to = "";
|
||||
}
|
||||
|
||||
$('#from').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
|
||||
$('#to').change(function(){
|
||||
search_by_date();
|
||||
});
|
||||
function search_by_date(){
|
||||
var from = $('#from').val();
|
||||
var to = $('#to').val();
|
||||
var period = 0;
|
||||
var period_type = 1;
|
||||
if(to != '' && from != ''){
|
||||
shift_name = from + ',' + to;
|
||||
check_arr.push(to);
|
||||
// console.log(check_arr.length)
|
||||
if(check_arr.length == 1){
|
||||
}
|
||||
if(check_arr.length == 3){
|
||||
check_arr = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
43
app/views/reports/receipt_no/indexback.xls.erb
Normal file
43
app/views/reports/receipt_no/indexback.xls.erb
Normal file
@@ -0,0 +1,43 @@
|
||||
<div class="span12">
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='text-align:center;'>Date</th>
|
||||
<th style='text-align:center;'>Receipt No</th>
|
||||
<th style='text-align:center;'>Cashier Name</th>
|
||||
<th style='text-align:center;'>Gross Sales</th>
|
||||
<th style='text-align:center;'>Discount</th>
|
||||
<th style='text-align:center;'>Total Sales</th>
|
||||
<% TaxProfile.all.each do |r|%>
|
||||
<th style='text-align:center;'><%=r.name%></th>
|
||||
<% end %>
|
||||
<th style='text-align:center;'>Nett Sales</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% total_sales = 0 %>
|
||||
<% net_sales = 0 %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
||||
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
||||
<tr>
|
||||
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||
<% sale.sale_taxes.each do |sale|%>
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||
<% end %>
|
||||
|
||||
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Daily Sale Report</li>
|
||||
<li>Sale Item Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<td><%= link_to employee.name,settings_employee_path(employee) %></td>
|
||||
<td><%= employee.role %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
<%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', settings_employee_path(employee) , method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -1,16 +1,37 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_employees_path %>">Employee</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Employee</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Role</th>
|
||||
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @employee.name %>
|
||||
</p>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @employee.name %></td>
|
||||
<td><%= @employee.role %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_settings_employee_path(@employee) %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<strong>Role:</strong>
|
||||
<%= @employee.role %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<strong>Employee ID:</strong>
|
||||
<%= @employee.emp_id %>
|
||||
</p>
|
||||
|
||||
@@ -11,17 +11,15 @@
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<div class="card-block">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Membership type</th>
|
||||
<th>Is active</th>
|
||||
<th>Gateway communication type</th>
|
||||
<th>Gateway url</th>
|
||||
<th>Auth token</th>
|
||||
<th>Merchant account</th>
|
||||
<th>Created by</th>
|
||||
<th>Additional parameter</th>
|
||||
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -30,13 +28,8 @@
|
||||
<% @settings_membership_actions.each do |settings_membership_action| %>
|
||||
<tr>
|
||||
<td><%= settings_membership_action.membership_type %></td>
|
||||
<td><%= settings_membership_action.is_active %></td>
|
||||
<td><%= settings_membership_action.gateway_communication_type %></td>
|
||||
<td><%= settings_membership_action.gateway_url %></td>
|
||||
<td><%= settings_membership_action.auth_token %></td>
|
||||
<td><%= settings_membership_action.merchant_account_id %></td>
|
||||
<td><%= settings_membership_action.created_by %></td>
|
||||
<td><%= settings_membership_action.additional_parameter %></td>
|
||||
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
|
||||
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
@@ -44,4 +37,6 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,44 +1,58 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_membership_actions_path %>">Membership Action</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
<li> <%= link_to 'Edit', edit_settings_membership_action_path(@settings_membership_action) %> |
|
||||
<%= link_to 'Back', settings_membership_actions_path %></li>
|
||||
|
||||
<p>
|
||||
<strong>Membership type:</strong>
|
||||
<%= @settings_membership_action.membership_type %>
|
||||
</p>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Membership type</th>
|
||||
<td><%= @settings_membership_action.membership_type %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Is active</th>
|
||||
<td><%= @settings_membership_action.is_active %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gateway communication type</th>
|
||||
<td><%= @settings_membership_action.gateway_communication_type %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gateway url</th>
|
||||
<td><%= @settings_membership_action.gateway_url %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Auth token</th>
|
||||
<td><%= @settings_membership_action.auth_token %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Merchant account</th>
|
||||
<td><%= @settings_membership_action.merchant_account_id %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Created by</th>
|
||||
<td><%= @settings_membership_action.created_by %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Additional parameter</th>
|
||||
<td><%= @settings_membership_action.additional_parameter %></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<strong>Is active:</strong>
|
||||
<%= @settings_membership_action.is_active %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<strong>Gateway communication type:</strong>
|
||||
<%= @settings_membership_action.gateway_communication_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Gateway url:</strong>
|
||||
<%= @settings_membership_action.gateway_url %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Auth token:</strong>
|
||||
<%= @settings_membership_action.auth_token %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Merchant account:</strong>
|
||||
<%= @settings_membership_action.merchant_account_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Created by:</strong>
|
||||
<%= @settings_membership_action.created_by %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Additional parameter:</strong>
|
||||
<%= @settings_membership_action.additional_parameter %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_membership_action_path(@settings_membership_action) %> |
|
||||
<%= link_to 'Back', settings_membership_actions_path %>
|
||||
|
||||
@@ -1,39 +1,49 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Membership type:</strong>
|
||||
<%= @settings_membership_setting.membership_type %>
|
||||
</p>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_membership_settings_path %>">Membership Setting</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Membership type</th>
|
||||
<th>Is active</th>
|
||||
<th>Gateway communication type</th>
|
||||
<th>Gateway url</th>
|
||||
<th>Auth token</th>
|
||||
<th>Merchant account</th>
|
||||
<th>Created by</th>
|
||||
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<p>
|
||||
<strong>Is active:</strong>
|
||||
<%= @settings_membership_setting.is_active %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Gateway communication type:</strong>
|
||||
<%= @settings_membership_setting.gateway_communication_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Gateway url:</strong>
|
||||
<%= @settings_membership_setting.gateway_url %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Auth token:</strong>
|
||||
<%= @settings_membership_setting.auth_token %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Merchant account:</strong>
|
||||
<%= @settings_membership_setting.merchant_account rescue ''%>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Created by:</strong>
|
||||
<%= @settings_membership_setting.created_by %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_membership_setting_path(@settings_membership_setting) %> |
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @settings_membership_setting.membership_type %></td>
|
||||
<td><%= @settings_membership_setting.is_active %></td>
|
||||
<td><%= @settings_membership_setting.gateway_communication_type %></td>
|
||||
<td><%= @settings_membership_setting.gateway_url %></td>
|
||||
<td><%= @settings_membership_setting.auth_token %></td>
|
||||
<td><%= @settings_membership_setting.merchant_account rescue ''%></td>
|
||||
<td><%= @settings_membership_setting.created_by %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_settings_membership_setting_path(@settings_membership_setting) %> |
|
||||
<%= link_to 'Back', settings_membership_settings_path %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -2,62 +2,52 @@
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_order_queue_stations_path %>">Order Queue Stations</a></li>
|
||||
<li>Order Queue Station</li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Menu Item Option</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Station name</th>
|
||||
<th>Is active</th>
|
||||
<th>Auto Print</th>
|
||||
<th>Processing items</th>
|
||||
<th>Print copy</th>
|
||||
<th>Printer name</th>
|
||||
<th>Font size</th>
|
||||
<th>Cut per item</th>
|
||||
<th>Use alternate name</th>
|
||||
<th>Created by</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<p id="notice"><%= notice %></p>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @settings_order_queue_station.station_name %></td>
|
||||
<td><%= @settings_order_queue_station.is_active %></td>
|
||||
<td><%= @settings_order_queue_station.auto_print %></td>
|
||||
<td><%= @settings_order_queue_station.processing_items %></td>
|
||||
<td><%= @settings_order_queue_station.print_copy %></td>
|
||||
<td><%= @settings_order_queue_station.printer_name %></td>
|
||||
<td><%= @settings_order_queue_station.font_size %></td>
|
||||
<td><%= @settings_order_queue_station.cut_per_item %></td>
|
||||
<td><%= @settings_order_queue_station.use_alternate_name %></td>
|
||||
<td><%= @settings_order_queue_station.created_by %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_settings_order_queue_station_path(@settings_order_queue_station) %> | <%= link_to 'Destroy', settings_order_queue_station_path(@settings_order_queue_station), method: :delete, data: { confirm: 'Are you sure?' } %> |
|
||||
|
||||
<p>
|
||||
<strong>Station name:</strong>
|
||||
<%= @settings_order_queue_station.station_name %>
|
||||
</p>
|
||||
<%= link_to 'Back', settings_order_queue_stations_path %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<strong>Is active:</strong>
|
||||
<%= @settings_order_queue_station.is_active %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Auto Print:</strong>
|
||||
<%= @settings_order_queue_station.auto_print %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Processing items:</strong>
|
||||
<%= @settings_order_queue_station.processing_items %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Print copy:</strong>
|
||||
<%= @settings_order_queue_station.print_copy %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Printer name:</strong>
|
||||
<%= @settings_order_queue_station.printer_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Font size:</strong>
|
||||
<%= @settings_order_queue_station.font_size %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Cut per item:</strong>
|
||||
<%= @settings_order_queue_station.cut_per_item %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Use alternate name:</strong>
|
||||
<%= @settings_order_queue_station.use_alternate_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Created by:</strong>
|
||||
<%= @settings_order_queue_station.created_by %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_order_queue_station_path(@settings_order_queue_station) %> | <%= link_to 'Destroy', settings_order_queue_station_path(@settings_order_queue_station), method: :delete, data: { confirm: 'Are you sure?' } %> |
|
||||
|
||||
<%= link_to 'Back', settings_order_queue_stations_path %>
|
||||
</div>
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Customer Details</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#sale_audit" role="tab">Sale Audits</a>
|
||||
</li> -->
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
@@ -205,15 +205,16 @@
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<th colspan="8">Membership Transactions</th>
|
||||
<th colspan="5">Membership Transactions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<!-- <th>Account No</th> -->
|
||||
<th>From Account</th>
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
@@ -226,7 +227,7 @@
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<!-- <td><%= transaction["account_no"] %></td> -->
|
||||
<td><%= transaction["account_status"] %></td>
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
@@ -244,15 +245,24 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Action </th>
|
||||
<th>Action At</th>
|
||||
<th>Approved By</th>
|
||||
<th>Approved At</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<% @sale_audits.each do |audit| %>
|
||||
<tr>
|
||||
<td><%= audit.action%></td>
|
||||
<td><%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%></td>
|
||||
<td><%= audit.approved_by.to_datetime.strftime("%m-%d-%Y %H:%M %p")%></td>
|
||||
<td><%= audit.remark%></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -53,5 +53,5 @@ Rails.application.configure do
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
|
||||
# Set Cable URL
|
||||
config.action_cable.url = "ws://192.168.1.140:3002/cable"
|
||||
# config.action_cable.url = "ws://192.168.1.140:3002/cable"
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ Rails.application.routes.draw do
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
# Action Cable Creation
|
||||
mount ActionCable.server => "/cable"
|
||||
# mount ActionCable.server => "/cable"
|
||||
|
||||
#--------- SmartSales Installation ------------#
|
||||
get 'install' => 'install#index'
|
||||
@@ -104,6 +104,9 @@ Rails.application.routes.draw do
|
||||
get "/:id/remove_all_discount" => "discounts#remove_all_discount"
|
||||
post "/:id/remove_discount_items" => "discounts#remove_discount_items"
|
||||
|
||||
# Discount for Member
|
||||
# post "/:id/member_discount" => "discounts#member_discount"
|
||||
|
||||
get "/:id/request_bills" => "request_bills#print",:as => "request_bill"
|
||||
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
|
||||
|
||||
@@ -268,10 +271,12 @@ Rails.application.routes.draw do
|
||||
|
||||
#--------- Reports Controller Sections ------------#
|
||||
namespace :reports do
|
||||
resources :receipt_no, :only => [:index, :show]
|
||||
resources :receipt_no
|
||||
resources :dailysale, :only => [:index, :show]
|
||||
resources :saleitem, :only => [:index, :show]
|
||||
resources :shiftsale, :only => [:index, :show]
|
||||
|
||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||
# resources :sales, :only => [:index, :show]
|
||||
# resources :orders, :only => [:index, :show]
|
||||
# resources :customers, :only => [:index, :show]
|
||||
|
||||
@@ -2,6 +2,11 @@ set :environment, "development"
|
||||
env :PATH, ENV['PATH']
|
||||
set :output, 'log/whenever.log'
|
||||
|
||||
every 30.minutes do
|
||||
runner "Customer.update_rebate"
|
||||
end
|
||||
|
||||
every 30.minutes do
|
||||
runner "Customer.update_membership"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
# :concurrency: 25
|
||||
# :pidfile: /home/superuser/Application/production/sxrestaurant/tmp/pids/sidekiq.pid
|
||||
# :logfile: /home/superuser/Application/production/sxrestaurant/log/sidekiq.log
|
||||
# :queues:
|
||||
# - default
|
||||
# - [high_priority, 2]
|
||||
# :demon: true
|
||||
|
||||
---
|
||||
:concurrency: 25
|
||||
:pidfile: /home/superuser/Application/production/sxrestaurant/tmp/pids/sidekiq.pid
|
||||
:logfile: /home/superuser/Application/production/sxrestaurant/log/sidekiq.log
|
||||
:pidfile: ./tmp/pids/sidekiq.pid
|
||||
:logfile: ./log/sidekiq.log
|
||||
:queues:
|
||||
- default
|
||||
- [high_priority, 2]
|
||||
:demon: true
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
|
||||
t.integer :dining_count, :default => 0
|
||||
t.integer :takeaway_count, :default => 0
|
||||
t.integer :member_count, :default => 0
|
||||
t.integer :total_rounding, :default => 0
|
||||
t.integer :total_receipt, :default => 0
|
||||
t.decimal :total_void, :default => 0
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,6 +13,7 @@ class CreateSales < ActiveRecord::Migration[5.1]
|
||||
t.string :payment_status, :null => false, :default => "outstanding"
|
||||
t.string :sale_status, :null => false, :default => "new"
|
||||
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :discount_type, :default => "overall"
|
||||
t.decimal :total_discount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :total_tax, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :tax_type, :null => false , :dfault => "exclusive_tax"
|
||||
@@ -22,6 +23,7 @@ class CreateSales < ActiveRecord::Migration[5.1]
|
||||
t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.integer :shift_sale_id
|
||||
t.decimal :old_grand_total
|
||||
t.string :rebate_status
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,7 +103,7 @@ customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contac
|
||||
# room = Room.create({name:"Table 2", zone: zone2, status:"available", seater: 4 , order_by:1, created_by:"SYSTEM DEFAULT"})
|
||||
|
||||
#Tax Profile
|
||||
tax_profiles = TaxProfile.create({id:1, name: "Commerical Tax", rate:5.0, order_by:1, created_by:"SYSTEM DEFAULT"})
|
||||
tax_profiles = TaxProfile.create({id:1, name: "Commercial Tax", rate:5.0, order_by:1, created_by:"SYSTEM DEFAULT"})
|
||||
|
||||
#Account for Menu Item Type (eg: Food, Beverage)
|
||||
# food = Account.create({title: "Food", account_type: "0"})
|
||||
|
||||
@@ -9,24 +9,30 @@ beverage = Account.create({title: "Beverage", account_type: "1"})
|
||||
menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"})
|
||||
# single pot
|
||||
menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
# menu_category1_menu_item01 = SimpleMenuItem.create({item_code:"010010", name: "Beauty Collagen Broth", alt_name: "胶原蛋白养颜美容锅",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
# menu_category1_menu_item02 = SimpleMenuItem.create({item_code:"010011", name: "Spicy Nourishing Broth", alt_name: "滋补养生香辣锅",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
# menu_category1_menu_item03 = SimpleMenuItem.create({item_code:"010012", name: "Herbal Drunken Chicken Broth", alt_name: "养生药膳醉鸡锅",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
# menu_category1_menu_item04 = SimpleMenuItem.create({item_code:"010013", name: "Cooling Coconut Broth", alt_name: "清凉解热雪耳椰子锅",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
# menu_category1_menu_item05 = SimpleMenuItem.create({item_code:"010014", name: "Lonevity Wild Pine Mushroom Broth", alt_name: "长生抗癌松茸菌锅",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
# menu_category1_menu_item06 = SimpleMenuItem.create({item_code:"010015", name: "Vitamin C Tomato Sweet Corn Broth", alt_name: "维他命C番茄玉米锅",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Single Pot",item_instance_code:"II0011", menu_item: menu_category1_menu_item0, price:0.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0051", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0061", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth",item_instance_code:"II0061", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0071", menu_item: menu_category1_menu_item0, price:17800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0081", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0091", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0101", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
|
||||
# twin pot
|
||||
menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"01002", name: "Twin Pot", alt_name: "Twin Pot",menu_category: menu_category1 , min_selectable_item: 2, max_selectable_item:2, account: food })
|
||||
menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"01002", name: "Twin Pot", alt_name: "Twin Pot",menu_category: menu_category1 , min_selectable_item: 2, max_selectable_item:2, account: food })
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Twin Pot",item_instance_code:"II0021", menu_item: menu_category1_menu_item1, price:0.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0052", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0062", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth",item_instance_code:"II0062", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0072", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0082", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0092", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0102", menu_item: menu_category1_menu_item1, price:11800.00, is_on_promotion:false}])
|
||||
# vip room Individual pot
|
||||
menu_category1_menu_item2 = SimpleMenuItem.create({item_code:"01003", name: "VIP Room Individual Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
menu_category1_menu_item2 = SimpleMenuItem.create({item_code:"01003", name: "VIP Room Individual Pot", alt_name: "VIP",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"VIP Room Individual Pot",item_instance_code:"II0031", menu_item: menu_category1_menu_item2, price:0.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0053", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0063", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}])
|
||||
|
||||
BIN
public/fonts/NotoSansCJKtc-Regular.ttf
Normal file
BIN
public/fonts/NotoSansCJKtc-Regular.ttf
Normal file
Binary file not shown.
Reference in New Issue
Block a user