update db index

This commit is contained in:
Aung Myo
2018-07-04 18:08:15 +06:30
parent bdd20f727e
commit 4f9a4e2984
7 changed files with 49 additions and 47 deletions

View File

@@ -44,11 +44,11 @@ class Origami::PaymentsController < BaseOrigamiController
end
#shop detail
shop_details = Shop.first
## shop_detail = Shop.first
# customer= Customer.where('customer_id=' +.customer_id)
customer = Customer.find(sale_data.customer_id)
# rounding adjustment
if shop_details.is_rounding_adj
if shop_detail.is_rounding_adj
a = sale_data.grand_total % 25 # Modulus
b = sale_data.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
@@ -79,7 +79,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil)
result = {
:filepath => filename,
@@ -102,9 +102,9 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
shop_details = Shop.first
#shop_detail = Shop.first
# rounding adjustment
if shop_details.is_rounding_adj
if shop_detail.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
@@ -123,16 +123,10 @@ class Origami::PaymentsController < BaseOrigamiController
rebate_amount = nil
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
# if bookings.count > 1
# # for Multiple Booking
# table = DiningFacility.find(bookings[0].dining_facility_id)
# else
# table = DiningFacility.find(bookings[0].dining_facility_id)
# end
if bookings[0].dining_facility_id.to_i > 0
table = DiningFacility.find(bookings[0].dining_facility_id)
# bookings = Booking.where("sale_id='#{sale_id}'")
bookings = Booking.find_by_sale_id(sale_id)
if bookings.dining_facility_id.to_i > 0
table = DiningFacility.find(bookings.dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
@@ -216,7 +210,7 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data)
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
@@ -255,7 +249,7 @@ class Origami::PaymentsController < BaseOrigamiController
if !@lookup_pdf.nil?
@pdf_view = @lookup_pdf.value
end
@shop = Shop.first #show shop info
@shop = shop_detail #show shop info
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
@@ -435,7 +429,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.first
#shop_detail = Shop.first
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
@@ -464,7 +458,7 @@ class Origami::PaymentsController < BaseOrigamiController
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data)
result = {
:status => true,
@@ -539,7 +533,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.first
#shop_detail = Shop.first
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
@@ -549,7 +543,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil)
result = {
:status => true,
:filepath => filename,
@@ -579,7 +573,7 @@ class Origami::PaymentsController < BaseOrigamiController
def rounding_adj
saleObj = Sale.find(params[:sale_id])
@shop = Shop.find_by_id(1)
@shop = shop_detail
if @shop.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus