update room for first bill

This commit is contained in:
Aung Myo
2018-01-15 17:48:35 +06:30
parent b480f8cd61
commit fb989572b1
3 changed files with 41 additions and 24 deletions

View File

@@ -63,6 +63,7 @@ class Origami::VoidController < BaseOrigamiController
member_info = nil member_info = nil
rebate_amount = nil rebate_amount = nil
current_balance = nil
# For Cashier by Zone # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") bookings = Booking.where("sale_id='#{sale_id}'")
@@ -87,7 +88,9 @@ class Origami::VoidController < BaseOrigamiController
if customer.membership_id != nil && rebate if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
end end
# 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

View File

@@ -576,7 +576,7 @@
swal ( "Oops" , "Please select an table!" , "warning" ); swal ( "Oops" , "Please select an table!" , "warning" );
} }
}else{ }else{
swal("Opps","You are not authorized for void","warning") swal("Opps","You are not authorized for Discount","warning")
} }
return false; return false;
}); });

View File

@@ -367,16 +367,20 @@
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> --> <!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button> <button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
<button type="button" class="btn bg-blue btn-block" id='edit'>Edit</button> <button type="button" class="btn bg-blue btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn bg-blue btn-block" >Discount</button> <button type="button" id="discount" class="btn bg-blue btn-block" active="<%= can? :index, :discount %>" >Discount</button>
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button> <button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button>
<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>
<!-- <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> -->
<!-- first bill not used in cloud --> <!-- first bill not used in cloud -->
<% if ENV["SERVER_MODE"] != "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>
<% else %>
<%if @membership.discount && @obj_sale.customer.membership_id %>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
<%else%>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<%end%>
<%end%> <%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>
@@ -393,6 +397,7 @@
<div class="modal-body"> <div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" > <select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<option value="Cash">Cash</option> <option value="Cash">Cash</option>
<option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %> <% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>"> <option value="<%= pay.payment_method %>">
<%= pay.payment_method %> <%= pay.payment_method %>
@@ -535,9 +540,10 @@ $(document).ready(function(){
return false; return false;
}); });
// Discount for Payment // Discount for Payment
$('#discount').click(function () { $('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').val(); var sale = $('#sale_id').val();
if (sale != "") { if (sale != "") {
var sale_id = sale var sale_id = sale
@@ -551,9 +557,12 @@ $(document).ready(function(){
else { else {
swal ( "Oops" , "Please select an table!" , "warning" ); swal ( "Oops" , "Please select an table!" , "warning" );
} }
}else{
swal("Opps","You are not authorized for Discount","warning")
}
return false; return false;
}); });
// Discount for Payment
// Add Other Charges // Add Other Charges
$('#other-charges').click(function() { $('#other-charges').click(function() {
@@ -595,11 +604,17 @@ $("#first_bill").on('click', function(){
$(".choose_payment").on('click', function () { $(".choose_payment").on('click', function () {
$( "#loading_wrapper").show(); $( "#loading_wrapper").show();
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
type = $('.payment_method').val(); type = $('.payment_method').val();
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) {
calculate_member_discount(sale_id,"Card");
calculate_member_discount(sale_id,type); }else{
calculate_member_discount(sale_id,"Cash");
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({ $.ajax({
type: "GET", type: "GET",
@@ -609,7 +624,6 @@ $(".choose_payment").on('click', function () {
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type); createReceiptNoInFirstBillData(receipt_no,type);
location.reload(); location.reload();
} }
}); });