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){ // No Needs For Auto Selected
var item_rows=get_item_rows(); // if(account_types.length > 0){
if(item_rows.length > 0){ // var item_rows=get_item_rows();
for(var k=0; k < item_rows.length; k++){ // if(item_rows.length > 0){
for(var j=0; j < account_types.length; j++){ // for(var k=0; k < item_rows.length; k++){
if(item_rows[k].account_id == account_types[j].id){ // for(var j=0; j < account_types.length; j++){
// Discount Items // if(item_rows[k].account_id == account_types[j].id){
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount); // // Discount Items
$("#order-items-table tbody").append(discount_item_row); // var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
total_discount = total_discount + amount; // $("#order-items-table tbody").append(discount_item_row);
} // total_discount = total_discount + amount;
} // }
} // }
} // }
else { // }
alert("No Items!"); // else {
} // alert("No Items!");
} // }
// }
sub_total = origin_sub_total - total_discount; 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 // Check account types exists
if(account_types.length > 0){ // if(account_types.length > 0){
var item_rows=get_item_rows(); // var item_rows=get_item_rows();
console.log(account_types); // console.log(account_types);
if(item_rows.length > 0){ // if(item_rows.length > 0){
for(var k=0; k < item_rows.length; k++){ // for(var k=0; k < item_rows.length; k++){
for(var j=0; j < account_types.length; j++){ // for(var j=0; j < account_types.length; j++){
if(item_rows[k].account_id == account_types[j].id){ // if(item_rows[k].account_id == account_types[j].id){
// Discount Items // // Discount Items
dis_amount = 0 - ((item_rows[k].price * amount)/100); // dis_amount = 0 - ((item_rows[k].price * amount)/100);
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount); // var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
$("#order-items-table tbody").append(discount_item_row); // $("#order-items-table tbody").append(discount_item_row);
total_discount = total_discount + dis_amount; // total_discount = total_discount + dis_amount;
} // }
} // }
} // }
} // }
else { // else {
alert("No Items!"); // alert("No Items!");
} // }
} // }
sub_total = origin_sub_total + total_discount; sub_total = origin_sub_total + total_discount;
} }

View File

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