update combine cloud and master bugs

This commit is contained in:
Aung Myo
2018-01-16 10:57:20 +06:30
parent fe846ea89a
commit eb29b20654
7 changed files with 59 additions and 46 deletions

View File

@@ -217,29 +217,31 @@ $(document).on('turbolinks:load', function() {
});
// Print Order Item
// $(document).on('click', '#print_order_item', function(event){
// var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
// var options = $('.selected-item').children('.card-block').find('.item-options').text();
// var params = { 'options':options };
$(document).on('click', '#print_order_item', function(event){
var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
var options = $('.selected-item').children('.card-block').find('.item-options').text();
var params = { 'options':options };
// $.ajax({
// type: 'GET',
// url: '/oqs/print/print/'+assigned_item_id,
// success: function(data){ }
// });
// });
$.ajax({
type: 'POST',
url: '/oqs/print/print/'+assigned_item_id,
data: params,
success: function(data){ }
});
});
// Print Order Summary
// $(document).on('click', '#print_order_summary', function(event){
// var orderNo = $('.selected-item').attr('data-order-no');
// var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
// var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
// var params = { 'table_name':table_name };
// $.ajax({
// type: 'GET',
// url: '/oqs/print/print_order_summary/'+assigned_item_id,
// data: params,
// success: function(data){ }
// });
// });
// Print Order Summary
// $('#print_order_summary').on('click',function(){
$(document).on('click', '#print_order_summary', function(event){
var orderNo = $('.selected-item').attr('data-order-no');
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'table_name':table_name };
$.ajax({
type: 'GET',
url: '/oqs/print/print_order_summary/'+assigned_item_id,
data: params,
success: function(data){ }
});
});
});

View File

@@ -1,4 +1,5 @@
class Origami::HomeController < BaseOrigamiController
authorize_resource :class => false
before_action :set_dining, only: [:show]
def index

View File

@@ -21,8 +21,6 @@ class Origami::PaymentsController < BaseOrigamiController
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
Rails.logger.debug ENV["SERVER_MODE"]
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# Print for First Bill to Customer
unique_code = "ReceiptBillPdf"

View File

@@ -54,27 +54,26 @@ class Origami::ShiftsController < BaseOrigamiController
card_sett_trans.save()
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "CloseCashierPdf"
shop_details = Shop.find(1)
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# unique_code = "CloseCashierPdf"
# shop_details = Shop.find(1)
# #get tax
# shift_obj = ShiftSale.where('id =?',@shift.id)
# @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
# #other payment details for mpu or visa like card
# @other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
# get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code)
# # Calculate price_by_accounts
# @total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
# @total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
# @total_member_discount = ShiftSale.get_total_member_discount(@shift)
# # get printer info
# print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::CashierStationPrinter.new(print_settings)
# printer = Printer::CashierStationPrinter.new(print_settings)
# printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
end
end
Employee.logout(session[:session_token])
session[:session_token] = nil

View File

@@ -89,10 +89,14 @@ class Ability
can :manage, Inventory
can :index, :home
can :show, :home
elsif user.role == "cashier"
# can :overall_void, :void
can :index, :home
can :show, :home
can :read, Order
can :update, Order
can :menage, Booking
@@ -176,6 +180,9 @@ class Ability
can :manage, Promotion
can :manage, Product
can :index, :home
can :show, :home
end
end
end

View File

@@ -43,12 +43,14 @@
</a>
</li>
<% end %>
<% if can? :index, :home %>
<li>
<a href="<%= origami_root_path %>">
<i class="material-icons">monetization_on</i>
<span><%= t :origami %></span>
</a>
</li>
<% end %>
<% if can? :menage, Customer %>
<li>
<a href="javascript:void(0);" class="menu-toggle">
@@ -106,6 +108,7 @@
<% end %>
</ul>
</li>
<% if can? :index, :dailysale %>
<li>
<a href="javascript:void(0);" class="menu-toggle">
<i class="material-icons">assessment</i>
@@ -141,6 +144,7 @@
</li>
</ul>
</li>
<%end%>
<li class="header"><%= t :settings %></li>
<% if can? :menage, Zone %>
<li>

View File

@@ -168,8 +168,10 @@
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<!-- <button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button>
<%end%>
</div>
</div>