merge with crm
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -144,4 +144,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
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, "Re-print")
|
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
|
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
|
||||||
|
|||||||
@@ -23,6 +23,26 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
@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]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
puts current_user.id
|
|
||||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -15,8 +14,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 +27,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
|
|
||||||
|
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
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -444,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")
|
||||||
@@ -451,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,
|
||||||
@@ -464,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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ class ShiftSale < ApplicationRecord
|
|||||||
#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
|
||||||
|
|||||||
176
app/pdf/close_cashier_pdf.rb
Normal file
176
app/pdf/close_cashier_pdf.rb
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
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";
|
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
|
|||||||
@@ -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();
|
||||||
|
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";
|
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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 %>';
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -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();
|
||||||
|
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";
|
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');
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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 %>';
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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'
|
||||||
@@ -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'
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -93,9 +93,9 @@ menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mut
|
|||||||
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user