update conflict file

This commit is contained in:
superuser
2017-07-02 14:37:21 +06:30
52 changed files with 877 additions and 292 deletions

View File

@@ -59,6 +59,7 @@ gem 'jbuilder', '~> 2.5'
gem 'bcrypt', '~> 3.1.7' gem 'bcrypt', '~> 3.1.7'
gem 'sidekiq' gem 'sidekiq'
gem 'whenever', :require => false
# XML parser # XML parser
#gem 'nokogiri', '~> 1.6' #gem 'nokogiri', '~> 1.6'

View File

@@ -51,6 +51,7 @@ GEM
builder (3.2.3) builder (3.2.3)
byebug (9.0.6) byebug (9.0.6)
cancancan (1.17.0) cancancan (1.17.0)
chronic (0.10.2)
coffee-rails (4.2.2) coffee-rails (4.2.2)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0) railties (>= 4.0.0)
@@ -237,6 +238,8 @@ GEM
websocket-driver (0.6.5) websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.2)
whenever (0.9.7)
chronic (>= 0.6.3)
PLATFORMS PLATFORMS
ruby ruby
@@ -282,6 +285,7 @@ DEPENDENCIES
tzinfo-data tzinfo-data
uglifier (>= 1.3.0) uglifier (>= 1.3.0)
web-console (>= 3.3.0) web-console (>= 3.3.0)
whenever
BUNDLED WITH BUNDLED WITH
1.15.1 1.15.1

View File

@@ -5,24 +5,28 @@ class Api::BillController < Api::ApiController
def create def create
@status = false @status = false
@error_message = "Order ID or Booking ID is require to request for a bill." @error_message = "Order ID or Booking ID is require to request for a bill."
if ShiftSale.current_shift
#create Bill by Booking ID #create Bill by Booking ID
if (params[:booking_id]) if (params[:booking_id])
booking = Booking.find(params[:booking_id]) booking = Booking.find(params[:booking_id])
if booking if booking
if booking.sale_id.nil? if booking.sale_id.nil?
@sale = Sale.new @sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier) @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
else else
@status = true @status = true
@sale_id = booking.sale_id @sale_id = booking.sale_id
end
end end
end
elsif (params[:order_id]) elsif (params[:order_id])
@sale = Sale.new @sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier) @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
end
else
@status = false
@error_message = "No Current Open Shift"
end end
#@sale_data = Sale.find_by_sale_id(@sale_id) #@sale_data = Sale.find_by_sale_id(@sale_id)

View File

@@ -34,7 +34,7 @@ class BaseReportController < ActionController::Base
to = params[:to] to = params[:to]
day_ref = Time.now.utc.getlocal day_ref = Time.now.utc.getlocal
if params[:report_type] == "daily_sale" if params[:report_type] == "daily_sale" || params[:report_type] == "sale_item"
if from != "" && to != "" if from != "" && to != ""
@@ -86,9 +86,7 @@ class BaseReportController < ActionController::Base
else # end daily sale report else # end daily sale report
if period_type.to_i == 1 if period_type.to_i == 1
if params[:from] && params[:to] if params[:from] != "" && params[:to] !=""
if params[:from] != "" && params[:to] !=""
f_date = DateTime.parse(params[:from]) f_date = DateTime.parse(params[:from])
t_date = DateTime.parse(params[:to]) t_date = DateTime.parse(params[:to])
@@ -99,8 +97,7 @@ class BaseReportController < ActionController::Base
else else
from = day_ref.beginning_of_day.utc from = day_ref.beginning_of_day.utc
to = day_ref.end_of_day.utc to = day_ref.end_of_day.utc
end end
end
else else
case period.to_i case period.to_i
when PERIOD["today"] when PERIOD["today"]

View File

@@ -48,7 +48,22 @@ class Crm::CustomersController < BaseCrmController
#get customer amount #get customer amount
@customer = Customer.find(params[:id]) @customer = Customer.find(params[:id])
@response = Customer.get_membership_transactions(@customer) @response = Customer.get_membership_transactions(@customer)
# get member information
total = Customer.get_member_account(@customer)
@balance = 0.00
@accountable_type = ''
if total["status"]==true
total["data"].each do |res|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
@balance += res["balance"]
# @accountable_type = res["accountable_type"]
@accountable_type = "Rebate Balance"
end
end
end
# @response = "" # @response = ""
#end customer amount #end customer amount
@@ -82,7 +97,8 @@ class Crm::CustomersController < BaseCrmController
card_no = customer_params[:card_no] card_no = customer_params[:card_no]
member_group_id = params[:member_group_id] member_group_id = params[:member_group_id]
if !member_group_id.nil? if member_group_id.present?
puts "aaaaaaaaa"
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer") memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s merchant_uid = memberaction.merchant_account_id.to_s
@@ -101,6 +117,7 @@ class Crm::CustomersController < BaseCrmController
}, },
:timeout => 10 :timeout => 10
) )
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }
@@ -110,9 +127,7 @@ class Crm::CustomersController < BaseCrmController
rescue SocketError rescue SocketError
response = { status: false} response = { status: false}
end end
if response["status"] == true if response["status"] == true
customer = Customer.find(@crm_customers.customer_id) customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id ) status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
@@ -123,13 +138,20 @@ class Crm::CustomersController < BaseCrmController
end end
# format.json { render :index, status: :created, location: @crm_customers } # format.json { render :index, status: :created, location: @crm_customers }
else else
# @crm_customers.destroy customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
if params[:sale_id] if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
else else
format.html { redirect_to crm_customers_path, notice: response["message"] } format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
end end
end end
else
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
end
end end
else else
@@ -183,6 +205,8 @@ end
}, },
:timeout => 10 :timeout => 10
) )
puts "hhhhhhhhh"
puts response.to_json
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }
@@ -199,8 +223,13 @@ end
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id ) status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'} format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else else
format.html { redirect_to crm_customers_path, notice: response["message"] }
customer = Customer.find(@crm_customer.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: response["error"] }
end end
else else

View File

@@ -77,7 +77,13 @@ class HomeController < ApplicationController
def route_by_role(employee) def route_by_role(employee)
if employee.role == "administrator" if employee.role == "administrator"
redirect_to dashboard_path # redirect_to dashboard_path
shift = ShiftSale.current_open_shift(employee.id)
if !shift.nil?
redirect_to origami_root_path
else
redirect_to new_origami_shift_path
end
elsif employee.role == "cashier" elsif employee.role == "cashier"
#check if cashier has existing open cashier #check if cashier has existing open cashier
shift = ShiftSale.current_open_shift(employee.id) shift = ShiftSale.current_open_shift(employee.id)

View File

@@ -6,19 +6,24 @@ class Oqs::HomeController < BaseOqsController
@queue_items_details = queue_items_query(false) @queue_items_details = queue_items_query(false)
# Query for OQS with delivery status true # Query for OQS with delivery status true
@queue_completed_item = queue_items_query(true) @queue_completed_item = completed_order
@queue_stations_items=Array.new @queue_stations_items=Array.new
# Calculate Count for each station tab # Calculate Count for each station tab
queue_stations.each do |que| queue_stations.each do |que|
i=0 i = 0
zone_id = 0
@queue_items_details.each do |qid| @queue_items_details.each do |qid|
if qid.station_name == que.station_name dining = DiningFacility.find_by_name(qid.zone)
i=i+1 que.order_queue_process_by_zones.each do |qz|
end if qid.station_id == qz.order_queue_station_id && qid.zone_id == dining.zone_id
zone_id = qid.zone_id
i=i+1
end
end
end end
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i }) @queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
end end
@queue_stations_items @queue_stations_items
@@ -83,34 +88,9 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with delivery status # Query for OQS with delivery status
def queue_items_query(status) def queue_items_query(status)
# queue_items = [] AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
# AssignedOrderItem.all.each do |aoi|
# oqs = OrderQueueStation.find(aoi.order_queue_station_id)
# order = Order.find(aoi.order_id)
# order_items = OrderItem.find_by_order_id(aoi.order_id)
# booking_orders = BookingOrder.find_by_order_id(aoi.order_id)
# booking = Booking.find(booking_orders.booking_id)
# dining = DiningFacility.find(booking.dining_facility_id)
# customer = Customer.find_by_customer_id(order.customer_id)
# queue_item = {
# :assigned_order_item_id => aoi.assigned_order_item_id,
# :station_name => oqs.station_name,
# :is_active => oqs.is_active,
# :zone => dining.name,
# :item_code => aoi.item_code,
# :item_name => order_items.item_name,
# :price => order_items.price,
# :qty => order_items.qty,
# :item_order_by => order_items.item_order_by,
# :options => order_items.options,
# :customer_name => customer.name,
# :created_at => order_items.created_at
# }
# queue_items.push(queue_item)
# end
# return queue_items
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
left join orders as od ON od.order_id = assigned_order_items.order_id left join orders as od ON od.order_id = assigned_order_items.order_id
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
left join customers as cus ON cus.customer_id = od.customer_id left join customers as cus ON cus.customer_id = od.customer_id
@@ -120,4 +100,23 @@ class Oqs::HomeController < BaseOqsController
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0") .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0")
.group("assigned_order_items.assigned_order_item_id") .group("assigned_order_items.assigned_order_item_id")
end end
# Completed Order
def completed_order
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
left join orders as od ON od.order_id = assigned_order_items.order_id
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
left join customers as cus ON cus.customer_id = od.customer_id
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
left join bookings as bk on bk.booking_id = bo.booking_id
left join dining_facilities as df on df.id = bk.dining_facility_id")
.where("assigned_order_items.delivery_status = true AND odt.price <> 0")
.group("assigned_order_items.order_id")
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
end
end end

View File

@@ -34,6 +34,7 @@ class Origami::CustomersController < BaseOrigamiController
#@crm_customers = Customer.all #@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new @crm_customer = Customer.new
@count_customer = Customer.count_customer
# if flash["errors"] # if flash["errors"]
# @crm_customer.valid? # @crm_customer.valid?

View File

@@ -74,8 +74,10 @@ class Origami::DiscountsController < BaseOrigamiController
end end
end end
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax; # sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
sale.save # sale.save
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
end end
dining = {:table_id => table_id, :table_type => table_type } dining = {:table_id => table_id, :table_type => table_type }
@@ -100,8 +102,12 @@ class Origami::DiscountsController < BaseOrigamiController
end end
end end
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax; # sale.total_discount = 0
sale.save # sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
# sale.save
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
end end
dining = {:table_id => table_id, :table_type => table_type } dining = {:table_id => table_id, :table_type => table_type }

View File

@@ -29,7 +29,7 @@ class Origami::OtherChargesController < BaseOrigamiController
sale_item.sale_id = sale_id sale_item.sale_id = sale_id
sale_item.product_code = "Other Charges" sale_item.product_code = "Other Charges"
sale_item.product_name = di["name"] sale_item.product_name = "*" + di["name"]
sale_item.product_alt_name = "" sale_item.product_alt_name = ""
sale_item.remark = "Other Charges" sale_item.remark = "Other Charges"

View File

@@ -30,7 +30,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details) printer.print_receipt_bill(print_settings,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
end end
def create def create
@@ -41,10 +41,10 @@ class Origami::PaymentsController < BaseOrigamiController
sale_payment = SalePayment.new sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "cash") sale_payment.process_payment(saleObj, @user, cash, "cash")
new_total = Sale.get_rounding_adjustment(saleObj.grand_total) # new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = saleObj.grand_total - new_total # rounding_adj = saleObj.grand_total - new_total
saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj) # saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
rebate_amount = nil rebate_amount = nil
@@ -63,7 +63,7 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) 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) 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
end end
@@ -142,6 +142,16 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) 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) 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, "Re-print")
end
def rounding_adj
saleObj = Sale.find(params[:sale_id])
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end end
end end

View File

@@ -18,11 +18,31 @@ class Origami::SaleEditController < BaseOrigamiController
@newsaleitem.save @newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1 @newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1 @newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 0 @newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + " - void" @newsaleitem.product_name = saleitemObj.product_name + " - void"
@newsaleitem.save @newsaleitem.save
end 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
# make cancel void item # make cancel void item
def item_void_cancel def item_void_cancel
saleitemId = params[:sale_item_id] saleitemId = params[:sale_item_id]

View File

@@ -4,6 +4,7 @@ class Origami::ShiftsController < BaseOrigamiController
end end
def show def show
puts ">>>>>"
puts current_user.id puts current_user.id
@shift = ShiftSale.current_open_shift(current_user.id) @shift = ShiftSale.current_open_shift(current_user.id)
end end
@@ -15,8 +16,9 @@ class Origami::ShiftsController < BaseOrigamiController
def create def create
opening_balance = params[:opening_balance] opening_balance = params[:opening_balance]
cashier_terminal = params[:cashier_terminal]
@shift = ShiftSale.new @shift = ShiftSale.new
@shift.create(opening_balance,current_user) @shift.create(opening_balance,cashier_terminal, current_user)
end end
def update_shift def update_shift
@@ -27,10 +29,21 @@ class Origami::ShiftsController < BaseOrigamiController
@shift.shift_closed_at = DateTime.now.utc @shift.shift_closed_at = DateTime.now.utc
@shift.closing_balance = closing_balance.to_f @shift.closing_balance = closing_balance.to_f
@shift.save @shift.save
end
end
unique_code = "CloseCashierPdf"
shop_details = Shop.find(1)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_close_cashier(print_settings,@shift,shop_details)
end
end
def edit def edit
end end
end end

View File

@@ -30,6 +30,13 @@ class Origami::VoidController < BaseOrigamiController
table.save table.save
end end
# update complete order items in oqs
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
aoi.delivery_status = 1
aoi.save
end
end
end end
end end

View File

@@ -74,10 +74,10 @@ class Settings::OrderQueueStationsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def settings_order_queue_station_params def settings_order_queue_station_params
# <<<<<<< HEAD # <<<<<<< HEAD
params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by) # params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
# ======= # =======
# Don't Know { zone_ids: [] } # Don't Know { zone_ids: [] }
# params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by,{ zone_ids: [] }) params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by,{ zone_ids: [] })
# >>>>>>> b093a993ba002c92659bbb34338c55c031c11d87 # >>>>>>> b093a993ba002c92659bbb34338c55c031c11d87
end end
end end

View File

@@ -20,6 +20,7 @@ class Transactions::OrdersController < ApplicationController
format.json { render json: @orders } format.json { render json: @orders }
end end
end end
def show def show
@order = Order.find(params[:id]) @order = Order.find(params[:id])

View File

@@ -52,6 +52,7 @@ class Ability
can :show, :payment can :show, :payment
can :create, :payment can :create, :payment
can :reprint, :payment can :reprint, :payment
can :rounding_adj, :payment
can :move_dining, :movetable can :move_dining, :movetable
can :moving, :movetable can :moving, :movetable
@@ -88,6 +89,7 @@ class Ability
can :show, :payment can :show, :payment
can :create, :payment can :create, :payment
can :reprint, :payment can :reprint, :payment
can :rounding_adj, :payment
can :move_dining, :movetable can :move_dining, :movetable
can :moving, :movetable can :moving, :movetable

View File

@@ -73,6 +73,48 @@ class Customer < ApplicationRecord
end end
def self.update_membership
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
@customers.each do |customer|
begin
response = HTTParty.post(url,
:body =>
{ name: customer.name,phone: customer.contact_no,
email: customer.email,dob: customer.date_of_birth,
address: customer.address,nrc:customer.nrc_no,
card_no:customer.card_no,member_group_id: customer.membership_type,
merchant_uid:merchant_uid,auth_token:auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
})
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError
response = { status: false}
end
puts response.to_json
if response["status"] == true
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
end
end
end
def self.search(search) def self.search(search)
if search if search
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])

View File

@@ -43,10 +43,10 @@ class OrderItem < ApplicationRecord
def self.get_order_items_details(booking_id) def self.get_order_items_details(booking_id)
# booking_orders = BookingOrder.where("booking_id=?",booking.booking_id) # booking_orders = BookingOrder.where("booking_id=?",booking.booking_id)
# if booking_orders # if booking_orders
# booking_orders.each do |book_order| # booking_orders.each do |book_order|
# order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price") # order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
# .joins("left join orders on orders.order_id = order_items.order_id") # .joins("left join orders on orders.order_id = order_items.order_id")
# .where("order_items.order_id=?",book_order.order) # .where("order_items.order_id=?",book_order.order)
# return order_details # return order_details
# end # end
# else # else
@@ -57,9 +57,9 @@ class OrderItem < ApplicationRecord
.joins("left join orders on orders.order_id = order_items.order_id") .joins("left join orders on orders.order_id = order_items.order_id")
.joins("left join booking_orders on booking_orders.order_id = order_items.order_id") .joins("left join booking_orders on booking_orders.order_id = order_items.order_id")
.joins("left join bookings on bookings.booking_id = booking_orders.booking_id") .joins("left join bookings on bookings.booking_id = booking_orders.booking_id")
.where("bookings.booking_id=?",booking_id) .where("bookings.booking_id=?",booking_id)
return order_details return order_details
end end
private private

View File

@@ -11,14 +11,24 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf") self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf")
end end
def print_close_cashier(receipt_no) # def print_close_cashier(receipt_no)
# #Use CUPS service
# #Generate PDF
# time = DateTime.now
# #Print
# pdf = CashierStationClosing.new
# pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
# self.print("tmp/receipt.pdf")
# end
#Bill Receipt Print
def print_close_cashier(printer_settings,shift_sale,shop_details)
#Use CUPS service #Use CUPS service
#Generate PDF #Generate PDF
time = DateTime.now
#Print #Print
pdf = CashierStationClosing.new pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details)
pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf" pdf.render_file "tmp/print_close_cashier.pdf"
self.print("tmp/receipt.pdf") self.print("tmp/print_close_cashier.pdf")
end end

View File

@@ -65,11 +65,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end end
#Bill Receipt Print #Bill Receipt Print
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details) def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status)
#Use CUPS service #Use CUPS service
#Generate PDF #Generate PDF
#Print #Print
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status)
# print as print copies in printer setting # print as print copies in printer setting
count = printer_settings.print_copies count = printer_settings.print_copies

View File

@@ -94,7 +94,6 @@ class Sale < ApplicationRecord
link_order_sale(order.id) link_order_sale(order.id)
end end
self.save! self.save!
#compute sales summary #compute sales summary
@@ -224,7 +223,7 @@ class Sale < ApplicationRecord
total_taxable = total_taxable + (item.taxable_price * item.qty) total_taxable = total_taxable + (item.taxable_price * item.qty)
end end
compute_tax(sale, total_taxable) compute_tax(sale, total_taxable, total_discount)
sale.total_amount = subtotal_price sale.total_amount = subtotal_price
sale.total_discount = total_discount sale.total_discount = total_discount
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
@@ -262,7 +261,7 @@ class Sale < ApplicationRecord
end end
# Tax Re-Calculte # Tax Re-Calculte
def compute_tax(sale, total_taxable) def compute_tax(sale, total_taxable, total_discount = 0)
#if tax is not apply create new record #if tax is not apply create new record
SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax| SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax|
#delete existing and create new #delete existing and create new
@@ -280,9 +279,12 @@ class Sale < ApplicationRecord
sale_tax.tax_rate = tax.rate sale_tax.tax_rate = tax.rate
#include or execulive #include or execulive
# sale_tax.tax_payable_amount = total_taxable * tax.rate # sale_tax.tax_payable_amount = total_taxable * tax.rate
# substract , to give after discount
total_taxable = total_taxable - total_discount
sale_tax.tax_payable_amount = total_taxable * tax.rate / 100 sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
#new taxable amount #new taxable amount is standard rule for step by step
total_taxable = total_taxable + sale_tax.tax_payable_amount # total_taxable = total_taxable + sale_tax.tax_payable_amount
sale_tax.inclusive = tax.inclusive sale_tax.inclusive = tax.inclusive
sale_tax.save sale_tax.save
@@ -319,8 +321,8 @@ class Sale < ApplicationRecord
#include or execulive #include or execulive
# sale_tax.tax_payable_amount = total_taxable * tax.rate # sale_tax.tax_payable_amount = total_taxable * tax.rate
sale_tax.tax_payable_amount = total_taxable * tax.rate / 100 sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
#new taxable amount #new taxable amount is standard rule for step by step
total_taxable = total_taxable + sale_tax.tax_payable_amount # total_taxable = total_taxable + sale_tax.tax_payable_amount
sale_tax.inclusive = tax.inclusive sale_tax.inclusive = tax.inclusive
sale_tax.save sale_tax.save
@@ -407,8 +409,8 @@ class Sale < ApplicationRecord
else else
## up to 100 ## up to 100
value = 100 - get_last_no.to_f value = 100 - get_last_no.to_f
num += value num += value
puts 'up to 100' puts 'up to 100'
end end
end end
end end
@@ -441,6 +443,7 @@ class Sale < ApplicationRecord
to_date = sale_date.end_of_day.utc - diff to_date = sale_date.end_of_day.utc - diff
total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total, 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 total_discount else 0 end),0) as total_discount,
IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_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") IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj")
@@ -448,6 +451,7 @@ class Sale < ApplicationRecord
total_sale.each do |sale| total_sale.each do |sale|
grand_total = sale.grand_total grand_total = sale.grand_total
old_grand_total = sale.old_grand_total
total_discount = sale.total_discount total_discount = sale.total_discount
void_amount = sale.void_amount void_amount = sale.void_amount
total = {:sale_date => pay.sale_date, total = {:sale_date => pay.sale_date,
@@ -461,6 +465,7 @@ class Sale < ApplicationRecord
:foc_amount => pay.foc_amount, :foc_amount => pay.foc_amount,
:total_discount => total_discount, :total_discount => total_discount,
:grand_total => grand_total, :grand_total => grand_total,
:old_grand_total => old_grand_total,
:void_amount => void_amount, :void_amount => void_amount,
:rounding_adj => sale.rounding_adj} :rounding_adj => sale.rounding_adj}
daily_total.push(total) daily_total.push(total)

View File

@@ -55,7 +55,7 @@ class SalePayment < ApplicationRecord
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by) sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
# update complete order items in oqs # update complete order items in oqs
SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr| SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi| AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
aoi.delivery_status = 1 aoi.delivery_status = 1
aoi.save aoi.save
@@ -274,6 +274,8 @@ class SalePayment < ApplicationRecord
shift = ShiftSale.current_open_shift(self.sale.cashier_id) shift = ShiftSale.current_open_shift(self.sale.cashier_id)
if !shift.nil? if !shift.nil?
shift.update(self.sale) shift.update(self.sale)
self.sale.shift_sale_id = shift.id
self.sale.save
end end
end end
@@ -285,7 +287,7 @@ class SalePayment < ApplicationRecord
bookings = table.bookings bookings = table.bookings
bookings.each do |tablebooking| bookings.each do |tablebooking|
if tablebooking.booking_status != 'moved' if tablebooking.booking_status != 'moved'
if tablebooking.sale.sale_status != 'completed' if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void'
status = false status = false
end end
end end
@@ -304,16 +306,22 @@ class SalePayment < ApplicationRecord
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0 if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
paypar = sObj.sale_payments paypar = sObj.sale_payments
payparcost = 0 payparcost = 0
credit = 0
paypar.each do |pp| paypar.each do |pp|
if pp.payment_method == "paypar" if pp.payment_method == "paypar"
payparcost = payparcost + pp.payment_amount payparcost = payparcost + pp.payment_amount
elsif pp.payment_method == "creditnote"
credit = 1
end end
end end
# overall_dis = SaleItem.get_overall_discount(sObj.id) # overall_dis = SaleItem.get_overall_discount(sObj.id)
overall_dis = sObj.total_discount overall_dis = sObj.total_discount
total_amount = rebate_prices - payparcost + overall_dis total_amount = rebate_prices - payparcost - overall_dis
if total_amount > 0 if credit == 1
total_amount = 0
end
if total_amount >= 0
receipt_no = sObj.receipt_no receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("rebate") memberaction = MembershipAction.find_by_membership_type("rebate")
@@ -332,7 +340,7 @@ class SalePayment < ApplicationRecord
}, :timeout => 10) }, :timeout => 10)
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = { status: false} response = { status: false}

View File

@@ -16,19 +16,23 @@ class ShiftSale < ApplicationRecord
belongs_to :cashier_terminal belongs_to :cashier_terminal
belongs_to :employee, :foreign_key => 'employee_id' belongs_to :employee, :foreign_key => 'employee_id'
def self.current_shift
today_date = DateTime.now.strftime("%Y-%m-%d")
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null",today_date).take
return shift
end
def self.current_open_shift(current_user) def self.current_open_shift(current_user)
#if current_user #if current_user
#find open shift where is open today and is not closed and login by current cashier #find open shift where is open today and is not closed and login by current cashier
today_date = DateTime.now.strftime("%Y-%m-%d") today_date = DateTime.now.strftime("%Y-%m-%d")
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
return shift return shift
#end #end
end end
def create(opening_balance,current_user) def create(opening_balance,cashier_terminal, current_user)
self.cashier_terminal_id = CashierTerminal.first.id self.cashier_terminal_id = cashier_terminal
self.shift_started_at = DateTime.now self.shift_started_at = DateTime.now
self.employee_id = current_user.id self.employee_id = current_user.id
self.opening_balance = opening_balance self.opening_balance = opening_balance

View File

@@ -0,0 +1,179 @@
class CloseCashierPdf < Prawn::Document
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
def initialize(printer_settings, shift_sale,shop_details)
self.page_width = 210
self.page_height = 7000
self.margin = 5
self.price_width = 40
self.qty_width = 20
self.total_width = 40
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
self.item_height = 15
self.item_description_width = (self.page_width-20) / 2
self.label_width = 100
self.text_width = (self.page_width - 80) - self.price_width / 3
# @item_width = self.page_width.to_i / 2
# @qty_width = @item_width.to_i / 3
# @double = @qty_width * 1.3
# @half_qty = @qty_width / 2
#setting page margin and width
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
self.header_font_size = 10
self.item_font_size = 8
header( shop_details)
stroke_horizontal_rule
shift_detail(shift_sale)
end
def header (shop_details)
move_down 7
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
move_down 5
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
# move_down self.item_height
move_down 5
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
move_down 5
stroke_horizontal_rule
end
def shift_detail(shift_sale)
move_down 7
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Cashier : ", :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.employee.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 "Cashier Station : ", :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.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 Float : ", :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.opening_balance}" , :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 Float : ", :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.closing_balance}" , :size => self.item_font_size,:align => :left
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
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
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 "Net Sales:", :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.nett_sales}", :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 Tax :", :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_taxes}", :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 Payment :", :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_sales}", :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 "Credit Payment :", :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.credit_sales}", :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 "Other Payment :", :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.other_sales}", :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 Sale :", :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_revenue}", :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 "Discount Amount :", :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_discounts}", :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 "Commercial Tax :", :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.commercial_taxes}", :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 "Grand Total :", :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.grand_total}", :size => self.item_font_size, :align => :right
end
move_down 5
stroke_horizontal_rule
move_down 5
move_down 5
end
end

View File

@@ -1,7 +1,7 @@
class ReceiptBillPdf < Prawn::Document class ReceiptBillPdf < Prawn::Document
include ActionView::Helpers::NumberHelper 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 attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details) def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status)
self.page_width = 210 self.page_width = 210
self.page_height = 7000 self.page_height = 7000
self.margin = 5 self.margin = 5
@@ -53,7 +53,7 @@ class ReceiptBillPdf < Prawn::Document
items_account(item_price_by_accounts,printer_settings.precision,delimiter) items_account(item_price_by_accounts,printer_settings.precision,delimiter)
footer footer(printed_status)
end end
def header (shop_details) def header (shop_details)
@@ -82,14 +82,11 @@ class ReceiptBillPdf < Prawn::Document
move_down 5 move_down 5
y_position = cursor y_position = cursor
bounding_box([0, y_position], :width =>self.item_width) do bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
end end
move_down 5 bounding_box([self.label_width,y_position], :width =>self.label_width, :height => self.item_height) do
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
y_position = cursor
bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do
text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left
end end
move_down 5 move_down 5
@@ -182,7 +179,7 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor 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.item_description_width, :height => self.item_height) do
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left text "#{ st.tax_name } ( #{ st.tax_rate.to_i }%)", :size => self.item_font_size,:align => :left
end end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
@@ -236,9 +233,16 @@ class ReceiptBillPdf < Prawn::Document
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment| SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do if payment.payment_method == "paypar"
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Redeem Payment", :size => self.item_font_size,:align => :left
end
else
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
end end
end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end end
@@ -266,34 +270,56 @@ class ReceiptBillPdf < Prawn::Document
if rebate_amount["status"] == true if rebate_amount["status"] == true
stroke_horizontal_rule stroke_horizontal_rule
rebate = 0 rebate = 0
redeem = 0
rebate_amount["data"].each do |res| rebate_amount["data"].each do |res|
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate"
rebate = rebate + res["rebate"]
end
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem" if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
redeem = redeem + res["redeem"]
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Current 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(res["redeem"], :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end end
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
rebate = rebate + res["rebate"]
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
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
end
end
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
rebate = rebate + res["rebate"]
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
end
end
end end
move_down 5 move_down 5
y_position = cursor 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.item_description_width, :height => self.item_height) do
text "Current Rebate Amount", :size => self.item_font_size,:align => :left text "Redeem Amount", :size => self.item_font_size,:align => :left
end end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(rebate, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end end
end end
end end
if member_info["status"] == true && member_info["data"].present? if member_info["status"] == true && member_info["data"].present?
@@ -309,7 +335,7 @@ class ReceiptBillPdf < Prawn::Document
move_down 5 move_down 5
y_position = cursor 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.item_description_width, :height => self.item_height) do
text "Current Balance", :size => self.item_font_size,:align => :left text "Total Balance", :size => self.item_font_size,:align => :left
end end
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right text "#{number_with_precision(balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
@@ -360,12 +386,18 @@ class ReceiptBillPdf < Prawn::Document
end end
end end
def footer def footer(printed_status)
move_down 5 move_down 5
stroke_horizontal_rule stroke_horizontal_rule
move_down 5 move_down 5
text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :center y_position = cursor
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
text "#{printed_status}", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
end
move_down 5 move_down 5
end end

View File

@@ -47,11 +47,15 @@
<tbody> <tbody>
<% @i = 0 %> <% @i = 0 %>
<% @crm_customers.each do |crm_customer| %> <% @crm_customers.each do |crm_customer| %>
<% if crm_customer.customer_id != "CUS-00001" && crm_customer.customer_id != "CUS-000000000" %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>"> <tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td> <td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td> <input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= @i += 1 %></td> <td>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<%= @i += 1 %>
<% end %>
</td>
<td><%= crm_customer.name %></td> <td><%= crm_customer.name %></td>
<td><%= crm_customer.card_no rescue '-' %></td> <td><%= crm_customer.card_no rescue '-' %></td>
<td><%= crm_customer.contact_no %></td> <td><%= crm_customer.contact_no %></td>
@@ -59,7 +63,7 @@
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td> <td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
</tr> </tr>
<% end %>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -32,6 +32,7 @@
<th>NRC/Passport No</th> <th>NRC/Passport No</th>
<th>Address</th> <th>Address</th>
<th>DOB</th> <th>DOB</th>
<th>Membership Type</th>
</tr> </tr>
</thead> </thead>
@@ -45,8 +46,16 @@
<td><%= @customer.nrc_no %></td> <td><%= @customer.nrc_no %></td>
<td><%= @customer.address%></td> <td><%= @customer.address%></td>
<td><%= @customer.date_of_birth %></td> <td><%= @customer.date_of_birth %></td>
<% if @customer.membership_type.to_f > 0%>
<td><%lookup= Lookup.find_by_value(@customer.membership_type) %>
<%= lookup.name %>
</td>
<%else%>
<td>-</td>
<%end%>
</tr> </tr>
<tr><th colspan="8"></th></tr> <tr><th colspan="9"></th></tr>
</tbody> </tbody>
</table> </table>
@@ -55,21 +64,19 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<%
if @response["data"].present? %>
<tr> <tr>
<th colspan="5">Membership Transactions</th> <th colspan="5">Membership Transactions</th>
<% if @response["status"] == true %>
<th>Current Balance : <%= @response["data"].last["balance"]%></th> <th>Current Balance : <%= @balance%></th>
<% end %>
</tr> </tr>
<% end %>
<tr> <tr>
<th>Date</th> <th>Date</th>
<th>Redeem</th> <th>Redeem</th>
<th>Rebate</th> <th>Rebate</th>
<th>Balance</th> <th>Balance</th>
<!-- <th>Account No</th> --> <th>From Account</th>
<th>Status</th> <th>Status</th>
<th>Receipt No</th> <th>Receipt No</th>
</tr> </tr>
@@ -82,7 +89,7 @@
<td><%= transaction["redeem"]%></td> <td><%= transaction["redeem"]%></td>
<td><%= transaction["rebate"] %></td> <td><%= transaction["rebate"] %></td>
<td><%= transaction["balance"] %></td> <td><%= transaction["balance"] %></td>
<!-- <td><%= transaction["account_no"] %></td> --> <td><%= transaction["account_status"] %></td>
<td><%= transaction["status"] %></td> <td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td> <td><%= transaction["receipt_no"] %></td>

View File

@@ -22,7 +22,10 @@
<%= qsi[:station_name] %> <%= qsi[:station_name] %>
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>> <span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
<%= qsi[:item_count] %> <%= qsi[:item_count] %>
</span> </span>
<% if qsi[:is_ap] %>
<span>(ap)</span>
<% end %>
</a> </a>
</li> </li>
<% end %> <% end %>
@@ -34,8 +37,7 @@
<div class="tab-pane active" id="completed" role="tabpanel"> <div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% <%
@queue_completed_item.each do |qid| @queue_completed_item.each do |qid|
if qid.price != 0
%> %>
<div class="card queue_station"> <div class="card queue_station">
<div class="card-block"> <div class="card-block">
@@ -70,8 +72,7 @@
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p> <p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div> </div>
</div> </div>
<% <%
end
end end
%> %>
</div> </div>
@@ -89,7 +90,7 @@
<% <%
@queue_items_details.each do |qid| @queue_items_details.each do |qid|
if qid.price != 0 if qid.price != 0
if qid.station_name == qsi[:station_name] if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
%> %>
<div class="card queue_station"> <div class="card queue_station">
<div class="card-block"> <div class="card-block">

View File

@@ -24,26 +24,21 @@
<button class='btn btn-primary payment-type' data-id='jcb' id='jcb'>JCB</button> <button class='btn btn-primary payment-type' data-id='jcb' id='jcb'>JCB</button>
</td> </td>
</tr> </tr>
<tr>
<td> Reference Number
</td>
<td><input type='text' id='payment_method_reference'/></td>
</tr>
<tr>
<td> Amount
</td>
<td><input type='text' id='amount'/></td>
</tr>
</table> </table>
<div class='row'>
<div class='col-md-2'></div>
<div class='col-md-2'>Reference Number </div>
<div class='col-md-4'><input type='text' id='payment_method_reference'/> </div>
</div>
<br>
<div class='row'>
<div class='col-md-2'></div>
<div class='col-md-2'>Amount</div>
<div class='col-md-4'><input type='text' id='amount'/></div>
</div>
<br><br>
<div class='row'>
<div class='col-md-3'></div>
<div class='col-md-4'><button class='btn btn-primary btn-lg' id='cash_in' style='width:200px;'> Cash In</button></div>
</div>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button class='btn btn-primary ' id='cash_in' style='width:100px;'> Back </button> <button type="button" class="btn btn-primary btn-block" id='back'> Back </button>
<button type="button" class="btn btn-primary btn-block" id='cash_in'> Cash In </button>
</div> </div>
</div> </div>
@@ -76,4 +71,7 @@ $('#cash_in').on('click',function(){
} }
}); });
}) })
$('#back').on('click',function(){
window.location.href = '/origami';
})
</script> </script>

View File

@@ -1,6 +1,8 @@
<h2>Payment Debit</h2>
<div class='row'> <div class='row'>
<div class='col-md-9'> <div class="col-lg-11 col-md-11 col-sm-11">
<h2>Payment Debit</h2>
<table class='table table-striped'> <table class='table table-striped'>
<tr> <tr>
<td> Payment Reference <td> Payment Reference
@@ -20,13 +22,12 @@
</table> </table>
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" id='back'> Back </button>
<button type="button" class="btn btn-primary btn-block" id='cash_out'> Cash Out </button>
</div>
</div>
</div>
<br><br>
<div class='row'>
<div class='col-md-3'></div>
<div class='col-md-4'><button class='btn btn-primary btn-lg' id='cash_out'> Cash Out</button></div>
</div>
<script> <script>
$('#cash_out').on('click',function(){ $('#cash_out').on('click',function(){
@@ -41,4 +42,8 @@ $('#cash_out').on('click',function(){
} }
}); });
}) })
$('#back').on('click',function(){
window.location.href = '/origami';
})
</script> </script>

View File

@@ -41,11 +41,15 @@
<% if @crm_customers.count > 0 %> <% if @crm_customers.count > 0 %>
<% @i = 0 %> <% @i = 0 %>
<% @crm_customers.each do |crm_customer| %> <% @crm_customers.each do |crm_customer| %>
<% if crm_customer.customer_id != "CUS-00000" && crm_customer.customer_id != "CUS-00000000" %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>"> <tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td> <td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td> <input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= @i += 1 %></td> <td>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<%= @i += 1 %>
<% end %>
</td>
<td><%= crm_customer.name %></td> <td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td> <td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td> <td><%= crm_customer.contact_no %></td>
@@ -53,7 +57,6 @@
</tr> </tr>
<% end %>
<% end %> <% end %>
<%else%> <%else%>
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr> <tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
@@ -155,10 +158,10 @@
<%= f.input :address, :class => "form-control col-md-6 address" %> <%= f.input :address, :class => "form-control col-md-6 address" %>
</div> </div>
<!-- <div class="form-group"> <div class="form-group">
<label>Sr.No</label> <label>Sr.No</label>
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true"> <input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
</div> --> </div>
<div class="form-group"> <div class="form-group">
<label>Date Of Birth</label> <label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>

View File

@@ -174,7 +174,7 @@
<div class="form-group"> <div class="form-group">
<button id="net" class="btn btn-info fluid action-btn">Nett</button> <button id="net" class="btn btn-info fluid action-btn">Nett</button>
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button> <button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button> <button id="remove-item" class="btn btn-default fluid action-btn">Clear Discount</button>
</div> </div>
</div> </div>
</div> </div>
@@ -187,7 +187,7 @@
<!-- Action Panel --> <!-- Action Panel -->
<div> <div>
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami';"><i class="fa fa-arrow-left"></i> Back </button> <button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami';"><i class="fa fa-arrow-left"></i> Back </button>
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">Remove Discount</button> <button id="remove-item-discount" class="btn btn-warning btn-block action-btn">RemoveItem Discount</button>
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button> <button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button> <button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
</div> </div>

View File

@@ -163,18 +163,18 @@
</thead> </thead>
<tbody> <tbody>
<% <%
count = 0 count = 0
sub_total = 0 sub_total = 0
if @status_sale == "sale" if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item| @sale_array[0].sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price sub_total = sub_total + sale_item.price
%> %>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>"> <input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% <%
# Can't check for discount # Can't check for discount
unless sale_item.price == 0 unless sale_item.price == 0
count += 1
%> %>
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
@@ -301,7 +301,7 @@
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button> <button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" class="btn btn-primary btn-block" >Add Order</button> <!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button> <button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button> <button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button> <button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
@@ -311,7 +311,7 @@
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button> <button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void </button> <button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %> <% else %>
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> <!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button> <button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button> <button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button> <button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
@@ -439,7 +439,7 @@ $("#first_bill").on('click', function(){
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
success:function(result){ success:function(result){
location.reload(); location.reload();
} }
}); });
@@ -447,7 +447,16 @@ $("#first_bill").on('click', function(){
$('#pay').on('click',function() { $('#pay').on('click',function() {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/'+ sale_id + "/payment"; var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
}); });
// Bill Request // Bill Request

View File

@@ -215,7 +215,16 @@ $(document).ready(function(){
}); });
$('#pay').on('click',function() { $('#pay').on('click',function() {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/'+ sale_id + "/payment"; var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
alert(url)
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
}); });
$('#back').on('click',function(){ $('#back').on('click',function(){
window.location.href = '/origami/'; window.location.href = '/origami/';

View File

@@ -70,14 +70,20 @@
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td> <td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td> <td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
</tr> </tr>
<tr>
<td style="width:80%; text-align:left; border-top:none"><strong>Tax</strong></td> <td style="width:80%; text-align:left; border-top:none"><strong>Tax</strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.total_tax rescue 0%></span></strong></td> <td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.total_tax rescue 0%></span></strong></td>
</tr> </tr>
<tr>
<td style="width:80%; text-align:left; border-top:none"><strong>Rounding Adj:</strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.rounding_adjustment rescue 0%></span></strong></td>
</tr>
<tr>
<td style="width:80%; text-align:left; border-top:none"><strong>Grand Total</strong></td> <td style="width:80%; text-align:left; border-top:none"><strong>Grand Total</strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td> <td style="width:20%; text-align:right; border-top:none"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
</tr> </tr>
<%if @balance > 0%> <%if @balance > 0%>
</tr> <tr>
<td style="width:80%; text-align:left; border-top:none"><strong><%= @accountable_type %></strong></td> <td style="width:80%; text-align:left; border-top:none"><strong><%= @accountable_type %></strong></td>
<td style="width:20%; text-align:right; border-top:none"><strong><span><%=@balance%></span></strong></td> <td style="width:20%; text-align:right; border-top:none"><strong><span><%=@balance%></span></strong></td>
</tr> </tr>
@@ -188,10 +194,10 @@
<div class="col-md-4" id="mastercount">0.0</div> <div class="col-md-4" id="mastercount">0.0</div>
</div> </div>
<% end %> <% end %>
<hr class="style2"> <br>
<div class="row"> <div class="row">
<div class="col-md-8">Balance</div> <div class="col-md-8"><strong style="font-size:18px;">Balance</strong></div>
<div class="col-md-4"><span id='balance'><%= @sale_data.grand_total %></span></div> <div class="col-md-4"><strong style="font-size:18px;"><span id='balance'><%= @sale_data.grand_total %></span></strong></div>
</div> </div>
<br> <br>
@@ -328,6 +334,7 @@ $( document ).ready(function() {
}); });
$('#pay').click(function() { $('#pay').click(function() {
$('#pay').text("Processing, Please wait!")
if($('#balance').text() > 0){ if($('#balance').text() > 0){
alert(" Insufficient Amount!") alert(" Insufficient Amount!")
}else{ }else{
@@ -345,6 +352,7 @@ $( document ).ready(function() {
if($('#balance').text() < 0){ if($('#balance').text() < 0){
alert("Changed amount " + $('#balance').text() * (-1) ) alert("Changed amount " + $('#balance').text() * (-1) )
}else{ }else{
$('#pay').text("Pay")
alert("Thank you") alert("Thank you")
} }

View File

@@ -46,6 +46,10 @@
<tr> <tr>
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>

View File

@@ -112,6 +112,10 @@
<tr> <tr>
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
@@ -139,7 +143,17 @@ $(document).ready(function(){
}); });
$('#pay').on('click',function() { $('#pay').on('click',function() {
window.location.href = '/origami/sale/<%= @sale.id %>/payment'; var sale_id = '<%= @sale.id %>';
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
alert(url)
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
}); });
$('#back').on('click',function(){ $('#back').on('click',function(){
window.location.href = '/origami/table/<%= @room.id %>'; window.location.href = '/origami/table/<%= @room.id %>';

View File

@@ -203,6 +203,10 @@
<tr> <tr>
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @obj.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @obj.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj.rounding_adjustment rescue 0%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
@@ -272,7 +276,7 @@
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button> <button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" class="btn btn-primary btn-block" >Add Order</button> <!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button> <button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button> <button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button> <button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
@@ -281,7 +285,7 @@
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button> <button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button> <button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
<% else %> <% else %>
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> <!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button> <button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button> <button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button> <button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
@@ -424,12 +428,19 @@ $("#first_bill").on('click', function(){
}); });
}); });
$('#pay').on('click',function() { $('#pay').on('click',function() {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/'+ sale_id + "/payment"; var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
alert(url)
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
}); });
// Bill Request // Bill Request
$('#request_bills').click(function() { $('#request_bills').click(function() {
var order_id = $('#save_order_id').attr('data-order'); var order_id = $('#save_order_id').attr('data-order');

View File

@@ -49,18 +49,18 @@
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td> <td class='item-name'><%= sale_item.product_name %></td>
<% if sale_item.remark != 'void' %> <% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" /></td> <td class='item-attr-edit'><input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" /></td>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" /></td> <td class='item-attr-edit'><input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" /></td>
<td class='item-attr'> <td class='item-attr'>
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm update'>Update</button> <button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm update'>Update</button>
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-sm void'>Void</button></td> <button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-sm void'>Void</button></td>
</td> </td>
<% elsif sale_item.qty.to_i < 0 %> <% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td> <td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" disabled/></td> <td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" disabled/></td>
<td class='item-attr'> <td class='item-attr'>
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm cancel'>Cancel Void</button> <button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-sm cancel'>Cancel Void/Update</button>
</td> </td>
<% else %> <% else %>
<td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td> <td class='item-attr-edit'><input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" disabled/></td>
@@ -101,11 +101,14 @@
$(document).ready(function(){ $(document).ready(function(){
$(".update").on('click',function() { $(".update").on('click',function() {
var sale_item_id = $(this).attr('data-id'); var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void"; var qty = $('#'+sale_item_id + "_qty").val();
var price = $('#'+ sale_item_id + "_price").val();
console.log(qty + "|" + price)
var ajax_url = "/origami/item_edit";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
data: 'order_id='+ order_id, data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
success:function(result){ success:function(result){
location.reload(); location.reload();
} }

View File

@@ -171,6 +171,10 @@
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr> </tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td> <td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>

View File

@@ -1,16 +1,23 @@
<h1>Open Cashier</h1> <h1>Open Cashier</h1>
<br> <br>
<div class="row">
<div class="col-md-12">
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<table class='table table-striped'> <table class='table table-striped'>
<tr>
<th>Cashier Terminal</th>
<th>
<select class='form-control' id='cashier_terminal'>
<% @terminal.each do |ter| %>
<option value="<%= ter.id %>"><%= ter.name %></option>
<% end %>
</select>
</th>
</tr>
<% @float.each do |float| %> <% @float.each do |float| %>
<tr> <tr>
<th><%= float.name %></th> <th><%= float.name %></th>
<th><input class='float-value' type='text' data-value ="<%= float.value %>" value='' /></th> <th><input class='float-value' type='text' data-value ="<%= float.value %>" value='0' id='<%= float.value %>'></input></th>
</tr> </tr>
<% end %> <% end %>
<tr> <tr>
@@ -18,12 +25,7 @@
<th><div id='total'></div></th> <th><div id='total'></div></th>
</tr> </tr>
</table> </table>
<div class="row">
<div class='col-md-4'></div>
<div class='col-md-2'>
<button class='btn btn-primary' id='open_cashier'>Open Cashier</button>
</div>
</div>
</div> </div>
<div class='col-md-8'> <div class='col-md-8'>
<div class="row"> <div class="row">
@@ -49,9 +51,9 @@
<div class=" cashier_number left" data-value="00" data-type="num">00</div> <div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div> </div>
<div class="row bottom"> <div class="row bottom">
<div class=" cashier_number red" data-type="del" >Del</div> <div class=" cashier_number orange " data-type="clr">Clr</div>
<div class=" cashier_number orange left" data-type="clr">Clr</div> <div class=" cashier_number left" data-type='ent' >Calculate</div>
<div class=" cashier_number purple left" data-type="ent">Ent</div> <div class=" cashier_number purple left" id="open_cashier">Open Cashier</div>
</div> </div>
</div> </div>
@@ -60,19 +62,58 @@
</div> </div>
<script> <script>
var total = 0
$(document).on('focusout', '.float-value', function(event){
var input_type = $(this).attr("data-value");
var count = $(this).val();
total += input_type * count
$('#total').text(total)
var float_value = ""
var total = 0
$(document).on('focusout', '.float-value', function(event){
float_value = $(this).attr("data-value");
$(document).on('click', '.cashier_number', function(event){
if(event.handled !== true) {
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
var original = $('#'+float_value).val();
if (original == "0"){
$('#'+float_value).val(input_value);
}else{
$('#'+float_value).val(original + input_value);
}
break;
case 'clr':
$('#'+float_value).val("0");
break;
case 'ent':
var sum = 0
<%
sum = 0
@float.each do |float|
%>
var float = "<%= float.value %>"
console.log(float)
var cal = $('#'+ float).val() * float
sum += cal;
<%
end
%>
total = sum
$('#total').text(total)
break;
}
event.handled = true;
} else {
return false;
}
});
}) })
$('#open_cashier').on('click',function(){ $('#open_cashier').on('click',function(){
var cashier_terminal = $('#cashier_terminal').val();
var amount = $('#total').text(); var amount = $('#total').text();
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_shifts_path %>", url: "<%= origami_shifts_path %>",
data: "opening_balance=" + amount, data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
success:function(result){ success:function(result){
if(result){ if(result){
window.location.href = '/origami'; window.location.href = '/origami';

View File

@@ -46,6 +46,10 @@
<tr> <tr>
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>

View File

@@ -112,6 +112,10 @@
<tr> <tr>
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
@@ -139,8 +143,23 @@ $(document).ready(function(){
}) })
}); });
// $('#pay').on('click',function() {
// window.location.href = '/origami/sale/<%= @sale.id %>/payment';
// });
$('#pay').on('click',function() { $('#pay').on('click',function() {
window.location.href = '/origami/sale/<%= @sale.id %>/payment'; var sale_id = '<%= @sale.id %>';
var url = '<%= @calculate_rouding_adj_path %>';
$.ajax({
type: "GET",
url: url,
success:function(result){
// location.reload();
}
});
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}); });
$('#back').on('click',function(){ $('#back').on('click',function(){
window.location.href = '/origami/table/<%= @table.id %>'; window.location.href = '/origami/table/<%= @table.id %>';

View File

@@ -74,7 +74,7 @@
<% credit += sale[:credit_amount] %> <% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %> <% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %> <% discount += sale[:total_discount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %> <% total += sale[:old_grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %> <% grand_total += sale[:grand_total].to_f %>
<% rounding_adj += sale[:rounding_adj].to_f %> <% rounding_adj += sale[:rounding_adj].to_f %>
<tr> <tr>
@@ -90,7 +90,7 @@
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td> <td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td> <td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td> <td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td> <td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:old_grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td> <td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td> <td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
</tr> </tr>

View File

@@ -116,24 +116,6 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<!--
<div class = "row">
<div class = "span3">
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
</div>
<div class = "span3">
<select name="shift" id="shift">
<option value="">All Shift</option>
</select>
</div>
<div class = "span3">
</div>
</div>
-->
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#custom_excel').hide(); $('#custom_excel').hide();
@@ -144,13 +126,69 @@ $(function(){
$('#frm_report').submit(); $('#frm_report').submit();
// window.location = url; // window.location = url;
}); });
function export_to(path)
{
var form_params = $("#frm_report").serialize();
window.location = path+"?"+ form_params;
}
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
}); });
//Reset the form to pervious values
$("#branch").val(<%=params[:branch]%>);
$("#waiter").val("<%=params[:waiter]%>");
$("#cashier").val(<%=params[:cashier]%>);
$("#product").val(<%=params[:product]%>);
$("#singer").val(<%=params[:singer]%>);
$("#item").val('<%=params[:item]%>');
$("#guest_role").val('<%=params[:guest_role]%>');
$("#from").val("<%=params[:from]%>");
$("#to").val("<%=params[:to]%>");
$("#sel_period").val(<%=params[:period]%>);
$("#sel_sale_type").val(<%=params[:sale_type]%>);
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script> </script>

View File

@@ -39,6 +39,9 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Customer Details</a> <a class="nav-link" data-toggle="tab" href="#customer" role="tab">Customer Details</a>
</li> </li>
<!-- <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#sale_audit" role="tab">Sale Audits</a>
</li> -->
</ul> </ul>
<!-- Nav tabs - End --> <!-- Nav tabs - End -->
@@ -235,23 +238,31 @@
</div> </div>
</div> </div>
<div class="tab-pane" id="sale_audit" role="tabpanel">
<br>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Status</th>
<th>Action At</th>
<th>Approved By</th>
<th>Remark</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div> </div>
</div> </div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2">
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary btn-lg">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
<a href="<%= transactions_void_path(@sale)%>" style="margin-top: 10px " class="btn btn-danger btn-lg">
<i class="fa fa-trash fa-lg"></i> Void Sale
</a>
<a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success btn-lg">
<i class="fa fa-invoice fa-lg"></i> Complete Sale
</a>
</div> -->
</div> </div>

View File

@@ -80,6 +80,7 @@ Rails.application.routes.draw do
post 'moving' => "movetable#moving" post 'moving' => "movetable#moving"
get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit" get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit"
post 'item_void' => "sale_edit#item_void" post 'item_void' => "sale_edit#item_void"
post 'item_edit' => "sale_edit#item_edit"
post 'item_void_cancel' => "sale_edit#item_void_cancel" post 'item_void_cancel' => "sale_edit#item_void_cancel"
post 'cancel_all_void' => 'sale_edit#cancel_all_void' post 'cancel_all_void' => 'sale_edit#cancel_all_void'
post 'apply_void' => 'sale_edit#apply_void' post 'apply_void' => 'sale_edit#apply_void'
@@ -109,7 +110,7 @@ Rails.application.routes.draw do
#---------Shift ---------------# #---------Shift ---------------#
resources :shifts, only: [:index, :new, :create, :edit] resources :shifts, only: [:index, :new, :create, :edit]
post 'close_shift' => 'shifts#update_shift' post 'close_shift' => 'shifts#update_shift'
get 'shift/close' => 'shifts#show' get 'shift/close' => 'shifts#show'
#shift - index (open/close shift landing page) #shift - index (open/close shift landing page)
#shift - show (sales summary display) #shift - show (sales summary display)
#shift - new (open shift) #shift - new (open shift)
@@ -121,6 +122,7 @@ Rails.application.routes.draw do
#payment - Outing payments - Cash only [ *Misc expeness tracking] #payment - Outing payments - Cash only [ *Misc expeness tracking]
#--------- Payment ------------# #--------- Payment ------------#
post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj',:as => "calculate_rouding_adjs"
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => { :format => 'json' } get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => { :format => 'json' }
get 'sale/:sale_id/payment' => 'payments#show' get 'sale/:sale_id/payment' => 'payments#show'

7
config/schedule.rb Normal file
View File

@@ -0,0 +1,7 @@
set :environment, "development"
env :PATH, ENV['PATH']
set :output, 'log/whenever.log'
every 30.minutes do
runner "Customer.update_membership"
end

View File

@@ -21,6 +21,7 @@ class CreateSales < ActiveRecord::Migration[5.1]
t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.integer :shift_sale_id t.integer :shift_sale_id
t.decimal :old_grand_total
t.timestamps t.timestamps
end end
end end

View File

@@ -159,6 +159,7 @@ admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "3
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"}) order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"}) order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"}) request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
close_cashier_printer=PrintSetting.create({name: "Close Cashier", unique_code: "CloseCashierPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"}) crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"}) queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})

View File

@@ -67,7 +67,7 @@ menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mut
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0152", menu_item: menu_category1_menu_item7, price:8000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0152", menu_item: menu_category1_menu_item7, price:8000.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0151", menu_item: menu_category1_menu_item7, price:16000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0151", menu_item: menu_category1_menu_item7, price:16000.00, is_on_promotion:false}])
# Sliced Beef Thin # Sliced Beef Thin
menu_category1_menu_item8 = SimpleMenuItem.create({item_code:"01009", name: "Sliced Beef Thin", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item8 = SimpleMenuItem.create({item_code:"01009", name: "Sliced Beef ( Thin ", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0162", menu_item: menu_category1_menu_item8, price:6000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0162", menu_item: menu_category1_menu_item8, price:6000.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0161", menu_item: menu_category1_menu_item8, price:12000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0161", menu_item: menu_category1_menu_item8, price:12000.00, is_on_promotion:false}])
# Tender Sliced Beef # Tender Sliced Beef
@@ -87,15 +87,15 @@ menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mut
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item12, price:7000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item12, price:7000.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item12, price:14000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item12, price:14000.00, is_on_promotion:false}])
# Sliced Beef ( Think ) # Sliced Beef ( Think )
menu_category1_menu_item13 = SimpleMenuItem.create({item_code:"01014", name: "Sliced Beef ( Think )", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item13 = SimpleMenuItem.create({item_code:"01014", name: "Sliced Beef ( Thick )", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1432", menu_item: menu_category1_menu_item13, price:7000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1432", menu_item: menu_category1_menu_item13, price:7000.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1431", menu_item: menu_category1_menu_item13, price:14000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1431", menu_item: menu_category1_menu_item13, price:14000.00, is_on_promotion:false}])
# Pork # Pork
menu_category4 = MenuCategory.create({menu: menu, code:"C004", name: "Pork", alt_name: "Pork", order_by: 4,created_by: "SYSTEM DEFAULT"}) menu_category4 = MenuCategory.create({menu: menu, code:"C004", name: "Pork", alt_name: "Pork", order_by: 4,created_by: "SYSTEM DEFAULT"})
# Sliced Tenderloin Pork # Sliced Tenderloin Pork
menu_category1_menu_item13 = SimpleMenuItem.create({item_code:"01014", name: "Sliced Tenderloin Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item137 = SimpleMenuItem.create({item_code:"01014", name: "Sliced Tenderloin Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0212", menu_item: menu_category1_menu_item13, price:4000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0212", menu_item: menu_category1_menu_item137, price:4000.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0211", menu_item: menu_category1_menu_item13, price:8000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0211", menu_item: menu_category1_menu_item137, price:8000.00, is_on_promotion:false}])
# Sliced Pork Belly # Sliced Pork Belly
menu_category1_menu_item14 = SimpleMenuItem.create({item_code:"01015", name: "Sliced Pork Belly", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item14 = SimpleMenuItem.create({item_code:"01015", name: "Sliced Pork Belly", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0222", menu_item: menu_category1_menu_item14, price:4000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0222", menu_item: menu_category1_menu_item14, price:4000.00, is_on_promotion:false}])
@@ -207,7 +207,7 @@ menu_category7 = MenuCategory.create({menu: menu, code:"C007", name: "Specialty
# Seafood # Seafood
menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", alt_name: "Seafood", order_by: 8,created_by: "SYSTEM DEFAULT"}) menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", alt_name: "Seafood", order_by: 8,created_by: "SYSTEM DEFAULT"})
# Promfret # Promfret
menu_category1_menu_item41 = SimpleMenuItem.create({item_code:"01042", name: "Promfret", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item41 = SimpleMenuItem.create({item_code:"01042", name: "Pomfret", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0492", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0492", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0491", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0491", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}])
# Garoupa # Garoupa
@@ -280,13 +280,13 @@ menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood",
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0661", menu_item: menu_category1_menu_item59, price:10.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0661", menu_item: menu_category1_menu_item59, price:10.00, is_on_promotion:false}])
# Fresh Flower Crabs # Fresh Flower Crabs
menu_category1_menu_item60 = SimpleMenuItem.create({item_code:"01061", name: "Fresh Flower Crabs", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item60 = SimpleMenuItem.create({item_code:"01061", name: "Fresh Flower Crabs", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0671", menu_item: menu_category1_menu_item60, price:10.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0671", menu_item: menu_category1_menu_item60, price:60.00, is_on_promotion:false}])
# Live Lobster # Live Lobster
menu_category1_menu_item61 = SimpleMenuItem.create({item_code:"01062", name: "Live Lobster", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item61 = SimpleMenuItem.create({item_code:"01062", name: "Live Lobster", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0681", menu_item: menu_category1_menu_item61, price:10.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0681", menu_item: menu_category1_menu_item61, price:150.00, is_on_promotion:false}])
# Live Mantis # Live Mantis
menu_category1_menu_item62 = SimpleMenuItem.create({item_code:"01063", name: "Live Mantis Prawn", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item62 = SimpleMenuItem.create({item_code:"01063", name: "Live Mantis Prawn", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:" ",item_instance_code:"II0691", menu_item: menu_category1_menu_item62, price:10.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:" ",item_instance_code:"II0691", menu_item: menu_category1_menu_item62, price:150.00, is_on_promotion:false}])
# Dumpling # Dumpling
menu_category9 = MenuCategory.create({menu: menu, code:"C009", name: "Dumpling", alt_name: "Chicken", order_by: 9, created_by: "SYSTEM DEFAULT"}) menu_category9 = MenuCategory.create({menu: menu, code:"C009", name: "Dumpling", alt_name: "Chicken", order_by: 9, created_by: "SYSTEM DEFAULT"})
# Pork and Chives Dumpling # Pork and Chives Dumpling
@@ -475,7 +475,7 @@ menu_category14 = MenuCategory.create({menu: menu, code:"C0013", name: "Others",
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1142", menu_item: menu_category1_menu_item106, price:1500.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1142", menu_item: menu_category1_menu_item106, price:1500.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1141", menu_item: menu_category1_menu_item106, price:3000.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1141", menu_item: menu_category1_menu_item106, price:3000.00, is_on_promotion:false}])
# Sliced Kelp # Sliced Kelp
menu_category1_menu_item107 = SimpleMenuItem.create({item_code:"01108", name: "Sliced Kelp", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_category1_menu_item107 = SimpleMenuItem.create({item_code:"01108", name: "Shredded Kelp", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food })
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1152", menu_item: menu_category1_menu_item107, price:1800.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1152", menu_item: menu_category1_menu_item107, price:1800.00, is_on_promotion:false}])
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1151", menu_item: menu_category1_menu_item107, price:3600.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1151", menu_item: menu_category1_menu_item107, price:3600.00, is_on_promotion:false}])
# Crystal Vermicelli # Crystal Vermicelli