Merge branch 'master' into license
This commit is contained in:
@@ -373,7 +373,7 @@ $(function() {
|
||||
$('.add_to_order').removeAttr('data-attributes');
|
||||
$('.add_to_order').removeAttr('data-options');
|
||||
|
||||
$('.keypress_qty').val(1);
|
||||
$('#count').val(1);
|
||||
|
||||
change_qty_plus_minus("count","plus","minus");
|
||||
|
||||
@@ -668,11 +668,12 @@ $(function() {
|
||||
e.preventDefault();
|
||||
$("#oqs_loading_wrapper").show();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var booking_id = $('#booking_id').text();
|
||||
if (!booking_id.length > 0) {
|
||||
|
||||
var params = {'order_source': "cashier", 'order_type': "dine_in",
|
||||
'customer_id': "", 'guest_info': "",'booking_id':booking_id,
|
||||
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
}
|
||||
@@ -682,7 +683,7 @@ $(function() {
|
||||
var ajax_url = '../addorders/create';
|
||||
|
||||
var params = {'order_source': "cashier", 'order_type': "dine_in",
|
||||
'customer_id': "", 'guest_info': "",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
$.ajax({
|
||||
@@ -824,18 +825,11 @@ $(function() {
|
||||
|
||||
// Get Selected Class
|
||||
function change_qty_plus_minus(id,plus,minus) {
|
||||
var count = parseInt($('#'+id).val());
|
||||
|
||||
|
||||
|
||||
|
||||
$('#'+plus).on("click", function(){
|
||||
|
||||
var count = parseInt($('#'+id).val());
|
||||
var countEl = document.getElementById(id);
|
||||
|
||||
count++;
|
||||
countEl.value = count;
|
||||
|
||||
$('#'+plus).on("click", function(){
|
||||
count++;
|
||||
$('#'+id).val(count);
|
||||
|
||||
if (id == "count") {
|
||||
price = $("#unit_price").text();
|
||||
@@ -861,12 +855,12 @@ $(function() {
|
||||
|
||||
$('#'+minus).on("click", function(){
|
||||
|
||||
var count = parseInt($('#'+id).val());
|
||||
var countEl = document.getElementById(id);
|
||||
// var count = parseInt($('#'+id).val());
|
||||
// var countEl = document.getElementById(id);
|
||||
|
||||
if (count > 1) {
|
||||
count--;
|
||||
countEl.value = count;
|
||||
$('#'+id).val(count);
|
||||
|
||||
if (id=="count") {
|
||||
price = $("#unit_price").text();
|
||||
@@ -899,7 +893,7 @@ $(function() {
|
||||
|
||||
if ($.isNumeric(value)) {
|
||||
if (id=="count") {
|
||||
$('.change_qty').attr('value',value);
|
||||
$('#count').attr('value',value);
|
||||
price = $("#unit_price").text();
|
||||
$("#total_price").text(value*price);
|
||||
}else{
|
||||
|
||||
@@ -104,6 +104,9 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// first input focus for all form
|
||||
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
|
||||
|
||||
// $(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
// $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
||||
// $('.dropdown-toggle').dropdown();
|
||||
|
||||
@@ -114,9 +114,11 @@
|
||||
.green{
|
||||
background-color: #009900;
|
||||
}
|
||||
.left{
|
||||
|
||||
.left-margin-1 {
|
||||
margin-left:1px;
|
||||
}
|
||||
|
||||
.bottom{
|
||||
margin-bottom:1px;
|
||||
}
|
||||
|
||||
@@ -93,3 +93,9 @@ nav.pagination .page a:hover,
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
|
||||
/*Logout Icon*/
|
||||
i.logout_icon{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ class Oqs::EditController < BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -17,7 +17,7 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_item_code(order_item.item_code)
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
@@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.item_code, print_status=" (Edited)" )
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.instance_code, print_status=" (Edited)" )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -58,6 +58,9 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
puts "sssssssssss"
|
||||
puts params[:customer_id]
|
||||
puts params.to_json
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
|
||||
@@ -8,7 +8,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
if sale_payment.payment_method == "creditnote"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
|
||||
@@ -29,14 +29,19 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||
# sale.save
|
||||
if discount_items.length > 0
|
||||
puts discount_items.to_json
|
||||
puts "dddddddddddd"
|
||||
|
||||
#save sale item for discount
|
||||
discount_items.each do |di|
|
||||
origin_sale_item = SaleItem.find(di["id"])
|
||||
puts origin_sale_item.to_json
|
||||
sale_item = SaleItem.new
|
||||
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
sale_item.product_name = di["name"]
|
||||
sale_item.item_instance_code = origin_sale_item.item_instance_code
|
||||
sale_item.product_alt_name = ""
|
||||
sale_item.remark = "Discount"
|
||||
|
||||
@@ -156,9 +161,9 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale = Sale.find(sale_id)
|
||||
|
||||
# Check for Card Payment
|
||||
is_card_payment = SaleItem.get_sale_payments_by_card(sale.sale_payments)
|
||||
is_card_payment = SalePayment.get_sale_payments_by_card(sale.sale_payments)
|
||||
|
||||
if is_card_payment != true
|
||||
if is_card != "true"
|
||||
account_types = Account.where("discount=?",true)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
@@ -43,7 +43,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = saleitemObj.qty * -1
|
||||
@newsaleitem.unit_price = saleitemObj.unit_price * -1
|
||||
@newsaleitem.unit_price = saleitemObj.unit_price * 1
|
||||
@newsaleitem.taxable_price = saleitemObj.taxable_price * -1
|
||||
@newsaleitem.price = saleitemObj.price * -1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + ' (FOC)'
|
||||
|
||||
@@ -8,12 +8,19 @@ class Origami::VoidController < BaseOrigamiController
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
# update count for shift sale
|
||||
# if(sale.sale_status == "completed")
|
||||
if(sale.sale_status == "completed")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
# end
|
||||
else
|
||||
# void before sale payment complete
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.total_void = shift.total_void + sale.grand_total
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
@@ -93,6 +100,5 @@ class Origami::VoidController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -20,7 +20,11 @@ authorize_resource :class => false
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@tax_profiles = TaxProfile.order('order_by asc')
|
||||
|
||||
puts @sale_taxes.to_json
|
||||
puts "sssssss"
|
||||
puts @tax_profiles.to_json
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
end
|
||||
end
|
||||
@sale_data, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_instances.save
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||
@@ -105,9 +105,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
#@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item_instances }
|
||||
@@ -154,6 +154,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
else
|
||||
@item = MenuItem.find(params[:set_menu_item_id])
|
||||
end
|
||||
|
||||
# To Only show in Menu item selected attrs
|
||||
@item.item_attributes = MenuItemAttribute.where(id: @item.item_attributes).select("id, name").map { |e| [e.name, e.id] }
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
||||
@@ -29,8 +29,12 @@ class Settings::PromotionsController < ApplicationController
|
||||
def create
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
if !@promotion.promo_start_hour.nil?
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
if !@promotion.promo_end_hour.nil?
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
respond_to do |format|
|
||||
if @promotion.save
|
||||
promo_pros = @promotion.promotion_products
|
||||
@@ -95,16 +99,23 @@ class Settings::PromotionsController < ApplicationController
|
||||
|
||||
def find_parent_item
|
||||
res = []
|
||||
item = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item.nil?
|
||||
arr_inst = []
|
||||
item_inst = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item_inst.nil?
|
||||
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
|
||||
res.push(product.name)
|
||||
res.push(product.item_code)
|
||||
else
|
||||
# menu_item = item.menu_item.pluck(:name,:item_code)
|
||||
res.push(item.item_instance_name)
|
||||
res.push(item.menu_item.item_code)
|
||||
# menu_item = item_inst.menu_item.pluck(:name,:item_code)
|
||||
# res.push(item_inst.item_instance_name)
|
||||
# res.push(item_inst.menu_item.item_code)
|
||||
item_inst.menu_item.menu_item_instances.each do |inst|
|
||||
arr_inst.push({inst.item_instance_code => inst.item_instance_name})
|
||||
end
|
||||
res.push({item_inst.menu_item.item_code => arr_inst})
|
||||
end
|
||||
puts "res"
|
||||
p res
|
||||
render json: res
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ class Transactions::BookingsController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
filter = params[:receipt_no]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && customer.nil?
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
|
||||
else
|
||||
sale = Sale.search_credit_sales(customer,filter,from,to)
|
||||
if sale.count > 0
|
||||
|
||||
@@ -3,16 +3,13 @@ class Transactions::OrdersController < ApplicationController
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
count = params[:count]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
|
||||
else
|
||||
orders = Order.search(filter,from,to,count)
|
||||
|
||||
orders = Order.search(filter,from,to)
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
|
||||
@@ -3,9 +3,8 @@ class OrderQueueProcessorJob < ApplicationJob
|
||||
|
||||
def perform(order_id, table_id)
|
||||
# Do something later
|
||||
#Order ID
|
||||
|
||||
order = Order.find(order_id)
|
||||
#Order ID
|
||||
order = Order.find(order_id)
|
||||
|
||||
#Execute orders and send to order stations
|
||||
if order
|
||||
|
||||
@@ -363,18 +363,18 @@ class Order < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.search(filter,from,to,count)
|
||||
if count.to_i > 0
|
||||
item_count = "and item_count = '#{count}'"
|
||||
def self.search(filter,from,to)
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
item_count = ''
|
||||
keyword = "order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%"
|
||||
end
|
||||
if from.present? && to.present?
|
||||
Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ? #{item_count}", from,to)
|
||||
elsif !from.present? && !to.present? && count.present?
|
||||
Order.where("item_count = '#{count}'")
|
||||
|
||||
if from.present? && to.present?
|
||||
order = Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to)
|
||||
query = order.where(keyword)
|
||||
else
|
||||
Order.where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class PrintSetting < ApplicationRecord
|
||||
# validations
|
||||
validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height
|
||||
validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies
|
||||
end
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
def print_order_item(print_settings,oqs,order_id, item_code, print_status, options="")
|
||||
def print_order_item(print_settings,oqs,order_id, instance_code, print_status, options="")
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_item = print_query('order_item', instance_code) #OrderItem.find_by_item_code(item_code)
|
||||
|
||||
filename = "tmp/order_item.pdf"
|
||||
|
||||
@@ -14,12 +20,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
# end
|
||||
@@ -29,9 +36,14 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
def print_order_summary(print_settings,oqs, order_id, order_items, print_status)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order=print_query('order_summary', order_id)
|
||||
#Print
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order=print_query('order_summary', order_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
order.each do|odi|
|
||||
@@ -44,11 +56,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name)
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#end
|
||||
@@ -59,12 +72,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
@@ -72,6 +86,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# Print for orders in booking
|
||||
def print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order=print_query('booking_summary', booking_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
@@ -89,9 +109,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#end
|
||||
@@ -105,9 +127,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,6 @@ class Printer::PrinterWorker
|
||||
end
|
||||
|
||||
def print(file_path,printer_destination = nil )
|
||||
|
||||
if printer_destination.nil?
|
||||
printer_destination = self.printer_destination
|
||||
end
|
||||
|
||||
@@ -74,6 +74,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
|
||||
# override print copies for print worker loop
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
begin
|
||||
if count == 1
|
||||
pdf.render_file "tmp/receipt_bill_#{sale_data.receipt_no}.pdf"
|
||||
@@ -100,7 +104,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = QueueNoPdf.new(printer_settings,queue)
|
||||
pdf.render_file "tmp/print_queue_no.pdf"
|
||||
pdf.render_file "tmp/print_queue_no.pdf"
|
||||
self.print("tmp/print_queue_no.pdf")
|
||||
end
|
||||
|
||||
|
||||
@@ -449,7 +449,7 @@ class Sale < ApplicationRecord
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
|
||||
query = sale.where(keyword)
|
||||
else
|
||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",)
|
||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -623,6 +623,7 @@ def self.get_item_query()
|
||||
|
||||
query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code, " +
|
||||
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item," +
|
||||
"i.remark as status_type,"+
|
||||
" i.unit_price as unit_price,i.product_name as product_name, mc.name as" +
|
||||
" menu_category_name,mc.id as menu_category_id ")
|
||||
|
||||
@@ -635,7 +636,7 @@ def self.get_item_query()
|
||||
|
||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
query = query.where("i.item_instance_code IS NOT NULL")
|
||||
query = query.group("i.item_instance_code").order("mi.account_id, mi.menu_category_id")
|
||||
query = query.group("i.product_name").order("mi.account_id, mi.menu_category_id")
|
||||
end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
@@ -724,19 +725,19 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
||||
query = Sale.all
|
||||
if shift.present?
|
||||
|
||||
query = query.where("sales.shift_sale_id in (?) #{payment_type} and sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
|
||||
query = query.where("sales.shift_sale_id in (?) #{payment_type} and sale_status= 'completed' and sales.payment_status= 'paid' and sale_payments.payment_amount != 0", shift.to_a)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
|
||||
elsif shift_sale_range.present?
|
||||
|
||||
query = query.where("sale_status='completed' #{payment_type} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
|
||||
query = query.where("sale_status='completed' #{payment_type} and sale_payments.payment_amount != 0 and sales.payment_status= 'paid' and sales.shift_sale_id in (?)",shift_sale_range.to_a)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
|
||||
else
|
||||
|
||||
query = query.where("sale_status='completed' and sales.receipt_date between ? and ? #{payment_type} and sale_payments.payment_amount != 0",from,to)
|
||||
query = query.where("sale_status='completed' and sales.receipt_date between ? and ? #{payment_type} and sales.payment_status= 'paid' and sale_payments.payment_amount != 0",from,to)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
end
|
||||
@@ -794,19 +795,19 @@ def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
|
||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status= 'completed'", shift.to_a)
|
||||
.group("sale_taxes.tax_name")
|
||||
.order("sale_taxes.sale_tax_id asc")
|
||||
.order("sale_taxes.tax_name desc")
|
||||
elsif shift_sale_range.present?
|
||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||
.where("sales.shift_sale_id in (?) and sale_status= 'completed'", shift_sale_range.to_a)
|
||||
.group("sale_taxes.tax_name")
|
||||
.order("sale_taxes.sale_tax_id asc")
|
||||
.order("sale_taxes.tax_name desc")
|
||||
else
|
||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||
.where("sales.receipt_date between ? and ? and sale_status= 'completed'", from,to)
|
||||
.group("sale_taxes.tax_name")
|
||||
.order("sale_taxes.sale_tax_id asc")
|
||||
.order("sale_taxes.tax_name desc")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -145,17 +145,6 @@ class SaleItem < ApplicationRecord
|
||||
return price,type
|
||||
end
|
||||
|
||||
# Check for Card Payment
|
||||
def self.get_sale_payments_by_card(sale_payments)
|
||||
|
||||
# Check for Card Payment
|
||||
sale_payments.each do |sp|
|
||||
if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master"
|
||||
return true;
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
# def self.get_overall_discount(sale_id)
|
||||
# price = 0.0
|
||||
# item=SaleItem.where("product_code=?", sale_id)
|
||||
|
||||
@@ -155,6 +155,16 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
# Check for Card Payment
|
||||
def self.get_sale_payments_by_card(sale_payments)
|
||||
# Check for Card Payment
|
||||
sale_payments.each do |sp|
|
||||
if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master"
|
||||
return true;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def cash_payment
|
||||
payment_status = false
|
||||
@@ -497,8 +507,6 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||
|
||||
@@ -54,7 +54,7 @@ class ShiftSale < ApplicationRecord
|
||||
self.cash_sales = self.cash_sales.to_f + cash.to_f
|
||||
self.credit_sales = self.credit_sales.to_i + credit.to_f
|
||||
self.other_sales = self.other_sales.to_i + other_sales.to_f
|
||||
self.nett_sales = self.nett_sales + (saleobj.total_amount.to_f - self.total_discounts) #self.grand_total.to_i - self.commercial_taxes
|
||||
self.nett_sales = self.nett_sales + (saleobj.total_amount.to_f - saleobj.total_discount) #self.grand_total.to_i - self.commercial_taxes
|
||||
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
|
||||
self.total_receipt = self.total_receipt + 1
|
||||
|
||||
@@ -263,13 +263,14 @@ class CloseCashierPdf < Prawn::Document
|
||||
end
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Sale :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#COMMENTED FOR NO NEED AND NOT CORRECT WHEN OTHER CHARGES
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
# text "Total Sale :", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-9 col-md-9 col-sm-9">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<div class="card">
|
||||
<div class="body table-responsive">
|
||||
<table class="table table-hover table-striped">
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="card">
|
||||
<div class="body" id="custom-slimscroll">
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,9 +39,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,9 +49,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,9 +59,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,9 +69,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number"></div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
<%= link_to t("views.btn.new"),new_crm_dining_queue_path,:class => 'btn bg-green btn-block btn-lg btn-block', 'data-no-turbolink' => true %>
|
||||
<hr>
|
||||
|
||||
<button type="button" id="assign" class="btn btn-primary btn-block btn-lg waves-effect" disabled>Assign</button>
|
||||
<button type="button" id="cancel" class="btn btn-danger btn-block btn-lg waves-effect" disabled>Cancel</button>
|
||||
<button type="button" id="assign" class="btn btn-primary btn-block btn-lg waves-effect" style="font-size: 11px" disabled>Assign</button>
|
||||
<button type="button" id="cancel" class="btn btn-danger btn-block btn-lg waves-effect" style="font-size: 11px" disabled>Cancel</button>
|
||||
<!-- <a href="<%= dashboard_path %>" class="btn btn-default btn-block waves-effect" role="button" aria-haspopup="true" aria-expanded="false"> Back </a> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
</button> -->
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Print <br/>Order<br/>Summary</button> -->
|
||||
<button id="assign" value="" disabled="disabled" data-type="assign" class="btn assign btn-primary btn-lg btn-block">ASSIGN</button>
|
||||
<button id="cancel" value="" disabled="disabled" data-type="cancel" class="btn btn-danger cancel btn-lg btn-block">CANCLE</button>
|
||||
<button id="cancel" value="" disabled="disabled" data-type="cancel" class="btn btn-danger cancel btn-lg btn-block">CANCEL</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<%if current_login_employee.role !="waiter" %>
|
||||
<p class="delete waves-effect waves-block p-l-30 m-t-15" data-ref="<%=logout_path%>" data-method="delete">
|
||||
<i class="material-icons">exit_to_app</i>
|
||||
<span class="font-18 m-b-5">Logout</span>
|
||||
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
||||
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
||||
<span class="font-18">Logout</span>
|
||||
</p>
|
||||
<span class="hidden" id="delete_text">
|
||||
<h6>Are you sure you want to Logout ?</h6>
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"><%=@table.type%></p>
|
||||
<p class="hidden" id="booking_id"><%=@booking_id%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
|
||||
@@ -40,15 +40,13 @@
|
||||
<!-- </div> -->
|
||||
<% end %>
|
||||
<!-- <div class="row"> -->
|
||||
<div class="row">
|
||||
<!-- <div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<label >Recent Credit Amount</label>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div> -->
|
||||
<!-- </div> -->
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
|
||||
@@ -115,11 +115,11 @@
|
||||
<label><%= t("views.right_panel.detail.salutation") %> :</label><br>
|
||||
<label class="font-15"><%= t("views.right_panel.detail.mr") %>
|
||||
<%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr"%></label>
|
||||
<label class="font-15 m-l-20"><%= t("views.right_panel.detail.miss") %>
|
||||
<label class="font-15 m-l-5"><%= t("views.right_panel.detail.miss") %>
|
||||
<%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs"%></label>
|
||||
<label class="font-15 m-l-20"><%= t("views.right_panel.detail.mrs") %>
|
||||
<label class="font-15 m-l-5"><%= t("views.right_panel.detail.mrs") %>
|
||||
<%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss"%></label>
|
||||
<label class="font-15 m-l-20"><%= t("views.right_panel.detail.mdm") %>
|
||||
<label class="font-15 m-l-5"><%= t("views.right_panel.detail.mdm") %>
|
||||
<%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm"%></label>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -374,14 +374,14 @@
|
||||
<% end %>
|
||||
<% if @status_sale == 'sale' %>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit'>Edit</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' active="<%= can? :edit, :sale_edit %>">Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect"> Void</button>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
@@ -617,7 +617,12 @@
|
||||
$('#edit').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
|
||||
if ($(this).attr('active')=== "true") {
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#commissions').on('click', function () {
|
||||
@@ -632,6 +637,7 @@
|
||||
});
|
||||
|
||||
$('#void').on('click', function () {
|
||||
if ($(this).attr('active')=== "true") {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
@@ -652,7 +658,10 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
});
|
||||
|
||||
$('#add_order').on('click', function () {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||
<label>You can pay up to </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_jcb %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -27,7 +27,7 @@
|
||||
<% if @jcbcount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Recent JCB paid amount </label>
|
||||
<label>Recent JCB paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@jcbcount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -35,14 +35,14 @@
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||
<label>You can pay up to </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_master %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -27,7 +27,7 @@
|
||||
<% if @mastercount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Recent Master paid amount </label>
|
||||
<label>Recent Master paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@mastercount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -35,14 +35,14 @@
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||
<label>You can pay up to </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_mpu %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -28,7 +28,7 @@
|
||||
<% if @mpucount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Recent MPU paid amount </label>
|
||||
<label>Recent MPU paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@mpucount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -36,14 +36,14 @@
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
@@ -276,8 +276,8 @@
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc"> FOC </button>
|
||||
<button type="button" class="btn bg-red btn-block" id="void"> Void </button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
||||
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
||||
<!-- Waiter Buttons -->
|
||||
</div>
|
||||
|
||||
@@ -359,95 +359,99 @@
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
// Disable click event cash to prevent
|
||||
$(".payment .cash-color").off('click');
|
||||
// Disable click event cash to prevent
|
||||
$(".payment .cash-color").off('click');
|
||||
|
||||
$('#credit_payment').click(function() {
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/credit_payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#card_payment').click(function() {
|
||||
localStorage.setItem("cash",$('#cash').text() );
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#pay').click(function() {
|
||||
$('#pay').text("Processing, Please wait!")
|
||||
|
||||
$( "#loading_wrapper" ).show();
|
||||
|
||||
if($('#balance').text() > 0){
|
||||
swal ( "Oops" , "Insufficient Amount!" , "error" );
|
||||
$( "#loading_wrapper" ).hide();
|
||||
}else{
|
||||
var sale_id = $('#sale_id').text();
|
||||
var item_row = $('.is_card');
|
||||
if (item_row.length < 1) {
|
||||
calculate_member_discount(sale_id);
|
||||
}
|
||||
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
async: false,
|
||||
success:function(result){
|
||||
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
$( "#loading_wrapper" ).hide();
|
||||
if($('#balance').text() < 0){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Changed amount ' + $('#balance').text() * (-1),
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}else{
|
||||
$('#pay').text("Pay");
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#credit_payment').click(function() {
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/credit_payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#void').on('click',function () {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Are you sure want to Void !',
|
||||
}, function () {
|
||||
var sale_id = $('#sale_id').text();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
$('#card_payment').click(function() {
|
||||
localStorage.setItem("cash",$('#cash').text() );
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
$('#pay').click(function() {
|
||||
$('#pay').text("Processing, Please wait!")
|
||||
|
||||
$( "#loading_wrapper" ).show();
|
||||
|
||||
if($('#balance').text() > 0){
|
||||
swal ( "Oops" , "Insufficient Amount!" , "error" );
|
||||
$( "#loading_wrapper" ).hide();
|
||||
}else{
|
||||
var sale_id = $('#sale_id').text();
|
||||
var item_row = $('.is_card');
|
||||
if (item_row.length < 1) {
|
||||
calculate_member_discount(sale_id);
|
||||
}
|
||||
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
async: false,
|
||||
success:function(result){
|
||||
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
$( "#loading_wrapper" ).hide();
|
||||
if($('#balance').text() < 0){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Changed amount ' + $('#balance').text() * (-1),
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}else{
|
||||
$('#pay').text("Pay");
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#void').on('click',function () {
|
||||
if ($(this).attr('active') === "true") {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Are you sure want to Void !',
|
||||
}, function () {
|
||||
var sale_id = $('#sale_id').text();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
})
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function update_balance(){
|
||||
var cash = $('#cash').text();
|
||||
@@ -464,19 +468,21 @@
|
||||
}
|
||||
|
||||
$('#foc').click(function() {
|
||||
$( "#loading_wrapper" ).show();
|
||||
//$( "#loading_wrapper" ).show();
|
||||
// payment
|
||||
var cash = $('#amount_due').text();
|
||||
var sub_total = $('#sub-total').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
||||
|
||||
$.ajax({type: "POST",
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
data: params,
|
||||
success:function(result){
|
||||
|
||||
$( "#loading_wrapper" ).hide();
|
||||
//$( "#loading_wrapper" ).hide();
|
||||
|
||||
if (cash > 0) {
|
||||
swal({
|
||||
@@ -489,6 +495,9 @@
|
||||
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for foc","warning")
|
||||
}
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id) {
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%">#</th>
|
||||
<th class="" width="30%">Items</th>
|
||||
<th class="" width="20%">Items</th>
|
||||
<th style="" width="13%">QTY
|
||||
</td>
|
||||
<th class="" width="13%">Price
|
||||
</td>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="17%"> Action</th>
|
||||
<th class='' width="20%"> Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -54,7 +54,7 @@
|
||||
%>
|
||||
<tr>
|
||||
<td width="4%"><%= count %></td>
|
||||
<td class='' width="30%">
|
||||
<td class='' width="20%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
|
||||
@@ -108,8 +108,8 @@
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
<td width="50%"><strong>Sub Total:</strong></td>
|
||||
<td><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<div class="row">
|
||||
<div class="row p-l-30">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="1" data-type="num">1</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||
<label>You can pay up to </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_visa %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -27,7 +27,7 @@
|
||||
<% if @visacount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Recent Visa paid amount </label>
|
||||
<label>Recent Visa paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@visacount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -35,14 +35,14 @@
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
@@ -167,7 +167,7 @@
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':false },
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
|
||||
<label>You can pay up to </label>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_voucher %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -19,7 +19,7 @@
|
||||
<% if @vouchercount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Recent Voucher paid amount </label>
|
||||
<label>Recent Voucher paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@vouchercount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -27,14 +27,14 @@
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="<%=@sale_id %>" class="form-control col-lg-7 col-md-7 col-sm-7 float-value" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
|
||||
<label>Amount</label>
|
||||
<!-- <div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div> -->
|
||||
<input type="text" name="" id="amount" class="form-control col-lg-7 col-md-7 col-sm-7 float-value" value="" data-value="amount" data-member-value="">
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
<%= f.input :page_height %>
|
||||
<%= f.input :print_copies %>
|
||||
<%= f.input :print_copies, input_html: { min: '1', step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
|
||||
<%= f.input :precision %>
|
||||
<%= f.input :delimiter %>
|
||||
<%= f.input :heading_space %>
|
||||
@@ -58,4 +58,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function greaterThanOne(val){
|
||||
if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
|
||||
}
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="p-l-15">
|
||||
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
||||
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
||||
<% if period_type != false %>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="">Select Date Range</label>
|
||||
@@ -12,17 +12,17 @@
|
||||
<% end %>
|
||||
</div> -->
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t :commissioner %></label>
|
||||
<select class="form-control" name="commissioner" id="commissioner">
|
||||
<select class="form-control" name="commissioner" id="commissioner" style="height: 37px;">
|
||||
<option value=""></option>
|
||||
<% @commissioner.each do |c| %>
|
||||
<% if @com_id == c.id %>
|
||||
@@ -34,16 +34,16 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20">
|
||||
<br>
|
||||
<br>
|
||||
<input type="submit" value="Generate Report" class='btn btn-info wave-effects'>
|
||||
</div>
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20">
|
||||
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||
</div> -->
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- <script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-20">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="font-20">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="font-20">All Shift</label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 ">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
<div class="page-header">
|
||||
<div class="page-header" style="width:117%;">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.daily_sale_report") %></li>
|
||||
@@ -10,7 +10,6 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
||||
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
||||
<hr />
|
||||
@@ -20,7 +19,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card ">
|
||||
<div class="card" style="width:117%;">
|
||||
<div class="body table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 from" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 from" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 to" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 to" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<td><%= payment.cashier_name rescue '-' %></td>
|
||||
<!--<td><%= payment.sale.customer.name rescue '-' %></td>-->
|
||||
<td><%= payment.payment_method rescue '-' %></td>
|
||||
<td><%= payment.payment_amount rescue '-' %></td>
|
||||
<td><%= payment.payment_amount + payment.outstanding_amount%> </td>
|
||||
<td><%= payment.sale.grand_total rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 33.5px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 33.5;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 36px;" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
|
||||
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<th><%= tax.tax_name %></th>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<th><%= tax.name %></th>
|
||||
<% end %>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
@@ -83,6 +83,9 @@
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<%if result.customer.customer_type == "Takeaway"%>
|
||||
<td>0.0</td>
|
||||
<%end%>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||
<%end%>
|
||||
@@ -108,8 +111,9 @@
|
||||
<td colspan="2"> </td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<% @sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_name %></td>
|
||||
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<td><%= tax.name %></td>
|
||||
<% end %>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
|
||||
|
||||
76
app/views/reports/saleitem/index.html.erb
Executable file → Normal file
76
app/views/reports/saleitem/index.html.erb
Executable file → Normal file
@@ -9,30 +9,20 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- <div class="container"> -->
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %>
|
||||
|
||||
<hr />
|
||||
<!-- /div> -->
|
||||
|
||||
<!-- <div class="container"> -->
|
||||
<!-- <div class="row"> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="items_table" border="0">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th colspan="7"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</tr>
|
||||
@@ -59,18 +49,23 @@
|
||||
<% acc_arr = Array.new %>
|
||||
<% cate_arr = Array.new %>
|
||||
|
||||
<% sub_total = 0.0 %>
|
||||
<% count = 0%>
|
||||
<% total_price = 0.0 %>
|
||||
<% sub_total = 0 %>
|
||||
<% count = 0 %>
|
||||
<% total_price = 0 %>
|
||||
<% cate_count = 0 %>
|
||||
<% acc_count = 0%>
|
||||
<% grand_total = 0%>
|
||||
<% total_qty = 0%>
|
||||
<% acc_count = 0 %>
|
||||
<% grand_total = 0 %>
|
||||
<% total_qty = 0 %>
|
||||
<% total_amount = 0 %>
|
||||
<% discount = 0%>
|
||||
<% discount = 0 %>
|
||||
<% total_item_foc = 0 %>
|
||||
<% total_item_dis = 0 %>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% total_qty += sale.total_item %>
|
||||
|
||||
<% if sale.total_item > 0
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
<tr>
|
||||
@@ -102,55 +97,52 @@
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<td><%= sale.unit_price rescue '-' %></td>
|
||||
<td><%= sale.grand_total rescue '-' %></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<!-- sub total -->
|
||||
<% @menu_cate_count.each do |key,value| %>
|
||||
<% if sale.menu_category_id == key %>
|
||||
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.sub_total") %></td>
|
||||
<td ><span class="underline"><%= sub_total %></span></td>
|
||||
|
||||
</tr>
|
||||
<% if sale.status_type === "foc"
|
||||
total_item_foc += sale.grand_total
|
||||
end %>
|
||||
|
||||
<% if sale.status_type === "Discount"
|
||||
total_item_dis += sale.grand_total
|
||||
end %>
|
||||
<% sub_total = 0.0%>
|
||||
<% count = 0%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!-- end sub total -->
|
||||
|
||||
<% end %>
|
||||
|
||||
<tr style="border-top:2px solid grey;">
|
||||
<td colspan="3"> </td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
|
||||
<td><span><%= total_qty%></span></td>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td><span><%= grand_total%></span></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.cash_received") %></td>
|
||||
<td><span><%= @cash_data - @change_amount %></span></td>
|
||||
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= total_item_foc %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.card_sales") %></td>
|
||||
<td><span><%= @card_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.credit_sales") %></td>
|
||||
<td><span><%= @credit_data %></span></td>
|
||||
<td><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= total_item_dis %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
@@ -162,12 +154,6 @@
|
||||
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
|
||||
<td><span><%= @discount_data %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"> </td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
||||
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<!-- <label class="font-14">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20"><br>
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 35px;">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 35px;">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="font-14">Definition Item</label>
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<div class="form-group col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-20"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-20"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-20"><%= t("views.right_panel.detail.all_shift") %></label>
|
||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
|
||||
</select>
|
||||
</div>
|
||||
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<%= f.input :item_instance_name %>
|
||||
<%= f.input :price %>
|
||||
|
||||
<%= f.input :item_attributes, collection: MenuItemAttribute.collection, input_html: { multiple: true } %>
|
||||
<%= f.input :item_attributes, collection: @item.item_attributes, include_blank: false, include_hidden: false%>
|
||||
|
||||
<%= f.input :is_on_promotion %>
|
||||
<%= f.input :promotion_price %>
|
||||
|
||||
@@ -106,39 +106,39 @@
|
||||
</div>
|
||||
-->
|
||||
<div class="row">
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% arr = MenuItem.active.joins("JOIN menu_item_instances as b ON b.menu_item_id=menu_items.id").group("menu_items.id").order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3 form-group">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place">
|
||||
<% if !@promotion.original_product.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@promotion.original_product) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @promotion.original_product %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@promotion.original_product) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @promotion.original_product %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<option value="" selected>Choose Something</option>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if !@promotion.original_product.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@promotion.original_product).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@promotion.original_product).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@promotion.original_product).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@promotion.original_product).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3 form-group"><%= f.input :original_product,collection: sample %></div>
|
||||
<!-- <div class="col-md-6"><%= f.input :original_product,collection: MenuItemInstance.order("item_instance_name desc").pluck(:item_instance_name,:item_instance_code),input_html: { selected: 2 } %></div> -->
|
||||
@@ -160,7 +160,7 @@
|
||||
<%= f.fields_for :promotion_products do |pro| %>
|
||||
<div class="row">
|
||||
<%= pro.hidden_field :item_code,:class => "promo_product" %>
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% arr = MenuItem.joins("JOIN menu_item_instances as b ON b.menu_item_id=menu_items.id").group("menu_items.id").order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
@@ -247,9 +247,10 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
if(($('.item_code_place').val()!=undefined) && ($('.item_code_place').val()!="")){
|
||||
getItemInstance($('.item_code_place').val());
|
||||
}
|
||||
|
||||
$('#promotion_promo_start_hour').on('change', function(event) {
|
||||
$('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
|
||||
@@ -273,7 +274,7 @@
|
||||
});
|
||||
|
||||
var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
|
||||
jQuery.each( dayy.split(","), function( i, d ) {
|
||||
$.each( dayy.split(","), function( i, d ) {
|
||||
$("input.selectDay[value='"+d+"']").prop( "checked", true );
|
||||
});
|
||||
|
||||
@@ -324,8 +325,13 @@
|
||||
// $(".item_code_place").select2();
|
||||
|
||||
$(".item_code_place").on('change', function(event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
getItemInstance(item_code);
|
||||
});
|
||||
|
||||
function getItemInstance(item_code) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var original_product = "<%= @promotion.original_product %>";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
@@ -334,13 +340,15 @@
|
||||
$("#promotion_original_product").empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
|
||||
var selected = "";
|
||||
if(original_product == result[i][1]) selected = "selected";
|
||||
itemlist += "<option value ="+result[i][1]+" "+selected+">"+result[i][0]+"</option>"
|
||||
}
|
||||
$("#promotion_original_product").append(itemlist);
|
||||
//$("#promotion_original_product").select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//$(".promotion_promotion_products_item_code select").select2();
|
||||
//$(".item_code_place1").select2();
|
||||
@@ -356,7 +364,7 @@
|
||||
|
||||
// for promotion products data showing
|
||||
var promopdt = $(".promo_product");
|
||||
jQuery.each( promopdt, function( i, ppdt ) {
|
||||
$.each( promopdt, function( i, ppdt ) {
|
||||
var ajax_url = "<%= settings_find_parent_item_path %>";
|
||||
var item_code = ppdt.value;
|
||||
var select_id = ppdt.id;
|
||||
@@ -365,14 +373,33 @@
|
||||
url: ajax_url,
|
||||
data: 'item_instance_code=' + item_code,
|
||||
success: function (result) {
|
||||
// console.log(result);
|
||||
var par_item_code = "";
|
||||
var arr_item_inst = "";
|
||||
if((result[0]!=undefined) && (result[0]!="")){
|
||||
$.each(result[0],function(k,val){
|
||||
par_item_code = k;
|
||||
arr_item_inst = val;
|
||||
});
|
||||
}
|
||||
|
||||
if(result.length > 0){
|
||||
$("select#"+select_id).empty();
|
||||
$("select#"+select_id).append("<option value='"+item_code+"'>"+result[0]+"</option>");
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+result[1]+"']").attr("selected","true")
|
||||
var iteminstlists;
|
||||
$.each(arr_item_inst,function(k2,v2al){
|
||||
$("select#"+select_id).empty();
|
||||
var selected = "";
|
||||
$.each(v2al,function(k3,v3al){
|
||||
if(k3 == item_code) selected = "selected";
|
||||
iteminstlists += "<option value='"+k3+"' "+selected+">"+v3al+"</option>";
|
||||
});
|
||||
});
|
||||
$("select#"+select_id).append(iteminstlists);
|
||||
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+par_item_code+"']").attr("selected","true")
|
||||
// $("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// promotion_promotion_products_attributes_0_item_code
|
||||
@@ -394,8 +421,8 @@
|
||||
}
|
||||
$("select#"+id).append(itemlist);
|
||||
//$("select#"+id).select2();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<%= f.input :item_code,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :alt_name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"},:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"},:input_html => {:class => "col-md-9"}, include_blank: false, include_hidden: false %>
|
||||
<%= f.input :min_qty,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :account_id, :label => "Account type", :collection => Account.collection,:input_html => {:class => "col-md-9"} %>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<%= f.input :item_code,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :alt_name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"}, include_blank: false, include_hidden: false %>
|
||||
<%= f.input :min_qty,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :account_id, :label => "Account type", :collection => Account.collection,:input_html => {:class => "col-md-9"} %>
|
||||
|
||||
|
||||
@@ -107,7 +107,9 @@
|
||||
|
||||
<td><%= settings_menu_item.item_instance_code %></td>
|
||||
<td><%= settings_menu_item.item_instance_name %></td>
|
||||
<td><%= settings_menu_item.item_attributes %></td>
|
||||
<td>
|
||||
<%= MenuItemAttribute.where(id: settings_menu_item.item_attributes).pluck(:name) %>
|
||||
</td>
|
||||
<td><%= settings_menu_item.price %></td>
|
||||
<!-- <td><%= settings_menu_item.is_on_promotion %></td> -->
|
||||
<td><%= settings_menu_item.promotion_price %></td>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
|
||||
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
|
||||
<input type="text" id="receipt_no" name="receipt_no" class="form-control" placeholder="" style="margin-right: 10px">
|
||||
<input type="text" id="receipt_no" name="receipt_no" class="form-control" placeholder="Booking/Sale ID" style="margin-right: 10px">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||
<label class=""><%= t("views.right_panel.detail.from") %></label>
|
||||
|
||||
Reference in New Issue
Block a user