update cloud for print and first bill
This commit is contained in:
@@ -20,8 +20,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
puts ENV["SERVER_MODE"]
|
|
||||||
puts "DDDDDDDDDDDDDDDDD"
|
Rails.logger.debug ENV["SERVER_MODE"]
|
||||||
|
|
||||||
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
# Print for First Bill to Customer
|
# Print for First Bill to Customer
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
#shop detail
|
#shop detail
|
||||||
@@ -63,7 +65,7 @@ puts "DDDDDDDDDDDDDDDDD"
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
|
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@@ -108,8 +110,9 @@ puts "DDDDDDDDDDDDDDDDD"
|
|||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
# unique_code = "ReceiptBillPdf"
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
# customer= Customer.find(saleObj.customer_id)
|
unique_code = "ReceiptBillPdf"
|
||||||
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
# get member information
|
# get member information
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
@@ -144,6 +147,7 @@ puts "DDDDDDDDDDDDDDDDD"
|
|||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@@ -246,6 +250,7 @@ puts "DDDDDDDDDDDDDDDDD"
|
|||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
@@ -281,6 +286,7 @@ puts "DDDDDDDDDDDDDDDDD"
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def foc
|
def foc
|
||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
@@ -316,24 +322,24 @@ puts "DDDDDDDDDDDDDDDDD"
|
|||||||
# Re-call Sale Data
|
# Re-call Sale Data
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|
||||||
# unique_code = "ReceiptBillPdf"
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
# customer= Customer.find(saleObj.customer_id)
|
unique_code = "ReceiptBillPdf"
|
||||||
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
# #shop detail
|
#shop detail
|
||||||
# shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# # get printer info
|
# get printer info
|
||||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
# # Calculate Food and Beverage Total
|
# Calculate Food and Beverage Total
|
||||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
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)
|
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,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rounding_adj
|
def rounding_adj
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
customer= Customer.find(sale.customer_id)
|
customer= Customer.find(sale.customer_id)
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
||||||
|
end
|
||||||
|
|
||||||
#end print
|
#end print
|
||||||
|
|
||||||
|
|||||||
@@ -395,9 +395,10 @@
|
|||||||
|
|
||||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
|
<!-- first bill not used in cloud -->
|
||||||
|
<% if ENV["SERVER_MODE"] != "cloud" %>
|
||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
|
<% end %>
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -407,6 +408,7 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||||
@@ -446,12 +448,15 @@
|
|||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
receipt_no = ($("#receipt_no").html()).trim();
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||||
// if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
// $("#pay").show();
|
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||||
// }else{
|
$("#pay").show();
|
||||||
// $("#pay").hide();
|
}else{
|
||||||
// }
|
$("#pay").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.invoicedetails').on('click', function () {
|
$('.invoicedetails').on('click', function () {
|
||||||
|
|||||||
@@ -26,13 +26,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
var receipt_no = "";
|
var receipt_no = "";
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
receipt_no = ($("#receipt_no").html()).trim();
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
}
|
}
|
||||||
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||||
if(payment_type) {
|
if(payment_type) {
|
||||||
$(".others-payment").hide();
|
$(".others-payment").hide();
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
$("."+payment_type[i]).show();
|
$("."+payment_type[i]).show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.others-payment').on('click',function(){
|
$('.others-payment').on('click',function(){
|
||||||
|
|||||||
@@ -298,7 +298,7 @@
|
|||||||
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -310,6 +310,7 @@
|
|||||||
receipt_no = ($("#receipt_no").html()).trim();
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||||
|
|
||||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||||
@@ -323,6 +324,7 @@
|
|||||||
} else{
|
} else{
|
||||||
$("#card_payment").hide();
|
$("#card_payment").hide();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
||||||
|
|||||||
@@ -374,13 +374,14 @@
|
|||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
||||||
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
||||||
|
<!-- first bill not used in cloud -->
|
||||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button> -->
|
<% if ENV["SERVER_MODE"] != "cloud" %>
|
||||||
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
|
<% end %>
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||||
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
|
|
||||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||||
@@ -452,11 +453,13 @@ $(document).ready(function(){
|
|||||||
receipt_no = ($("#receipt_no").html()).trim();
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
}
|
}
|
||||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||||
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||||
$("#pay").show();
|
$("#pay").show();
|
||||||
}else{
|
}else{
|
||||||
$("#pay").hide();
|
$("#pay").hide();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.invoicedetails').on('click',function(){
|
$('.invoicedetails').on('click',function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user