api/bill_controller edited

This commit is contained in:
superuser
2017-06-30 19:29:09 +06:30
143 changed files with 3322 additions and 1499 deletions

View File

@@ -13,37 +13,54 @@ class Api::BillController < Api::ApiController
if booking
if booking.sale_id.nil?
@sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
else
@status = true
@sale_id = booking.sale_id
end
end
elsif (params[:order_id])
@sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
end
<<<<<<< HEAD
@sale_data = Sale.find_by_sale_id(@sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_id)
=======
unique_code = "ReceiptBillPdf"
#shop detail
shop_details = Shop.find(1)
# Not Use for these printed bill cannot give customer
# @sale_data = Sale.find_by_sale_id(@sale_id)
# @sale_items = SaleItem.where("sale_id=?",@sale_id)
# unique_code = "ReceiptBillPdf"
# #shop detail
# shop_details = Shop.find(1)
# customer= Customer.find(@sale_data.customer_id)
# # get member information
# member_info = Customer.get_member_account(customer)
# # get printer info
# print_settings=PrintSetting.find_by_unique_code(unique_code)
>>>>>>> 18094f5a71174d84305cfefd3a39db8123b65cff
# # Calculate Price by accounts
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
<<<<<<< HEAD
customer= Customer.find(@sale_data.customer_id)
# get member information
member_info = Customer.get_member_account(customer)
=======
>>>>>>> 18094f5a71174d84305cfefd3a39db8123b65cff
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# 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)
# Calculate Price by accounts
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
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)
end