fix discount and edit title confirm borx

This commit is contained in:
Yan
2017-07-08 21:46:13 +06:30
parent 94555bc325
commit 1666cb3d0c
2 changed files with 42 additions and 40 deletions

View File

@@ -578,24 +578,25 @@ function calculate_item_discount(type, amount, sale_items, account_types){
}
}
if(account_types.length > 0){
var item_rows=get_item_rows();
if(item_rows.length > 0){
for(var k=0; k < item_rows.length; k++){
for(var j=0; j < account_types.length; j++){
if(item_rows[k].account_id == account_types[j].id){
// Discount Items
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
$("#order-items-table tbody").append(discount_item_row);
total_discount = total_discount + amount;
}
}
}
}
else {
alert("No Items!");
}
}
// No Needs For Auto Selected
// if(account_types.length > 0){
// var item_rows=get_item_rows();
// if(item_rows.length > 0){
// for(var k=0; k < item_rows.length; k++){
// for(var j=0; j < account_types.length; j++){
// if(item_rows[k].account_id == account_types[j].id){
// // Discount Items
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
// $("#order-items-table tbody").append(discount_item_row);
// total_discount = total_discount + amount;
// }
// }
// }
// }
// else {
// alert("No Items!");
// }
// }
sub_total = origin_sub_total - total_discount;
}
@@ -631,27 +632,28 @@ function calculate_item_discount(type, amount, sale_items, account_types){
}
}
// No Needs For Auto Selected
// Check account types exists
if(account_types.length > 0){
var item_rows=get_item_rows();
console.log(account_types);
if(item_rows.length > 0){
for(var k=0; k < item_rows.length; k++){
for(var j=0; j < account_types.length; j++){
if(item_rows[k].account_id == account_types[j].id){
// Discount Items
dis_amount = 0 - ((item_rows[k].price * amount)/100);
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
$("#order-items-table tbody").append(discount_item_row);
total_discount = total_discount + dis_amount;
}
}
}
}
else {
alert("No Items!");
}
}
// if(account_types.length > 0){
// var item_rows=get_item_rows();
// console.log(account_types);
// if(item_rows.length > 0){
// for(var k=0; k < item_rows.length; k++){
// for(var j=0; j < account_types.length; j++){
// if(item_rows[k].account_id == account_types[j].id){
// // Discount Items
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
// $("#order-items-table tbody").append(discount_item_row);
// total_discount = total_discount + dis_amount;
// }
// }
// }
// }
// else {
// alert("No Items!");
// }
// }
sub_total = origin_sub_total + total_discount;
}

View File

@@ -360,7 +360,7 @@ $( document ).ready(function() {
if($('#balance').text() < 0){
$.confirm({
title: 'Hi!',
title: 'Infomation!',
content: 'Changed amount ' + $('#balance').text() * (-1),
buttons: {
confirm: {
@@ -377,7 +377,7 @@ $( document ).ready(function() {
$('#pay').text("Pay")
$.confirm({
title: 'Hi!',
title: 'Infomation!',
content: 'Thank you !',
buttons: {
confirm: {