Added dafult bank account in the customer/supplier
diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py
index 7a79de5..b13259b 100644
--- a/erpnext/accounts/doctype/bank_account/bank_account.py
+++ b/erpnext/accounts/doctype/bank_account/bank_account.py
@@ -33,6 +33,11 @@
 	return doc
 
 @frappe.whitelist()
-def get_account_from_bank_acc(name):
-	return frappe.db.get_value('Bank Account',
-		name, 'account')
\ No newline at end of file
+def get_party_bank_account(party_type, party):
+	return frappe.db.get_value(party_type,
+		party, 'default_bank_account')
+
+@frappe.whitelist()
+def get_bank_account_details(bank_account):
+	return frappe.db.get_value("Bank Account",
+		bank_account, ['account', 'bank', 'bank_account_no'], as_dict=1)
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 58a380c..15cc3fd 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -291,7 +291,12 @@
 							() => frm.events.get_outstanding_documents(frm),
 							() => frm.events.hide_unhide_fields(frm),
 							() => frm.events.set_dynamic_labels(frm),
-							() => { frm.set_party_account_based_on_party = false; }
+							() => {
+								frm.set_party_account_based_on_party = false;
+								if (r.message.bank_account) {
+									frm.set_value("bank_account", r.message.bank_account);
+								}
+							}
 						]);
 					}
 				}
@@ -846,13 +851,15 @@
 		const field = frm.doc.payment_type == "Pay" ? "paid_from":"paid_to";
 		if (frm.doc.bank_account && in_list(['Pay', 'Receive'], frm.doc.payment_type)) {
 			frappe.call({
-				method: "erpnext.accounts.doctype.bank_account.bank_account.get_account_from_bank_acc",
+				method: "erpnext.accounts.doctype.bank_account.bank_account.get_bank_account_details",
 				args: {
 					bank_account: frm.doc.bank_account
 				},
 				callback: function(r) {
 					if (r.message) {
-						frm.set_value(field, r.message);
+						frm.set_value(field, r.message.account);
+						frm.set_value('bank', r.message.bank);
+						frm.set_value('bank_account_no', r.message.bank_account_no);
 					}
 				}
 			});
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index f213ffa..7f1f550 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -12,6 +12,7 @@
 from erpnext.setup.utils import get_exchange_rate
 from erpnext.accounts.general_ledger import make_gl_entries
 from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
+from erpnext.accounts.doctype.bank_account.bank_account import get_party_bank_account, get_bank_account_details
 from erpnext.controllers.accounts_controller import AccountsController, get_supplier_block_status
 
 from six import string_types, iteritems
@@ -88,6 +89,16 @@
 					.format(d.idx, d.reference_doctype, d.reference_name))
 			reference_names.append((d.reference_doctype, d.reference_name))
 
+	def set_bank_account_data(self):
+		if self.bank_account:
+			bank_data = get_bank_account_details(self.bank_account)
+
+			field = "paid_from" if self.payment_type == "Pay" else "paid_to"
+
+			self.bank = bank_data.bank
+			self.bank_account_no = bank_data.bank_account_no
+			self.set(field, bank_data.account)
+
 	def validate_allocated_amount(self):
 		for d in self.get("references"):
 			if (flt(d.allocated_amount))> 0:
@@ -670,6 +681,7 @@
 
 @frappe.whitelist()
 def get_party_details(company, party_type, party, date, cost_center=None):
+	bank_account = ''
 	if not frappe.db.exists(party_type, party):
 		frappe.throw(_("Invalid {0}: {1}").format(party_type, party))
 
@@ -680,13 +692,16 @@
 	_party_name = "title" if party_type == "Student" else party_type.lower() + "_name"
 	party_name = frappe.db.get_value(party_type, party, _party_name)
 	party_balance = get_balance_on(party_type=party_type, party=party, cost_center=cost_center)
+	if party_type in ["Customer", "Supplier"]:
+		bank_account = get_party_bank_account(party_type, party)
 
 	return {
 		"party_account": party_account,
 		"party_name": party_name,
 		"party_account_currency": account_currency,
 		"party_balance": party_balance,
-		"account_balance": account_balance
+		"account_balance": account_balance,
+		"bank_account": bank_account
 	}
 
 
@@ -890,6 +905,11 @@
 	pe.allocate_payment_amount = 1
 	pe.letter_head = doc.get("letter_head")
 
+	if pe.party_type in ["Customer", "Supplier"]:
+		bank_account = get_party_bank_account(pe.party_type, pe.party)
+		pe.set("bank_account", bank_account)
+		pe.set_bank_account_data()
+
 	# only Purchase Invoice can be blocked individually
 	if doc.doctype == "Purchase Invoice" and doc.invoice_is_blocked():
 		frappe.msgprint(_('{0} is on hold till {1}'.format(doc.name, doc.release_date)))
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index d25e6de..eb1146b 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -567,7 +567,7 @@
 	data = frappe.db.sql(""" SELECT party, sum({0}) as amount
 		FROM `tabGL Entry`
 		WHERE party_type = %s and against_voucher is null GROUP BY party"""
-		.format("credit" if party_type == "Customer" else "debit") , party_type, debug=1)
+		.format(("credit - debit") if party_type == "Customer" else "debit") , party_type, debug=1)
 
 	if data:
 		return frappe._dict(data)
\ No newline at end of file
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index a272bfe..73ca8b4 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
@@ -25,8 +25,8 @@
 		credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt"
 
 		columns += [{
-			"label": _("On Account Amount"),
-			"fieldname": "on_account_amt",
+			"label": _("Advance Amount"),
+			"fieldname": "advance_amount",
 			"fieldtype": "Currency",
 			"options": "currency",
 			"width": 100
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 3b1f4e0..4586c64 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -156,6 +156,39 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "default_bank_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Bank Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Bank Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "tax_id", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1463,7 +1496,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2019-01-07 16:52:04.660271", 
+ "modified": "2019-01-17 13:58:08.597792", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier", 
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index 608c0e9..a82042f 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -224,6 +224,39 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "default_bank_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Bank Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Bank Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "lead_name", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1873,7 +1906,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-10-01 10:07:34.510264", 
+ "modified": "2019-01-17 13:10:24.360875", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Customer",