edit for shop_code query

This commit is contained in:
Thein Lin Kyaw
2020-01-13 15:28:26 +06:30
parent bad46cf02c
commit d379c05298
32 changed files with 58 additions and 115 deletions

View File

@@ -62,13 +62,13 @@ class Api::OrdersController < Api::ApiController
def create
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
@shop = Shop.find_by_shop_code(params[:shop_code])
current_shift = ShiftSale.current_shift
if current_shift.nil?
@status = false
@message = "No Current Open Shift for This Employee"
else
current_user =Employee.find(current_shift.employee_id)
current_user = Employee.find(current_shift.employee_id)
if checkin_checkout_time(params[:booking_id])
table = DiningFacility.find(params[:table_id]) if params[:table_id].present?

View File

@@ -27,11 +27,10 @@ class Api::PaymentsController < Api::ApiController
if !sale.nil?
sale_id =sale.sale_id
sale_items = SaleItem.get_all_sale_items(sale_id)
@shop =Shop.find_by_shop_code(sale.shop_code)
if sale.sale_status == "new"
if !params[:card_no].empty?
current_shift = ShiftSale.current_shift
current_login_employee =Employee.find(current_shift.employee_id)
current_login_employee = Employee.find(current_shift.employee_id)
@status, @message = send_account_paymal(sale.grand_total, params[:card_no], sale.receipt_no,current_login_employee)
if @status
sale_payment = SalePayment.new
@@ -192,9 +191,9 @@ class Api::PaymentsController < Api::ApiController
action_by = current_login_employee.name
@status = true
@message = ""
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sale.shop_code)
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type_and_shop_code("get_account_balance",sale.shop_code)
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url
@campaign_type_id = nil
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s

View File

@@ -48,7 +48,6 @@ class Crm::CustomersController < BaseCrmController
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.shop_code = @shop.shop_code
@crm_customers.save
@crm_customers = Customer.search(filter)
flash[:member_notice]='Customer was successfully created.'
@@ -263,7 +262,6 @@ class Crm::CustomersController < BaseCrmController
if @checked_contact.nil?
respond_to do |format|
@crm_customers = Customer.new(customer_params)
@crm_customers.shop_code = @shop.shop_code
if @crm_customers.save
# update tax profile
customer = Customer.find(@crm_customers.customer_id)

View File

@@ -87,8 +87,9 @@ class Foodcourt::CustomersController < BaseFoodcourtController
@count_customer = Customer.count_customer
# @taxes = TaxProfile.where(:group_type => 'cashier')
@taxes = TaxProfile.unscoped.select("id, (CONCAT(name,'(',(SELECT name FROM lookups WHERE lookup_type='tax_profiles' AND value=group_type),')')) as name")
.order("group_type ASC,order_by ASC")
@taxes = TaxProfile.unscope(:order).select("tax_profiles.id, CONCAT(tax_profiles.name, '(', lookups.name, ')') as name")
.joins(:lookup)
.order("group_type ASC, order_by ASC")
# if flash["errors"]
# @crm_customer.valid?
# end

View File

@@ -118,7 +118,7 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
sale.compute_by_sale_items(sale.total_discount, nil, order_source)
ProductCommission.edit_product_commission(saleitemObj,sale.shop_code)
ProductCommission.edit_product_commission(saleitemObj)
end
# make cancel void item

View File

@@ -92,7 +92,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
sale_items = ''
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value
if @lookup.to_i == 1
@sale_items = Sale.get_shift_sale_items(@shift.id)
other_charges = Sale.get_other_charges()

View File

@@ -91,7 +91,6 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
format.json { head :no_content }
end
# inventory = InventoryDefinition.find_by_id_and_shop_code(params[:id],@shop.shop_code)
StockJournal.delete_stock_journal(inventory.item_code,@shop)
StockCheckItem.delete_stock_check_item(inventory.item_code,@shop)
if !inventory.nil?

View File

@@ -87,8 +87,9 @@ class Origami::CustomersController < BaseOrigamiController
@count_customer = Customer.count_customer
# @taxes = TaxProfile.where(:group_type => 'cashier')
@taxes = TaxProfile.unscope(:order).select("id, (CONCAT(name,'(',(SELECT name FROM lookups WHERE lookup_type='tax_profiles' AND value=group_type),')')) as name")
.order("group_type ASC,order_by ASC")
@taxes = TaxProfile.unscope(:order).select("tax_profiles.id, CONCAT(tax_profiles.name, '(', lookups.name, ')') as name")
.joins(:lookup)
.order("group_type ASC, order_by ASC")
# if flash["errors"]
# @crm_customer.valid?
# end

View File

@@ -65,7 +65,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
end
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal, sale_items, sale_data, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, @shop, "Frt", current_balance, nil, other_amount, nil, nil, nil)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal, sale_items, sale_data, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, nil, @shop, "Frt", current_balance, nil, other_amount, nil, nil, nil)
result = {
:filepath => filename,
@@ -202,7 +202,7 @@ class Origami::PaymentsController < BaseOrigamiController
other_amount = SaleItem.calculate_other_charges(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal, sale_items, saleObj, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, @shop, "Paid", current_balance, card_data, other_amount, latest_order_no, card_balance_amount, nil)
#end
end

View File

@@ -163,7 +163,7 @@ class Origami::SaleEditController < BaseOrigamiController
# end
# end
ProductCommission.edit_product_commission(saleitemObj,sale.shop_code)
ProductCommission.edit_product_commission(saleitemObj)
end
# make cancel void item

View File

@@ -91,7 +91,7 @@ class Origami::ShiftsController < BaseOrigamiController
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
sale_items = ''
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value
if @lookup.to_i == 1
@sale_items = Sale.get_shift_sale_items(@shift.id)
other_charges = Sale.get_other_charges()

View File

@@ -11,7 +11,7 @@ class PrintSettingsController < ApplicationController
# GET /print_settings/1
# GET /print_settings/1.json
def show
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value
end
# GET /print_settings/new
@@ -22,7 +22,7 @@ class PrintSettingsController < ApplicationController
# GET /print_settings/1/edit
def edit
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value
@server_mode = ENV["SERVER_MODE"]
end
@@ -48,7 +48,7 @@ class PrintSettingsController < ApplicationController
respond_to do |format|
if @print_setting.update(print_setting_params)
if @print_setting.unique_code == 'CloseCashierPdf'
Lookup.save_shift_sale_items_settings(params[:shift_sale_items],@shop.shop_code)
Lookup.save_shift_sale_items_settings(params[:shift_sale_items])
end
format.html { redirect_to @print_setting, notice: 'Print setting was successfully updated.' }

View File

@@ -19,7 +19,7 @@ class Reports::IndutyController < BaseReportController
end
@commissioner = params[:commissioner]
@induty_data = InDuty.get_induty_by_shift(@shift_sale_range,@shift,from,to,@commissioner).where("sales.shop_code='#{@shop.shop_code}'")
@induty_data = InDuty.get_induty_by_shift(@shift_sale_range,@shift,from,to,@commissioner)
@from = from
@to = to

View File

@@ -27,7 +27,7 @@ class Reports::OrderReservationController < BaseReportController
provider = params[:provider]
payment_type = params[:payment_type]
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider,payment_type)
@from = from
@to = to
# get printer info
@@ -49,7 +49,7 @@ class Reports::OrderReservationController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -9,7 +9,7 @@ class Reports::PaymentMethodController < BaseReportController
from, to = get_date_range_from_params
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift = ''
if params[:shift_name].to_i != 0
@@ -43,7 +43,7 @@ class Reports::PaymentMethodController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -10,7 +10,7 @@ authorize_resource :class => false
@shift = ''
if params[:shift_name].to_i != 0
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@@ -26,12 +26,12 @@ authorize_resource :class => false
@lookup = Lookup.find_by_lookup_type('reprint_receipt')
if @lookup.nil?
@lookup = Lookup.create_reprint_receipt_lookup(@shop.shop_code)
@lookup = Lookup.create_reprint_receipt_lookup
end
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@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.group('name').order('order_by asc') #.limit(2)
@from = from
@@ -55,7 +55,7 @@ authorize_resource :class => false
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -26,7 +26,7 @@ authorize_resource :class => false
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type)
@from = from
@@ -50,7 +50,7 @@ authorize_resource :class => false
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -9,7 +9,7 @@ class Reports::SaleitemController < BaseReportController
shift = ''
if params[:shift_name].to_i != 0
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@@ -27,7 +27,7 @@ class Reports::SaleitemController < BaseReportController
@type = params[:sale_type]
@sale_data, @other_charges,@product, @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,@type,account_type,@shop.shop_code)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
@@ -60,7 +60,7 @@ class Reports::SaleitemController < BaseReportController
def show
from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -29,7 +29,7 @@ class Reports::ShiftsaleController < BaseReportController
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|
@@ -77,7 +77,7 @@ class Reports::ShiftsaleController < BaseReportController
shop_details = shop_detail
cashier_terminal = @shift.cashier_terminal
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card

View File

@@ -34,7 +34,7 @@ class Reports::StaffMealController < BaseReportController
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_staff_meal_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,account_type,customer_id,@shop.shop_code)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}

View File

@@ -29,7 +29,7 @@ class Reports::StockCheckController < BaseReportController
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -39,7 +39,7 @@ authorize_resource :class => false
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -4,7 +4,7 @@ authorize_resource :class => false
from, to = get_date_range_from_params
@sale_type = params[:sale_type]
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'")
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type)
@from = from
@to = to
# get printer info

View File

@@ -38,7 +38,7 @@ class Transactions::ShiftSalesController < ApplicationController
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)

View File

@@ -43,7 +43,7 @@ class Employee < ApplicationRecord
if (session_token)
user = Employee.find_by_token_session(session_token)
expiry_time = login_expiry_time
if !user.session_expiry.nil?
if user && !user.session_expiry.nil?
if user && user.session_expiry.utc > DateTime.now.utc
#Extend the login time each time authenticatation take place
user.session_expiry = user.session_expiry.utc + expiry_time.minutes

View File

@@ -1,7 +1,6 @@
class Lookup < ApplicationRecord
has_many :accounts
belongs_to :shop
scope :number_formats, -> { where(lookup_type: 'number_format')}
@@ -26,12 +25,10 @@ class Lookup < ApplicationRecord
# Lookup.select("value, name").where("lookup_type = ?", lookup_type ).order("name asc").map { |r| [r.name, r.value] }
# end
def self.time_limit
TIME_LIMIT
end
def self.get_checkin_time_limit
return RequestStore[:checkin_time_limit] if RequestStore[:checkin_time_limit]
RequestStore[:checkin_time_limit] = Lookup.find_by_lookup_type('checkin_time_limit').value.to_i rescue time_limit
@@ -63,41 +60,39 @@ class Lookup < ApplicationRecord
Lookup.where("lookup_type" => type ).pluck("name, value")
end
def self.create_shift_sale_lookup(shop_code)
def self.create_shift_sale_lookup
@lookup = Lookup.new
@lookup.lookup_type = 'shift_sale_items'
@lookup.name = 'Shift Sale Items'
@lookup.value = 0
@lookup.shop_code = shop_code
@lookup.save
return @lookup
end
def self.create_reprint_receipt_lookup(shop_code)
def self.create_reprint_receipt_lookup
@lookup = Lookup.new
@lookup.lookup_type = 'reprint_receipt'
@lookup.name = 'Reprint Receipt in Report'
@lookup.value = 0
@lookup.shop_code = shop_code
@lookup.save
return @lookup
end
def self.save_shift_sale_items_settings(val,shop_code)
def self.save_shift_sale_items_settings(val)
@lookup = Lookup.where("lookup_type=?", 'shift_sale_items').last
if @lookup.nil?
@lookup = Lookup.create_shift_sale_lookup(shop_code)
@lookup = Lookup.create_shift_sale_lookup
end
@lookup.value = val
@lookup.save
end
def self.shift_sale_items_lookup_value(shop_code)
def self.shift_sale_items_lookup_value
@lookup = Lookup.where("lookup_type=?", 'shift_sale_items').last
if @lookup.nil?
@lookup = Lookup.create_shift_sale_lookup(shop_code)
@lookup = Lookup.create_shift_sale_lookup
end
return @lookup.value
end

View File

@@ -90,20 +90,20 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
#Bill Receipt Print
def print_receipt_bill(printer_settings, kbz_pay_status, qr_code, 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,other_amount,latest_order_no,card_balance_amount,order_reservation,transaction_ref)
def print_receipt_bill(printer_settings, kbz_pay_status, qr_code, cashier_terminal, 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, other_amount, latest_order_no, card_balance_amount, order_reservation = nil, transaction_ref = nil)
#Use CUPS service
#Generate PDF
#Print
if printer_settings
if !printer_settings.unique_code.match?(/receiptbillorder/i)
if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf
pdf = ReceiptBillA5Pdf.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,other_amount,latest_order_no,card_balance_amount)
pdf = ReceiptBillA5Pdf.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, other_amount, latest_order_no, card_balance_amount)
else
pdf = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first.unique_code.constantize.new(printer_settings, kbz_pay_status, qr_code, 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,other_amount,latest_order_no,card_balance_amount)
pdf = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first.unique_code.constantize.new(printer_settings, kbz_pay_status, qr_code, 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, other_amount, latest_order_no, card_balance_amount, transaction_ref)
end
else
#doemal online order pdf template
pdf = ReceiptBillOrderPdf.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,other_amount,latest_order_no,card_balance_amount,order_reservation)
pdf = ReceiptBillOrderPdf.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,other_amount,latest_order_no,card_balance_amount,order_reservation)
end
# print as print copies in printer setting

View File

@@ -33,7 +33,7 @@ class ProductCommission < ApplicationRecord
product_commission.save
end
def self.edit_product_commission(saleItemObj,shop_code)
def self.edit_product_commission(saleItemObj)
menu_item = MenuItem.find_by_item_code(saleItemObj.product_code)
commission = Commission.where("product_code = ? AND is_active = ?", menu_item.id, true).take
product_commission = ProductCommission.where('sale_item_id = ?', saleItemObj.id).take

View File

@@ -705,7 +705,7 @@ class SalePayment < ApplicationRecord
self.sale.cashier_name = Employee.find(shift.employee_id).name
self.sale.save
else
shift = ShiftSale.current_shift(self.sale.shop_code)
shift = ShiftSale.current_shift
shift.update(self.sale)
self.sale.shift_sale_id = shift.id
self.sale.cashier_id = shift.employee_id

View File

@@ -5,7 +5,7 @@ class ReceiptBillPdf < 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, :description_width, :price_num_width, :line_move
def initialize(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_account, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil, shop_details, printed_status, current_balance, card_data, other_charges_amount, latest_order_no, card_balance_amount, transaction_ref)
def initialize(printer_settings, kbz_pay_status, qr_code, sale_items, sale_data, customer_account, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, shop_details, printed_status, current_balance, card_data, other_charges_amount, latest_order_no, card_balance_amount, transaction_ref = nil)
self.page_width = printer_settings.page_width
self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i
@@ -72,8 +72,7 @@ class ReceiptBillPdf < Prawn::Document
else
customer(customer_account,nil)
end
puts "Card data = >" +card_data
puts "Printed =>" + printed_status
#start card sale trans data
if card_data != nil
card_sale_data(card_data)
@@ -693,7 +692,7 @@ class ReceiptBillPdf < Prawn::Document
query = sale_data.sale_payments
.merge(SalePayment.where.not(payment_method: 'creditnote')
.or(SalePayment.where.not(SalePayment.arel_table[:payment_amount].lteq(sale_data.sale_payments.joins(:sale_audit).sum(:payment_amount)))))
query.each do |payment|
if payment.payment_method == "creditnote"

View File

@@ -1,21 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDaDCCAlACCQCMa8dYfX0ohTANBgkqhkiG9w0BAQsFADB2MQswCQYDVQQGEwJZ
RzELMAkGA1UECAwCWUcxCzAJBgNVBAcMAllHMQwwCgYDVQQKDANDMkwxCjAIBgNV
BAsMATMxCzAJBgNVBAMMAlNYMSYwJAYJKoZIhvcNAQkBFhdud2VuaS5hdW5nQGNv
ZGUybGFiLmNvbTAeFw0xOTExMjYwNTM0NTNaFw0yMDExMjUwNTM0NTNaMHYxCzAJ
BgNVBAYTAllHMQswCQYDVQQIDAJZRzELMAkGA1UEBwwCWUcxDDAKBgNVBAoMA0My
TDEKMAgGA1UECwwBMzELMAkGA1UEAwwCU1gxJjAkBgkqhkiG9w0BCQEWF253ZW5p
LmF1bmdAY29kZTJsYWIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
AQEAzjshIBw0Dnv4nFxBBtDd6TbcIR9GGndM7aKOr8yZBv7qKiRoFr9vtT/M1JZh
MO2G0DxvH9BjR1oVWNuAOBx7JUf9wweZ0ntaYT+kPen66LqTn5gFfCAJ+EAzIvaq
s2zlWB8Opl1kahW3LDLngmJGQPBTXO5UVfZHcxgyEGa4b+KdG9s8xq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