fixed conflictfile

This commit is contained in:
Aung Myo
2017-06-12 15:01:19 +06:30
30 changed files with 699 additions and 353 deletions

View File

@@ -2,7 +2,7 @@ class Origami::DiscountsController < BaseOrigamiController
#discount page show from origami index with selected order
def index
sale_id = params[:id]
sale_id = params[:id]
if Sale.exists?(sale_id)
@sale_data = Sale.find(sale_id)
end
@@ -11,30 +11,32 @@ class Origami::DiscountsController < BaseOrigamiController
#discount for selected order
def create
sale_id = params[:sale_id]
sale_item_id = params[:sale_item_id]
discount_type = params[:discount_type]
discount_value = params[:discount_value]
discount_amount = params[:discount_amount]
grand_total = params[:grand_total]
discount_value = params[:discount_value]
discount_amount = params[:discount_amount]
grand_total = params[:grand_total]
if discount_type == 0
remark="Discount " + discount_amount + " as net"
else
remark="Discount " + discount_amount + " as percentage"
end
if discount_type == 0
remark="Discount " + discount_amount + " as net"
else
remark="Discount " + discount_amount + " as percentage"
end
#update discount for sale
sale = Sale.find(sale_id)
sale.total_discount = discount_amount
sale.grand_total = grand_total
sale.save
#update discount for sale
sale = Sale.find(sale_id)
sale.total_discount = sale.total_discount + discount_amount.to_f
sale.grand_total = grand_total
sale.save
#save sale item for discount
origin_sale_item = SaleItem.find(sale_item_id)
sale_item = SaleItem.new
#pull
sale_item.sale_id = sale_id
sale_item.product_code = 0
sale_item.product_name = "Discount"
sale_item.product_code = origin_sale_item.product_code
sale_item.product_name = origin_sale_item.product_name + " Discount"
sale_item.remark = remark
sale_item.qty = 1
@@ -45,7 +47,7 @@ class Origami::DiscountsController < BaseOrigamiController
sale_item.price = sale_item.qty * sale_item.unit_price
sale_item.save
redirect_to origami_root_path
redirect_to origami_path(sale_id)
end
end

View File

@@ -1,30 +1,49 @@
class Origami::HomeController < BaseOrigamiController
def index
if params[:booking_id] != nil
type=params[:booking_id].split('-')[0];
# Sale
if type == "SAL"
@selected_item = Sale.find(params[:booking_id])
@selected_item_type="Sale"
# Booking
else
@selected_item = Order.find(params[:booking_id])
@selected_item_type="Order"
end
end
@completed_orders = Order.get_completed_order()
@booking_orders = Order.get_booking_order_table()
@booking_rooms = Order.get_booking_order_rooms()
@orders = Order.get_orders()
end
end
def show
str = []
type=params[:id].split('-')[0];
def item_show
selection(params[:booking_id],1)
end
def selection(selected_id, is_ajax)
str = []
type=selected_id.split('-')[0];
# Sale
if type == "SAL"
@order_details = SaleItem.get_order_items_details(params[:id])
@order_details = SaleItem.get_order_items_details(params[:booking_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
render :json => str.to_json
# Booking
else
@order_details = OrderItem.get_order_items_details(params[:id])
@order_details = OrderItem.get_order_items_details(params[:booking_id])
@order_details.each do |ord_detail|
str.push(ord_detail)
end
render :json => str.to_json
end
end
if is_ajax == 1
render :json => str.to_json
else
str
end
end
def update_sale_by_customer

View File

@@ -14,17 +14,23 @@ class Origami::RequestBillsController < BaseOrigamiController
@sale_items = SaleItem.where("sale_id=?",@sale_id)
else
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
end
unique_code = "ReceiptBillPdf"
customer_name = Customer.select("name").where('customer_id=' + @sale_data.customer_id)
customer= Customer.where('customer_id=' + @sale_data.customer_id)
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 Food and Beverage Total
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name)
redirect_to origami_root_path
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, food_total, beverage_total)
redirect_to origami_path(sale_order.sale_id)
end
end