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

This commit is contained in:
Nweni
2017-06-27 10:28:58 +06:30
36 changed files with 498 additions and 220 deletions

View File

@@ -29,7 +29,12 @@ class Api::BillController < Api::ApiController
@sale_items = SaleItem.where("sale_id=?",@sale_id)
unique_code = "ReceiptBillPdf"
#shop detail
shop_details = Shop.find(1)
customer= Customer.where('customer_id=' + @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)
@@ -38,7 +43,7 @@ class Api::BillController < Api::ApiController
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)
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
end

View File

@@ -30,7 +30,9 @@ class ApplicationController < ActionController::Base
end
def current_login_employee
@employee = Employee.find_by_token_session(session[:session_token])
if (!session[:session_token].nil?)
@employee = Employee.find_by_token_session(session[:session_token])
end
end
private

View File

@@ -1,10 +1,30 @@
class HomeController < ApplicationController
skip_before_action :authenticate, only: [:index, :create, :destroy]
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
def index
@employees = Employee.all.order("name asc")
@login_form = LoginForm.new()
end
def show
@login_form = LoginForm.new()
@login_form.emp_id = params[:emp_id]
end
def update
@login_form = LoginForm.new()
@login_form.emp_id = params[:emp_id]
@login_form.password = params[:login_form][:password]
@employee = Employee.login(@login_form.emp_id, @login_form.password)
if @employee != nil
session[:session_token] = @employee.token_session
redirect_to origami_root_path
else
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
end
end
def create
@login_form = LoginForm.new()
@login_form.emp_id = params[:login_form][:emp_id]
@@ -27,9 +47,9 @@ class HomeController < ApplicationController
else
render :index
end
else
else
redirect_to origami_root_path, :notice => "Username and Password dosn't match!"
end
end
end

View File

@@ -118,6 +118,6 @@ class Oqs::HomeController < BaseOqsController
left join bookings as bk on bk.booking_id = bo.booking_id
left join dining_facilities as df on df.id = bk.dining_facility_id")
.where("assigned_order_items.delivery_status = #{status}")
.group("odt.order_items_id")
.group("assigned_order_items.assigned_order_item_id")
end
end

View File

@@ -17,6 +17,8 @@ class Origami::PaymentsController < BaseOrigamiController
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
rebate_amount = Customer.get_membership_transactions(customer)
#shop detail
shop_details = Shop.find(1)
# get member information
member_info = Customer.get_member_account(customer)
@@ -26,7 +28,7 @@ class Origami::PaymentsController < BaseOrigamiController
item_price_by_accounts = SaleItem.calculate_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)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
end
end
@@ -52,8 +54,8 @@ class Origami::PaymentsController < BaseOrigamiController
@accountable_type = ''
if response["status"]==true
response["data"].each do |res|
if res["accountable_type"] == "RebateAccount"
@balance = res["balance"]
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
@balance += res["balance"]
# @accountable_type = res["accountable_type"]
@accountable_type = "Rebate Balance"
end
@@ -92,6 +94,8 @@ class Origami::PaymentsController < BaseOrigamiController
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.find(1)
# get member information
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer)
@@ -102,7 +106,7 @@ class Origami::PaymentsController < BaseOrigamiController
item_price_by_accounts = SaleItem.calculate_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)
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
end

View File

@@ -21,8 +21,9 @@ class Origami::RequestBillsController < BaseOrigamiController
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)
@@ -37,7 +38,7 @@ class Origami::RequestBillsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info)
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)
end

View File

@@ -0,0 +1,18 @@
class Transactions::CreditNotesController < ApplicationController
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
# GET /transactions/sales
# GET /transactions/sales.json
def index
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sales }
end
end
end