Added total debit / credit row in trial balance. Fixes #1313
diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.js b/erpnext/accounts/page/financial_analytics/financial_analytics.js
index df30d83..52298bb 100644
--- a/erpnext/accounts/page/financial_analytics/financial_analytics.js
+++ b/erpnext/accounts/page/financial_analytics/financial_analytics.js
@@ -256,9 +256,6 @@
 				}
 			});
 			this.data.push(net_profit);
-			// $.each(me.data, function(i, v) {
-			// 	if(v.report_type=="Profit and Loss") console.log(v)
-			// })
 		}
 	},
 	add_balance: function(field, account, gl) {
diff --git a/erpnext/accounts/page/trial_balance/trial_balance.js b/erpnext/accounts/page/trial_balance/trial_balance.js
index e73e1d4..2edf822 100644
--- a/erpnext/accounts/page/trial_balance/trial_balance.js
+++ b/erpnext/accounts/page/trial_balance/trial_balance.js
@@ -29,6 +29,7 @@
 			this.with_period_closing_entry = this.wrapper
 				.find(".with_period_closing_entry input:checked").length;
 			this._super();
+			this.add_total_debit_credit();
 		},
 
 		update_balances: function(account, posting_date, v) {
@@ -42,6 +43,32 @@
 				this._super(account, posting_date, v);
 			}
 		},
+
+		add_total_debit_credit: function() {
+			var me = this;
+
+			var total_row = {
+				company: me.company,
+				id: "Total Debit / Credit",
+				name: "Total Debit / Credit",
+				indent: 0,
+				opening_dr: "NA",
+				opening_cr: "NA",
+				debit: 0,
+				credit: 0,
+				checked: false,
+			};
+			me.item_by_name[total_row.name] = total_row;
+
+			$.each(this.data, function(i, account) {
+				if((account.group_or_ledger == "Ledger") || (account.rgt - account.lft == 1)) {
+					total_row["debit"] += account.debit;
+					total_row["credit"] += account.credit;
+				}
+			});
+
+			this.data.push(total_row);
+		}
 	})
 	erpnext.trial_balance = new TrialBalance(wrapper, 'Trial Balance');