diff --git a/.gitignore b/.gitignore
index 91a498bc..5dafee53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,3 +48,6 @@ config/deploy/config/*
# For Redis Server log file
dump.rdb
+
+# Fonts
+public/fonts/*
diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
index 43efe3f2..ce5ac871 100644
--- a/app/assets/javascripts/cable.js
+++ b/app/assets/javascripts/cable.js
@@ -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);
diff --git a/app/assets/javascripts/channels/order_queue_station.js b/app/assets/javascripts/channels/order_queue_station.js
index 00151e5e..85706bb5 100644
--- a/app/assets/javascripts/channels/order_queue_station.js
+++ b/app/assets/javascripts/channels/order_queue_station.js
@@ -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) {
diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss
index e0a59dc7..7935b50e 100644
--- a/app/assets/stylesheets/origami.scss
+++ b/app/assets/stylesheets/origami.scss
@@ -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;
}
diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb
index 4606b049..7b846db0 100644
--- a/app/controllers/crm/customers_controller.rb
+++ b/app/controllers/crm/customers_controller.rb
@@ -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 }
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index f2a8676c..d6960bc3 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -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
diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb
index d2236caa..3c087aa9 100644
--- a/app/controllers/oqs/edit_controller.rb
+++ b/app/controllers/oqs/edit_controller.rb
@@ -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
diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb
index d551a766..226b3a83 100644
--- a/app/controllers/oqs/home_controller.rb
+++ b/app/controllers/oqs/home_controller.rb
@@ -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
diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb
index 16590320..2a89cd28 100644
--- a/app/controllers/origami/discounts_controller.rb
+++ b/app/controllers/origami/discounts_controller.rb
@@ -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
diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index 03e0931e..f2919cce 100644
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -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)
diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb
index cfea9d37..687c872f 100644
--- a/app/controllers/origami/request_bills_controller.rb
+++ b/app/controllers/origami/request_bills_controller.rb
@@ -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
diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb
index c25e0e1f..e5728f99 100644
--- a/app/controllers/origami/rooms_controller.rb
+++ b/app/controllers/origami/rooms_controller.rb
@@ -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
diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb
index 8a47da39..3d632403 100644
--- a/app/controllers/origami/sale_edit_controller.rb
+++ b/app/controllers/origami/sale_edit_controller.rb
@@ -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]
diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb
index 687d9fa5..c0245dc3 100644
--- a/app/controllers/origami/void_controller.rb
+++ b/app/controllers/origami/void_controller.rb
@@ -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
diff --git a/app/controllers/reports/dailysale_controller.rb b/app/controllers/reports/dailysale_controller.rb
index 27e812ab..14013a1b 100644
--- a/app/controllers/reports/dailysale_controller.rb
+++ b/app/controllers/reports/dailysale_controller.rb
@@ -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
diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb
index e4157c4e..fd203791 100644
--- a/app/controllers/reports/receipt_no_controller.rb
+++ b/app/controllers/reports/receipt_no_controller.rb
@@ -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
\ No newline at end of file
diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb
index 19803c0d..eb058cac 100644
--- a/app/controllers/transactions/sales_controller.rb
+++ b/app/controllers/transactions/sales_controller.rb
@@ -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)
diff --git a/app/models/customer.rb b/app/models/customer.rb
index 60cf8b14..2f09ff12 100644
--- a/app/models/customer.rb
+++ b/app/models/customer.rb
@@ -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)
diff --git a/app/models/order_item.rb b/app/models/order_item.rb
index 109665d0..897a4b1e 100644
--- a/app/models/order_item.rb
+++ b/app/models/order_item.rb
@@ -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
diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb
index c9da3a9f..edd2ace2 100644
--- a/app/models/order_queue_station.rb
+++ b/app/models/order_queue_station.rb
@@ -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
diff --git a/app/models/sale.rb b/app/models/sale.rb
index 0e767ea0..8e7b0677 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -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
diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb
index 3cc0eb43..a0bc1ae2 100644
--- a/app/models/sale_item.rb
+++ b/app/models/sale_item.rb
@@ -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)
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index fb1e58d8..300935d9 100644
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -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
diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb
index b9c5aa28..c9a05561 100644
--- a/app/models/shift_sale.rb
+++ b/app/models/shift_sale.rb
@@ -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)
diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb
index fc04b6cc..82507e67 100644
--- a/app/pdf/close_cashier_pdf.rb
+++ b/app/pdf/close_cashier_pdf.rb
@@ -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
diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb
index 12d51c53..546e8f82 100644
--- a/app/pdf/order_item_pdf.rb
+++ b/app/pdf/order_item_pdf.rb
@@ -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
diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb
index 9e8ad10b..6d530058 100644
--- a/app/pdf/order_summary_pdf.rb
+++ b/app/pdf/order_summary_pdf.rb
@@ -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
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index 52cdf586..1bf4b95f 100644
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -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
diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb
index d52c0456..66a16b2b 100644
--- a/app/views/crm/customers/_new_form.html.erb
+++ b/app/views/crm/customers/_new_form.html.erb
@@ -1,4 +1,4 @@
-
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb
index b9418d22..7a19a68f 100644
--- a/app/views/home/show.html.erb
+++ b/app/views/home/show.html.erb
@@ -52,7 +52,7 @@
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb
index 72e402e8..a1d359e8 100644
--- a/app/views/origami/customers/index.html.erb
+++ b/app/views/origami/customers/index.html.erb
@@ -10,7 +10,7 @@
-
+
@@ -71,7 +71,7 @@
-
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb
index faa48c05..5dfcb0a1 100644
--- a/app/views/origami/discounts/index.html.erb
+++ b/app/views/origami/discounts/index.html.erb
@@ -17,7 +17,7 @@
Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
@@ -138,7 +138,7 @@
7
@@ -149,7 +149,7 @@
0
@@ -160,7 +160,7 @@
@@ -190,6 +190,8 @@
RemoveItem Discount
Remove All
Enter
+
@@ -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);
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb
index 99fa713e..6bdadd85 100644
--- a/app/views/origami/home/index.html.erb
+++ b/app/views/origami/home/index.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -35,7 +35,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -67,7 +67,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -88,7 +88,7 @@
-
+
<% @orders.each do |order| %>
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb
index baad1a0a..73959b5b 100644
--- a/app/views/origami/home/show.html.erb
+++ b/app/views/origami/home/show.html.erb
@@ -6,7 +6,7 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -38,7 +38,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -71,7 +71,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -98,7 +98,7 @@
-
+
<% @orders.each do |order| %>
@@ -150,7 +150,7 @@
<%end%>
-
+
@@ -182,6 +182,7 @@
<%= sale_item.qty %>
<%= sale_item.price %>
+
<%
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();
+ }
}
});
});
diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb
index 109bc418..a8620d6e 100644
--- a/app/views/origami/moveroom/move_dining.html.erb
+++ b/app/views/origami/moveroom/move_dining.html.erb
@@ -21,7 +21,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -42,7 +42,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -95,7 +95,7 @@
-
+
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb
index c8254d42..d64b71f0 100644
--- a/app/views/origami/movetable/move_dining.html.erb
+++ b/app/views/origami/movetable/move_dining.html.erb
@@ -21,7 +21,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -42,7 +42,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -95,7 +95,7 @@
-
+
diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb
index e0448009..40388847 100644
--- a/app/views/origami/orders/show.html.erb
+++ b/app/views/origami/orders/show.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -60,7 +60,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -86,7 +86,7 @@
-
+
<% @orders.each do |order| %>
@@ -140,7 +140,7 @@
-
+
diff --git a/app/views/origami/other_charges/index.html.erb b/app/views/origami/other_charges/index.html.erb
index 129aa0e0..20bb5a4b 100644
--- a/app/views/origami/other_charges/index.html.erb
+++ b/app/views/origami/other_charges/index.html.erb
@@ -17,7 +17,7 @@
Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
diff --git a/app/views/origami/payments/create.json.jbuilder b/app/views/origami/payments/create.json.jbuilder
index 08bf292c..f1dd8cad 100644
--- a/app/views/origami/payments/create.json.jbuilder
+++ b/app/views/origami/payments/create.json.jbuilder
@@ -1 +1,2 @@
json.status true
+
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index 86738c22..1a325800 100644
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -10,11 +10,12 @@
Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
- Table No <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %>
+ Table No - <%=@table_no%>
Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %>
- Customer : <%= @sale_data.customer.name%>
+ Customer : <%= @sale_data.customer.name%>
+ Customer ID : <%= @sale_data.customer.customer_id%>
@@ -42,7 +43,7 @@
count += 1
%>
- <% sub_total += sale_item.qty*sale_item.unit_price%>
+ <% sub_total += sale_item.price%>
<%= count %>
@@ -52,7 +53,7 @@
<%=sale_item.qty%>
- <%=(sale_item.qty*sale_item.unit_price)%>
+ <%=(sale_item.price)%>
<%end %>
@@ -119,7 +120,7 @@
<%= @other %>
<% else %>
-
+
<% 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 () {
diff --git a/app/views/origami/request_bills/print.json.jbuilder b/app/views/origami/request_bills/print.json.jbuilder
index 08bf292c..332a9cec 100644
--- a/app/views/origami/request_bills/print.json.jbuilder
+++ b/app/views/origami/request_bills/print.json.jbuilder
@@ -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
diff --git a/app/views/origami/room_invoices/show.html.erb b/app/views/origami/room_invoices/show.html.erb
index 4b507526..b44340d4 100644
--- a/app/views/origami/room_invoices/show.html.erb
+++ b/app/views/origami/room_invoices/show.html.erb
@@ -41,7 +41,7 @@
-
+
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
index 1329bc8d..66a48522 100644
--- a/app/views/origami/rooms/show.html.erb
+++ b/app/views/origami/rooms/show.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -65,20 +65,27 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
-
-
- <%= room.name %>
- <% if room.get_booking.nil? %>
- billed
- <% else %>
- new
- <% end %>
-
-
+
+ <% if room.get_booking.nil? %>
+
+
+ <%= room.name %>
+
billed
+
+
+
+ <% else %>
+
+
+ <%= room.name %>
+ new
+
+
+ <% end %>
<% else %>
@@ -91,7 +98,7 @@
-
+
<% @orders.each do |order| %>
@@ -114,7 +121,7 @@
-
+
@@ -218,7 +225,7 @@
<%
- if @status_sale == 'sale'
+ if @status == 'sale'
unless @order_items.nil?
%>
Pending New Order
@@ -272,10 +279,10 @@
Back
- <% if @dining.bookings.length >= 1 %>
+ <% if @room.bookings.length >= 1 %>
Customer
- <% if @status_order == 'order' && @status_sale != 'sale' %>
+ <% if @status == 'order' && @status != 'sale' %>
Edit
Discount
@@ -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";
});
diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb
index 13812e59..6ba861a8 100644
--- a/app/views/origami/sale_edit/edit.html.erb
+++ b/app/views/origami/sale_edit/edit.html.erb
@@ -22,15 +22,16 @@
-
+
- #
- Items
- QTY
- Price
- Action
+ #
+ Items
+ QTY
+ Price
+
+ Action
@@ -47,24 +48,46 @@
unless sale_item.price == 0
%>
- <%= count %>
- <%= sale_item.product_name %>
+ <%= count %>
+
+ <%= sale_item.product_name %>
+
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
-
-
-
- Update
- Void
-
+
+
+
+
+
+
+
+
+ Update
+
+ Void
+
+
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
-
-
-
- Cancel Void/Update
+
+
+
+
+
+
+
+
+ Cancel Void/Update
<% else %>
-
-
+
+
+
+
+
+
<% end %>
@@ -99,20 +122,35 @@
\ No newline at end of file
+
diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb
index dc7d05ee..d5f2cafc 100644
--- a/app/views/reports/receipt_no/index.html.erb
+++ b/app/views/reports/receipt_no/index.html.erb
@@ -1,115 +1,209 @@
- <%= 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} %>
-
+
-
-
-
- Date
- Receipt No
- Cashier Name
- Gross Sales
- Discount
- Total Sales
- <% TaxProfile.all.each do |r|%>
- <%=r.name%>
- <% end %>
- Nett Sales
-
-
+
+
+ <% if !params[:from].blank?%>
+
+ From Date : <%= params[:from] rescue '-' %> , To Date : <%= params[:to] rescue '-'%>
+
+ <% end %>
+ <% if @shift_from %>
+
+ <% if @shift.employee %>
+ <% cashier_name = !@shift.nil? ? @shift.employee.name : '-' %>
+ <% end %>
+ Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )
+
+ <% end %>
-
- <% 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%>
-
- <%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %>
- <%=sale.receipt_no.to_s rescue ''%>
- <%=Employee.find(sale.cashier_id).name rescue ''%>
- <%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %>
- <%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %>
- <%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %>
- <% sale.sale_taxes.each do |sale|%>
- <%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %>
- <% end %>
-
- <%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %>
-
- <% end %>
-
-
-
+
+ Recipt No
+ Cashier Name
+ Total Amount
+ Discount Amount
+ Tax Amount
+
+ Grand Total
+ Rounding Adj.
+ Grand Total +
+ Rounding Adj.
+
+
+
+
+ <% 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 %>
+
+
+
+ <%= result.receipt_no rescue '-' %>
+ <%= result.cashier_name rescue '-' %>
+ <%= result.total_amount rescue '-' %>
+ <%= result.total_discount rescue '-' %>
+ <%= result.total_tax rescue '-' %>
+
+
+ <%= result.grand_total %>
+ <%= result.rounding_adjustment.to_f rescue '-' %>
+ <%= result.grand_total_after_rounding() rescue '-'%>
+
+
+ <%
+ end
+ end
+ %>
+
+
+ <%= total_sum rescue '-'%>
+ <%= discount_amt rescue '-'%>
+ <%= sprintf "%.2f",total_tax rescue '-'%>
+
+ <%= grand_total.to_f.round(2) rescue '-'%>
+ <%= rounding_adj rescue '-'%>
+ <%= old_grand_total.to_f.round + rounding_adj %>
+
+
+
+ Total Amount
+ Discount Amount
+ Tax Amount
+ Grand Total
+ Rounding Adj.
+ Grand Total +
+ Rounding Adj.
+
+
+
+
+
-<%= paginate @sale_data %>
-
\ No newline at end of file
diff --git a/app/views/reports/receipt_no/index.xls.erb b/app/views/reports/receipt_no/index.xls.erb
index 5befb18a..b55a40c4 100644
--- a/app/views/reports/receipt_no/index.xls.erb
+++ b/app/views/reports/receipt_no/index.xls.erb
@@ -1,43 +1,91 @@
-
-
+
+
+
+
+ <% if !params[:from].blank?%>
+
+ From Date : <%= params[:from] rescue '-' %> , To Date : <%= params[:to] rescue '-'%>
+
+ <% end %>
+ <% if @shift_from %>
+
+ <% if @shift.employee %>
+ <% cashier_name = !@shift.nil? ? @shift.employee.name : '-' %>
+ <% end %>
+ Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )
+
+ <% end %>
-
-
-
- Date
- Receipt No
- Cashier Name
- Gross Sales
- Discount
- Total Sales
- <% TaxProfile.all.each do |r|%>
- <%=r.name%>
- <% end %>
- Nett Sales
-
-
+
+ Recipt No
+ Cashier Name
+ Total Amount
+ Discount Amount
+ Tax Amount
+
+ Grand Total
+ Rounding Adj.
+ Grand Total +
+ Rounding Adj.
+
+
+
+
+ <% 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 %>
-
- <% 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%>
-
- <%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %>
- <%=sale.receipt_no.to_s rescue ''%>
- <%=Employee.find(sale.cashier_id).name rescue ''%>
- <%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %>
- <%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %>
- <%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %>
- <% sale.sale_taxes.each do |sale|%>
- <%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %>
- <% end %>
-
- <%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %>
-
- <% end %>
-
-
-
+ <% @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 %>
+
+
+
+ <%= result.receipt_no rescue '-' %>
+ <%= result.cashier_name rescue '-' %>
+ <%= result.total_amount rescue '-' %>
+ <%= result.total_discount rescue '-' %>
+ <%= sprintf "%.2f",result.total_tax rescue '-' %>
+
+
+ <%= result.grand_total %>
+ <%= result.rounding_adjustment.to_f rescue '-' %>
+ <%= result.grand_total_after_rounding() rescue '-'%>
+
+
+ <% end %>
+
+
+ <%= total_sum rescue '-'%>
+ <%= discount_amt rescue '-'%>
+ <%= sprintf "%.2f",total_tax rescue '-'%>
+
+ <%= grand_total.to_f.round(2) rescue '-'%>
+ <%= rounding_adj rescue '-'%>
+ <%= grand_total.to_f.round + rounding_adj %>
+
+
+
+ Total Amount
+ Discount Amount
+ Tax Amount
+ Grand Total
+ Rounding Adj.
+ Grand Total +
+ Rounding Adj.
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/reports/receipt_no/indexback.html.erb b/app/views/reports/receipt_no/indexback.html.erb
new file mode 100644
index 00000000..dc7d05ee
--- /dev/null
+++ b/app/views/reports/receipt_no/indexback.html.erb
@@ -0,0 +1,115 @@
+
+
+
+ <%= render :partial=>'shift_sale_report_filter',
+ :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %>
+
+
+
+
+
+
+
+
+
+
+ Date
+ Receipt No
+ Cashier Name
+ Gross Sales
+ Discount
+ Total Sales
+ <% TaxProfile.all.each do |r|%>
+ <%=r.name%>
+ <% end %>
+ Nett Sales
+
+
+
+
+ <% 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%>
+
+ <%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %>
+ <%=sale.receipt_no.to_s rescue ''%>
+ <%=Employee.find(sale.cashier_id).name rescue ''%>
+ <%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %>
+ <%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %>
+ <%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %>
+ <% sale.sale_taxes.each do |sale|%>
+ <%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %>
+ <% end %>
+
+ <%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %>
+
+ <% end %>
+
+
+
+
+
+<%= paginate @sale_data %>
+
+
\ No newline at end of file
diff --git a/app/views/reports/receipt_no/indexback.xls.erb b/app/views/reports/receipt_no/indexback.xls.erb
new file mode 100644
index 00000000..5befb18a
--- /dev/null
+++ b/app/views/reports/receipt_no/indexback.xls.erb
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ Date
+ Receipt No
+ Cashier Name
+ Gross Sales
+ Discount
+ Total Sales
+ <% TaxProfile.all.each do |r|%>
+ <%=r.name%>
+ <% end %>
+ Nett Sales
+
+
+
+
+ <% 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%>
+
+ <%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %>
+ <%=sale.receipt_no.to_s rescue ''%>
+ <%=Employee.find(sale.cashier_id).name rescue ''%>
+ <%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %>
+ <%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %>
+ <%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %>
+ <% sale.sale_taxes.each do |sale|%>
+ <%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %>
+ <% end %>
+
+ <%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %>
+
+ <% end %>
+
+
+
+
diff --git a/app/views/reports/saleitem/index.html.erb b/app/views/reports/saleitem/index.html.erb
index b6482271..23b3a582 100644
--- a/app/views/reports/saleitem/index.html.erb
+++ b/app/views/reports/saleitem/index.html.erb
@@ -1,7 +1,7 @@
diff --git a/app/views/settings/employees/index.html.erb b/app/views/settings/employees/index.html.erb
index 1112f72b..d0d55202 100644
--- a/app/views/settings/employees/index.html.erb
+++ b/app/views/settings/employees/index.html.erb
@@ -25,7 +25,7 @@
<%= link_to employee.name,settings_employee_path(employee) %>
<%= employee.role %>
- <%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', settings_employee_path(employee) , method: :delete, data: { confirm: 'Are you sure?' } %>
<% end %>
diff --git a/app/views/settings/employees/show.html.erb b/app/views/settings/employees/show.html.erb
index 753298e6..cad7a6ad 100644
--- a/app/views/settings/employees/show.html.erb
+++ b/app/views/settings/employees/show.html.erb
@@ -1,16 +1,37 @@
-<%= notice %>
+
+
+
+
Employee
+
+
+
+ Name
+ Role
+
+ Action
+
+
-
- Name:
- <%= @employee.name %>
-
+
+
+ <%= @employee.name %>
+ <%= @employee.role %>
+
+ <%= link_to 'Edit', edit_settings_employee_path(@employee) %>
+
+
+
+
+
+
-
- Role:
- <%= @employee.role %>
-
+
-
- Employee ID:
- <%= @employee.emp_id %>
-
diff --git a/app/views/settings/membership_actions/index.html.erb b/app/views/settings/membership_actions/index.html.erb
index 4a348ed3..4019e479 100644
--- a/app/views/settings/membership_actions/index.html.erb
+++ b/app/views/settings/membership_actions/index.html.erb
@@ -11,17 +11,15 @@
-
+
+
+
Membership type
- Is active
- Gateway communication type
Gateway url
- Auth token
Merchant account
- Created by
- Additional parameter
+
@@ -30,13 +28,8 @@
<% @settings_membership_actions.each do |settings_membership_action| %>
<%= settings_membership_action.membership_type %>
- <%= settings_membership_action.is_active %>
- <%= settings_membership_action.gateway_communication_type %>
<%= settings_membership_action.gateway_url %>
- <%= settings_membership_action.auth_token %>
<%= settings_membership_action.merchant_account_id %>
- <%= settings_membership_action.created_by %>
- <%= settings_membership_action.additional_parameter %>
<%= link_to 'Show', settings_membership_action_path(settings_membership_action) %>
<%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %>
<%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %>
@@ -44,4 +37,6 @@
<% end %>
+
+
diff --git a/app/views/settings/membership_actions/show.html.erb b/app/views/settings/membership_actions/show.html.erb
index ee285af8..37be9266 100644
--- a/app/views/settings/membership_actions/show.html.erb
+++ b/app/views/settings/membership_actions/show.html.erb
@@ -1,44 +1,58 @@
-<%= notice %>
+
+
+
+
+
+
+ Membership type
+ <%= @settings_membership_action.membership_type %>
+
+
+ Is active
+ <%= @settings_membership_action.is_active %>
+
+
+ Gateway communication type
+ <%= @settings_membership_action.gateway_communication_type %>
+
+
+ Gateway url
+ <%= @settings_membership_action.gateway_url %>
+
+
+ Auth token
+ <%= @settings_membership_action.auth_token %>
+
+
+ Merchant account
+ <%= @settings_membership_action.merchant_account_id %>
+
+
+ Created by
+ <%= @settings_membership_action.created_by %>
+
+
+ Additional parameter
+ <%= @settings_membership_action.additional_parameter %>
+
+
+
+
+
+
-
- Is active:
- <%= @settings_membership_action.is_active %>
-
+
-
- Gateway communication type:
- <%= @settings_membership_action.gateway_communication_type %>
-
-
- Gateway url:
- <%= @settings_membership_action.gateway_url %>
-
-
- Auth token:
- <%= @settings_membership_action.auth_token %>
-
-
-
- Merchant account:
- <%= @settings_membership_action.merchant_account_id %>
-
-
-
- Created by:
- <%= @settings_membership_action.created_by %>
-
-
-
- Additional parameter:
- <%= @settings_membership_action.additional_parameter %>
-
-
-<%= link_to 'Edit', edit_settings_membership_action_path(@settings_membership_action) %> |
-<%= link_to 'Back', settings_membership_actions_path %>
diff --git a/app/views/settings/membership_settings/show.html.erb b/app/views/settings/membership_settings/show.html.erb
index de4d610d..ecbb9ec1 100644
--- a/app/views/settings/membership_settings/show.html.erb
+++ b/app/views/settings/membership_settings/show.html.erb
@@ -1,39 +1,49 @@
-<%= notice %>
-
- Membership type:
- <%= @settings_membership_setting.membership_type %>
-
+
+
+
+
+
+
+ Membership type
+ Is active
+ Gateway communication type
+ Gateway url
+ Auth token
+ Merchant account
+ Created by
+
+ Action
+
+
-
- Is active:
- <%= @settings_membership_setting.is_active %>
-
-
-
- Gateway communication type:
- <%= @settings_membership_setting.gateway_communication_type %>
-
-
-
- Gateway url:
- <%= @settings_membership_setting.gateway_url %>
-
-
-
- Auth token:
- <%= @settings_membership_setting.auth_token %>
-
-
-
- Merchant account:
- <%= @settings_membership_setting.merchant_account rescue ''%>
-
-
-
- Created by:
- <%= @settings_membership_setting.created_by %>
-
-
-<%= link_to 'Edit', edit_settings_membership_setting_path(@settings_membership_setting) %> |
+
+
+ <%= @settings_membership_setting.membership_type %>
+ <%= @settings_membership_setting.is_active %>
+ <%= @settings_membership_setting.gateway_communication_type %>
+ <%= @settings_membership_setting.gateway_url %>
+ <%= @settings_membership_setting.auth_token %>
+ <%= @settings_membership_setting.merchant_account rescue ''%>
+ <%= @settings_membership_setting.created_by %>
+
+ <%= link_to 'Edit', edit_settings_membership_setting_path(@settings_membership_setting) %> |
<%= link_to 'Back', settings_membership_settings_path %>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/settings/order_queue_stations/show.html.erb b/app/views/settings/order_queue_stations/show.html.erb
index e92ed0bb..fbb19182 100644
--- a/app/views/settings/order_queue_stations/show.html.erb
+++ b/app/views/settings/order_queue_stations/show.html.erb
@@ -2,62 +2,52 @@
+
+
+
Menu Item Option
+
+
+
+ Station name
+ Is active
+ Auto Print
+ Processing items
+ Print copy
+ Printer name
+ Font size
+ Cut per item
+ Use alternate name
+ Created by
+ Action
+
+
-<%= notice %>
+
+
+ <%= @settings_order_queue_station.station_name %>
+ <%= @settings_order_queue_station.is_active %>
+ <%= @settings_order_queue_station.auto_print %>
+ <%= @settings_order_queue_station.processing_items %>
+ <%= @settings_order_queue_station.print_copy %>
+ <%= @settings_order_queue_station.printer_name %>
+ <%= @settings_order_queue_station.font_size %>
+ <%= @settings_order_queue_station.cut_per_item %>
+ <%= @settings_order_queue_station.use_alternate_name %>
+ <%= @settings_order_queue_station.created_by %>
+
+ <%= 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?' } %> |
-
- Station name:
- <%= @settings_order_queue_station.station_name %>
-
+ <%= link_to 'Back', settings_order_queue_stations_path %>
+
+
+
+
+
+
-
- Is active:
- <%= @settings_order_queue_station.is_active %>
-
-
-
- Auto Print:
- <%= @settings_order_queue_station.auto_print %>
-
-
-
- Processing items:
- <%= @settings_order_queue_station.processing_items %>
-
-
-
- Print copy:
- <%= @settings_order_queue_station.print_copy %>
-
-
-
- Printer name:
- <%= @settings_order_queue_station.printer_name %>
-
-
-
- Font size:
- <%= @settings_order_queue_station.font_size %>
-
-
-
- Cut per item:
- <%= @settings_order_queue_station.cut_per_item %>
-
-
-
- Use alternate name:
- <%= @settings_order_queue_station.use_alternate_name %>
-
-
-
- Created by:
- <%= @settings_order_queue_station.created_by %>
-
-
-<%= 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 %>
+
diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb
index 4dd15755..cbd07c41 100644
--- a/app/views/transactions/sales/show.html.erb
+++ b/app/views/transactions/sales/show.html.erb
@@ -39,9 +39,9 @@
Customer Details
-
+
@@ -205,15 +205,16 @@
<%= @customer.address%>
<%= @customer.date_of_birth %>
+
- Membership Transactions
+ Membership Transactions
Date
Redeem
Rebate
Balance
-
+ From Account
Status
Receipt No
@@ -226,7 +227,7 @@
<%= transaction["redeem"]%>
<%= transaction["rebate"] %>
<%= transaction["balance"] %>
-
+ <%= transaction["account_status"] %>
<%= transaction["status"] %>
<%= transaction["receipt_no"] %>
@@ -244,15 +245,24 @@
- Status
+ Action
Action At
- Approved By
+ Approved At
Remark
-
+
+ <% @sale_audits.each do |audit| %>
+
+ <%= audit.action%>
+ <%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%>
+ <%= audit.approved_by.to_datetime.strftime("%m-%d-%Y %H:%M %p")%>
+ <%= audit.remark%>
+
+
+ <% end %>
diff --git a/config/environments/development.rb b/config/environments/development.rb
index f5ab7304..4d8fc580 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -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
diff --git a/config/routes.rb b/config/routes.rb
index 19c35e2b..3320bdc6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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]
diff --git a/config/schedule.rb b/config/schedule.rb
index b21a46e3..6a43ba25 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -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
\ No newline at end of file
+end
+
diff --git a/config/sidekiq.yml b/config/sidekiq.yml
index fa0b1e15..ac1bb2d5 100644
--- a/config/sidekiq.yml
+++ b/config/sidekiq.yml
@@ -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
+
diff --git a/db/migrate/20170626191519_create_shift_sales.rb b/db/migrate/20170626191519_create_shift_sales.rb
index 18323c9d..d16449d7 100644
--- a/db/migrate/20170626191519_create_shift_sales.rb
+++ b/db/migrate/20170626191519_create_shift_sales.rb
@@ -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
diff --git a/db/migrate/20170701101420_create_sales.rb b/db/migrate/20170701101420_create_sales.rb
index fc261826..d0e70287 100644
--- a/db/migrate/20170701101420_create_sales.rb
+++ b/db/migrate/20170701101420_create_sales.rb
@@ -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
diff --git a/db/seeds.rb b/db/seeds.rb
index 3bff75a0..8fe62bde 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -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"})
diff --git a/lib/tasks/menu_import.rake b/lib/tasks/menu_import.rake
index f8b4ae4a..e0e0be3a 100644
--- a/lib/tasks/menu_import.rake
+++ b/lib/tasks/menu_import.rake
@@ -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}])
diff --git a/public/fonts/NotoSansCJKtc-Regular.ttf b/public/fonts/NotoSansCJKtc-Regular.ttf
new file mode 100644
index 00000000..0e767023
Binary files /dev/null and b/public/fonts/NotoSansCJKtc-Regular.ttf differ