Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -13,12 +13,12 @@
|
|||||||
|
|
||||||
.selected-item {
|
.selected-item {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: #ccc !important;
|
background-color: #54A5AF !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assign {
|
.assign {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: red;
|
background-color: #009900;
|
||||||
}
|
}
|
||||||
.assign .text-muted{
|
.assign .text-muted{
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
.green{
|
.green{
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: green;
|
background-color: #009900;
|
||||||
}
|
}
|
||||||
.required abbr{
|
.required abbr{
|
||||||
color: red !important;
|
color: red !important;
|
||||||
@@ -37,3 +37,11 @@
|
|||||||
.jconfirm-box-container{
|
.jconfirm-box-container{
|
||||||
margin-left:-40px !important
|
margin-left:-40px !important
|
||||||
}
|
}
|
||||||
|
.card-columns {
|
||||||
|
@include media-breakpoint-only(lg) {
|
||||||
|
column-count: 6;
|
||||||
|
}
|
||||||
|
@include media-breakpoint-only(xl) {
|
||||||
|
column-count: 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
// Place all the styles related to the reports/dailysales controller here.
|
// Place all the styles related to the reports/dailysale controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
// Place all the styles related to the reports/sale_items controller here.
|
// Place all the styles related to the reports/saleitem controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -29,7 +29,6 @@ class Api::BillController < Api::ApiController
|
|||||||
# @sale_data = Sale.find_by_sale_id(@sale_id)
|
# @sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
# @sale_items = SaleItem.where("sale_id=?",@sale_id)
|
# @sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
|
||||||
|
|
||||||
# unique_code = "ReceiptBillPdf"
|
# unique_code = "ReceiptBillPdf"
|
||||||
# #shop detail
|
# #shop detail
|
||||||
# shop_details = Shop.find(1)
|
# shop_details = Shop.find(1)
|
||||||
|
|||||||
@@ -14,5 +14,4 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_item(oqs, assigned_item.order_id, assigned_item.item_code, print_status, options )
|
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, assigned_item.item_code, print_status, options )
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
@@ -46,7 +46,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_booking_summary(oqs, booking.booking_id, print_status)
|
order_queue_printer.print_booking_summary(print_settings,oqs, booking.booking_id, print_status)
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ class PrintSettingsController < 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 print_setting_params
|
def print_setting_params
|
||||||
params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies)
|
params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
class Reports::SaleItemsController < BaseReportController
|
|
||||||
authorize_resource :class => false
|
|
||||||
def index
|
|
||||||
|
|
||||||
from, to, report_type = get_date_range_from_params
|
|
||||||
|
|
||||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.xls
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
class Reports::DailySalesController < BaseReportController
|
|
||||||
# authorize_resource :class => false
|
|
||||||
def index
|
|
||||||
from, to ,report_type = get_date_range_from_params
|
|
||||||
@sale_data = Sale.daily_sales_list(from,to)
|
|
||||||
@tax = SaleTax.get_tax(from,to)
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.xls
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
class Reports::DailySalesController < BaseReportController
|
class Reports::DailysaleController < BaseReportController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def index
|
def index
|
||||||
from, to ,report_type = get_date_range_from_params
|
from, to ,report_type = get_date_range_from_params
|
||||||
@sale_data = Sale.daily_sales_list(from,to)
|
@sale_data = Sale.daily_sales_list(from,to)
|
||||||
@@ -13,5 +14,4 @@ class Reports::DailySalesController < BaseReportController
|
|||||||
def show
|
def show
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Reports::ReceiptNoController < BaseReportController
|
class Reports::ReceiptNoController < BaseReportController
|
||||||
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
puts "from..."
|
puts "from..."
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Reports::SaleItemsController < BaseReportController
|
class Reports::SaleitemController < BaseReportController
|
||||||
# authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
|
|
||||||
from, to, report_type = get_date_range_from_params
|
from, to, report_type = get_date_range_from_params
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
module Origami::RequestBillsHelper
|
module Origami::RequestBillsHelper
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
2
app/helpers/reports/dailysale_helper.rb
Normal file
2
app/helpers/reports/dailysale_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Reports::DailysaleHelper
|
||||||
|
end
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
module Reports::DailysalesHelper
|
|
||||||
end
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
module Reports::SaleItemsHelper
|
|
||||||
end
|
|
||||||
2
app/helpers/reports/saleitem_helper.rb
Normal file
2
app/helpers/reports/saleitem_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Reports::SaleitemHelper
|
||||||
|
end
|
||||||
@@ -31,9 +31,11 @@ class Ability
|
|||||||
can :manage, Sale
|
can :manage, Sale
|
||||||
|
|
||||||
can :manage, Customer
|
can :manage, Customer
|
||||||
|
can :manage, DiningQueue
|
||||||
|
|
||||||
can :index, :dailysale
|
can :index, :dailysale
|
||||||
can :index, :saleitem
|
can :index, :saleitem
|
||||||
|
can :index, :receipt_no
|
||||||
|
|
||||||
can :add_customer, Customer
|
can :add_customer, Customer
|
||||||
can :update_sale_by_customer, Customer
|
can :update_sale_by_customer, Customer
|
||||||
@@ -80,12 +82,17 @@ class Ability
|
|||||||
elsif user.role == "accountant"
|
elsif user.role == "accountant"
|
||||||
|
|
||||||
can :index, :dailysale
|
can :index, :dailysale
|
||||||
can :index, :saleitem
|
can :manage, :saleitem
|
||||||
|
can :index, :receiptno
|
||||||
|
|
||||||
|
elsif user.role == "supervisour"
|
||||||
|
|
||||||
|
can :index, :dailysale
|
||||||
|
can :manage, :saleitem
|
||||||
can :index, :receiptno
|
can :index, :receiptno
|
||||||
can :show, :dailysale
|
|
||||||
can :show, :saleitem
|
|
||||||
can :show, :receiptno
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("(orders.status = 'new' or orders.status = 'billed')")
|
.where("(orders.status = 'new' or orders.status = 'billed') AND orders.date between #{ from } and #{ to }")
|
||||||
|
|
||||||
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
||||||
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||||
|
|
||||||
def print_order_item(oqs,order_id, item_code, print_status, options="")
|
def print_order_item(print_settings,oqs,order_id, item_code, print_status, options="")
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
@@ -10,7 +10,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
if order_item[0].price != 0
|
if order_item[0].price != 0
|
||||||
pdf = OrderItemPdf.new(order_item[0], print_status, options)
|
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
|
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -26,11 +26,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Query for per order
|
# Query for per order
|
||||||
def print_order_summary(oqs, order_id, order_items, print_status)
|
def print_order_summary(print_settings,oqs, order_id, order_items, print_status)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
order=print_query('order_summary', order_id)
|
order=print_query('order_summary', order_id)
|
||||||
|
|
||||||
# For Print Per Item
|
# For Print Per Item
|
||||||
if oqs.cut_per_item
|
if oqs.cut_per_item
|
||||||
order.each do|odi|
|
order.each do|odi|
|
||||||
@@ -40,7 +41,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
if odi.price != 0
|
if odi.price != 0
|
||||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name)
|
||||||
# pdf.render_file "tmp/order_item.pdf"
|
# pdf.render_file "tmp/order_item.pdf"
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -54,7 +55,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# For Print Order Summary
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
|
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(order, print_status, order_items)
|
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
self.print(filename, oqs.printer_name)
|
self.print(filename, oqs.printer_name)
|
||||||
@@ -69,7 +70,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Print for orders in booking
|
# Print for orders in booking
|
||||||
def print_booking_summary(oqs, booking_id, print_status)
|
def print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||||
order=print_query('booking_summary', booking_id)
|
order=print_query('booking_summary', booking_id)
|
||||||
# For Print Per Item
|
# For Print Per Item
|
||||||
if oqs.cut_per_item
|
if oqs.cut_per_item
|
||||||
@@ -80,7 +81,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
if odi.price != 0
|
if odi.price != 0
|
||||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
|
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -97,7 +98,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# For Print Order Summary
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
|
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(order, print_status)
|
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
self.print(filename, oqs.printer_name)
|
self.print(filename, oqs.printer_name)
|
||||||
@@ -114,31 +115,34 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def print_query(type, id)
|
def print_query(type, id)
|
||||||
if type == "order_item"
|
if type == "order_item"
|
||||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||||
|
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||||
.where("order_items.item_code = '#{ id }' AND order_items.price != 0")
|
.where("order_items.item_code = '#{ id }' AND order_items.price != 0")
|
||||||
.group("order_items.item_code")
|
.group("order_items.item_code")
|
||||||
elsif type == "order_summary"
|
elsif type == "order_summary"
|
||||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||||
|
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||||
.where("orders.order_id = '#{ id }' AND order_items.price != 0")
|
.where("orders.order_id = '#{ id }' AND order_items.price != 0")
|
||||||
.group("order_items.order_items_id")
|
.group("order_items.order_items_id")
|
||||||
else
|
else
|
||||||
# order summary for booking
|
# order summary for booking
|
||||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||||
|
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||||
.where("b.booking_id = '#{ id }' AND order_items.price != 0")
|
.where("b.booking_id = '#{ id }' AND order_items.price != 0")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ShiftSale < ApplicationRecord
|
|||||||
#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")
|
||||||
puts today_date
|
puts today_date
|
||||||
shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? 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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class OrderItemPdf < Prawn::Document
|
class OrderItemPdf < 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
|
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(order_item, print_status, options)
|
def initialize(print_settings,order_item, print_status, options, alt_name)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -12,12 +12,13 @@ class OrderItemPdf < Prawn::Document
|
|||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=100
|
self.label_width=100
|
||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
|
#font "public/fonts/Chinese.ttf"
|
||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||||
|
|
||||||
# order items
|
# order items
|
||||||
order_items(order_item, options)
|
order_items(order_item, options, alt_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
@@ -57,11 +58,11 @@ class OrderItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_items(order_item, options)
|
def order_items(order_item, options, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
add_order_items(order_item, options)
|
add_order_items(order_item, options, alt_name)
|
||||||
|
|
||||||
dash(1, :space => 1, :phase => 1)
|
dash(1, :space => 1, :phase => 1)
|
||||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
@@ -69,19 +70,31 @@ class OrderItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Add order items under order info
|
# Add order items under order info
|
||||||
def add_order_items(order_item, options)
|
def add_order_items(order_item, options, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
|
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if alt_name
|
||||||
|
move_down 4
|
||||||
|
font("public/fonts/Chinese.ttf") do
|
||||||
|
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class OrderSummaryPdf < Prawn::Document
|
class OrderSummaryPdf < 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
|
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(order, print_status, order_items = nil)
|
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -12,11 +12,11 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=100
|
self.label_width=100
|
||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_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/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
@@ -29,9 +29,9 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
|
|
||||||
# order items
|
# order items
|
||||||
if order_items == nil
|
if order_items == nil
|
||||||
order_items(order)
|
order_items(order, alt_name)
|
||||||
else
|
else
|
||||||
order_items(order_items)
|
order_items(order_items, alt_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_items(order_item)
|
def order_items(order_item, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
@@ -75,12 +75,12 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
add_order_items(order_item)
|
add_order_items(order_item, alt_name)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add order items under order info
|
# Add order items under order info
|
||||||
def add_order_items(order_item)
|
def add_order_items(order_item, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -92,12 +92,26 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if alt_name
|
||||||
|
move_down 4
|
||||||
|
font("public/fonts/Chinese.ttf") do
|
||||||
|
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
class ReceiptBillPdf < Prawn::Document
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
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)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
@@ -16,7 +17,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# @double = @qty_width * 1.3
|
# @double = @qty_width * 1.3
|
||||||
# @half_qty = @qty_width / 2
|
# @half_qty = @qty_width / 2
|
||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
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/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
@@ -24,26 +25,33 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 8
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
if printer_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
|
||||||
header( shop_details)
|
header( shop_details)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
cashier_info(sale_data, customer_name)
|
cashier_info(sale_data, customer_name)
|
||||||
line_items(sale_items)
|
line_items(sale_items,printer_settings.precision,delimiter)
|
||||||
all_total(sale_data)
|
all_total(sale_data,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
if member_info != nil
|
if member_info != nil
|
||||||
member_info(member_info,customer_name,rebate_amount,sale_data)
|
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
customer(customer_name)
|
customer(customer_name)
|
||||||
|
|
||||||
if discount_price_by_accounts.length > 0
|
if discount_price_by_accounts.length > 0
|
||||||
discount_account(discount_price_by_accounts)
|
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
items_account(item_price_by_accounts)
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
footer
|
footer
|
||||||
end
|
end
|
||||||
@@ -87,7 +95,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
||||||
text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -101,7 +109,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def line_items(sale_items)
|
def line_items(sale_items,precision,delimiter)
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -114,10 +122,10 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
}
|
}
|
||||||
move_down -5
|
move_down -5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
add_line_item_row(sale_items)
|
add_line_item_row(sale_items,precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items)
|
def add_line_item_row(sale_items,precision,delimiter)
|
||||||
item_name_width = (self.item_width+self.price_width)
|
item_name_width = (self.item_width+self.price_width)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -136,9 +144,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "#{total_price}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down 1
|
move_down 1
|
||||||
end
|
end
|
||||||
@@ -152,12 +160,12 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
text "Sub Total", :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 "#{ sub_total }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_total(sale_data)
|
def all_total(sale_data,precision,delimiter)
|
||||||
item_name_width = self.item_width
|
item_name_width = self.item_width
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
@@ -165,7 +173,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Overall Discount", :size => self.item_font_size,:align => :left
|
text "Overall Discount", :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 "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
if sale_data.sale_taxes.length > 0
|
if sale_data.sale_taxes.length > 0
|
||||||
@@ -177,7 +185,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
|
text "#{ st.tax_name }", :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 "#{ st.tax_payable_amount }" , :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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -198,18 +206,18 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
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 "Grand Total", :size => self.header_font_size,:align => :left
|
text "Grand Total",:style => :bold, :size => self.header_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 "#{sale_data.grand_total}" , :size => self.header_font_size,:align => :right
|
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
sale_payment(sale_data)
|
sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_payment(sale_data)
|
def sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -220,7 +228,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
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
|
||||||
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 "#{ payment.payment_amount }" , :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
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
@@ -231,7 +239,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
text "Change 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 "#{sale_data.amount_changed}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
@@ -239,7 +247,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# show member information
|
# show member information
|
||||||
def member_info(member_info,customer_name,rebate_amount,sale_data)
|
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
|
||||||
|
|
||||||
if rebate_amount != nil
|
if rebate_amount != nil
|
||||||
|
|
||||||
@@ -255,7 +263,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Current Rebate Amount", :size => self.item_font_size,:align => :left
|
text "Current Rebate 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 "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||||
@@ -266,15 +274,15 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Current Redeem Amount", :size => self.item_font_size,:align => :left
|
text "Current 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 "(#{ res["redeem"] })" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(res["redeem"], :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if member_info["status"] == true
|
if member_info["status"] == true && member_info["data"].present?
|
||||||
balance = 0.0
|
balance = 0
|
||||||
member_info["data"].each do |res|
|
member_info["data"].each do |res|
|
||||||
|
|
||||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||||
@@ -289,7 +297,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
text "Current 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 "#{ balance }" , :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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -305,8 +313,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def discount_account(discount_price_by_accounts,precision,delimiter)
|
||||||
def discount_account(discount_price_by_accounts)
|
|
||||||
move_down 5
|
move_down 5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -317,12 +324,12 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :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 "(" + "#{ ipa[:price] }" + ")" , :size => self.item_font_size,:align => :right
|
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def items_account(item_price_by_accounts)
|
def items_account(item_price_by_accounts,precision,delimiter)
|
||||||
move_down 5
|
move_down 5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -333,7 +340,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
text "#{ ipa[:name] }", :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 "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @i =0 %>
|
<% @i =0 %>
|
||||||
<% @dining_queues.each do |queue| %>
|
<% @dining_queues.each do |queue| %>
|
||||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>">
|
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>" style="width: 17.5rem;">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<p class="hidden queue-id"><%= queue.id %></p>
|
<p class="hidden queue-id"><%= queue.id %></p>
|
||||||
<p class="hidden queue-status"><%= queue.status %></p>
|
<p class="hidden queue-status"><%= queue.status %></p>
|
||||||
|
|||||||
@@ -33,14 +33,14 @@
|
|||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Orders ", transactions_orders_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Orders ", transactions_orders_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Sales ", transactions_sales_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales ", transactions_sales_path, :tabindex =>"-1" %></li>
|
||||||
<!-- <li><%= link_to "Sales ", transactions_credit_notes_path, :tabindex =>"-1" %></li> -->
|
<li><%= link_to "Credit Note ", transactions_credit_notes_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="navbar-nav mr-auto dropdown">
|
<li class="navbar-nav mr-auto dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Daily Sale Report", reports_daily_sales_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Daily Sale Report", reports_dailysale_index_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Sales Item Report", reports_sale_items_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -228,6 +228,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"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%= @obj_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"><%= @obj_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"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
||||||
@@ -411,6 +415,7 @@ $(document).ready(function(){
|
|||||||
$("#first_bill").on('click', function(){
|
$("#first_bill").on('click', function(){
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
|
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
</span></p>
|
</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
<p>Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-title row customer_detail hide">
|
<div class="card-title row customer_detail hide">
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
<%= f.input :page_width %>
|
<%= f.input :page_width %>
|
||||||
<%= f.input :page_height %>
|
<%= f.input :page_height %>
|
||||||
<%= f.input :print_copies %>
|
<%= f.input :print_copies %>
|
||||||
|
<%= f.input :precision %>
|
||||||
|
<%= f.input :delimiter %>
|
||||||
|
<%= f.input :heading_space %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
<th>Page width</th>
|
<th>Page width</th>
|
||||||
<th>Page height</th>
|
<th>Page height</th>
|
||||||
<th>Print copies</th>
|
<th>Print copies</th>
|
||||||
|
<th>Precision</th>
|
||||||
|
<th>Delimiter</th>
|
||||||
|
<th>Heading_space</th>
|
||||||
<th colspan="3"></th>
|
<th colspan="3"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -45,6 +48,9 @@
|
|||||||
<td><%= print_setting.page_width %></td>
|
<td><%= print_setting.page_width %></td>
|
||||||
<td><%= print_setting.page_height %></td>
|
<td><%= print_setting.page_height %></td>
|
||||||
<td><%= print_setting.print_copies %></td>
|
<td><%= print_setting.print_copies %></td>
|
||||||
|
<td><%= print_setting.precision %></td>
|
||||||
|
<td><%= print_setting.delimiter %></td>
|
||||||
|
<td><%= print_setting.heading_space %></td>
|
||||||
<td><%= link_to 'Show', print_setting %></td>
|
<td><%= link_to 'Show', print_setting %></td>
|
||||||
<td><%= link_to 'Edit', edit_print_setting_path(print_setting) %></td>
|
<td><%= link_to 'Edit', edit_print_setting_path(print_setting) %></td>
|
||||||
<td><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
|
||||||
<!-- <div class="form-group col-md-2">
|
|
||||||
<label>Select Type</label>
|
|
||||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
|
||||||
<option value="0">All Sale Type</option>
|
|
||||||
<option value="1">Revenue Only</option>
|
|
||||||
<option value="2">Discount Only</option>
|
|
||||||
<option value="3">Void Only</option>
|
|
||||||
<option value="4">Taxes Only</option>
|
|
||||||
<option value="5">Other Amount Only</option>
|
|
||||||
</select>
|
|
||||||
</div> -->
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<% if defined? show_monthly %>
|
|
||||||
<div class="span3" style="margin-bottom:10px;">
|
|
||||||
<input type="hidden" id="report_type" name="report_type" value="0">
|
|
||||||
<div class="btn-group" data-toggle="buttons-radio">
|
|
||||||
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
|
||||||
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group">
|
|
||||||
<% if defined? promotions %>
|
|
||||||
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? menu_types %>
|
|
||||||
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? payments %>
|
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? shift_name %>
|
|
||||||
<!-- Temporary no needs
|
|
||||||
<select name="shift_name" id="shift_name"></select>
|
|
||||||
-->
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? cashiers %>
|
|
||||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? singer %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? bsm %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? guest_role %>
|
|
||||||
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
|
||||||
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? products %>
|
|
||||||
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? items %>
|
|
||||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class = "row">
|
|
||||||
|
|
||||||
<div class = "span3">
|
|
||||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
<select name="shift" id="shift">
|
|
||||||
<option value="">All Shift</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$('#custom_excel').hide();
|
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
|
||||||
var url = $('#custom_excel').attr('data-url');
|
|
||||||
$('#frm_report').attr('action',url)
|
|
||||||
$('#frm_report').submit();
|
|
||||||
// window.location = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
<div class="card row">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<% if params[:from]%>
|
|
||||||
<tr>
|
|
||||||
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<th style='text-align:center;'>Sr.no</th>
|
|
||||||
<th style='text-align:center;'>Date</th>
|
|
||||||
<th style='text-align:center;'>Void Amount</th>
|
|
||||||
<th style='text-align:center;'>Mpu Sales</th>
|
|
||||||
<th style='text-align:center;'>Master Sales</th>
|
|
||||||
<th style='text-align:center;'>Visa Sales</th>
|
|
||||||
<th style='text-align:center;'>Jcb Sales</th>
|
|
||||||
<th style='text-align:center;'>Paypar Sales</th>
|
|
||||||
<th style='text-align:center;'>Cash Sales</th>
|
|
||||||
<th style='text-align:center;'>Credit Sales</th>
|
|
||||||
<th style='text-align:center;'>FOC Sales</th>
|
|
||||||
<th style='text-align:center;'>(Discount)</th>
|
|
||||||
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
|
||||||
<th style='text-align:center;'>Rounding Adj.</th>
|
|
||||||
<th style='text-align:center;'>Grand Total</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<% unless @sale_data.empty? %>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% void = 0 %>
|
|
||||||
<% mpu = 0 %>
|
|
||||||
<% master = 0 %>
|
|
||||||
<% visa = 0 %>
|
|
||||||
<% jcb = 0 %>
|
|
||||||
<% paypar = 0 %>
|
|
||||||
<% cash = 0 %>
|
|
||||||
<% credit = 0 %>
|
|
||||||
<% foc = 0 %>
|
|
||||||
<% discount = 0 %>
|
|
||||||
<% total = 0 %>
|
|
||||||
<% grand_total = 0 %>
|
|
||||||
<% count = 1 %> <% rounding_adj = 0 %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% void += sale[:void_amount] %>
|
|
||||||
<% mpu += sale[:mpu_amount] %>
|
|
||||||
<% master += sale[:master_amount] %>
|
|
||||||
<% visa += sale[:visa_amount] %>
|
|
||||||
<% jcb += sale[:jcb_amount] %>
|
|
||||||
<% paypar += sale[:paypar_amount] %>
|
|
||||||
<% cash += sale[:cash_amount] %>
|
|
||||||
<% credit += sale[:credit_amount] %>
|
|
||||||
<% foc += sale[:foc_amount] %>
|
|
||||||
<% discount += sale[:total_discount] %>
|
|
||||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
|
||||||
<% grand_total += sale[:grand_total].to_f %>
|
|
||||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
|
||||||
<tr>
|
|
||||||
<td style='text-align:right;'><%= count %></td>
|
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<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[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% total_tax = 0 %>
|
|
||||||
<% unless @tax.empty? %>
|
|
||||||
<% @tax.each do |tax| %>
|
|
||||||
<% total_tax += tax.tax_amount.to_f %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<% net = total - total_tax %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -117,23 +117,6 @@
|
|||||||
</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();
|
||||||
@@ -145,7 +128,68 @@ $(function(){
|
|||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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>
|
||||||
@@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %>
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<a href="javascript:export_to('<%=reports_daily_sales_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_dailysale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,135 +1,43 @@
|
|||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
||||||
<% unless @sale_data.empty? %>
|
<table class="table table-striped">
|
||||||
<h3 align="center"><%=current_active_location.name%></h3>
|
<thead>
|
||||||
<h3 align="center">Sales Summary Report (BreadTalk)</h3>
|
<tr>
|
||||||
<% if params[:from]%>
|
<th style='text-align:center;'>Date</th>
|
||||||
<h4>From Date : <%= params[:from] %> , To Date : <%= params[:to] %></h4>
|
<th style='text-align:center;'>Receipt No</th>
|
||||||
<% end %>
|
<th style='text-align:center;'>Cashier Name</th>
|
||||||
<table class="table table-bordered" border="1">
|
<th style='text-align:center;'>Gross Sales</th>
|
||||||
<thead>
|
<th style='text-align:center;'>Discount</th>
|
||||||
<tr>
|
<th style='text-align:center;'>Total Sales</th>
|
||||||
<!-- <th style='text-align:center;'>Sr.no</th> -->
|
<% TaxProfile.all.each do |r|%>
|
||||||
<th style='text-align:center;'>Location Name</th>
|
<th style='text-align:center;'><%=r.name%></th>
|
||||||
<th style='text-align:center;'>Date</th>
|
<% end %>
|
||||||
<th style='text-align:center;'>Cash Sales</th>
|
<th style='text-align:center;'>Nett Sales</th>
|
||||||
<th style='text-align:center;'>Credit Sales</th>
|
</tr>
|
||||||
<th style='text-align:center;'>Credit Received</th>
|
</thead>
|
||||||
<!-- <th style='text-align:center;'>Other Payment</th> -->
|
|
||||||
<th style='text-align:center;'>Card Payment</th>
|
|
||||||
<th style='text-align:center;'>Total Discount</th>
|
|
||||||
<th style='text-align:center;'>Total Taxes</th>
|
|
||||||
<th style='text-align:center;'>Total Other Charges</th>
|
|
||||||
<th style='text-align:center;'>FOC Sales</th>
|
|
||||||
<th style='text-align:center;'>Void Sales</th>
|
|
||||||
<th style='text-align:center;'>Grand Total</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% void = 0 %>
|
|
||||||
<% card = 0 %>
|
|
||||||
<% credit_payment = 0 %>
|
|
||||||
<% cash = 0 %>
|
|
||||||
<% credit = 0 %>
|
|
||||||
<% foc = 0 %>
|
|
||||||
<% discount = 0 %>
|
|
||||||
<% total = 0 %>
|
|
||||||
<% count = 1 %>
|
|
||||||
<% discount_rev = 0 %>
|
|
||||||
<% total_rev = 0 %>
|
|
||||||
<% grand_rev = 0 %>
|
|
||||||
<% total_other_charges=0 %>
|
|
||||||
<% total_tax=0 %>
|
|
||||||
<% cash_received = 0 %>
|
|
||||||
<% total_cash_received = 0 %>
|
|
||||||
<% today_credit_payment_amount = 0 %>
|
|
||||||
<% old_location_id = 0%>
|
|
||||||
<% sub_total = 0 %>
|
|
||||||
<% count_of_void = 0 %>
|
|
||||||
<% flag = false %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% credit_payment += sale[:credit_payment].to_f %>
|
|
||||||
<% card += sale[:card_amount].to_f %>
|
|
||||||
<% cash += sale[:cash_amount].to_f %>
|
|
||||||
<% credit += sale[:credit_amount].to_f %>
|
|
||||||
<% foc += sale[:foc_amount].to_f %>
|
|
||||||
<% discount += sale[:total_discount].to_f %>
|
|
||||||
<% total += sale[:grand_total].to_f %>
|
|
||||||
<% total_other_charges +=sale[:other_charges].to_f %>
|
|
||||||
<% total_tax +=sale[:total_tax].to_f %>
|
|
||||||
|
|
||||||
<% cash_received = sale[:cash_amount].to_f + sale[:credit_payment].to_f%>
|
<tbody>
|
||||||
<% total_cash_received = cash.to_f + credit_payment.to_f%>
|
<% total_sales = 0 %>
|
||||||
<% today_credit_payment_amount += sale[:today_credit_payment].to_f %>
|
<% net_sales = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
||||||
|
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||||
|
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||||
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||||
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||||
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||||
|
<% sale.sale_taxes.each do |sale|%>
|
||||||
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<tr>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||||
<!-- <td style='text-align:right;'><%= count %></td> -->
|
</tr>
|
||||||
|
<% end %>
|
||||||
<td style='text-align:right;'><%= sale[:location].to_s rescue '-' %></td>
|
</tbody>
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
</table>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %></td>
|
|
||||||
<% total_void_amount = 0 %>
|
|
||||||
<% if !@daily_void.nil? %>
|
|
||||||
<% @daily_void.each do |d_v|%>
|
|
||||||
|
|
||||||
<% if d_v[:daily_void_amt].to_i > 0 %>
|
|
||||||
<% if d_v[:location_id] == sale[:location_id] %>
|
|
||||||
<% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%>
|
|
||||||
<%count_of_void+=1%>
|
|
||||||
|
|
||||||
<%total_void_amount += d_v[:daily_void_amt].to_f%>
|
|
||||||
<% flag = true %>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<%end %>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
<% if flag == true%>
|
|
||||||
<% void += total_void_amount.to_f %>
|
|
||||||
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %></td>
|
|
||||||
<% flag = false %>
|
|
||||||
<% end%>
|
|
||||||
<%if count_of_void == 0%>
|
|
||||||
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %></td>
|
|
||||||
<%end %>
|
|
||||||
<td style='text-align:right;'>
|
|
||||||
<%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<%count_of_void= 0%>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="2" style='text-align:center;'>Grand Total</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %></td>
|
|
||||||
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %></td>
|
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %></td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="span12">
|
|
||||||
<% unless @sale_data.blank? %>
|
|
||||||
|
|
||||||
<table class="table table-striped" id="items_table" border="0">
|
|
||||||
<thead>
|
|
||||||
|
|
||||||
<% if !params[:from].blank?%>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7">From Date : <%= params[:from] %> , To Date : <%= params[:to] %></th>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
<% if @shift_from %>
|
|
||||||
<tr>
|
|
||||||
<% if @shift_data.employee %>
|
|
||||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
|
||||||
<% end %>
|
|
||||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<th> </th>
|
|
||||||
<th>Menu Category</th>
|
|
||||||
<th>Code</th>
|
|
||||||
<th>Product</th>
|
|
||||||
<th>Total Item</th>
|
|
||||||
<th>Unit Price</th>
|
|
||||||
<th>Revenue</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<% acc_arr = Array.new %>
|
|
||||||
<% cate_arr = Array.new %>
|
|
||||||
|
|
||||||
<% sub_total = 0.0 %>
|
|
||||||
<% count = 0%>
|
|
||||||
<% total_price = 0.0 %>
|
|
||||||
<% cate_count = 0 %>
|
|
||||||
<% acc_count = 0%>
|
|
||||||
<% grand_total = 0%>
|
|
||||||
<% total_discount = 0.0 %>
|
|
||||||
|
|
||||||
<% @sale_data.order("total_item desc").each do |sale| %>
|
|
||||||
|
|
||||||
<% if !acc_arr.include?(sale.account_id) %>
|
|
||||||
<tr>
|
|
||||||
<td><b><%= sale.account_name %></b></td>
|
|
||||||
<td colspan="4"> </td>
|
|
||||||
<td>Total Price By <%= sale.account_name %></td>
|
|
||||||
<td>
|
|
||||||
<% @totalByAccount.each do |account, total| %>
|
|
||||||
<% if sale.account_id == account %>
|
|
||||||
<b><%= total %></b>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% acc_arr.push(sale.account_id) %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<td> </td>
|
|
||||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
|
||||||
<td><%= sale.menu_category_name %></td>
|
|
||||||
<% cate_arr.push(sale.menu_category_id) %>
|
|
||||||
<% else %>
|
|
||||||
<td> </td>
|
|
||||||
<% end %>
|
|
||||||
<td><%= sale.code rescue '-' %></td>
|
|
||||||
<% if @item_table == 'sale' %>
|
|
||||||
<% if sale.item_remark == 'FOC' %>
|
|
||||||
<td><%= '[PROMO] '.to_s + sale.product_name.to_s rescue '-' %></td>
|
|
||||||
<% elsif sale.item_remark == 'FOC ITEM' %>
|
|
||||||
<td><%= '[DIS:QTY] '.to_s + sale.product_name.to_s rescue '-' %></td>
|
|
||||||
<% elsif sale.item_remark == 'DISCOUNT' %>
|
|
||||||
<td><%= '[DIS:TP] '.to_s + sale.product_name.to_s rescue '-' %></td>
|
|
||||||
<% else %>
|
|
||||||
<td><%= sale.product_name.to_s rescue '-' %></td>
|
|
||||||
<% end %>
|
|
||||||
<% if sale.item_remark == 'DISCOUNT' %>
|
|
||||||
<td> - </td>
|
|
||||||
<td> - </td>
|
|
||||||
<td><%= sale.total_price.abs rescue '-' %></td>
|
|
||||||
<% total_price += sale.total_price %>
|
|
||||||
<% else %>
|
|
||||||
<td><%= sale.total_item.abs rescue '-' %></td>
|
|
||||||
<td><%= sale.unit_price rescue '-' %></td>
|
|
||||||
<td><%= sale.grand_total.abs rescue '-' %></td>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<td><%= sale.product_name.to_s rescue '-' %></td>
|
|
||||||
<td><%= sale.total_item.abs rescue '-' %></td>
|
|
||||||
<td><%= sale.unit_price rescue '-' %></td>
|
|
||||||
<td><%= sale.grand_total.abs rescue '-' %></td>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<!-- sub total -->
|
|
||||||
<% @menu_cate_count.each do |key,value| %>
|
|
||||||
<% if sale.menu_category_id == key %>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% sub_total += sale.grand_total %>
|
|
||||||
<% if count == value %>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Sub Total</td>
|
|
||||||
<td ><span class="underline"><%= sub_total + total_price %></span></td>
|
|
||||||
</tr>
|
|
||||||
<% sub_total = 0.0%>
|
|
||||||
<% total_discount = total_discount + total_price %>
|
|
||||||
<% total_price = 0.0%>
|
|
||||||
<% count = 0%>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<!-- end sub total -->
|
|
||||||
<% grand_total += sale.grand_total%>
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Grand Total</td>
|
|
||||||
<td><span class="double_underline"><%= grand_total + total_discount %></span></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="report_type" value="sale_item" id="sel_sale_type">
|
|
||||||
<!-- <div class="form-group col-md-2">
|
|
||||||
<label>Select Type</label>
|
|
||||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
|
||||||
<option value="0">All Sale Type</option>
|
|
||||||
<option value="1">Revenue Only</option>
|
|
||||||
<option value="2">Discount Only</option>
|
|
||||||
<option value="3">Void Only</option>
|
|
||||||
<option value="4">Taxes Only</option>
|
|
||||||
<option value="5">Other Amount Only</option>
|
|
||||||
</select>
|
|
||||||
</div> -->
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<% if defined? show_monthly %>
|
|
||||||
<div class="span3" style="margin-bottom:10px;">
|
|
||||||
<input type="hidden" id="report_type" name="report_type" value="0">
|
|
||||||
<div class="btn-group" data-toggle="buttons-radio">
|
|
||||||
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
|
||||||
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group">
|
|
||||||
<% if defined? promotions %>
|
|
||||||
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? menu_types %>
|
|
||||||
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? payments %>
|
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? shift_name %>
|
|
||||||
<!-- Temporary no needs
|
|
||||||
<select name="shift_name" id="shift_name"></select>
|
|
||||||
-->
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? cashiers %>
|
|
||||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? singer %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? bsm %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? guest_role %>
|
|
||||||
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
|
||||||
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? products %>
|
|
||||||
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? items %>
|
|
||||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class = "row">
|
|
||||||
|
|
||||||
<div class = "span3">
|
|
||||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
<select name="shift" id="shift">
|
|
||||||
<option value="">All Shift</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$('#custom_excel').hide();
|
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
|
||||||
var url = $('#custom_excel').attr('data-url');
|
|
||||||
$('#frm_report').attr('action',url)
|
|
||||||
$('#frm_report').submit();
|
|
||||||
// window.location = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
function export_to(path)
|
|
||||||
{
|
|
||||||
var form_params = $("#frm_report").serialize();
|
|
||||||
window.location = path+"?"+ form_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
<div class="page-header">
|
|
||||||
<ul class="breadcrumb">
|
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
|
||||||
<li>Daily Sale Report</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 text-right">
|
|
||||||
<a href="javascript:export_to('<%=reports_sale_items_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
|
||||||
<div class="card row">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Date</th>
|
|
||||||
<th id="date"></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Menu Category</th>
|
|
||||||
<th>Code</th>
|
|
||||||
<th>Product</th>
|
|
||||||
<th>Total Item</th>
|
|
||||||
<th>Unit Price</th>
|
|
||||||
<th>Revenue</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
|
|
||||||
var cate = [];
|
|
||||||
var y;
|
|
||||||
var count = 0;
|
|
||||||
var sub_total = 0;
|
|
||||||
var sub_total_arr = [];
|
|
||||||
|
|
||||||
<% @sale_data.each do |result| %>
|
|
||||||
|
|
||||||
count = count + 1;
|
|
||||||
if(count == 1)
|
|
||||||
$('#date').append('<%= result.date_name rescue '-'%>');
|
|
||||||
|
|
||||||
y = $.inArray(<%= result.menu_category_id %>, cate);
|
|
||||||
if(y == -1){
|
|
||||||
//add sub total row
|
|
||||||
sub_total_arr.push(sub_total);
|
|
||||||
var total_row = '<tr><td colspan="4"></td>'+
|
|
||||||
'<td > Sub Total</td> ' +
|
|
||||||
'<td><span class="underline">'+ sub_total +'</span></td>'+
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
if(count != 1){
|
|
||||||
$('.table').append(total_row);
|
|
||||||
sub_total = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cate.push(<%= result.menu_category_id %>);
|
|
||||||
var th = '<tr><td colspan="6"><%= result.menu_category_name rescue '-'%></td></tr>';
|
|
||||||
var tr = '<tr>'+
|
|
||||||
'<td></td>'+
|
|
||||||
'<td><%= result.code rescue '-'%></td>' +
|
|
||||||
'<td><%= result.product_name rescue '-'%></td>' +
|
|
||||||
'<td><%= result.total_item.to_i rescue '-'%></td>' +
|
|
||||||
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
|
|
||||||
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%>'+
|
|
||||||
'</td>'+
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
$('.table').append(th);
|
|
||||||
$('.table').append(tr);
|
|
||||||
|
|
||||||
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
var tr = '<tr>'+
|
|
||||||
'<td></td>'+
|
|
||||||
'<td><%= result.code rescue '-'%></td>' +
|
|
||||||
'<td><%= result.product_name rescue '-'%></td>' +
|
|
||||||
'<td><%= result.total_item.to_i rescue '-'%></td>' +
|
|
||||||
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
|
|
||||||
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%></td></tr>';
|
|
||||||
$('.table').append(tr);
|
|
||||||
|
|
||||||
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
|
|
||||||
}
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
last_line_subtotal(sub_total);
|
|
||||||
sub_total_arr.push(parseInt(sub_total));
|
|
||||||
grand_total(sub_total_arr);
|
|
||||||
})
|
|
||||||
|
|
||||||
function last_line_subtotal(sub_total){
|
|
||||||
|
|
||||||
var total_row = '<tr><td colspan="4"></td>'+
|
|
||||||
'<td > Sub Total</td> ' +
|
|
||||||
'<td><span class="underline">'+ sub_total +'</span></td>'+
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
$('.table').append(total_row);
|
|
||||||
}
|
|
||||||
|
|
||||||
function grand_total(sub_total_arr){
|
|
||||||
|
|
||||||
var total = 0;
|
|
||||||
for(var i=0; i< sub_total_arr.length; i++){
|
|
||||||
//total_1 = (total_1) + (sub_total_arr[i]);
|
|
||||||
total = parseInt(total) + parseInt(sub_total_arr[i]);
|
|
||||||
}
|
|
||||||
var row = '<tr><td colspan="4"></td>'+
|
|
||||||
'<td > Grand Total</td> ' +
|
|
||||||
'<td><span class="double_underline">'+ total +'</span></td>'+
|
|
||||||
'</tr>';
|
|
||||||
$('.table').append(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %>
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_saleitem_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<a href="javascript:export_to('<%=reports_sale_items_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,22 +49,6 @@
|
|||||||
|
|
||||||
<% @sale_data.order("total_item desc").each do |sale| %>
|
<% @sale_data.order("total_item desc").each do |sale| %>
|
||||||
|
|
||||||
<% if !acc_arr.include?(sale.account_id) %>
|
|
||||||
<tr>
|
|
||||||
<td><b><%= sale.account_name %></b></td>
|
|
||||||
<td colspan="4"> </td>
|
|
||||||
<td>Total Price By <%= sale.account_name %></td>
|
|
||||||
<td>
|
|
||||||
<% @totalByAccount.each do |account, total| %>
|
|
||||||
<% if sale.account_id == account %>
|
|
||||||
<b><%= total %></b>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% acc_arr.push(sale.account_id) %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||||
@@ -103,23 +87,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- sub total -->
|
<!-- sub total -->
|
||||||
<% @menu_cate_count.each do |key,value| %>
|
|
||||||
<% if sale.menu_category_id == key %>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% sub_total += sale.grand_total %>
|
|
||||||
<% if count == value %>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Sub Total</td>
|
|
||||||
<td ><span class="underline"><%= sub_total + total_price %></span></td>
|
|
||||||
</tr>
|
|
||||||
<% sub_total = 0.0%>
|
|
||||||
<% total_discount = total_discount + total_price %>
|
|
||||||
<% total_price = 0.0%>
|
|
||||||
<% count = 0%>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<!-- end sub total -->
|
<!-- end sub total -->
|
||||||
<% grand_total += sale.grand_total%>
|
<% grand_total += sale.grand_total%>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -14,6 +14,5 @@ module SXRestaurants
|
|||||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
config.time_zone = 'Asia/Rangoon'
|
config.time_zone = 'Asia/Rangoon'
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -261,8 +261,8 @@ Rails.application.routes.draw do
|
|||||||
#--------- Reports Controller Sections ------------#
|
#--------- Reports Controller Sections ------------#
|
||||||
namespace :reports do
|
namespace :reports do
|
||||||
resources :receipt_no, :only => [:index, :show]
|
resources :receipt_no, :only => [:index, :show]
|
||||||
resources :daily_sales, :only => [:index, :show]
|
resources :dailysale, :only => [:index, :show]
|
||||||
resources :sale_items, :only => [:index, :show]
|
resources :saleitem, :only => [:index, :show]
|
||||||
# resources :sales, :only => [:index, :show]
|
# resources :sales, :only => [:index, :show]
|
||||||
# resources :orders, :only => [:index, :show]
|
# resources :orders, :only => [:index, :show]
|
||||||
# resources :customers, :only => [:index, :show]
|
# resources :customers, :only => [:index, :show]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class CreateDiningQueues < ActiveRecord::Migration[5.1]
|
class DiningQueues < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :dining_queues do |t|
|
create_table :dining_queues do |t|
|
||||||
t.string :name
|
t.string :name
|
||||||
t.string :contact_no
|
t.string :contact_no
|
||||||
t.string :queue_no
|
t.string :queue_no
|
||||||
@@ -9,6 +9,6 @@ class CreateDiningQueues < ActiveRecord::Migration[5.1]
|
|||||||
t.integer :seater
|
t.integer :seater
|
||||||
t.string :remark
|
t.string :remark
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -13,6 +13,9 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
|
|||||||
t.decimal :page_width, :null => false, :default => 200
|
t.decimal :page_width, :null => false, :default => 200
|
||||||
t.decimal :page_height, :null => false, :default => 800
|
t.decimal :page_height, :null => false, :default => 800
|
||||||
t.integer :print_copies, :null => false, :default => 1
|
t.integer :print_copies, :null => false, :default => 1
|
||||||
|
t.string :precision
|
||||||
|
t.boolean :delimiter
|
||||||
|
t.integer :heading_space
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
11
db/seeds.rb
11
db/seeds.rb
@@ -63,6 +63,7 @@ employee_roles = Lookup.create([{lookup_type:'employee_roles', name: 'Cashier',
|
|||||||
{lookup_type:'employee_roles', name: 'Waiter', value: 'waiter'},
|
{lookup_type:'employee_roles', name: 'Waiter', value: 'waiter'},
|
||||||
{lookup_type:'employee_roles', name: 'Supervisour', value: 'supervisour'},
|
{lookup_type:'employee_roles', name: 'Supervisour', value: 'supervisour'},
|
||||||
{lookup_type:'employee_roles', name: 'Manager', value: 'manager'},
|
{lookup_type:'employee_roles', name: 'Manager', value: 'manager'},
|
||||||
|
{lookup_type:'employee_roles', name: 'Accountant', value: 'account'},
|
||||||
{lookup_type:'employee_roles', name: 'Administrator', value: 'administrator'}])
|
{lookup_type:'employee_roles', name: 'Administrator', value: 'administrator'}])
|
||||||
|
|
||||||
#booking_status
|
#booking_status
|
||||||
@@ -155,11 +156,11 @@ admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "111
|
|||||||
admin_employee = Employee.create({name: "Waiter 2", role: "waiter", password: "22222", emp_id:"222", created_by: "SYSTEM DEFAULT"})
|
admin_employee = Employee.create({name: "Waiter 2", role: "waiter", password: "22222", emp_id:"222", created_by: "SYSTEM DEFAULT"})
|
||||||
admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "33333", emp_id:"333", created_by: "SYSTEM DEFAULT"})
|
admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "33333", emp_id:"333", created_by: "SYSTEM DEFAULT"})
|
||||||
|
|
||||||
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
|
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A", precision: "0", delimiter: "0", heading_space: "5"})
|
||||||
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
|
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A", precision: "0", delimiter: "0", heading_space: "5"})
|
||||||
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
|
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A", precision: "0", delimiter: "0", heading_space: "5"})
|
||||||
crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "EPSON-TM-T82-S-A"})
|
crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "EPSON-TM-T82-S-A", precision: "0", delimiter: "0", heading_space: "5"})
|
||||||
queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf", printer_name: "EPSON-TM-T82-S-A"})
|
queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf", printer_name: "EPSON-TM-T82-S-A", precision: "0", delimiter: "0", heading_space: "5"})
|
||||||
|
|
||||||
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
||||||
|
|
||||||
|
|||||||
BIN
public/fonts/Chinese.ttf
Executable file
BIN
public/fonts/Chinese.ttf
Executable file
Binary file not shown.
BIN
public/fonts/Zawgyi-One.ttf
Executable file
BIN
public/fonts/Zawgyi-One.ttf
Executable file
Binary file not shown.
BIN
public/fonts/padauk.ttf
Executable file
BIN
public/fonts/padauk.ttf
Executable file
Binary file not shown.
5
spec/controllers/reports/dailysale_controller_spec.rb
Normal file
5
spec/controllers/reports/dailysale_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Reports::DailysaleController, type: :controller do
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Reports::DailysalesController, type: :controller do
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Reports::SaleItemsController, type: :controller do
|
|
||||||
|
|
||||||
end
|
|
||||||
5
spec/controllers/reports/saleitem_controller_spec.rb
Normal file
5
spec/controllers/reports/saleitem_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Reports::SaleitemController, type: :controller do
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
# Specs in this file have access to a helper object that includes
|
||||||
# the Reports::SaleItemsHelper. For example:
|
# the Reports::DailysaleHelper. For example:
|
||||||
#
|
#
|
||||||
# describe Reports::SaleItemsHelper do
|
# describe Reports::DailysaleHelper do
|
||||||
# describe "string concat" do
|
# describe "string concat" do
|
||||||
# it "concats two strings with spaces" do
|
# it "concats two strings with spaces" do
|
||||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
RSpec.describe Reports::SaleItemsHelper, type: :helper do
|
RSpec.describe Reports::DailysaleHelper, type: :helper do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
# Specs in this file have access to a helper object that includes
|
||||||
# the Reports::DailysalesHelper. For example:
|
# the Reports::SaleitemHelper. For example:
|
||||||
#
|
#
|
||||||
# describe Reports::DailysalesHelper do
|
# describe Reports::SaleitemHelper do
|
||||||
# describe "string concat" do
|
# describe "string concat" do
|
||||||
# it "concats two strings with spaces" do
|
# it "concats two strings with spaces" do
|
||||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
RSpec.describe Reports::DailysalesHelper, type: :helper do
|
RSpec.describe Reports::SaleitemHelper, type: :helper do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user