update payment and memberdiscoun
This commit is contained in:
@@ -145,30 +145,45 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
|
||||
/* start check first bill or not funs: */
|
||||
function checkReceiptNoInFirstBillData(receipt_no) {
|
||||
function checkReceiptNoInFirstBillData(receipt_no,payment=null) {
|
||||
// localStorage.removeItem('receipt_lists');
|
||||
var status = false;
|
||||
if((receipt_no!=undefined) && (receipt_no!="")){
|
||||
if(localStorage.hasOwnProperty("receipt_lists")===true){
|
||||
var arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||
var json_data = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||
console.log(arr_data)
|
||||
if (payment) {
|
||||
var json_data = arr_data.filter(function(e) { return e.receipt_no == receipt_no });
|
||||
}else{
|
||||
var json_data = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||
}
|
||||
|
||||
if((arr_data.length) > (json_data.length)){
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
if (payment) {
|
||||
return json_data[0]["payment"];
|
||||
}else{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
function createReceiptNoInFirstBillData(receipt_no) {
|
||||
function createReceiptNoInFirstBillData(receipt_no,payment=null) {
|
||||
var arr_data = [];
|
||||
var json_data = [];
|
||||
if(localStorage.hasOwnProperty("receipt_lists")===true){
|
||||
arr_data = JSON.parse(localStorage.getItem("receipt_lists"));
|
||||
json_data = arr_data.filter(function(e) { return e.receipt_no == receipt_no });
|
||||
if (payment) {
|
||||
jdata = arr_data.filter(function(e) { return e.receipt_no !== receipt_no });
|
||||
jdata.push({'receipt_no':receipt_no,'payment':payment});
|
||||
localStorage.setItem("receipt_lists",JSON.stringify(jdata));
|
||||
}
|
||||
}
|
||||
if(((arr_data.length == 0) && (json_data.length == 0)) || ((arr_data.length > 0) && (json_data.length == 0))){
|
||||
arr_data.push({'receipt_no':receipt_no});
|
||||
arr_data.push({'receipt_no':receipt_no,'payment':payment});
|
||||
localStorage.setItem("receipt_lists",JSON.stringify(arr_data));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user