all items foc case fixed

This commit is contained in:
Zoey
2019-07-03 14:15:09 +06:30
parent 8a6b8dfa59
commit 569f074a4e
4 changed files with 25 additions and 25 deletions

View File

@@ -131,7 +131,7 @@ class Api::BillController < Api::ApiController
#member_info = Customer.get_member_account(customer)
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
# printer.print_receipt_bill(print_settings, false, nil,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
end
def request_bill

View File

@@ -51,7 +51,7 @@ class Oqs::PrintController < ApplicationController
ai.save
end
# 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,other_amount)
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
if ENV["SERVER_MODE"] == "cloud"
result = {
:filepath => filename,
@@ -119,7 +119,7 @@ class Oqs::PrintController < ApplicationController
ai.save
end
# 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,other_amount)
# filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_detail, "Frt",current_balance,nil,other_amount)
if ENV["SERVER_MODE"] == "cloud"
result = {
:filepath => filename,

View File

@@ -120,7 +120,7 @@ class Origami::RequestBillsController < ApplicationController
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
# printer.print_receipt_bill(print_settings, false, nil,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
end
end

View File

@@ -62,29 +62,29 @@ class SaleItem < ApplicationRecord
item.save
menu_category = MenuCategory.get_menu_category(item.product_code) #get menu category for menu items
sale_item = SaleItem.new
sale_item.menu_category_code = menu_category.code ? menu_category.code : nil
sale_item.menu_category_name = menu_category.name
sale_item.product_code = item.product_code
sale_item.item_instance_code = item.item_instance_code
sale_item.product_name = item.product_name + " (#{type.upcase})"
sale_item.product_alt_name = item.product_alt_name
sale_item.account_id = item.account_id
sale_item.status = type
sale_item.remark = type
if type == "foc" || type == "promotion" || type == "void" || type == "waste" || type == "spoile"
sale_item.qty = qty * (-1)
else
sale_item.qty = qty
end
# sale_item = SaleItem.new
# sale_item.menu_category_code = menu_category.code ? menu_category.code : nil
# sale_item.menu_category_name = menu_category.name
# sale_item.product_code = item.product_code
# sale_item.item_instance_code = item.item_instance_code
# sale_item.product_name = item.product_name + " (#{type.upcase})"
# sale_item.product_alt_name = item.product_alt_name
# sale_item.account_id = item.account_id
# sale_item.status = type
# sale_item.remark = type
# if type == "foc" || type == "promotion" || type == "void" || type == "waste" || type == "spoile"
# sale_item.qty = qty * (-1)
# else
# sale_item.qty = qty
# end
sale_item.unit_price = item_price # * (-1)
sale_item.taxable_price = (price) * (-1)
sale_item.price = (price) * (-1)
# sale_item.unit_price = item_price # * (-1)
# sale_item.taxable_price = (price) * (-1)
# sale_item.price = (price) * (-1)
sale_item.is_taxable = 1
sale_item.sale_id = sale_id
sale_item.save
# sale_item.is_taxable = 1
# sale_item.sale_id = sale_id
# sale_item.save
sale = Sale.find(sale_id)
sale.compute_by_sale_items(sale.id, sale.sale_items, sale.total_discount)
end