discount calculation and in print view
diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js
index 652350a..21ad71f 100644
--- a/erpnext/public/js/controllers/accounts.js
+++ b/erpnext/public/js/controllers/accounts.js
@@ -93,11 +93,11 @@
 
 cur_frm.pformat.taxes= function(doc){
 	//function to make row of table
-	var make_row = function(title, val, bold){
+	var make_row = function(title, val, bold, is_negative) {
 		var bstart = '<b>'; var bend = '</b>';
 		return '<tr><td style="width:50%;">' + (bold?bstart:'') + title + (bold?bend:'') + '</td>'
-			+ '<td style="width:50%;text-align:right;">' + format_currency(val, doc.currency) + '</td>'
-			+ '</tr>';
+			+ '<td style="width:50%;text-align:right;">' + (is_negative ? '- ' : '')
+		+ format_currency(val, doc.currency) + '</td></tr>';
 	}
 
 	function convert_rate(val) {
@@ -125,6 +125,10 @@
 			out += make_row('Net Total', doc.print_total, 1);
 		}
 
+		// Discount Amount on net total
+		if(!print_hide('discount_amount') && doc.apply_discount_on == "Net Total" && doc.discount_amount)
+			out += make_row('Discount Amount', doc.discount_amount, 0, 1);
+
 		// add rows
 		if(cl.length){
 			for(var i=0;i<cl.length;i++) {
@@ -133,9 +137,9 @@
 			}
 		}
 
-		// Discount Amount
-		if(!print_hide('discount_amount') && doc.discount_amount)
-			out += make_row('Discount Amount', doc.discount_amount, 0);
+		// Discount Amount on grand total
+		if(!print_hide('discount_amount') && doc.apply_discount_on == "Grand Total" && doc.discount_amount)
+			out += make_row('Discount Amount', doc.discount_amount, 0, 1);
 
 		// grand total
 		if(!print_hide('grand_total'))