Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm

This commit is contained in:
Aung Myo
2017-06-20 17:59:14 +06:30
29 changed files with 331 additions and 172 deletions

View File

@@ -122,11 +122,13 @@ $(document).ready(function(){
// Print Order Summary
$('#print_order_summary').on('click',function(){
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
var params = { 'table_name':table_name };
$.ajax({
type: 'GET',
url: '/oqs/print/print_order_summary/'+assigned_item_id,
data: params,
success: function(data){ }
});
});

View File

@@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() {
items.push($(value).attr("data-id"));
});
$("#order_queue_station_processing_items").val(items);
$("#order_queue_station_processing_items").val(JSON.stringify(items));
//$(this).submit();
})
})

View File

@@ -2,9 +2,9 @@ class Oqs::HomeController < BaseOqsController
def index
queue_stations=OrderQueueStation.all
@queue_items_details = queue_items_query(0)
@queue_items_details = queue_items_query(false)
@queue_completed_item = queue_items_query(1)
@queue_completed_item = queue_items_query(true)
@queue_stations_items=Array.new

View File

@@ -9,10 +9,13 @@ class Oqs::PrintController < ApplicationController
# order queue stations
oqs = assigned_item.order_queue_station
# Check Printed
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
# print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(oqs,assigned_item.order_id, assigned_item.item_code )
order_queue_printer.print_order_item(oqs, assigned_item.order_id, assigned_item.item_code, print_status )
# update print status for completed same order items
assigned_items.each do |ai|
@@ -21,20 +24,28 @@ class Oqs::PrintController < ApplicationController
end
end
# Print Order Details
# Print Order Details with booking id
def print_order_summary
unique_code="OrderSummaryPdf"
assigned_item_id=params[:id]
table_name=params[:table_name]
assigned_item=AssignedOrderItem.find(assigned_item_id)
assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
# order queue stations
oqs = assigned_item.order_queue_station
# Check Printed
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
# get dining
dining = DiningFacility.find_by_name(table_name);
booking = Booking.find_by_dining_facility_id(dining.id)
# print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_summary(oqs,assigned_item.order_id)
order_queue_printer.print_booking_summary(oqs, booking.booking_id, print_status)
# update print status for completed same order items
assigned_items.each do |ai|

View File

@@ -6,7 +6,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id)
# limit redeem_amount
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
nonrebate_prices = sale_data.total_amount - rebate_prices
@payparcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
@@ -16,11 +17,11 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
others = others + sale_payment.payment_amount
end
end
is_bervage_exceed = others - (beverage_prices + sale_data.total_tax)
if is_bervage_exceed < 0
@food_prices = food_prices - @payparcount
non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
if non_rebate_exceed < 0
@redeem_prices = rebate_prices - @payparcount
else
@food_prices = food_prices - @payparcount -is_bervage_exceed
@redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
end
if sale_data

View File

@@ -68,6 +68,6 @@ class Settings::AccountsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def account_params
params.require(:account).permit(:title, :account_type)
params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
end
end

View File

@@ -41,7 +41,7 @@ class Settings::OrderQueueStationsController < ApplicationController
# PATCH/PUT /settings/order_queue_stations/1
# PATCH/PUT /settings/order_queue_stations/1.json
def update
params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
# params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
respond_to do |format|
if @settings_order_queue_station.update(settings_order_queue_station_params)
format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }

View File

@@ -1,6 +1,6 @@
class Settings::RoomsController < ApplicationController
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy]
# GET /settings/rooms
# GET /settings/rooms.json
def index
@@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController
@settings_room = Room.new(settings_room_params)
@settings_room.type = DiningFacility::ROOM_TYPE
@settings_room.zone_id = params[:zone_id]
@settings_room.created_by = current_login_employee.name
respond_to do |format|
if @settings_room.save
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' }
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
format.json { render :show, status: :created, location: @settings_room }
else
puts "abc"
@@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController
# PATCH/PUT /settings/rooms/1
# PATCH/PUT /settings/rooms/1.json
def update
@settings_room.created_by = current_login_employee.name
respond_to do |format|
if @settings_room.update(settings_room_params)
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' }
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_room }
else
format.html { render :edit }
@@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController
def destroy
@settings_room.destroy
respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' }
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' }
format.json { head :no_content }
end
end

View File

@@ -28,12 +28,12 @@ class Settings::TablesController < ApplicationController
@settings_table = Table.new(settings_table_params)
@settings_table.type = DiningFacility::TABLE_TYPE
@settings_table.zone_id = params[:zone_id]
@settings_table.created_by = current_login_employee.name
respond_to do |format|
if @settings_table.save
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully created.' }
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully created.' }
format.json { render :show, status: :created, location: @settings_table }
else
puts "abc"
format.html { render :new }
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
end
@@ -43,9 +43,10 @@ class Settings::TablesController < ApplicationController
# PATCH/PUT /settings/tables/1
# PATCH/PUT /settings/tables/1.json
def update
@settings_table.created_by = current_login_employee.name
respond_to do |format|
if @settings_table.update(settings_table_params)
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully updated.' }
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_table }
else
format.html { render :edit }
@@ -59,7 +60,7 @@ class Settings::TablesController < ApplicationController
def destroy
@settings_table.destroy
respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Table was successfully destroyed.' }
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' }
format.json { head :no_content }
end
end

View File

@@ -27,7 +27,7 @@ class Settings::ZonesController < ApplicationController
# POST /settings/zones.json
def create
@settings_zone = Zone.new(settings_zone_params)
@settings_zone.created_by = current_login_employee.name
respond_to do |format|
if @settings_zone.save
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
@@ -43,6 +43,7 @@ class Settings::ZonesController < ApplicationController
# PATCH/PUT /settings/zones/1.json
def update
respond_to do |format|
@settings_zone.created_by = current_login_employee.name
if @settings_zone.update(settings_zone_params)
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_zone }
@@ -56,6 +57,8 @@ class Settings::ZonesController < ApplicationController
# DELETE /settings/zones/1
# DELETE /settings/zones/1.json
def destroy
@settings_zone.rooms.destroy
@settings_zone.tables.destroy
@settings_zone.destroy
respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }

View File

@@ -16,6 +16,10 @@ class OrderQueueStation < ApplicationRecord
oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
order_items = order.order_items
# get dining
booking = Booking.find_by_dining_facility_id(dining.id)
#Assign OQS id to order Items
oqs_stations.each do |oqs|
#Get List of items -
@@ -26,29 +30,53 @@ class OrderQueueStation < ApplicationRecord
#Processing through the looping items
order_items.each do |order_item|
if (pq_item == order_item.item_code)
if oqs.id == oqpbz.order_queue_station_id
#Same Order_items can appear in two location.
# if oqs.id == oqpbz.order_queue_station_id
# #Same Order_items can appear in two location.
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
# else
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
else
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
end
# end
if oqs.auto_print
print_slip(oqs, order, order_items)
end
end
end
end
end
#Print OQS where printing is require
end
private
#Print order_items in 1 slip
def print_slip
def print_slip(oqs, order, order_items)
unique_code="OrderSummaryPdf"
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_summary(oqs,order.order_id, print_status="")
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
# update print status for order items
ai.print_status=true
ai.save
end
end
#Print order_items in 1 slip per item
def print_slip_item
#Print order_item in 1 slip per item
def print_slip_item(oqs, assigned_order_item)
unique_code="OrderItemPdf"
# print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(oqs,item.order_id, item.item_code, print_status="" )
# update print status for completed same order items
assigned_order_item.each do |ai|
ai.print_status=true
ai.save
end
end
end

View File

@@ -1,66 +1,128 @@
class Printer::OrderQueuePrinter < Printer::PrinterWorker
def print_order_item(oqs,order_id, item_code)
def print_order_item(oqs,order_id, item_code, print_status)
#Use CUPS service
#Generate PDF
#Print
order_item= print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
pdf = OrderItemPdf.new(order_item[0])
pdf.render_file "tmp/receipt.pdf"
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf"
pdf = OrderItemPdf.new(order_item[0], print_status)
pdf.render_file filename
if oqs.print_copy
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print("tmp/receipt.pdf", 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
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
end
end
def print_order_summary(oqs,order_id)
# Query for per order
def print_order_summary(oqs, order_id, print_status)
#Use CUPS service
#Generate PDF
#Print
order=print_query('order_summary',order_id)
#Print
order=print_query('order_summary', order_id)
# For Print Per Item
if oqs.cut_per_item
order.each do|odi|
pdf = OrderItemPdf.new(odi)
pdf.render_file "tmp/receipt.pdf"
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
pdf = OrderItemPdf.new(odi, print_status)
# pdf.render_file "tmp/order_item.pdf"
pdf.render_file filename
if oqs.print_copy
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print("tmp/receipt.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
end
end
# For Print Order Summary
else
filename = "tmp/order_summary_#{order_id}" + ".pdf"
pdf = OrderSummaryPdf.new(order)
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
pdf = OrderSummaryPdf.new(order, print_status)
pdf.render_file filename
self.print(filename, oqs.printer_name)
if oqs.print_copy
self.print(filename, oqs.printer_name)
#For print copy
pdf.render_file filename.gsub(".","-copy.")
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print(filename, oqs.printer_name)
end
end
end
# Print for orders in booking
def print_booking_summary(oqs, booking_id, print_status)
order=print_query('booking_summary', booking_id)
# For Print Per Item
if oqs.cut_per_item
order.each do|odi|
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
pdf = OrderItemPdf.new(odi, print_status)
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
#For print copy
pdf.render_file filename.gsub(".","-copy.")
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print(filename, oqs.printer_name)
end
end
# For Print Order Summary
else
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
pdf = OrderSummaryPdf.new(order, print_status)
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
#For print copy
pdf.render_file filename.gsub(".","-copy.")
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print(filename, oqs.printer_name)
end
end
end
# Query for OQS with status
def print_query(type, code)
if type == 'order_item'
def print_query(type, id)
if type == "order_item"
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
.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 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 customers as cus ON cus.customer_id = orders.customer_id")
.where("order_items.item_code='" + code + "'")
.where("order_items.item_code = '#{ id }'")
.group("order_items.item_code")
else
elsif type == "order_summary"
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
.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 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 customers as cus ON cus.customer_id = orders.customer_id")
.where("orders.order_id='" + code + "'")
.group("order_items.item_code")
.where("orders.order_id = '#{ id }'")
else
# order summary for booking
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
.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 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 customers as cus ON cus.customer_id = orders.customer_id")
.where("b.booking_id = '#{ id }'")
end
end

View File

@@ -32,48 +32,49 @@ class SaleItem < ApplicationRecord
# Calculate food total and beverage total
def self.calculate_food_beverage(sale_items)
food_prices=0
beverage_prices=0
sale_items.each do |si|
food_price, beverage_price = self.get_price(si.sale_item_id)
food_prices = food_prices + food_price
beverage_prices = beverage_prices + beverage_price
rebateacc = Account.where("rebate=?",true)
puts "Account that can rebate"
rebateacc.each do |i|
puts i.title
end
puts food_prices
puts beverage_prices
return food_prices, beverage_prices
prices=0
sale_items.each do |si|
price = self.get_price(si.sale_item_id,rebateacc)
prices = prices + price
end
return prices
end
# get food price or beverage price for item
def self.get_price(sale_item_id)
food_price=0
beverage_price=0
def self.get_price(sale_item_id,rebateacc)
price=0
item=SaleItem.select("sale_items.price , menu_items.account_id")
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
.where("sale_items.sale_item_id=?", sale_item_id.to_s)
if item[0].account_id == 1
food_price = item[0].price
else
beverage_price = item[0].price
end
return food_price, beverage_price
end
def self.get_overall_discount(sale_id)
price = 0.0
item=SaleItem.where("product_code=?", sale_id)
item.each do|i|
price += i.price
rebateacc.each do |i|
if item[0].account_id == i.id
price = item[0].price
end
end
return price
end
# def self.get_overall_discount(sale_id)
# price = 0.0
# item=SaleItem.where("product_code=?", sale_id)
#
# item.each do|i|
# price += i.price
# end
#
# return price
# end
private
def generate_custom_id
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")

View File

@@ -258,7 +258,9 @@ class SalePayment < ApplicationRecord
end
def rebat(sObj)
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
rebate_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
puts "rebate_prices"
puts rebate_prices
generic_customer_id = sObj.customer.membership_id
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
paypar = sObj.sale_payments
@@ -268,12 +270,10 @@ class SalePayment < ApplicationRecord
payparcost = payparcost + pp.payment_amount
end
end
overall_dis = SaleItem.get_overall_discount(sObj.id)
total_amount = food_prices - payparcost + overall_dis
puts "total_amount"
puts food_prices
puts payparcost
puts total_amount
# overall_dis = SaleItem.get_overall_discount(sObj.id)
overall_dis = sObj.total_discount
total_amount = rebate_prices - payparcost + overall_dis
if total_amount > 0
receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url")

View File

@@ -1,16 +1,16 @@
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
def initialize(order_item)
self.page_width = 254
self.page_height = 1450
self.margin = 10
def initialize(order_item, print_status)
self.page_width = 210
self.page_height = 2500
self.margin = 5
self.price_width = 40 # No Need for item
self.qty_width = 34
self.qty_width = 30
self.total_width = 40 # No Need for item
self.item_width = self.page_width - (self.qty_width + (self.margin*4))
self.item_width = self.page_width - self.qty_width
self.item_height = 15
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=80
self.label_width=100
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
@@ -19,9 +19,9 @@ class OrderItemPdf < Prawn::Document
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
self.header_font_size = 14
self.item_font_size = 12
self.item_font_size = 12
text "#{order_item.dining}", :size => self.header_font_size,:align => :center, :left_margin => -20
text "#{ order_item.dining+print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
stroke_horizontal_rule
move_down 5
@@ -71,7 +71,7 @@ class OrderItemPdf < Prawn::Document
add_order_items(order_item)
dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, self.page_width
stroke_horizontal_line 0, (self.page_width - self.margin)
move_down 5
end

View File

@@ -1,13 +1,13 @@
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
def initialize(order)
self.page_width = 254
self.page_height = 1450
self.margin = 10
def initialize(order, print_status)
self.page_width = 210
self.page_height = 2500
self.margin = 5
self.price_width = 40 # No Need for item
self.qty_width = 34
self.qty_width = 30
self.total_width = 40 # No Need for item
self.item_width = self.page_width - (self.qty_width + (self.margin*4))
self.item_width = self.page_width - (self.qty_width - self.margin)
self.item_height = 15
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=100
@@ -20,7 +20,7 @@ class OrderSummaryPdf < Prawn::Document
self.header_font_size = 12
self.item_font_size = 10
text "#{order[0].dining}", :size => self.header_font_size,:align => :center, :left_margin => -20
text "#{ order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
stroke_horizontal_rule
move_down 5
@@ -59,7 +59,7 @@ class OrderSummaryPdf < Prawn::Document
text "Item", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
bounding_box([self.item_width-2,y_position], :width => self.qty_width, :height => self.item_height) do
text "Qty", :size => self.item_font_size,:align => :left
end
@@ -77,16 +77,22 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
order_item.each do|odi|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
y_position = cursor
# pad_top(15) {
# text_box "#{odi.item_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
# text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
# }
bounding_box([0,y_position], :width => self.item_width) do
text "#{odi.item_name}", :size => self.item_font_size,:align => :left, :height => self.item_height
end
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left
bounding_box([self.item_width,y_position], :width => self.qty_width) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left, :height => self.item_height
end
end
move_down 5
move_down 5
end
end
end

View File

@@ -23,6 +23,8 @@
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
<hr>
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
</ul>
</li>

View File

@@ -49,7 +49,10 @@
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<!--
Item Options
<p class="card-text">Medium, Fries, Salad</p>
-->
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
@@ -97,7 +100,10 @@
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<!--
Item Options
<p class="card-text">Medium, Fries, Salad</p>
-->
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">

View File

@@ -6,7 +6,7 @@
<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 redeem upto </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @food_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div>
<hr>
</div>
@@ -38,10 +38,10 @@
<!-- <% if @payparcount > 0 %>
<p class="">Last time rebate amount is <%= @payparcount %></p>
<% end %>
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p> -->
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @redeem_prices %></span></p> -->
</div>
<div class="col-lg-7 col-md-7 col-sm-7">
<div class="col-lg-6 col-md-7 col-sm-7">
<div class="row">
<div class="col-lg-6 col-md-1 col-sm-1">
@@ -84,9 +84,15 @@
<div class="pay purple" id="redeem">Pay</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
</div>
</div>
<div class="row">
@@ -145,7 +151,7 @@ $("#redeem").click(function(){
}else if(valid_amount< redeem_amount){
alert(" Insufficient Amount!")
}else{
if(redeem_amount <= "<%= @food_prices %>"){
if(redeem_amount <= "<%= @redeem_prices %>"){
$.ajax({
type: "POST",
url: "<%=origami_payment_paypar_path%>",

View File

@@ -4,11 +4,14 @@
<div class="form-inputs">
<%= f.input :title %>
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
<%= f.input :discount %>
<%= f.input :point %>
<%= f.input :bonus %>
<%= f.input :rebate %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
<% end %>

View File

@@ -14,9 +14,14 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width:40%">Title</th>
<th style="width:40%">Account Type</th>
<th style="width:20%">Action</th>
<th>Title</th>
<th>Account Type</th>
<th>Can get Discount</th>
<th>Can get Points</th>
<th>Can get Bonus</th>
<th>Can rebate</th>
<th style="">Action</th>
</tr>
</thead>
@@ -25,10 +30,14 @@
<tr>
<td><%= account.title %></td>
<td><%= account.account_type %></td>
<td><%= account.discount %></td>
<td><%= account.point %></td>
<td><%= account.bonus %></td>
<td><%= account.rebate %></td>
<td>
<%= link_to 'Edit', edit_settings_account_path(account) %> |
<%= link_to 'Edit', edit_settings_account_path(account) %> |
<%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>

View File

@@ -17,6 +17,10 @@
<tr>
<th>Title</th>
<th>Account type</th>
<th>Can get Discount</th>
<th>Can get Points</th>
<th>Can get Bonus</th>
<th>Can rebate</th>
<th>Action</th>
</tr>
</thead>
@@ -25,10 +29,14 @@
<tr>
<td><%= @settings_account.title %></td>
<td><%= @settings_account.account_type %></td>
<td><%= @settings_account.discount %></td>
<td><%= @settings_account.point %></td>
<td><%= @settings_account.bonus %></td>
<td><%= @settings_account.rebate %></td>
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -9,7 +9,6 @@
<%= f.input :auth_token %>
<%= f.input :merchant_account_id %>
<%= f.input :created_by %>
<%= f.input :additional_parameter %>
</div>
<div class="form-actions">

View File

@@ -1,41 +1,47 @@
<p id="notice"><%= notice %></p>
<h1>Settings Membership Actions</h1>
<table>
<thead>
<tr>
<th>Membership type</th>
<th>Is active</th>
<th>Gateway communication type</th>
<th>Gateway url</th>
<th>Auth token</th>
<th>Merchant account</th>
<th>Created by</th>
<th>Additional parameter</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @settings_membership_actions.each do |settings_membership_action| %>
<tr>
<td><%= settings_membership_action.membership_type %></td>
<td><%= settings_membership_action.is_active %></td>
<td><%= settings_membership_action.gateway_communication_type %></td>
<td><%= settings_membership_action.gateway_url %></td>
<td><%= settings_membership_action.auth_token %></td>
<td><%= settings_membership_action.merchant_account_id %></td>
<td><%= settings_membership_action.created_by %></td>
<td><%= settings_membership_action.additional_parameter %></td>
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Settings Membership Actions</li>
<span style="float: right">
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Membership type</th>
<th>Is active</th>
<th>Gateway communication type</th>
<th>Gateway url</th>
<th>Auth token</th>
<th>Merchant account</th>
<th>Created by</th>
<th>Additional parameter</th>
<th colspan="3"></th>
</tr>
</thead>
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path %>
<tbody>
<% @settings_membership_actions.each do |settings_membership_action| %>
<tr>
<td><%= settings_membership_action.membership_type %></td>
<td><%= settings_membership_action.is_active %></td>
<td><%= settings_membership_action.gateway_communication_type %></td>
<td><%= settings_membership_action.gateway_url %></td>
<td><%= settings_membership_action.auth_token %></td>
<td><%= settings_membership_action.merchant_account_id %></td>
<td><%= settings_membership_action.created_by %></td>
<td><%= settings_membership_action.additional_parameter %></td>
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -13,6 +13,7 @@ div.form-inputs span{
<%= f.input :printer_name %>
<%= f.input :font_size %>
<%= f.input :print_copy %>
<%= f.hidden_field :processing_items %>
<%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'ta'%>
<%= f.input :cut_per_item %>

View File

@@ -7,7 +7,6 @@
<%= f.input :seater %>
<%= f.input :order_by %>
<%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
</div>
<div class="form-actions">

View File

@@ -7,7 +7,6 @@
<%= f.input :seater %>
<%= f.input :order_by %>
<%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
</div>
<div class="form-actions">

View File

@@ -4,7 +4,7 @@
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
<!-- <%= f.input :created_by, :collection => Employee.collection %> -->
</div>
<div class="form-actions">

View File

@@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1]
create_table :accounts do |t|
t.string :title
t.string :account_type
t.boolean :discount, :null => false, :default => false
t.boolean :point, :null => false, :default => false
t.boolean :bonus, :null => false, :default => false
t.boolean :rebate, :null => false, :default => false
t.timestamps
end