check first bill or not

This commit is contained in:
phyusin
2017-12-21 15:11:11 +06:30
parent 9b037f9daf
commit 11b8466e10
4 changed files with 91 additions and 14 deletions

View File

@@ -156,8 +156,7 @@
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
@@ -439,6 +438,18 @@
</div>
<script>
$(document).ready(function () {
/* start check first bill or not*/
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
// console.log(checkReceiptNoInFirstBillData(receipt_no));
if(checkReceiptNoInFirstBillData(receipt_no)){
$("#pay").show();
}else{
$("#pay").hide();
}
/* end check first bill or not*/
$('.invoicedetails').on('click', function () {
var dining_id = "<%= @dining.id %>";
@@ -555,14 +566,19 @@
// 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",
url: ajax_url,
success: function (result) {
location.reload();
}
});
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);
location.reload();
}
});
});
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
@@ -625,11 +641,12 @@
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
}
else {
location.reload();
else {
location.reload();
}
}
});

View File

@@ -405,6 +405,12 @@
data: "cash="+ cash + "&sale_id=" + sale_id,
async: false,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {

View File

@@ -447,6 +447,19 @@ $(document).ready(function(){
// window.location.href = '/origami/order/' + order_id;
// })
/* start check first bill or not*/
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
// console.log(checkReceiptNoInFirstBillData(receipt_no));
if(checkReceiptNoInFirstBillData(receipt_no)){
$("#pay").show();
}else{
$("#pay").hide();
}
/* end check first bill or not*/
$('.invoicedetails').on('click',function(){
var dining_id = "<%= @room.id %>";
var sale_id = this.id;
@@ -569,6 +582,10 @@ $("#first_bill").on('click', function(){
type: "GET",
url: ajax_url,
success:function(result){
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no);
location.reload();
}
});