update qurick raw

This commit is contained in:
Aung Myo
2018-02-01 10:29:24 +06:30
parent a96091decb
commit 2f024e8691
18 changed files with 585 additions and 60 deletions

View File

@@ -83,9 +83,12 @@ $(function() {
//show menu item list when click menu category
function show_menu_item_list(url_item){
var menu_list = $('.menu_items_list');
menu_list.empty();
if ($('#type').val() == 'true') {
url_item = 'addorders/'+url_item
}
//Start Ajax
$.ajax({
type: "GET",
@@ -702,26 +705,41 @@ $(function() {
}
}
// Pay Discount for Payment
// Create Order
$("#create_order").on('click', function(e){
$(this).attr('disabled', 'disabled');
e.preventDefault();
$("#oqs_loading_wrapper").show();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
var booking_id = $('#booking_id').text();
type = $('#type').val();
if (type == 'true') {
type = 'cashier'
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
var customer_id = $('#customer_id').val();
var booking_id = $('#booking_id').text();
var ajax_url = 'addorders/create';
}else{
type = 'cashier'
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
var customer_id = $('#customer_id').text();
var booking_id = $('#booking_id').text();
var ajax_url = '../addorders/create';
}
if (!booking_id.length > 0) {
var params = {'order_source': "cashier", 'order_type': "dine_in",
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
'table_id': table_id,
'order_items': order_items };
}
var table_type = $('#table_type').text();
var order_items = JSON.stringify(get_order_item_rows());
var ajax_url = '../addorders/create';
var params = {'order_source': "cashier", 'order_type': "dine_in",
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",
'table_id': table_id,
'order_items': order_items };
@@ -731,27 +749,61 @@ $(function() {
data: params,
dataType: "json",
success:function(result){
// $("#oqs_loading_wrapper").hide();
// swal({
// title: "Information !",
// text: 'Order has been successfully created',
// confirmButtonColor: "green",
// confirmButtonText: "Yes!",
// closeOnConfirm: false,
// }, function (isConfirm) {
// if (isConfirm) {
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
}
else {
window.location.href = "/origami/room/" + table_id
}
// }
// });
}
}
});
});
// Pay Discount for Payment
$("#create_pay_order").on('click', function(e){
$(this).attr('disabled', 'disabled');
e.preventDefault();
$("#oqs_loading_wrapper").show();
type = $('#type').val();
type = 'quick_service'
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
var customer_id = $('#customer_id').val();
var booking_id = $('#booking_id').text();
var ajax_url = 'addorders/create';
if (!booking_id.length > 0) {
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id,
'table_id': table_id,
'order_items': order_items };
}
var order_items = JSON.stringify(get_order_item_rows());
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",
'table_id': table_id,
'order_items': order_items };
$.ajax({
type: "POST",
url: ajax_url,
data: params,
dataType: "json",
success:function(result){
console.log(result)
if (result.status) {
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/payment"
}
// window.location.href = "/origami/quick_service"
}
});
});
//click item row for update qty
$('.summary-items').on('click', '.item_box', function(){
$(this).attr('data-active',true);
@@ -863,11 +915,21 @@ $(function() {
$("#back").on("click", function(){
var table_id = $('#table_id').text();
var table_type = $('#table_type').text();
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
}else {
window.location.href = "/origami/room/" + table_id
}
type = $('#type').val();
if (type == 'true') {
var table_type = $('#table_id').find("option:selected").data('type');
var table_id = $('#table_id').val();
window.location.href = "/origami/dashboard"
}else{
var table_type = $('#table_type').text();
var table_id = $('#table_id').text();
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
}else {
window.location.href = "/origami/room/" + table_id
}
}
});
// Get Selected Class
@@ -970,6 +1032,9 @@ $(function() {
$(".sub_click").on("click", function(){
var menu_id = $(this).attr("data-id");
var url = "get_menu_sub_category/"+menu_id;
if ($('#type').val() == 'true') {
url = 'addorders/'+url
}
sub_category = $(this).find('.sub_category_list');
show_sub_category_list(url,sub_category);
});
@@ -992,7 +1057,12 @@ $(function() {
data = data.sub_category;
if (data.length>0) {
$(sub_category).removeClass('hidden');
if ((sub_category.hasClass('hidden'))) {
$(sub_category).removeClass('hidden');
}else{
$(sub_category).addClass('hidden');
}
for(var i in data) {
row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">'

View File

@@ -53,8 +53,13 @@ section .content{
.nav-tabs .nav-item {
border-bottom: 1px solid #fff;
border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;
margin-left:2px;
}
#ul-navbar{
border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;
}
.nav > li > a{
color:#54A5AF;

View File

@@ -46,7 +46,8 @@ class Api::BillController < Api::ApiController
Promotion.promo_activate(@sale)
BillBroadcastJob.perform_later(table)
#BillBroadcastJob.perform_later(table)
ActionCable.server.broadcast "bill_channel",table: table
else
@status = false
@error_message = "No Current Open Shift"

View File

@@ -5,7 +5,8 @@ class Api::CallWaitersController < ActionController::API
@table_id = params[:dining_id]
@time = params[:time]
@table = DiningFacility.find(@table_id)
CallWaiterJob.perform_later(@table,@time)
# CallWaiterJob.perform_later(@table,@time)
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
# get printer info
@shop = Shop::ShopDetail

View File

@@ -8,7 +8,8 @@ class BaseOrigamiController < ActionController::Base
protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
redirect_to origami_root_path
# redirect_to origami_root_path
redirect_to origami_dashboard_path
end
def current_user

View File

@@ -146,7 +146,8 @@ class HomeController < ApplicationController
#check if cashier has existing open cashier
shift = ShiftSale.current_open_shift(employee.id)
if !shift.nil?
redirect_to origami_root_path
redirect_to origami_dashboard_path
# redirect_to origami_root_path
else
redirect_to new_origami_shift_path
end

View File

@@ -131,6 +131,15 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
@status, @booking = @order.generate
if @status && @booking && @order.source == 'quick_service'
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
result = {:status=> @status, :data => @sale }
render :json => result.to_json
puts @status
puts @sale.to_json
puts "ssssssssssssssssssss"
end
end
# render json for http status code

View File

@@ -0,0 +1,59 @@
class Origami::DashboardController < BaseOrigamiController
def index
@shop = Shop.first
today = DateTime.now.strftime('%Y-%m-%d')
# @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @top_products = Sale.top_products(today).sum('i.qty')
# @bottom_products = Sale.bottom_products(today).sum('i.qty')
# @hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
# .sum(:grand_total)
# @employee_sales = Sale.employee_sales(today)
# .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
# @inventories = StockJournal.inventory_balances(today).sum(:balance)
@total_sale = Sale.total_sale(today)
@total_count = Sale.total_count(today)
@total_card = Sale.total_card_sale(today)
@total_credit = Sale.credit_payment(today)
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(today)
@total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
pay = Sale.payment_sale('card', today)
@sale_data.push({'card' => pay.payment_amount})
else
pay = Sale.payment_sale(payment.payment_method, today)
@sale_data.push({payment.payment_method => pay.payment_amount})
end
end
@summ_sale = Sale.summary_sale_receipt(today)
@total_customer = Sale.total_customer(today)
@total_dinein = Sale.total_dinein(today)
@total_takeaway = Sale.total_takeaway(today)
@total_other_customer = Sale.total_other_customer(today)
@total_membership = Sale.total_membership(today)
@total_order = Sale.total_order(today)
@total_accounts = Sale.total_account(today)
@account_data = Array.new
@total_accounts.each do |account|
acc = Sale.account_data(account.account_id, today)
if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end
end
@top_items = Sale.top_items(today)
@total_foc_items = Sale.total_foc_items(today)
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
end
end

View File

@@ -0,0 +1,42 @@
class Origami::QuickServiceController < ApplicationController
# before_action :set_dining, only: [:detail]
def index
@menu = MenuCategory.all.active
@dining = DiningFacility.all.active
@customer = Customer.all
# @tables = Table.all.active.order('zone_id asc').group("zone_id")
# @rooms = Room.all.active.order('zone_id asc').group("zone_id")
# @all_table = Table.all.active.order('status desc')
# @all_room = Room.all.active.order('status desc')
render "origami/addorders/detail"
end
def get_menu_category ()
if (params[:id])
puts params[:id]
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
MenuCategory.current_menu
end
end
def get_menu_sub_category ()
id = params[:id]
if (id)
#Pull this menu
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
# puts @menu.menu_items[1].item_attributes.to_json
return @sub_menu
end
end
def get_all_product()
@product = Product.all
end
end

View File

@@ -203,8 +203,6 @@ class Order < ApplicationRecord
def re_order_items(form_items) #reorder inputs items as parents and child
parent_id = Array.new
parents = Array.new
puts form_items
puts "hhhhh"
parents_and_children_items = Array.new
new_items_list = Array.new

View File

@@ -137,6 +137,41 @@ class Sale < ApplicationRecord
end
#fOR Quick Service pay and create
def self.request_bill(order,current_user,current_login_employee)
@sale = Sale.new
sale_order=SaleOrder.new
if shift = ShiftSale.current_open_shift(current_user.id)
order_id = order.order_id # order_id
bk_order = BookingOrder.find_by_order_id(order_id)
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
@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)
else
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
end
# Bind shift sale id to sale
@sale_data.shift_sale_id = shift.id
@sale_data.save
# Promotion Activation
Promotion.promo_activate(@sale)
@status = true
return @status, @sale
else
@status = false
@message = "No Current Open Shift for This Employee"
end
end
#This is when spilt bill is request - then we cannot link order to invoice
#Cos there will be multiple orders - and items are spilt from there.
#Unless order is spilt by then it is possible.

View File

@@ -335,7 +335,7 @@ class SalePayment < ApplicationRecord
#record an payment in sale-audit
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
sale_audit = SaleAudit.record_paymal(sObj.sale_id, remark, 1)
if !response.nil?
if response["status"] == true

View File

@@ -4,14 +4,38 @@
<div id="oqs_loading"></div>
</div>
<% type = request.path_info.include?('quick_service')%>
<input type="hidden" name="type" id="type" value="<%=type%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2">
<ul class="nav nav-tabs flex-column" role="tablist" >
<ul class="nav nav-tabs flex-column" role="tablist" id="ul-navbar">
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<% if @table.get_current_checkout_booking.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<% else %>
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
@@ -20,15 +44,8 @@
</a>
</li>
<% end%>
<% else %>
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
@@ -36,8 +53,6 @@
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
</ul>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10">
@@ -52,19 +67,36 @@
Back
</button>
<br>
<div class="card-header">
<div>
<div class="card-header" style="padding: 0.5rem 0.25rem">
<% if type %>
<div class="row clearfix">
<div class="col-md-6 ">
<strong id="order-title" class="font-14">ORDER DETAILS </strong>
</div>
<!-- <div class="col-md-3">Table -</div> -->
<div class="col-md-6">
<select class="form-control m-t--5" id="table_id" name="table_id" >
<option value="">Select Table</option>
<% @dining.each do |table| %>
<option value="<%= table.id %>" data-type="<%=table.type%>"><%= table.name %></option>
<%end %>
</select>
</div>
</div>
<% else %>
<div>
<strong id="order-title" class="font-14">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
</div>
<% end%>
</div>
<div class="card-block">
<div class="card-text" style="max-height:550px; overflow:auto"">
<table class="table table-striped summary-items">
<div class="card-text" id="order-detail-slimscroll" data-height="180">
<table class="table table-striped summary-items" id="order-items-table" >
<thead>
<tr>
<th>#</th>
@@ -73,19 +105,39 @@
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody class="font-13">
<tbody class="font-13" >
</tbody>
</table>
</div>
<div class="card-footer custom-card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
</tr>
</table>
<button type="button" class="btn btn-primary btn-block create" id="create_order" disabled="disabled">Create Order</button>
<% if type %>
<div class="row clearfix">
<div class="col-md-4 ">
<strong id="order-title" class="font-14">Customer</strong>
</div>
<!-- <div class="col-md-3">Table -</div> -->
<div class="col-md-8">
<select class="form-control m-t--5" id="customer_id" name="customer_id" >
<option value="">Select Customer</option>
<% @customer.each do |cus| %>
<option <%=(cus.customer_id == 'CUS-000000000001')? 'selected':''%> value="<%= cus.customer_id %>"><%= cus.name %></option>
<%end %>
</select>
</div>
</div>
<button type="button" class="btn btn-primary btn-block create" id="create_pay_order" disabled="disabled">Create Order & Pay</button>
<% end %>
<button type="button" class="btn btn-primary btn-block create m-t-5" id="create_order" disabled="disabled">Create Order</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,245 @@
<div class="container-fluid">
<div class="block-header">
<h2><%= t :dashboard %></h2>
</div>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<!-- Widgets -->
<div class="row clearfix">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-cyan hover-expand-effect">
<div class="icon">
<i class="material-icons">help</i>
</div>
<div class="content">
<div class="text"><%= t :sale_count %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_count%>" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-pink hover-expand-effect">
<div class="icon">
<i class="material-icons">attach_money</i>
</div>
<div class="content">
<div class="text"><%= t :total_sale %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_sale%>" data-speed="15" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-light-green hover-expand-effect">
<div class="icon">
<i class="material-icons">person_add</i>
</div>
<div class="content">
<div class="text"><%= t :total_credit %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_credit%>" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-orange hover-expand-effect">
<div class="icon">
<i class="material-icons">credit_card</i>
</div>
<div class="content">
<div class="text"><%= t :total_card %></div>
<div class="number count-to" data-from="0" data-to="<%= @total_card%>" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
</div>
<!-- #END# Widgets -->
<!-- Widgets -->
<div class="row clearfix">
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
<div class="info-box bg-purple">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;">Quick Service</div>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-12 cashier_view">
<div class="info-box bg-green">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;">Cashier</div>
</div>
</div>
</div>
<!-- #END# Widgets -->
<!-- CPU Usage -->
<div class="row clearfix">
<% if !@summ_sale.nil? %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
<h6><%= t :sale %></h6>
<table class="table">
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : </td>
<td align="right"><%= @summ_sale.total_receipt %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
</tr>
<tr>
<td><%= t("views.right_panel.detail.grand_total") %> : </td>
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
</tr>
</table>
<table class="table">
<% if !(@total_payment_methods.nil?) %>
<% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %>
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
<tr>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= data[""+pay_mth+""] %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
<% if !total_card.nil? %>
<tr>
<td><%= t("views.right_panel.detail.card_sale") %> : </td>
<td align="right">
<%= total_card["card"].to_f %>
</td>
</tr>
<% end %>
<% end %>
</table>
</div>
</div>
</div>
<% end %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
<h6><%= t :customer %></h6>
<table class="table">
<% if !@total_customer.nil? %>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
<td align="right"><%= @total_customer %></td>
</tr>
<% end %>
<% if !@total_dinein.nil? %>
<tr>
<td><%= t("views.right_panel.detail.dine_in") %> : </td>
<td align="right"><%= @total_dinein.total_dinein_cus %></td>
</tr>
<% end %>
<% if !@total_takeaway.nil? %>
<tr>
<td><%= t("views.right_panel.detail.takeaway") %> : </td>
<td align="right"><%= @total_takeaway.total_take_cus %></td>
</tr>
<% end %>
<% if !@total_other_customer.nil? %>
<tr>
<td><%= t :customer %> : </td>
<td align="right"><%= @total_other_customer.total_cus %></td>
</tr>
<% end %>
<% if !@total_membership.nil? %>
<tr>
<td><%= t("views.right_panel.detail.membership") %> : </td>
<td align="right"><%= @total_membership.total_memb_cus %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
<h6><%= t("views.right_panel.detail.order") %></h6>
<table class="table">
<% if !@total_order.nil? %>
<tr>
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : </td>
<td align="right" width="60px"><%= @total_order.total_order %></td>
</tr>
<% end %>
<% if !@total_accounts.nil? %>
<% @total_accounts.each do |account| %>
<tr>
<td width="40px"><%= account.title %> (Account) : </td>
<td align="right" width="60px">
<% @account_data.each do |data| %>
<% acc = account.title %>
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% if !@top_items.nil? %>
<tr>
<td width="40px"><%= t :top %> <%= t("views.right_panel.detail.item") %> : </td>
<td align="right" width="60px"><%= @top_items.item_name %>
<br>(<%= @top_items.item_total_price %>)</td>
</tr>
<% end %>
<% if !@total_foc_items.nil? %>
<tr>
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : </td>
<td align="right" width="60px"><%= @total_foc_items.to_int %></td>
</tr>
<% end %>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});
$(".qs_view").on('click', function() {
window.location.href = '/origami/quick_service';
});
</script>

View File

@@ -118,6 +118,10 @@
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- <button id="refreshbutton" type="button" class="btn btn-block radius-btn"> Refresh off </button> -->
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button>
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
</button>
@@ -239,6 +243,6 @@ $('#close_cashier').on('click',function(){
window.location.href = '/origami/shift/close';
})
$('#back').on('click',function(){
window.location.href = '/dashboard';
window.location.href = '/origami/dashboard';
})
</script>

View File

@@ -117,7 +117,7 @@
data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
success:function(result){
if(result){
window.location.href = '/origami';
window.location.href = '/origami/dashboard';
}
}
});

View File

@@ -84,6 +84,8 @@ scope "(:locale)", locale: /en|mm/ do
#--------- Cashier ------------#
namespace :origami do
get "dashboard" => "dashboard#index"
get "quick_service" => "quick_service#index"
resources :cash_ins, only: [:new, :create]
resources :cash_outs, only: [:new, :create]
@@ -200,12 +202,12 @@ scope "(:locale)", locale: /en|mm/ do
get '/addorders/products/list' => "addorders#get_all_product",:as => "get_all_product", :defaults => { :format => 'json' }
get '/:addorders/:id' => "addorders#detail"
post '/:addorders/create' => "addorders#create", :defaults => { :format => 'json' }
post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' }
resources :commissions
resources :commissioners
resources :addorders
# resources :addorders
resources :in_duties
# product_commission