fixed confiixed for print
This commit is contained in:
@@ -96,6 +96,7 @@ class Ability
|
||||
can :read, Order
|
||||
can :update, Order
|
||||
can :menage, Booking
|
||||
can :manage, OrderQueueStation
|
||||
can :read, Sale
|
||||
can :update, Sale
|
||||
can :get_customer, Customer
|
||||
@@ -104,11 +105,11 @@ class Ability
|
||||
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
can :member_discount, :discount
|
||||
# can :index, :discount
|
||||
# can :create, :discount
|
||||
# can :remove_discount_items, :discount
|
||||
# can :remove_all_discount, :discount
|
||||
# can :member_discount, :discount
|
||||
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
|
||||
2
app/models/card_sale_tran.rb
Normal file
2
app/models/card_sale_tran.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class CardSaleTran < ApplicationRecord
|
||||
end
|
||||
2
app/models/card_settle_tran.rb
Normal file
2
app/models/card_settle_tran.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class CardSettleTran < ApplicationRecord
|
||||
end
|
||||
@@ -146,9 +146,10 @@ class Customer < ApplicationRecord
|
||||
if sale.customer.membership_id
|
||||
response = self.rebat(Sale.find(sale.sale_id))
|
||||
#record an payment in sale-audit
|
||||
if !response.nil?
|
||||
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.amount_received} "
|
||||
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
|
||||
|
||||
end
|
||||
if response["status"] == true
|
||||
status = sale.update_attributes(rebate_status: "true")
|
||||
end
|
||||
@@ -159,8 +160,9 @@ class Customer < ApplicationRecord
|
||||
def self.rebat(sObj)
|
||||
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
if generic_customer_id.present?
|
||||
|
||||
|
||||
if generic_customer_id.present?
|
||||
paypar = sObj.sale_payments
|
||||
payparcost = 0
|
||||
credit = 0
|
||||
@@ -171,6 +173,7 @@ class Customer < ApplicationRecord
|
||||
end
|
||||
if pp.payment_method == "creditnote"
|
||||
credit = 1
|
||||
sObj.update_attributes(rebate_status: nil)
|
||||
end
|
||||
end
|
||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||
@@ -287,6 +290,7 @@ class Customer < ApplicationRecord
|
||||
end
|
||||
end
|
||||
else
|
||||
puts "no Response"
|
||||
response = { "status": "no_member", "message": "Not membership"}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,6 +37,25 @@ class MenuCategory < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def valid_time
|
||||
|
||||
menu_category = MenuCategory.find(self.id)
|
||||
menu = Menu.find(menu_category.menu_id)
|
||||
from = menu.valid_time_from.strftime("%H:%M:%S")
|
||||
to = menu.valid_time_to.strftime("%H:%M:%S")
|
||||
current = Time.now.utc.getlocal.strftime("%H:%M:%S")
|
||||
|
||||
from = from.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
||||
to = to.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
||||
current = current.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b}
|
||||
|
||||
if current.between?(from, to)
|
||||
return true
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# def generate_menu_category_code
|
||||
|
||||
@@ -65,12 +65,12 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
end
|
||||
|
||||
#Bill Receipt Print
|
||||
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance)
|
||||
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance)
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data)
|
||||
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
|
||||
@@ -654,7 +654,7 @@ def self.get_item_query()
|
||||
query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " +
|
||||
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item,i.qty as qty," +
|
||||
"i.remark as status_type,"+
|
||||
" i.unit_price as unit_price,i.product_name as product_name, mc.name as" +
|
||||
" i.unit_price as unit_price,i.price as price,i.product_name as product_name, mc.name as" +
|
||||
" menu_category_name,mc.id as menu_category_id ")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
|
||||
@@ -1125,6 +1125,15 @@ end
|
||||
.sum("a.qty")
|
||||
end
|
||||
|
||||
#card sale trans data
|
||||
def self.getCardSaleTrans(sale_id)
|
||||
query = Sale.select("cst.res_date,cst.res_time,cst.trace,cst.pan,cst.batch_no,cst.exp_date,cst.app,cst.res_type,cst.ref_no,cst.terminal_id,cst.merchant_id,cst.app_code")
|
||||
.joins("JOIN card_sale_trans as cst on cst.sale_id = sales.sale_id")
|
||||
.where("sales.sale_id=? and status = 'Approved'",sale_id)
|
||||
|
||||
return query
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
Reference in New Issue
Block a user