Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm

This commit is contained in:
Aung Myo
2017-06-29 15:42:45 +06:30
38 changed files with 878 additions and 186 deletions

View File

@@ -0,0 +1,15 @@
class Origami::CashInsController < BaseOrigamiController
def new
end
def create
reference = params[:reference]
remark = params[:remark]
amount = params[:amount]
payment_method = params[:payment_method]
payment_method_reference = params[:payment_method_reference]
p_jour = PaymentJournal.new
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
end
end

View File

@@ -0,0 +1,13 @@
class Origami::CashOutsController < BaseOrigamiController
def new
end
def create
reference = params[:reference]
remark = params[:remark]
amount = params[:amount]
p_jour = PaymentJournal.new
p_jour.cash_out(reference, remark, amount, current_user.id)
end
end

View File

@@ -6,6 +6,7 @@ class Origami::HomeController < BaseOrigamiController
@rooms = Room.all.active.order('status desc')
@complete = Sale.all
@orders = Order.all.order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id)
end
# origami table detail

View File

@@ -19,9 +19,9 @@ class Origami::HomeController < BaseOrigamiController
@orders = Order.get_orders()
end
def item_show
selection(params[:booking_id],1)
end
# def item_show
# selection(params[:booking_id],1)
# end
def selection(selected_id, is_ajax)
str = []
@@ -37,8 +37,8 @@ class Origami::HomeController < BaseOrigamiController
@order_details = OrderItem.get_order_items_details(params[:booking_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
end
end
end
if is_ajax == 1
render :json => str.to_json

View File

@@ -4,6 +4,34 @@ class Origami::PaymentsController < BaseOrigamiController
def index
end
def first_bill
sale_id = params[:sale_id] # sale_id
sale_data = Sale.find_by_sale_id(sale_id)
sale_items = SaleItem.where("sale_id=?",sale_id)
# Print for First Bill to Customer
unique_code = "ReceiptBillPdf"
#shop detail
shop_details = Shop.find(1)
# customer= Customer.where('customer_id=' +.customer_id)
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)
# find order id by sale id
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
# Calculate price_by_accounts
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
discount_price_by_accounts = SaleItem.get_discount_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, discount_price_by_accounts, member_info, shop_details)
end
def create
cash = params[:cash]
sale_id = params[:sale_id]
@@ -26,9 +54,10 @@ class Origami::PaymentsController < BaseOrigamiController
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
end
end
@@ -104,10 +133,9 @@ class Origami::PaymentsController < BaseOrigamiController
# Calculate price_by_accounts
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
end
end

View File

@@ -10,8 +10,8 @@ class Origami::RequestBillsController < BaseOrigamiController
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
if check_booking.sale_id.nil?
# Create Sale if it doesn't exist
puts "current_login_employee"
puts current_login_employee.name
# puts "current_login_employee"
# puts current_login_employee.name
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
@sale_data = Sale.find_by_sale_id(@sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_id)
@@ -20,26 +20,26 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
end
unique_code = "ReceiptBillPdf"
#shop detail
shop_details = Shop.find(1)
# customer= Customer.where('customer_id=' +.customer_id)
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)
# Not Use for these printed bill cannot give customer
# unique_code = "ReceiptBillPdf"
# #shop detail
# shop_details = Shop.find(1)
# # customer= Customer.where('customer_id=' +.customer_id)
# 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)
# find order id by sale id
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
# # find order id by sale id
# # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
# Calculate price_by_accounts
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
# # Calculate price_by_accounts
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
# 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)
# redirect_to origami_path(@sale_data.sale_id)
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
end
end

View File

@@ -18,6 +18,7 @@ class Origami::SaleEditController < BaseOrigamiController
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 0
@newsaleitem.product_name = saleitemObj.product_name + " - void"
@newsaleitem.save
end

View File

@@ -1,11 +1,28 @@
class Origami::ShiftsController < ApplicationController
class Origami::ShiftsController < BaseOrigamiController
def index
end
def show
@shift = ShiftSale.current_open_shift(current_user.id)
end
def new
@float = Lookup.where('lookup_type=?','float_value')
end
def create
opening_balance = params[:opening_balance]
@shift = ShiftSale.new
@shift.create(opening_balance,current_user)
end
def update_shift
@shift = ShiftSale.current_open_shift(current_user.id)
if @shift
@shift.shift_closed_at = DateTime.now.utc
@shift.save
end
end
def edit