Edit first bill button

This commit is contained in:
San Wai Lwin
2018-06-08 16:48:52 +06:30
parent 9bae3445d3
commit a04bb14477
3 changed files with 287 additions and 254 deletions

View File

@@ -1,7 +1,7 @@
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<div id="loading"></div>
</div>
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
@@ -334,7 +334,15 @@
</tr>
<% if @status_sale == "sale" %>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="charges-name"><strong>Tax:
(<% @i = 0
@account_arr.each do |ct| %>
<%=ct.name%>
<% if @account_arr.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
@@ -430,7 +438,7 @@
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% if @room.bookings.length >= 1 %>
<% if @room.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
<!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> -->
@@ -473,16 +481,11 @@
<% end %>
<% end %>
<% if current_login_employee.role != "waiter" %>
<!-- 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>
<% 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%>-->
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<% end %>
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
@@ -789,23 +792,37 @@ $(document).ready(function(){
// Print for first bill
$("#first_bill").on('click', function(){
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({
type: "GET",
swal({
title: "Alert",
text: "Are you sure want to print First Bill?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, print it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success:function(result){
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
location.reload();
}
location.reload();
}
});
}
});
});
});
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();