minor fixes
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 777b7bd..8a247cc 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '10.1.23'
+__version__ = '10.1.27'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index 9f06ada..fe1977c 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -71,7 +71,7 @@
 
 		// financial statements
 		for (let report of ['Trial Balance', 'General Ledger', 'Balance Sheet',
-			'Profit and Loss', 'Cash Flow Statement', 'Accounts Payable', 'Accounts Receivable']) {
+			'Profit and Loss Statement', 'Cash Flow Statement', 'Accounts Payable', 'Accounts Receivable']) {
 			treeview.page.add_inner_button(__(report), function() {
 				frappe.set_route('query-report', report, {company: get_company()});
 			}, __('Financial Statements'));
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index 91db378..46fff7d 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -165,7 +165,7 @@
 		tree[child.account_name] = {}
 		
 		# assign account_type and root_type
-		if child.account_type:
+		if child.account_number:
 			tree[child.account_name]["account_number"] = child.account_number
 		if child.account_type:
 			tree[child.account_name]["account_type"] = child.account_type
@@ -193,4 +193,4 @@
 
 		_get_account_names(chart)
 
-	return (bank_account in accounts)
\ No newline at end of file
+	return (bank_account in accounts)
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index 5b7d73f..0556e9b 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -29,11 +29,11 @@
 	cheque_print.html = """
 <div style="position: relative; top:%(starting_position_from_top_edge)scm">
 	<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
-		<span style="top: {{ %(acc_pay_dist_from_top_edge)s }}cm; left: {{ %(acc_pay_dist_from_left_edge)s }}cm;
+		<span style="top:%(acc_pay_dist_from_top_edge)scm; left:%(acc_pay_dist_from_left_edge)scm;
 			border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
 				%(message_to_show)s
 		</span>
-		<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
+		<span style="top:%(date_dist_from_top_edge)scm; left:%(date_dist_from_left_edge)scm;
 			position: absolute;">
 			{{ frappe.utils.formatdate(doc.reference_date) or '' }}
 		</span>
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index 0e03e33..98f68d5 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -23,6 +23,12 @@
 			}, "fa fa-table");
 		}
 
+		if(frm.doc.docstatus==1 && frm.doc.naming_series=="JV-") {
+			frm.add_custom_button(__('Reverse Journal Entry'), function() {
+				return erpnext.journal_entry.reverse_journal_entry(frm);
+			});
+		}
+
 		if (frm.doc.__islocal) {
 			frm.add_custom_button(__('Quick Entry'), function() {
 				return erpnext.journal_entry.quick_entry(frm);
@@ -553,5 +559,20 @@
 			});
 		}
 		return { filters: filters };
+	},
+
+	reverse_journal_entry: function(frm) {
+		var me = frm.doc;
+		for(var i=0; i<me.accounts.length; i++) {
+			me.accounts[i].credit += me.accounts[i].debit;
+			me.accounts[i].debit = me.accounts[i].credit - me.accounts[i].debit;
+			me.accounts[i].credit -= me.accounts[i].debit;
+			me.accounts[i].credit_in_account_currency = me.accounts[i].credit;
+			me.accounts[i].debit_in_account_currency = me.accounts[i].debit;
+			me.accounts[i].reference_type = "Journal Entry";
+			me.accounts[i].reference_name = me.name
+		}
+		frm.copy_doc();
+		cur_frm.reload_doc();
 	}
 });
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json
index 4d445a4..5522d6e 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.json
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json
@@ -129,7 +129,7 @@
    "no_copy": 1, 
    "oldfieldname": "naming_series", 
    "oldfieldtype": "Select", 
-   "options": "JV-", 
+   "options": "JV-\nJV-RET-", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -816,6 +816,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "paid_loan", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Paid Loan", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break98", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1489,7 +1520,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-03-10 07:30:24.319356", 
+ "modified": "2018-04-30 17:34:38.429196", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Journal Entry", 
@@ -1497,7 +1528,6 @@
  "permissions": [
   {
    "amend": 1, 
-   "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
@@ -1517,7 +1547,6 @@
   }, 
   {
    "amend": 1, 
-   "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
@@ -1537,7 +1566,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index addffac..2e4dd83 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -9,7 +9,7 @@
 from erpnext.accounts.utils import get_balance_on, get_account_currency
 from erpnext.accounts.party import get_party_account
 from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
-from erpnext.hr.doctype.employee_loan.employee_loan import update_disbursement_status
+from erpnext.hr.doctype.loan.loan import update_disbursement_status, update_total_amount_paid
 
 from six import string_types, iteritems
 
@@ -46,9 +46,9 @@
 	def on_submit(self):
 		self.check_credit_limit()
 		self.make_gl_entries()
+		self.update_loan()
 		self.update_advance_paid()
 		self.update_expense_claim()
-		self.update_employee_loan()
 
 	def get_title(self):
 		return self.pay_to_recd_from or self.accounts[0].account
@@ -72,7 +72,7 @@
 		self.make_gl_entries(1)
 		self.update_advance_paid()
 		self.update_expense_claim()
-		self.update_employee_loan()
+		self.update_loan()
 		self.unlink_advance_entry_reference()
 		self.unlink_asset_reference()
 
@@ -518,11 +518,17 @@
 				doc = frappe.get_doc("Expense Claim", d.reference_name)
 				update_reimbursed_amount(doc)
 
-	def update_employee_loan(self):
+	def update_loan(self):
+		if self.paid_loan:
+			paid_loan = json.loads(self.paid_loan)
+			value = 1 if self.docstatus < 2 else 0
+			for name in paid_loan:
+				frappe.db.set_value("Repayment Schedule", name, "paid", value)
 		for d in self.accounts:
-			if d.reference_type=="Employee Loan" and flt(d.debit) > 0:
-				doc = frappe.get_doc("Employee Loan", d.reference_name)
+			if d.reference_type=="Loan" and flt(d.debit) > 0:
+				doc = frappe.get_doc("Loan", d.reference_name)
 				update_disbursement_status(doc)
+				update_total_amount_paid(doc)
 
 	def validate_expense_claim(self):
 		for d in self.accounts:
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index 76ff727..98a2a29 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -618,7 +618,7 @@
    "label": "Reference Type", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nEmployee Loan\nPayroll Entry\nEmployee Advance", 
+   "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index bb2d071..2fcca75 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -319,6 +319,7 @@
 	},
 
 	pos_profile: function() {
+		this.frm.doc.taxes = []
 		this.set_pos_data();
 	},
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 121ad6a..5441122 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -4824,7 +4824,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-03-16 15:19:54.711885",
+ "modified": "2018-04-30 16:19:54.711885",
  "modified_by": "Administrator",
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py
index 8f4fe4d..1edc138 100644
--- a/erpnext/accounts/doctype/subscription/subscription.py
+++ b/erpnext/accounts/doctype/subscription/subscription.py
@@ -279,6 +279,7 @@
 			discount_on = self.apply_additional_discount
 			invoice.apply_additional_discount = discount_on if discount_on else 'Grand Total'
 
+		invoice.flags.ignore_mandatory = True
 		invoice.save()
 		invoice.submit()
 
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 63ef832..e95b0f3 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -32,7 +32,7 @@
 			"fieldname":"ageing_based_on",
 			"label": __("Ageing Based On"),
 			"fieldtype": "Select",
-			"options": 'Posting Date\nDue Date',
+			"options": 'Posting Date\nDue Date\nSupplier Invoice Date',
 			"default": "Posting Date"
 		},
 		{
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 6109683..fc730ed 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -151,6 +151,7 @@
 
 					# get due date
 					due_date = voucher_details.get(gle.voucher_no, {}).get("due_date", "")
+					bill_date = voucher_details.get(gle.voucher_no, {}).get("bill_date", "")
 
 					row += [gle.voucher_type, gle.voucher_no, due_date]
 
@@ -167,15 +168,25 @@
 					row += [invoiced_amount, paid_amt, credit_note_amount, outstanding_amount]
 
 					# ageing data
-					entry_date = due_date if self.filters.ageing_based_on == "Due Date" else gle.posting_date
+					if self.filters.ageing_based_on == "Due Date":
+					    entry_date = due_date 
+					elif self.filters.ageing_based_on == "Supplier Invoice Date": 
+					    entry_date = bill_date    
+					else:
+					    entry_date = gle.posting_date
 					row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2),
 						cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
 
+
 					# issue 6371-Ageing buckets should not have amounts if due date is not reached
 					if self.filters.ageing_based_on == "Due Date" \
 							and getdate(due_date) > getdate(self.filters.report_date):
 						row[-1]=row[-2]=row[-3]=row[-4]=0
 
+					if self.filters.ageing_based_on == "Supplier Invoice Date" \
+							and getdate(bill_date) > getdate(self.filters.report_date):
+						row[-1]=row[-2]=row[-3]=row[-4]=0	
+
 					if self.filters.get(scrub(args.get("party_type"))):
 						row.append(gle.account_currency)
 					else:
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 09ec72a..35d2cf0 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -3560,7 +3560,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-03-28 14:09:02.393746",
+ "modified": "2018-03-30 14:09:02.393746",
  "modified_by": "Administrator",
  "module": "Buying", 
  "name": "Purchase Order", 
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index 2142fc7..4cd1b14 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -159,7 +159,7 @@
 			]
 		},
 		{
-			"label": _("Employee Loan Management"),
+			"label": _("Loan Management"),
 			"icon": "icon-list",
 			"items": [
 				{
@@ -169,12 +169,12 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Employee Loan Application",
-					"description": _("Employee Loan Application")
+					"name": "Loan Application",
+					"description": _("Loan Application")
 				},
 				{
 					"type": "doctype",
-					"name": "Employee Loan"
+					"name": "Loan"
 				},
 			]
 		},
diff --git a/erpnext/config/non_profit.py b/erpnext/config/non_profit.py
index 60ca80e..ba32342 100644
--- a/erpnext/config/non_profit.py
+++ b/erpnext/config/non_profit.py
@@ -65,6 +65,26 @@
 			]
 		},
 		{
+			"label": _("Loan Management"),
+			"icon": "icon-list",
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Loan Type",
+					"description": _("Define various loan types")
+				},
+				{
+					"type": "doctype",
+					"name": "Loan Application",
+					"description": _("Loan Application")
+				},
+				{
+					"type": "doctype",
+					"name": "Loan"
+				},
+			]
+		},
+		{
 			"label": _("Grant Application"),
 			"items": [
 				{
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 9f0f574..c70cfcd 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -233,7 +233,7 @@
 
 		tax_master_doctype = self.meta.get_field("taxes_and_charges").options
 
-		if self.is_new() and not self.get("taxes"):
+		if (self.is_new() or self.is_pos_profile_changed()) and not self.get("taxes"):
 			if self.company and not self.get("taxes_and_charges"):
 				# get the default tax master
 				self.taxes_and_charges = frappe.db.get_value(tax_master_doctype,
@@ -241,6 +241,11 @@
 
 			self.append_taxes_from_master(tax_master_doctype)
 
+	def is_pos_profile_changed(self):
+		if (self.doctype == 'Sales Invoice' and self.is_pos and
+			self.pos_profile != frappe.db.get_value('Sales Invoice', self.name, 'pos_profile')):
+			return True
+
 	def append_taxes_from_master(self, tax_master_doctype=None):
 		if self.get("taxes_and_charges"):
 			if not tax_master_doctype:
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 7749ac5..a544119 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -272,18 +272,19 @@
 				else:
 					variant.set(field.fieldname, item.get(field.fieldname))
 
-	variant.variant_of = item.name
-	variant.has_variants = 0
-	if not variant.description:
-		variant.description = ""
+	if 'description' in allow_fields:
+		variant.variant_of = item.name
+		variant.has_variants = 0
+		if not variant.description:
+			variant.description = ""
 
-	if item.variant_based_on=='Item Attribute':
-		if variant.attributes:
-			attributes_description = ""
-			for d in variant.attributes:
-				attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
+		if item.variant_based_on=='Item Attribute':
+			if variant.attributes:
+				attributes_description = ""
+				for d in variant.attributes:
+					attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
 
-			if attributes_description not in variant.description:
+				if attributes_description not in variant.description:
 					variant.description += attributes_description
 
 def make_variant_item_code(template_item_code, template_item_name, variant):
diff --git a/erpnext/docs/assets/img/asset/book-asset-depreciation-accounting-automatically.png b/erpnext/docs/assets/img/asset/book-asset-depreciation-accounting-automatically.png
new file mode 100644
index 0000000..db0187d
--- /dev/null
+++ b/erpnext/docs/assets/img/asset/book-asset-depreciation-accounting-automatically.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/loan-repayment.gif b/erpnext/docs/assets/img/human-resources/loan-repayment.gif
new file mode 100644
index 0000000..4144984
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/loan-repayment.gif
Binary files differ
diff --git a/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md b/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md
index 3f1d6eb..8fd348a 100644
--- a/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md
+++ b/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md
@@ -1,4 +1,4 @@
-#Tracking Project Profibitability using Cost Center
+#Tracking Project Profitability using Cost Center
 
 To track expenses and profibility for a project, you can use Cost Centers. You should create separate Cost Center for each Project. This will allow you to.
 
@@ -77,4 +77,4 @@
 
 [Click here to learn how to do budgeting from Cost Center](/docs/user/manual/en/accounts/budgeting.html).
 
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/asset/assets.md b/erpnext/docs/user/manual/en/asset/assets.md
index a5a84b6..9bc1a51 100644
--- a/erpnext/docs/user/manual/en/asset/assets.md
+++ b/erpnext/docs/user/manual/en/asset/assets.md
@@ -52,6 +52,8 @@
 
 If you are required to calculate the depreciation based on your Fiscal Year and prorated by the number of days left, select the corresponding option in "Account Settings".
 
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/asset/book-asset-depreciation-accounting-automatically.png">
+
 The system will automatically set the fiscal year end date as the next depreciation date and calculate the depreciation amount prorata temporis based on the Available-for-use Date (IFRS16)
 
 <img class="screenshot" alt="Asset" src="/docs/assets/img/asset/asset-prorated-depreciation.png">
diff --git a/erpnext/docs/user/manual/en/human-resources/articles/index.txt b/erpnext/docs/user/manual/en/human-resources/articles/index.txt
index 3019af5..d1e355c 100644
--- a/erpnext/docs/user/manual/en/human-resources/articles/index.txt
+++ b/erpnext/docs/user/manual/en/human-resources/articles/index.txt
@@ -1,3 +1,3 @@
-employees-loan-management
+loan-management
 leave-calculation-in-salary-slip
 working-days-in-salary-slip
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md b/erpnext/docs/user/manual/en/human-resources/articles/loan-management.md
similarity index 69%
rename from erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md
rename to erpnext/docs/user/manual/en/human-resources/articles/loan-management.md
index dae54ba..160970d 100644
--- a/erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md
+++ b/erpnext/docs/user/manual/en/human-resources/articles/loan-management.md
@@ -1,16 +1,16 @@
-<h1>Employees Loan Management</h1>
+<h1>Loan Management</h1>
 
-Employee Loan is an sum of money paid by Employer to Employee based on certain terms and condition. There are multiple ways accounting for the Employee loan can be managed. Company could collect loan from an employee separately. Or they can choose to deduct loan installment from the employee's salary.
+Loan is an sum of money paid by Employer to Employee based on certain terms and condition. There are multiple ways accounting for the loan can be managed. Company could collect loan from an employee separately. Or they can choose to deduct loan installment from the employee's salary.
 
-Let's check below how accounting can be managed for Employee Loan in ERPNext.
+Let's check below how accounting can be managed for Loan in ERPNext.
 
 ### 1. Setup Masters
 
 Create following Groups and Ledgers in Chart of Accounts if not there.
       
-#### 1.1  Employee Loan Account
+#### 1.1  Loan Account
 
-Create Group as 'Employees Loans' under Current Assets and create employee loan A/C (Ledger) under it. [Check this link for new account creation](/docs/user/manual/en/setting-up/articles/managing-tree-structure-masters)
+Create Group as 'Loans' under Current Assets and create loan A/C (Ledger) under it. [Check this link for new account creation](/docs/user/manual/en/setting-up/articles/managing-tree-structure-masters)
 
 ![CoA]({{docs_base_url}}/assets/img/articles/Selection_433.png)
 
@@ -26,7 +26,7 @@
 
 ### 2. Book Loan Amount
 
-Once loan amount is finalized, make journal voucher to book loan payment entry. You should Credit Loan amount to Bank/Cash account and Debit Loan amount employee loan account.  
+Once loan amount is finalized, make journal voucher to book loan payment entry. You should Credit Loan amount to Bank/Cash account and Debit Loan amount loan account.  
 
 ![Loan Entry]({{docs_base_url}}/assets/img/articles/Selection_435.png)
 
diff --git a/erpnext/docs/user/manual/en/human-resources/employee-loan-management.md b/erpnext/docs/user/manual/en/human-resources/employee-loan-management.md
deleted file mode 100644
index e85b5d6..0000000
--- a/erpnext/docs/user/manual/en/human-resources/employee-loan-management.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Employee Loan Management
-This module enables companies which provides employee loans to define and manage employee loans.
-Employees can request loans, which are then reviewed and approved. For the approved loans, 
-repayment schedule for the entire loan cycle can be generated and automatic deduction from salary can also be set up. 
-
-### Loan Type
-To create a new Loan Type go to:
-
-> Human Resources > Employee Loan Management > Loan Type > New Loan Type
-
-Configure Loan limit and Rate of interest.
-
-<img class="screenshot" alt="Loan Type" src="{{docs_base_url}}/assets/img/human-resources/loan-type.png">
-
-### Employee Loan Application
-
-Employee can apply for loan by going to:
-
-> Human Resources > Employee Loan Management > Employee Loan Application > New Employee Loan Application
-
-<img class="screenshot" alt="Employee Loan Application" src="{{docs_base_url}}/assets/img/human-resources/employee-loan-application.png">
-
-#### In the Employee Loan Application,
-
-  * Enter Employee details and Loan details
-  * Select the repayment method, and based on your selection enter Repayment Period in Months or repayment Amount
-  
-On save, Employee can see Repayment Information and make changes if required before submitting.
-
-<img class="screenshot" alt="Employee Loan Application" src="{{docs_base_url}}/assets/img/human-resources/repayment-info.png">
-
-### Employee Loan
-
-Once the Loan is approved, Manager can create Employee Loan record for the Employee.
-
-> Human Resources > Employee Loan Management > Employee Loan > New Employee Loan
-
-<img class="screenshot" alt="Employee Loan Application" src="{{docs_base_url}}/assets/img/human-resources/employee-loan.png">
-
-#### In the Employee Loan,
-
- * Enter Employee and Loan Application
- * Check "Repay from Salary" if the loan repayment will be deducted from the salary
- * Enter Disbursement Date and Account Info
- * As soon as you hit save, the repayment schedule is generated.
- 
-<img class="screenshot" alt="repayment Schedule" src="{{docs_base_url}}/assets/img/human-resources/repayment-schedule.png">
-
-#### Loan repayment deduction from Salary
-
-To auto deduct the Loan repayment from Salary, check "Repay from Salary" in Employee Loan. It will appear as Loan repayment in Salary Slip.
-
-<img class="screenshot" alt="Salary Slip" src="{{docs_base_url}}/assets/img/human-resources/loan-repayment-salary-slip.png">
-
-<div class="embed-container">
-  <iframe src="https://www.youtube.com/embed/IUM0t7t4zFU?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
-  </iframe>
-</div>
-
-{nex}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/human-resources/index.txt b/erpnext/docs/user/manual/en/human-resources/index.txt
index 758c419..479e2dd 100644
--- a/erpnext/docs/user/manual/en/human-resources/index.txt
+++ b/erpnext/docs/user/manual/en/human-resources/index.txt
@@ -17,5 +17,5 @@
 human-resource-setup
 daily-work-summary
 fleet-management
-employee-loan-management
+loan-management
 articles
diff --git a/erpnext/docs/user/manual/en/human-resources/loan-management.md b/erpnext/docs/user/manual/en/human-resources/loan-management.md
new file mode 100644
index 0000000..d8a548b
--- /dev/null
+++ b/erpnext/docs/user/manual/en/human-resources/loan-management.md
@@ -0,0 +1,69 @@
+# Loan Management
+This module enables companies which provides loans to define and manage loans.
+Employees can request loans, which are then reviewed and approved. For the approved loans, 
+repayment schedule for the entire loan cycle can be generated and automatic deduction from salary can also be set up. 
+
+### Loan Type
+To create a new Loan Type go to:
+
+> Human Resources > Loan Management > Loan Type > New Loan Type
+
+Configure Loan limit and Rate of interest.
+
+<img class="screenshot" alt="Loan Type" src="{{docs_base_url}}/assets/img/human-resources/loan-type.png">
+
+### Loan Application
+
+Employee can apply for loan by going to:
+
+> Human Resources > Loan Management > Loan Application > New Loan Application
+
+<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/employee-loan-application.png">
+
+#### In the Loan Application,
+
+  * Enter Employee details and Loan details
+  * Select the repayment method, and based on your selection enter Repayment Period in Months or repayment Amount
+  
+On save, Employee can see Repayment Information and make changes if required before submitting.
+
+<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/repayment-info.png">
+
+### Loan
+
+Once the Loan is approved, Manager can create Loan record for the Employee.
+
+> Human Resources > Loan Management > Loan > New Loan
+
+<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/employee-loan.png">
+
+#### In the Loan,
+
+ * Enter Employee and Loan Application
+ * Check "Repay from Salary" if the loan repayment will be deducted from the salary
+ * Enter Disbursement Date, Repayment Start Date, and Account Info
+ * If the amount has been disbursed and status is set to "Disbursed", as soon as you hit save, the repayment schedule is generated.
+ * The first repayment payment date would be set as per the "Repayment Start Date".  
+ 
+<img class="screenshot" alt="repayment Schedule" src="{{docs_base_url}}/assets/img/human-resources/repayment-schedule.png">
+
+#### Loan Repayment for Members
+
+* After submitting the document, if the status is "Disbursed" and "Repay from Salary" is unchecked, you can click on "Make Repayment Entry" and select the payments which haven't been paid till date.
+* After selecting the rows, you will be routed to Journal Entry where the selected payments will be added and placed in their respective Debit/ Credit accounts.
+* On submitting the Journal Entry, "Paid" will be checked in the payment rows of the Repayment Schedule, for which the Journal entry has been created.
+
+<img class="screenshot" alt="Make Repayment" src="{{docs_base_url}}/assets/img/human-resources/loan-repayment.gif">
+
+#### Loan repayment deduction from Salary
+
+To auto deduct the Loan repayment from Salary, check "Repay from Salary" in Loan. It will appear as Loan repayment in Salary Slip.
+
+<img class="screenshot" alt="Salary Slip" src="{{docs_base_url}}/assets/img/human-resources/loan-repayment-salary-slip.png">
+
+<div class="embed-container">
+  <iframe src="https://www.youtube.com/embed/IUM0t7t4zFU?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+  </iframe>
+</div>
+
+{next}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/selling/articles/erpnext-for-services-organization.md b/erpnext/docs/user/manual/en/selling/articles/erpnext-for-services-organization.md
index 0e1e683..a486519 100644
--- a/erpnext/docs/user/manual/en/selling/articles/erpnext-for-services-organization.md
+++ b/erpnext/docs/user/manual/en/selling/articles/erpnext-for-services-organization.md
@@ -40,6 +40,9 @@
 
 You can also refer to help video on User and Permissions setting in ERPNext.
 
-<iframe width="660" height="371" src="https://www.youtube.com/embed/fnBoRhBrwR4" frameborder="0" allowfullscreen></iframe>
+<div class="embed-container">
+    <iframe src="https://www.youtube.com/embed/8Slw1hsTmUI" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+    </iframe>
+</div>
 
 <!-- markdown -->
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/authorization-rule.md b/erpnext/docs/user/manual/en/setting-up/authorization-rule.md
index 8b99894..138a62e 100644
--- a/erpnext/docs/user/manual/en/setting-up/authorization-rule.md
+++ b/erpnext/docs/user/manual/en/setting-up/authorization-rule.md
@@ -10,7 +10,7 @@
 
 Let's consider an example of Authorization Rule to learn better.
 
-Assume that Sales Manager needs to authorize Sales Orders, only if its Grand Total value exceeds 10000. If Sales Orer values is less than 10000, then even Sales User will be able to submit it. It means Submit permision of Sales User will be restricted only upto Sales Order of Grand Total less than 10000.
+Assume that Sales Manager needs to authorize Sales Orders, only if its Grand Total value exceeds 10000. If Sales Order values is less than 10000, then even Sales User will be able to submit it. It means Submit permision of Sales User will be restricted only upto Sales Order of Grand Total less than 10000.
 
 **Step 1:**
 
diff --git a/erpnext/docs/user/manual/en/setting-up/feedback/manual-feedback-request.md b/erpnext/docs/user/manual/en/setting-up/feedback/manual-feedback-request.md
index 4afaee1..2e6b12b 100644
--- a/erpnext/docs/user/manual/en/setting-up/feedback/manual-feedback-request.md
+++ b/erpnext/docs/user/manual/en/setting-up/feedback/manual-feedback-request.md
@@ -4,7 +4,7 @@
 Feedback Trigger.
 
 To request a feedback manually go to respective document e.g. Sales Order, Issue etc.
-and click on Ask a Feedback option in Menu.
+and click on Request Feedback option in Menu.
 
 <img class="screenshot" alt="Setting Condition" src="{{docs_base_url}}/assets/img/setup/feedback/manual-feedback-request-option.png">
 
diff --git a/erpnext/docs/user/manual/en/website/setup/social-login-keys.md b/erpnext/docs/user/manual/en/website/setup/social-login-keys.md
index be67a8b..26743c0 100644
--- a/erpnext/docs/user/manual/en/website/setup/social-login-keys.md
+++ b/erpnext/docs/user/manual/en/website/setup/social-login-keys.md
@@ -6,9 +6,26 @@
 
 Checkout the following Video Tutorials to understand how to enable social logins on ERPNext
 
-* for FaceBook - https://www.youtube.com/watch?v=zC6Q6gIfiw8
-* for Google - https://www.youtube.com/watch?v=w_EAttrE9sw 
-* for GitHub - https://www.youtube.com/watch?v=bG71DxxkVjQ
+* for FaceBook: 
+
+<div class="embed-container">
+    <iframe src="https://www.youtube.com/embed/zC6Q6gIfiw8?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+    </iframe>
+</div>
+
+* for Google:  
+
+<div class="embed-container">
+    <iframe width="560" height="315" src="https://www.youtube.com/embed/w_EAttrE9sw?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+    </iframe>
+</div>
+
+* for GitHub:  
+
+<div class="embed-container">
+    <iframe width="560" height="315" src="https://www.youtube.com/embed/bG71DxxkVjQ?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
+    </iframe>
+</div>
 
 For Google the *Authorized redirect URI* is [yoursite]/api/method/frappe.www.login.login_via_google
 
diff --git a/erpnext/education/doctype/course_schedule/course_schedule_calendar.js b/erpnext/education/doctype/course_schedule/course_schedule_calendar.js
index 4fb6913..803527e 100644
--- a/erpnext/education/doctype/course_schedule/course_schedule_calendar.js
+++ b/erpnext/education/doctype/course_schedule/course_schedule_calendar.js
@@ -8,7 +8,7 @@
 		"allDay": "allDay"
 	},
 	gantt: false,
-	order_by: "from_time",
+	order_by: "schedule_date",
 	filters: [
 		{
 			"fieldtype": "Link",
diff --git a/erpnext/education/doctype/student/student.js b/erpnext/education/doctype/student/student.js
index cadf272..2c933e2 100644
--- a/erpnext/education/doctype/student/student.js
+++ b/erpnext/education/doctype/student/student.js
@@ -15,5 +15,15 @@
 				}
 			};
 		})
+	},
+	refresh: function(frm) {
+		if(!frm.is_new()) {
+
+			// custom buttons
+			frm.add_custom_button(__('Accounting Ledger'), function() {
+				frappe.set_route('query-report', 'General Ledger',
+					{party_type:'Student', party:frm.doc.name});
+			});
+		}
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/education/doctype/student_group/student_group.js b/erpnext/education/doctype/student_group/student_group.js
index f3f8c88..5373df9 100644
--- a/erpnext/education/doctype/student_group/student_group.js
+++ b/erpnext/education/doctype/student_group/student_group.js
@@ -82,36 +82,39 @@
 					max_roll_no = d.group_roll_number;
 				}
 			});
-			frappe.call({
-				method: "erpnext.education.doctype.student_group.student_group.get_students",
-				args: {
-					"academic_year": frm.doc.academic_year,
-					"academic_term": frm.doc.academic_term,
-					"group_based_on": frm.doc.group_based_on,
-					"program": frm.doc.program,
-					"batch" : frm.doc.batch,
-					"course": frm.doc.course	
-				},
-				callback: function(r) {
-					if(r.message) {
-						$.each(r.message, function(i, d) {
-							if(!in_list(student_list, d.student)) {
-								var s = frm.add_child("students");
-								s.student = d.student;
-								s.student_name = d.student_name;
-								if (d.active === 0) {
-									s.active = 0;
+
+			if(frm.doc.academic_year) {
+				frappe.call({
+					method: "erpnext.education.doctype.student_group.student_group.get_students",
+					args: {
+						"academic_year": frm.doc.academic_year,
+						"academic_term": frm.doc.academic_term,
+						"group_based_on": frm.doc.group_based_on,
+						"program": frm.doc.program,
+						"batch" : frm.doc.batch,
+						"course": frm.doc.course
+					},
+					callback: function(r) {
+						if(r.message) {
+							$.each(r.message, function(i, d) {
+								if(!in_list(student_list, d.student)) {
+									var s = frm.add_child("students");
+									s.student = d.student;
+									s.student_name = d.student_name;
+									if (d.active === 0) {
+										s.active = 0;
+									}
+									s.group_roll_number = ++max_roll_no;
 								}
-								s.group_roll_number = ++max_roll_no;
-							}
-						});
-						refresh_field("students");
-						frm.save();
-					} else {
-						frappe.msgprint(__("Student Group is already updated."))
+							});
+							refresh_field("students");
+							frm.save();
+						} else {
+							frappe.msgprint(__("Student Group is already updated."))
+						}
 					}
-				}
-			})	
+				})
+			}
 		} else {
 			frappe.msgprint(__("Select students manually for the Activity based Group"));
 		}
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
index 2905949..c35e397 100644
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
@@ -1,13 +1,14 @@
 
 frappe.views.calendar["Patient Appointment"] = {
 	field_map: {
-		"start": "start",
-		"end": "end",
+		"start": "appointment_date",
+		"end": "appointment_datetime",
 		"id": "name",
 		"title": "patient",
 		"allDay": "allDay",
 		"eventColor": "color"
 	},
+	order_by: "appointment_date",
 	gantt: true,
 	get_events_method: "erpnext.healthcare.doctype.patient_appointment.patient_appointment.get_events",
 	filters: [
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index 5e1013d..240411d 100755
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -14,17 +14,6 @@
 			return { query: "erpnext.controllers.queries.employee_query"} }
 	},
 
-	onload: function() {
-		this.frm.set_query("leave_approver", "leave_approvers", function(doc) {
-			return {
-				query:"erpnext.hr.doctype.employee_leave_approver.employee_leave_approver.get_approvers",
-				filters:{
-					user: doc.user_id
-				}
-			}
-		});
-	},
-
 	refresh: function() {
 		var me = this;
 		erpnext.toggle_naming_series();
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index cd97e3f..0f11639 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -40,7 +40,6 @@
 		self.validate_date()
 		self.validate_email()
 		self.validate_status()
-		self.validate_employee_leave_approver()
 		self.validate_reports_to()
 		self.validate_preferred_email()
 
@@ -150,11 +149,6 @@
 			throw(_("User {0} is already assigned to Employee {1}").format(
 				self.user_id, employee[0]), frappe.DuplicateEntryError)
 
-	def validate_employee_leave_approver(self):
-		for l in self.get("leave_approvers")[:]:
-			if "Leave Approver" not in frappe.get_roles(l.leave_approver):
-				frappe.get_doc("User", l.leave_approver).add_roles("Leave Approver")
-
 	def validate_reports_to(self):
 		if self.reports_to == self.name:
 			throw(_("Employee cannot report to himself."))
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.js b/erpnext/hr/doctype/employee_loan/employee_loan.js
deleted file mode 100644
index 1f38105..0000000
--- a/erpnext/hr/doctype/employee_loan/employee_loan.js
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Employee Loan', {
-	onload: function (frm) {
-		frm.set_query("employee_loan_application", function () {
-			return {
-				"filters": {
-					"employee": frm.doc.employee,
-					"docstatus": 1,
-					"status": "Approved"
-				}
-			};
-		});
-
-		frm.set_query("interest_income_account", function () {
-			return {
-				"filters": {
-					"company": frm.doc.company,
-					"root_type": "Income",
-					"is_group": 0
-				}
-			};
-		});
-
-		frm.set_query("employee", function() {
-			return {
-				"filters": {
-					"company": frm.doc.company,
-				}
-			};
-		});
-
-		$.each(["payment_account", "employee_loan_account"], function (i, field) {
-			frm.set_query(field, function () {
-				return {
-					"filters": {
-						"company": frm.doc.company,
-						"root_type": "Asset",
-						"is_group": 0
-					}
-				};
-			});
-		})
-	},
-
-	refresh: function (frm) {
-		if (frm.doc.docstatus == 1 && (frm.doc.status == "Sanctioned" || frm.doc.status == "Partially Disbursed")) {
-			frm.add_custom_button(__('Make Disbursement Entry'), function () {
-				frm.trigger("make_jv");
-			})
-		}
-		frm.trigger("toggle_fields");
-	},
-
-	make_jv: function (frm) {
-		frappe.call({
-			args: {
-				"employee_loan": frm.doc.name,
-				"company": frm.doc.company,
-				"employee_loan_account": frm.doc.employee_loan_account,
-				"employee": frm.doc.employee,
-				"loan_amount": frm.doc.loan_amount,
-				"payment_account": frm.doc.payment_account
-			},
-			method: "erpnext.hr.doctype.employee_loan.employee_loan.make_jv_entry",
-			callback: function (r) {
-				if (r.message)
-					var doc = frappe.model.sync(r.message)[0];
-				frappe.set_route("Form", doc.doctype, doc.name);
-			}
-		})
-	},
-	mode_of_payment: function (frm) {
-		frappe.call({
-			method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
-			args: {
-				"mode_of_payment": frm.doc.mode_of_payment,
-				"company": frm.doc.company
-			},
-			callback: function (r, rt) {
-				if (r.message) {
-					frm.set_value("payment_account", r.message.account);
-				}
-			}
-		});
-	},
-
-	employee_loan_application: function (frm) {
-	    if(frm.doc.employee_loan_application){
-            return frappe.call({
-                method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
-                args: {
-                    "employee_loan_application": frm.doc.employee_loan_application
-                },
-                callback: function (r) {
-                    if (!r.exc && r.message) {
-                        frm.set_value("loan_type", r.message.loan_type);
-                        frm.set_value("loan_amount", r.message.loan_amount);
-                        frm.set_value("repayment_method", r.message.repayment_method);
-                        frm.set_value("monthly_repayment_amount", r.message.repayment_amount);
-                        frm.set_value("repayment_periods", r.message.repayment_periods);
-                        frm.set_value("rate_of_interest", r.message.rate_of_interest);
-                    }
-                }
-            });
-        }
-	},
-
-	repayment_method: function (frm) {
-		frm.trigger("toggle_fields")
-	},
-
-	toggle_fields: function (frm) {
-		frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method == "Repay Fixed Amount per Period")
-		frm.toggle_enable("repayment_periods", frm.doc.repayment_method == "Repay Over Number of Periods")
-	}
-});
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.py b/erpnext/hr/doctype/employee_loan/employee_loan.py
deleted file mode 100644
index 1751835..0000000
--- a/erpnext/hr/doctype/employee_loan/employee_loan.py
+++ /dev/null
@@ -1,160 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-import frappe, math
-import erpnext
-from frappe import _
-from frappe.utils import flt, rounded, add_months, nowdate
-from erpnext.controllers.accounts_controller import AccountsController
-
-class EmployeeLoan(AccountsController):
-	def validate(self):
-		check_repayment_method(self.repayment_method, self.loan_amount, self.monthly_repayment_amount, self.repayment_periods)
-		if not self.company:
-			self.company = erpnext.get_default_company()
-		if not self.posting_date:
-			self.posting_date = nowdate()
-		if self.loan_type and not self.rate_of_interest:
-			self.rate_of_interest = frappe.db.get_value("Loan Type", self.loan_type, "rate_of_interest")
-		if self.repayment_method == "Repay Over Number of Periods":
-			self.monthly_repayment_amount = get_monthly_repayment_amount(self.repayment_method, self.loan_amount, self.rate_of_interest, self.repayment_periods)
-
-		self.make_repayment_schedule()
-		self.set_repayment_period()
-		self.calculate_totals()
-
-	def make_jv_entry(self):
-		self.check_permission('write')
-		journal_entry = frappe.new_doc('Journal Entry')
-		journal_entry.voucher_type = 'Bank Entry'
-		journal_entry.user_remark = _('Against Employee Loan: {0}').format(self.name)
-		journal_entry.company = self.company
-		journal_entry.posting_date = nowdate()
-
-		account_amt_list = []
-
-		account_amt_list.append({
-			"account": self.employee_loan_account,
-			"party_type": "Employee",
-			"party": self.employee,
-			"debit_in_account_currency": self.loan_amount,
-			"reference_type": "Employee Loan",
-			"reference_name": self.name,
-			})
-		account_amt_list.append({
-			"account": self.payment_account,
-			"credit_in_account_currency": self.loan_amount,
-			"reference_type": "Employee Loan",
-			"reference_name": self.name,
-			})
-		journal_entry.set("accounts", account_amt_list)
-		return journal_entry.as_dict()
-
-	def make_repayment_schedule(self):
-		self.repayment_schedule = []
-		payment_date = self.disbursement_date
-		balance_amount = self.loan_amount
-
-		while(balance_amount > 0):
-			interest_amount = rounded(balance_amount * flt(self.rate_of_interest) / (12*100))
-			principal_amount = self.monthly_repayment_amount - interest_amount
-			balance_amount = rounded(balance_amount + interest_amount - self.monthly_repayment_amount)
-
-			if balance_amount < 0:
-				principal_amount += balance_amount
-				balance_amount = 0.0
-
-			total_payment = principal_amount + interest_amount
-
-			self.append("repayment_schedule", {
-				"payment_date": payment_date,
-				"principal_amount": principal_amount,
-				"interest_amount": interest_amount,
-				"total_payment": total_payment,
-				"balance_loan_amount": balance_amount
-			})
-
-			next_payment_date = add_months(payment_date, 1)
-			payment_date = next_payment_date
-
-	def set_repayment_period(self):
-		if self.repayment_method == "Repay Fixed Amount per Period":
-			repayment_periods = len(self.repayment_schedule)
-
-			self.repayment_periods = repayment_periods
-
-	def calculate_totals(self):
-		self.total_payment = 0
-		self.total_interest_payable = 0
-		for data in self.repayment_schedule:
-			self.total_payment += data.total_payment
-			self.total_interest_payable +=data.interest_amount
-
-
-def update_disbursement_status(doc):
-	disbursement = frappe.db.sql("""select posting_date, ifnull(sum(debit_in_account_currency), 0) as disbursed_amount 
-		from `tabGL Entry` where against_voucher_type = 'Employee Loan' and against_voucher = %s""", 
-		(doc.name), as_dict=1)[0]
-	if disbursement.disbursed_amount == doc.loan_amount:
-		frappe.db.set_value("Employee Loan", doc.name , "status", "Fully Disbursed")
-	if disbursement.disbursed_amount < doc.loan_amount and disbursement.disbursed_amount != 0:
-		frappe.db.set_value("Employee Loan", doc.name , "status", "Partially Disbursed")
-	if disbursement.disbursed_amount == 0:
-		frappe.db.set_value("Employee Loan", doc.name , "status", "Sanctioned")
-	if disbursement.disbursed_amount > doc.loan_amount:
-		frappe.throw(_("Disbursed Amount cannot be greater than Loan Amount {0}").format(doc.loan_amount))
-	if disbursement.disbursed_amount > 0:
-		frappe.db.set_value("Employee Loan", doc.name , "disbursement_date", disbursement.posting_date)	
-	
-def check_repayment_method(repayment_method, loan_amount, monthly_repayment_amount, repayment_periods):
-	if repayment_method == "Repay Over Number of Periods" and not repayment_periods:
-		frappe.throw(_("Please enter Repayment Periods"))
-		
-	if repayment_method == "Repay Fixed Amount per Period":
-		if not monthly_repayment_amount:
-			frappe.throw(_("Please enter repayment Amount"))
-		if monthly_repayment_amount > loan_amount:
-			frappe.throw(_("Monthly Repayment Amount cannot be greater than Loan Amount"))
-
-def get_monthly_repayment_amount(repayment_method, loan_amount, rate_of_interest, repayment_periods):
-	if rate_of_interest:
-		monthly_interest_rate = flt(rate_of_interest) / (12 *100)
-		monthly_repayment_amount = math.ceil((loan_amount * monthly_interest_rate *
-			(1 + monthly_interest_rate)**repayment_periods) \
-			/ ((1 + monthly_interest_rate)**repayment_periods - 1))
-	else:
-		monthly_repayment_amount = math.ceil(flt(loan_amount) / repayment_periods)
-	return monthly_repayment_amount
-
-@frappe.whitelist()
-def get_employee_loan_application(employee_loan_application):
-	employee_loan = frappe.get_doc("Employee Loan Application", employee_loan_application)
-	if employee_loan:
-		return employee_loan.as_dict()
-
-@frappe.whitelist()
-def make_jv_entry(employee_loan, company, employee_loan_account, employee, loan_amount, payment_account=None):
-	journal_entry = frappe.new_doc('Journal Entry')
-	journal_entry.voucher_type = 'Bank Entry'
-	journal_entry.user_remark = _('Against Employee Loan: {0}').format(employee_loan)
-	journal_entry.company = company
-	journal_entry.posting_date = nowdate()
-
-	account_amt_list = []
-
-	account_amt_list.append({
-		"account": employee_loan_account,
-		"debit_in_account_currency": loan_amount,
-		"reference_type": "Employee Loan",
-		"reference_name": employee_loan,
-		})
-	account_amt_list.append({
-		"account": payment_account,
-		"credit_in_account_currency": loan_amount,
-		"reference_type": "Employee Loan",
-		"reference_name": employee_loan,
-		})
-	journal_entry.set("accounts", account_amt_list)
-	return journal_entry.as_dict()
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_loan/test_employee_loan.py b/erpnext/hr/doctype/employee_loan/test_employee_loan.py
deleted file mode 100644
index abc96fd..0000000
--- a/erpnext/hr/doctype/employee_loan/test_employee_loan.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import frappe
-import erpnext
-import unittest
-from frappe.utils import nowdate
-from erpnext.hr.doctype.salary_structure.test_salary_structure import make_employee
-
-class TestEmployeeLoan(unittest.TestCase):
-	def setUp(self):
-		create_loan_type("Personal Loan", 500000, 8.4)
-		self.employee = make_employee("robert_loan@loan.com")
-		create_employee_loan(self.employee, "Personal Loan", 280000, "Repay Over Number of Periods", 20)
-	
-	def test_employee_loan(self):
-		employee_loan = frappe.get_doc("Employee Loan", {"employee":self.employee})
-		self.assertEqual(employee_loan.monthly_repayment_amount, 15052)
-		self.assertEqual(employee_loan.total_interest_payable, 21034)
-		self.assertEqual(employee_loan.total_payment, 301034)
-
-		schedule = employee_loan.repayment_schedule
-
-		self.assertEqual(len(schedule), 20)
-
-		for idx, principal_amount, interest_amount, balance_loan_amount in [[3, 13369, 1683, 227079], [19, 14941, 105, 0], [17, 14740, 312, 29785]]:
-			self.assertEqual(schedule[idx].principal_amount, principal_amount)
-			self.assertEqual(schedule[idx].interest_amount, interest_amount)
-			self.assertEqual(schedule[idx].balance_loan_amount, balance_loan_amount)
-
-		employee_loan.repayment_method = "Repay Fixed Amount per Period"
-		employee_loan.monthly_repayment_amount = 14000
-		employee_loan.save()
-
-		self.assertEqual(len(employee_loan.repayment_schedule), 22)
-		self.assertEqual(employee_loan.total_interest_payable, 22712)
-		self.assertEqual(employee_loan.total_payment, 302712)
-
-def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
-	if not frappe.db.exists("Loan Type", loan_name):
-		frappe.get_doc({
-			"doctype": "Loan Type",
-			"loan_name": loan_name,
-			"maximum_loan_amount": maximum_loan_amount,
-			"rate_of_interest": rate_of_interest
-		}).insert()
-
-def	create_employee_loan(employee, loan_type, loan_amount, repayment_method, repayment_periods):
-	create_loan_type(loan_type, 500000, 8.4)
-	if not frappe.db.get_value("Employee Loan", {"employee":employee}):
-		employee_loan = frappe.new_doc("Employee Loan")
-		employee_loan.update({
-				"employee": employee,
-				"loan_type": loan_type,
-				"loan_amount": loan_amount,
-				"repayment_method": repayment_method,
-				"repayment_periods": repayment_periods,
-				"disbursement_date": nowdate(),
-				"mode_of_payment": frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name'),
-				"payment_account": frappe.db.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name"),
-				"employee_loan_account": frappe.db.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name"),
-				"interest_income_account": frappe.db.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
-			})
-		employee_loan.insert()
-		return employee_loan
-	else:
-		return frappe.get_doc("Employee Loan", {"employee":employee})
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
index f89beba..3e031c9 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -77,9 +77,27 @@
 		])
 
 		for gle in gl_entries:
-			self.assertEqual(expected_values[gle.account][0], gle.account)
-			self.assertEqual(expected_values[gle.account][1], gle.debit)
-			self.assertEqual(expected_values[gle.account][2], gle.credit)
+			self.assertEquals(expected_values[gle.account][0], gle.account)
+			self.assertEquals(expected_values[gle.account][1], gle.debit)
+			self.assertEquals(expected_values[gle.account][2], gle.credit)
+
+	def test_rejected_expense_claim(self):
+		payable_account = get_payable_account("Wind Power LLC")
+		expense_claim = frappe.get_doc({
+			 "doctype": "Expense Claim",
+			 "employee": "_T-Employee-00001",
+			 "payable_account": payable_account,
+			 "approval_status": "Rejected",
+			 "expenses":
+			 	[{ "expense_type": "Travel", "default_account": "Travel Expenses - WP", "claim_amount": 300, "sanctioned_amount": 200 }]
+		})
+		expense_claim.submit()
+
+		self.assertEquals(expense_claim.status, 'Rejected')
+		self.assertEquals(expense_claim.total_sanctioned_amount, 0.0)
+
+		gl_entry = frappe.get_all('GL Entry', {'voucher_type': 'Expense Claim', 'voucher_no': expense_claim.name})
+		self.assertEquals(len(gl_entry), 0)
 
 def get_payable_account(company):
 	return frappe.db.get_value('Company', company, 'default_payable_account')
@@ -89,6 +107,7 @@
 		 "doctype": "Expense Claim",
 		 "employee": "_T-Employee-00001",
 		 "payable_account": payable_account,
+		 "approval_status": "Approved",
 		 "company": company,
 		 "expenses":
 			[{ "expense_type": "Travel", "default_account": account, "claim_amount": claim_amount, "sanctioned_amount": sanctioned_amount }]
@@ -100,5 +119,3 @@
 
 	expense_claim.submit()
 	return expense_claim
-
-
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js b/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js
index 3cc8dd5..507d070 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js
+++ b/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js
@@ -3,8 +3,8 @@
 
 frappe.views.calendar["Holiday List"] = {
 	field_map: {
-		"start": "holiday_date",
-		"end": "holiday_date",
+		"start": "from_date",
+		"end": "to_date",
 		"id": "name",
 		"title": "description",
 		"allDay": "allDay"
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index 085fa3c..242c987 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -110,6 +110,15 @@
 
 	calculate_total_days: function(frm) {
 		if(frm.doc.from_date && frm.doc.to_date && frm.doc.employee && frm.doc.leave_type) {
+
+			var from_date = Date.parse(frm.doc.from_date);
+			var to_date = Date.parse(frm.doc.to_date);
+
+			if(to_date < from_date){
+				frappe.msgprint(__("To Date cannot be less than From Date"));
+				frm.set_value('to_date', '');
+				return;
+			}
 				// server call is done to include holidays in leave days calculations
 			return frappe.call({
 				method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days',
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 45fcde0..df554e8 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -9,8 +9,6 @@
 from erpnext.hr.utils import set_employee_name
 from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
 from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
-from erpnext.hr.doctype.employee_leave_approver.employee_leave_approver import get_approver_list
-
 
 class LeaveDayBlockedError(frappe.ValidationError): pass
 class OverlapError(frappe.ValidationError): pass
@@ -234,24 +232,24 @@
 		})
 
 	def notify_leave_approver(self):
+		if self.leave_approver:
+			parent_doc = frappe.get_doc('Leave Application', self.name)
+			args = parent_doc.as_dict()
 
-		parent_doc = frappe.get_doc('Leave Application', self.name)
-		args = parent_doc.as_dict()
+			template = frappe.db.get_single_value('HR Settings', 'leave_approval_notification_template')
+			if not template:
+				frappe.msgprint(_("Please set default template for Leave Approval Notification in HR Settings."))
+				return
+			email_template = frappe.get_doc("Email Template", template)
+			message = frappe.render_template(email_template.response, args)
 
-		template = frappe.db.get_single_value('HR Settings', 'leave_approval_notification_template')
-		if not template:
-			frappe.msgprint(_("Please set default template for Leave Approval Notification in HR Settings."))
-			return
-		email_template = frappe.get_doc("Email Template", template)
-		message = frappe.render_template(email_template.response, args)
-
-		self.notify({
-			# for post in messages
-			"message": message,
-			"message_to": self.leave_approver,
-			# for email
-			"subject": email_template.subject
-		})
+			self.notify({
+				# for post in messages
+				"message": message,
+				"message_to": self.leave_approver,
+				# for email
+				"subject": email_template.subject
+			})
 
 	def notify(self, args):
 		args = frappe._dict(args)
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 38b10f7..4643e89 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -49,9 +49,6 @@
 	def tearDown(self):
 		frappe.set_user("Administrator")
 
-		# so that this test doesn't affect other tests
-		frappe.db.sql("""delete from `tabEmployee Leave Approver`""")
-
 	def _clear_roles(self):
 		frappe.db.sql("""delete from `tabHas Role` where parent in
 			("test@example.com", "test1@example.com", "test2@example.com")""")
@@ -59,29 +56,6 @@
 	def _clear_applications(self):
 		frappe.db.sql("""delete from `tabLeave Application`""")
 
-	def _add_employee_leave_approver(self, employee, leave_approver):
-		temp_session_user = frappe.session.user
-		frappe.set_user("Administrator")
-		employee = frappe.get_doc("Employee", employee)
-		employee.append("leave_approvers", {
-			"doctype": "Employee Leave Approver",
-			"leave_approver": leave_approver
-		})
-		employee.save()
-		frappe.set_user(temp_session_user)
-
-	def _remove_employee_leave_approver(self, employee, leave_approver):
-		temp_session_user = frappe.session.user
-		frappe.set_user("Administrator")
-		employee = frappe.get_doc("Employee", employee)
-		d = employee.get("leave_approvers", {
-			"leave_approver": leave_approver
-		})
-		if d:
-			employee.get("leave_approvers").remove(d[0])
-			employee.save()
-		frappe.set_user(temp_session_user)
-
 	def get_application(self, doc):
 		application = frappe.copy_doc(doc)
 		application.from_date = "2013-01-01"
@@ -103,6 +77,7 @@
 
 		application = self.get_application(_test_records[0])
 		application.insert()
+		application.status = "Approved"
 		self.assertRaises(LeaveDayBlockedError, application.submit)
 
 		frappe.set_user("test1@example.com")
@@ -230,7 +205,6 @@
 		from frappe.utils.user import add_role
 		add_role("test1@example.com", "Employee")
 		add_role("test@example.com", "Leave Approver")
-		self._add_employee_leave_approver("_T-Employee-00002", "test@example.com")
 
 		make_allocation_record(employee="_T-Employee-00002")
 
@@ -243,7 +217,7 @@
 
 		frappe.set_user("test1@example.com")
 		application.insert()
-
+		application.status = "Approved"
 		frappe.set_user("test@example.com")
 		self.assertRaises(LeaveDayBlockedError, application.submit)
 
diff --git a/erpnext/hr/doctype/employee_loan/__init__.py b/erpnext/hr/doctype/loan/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/employee_loan/__init__.py
rename to erpnext/hr/doctype/loan/__init__.py
diff --git a/erpnext/hr/doctype/loan/loan.js b/erpnext/hr/doctype/loan/loan.js
new file mode 100644
index 0000000..b401324
--- /dev/null
+++ b/erpnext/hr/doctype/loan/loan.js
@@ -0,0 +1,239 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+{% include 'erpnext/hr/loan_common.js' %};
+
+frappe.ui.form.on('Loan', {
+	onload: function (frm) {
+		frm.set_query("loan_application", function () {
+			return {
+				"filters": {
+					"applicant": frm.doc.applicant,
+					"docstatus": 1,
+					"status": "Approved"
+				}
+			};
+		});
+
+		frm.set_query("interest_income_account", function () {
+			return {
+				"filters": {
+					"company": frm.doc.company,
+					"root_type": "Income",
+					"is_group": 0
+				}
+			};
+		});
+
+		$.each(["payment_account", "loan_account"], function (i, field) {
+			frm.set_query(field, function () {
+				return {
+					"filters": {
+						"company": frm.doc.company,
+						"root_type": "Asset",
+						"is_group": 0
+					}
+				};
+			});
+		})
+	},
+
+	refresh: function (frm) {
+		if (frm.doc.docstatus == 1 && frm.doc.status == "Sanctioned") {
+			frm.add_custom_button(__('Make Disbursement Entry'), function() {
+				frm.trigger("make_jv");
+			})
+		}
+		if (frm.doc.repayment_schedule) {
+			let total_amount_paid = 0;
+			$.each(frm.doc.repayment_schedule || [], function(i, row) {
+				if (row.paid) {
+					total_amount_paid += row.total_payment;
+				}
+			});
+			frm.set_value("total_amount_paid", total_amount_paid);
+;		}
+		if (frm.doc.docstatus == 1 && frm.doc.repayment_start_date && (frm.doc.applicant_type == 'Member' || frm.doc.repay_from_salary == 0)) {
+			frm.add_custom_button(__('Make Repayment Entry'), function() {
+				frm.trigger("make_repayment_entry");
+			})
+		}
+		frm.trigger("toggle_fields");
+	},
+	status: function (frm) {
+		frm.toggle_reqd("disbursement_date", frm.doc.status == 'Disbursed')
+		frm.toggle_reqd("repayment_start_date", frm.doc.status == 'Disbursed')
+	},
+
+	make_jv: function (frm) {
+		frappe.call({
+			args: {
+				"loan": frm.doc.name,
+				"company": frm.doc.company,
+				"loan_account": frm.doc.loan_account,
+				"applicant_type": frm.doc.applicant_type,
+				"applicant": frm.doc.applicant,
+				"loan_amount": frm.doc.loan_amount,
+				"payment_account": frm.doc.payment_account
+			},
+			method: "erpnext.hr.doctype.loan.loan.make_jv_entry",
+			callback: function (r) {
+				if (r.message)
+					var doc = frappe.model.sync(r.message)[0];
+				frappe.set_route("Form", doc.doctype, doc.name);
+			}
+		})
+	},
+	make_repayment_entry: function(frm) {
+		var repayment_schedule = $.map(frm.doc.repayment_schedule, function(d) { return d.paid ? d.payment_date : false; });
+		if(repayment_schedule.length >= 1){
+			frm.repayment_data = [];
+			frm.show_dialog = 1;
+			let title = "";
+			let fields = [
+			{fieldtype:'Section Break', label: __('Repayment Schedule')},
+			{fieldname: 'payments', fieldtype: 'Table',
+				fields: [
+					{
+						fieldtype:'Data',
+						fieldname:'payment_date',
+						label: __('Date'),
+						read_only:1,
+						in_list_view: 1,
+						columns: 2
+					},
+					{
+						fieldtype:'Currency',
+						fieldname:'principal_amount',
+						label: __('Principal Amount'),
+						read_only:1,
+						in_list_view: 1,
+						columns: 3
+					},
+					{
+						fieldtype:'Currency',
+						fieldname:'interest_amount',
+						label: __('Interest'),
+						read_only:1,
+						in_list_view: 1,
+						columns: 2
+					},
+					{
+						fieldtype:'Currency',
+						read_only:1,
+						fieldname:'total_payment',
+						label: __('Total Payment'),
+						in_list_view: 1,
+						columns: 3
+					},
+				],
+				data: frm.repayment_data,
+				get_data: function() {
+					return frm.repayment_data;
+				}
+			}
+		]
+
+		var dialog = new frappe.ui.Dialog({
+			title: title, fields: fields,
+		});
+		if (frm.doc['repayment_schedule']) {
+			frm.doc['repayment_schedule'].forEach((payment, index) => {
+			if (payment.paid == 0 && payment.payment_date <= frappe.datetime.now_date()) {
+					frm.repayment_data.push ({
+						'id': index,
+						'name': payment.name,
+						'payment_date': payment.payment_date,
+						'principal_amount': payment.principal_amount,
+						'interest_amount': payment.interest_amount,
+						'total_payment': payment.total_payment 
+					});
+					dialog.fields_dict.payments.grid.refresh();
+					$(dialog.wrapper.find(".grid-buttons")).hide();
+					$(`.octicon.octicon-triangle-down`).hide();
+				}
+
+			})
+		}
+
+		dialog.show()
+		dialog.set_primary_action(__('Make Repayment Entry'), function() {
+			frm.values = dialog.get_values();
+			if(frm.values) {
+				_make_repayment_entry(frm, dialog.fields_dict.payments.grid.get_selected_children());
+				dialog.hide()
+				}
+			});
+		}
+
+		dialog.get_close_btn().on('click', () => {
+			dialog.hide();
+		});
+	},
+
+	mode_of_payment: function (frm) {
+		frappe.call({
+			method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
+			args: {
+				"mode_of_payment": frm.doc.mode_of_payment,
+				"company": frm.doc.company
+			},
+			callback: function (r, rt) {
+				if (r.message) {
+					frm.set_value("payment_account", r.message.account);
+				}
+			}
+		});
+	},
+
+	loan_application: function (frm) {
+	    if(frm.doc.loan_application){
+            return frappe.call({
+                method: "erpnext.hr.doctype.loan.loan.get_loan_application",
+                args: {
+                    "loan_application": frm.doc.loan_application
+                },
+                callback: function (r) {
+                    if (!r.exc && r.message) {
+                        frm.set_value("loan_type", r.message.loan_type);
+                        frm.set_value("loan_amount", r.message.loan_amount);
+                        frm.set_value("repayment_method", r.message.repayment_method);
+                        frm.set_value("monthly_repayment_amount", r.message.repayment_amount);
+                        frm.set_value("repayment_periods", r.message.repayment_periods);
+                        frm.set_value("rate_of_interest", r.message.rate_of_interest);
+                    }
+                }
+            });
+        }
+	},
+
+	repayment_method: function (frm) {
+		frm.trigger("toggle_fields")
+	},
+
+	toggle_fields: function (frm) {
+		frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method == "Repay Fixed Amount per Period")
+		frm.toggle_enable("repayment_periods", frm.doc.repayment_method == "Repay Over Number of Periods")
+	}
+});
+
+var _make_repayment_entry = function(frm, payment_rows) {
+	frappe.call({
+		method:"erpnext.hr.doctype.loan.loan.make_repayment_entry",
+		args: {
+			payment_rows: payment_rows,
+			"loan": frm.doc.name,
+			"company": frm.doc.company,
+			"loan_account": frm.doc.loan_account,
+			"applicant_type": frm.doc.applicant_type,
+			"applicant": frm.doc.applicant,
+			"payment_account": frm.doc.payment_account,
+			"interest_income_account": frm.doc.interest_income_account
+		},
+		callback: function(r) {
+			if (r.message)
+				var doc = frappe.model.sync(r.message)[0];
+			frappe.set_route("Form", doc.doctype, doc.name, {'payment_rows': payment_rows});
+		}
+	});
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.json b/erpnext/hr/doctype/loan/loan.json
similarity index 85%
rename from erpnext/hr/doctype/employee_loan/employee_loan.json
rename to erpnext/hr/doctype/loan/loan.json
index 35c735a..a073ec4 100644
--- a/erpnext/hr/doctype/employee_loan/employee_loan.json
+++ b/erpnext/hr/doctype/loan/loan.json
@@ -3,7 +3,7 @@
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
  "allow_rename": 0, 
- "autoname": "ELN.####", 
+ "autoname": "LN.####", 
  "beta": 0, 
  "creation": "2016-12-02 10:11:49.673604", 
  "custom": 0, 
@@ -19,19 +19,19 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "employee", 
-   "fieldtype": "Link", 
+   "fieldname": "applicant_type", 
+   "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_global_search": 1, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Employee", 
+   "label": "Applicant Type", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Employee", 
+   "options": "Employee\nMember", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -42,6 +42,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -50,19 +51,19 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "employee_name", 
-   "fieldtype": "Read Only", 
+   "fieldname": "applicant", 
+   "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_global_search": 1, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Employee Name", 
+   "in_standard_filter": 1, 
+   "label": "Applicant", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "employee.employee_name", 
+   "options": "applicant_type", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -70,9 +71,10 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -81,7 +83,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "employee_loan_application", 
+   "fieldname": "applicant_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Applicant Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "loan_application", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -90,10 +123,10 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Employee Loan Application", 
+   "label": "Loan Application", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Employee Loan Application", 
+   "options": "Loan Application", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -104,6 +137,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -135,6 +169,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -164,6 +199,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -195,6 +231,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -226,6 +263,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -247,7 +285,7 @@
    "label": "Status", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Sanctioned\nPartially Disbursed\nFully Disbursed\nRepaid/Closed", 
+   "options": "Sanctioned\nDisbursed\nRepaid/Closed", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -258,6 +296,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -266,6 +305,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "eval:doc.applicant_type==\"Employee\"", 
    "fieldname": "repay_from_salary", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -288,6 +328,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -318,6 +359,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -349,6 +391,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -381,6 +424,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -411,6 +455,38 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "repayment_start_date", 
+   "fieldtype": "Date", 
+   "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": "Repayment Start Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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
   }, 
   {
@@ -440,6 +516,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -472,6 +549,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -504,6 +582,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -537,6 +616,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -567,6 +647,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -598,6 +679,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -629,6 +711,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -658,6 +741,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -666,7 +750,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "employee_loan_account", 
+   "fieldname": "loan_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -675,7 +759,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Employee Loan Account", 
+   "label": "Loan Account", 
    "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
@@ -689,6 +773,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -720,6 +805,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -750,6 +836,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -781,6 +868,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -811,6 +899,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -843,6 +932,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -872,6 +962,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -904,6 +995,39 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "total_amount_paid", 
+   "fieldtype": "Currency", 
+   "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": "Total Amount Paid", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -924,7 +1048,7 @@
    "label": "Amended From", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Employee Loan", 
+   "options": "Loan", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -934,6 +1058,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -947,16 +1072,15 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-05-02 13:52:30.884154", 
+ "modified": "2018-04-08 15:32:58.948412", 
  "modified_by": "Administrator", 
  "module": "HR", 
- "name": "Employee Loan", 
+ "name": "Loan", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
@@ -976,7 +1100,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 1, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
diff --git a/erpnext/hr/doctype/loan/loan.py b/erpnext/hr/doctype/loan/loan.py
new file mode 100644
index 0000000..419a561
--- /dev/null
+++ b/erpnext/hr/doctype/loan/loan.py
@@ -0,0 +1,225 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe, math, json
+import erpnext
+from frappe import _
+from frappe.utils import flt, rounded, add_months, nowdate
+from erpnext.controllers.accounts_controller import AccountsController
+
+class Loan(AccountsController):
+	def validate(self):
+		check_repayment_method(self.repayment_method, self.loan_amount, self.monthly_repayment_amount, self.repayment_periods)
+		if not self.company:
+			self.company = erpnext.get_default_company()
+		if not self.posting_date:
+			self.posting_date = nowdate()
+		if self.loan_type and not self.rate_of_interest:
+			self.rate_of_interest = frappe.db.get_value("Loan Type", self.loan_type, "rate_of_interest")
+		if self.repayment_method == "Repay Over Number of Periods":
+			self.monthly_repayment_amount = get_monthly_repayment_amount(self.repayment_method, self.loan_amount, self.rate_of_interest, self.repayment_periods)
+		if self.status == "Repaid/Closed":
+			self.total_amount_paid = self.total_payment
+		if self.status == 'Disbursed' and self.repayment_start_date < self.disbursement_date:
+			frappe.throw(_("Repayment Start Date cannot be before Disbursement Date."))
+
+		if self.status == "Disbursed":
+			self.make_repayment_schedule()
+			self.set_repayment_period()
+			self.calculate_totals()
+
+	def make_jv_entry(self):
+		self.check_permission('write')
+		journal_entry = frappe.new_doc('Journal Entry')
+		journal_entry.voucher_type = 'Bank Entry'
+		journal_entry.user_remark = _('Against Loan: {0}').format(self.name)
+		journal_entry.company = self.company
+		journal_entry.posting_date = nowdate()
+
+		account_amt_list = []
+
+		account_amt_list.append({
+			"account": self.loan_account,
+			"party_type": self.applicant_type,
+			"party": self.applicant,
+			"debit_in_account_currency": self.loan_amount,
+			"reference_type": "Loan",
+			"reference_name": self.name,
+			})
+		account_amt_list.append({
+			"account": self.payment_account,
+			"credit_in_account_currency": self.loan_amount,
+			"reference_type": "Loan",
+			"reference_name": self.name,
+			})
+		journal_entry.set("accounts", account_amt_list)
+		return journal_entry.as_dict()
+
+	def make_repayment_schedule(self):
+		self.repayment_schedule = []
+		payment_date = self.repayment_start_date
+		balance_amount = self.loan_amount
+		while(balance_amount > 0):
+			interest_amount = rounded(balance_amount * flt(self.rate_of_interest) / (12*100))
+			principal_amount = self.monthly_repayment_amount - interest_amount
+			balance_amount = rounded(balance_amount + interest_amount - self.monthly_repayment_amount)
+
+			if balance_amount < 0:
+				principal_amount += balance_amount
+				balance_amount = 0.0
+
+			total_payment = principal_amount + interest_amount
+			self.append("repayment_schedule", {
+				"payment_date": payment_date,
+				"principal_amount": principal_amount,
+				"interest_amount": interest_amount,
+				"total_payment": total_payment,
+				"balance_loan_amount": balance_amount
+			})
+			next_payment_date = add_months(payment_date, 1)
+			payment_date = next_payment_date
+
+	def set_repayment_period(self):
+		if self.repayment_method == "Repay Fixed Amount per Period":
+			repayment_periods = len(self.repayment_schedule)
+
+			self.repayment_periods = repayment_periods
+
+	def calculate_totals(self):
+		self.total_payment = 0
+		self.total_interest_payable = 0
+		self.total_amount_paid = 0
+		for data in self.repayment_schedule:
+			self.total_payment += data.total_payment
+			self.total_interest_payable +=data.interest_amount
+			if data.paid:
+				self.total_amount_paid += data.total_payment
+
+def update_total_amount_paid(doc):
+	total_amount_paid = 0
+	for data in doc.repayment_schedule:
+		if data.paid:
+			total_amount_paid += data.total_payment
+	frappe.db.set_value("Loan", doc.name, "total_amount_paid", total_amount_paid)
+
+def update_disbursement_status(doc):
+	disbursement = frappe.db.sql("""select posting_date, ifnull(sum(credit_in_account_currency), 0) as disbursed_amount
+		from `tabGL Entry` where account = %s and against_voucher_type = 'Loan' and against_voucher = %s""",
+		(doc.payment_account, doc.name), as_dict=1)[0]
+	if disbursement.disbursed_amount == doc.loan_amount:
+		frappe.db.set_value("Loan", doc.name , "status", "Disbursed")
+	if disbursement.disbursed_amount == 0:
+		frappe.db.set_value("Loan", doc.name , "status", "Sanctioned")
+	if disbursement.disbursed_amount > doc.loan_amount:
+		frappe.throw(_("Disbursed Amount cannot be greater than Loan Amount {0}").format(doc.loan_amount))
+	if disbursement.disbursed_amount > 0:
+		frappe.db.set_value("Loan", doc.name , "disbursement_date", disbursement.posting_date)
+		frappe.db.set_value("Loan", doc.name , "repayment_start_date", disbursement.posting_date)
+	
+def check_repayment_method(repayment_method, loan_amount, monthly_repayment_amount, repayment_periods):
+	if repayment_method == "Repay Over Number of Periods" and not repayment_periods:
+		frappe.throw(_("Please enter Repayment Periods"))
+		
+	if repayment_method == "Repay Fixed Amount per Period":
+		if not monthly_repayment_amount:
+			frappe.throw(_("Please enter repayment Amount"))
+		if monthly_repayment_amount > loan_amount:
+			frappe.throw(_("Monthly Repayment Amount cannot be greater than Loan Amount"))
+
+def get_monthly_repayment_amount(repayment_method, loan_amount, rate_of_interest, repayment_periods):
+	if rate_of_interest:
+		monthly_interest_rate = flt(rate_of_interest) / (12 *100)
+		monthly_repayment_amount = math.ceil((loan_amount * monthly_interest_rate *
+			(1 + monthly_interest_rate)**repayment_periods) \
+			/ ((1 + monthly_interest_rate)**repayment_periods - 1))
+	else:
+		monthly_repayment_amount = math.ceil(flt(loan_amount) / repayment_periods)
+	return monthly_repayment_amount
+
+@frappe.whitelist()
+def get_loan_application(loan_application):
+	loan = frappe.get_doc("Loan Application", loan_application)
+	if loan:
+		return loan.as_dict()
+
+@frappe.whitelist()
+def make_repayment_entry(payment_rows, loan, company, loan_account, applicant_type, applicant, \
+	payment_account=None, interest_income_account=None):
+
+	if isinstance(payment_rows, basestring):
+		payment_rows_list = json.loads(payment_rows)
+	else:
+		frappe.throw(_("No repayments available for Journal Entry"))
+
+	if payment_rows_list:
+		row_name = list(set(d["name"] for d in payment_rows_list))
+	else:
+		frappe.throw(_("No repayments selected for Journal Entry"))
+	total_payment = 0
+	principal_amount = 0
+	interest_amount = 0
+	for d in payment_rows_list:
+		total_payment += d["total_payment"]
+		principal_amount += d["principal_amount"]
+		interest_amount += d["interest_amount"]
+
+	journal_entry = frappe.new_doc('Journal Entry')
+	journal_entry.voucher_type = 'Bank Entry'
+	journal_entry.user_remark = _('Against Loan: {0}').format(loan)
+	journal_entry.company = company
+	journal_entry.posting_date = nowdate()
+	journal_entry.paid_loan = json.dumps(row_name)
+	account_amt_list = []
+
+	account_amt_list.append({
+		"account": payment_account,
+		"debit_in_account_currency": total_payment,
+		"reference_type": "Loan",
+		"reference_name": loan,
+		})
+	account_amt_list.append({
+		"account": loan_account,
+		"credit_in_account_currency": principal_amount,
+		"party_type": applicant_type,
+		"party": applicant,
+		"reference_type": "Loan",
+		"reference_name": loan,
+		})
+	account_amt_list.append({
+		"account": interest_income_account,
+		"credit_in_account_currency": interest_amount,
+		"reference_type": "Loan",
+		"reference_name": loan,
+		})
+	journal_entry.set("accounts", account_amt_list)
+
+	return journal_entry.as_dict()
+
+@frappe.whitelist()
+def make_jv_entry(loan, company, loan_account, applicant_type, applicant, loan_amount,payment_account=None):
+
+	journal_entry = frappe.new_doc('Journal Entry')
+	journal_entry.voucher_type = 'Bank Entry'
+	journal_entry.user_remark = _('Against Loan: {0}').format(loan)
+	journal_entry.company = company
+	journal_entry.posting_date = nowdate()
+	account_amt_list = []
+
+	account_amt_list.append({
+		"account": loan_account,
+		"debit_in_account_currency": loan_amount,
+		"party_type": applicant_type,
+		"party": applicant,
+		"reference_type": "Loan",
+		"reference_name": loan,
+		})
+	account_amt_list.append({
+		"account": payment_account,
+		"credit_in_account_currency": loan_amount,
+		"reference_type": "Loan",
+		"reference_name": loan,
+		})
+	journal_entry.set("accounts", account_amt_list)
+	return journal_entry.as_dict()
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan_dashboard.py b/erpnext/hr/doctype/loan/loan_dashboard.py
similarity index 61%
rename from erpnext/hr/doctype/employee_loan/employee_loan_dashboard.py
rename to erpnext/hr/doctype/loan/loan_dashboard.py
index 20ce69e..c621a7f 100644
--- a/erpnext/hr/doctype/employee_loan/employee_loan_dashboard.py
+++ b/erpnext/hr/doctype/loan/loan_dashboard.py
@@ -2,18 +2,24 @@
 
 def get_data():
 	return {
-		'fieldname': 'employee',
+		'fieldname': 'applicant',
 		'non_standard_fieldnames': {
 			'Journal Entry': 'reference_name',
+			'Salary Slip': 'employee'
 			},
 		'transactions': [
 			{
-				'label': _('Employee'),
-				'items': ['Employee Loan Application', 'Salary Slip']
+				'label': _('Applicant'),
+				'items': ['Loan Application']
 			},
+
 			{
 				'label': _('Account'),
 				'items': ['Journal Entry']
+			},
+			{
+				'label': _('Employee'),
+				'items': ['Salary Slip']
 			}
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_loan/test_employee_loan.js b/erpnext/hr/doctype/loan/test_loan.js
similarity index 84%
rename from erpnext/hr/doctype/employee_loan/test_employee_loan.js
rename to erpnext/hr/doctype/loan/test_loan.js
index 41aad04..28d30c9 100644
--- a/erpnext/hr/doctype/employee_loan/test_employee_loan.js
+++ b/erpnext/hr/doctype/loan/test_loan.js
@@ -11,17 +11,17 @@
 			(r) => {
 				employee_name = r.message.name;
 			},
-			() => frappe.db.get_value('Employee Loan Application', {'loan_type': lname}, 'name'),
+			() => frappe.db.get_value('Loan Application', {'loan_type': lname}, 'name'),
 			(r) => {
 				// Creating loan for an employee
-				return frappe.tests.make('Employee Loan', [
+				return frappe.tests.make('Loan', [
 					{ company: 'For Testing'},
 					{ posting_date: '2017-08-26'},
-					{ employee: employee_name},
-					{ employee_loan_application: r.message.name},
+					{ applicant: employee_name},
+					{ loan_application: r.message.name},
 					{ disbursement_date: '2018-08-26'},
 					{ mode_of_payment: 'Cash'},
-					{ employee_loan_account: 'Temporary Opening - FT'},
+					{ loan_account: 'Temporary Opening - FT'},
 					{ interest_income_account: 'Service - FT'}
 				]);
 			},
@@ -33,7 +33,7 @@
 
 			// Checking if all the amounts are correctly calculated
 			() => {
-				assert.ok(cur_frm.get_field('employee_name').value=='Test Employee 1'&&
+				assert.ok(cur_frm.get_field('applicant_name').value=='Test Employee 1'&&
 					(cur_frm.get_field('status').value=='Sanctioned'),
 				'Loan Sanctioned for correct employee');
 
@@ -62,7 +62,7 @@
 					'Balance amount after last instalment is correctly calculated');
 
 			},
-			() => frappe.set_route('List','Employee Loan','List'),
+			() => frappe.set_route('List','Loan','List'),
 			() => frappe.timeout(2),
 
 			// Checking the submission of Loan
diff --git a/erpnext/hr/doctype/loan/test_loan.py b/erpnext/hr/doctype/loan/test_loan.py
new file mode 100644
index 0000000..6f87c2a
--- /dev/null
+++ b/erpnext/hr/doctype/loan/test_loan.py
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import erpnext
+import unittest
+from frappe.utils import nowdate
+from erpnext.hr.doctype.salary_structure.test_salary_structure import make_employee
+
+class TestLoan(unittest.TestCase):
+	def setUp(self):
+		create_loan_type("Personal Loan", 500000, 8.4)
+		self.applicant = make_employee("robert_loan@loan.com")
+		create_loan(self.applicant, "Personal Loan", 280000, "Repay Over Number of Periods", 20)
+	
+	def test_loan(self):
+		loan = frappe.get_doc("Loan", {"applicant":self.applicant})
+		self.assertEquals(loan.monthly_repayment_amount, 15052)
+		self.assertEquals(loan.total_interest_payable, 21034)
+		self.assertEquals(loan.total_payment, 301034)
+
+		schedule = loan.repayment_schedule
+
+		self.assertEqual(len(schedule), 20)
+
+		for idx, principal_amount, interest_amount, balance_loan_amount in [[3, 13369, 1683, 227079], [19, 14941, 105, 0], [17, 14740, 312, 29785]]:
+			self.assertEqual(schedule[idx].principal_amount, principal_amount)
+			self.assertEqual(schedule[idx].interest_amount, interest_amount)
+			self.assertEqual(schedule[idx].balance_loan_amount, balance_loan_amount)
+
+		loan.repayment_method = "Repay Fixed Amount per Period"
+		loan.monthly_repayment_amount = 14000
+		loan.save()
+
+		self.assertEquals(len(loan.repayment_schedule), 22)
+		self.assertEquals(loan.total_interest_payable, 22712)
+		self.assertEquals(loan.total_payment, 302712)
+
+def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
+	if not frappe.db.exists("Loan Type", loan_name):
+		frappe.get_doc({
+			"doctype": "Loan Type",
+			"loan_name": loan_name,
+			"maximum_loan_amount": maximum_loan_amount,
+			"rate_of_interest": rate_of_interest
+		}).insert()
+
+def	create_loan(applicant, loan_type, loan_amount, repayment_method, repayment_periods):
+	create_loan_type(loan_type, 500000, 8.4)
+	if not frappe.db.get_value("Loan", {"applicant":applicant}):
+		loan = frappe.new_doc("Loan")
+		loan.update({
+				"applicant": applicant,
+				"loan_type": loan_type,
+				"loan_amount": loan_amount,
+				"repayment_method": repayment_method,
+				"repayment_periods": repayment_periods,
+				"disbursement_date": nowdate(),
+				"mode_of_payment": frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name'),
+				"payment_account": frappe.db.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name"),
+				"loan_account": frappe.db.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name"),
+				"interest_income_account": frappe.db.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
+			})
+		loan.insert()
+		return loan
+	else:
+		return frappe.get_doc("Loan", {"applicant":applicant})
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_loan_application/__init__.py b/erpnext/hr/doctype/loan_application/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/employee_loan_application/__init__.py
rename to erpnext/hr/doctype/loan_application/__init__.py
diff --git a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.js b/erpnext/hr/doctype/loan_application/loan_application.js
similarity index 81%
rename from erpnext/hr/doctype/employee_loan_application/employee_loan_application.js
rename to erpnext/hr/doctype/loan_application/loan_application.js
index 33b620b..2c0f2d1 100644
--- a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.js
+++ b/erpnext/hr/doctype/loan_application/loan_application.js
@@ -1,7 +1,9 @@
 // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
 // For license information, please see license.txt
 
-frappe.ui.form.on('Employee Loan Application', {
+{% include 'erpnext/hr/loan_common.js' %};
+
+frappe.ui.form.on('Loan Application', {
 	refresh: function(frm) {
 		frm.trigger("toggle_fields")
 		frm.trigger("add_toolbar_buttons")
@@ -16,10 +18,10 @@
 	},
 	add_toolbar_buttons: function(frm) {
 		if (frm.doc.status == "Approved") {
-			frm.add_custom_button(__('Employee Loan'), function() {
+			frm.add_custom_button(__('Loan'), function() {
 				frappe.call({
 					type: "GET",
-					method: "erpnext.hr.doctype.employee_loan_application.employee_loan_application.make_employee_loan",
+					method: "erpnext.hr.doctype.loan_application.loan_application.make_loan",
 					args: {
 						"source_name": frm.doc.name
 					},
diff --git a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.json b/erpnext/hr/doctype/loan_application/loan_application.json
similarity index 86%
rename from erpnext/hr/doctype/employee_loan_application/employee_loan_application.json
rename to erpnext/hr/doctype/loan_application/loan_application.json
index 4c673c3..ea305ef 100644
--- a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.json
+++ b/erpnext/hr/doctype/loan_application/loan_application.json
@@ -1,8 +1,9 @@
 {
  "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
- "autoname": "ELA/.#####", 
+ "autoname": "LA/.#####", 
  "beta": 0, 
  "creation": "2016-12-02 12:35:56.046811", 
  "custom": 0, 
@@ -13,6 +14,133 @@
  "engine": "InnoDB", 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "applicant_type", 
+   "fieldtype": "Select", 
+   "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": "Applicant Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Employee\nMember", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "applicant", 
+   "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 1, 
+   "label": "Applicant", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "applicant_type", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "applicant", 
+   "fieldname": "applicant_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Applicant Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
+   "fieldtype": "Column Break", 
+   "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, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -40,97 +168,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "employee", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 1, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Employee", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Employee", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "employee_name", 
-   "fieldtype": "Read Only", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 1, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Employee Name", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "employee.employee_name", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_2", 
-   "fieldtype": "Column Break", 
-   "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, 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
-   "unique": 0
-  }, 
-  {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
@@ -158,9 +200,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -172,7 +216,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Company", 
    "length": 0, 
@@ -188,9 +232,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -217,9 +263,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -231,7 +279,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Loan Type", 
    "length": 0, 
@@ -247,9 +295,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -261,7 +311,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Loan Amount", 
    "length": 0, 
@@ -277,9 +327,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -306,9 +358,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -334,9 +388,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -363,9 +419,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -392,9 +450,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -422,9 +482,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -452,9 +514,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -482,9 +546,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -510,9 +576,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -541,9 +609,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -571,9 +641,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -601,9 +673,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -620,7 +694,7 @@
    "label": "Amended From", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Employee Loan Application", 
+   "options": "Loan Application", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -630,23 +704,24 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
+ "has_web_view": 0, 
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "idx": 0, 
  "image_view": 0, 
  "in_create": 0, 
- "in_dialog": 0, 
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-03-02 04:25:43.397934", 
+ "modified": "2018-02-26 08:35:57.606555", 
  "modified_by": "Administrator", 
  "module": "HR", 
- "name": "Employee Loan Application", 
+ "name": "Loan Application", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
@@ -734,12 +809,12 @@
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "employee, employee_name, loan_type, loan_amount", 
+ "search_fields": "applicant_type, applicant, loan_type, loan_amount", 
  "show_name_in_global_search": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "timeline_field": "employee", 
- "title_field": "employee_name", 
+ "timeline_field": "applicant", 
+ "title_field": "applicant", 
  "track_changes": 1, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.py b/erpnext/hr/doctype/loan_application/loan_application.py
similarity index 85%
rename from erpnext/hr/doctype/employee_loan_application/employee_loan_application.py
rename to erpnext/hr/doctype/loan_application/loan_application.py
index 0c29e0d..706c964 100644
--- a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.py
+++ b/erpnext/hr/doctype/loan_application/loan_application.py
@@ -9,9 +9,9 @@
 from frappe.model.mapper import get_mapped_doc
 from frappe.model.document import Document
 
-from erpnext.hr.doctype.employee_loan.employee_loan import get_monthly_repayment_amount, check_repayment_method
+from erpnext.hr.doctype.loan.loan import get_monthly_repayment_amount, check_repayment_method
 
-class EmployeeLoanApplication(Document):
+class LoanApplication(Document):
 	def validate(self):
 		check_repayment_method(self.repayment_method, self.loan_amount, self.repayment_amount, self.repayment_periods)
 		self.validate_loan_amount()
@@ -51,10 +51,10 @@
 		self.total_payable_amount = self.loan_amount + self.total_payable_interest
 		
 @frappe.whitelist()
-def make_employee_loan(source_name, target_doc = None):
-	doclist = get_mapped_doc("Employee Loan Application", source_name, {
-		"Employee Loan Application": {
-			"doctype": "Employee Loan",
+def make_loan(source_name, target_doc = None):
+	doclist = get_mapped_doc("Loan Application", source_name, {
+		"Loan Application": {
+			"doctype": "Loan",
 			"validation": {
 				"docstatus": ["=", 1]
 			}
diff --git a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js b/erpnext/hr/doctype/loan_application/test_loan_application.js
similarity index 83%
rename from erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
rename to erpnext/hr/doctype/loan_application/test_loan_application.js
index d828d9a..b8789c7 100644
--- a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
+++ b/erpnext/hr/doctype/loan_application/test_loan_application.js
@@ -1,6 +1,6 @@
 QUnit.module('hr');
 
-QUnit.test("Test: Employee Loan Application [HR]", function (assert) {
+QUnit.test("Test: Loan Application [HR]", function (assert) {
 	assert.expect(8);
 	let done = assert.async();
 	let employee_name;
@@ -12,10 +12,10 @@
 			employee_name = r.message.name;
 		},
 		() => {
-			return frappe.tests.make('Employee Loan Application', [
+			return frappe.tests.make('Loan Application', [
 				{ company: 'For Testing'},
-				{ employee: employee_name},
-				{ employee_name: 'Test Employee 1'},
+				{ applicant: employee_name},
+				{ applicant_name: 'Test Employee 1'},
 				{ status: 'Approved'},
 				{ loan_type: 'Test Loan '},
 				{ loan_amount: 200000},
@@ -33,7 +33,7 @@
 		() => {
 			// To check if all the amounts are correctly calculated
 
-			assert.ok(cur_frm.get_field('employee_name').value == 'Test Employee 1',
+			assert.ok(cur_frm.get_field('applicant_name').value == 'Test Employee 1',
 				'Application created successfully');
 
 			assert.ok(cur_frm.get_field('status').value=='Approved',
@@ -55,7 +55,7 @@
 				'Total payable amount is correctly calculated');
 		},
 
-		() => frappe.set_route('List','Employee Loan Application','List'),
+		() => frappe.set_route('List','Loan Application','List'),
 		() => frappe.timeout(2),
 
 		// Checking the submission of Loan Application
diff --git a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py b/erpnext/hr/doctype/loan_application/test_loan_application.py
similarity index 67%
rename from erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py
rename to erpnext/hr/doctype/loan_application/test_loan_application.py
index a6d7921..7644dd0 100644
--- a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py
+++ b/erpnext/hr/doctype/loan_application/test_loan_application.py
@@ -7,10 +7,10 @@
 import unittest
 from erpnext.hr.doctype.salary_structure.test_salary_structure import make_employee
 
-class TestEmployeeLoanApplication(unittest.TestCase):
+class TestLoanApplication(unittest.TestCase):
 	def setUp(self):
 		self.create_loan_type()
-		self.employee = make_employee("kate_loan@loan.com")
+		self.applicant = make_employee("kate_loan@loan.com")
 		self.create_loan_application()
 
 	def create_loan_type(self):
@@ -23,10 +23,10 @@
 			}).insert()
 
 	def create_loan_application(self):
-		if not frappe.db.get_value("Employee Loan Application", {"employee":self.employee}, "name"):
-			loan_application = frappe.new_doc("Employee Loan Application")
+		if not frappe.db.get_value("Loan Application", {"applicant":self.applicant}, "name"):
+			loan_application = frappe.new_doc("Loan Application")
 			loan_application.update({
-				"employee": self.employee,
+				"applicant": self.applicant,
 				"loan_type": "Home Loan",
 				"rate_of_interest": 9.2,
 				"loan_amount": 250000,
@@ -37,10 +37,10 @@
 	
 
 	def test_loan_totals(self):
-		loan_application = frappe.get_doc("Employee Loan Application", {"employee":self.employee})
-		self.assertEqual(loan_application.repayment_amount, 11445)
-		self.assertEqual(loan_application.total_payable_interest, 24657)
-		self.assertEqual(loan_application.total_payable_amount, 274657)
+		loan_application = frappe.get_doc("Loan Application", {"applicant":self.applicant})
+		self.assertEquals(loan_application.repayment_amount, 11445)
+		self.assertEquals(loan_application.total_payable_interest, 24657)
+		self.assertEquals(loan_application.total_payable_amount, 274657)
 
 		loan_application.repayment_method = "Repay Fixed Amount per Period"
 		loan_application.repayment_amount = 15000
diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
index f4097b4..1025bc7 100644
--- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py
+++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
@@ -183,7 +183,7 @@
 			Get loan details from submitted salary slip based on selected criteria
 		"""
 		cond = self.get_filter_condition()
-		return frappe.db.sql(""" select eld.employee_loan_account, eld.employee_loan,
+		return frappe.db.sql(""" select eld.loan_account,
 				eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
 			from
 				`tabSalary Slip` t1, `tabSalary Slip Loan` eld
@@ -285,10 +285,10 @@
 						"project": self.project
 					})
 
-			# Employee loan
+			# Loan
 			for data in loan_details:
 				accounts.append({
-						"account": data.employee_loan_account,
+						"account": data.loan_account,
 						"credit_in_account_currency": data.principal_amount
 					})
 
diff --git a/erpnext/hr/doctype/payroll_entry/test_payroll_entry.py b/erpnext/hr/doctype/payroll_entry/test_payroll_entry.py
index 52735ef..2a9d87c 100644
--- a/erpnext/hr/doctype/payroll_entry/test_payroll_entry.py
+++ b/erpnext/hr/doctype/payroll_entry/test_payroll_entry.py
@@ -29,13 +29,13 @@
 		self.assertEqual(get_end_date('2017-02-15', 'monthly'), {'end_date': '2017-03-14'})
 		self.assertEqual(get_end_date('2017-02-15', 'daily'), {'end_date': '2017-02-15'})
 
-	def test_employee_loan(self):
+	def test_loan(self):
 		from erpnext.hr.doctype.salary_structure.test_salary_structure import (make_employee,
 			make_salary_structure)
-		from erpnext.hr.doctype.employee_loan.test_employee_loan import create_employee_loan
+		from erpnext.hr.doctype.loan.test_loan import create_loan
 
 		branch = "Test Employee Branch"
-		employee = make_employee("test_employee@loan.com")
+		applicant = make_employee("test_employee@loan.com")
 		company = erpnext.get_default_company()
 		holiday_list = make_holiday("test holiday for loan")
 
@@ -57,7 +57,7 @@
 			salary_component = frappe.get_doc('Salary Component', 'Basic Salary')
 			salary_component.append('accounts', {
 				'company': company,
-				'default_account': 'Salary - WP'
+				'default_account': "Salary - " + frappe.db.get_value('Company', company, 'abbr')
 			})
 
 		company_doc = frappe.get_doc('Company', company)
@@ -72,20 +72,20 @@
 				'branch': branch
 			}).insert()
 
-		employee_doc = frappe.get_doc('Employee', employee)
+		employee_doc = frappe.get_doc('Employee', applicant)
 		employee_doc.branch = branch
 		employee_doc.holiday_list = holiday_list
 		employee_doc.save()
 
-		employee_loan = create_employee_loan(employee,
+		loan = create_loan(applicant,
 			"Personal Loan", 280000, "Repay Over Number of Periods", 20)
-		employee_loan.repay_from_salary = 1
-		employee_loan.submit()
+		loan.repay_from_salary = 1
+		loan.submit()
 
 		salary_strcture = "Test Salary Structure for Loan"
 		if not frappe.db.exists('Salary Structure', salary_strcture):
 			salary_strcture = make_salary_structure(salary_strcture, [{
-				'employee': employee,
+				'employee': applicant,
 				'from_date': '2017-01-01',
 				'base': 30000
 			}])
@@ -104,13 +104,13 @@
 			end_date=dates.end_date, branch=branch)
 
 		name = frappe.db.get_value('Salary Slip',
-			{'posting_date': nowdate(), 'employee': employee}, 'name')
+			{'posting_date': nowdate(), 'employee': applicant}, 'name')
 
 		salary_slip = frappe.get_doc('Salary Slip', name)
 		for row in salary_slip.loans:
-			if row.employee_loan == employee_loan.name:
+			if row.loan == loan.name:
 				interest_amount = (280000 * 8.4)/(12*100)
-				principal_amount = employee_loan.monthly_repayment_amount - interest_amount
+				principal_amount = loan.monthly_repayment_amount - interest_amount
 				self.assertEqual(row.interest_amount, interest_amount)
 				self.assertEqual(row.principal_amount, principal_amount)
 				self.assertEqual(row.total_payment,
@@ -119,8 +119,8 @@
 		if salary_slip.docstatus == 0:
 			frappe.delete_doc('Salary Slip', name)
 
-		employee_loan.cancel()
-		frappe.delete_doc('Employee Loan', employee_loan.name)
+		loan.cancel()
+		frappe.delete_doc('Loan', loan.name)
 
 def get_salary_component_account(sal_comp):
 	company = erpnext.get_default_company()
diff --git a/erpnext/hr/doctype/repayment_schedule/repayment_schedule.json b/erpnext/hr/doctype/repayment_schedule/repayment_schedule.json
index 14091b9..a116185 100644
--- a/erpnext/hr/doctype/repayment_schedule/repayment_schedule.json
+++ b/erpnext/hr/doctype/repayment_schedule/repayment_schedule.json
@@ -40,6 +40,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -71,6 +72,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -102,6 +104,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -133,6 +136,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -164,6 +168,38 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "paid", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Paid", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -177,7 +213,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-07-26 14:47:29.862084", 
+ "modified": "2018-03-30 17:37:31.834792", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Repayment Schedule", 
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.json b/erpnext/hr/doctype/salary_slip/salary_slip.json
index 6cc62eb..00deb0f 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.json
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.json
@@ -41,6 +41,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -73,6 +74,7 @@
    "reqd": 1, 
    "search_index": 1, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -105,6 +107,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -137,6 +140,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -170,6 +174,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -202,6 +207,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -231,6 +237,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0, 
    "width": "50%"
   }, 
@@ -263,6 +270,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -294,6 +302,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -324,6 +333,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -354,6 +364,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -383,6 +394,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -415,6 +427,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -446,6 +459,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -478,6 +492,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -507,6 +522,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -539,6 +555,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -572,6 +589,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -604,6 +622,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -636,6 +655,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -668,6 +688,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -699,6 +720,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -731,6 +753,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -760,6 +783,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -790,6 +814,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -821,6 +846,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -852,6 +878,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -883,6 +910,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -914,6 +942,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -943,6 +972,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -975,6 +1005,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1005,6 +1036,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1035,6 +1067,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0, 
    "width": "50%"
   }, 
@@ -1069,6 +1102,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1099,6 +1133,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0, 
    "width": "50%"
   }, 
@@ -1132,6 +1167,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1162,6 +1198,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1194,6 +1231,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1222,6 +1260,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1254,6 +1293,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1285,6 +1325,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1302,7 +1343,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Employee Loan", 
+   "label": "Loan", 
    "length": 0, 
    "no_copy": 0, 
    "options": "Salary Slip Loan", 
@@ -1316,6 +1357,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1345,6 +1387,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1377,6 +1420,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1409,6 +1453,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1438,6 +1483,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1470,6 +1516,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1500,6 +1547,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1533,6 +1581,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1562,6 +1611,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1592,6 +1642,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1621,6 +1672,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -1653,6 +1705,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -1667,7 +1720,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-11-13 23:55:37.504856", 
+ "modified": "2018-02-26 05:16:47.169743", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Slip", 
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 71f06f2..75eb73b 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -380,13 +380,13 @@
 		self.total_interest_amount = 0
 		self.total_principal_amount = 0
 
-		for loan in self.get_employee_loan_details():
+		for loan in self.get_loan_details():
 			self.append('loans', {
-				'employee_loan': loan.name,
+				'loan': loan.name,
 				'total_payment': loan.total_payment,
 				'interest_amount': loan.interest_amount,
 				'principal_amount': loan.principal_amount,
-				'employee_loan_account': loan.employee_loan_account,
+				'loan_account': loan.loan_account,
 				'interest_income_account': loan.interest_income_account
 			})
 
@@ -394,14 +394,14 @@
 			self.total_interest_amount += loan.interest_amount
 			self.total_principal_amount += loan.principal_amount
 
-	def get_employee_loan_details(self):
-		return frappe.db.sql("""select rps.principal_amount, rps.interest_amount, el.name,
-				rps.total_payment, el.employee_loan_account, el.interest_income_account
+	def get_loan_details(self):
+		return frappe.db.sql("""select rps.principal_amount, rps.interest_amount, l.name,
+				rps.total_payment, l.loan_account, l.interest_income_account
 			from
-				`tabRepayment Schedule` as rps, `tabEmployee Loan` as el
+				`tabRepayment Schedule` as rps, `tabLoan` as l
 			where
-				el.name = rps.parent and rps.payment_date between %s and %s and
-				el.repay_from_salary = 1 and el.docstatus = 1 and el.employee = %s""",
+				l.name = rps.parent and rps.payment_date between %s and %s and
+				l.repay_from_salary = 1 and l.docstatus = 1 and l.applicant = %s""",
 			(self.start_date, self.end_date, self.employee), as_dict=True) or []
 
 	def on_submit(self):
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 3bd7771..cced29d 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -134,12 +134,12 @@
 		self.assertTrue(email_queue)
 
 	def test_loan_repayment_salary_slip(self):
-		from erpnext.hr.doctype.employee_loan.test_employee_loan import create_loan_type, create_employee_loan
-		employee = self.make_employee("test_employee@salary.com")
+		from erpnext.hr.doctype.loan.test_loan import create_loan_type, create_loan
+		applicant = self.make_employee("test_employee@salary.com")
 		create_loan_type("Car Loan", 500000, 6.4)
-		employee_loan = create_employee_loan(employee, "Car Loan", 11000, "Repay Over Number of Periods", 20)
-		employee_loan.repay_from_salary = 1
-		employee_loan.submit()
+		loan = create_loan(applicant, "Car Loan", 11000, "Repay Over Number of Periods", 20)
+		loan.repay_from_salary = 1
+		loan.submit()
 		ss = frappe.get_doc("Salary Slip",
 			self.make_employee_salary_slip("test_employee@salary.com", "Monthly"))
 		ss.submit()
diff --git a/erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.json b/erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.json
index 445c2f4..5d1212b 100644
--- a/erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.json
+++ b/erpnext/hr/doctype/salary_slip_loan/salary_slip_loan.json
@@ -18,7 +18,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "employee_loan", 
+   "fieldname": "loan", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -27,10 +27,10 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Employee Loan", 
+   "label": "Loan", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Employee Loan", 
+   "options": "Loan", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -41,6 +41,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -49,7 +50,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "employee_loan_account", 
+   "fieldname": "loan_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -58,7 +59,7 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Employee Loan Account", 
+   "label": "Loan Account", 
    "length": 0, 
    "no_copy": 0, 
    "options": "Account", 
@@ -72,6 +73,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -103,6 +105,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -132,6 +135,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -163,6 +167,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -194,6 +199,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -225,6 +231,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -238,7 +245,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-11-13 23:59:47.237689", 
+ "modified": "2018-02-26 05:24:31.369630", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Slip Loan", 
diff --git a/erpnext/hr/loan_common.js b/erpnext/hr/loan_common.js
new file mode 100644
index 0000000..3e754fa
--- /dev/null
+++ b/erpnext/hr/loan_common.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on(cur_frm.doctype, {
+	refresh: function(frm) {
+		if (!frappe.boot.active_domains.includes("Non Profit")) {
+			frm.set_df_property('applicant_type', 'options', ['Employee']);
+			frm.refresh_field('applicant_type');
+		}
+	},
+	applicant_type: function(frm) {
+		frm.set_value("applicant", null);
+		frm.set_value("applicant_name", null);
+	},
+	applicant: function(frm) {
+		if (frm.doc.applicant) {
+			frappe.model.with_doc(frm.doc.applicant_type, frm.doc.applicant, function() {
+				var applicant = frappe.model.get_doc(frm.doc.applicant_type, frm.doc.applicant);
+				frm.set_value("applicant_name",
+					applicant.employee_name || applicant.member_name);
+			});
+		}
+		else {
+			frm.set_value("applicant_name", null);
+		}
+	}
+});
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index 3b91080..fc8eaa1 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -290,7 +290,7 @@
 		if (doc.docstatus === 1) {
 			if (doc.status != 'Stopped' && doc.status != 'Completed') {
 				frm.add_custom_button(__('Stop'), function() {
-					erpnext.wokr_order.stop_work_order(frm, "Stopped");
+					erpnext.work_order.stop_work_order(frm, "Stopped");
 				}, __("Status"));
 			} else if (doc.status == 'Stopped') {
 				frm.add_custom_button(__('Re-open'), function() {
diff --git a/erpnext/non_profit/doctype/chapter/chapter.py b/erpnext/non_profit/doctype/chapter/chapter.py
index 3320690..e9554b1 100644
--- a/erpnext/non_profit/doctype/chapter/chapter.py
+++ b/erpnext/non_profit/doctype/chapter/chapter.py
@@ -35,7 +35,6 @@
 	context.title = 'All Chapters'
 	context.no_breadcrumbs = True
 	context.order_by = 'creation desc'
-	context.introduction = '<p>All Chapters</p>'
 
 
 @frappe.whitelist()
@@ -47,4 +46,4 @@
 			member.leave_reason = leave_reason
 	chapter.save(ignore_permissions=1)
 	frappe.db.commit()
-	return "Thank you for Feedback"
\ No newline at end of file
+	return "Thank you for Feedback"
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2e5c816..982a721 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -517,9 +517,11 @@
 erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract
 erpnext.patches.v11_0.add_index_on_nestedset_doctypes
 erpnext.patches.v11_0.remove_modules_setup_page
-erpnext.patches.v11_0.update_department_lft_rgt
+erpnext.patches.v11_0.rename_employee_loan_to_loan
 erpnext.patches.v11_0.move_leave_approvers_from_employee
+erpnext.patches.v11_0.update_department_lft_rgt
 erpnext.patches.v11_0.add_default_email_template_for_leave
 erpnext.patches.v11_0.set_default_email_template_in_hr
+erpnext.patches.v10_0.taxes_issue_with_pos
 erpnext.patches.v10_1.transfer_subscription_to_auto_repeat
 erpnext.patches.v10_1.drop_old_subscription_records
diff --git a/erpnext/patches/v10_0/taxes_issue_with_pos.py b/erpnext/patches/v10_0/taxes_issue_with_pos.py
new file mode 100644
index 0000000..9b54297
--- /dev/null
+++ b/erpnext/patches/v10_0/taxes_issue_with_pos.py
@@ -0,0 +1,26 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	for d in frappe.get_all('Sales Invoice', fields=["name"],
+		filters = {'is_pos':1, 'docstatus': 1, 'creation': ('>', '2018-04-23')}):
+		doc = frappe.get_doc('Sales Invoice', d.name)
+		if (not doc.taxes and doc.taxes_and_charges and doc.pos_profile and doc.outstanding_amount != 0 and
+			frappe.db.get_value('POS Profile', doc.pos_profile, 'taxes_and_charges', cache=True) == doc.taxes_and_charges):
+
+			doc.append_taxes_from_master()
+			doc.calculate_taxes_and_totals()
+			for d in doc.taxes:
+				d.db_update()
+
+			doc.db_update()
+
+			delete_gle_for_voucher(doc.name)
+			doc.make_gl_entries(repost_future_gle=False)
+
+def delete_gle_for_voucher(voucher_no):
+	frappe.db.sql("""delete from `tabGL Entry` where voucher_no = %(voucher_no)s""",
+		{'voucher_no': voucher_no})
\ No newline at end of file
diff --git a/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py b/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
index cdb013d..481c557 100644
--- a/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
+++ b/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
@@ -5,8 +5,8 @@
 
 def execute():
 	to_rename = ['Purchase Order', 'Journal Entry', 'Sales Invoice', 'Payment Entry',
-					'Delivery Note', 'Purchase Invoice', 'Quotation', 'Sales Order',
-					'Purchase Receipt', 'Supplier Quotation']
+		'Delivery Note', 'Purchase Invoice', 'Quotation', 'Sales Order',
+		'Purchase Receipt', 'Supplier Quotation']
 
 	frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
 	frappe.reload_doc('accounts', 'doctype', 'purchase_invoice')
diff --git a/erpnext/patches/v11_0/add_default_email_template_for_leave.py b/erpnext/patches/v11_0/add_default_email_template_for_leave.py
index bbf4383..bd86ae2 100644
--- a/erpnext/patches/v11_0/add_default_email_template_for_leave.py
+++ b/erpnext/patches/v11_0/add_default_email_template_for_leave.py
@@ -2,7 +2,7 @@
 from frappe import _
 
 def execute():
-	frappe.reload_doc("setup", "doctype", "email_template")
+	frappe.reload_doc("email", "doctype", "email_template")
 
 	if not frappe.db.exists("Email Template", _('Leave Approval Notification')):
 		base_path = frappe.get_app_path("erpnext", "hr", "doctype")
diff --git a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
index fc197ad..0fdf0b9 100644
--- a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
+++ b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
@@ -6,4 +6,5 @@
 def execute():
 	frappe.reload_doc("agriculture", "doctype", "land_unit")
 	for dt in ("Account", "Cost Center", "File", "Employee", "Land Unit", "Task", "Customer Group", "Sales Person", "Territory"):
+		frappe.reload_doctype(dt)
 		frappe.get_doc("DocType", dt).run_module_method("on_doctype_update")
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/move_leave_approvers_from_employee.py b/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
index 2a7afdc..2cd2362 100644
--- a/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
+++ b/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
@@ -2,9 +2,9 @@
 from frappe import _
 
 def execute():
+	frappe.reload_doc("hr", "doctype", "department_approver")
 	frappe.reload_doc("hr", "doctype", "employee")
 	frappe.reload_doc("hr", "doctype", "department")
-	frappe.reload_doc("hr", "doctype", "employee_leave_approver")
 
 	approvers = frappe.db.sql("""select distinct app.leave_approver, emp.department from
 	`tabEmployee Leave Approver` app, `tabEmployee` emp
@@ -13,6 +13,6 @@
 		""", as_dict=True)
 	for record in approvers:
 		if record.department:
-			frappe.db.sql("""update `tabDepartment Approver` app set app.parenttype = '{0}',
-				app.parent = '{1}' and parentfield = 'leave_approver' where app.leave_approver = '{2}'"""
+			frappe.db.sql("""update `tabDepartment Approver` set parenttype = '{0}',
+				parent = '{1}' and parentfield = 'leave_approver' where approver = '{2}'"""
 				.format(_('Department'), record.department, record.leave_approver))
diff --git a/erpnext/patches/v11_0/rename_employee_loan_to_loan.py b/erpnext/patches/v11_0/rename_employee_loan_to_loan.py
new file mode 100644
index 0000000..e674137
--- /dev/null
+++ b/erpnext/patches/v11_0/rename_employee_loan_to_loan.py
@@ -0,0 +1,27 @@
+import frappe
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+	if frappe.db.table_exists("Employee Loan Application") and not frappe.db.table_exists("Loan Application"):
+		frappe.rename_doc("DocType", "Employee Loan Application", "Loan Application", force=True)
+
+	if frappe.db.table_exists("Employee Loan") and not frappe.db.table_exists("Loan"):
+		frappe.rename_doc("DocType", "Employee Loan", "Loan", force=True)
+
+	frappe.reload_doc("hr", "doctype", "loan_application")
+	frappe.reload_doc("hr", "doctype", "loan")
+	frappe.reload_doc("hr", "doctype", "salary_slip_loan")
+
+	for doctype in ['Loan', 'Salary Slip Loan']:
+		if frappe.db.has_column(doctype, 'employee_loan_account'):
+			rename_field(doctype, "employee_loan_account", "loan_account")
+
+	columns = {'employee': 'applicant', 'employee_name': 'applicant_name'}
+	for doctype in ['Loan Application', 'Loan']:
+		frappe.db.sql(""" update `tab{doctype}` set applicant_type = 'Employee' """
+			.format(doctype=doctype))
+		for column, new_column in columns.items():
+			if frappe.db.has_column(doctype, column):
+				rename_field(doctype, column, new_column)
+
+		frappe.delete_doc('DocType', doctype)
\ No newline at end of file
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 218df51..0073d33 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -183,11 +183,11 @@
 		'Purchase Invoice Item': [hsn_sac_field],
 		'Employee': [
 			dict(fieldname='ifsc_code', label='IFSC Code',
-				fieldtype='Data', insert_after='bank_ac_no', print_hide=1, 
+				fieldtype='Data', insert_after='bank_ac_no', print_hide=1,
 				depends_on='eval:doc.salary_mode == "Bank"') ]
 	}
 
-	create_custom_fields(custom_fields)
+	create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch)
 
 def make_fixtures():
 	docs = [
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index 5c4bd16..fcd2212 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -816,7 +816,7 @@
 						});
 						this.numpad.reset_value();
 					} else {
-						const item_code = this.selected_item.attr('data-item-code');
+						const item_code = unescape(this.selected_item.attr('data-item-code'));
 						const batch_no = this.selected_item.attr('data-batch-no');
 						const field = this.selected_item.active_field;
 						const value = this.numpad.get_value();
@@ -863,7 +863,7 @@
 
 	update_item(item) {
 		const item_selector = item.batch_no ?
-			`[data-batch-no="${item.batch_no}"]` : `[data-item-code="${item.item_code}"]`;
+			`[data-batch-no="${item.batch_no}"]` : `[data-item-code="${escape(item.item_code)}"]`;
 
 		const $item = this.$cart_items.find(item_selector);
 
@@ -889,7 +889,7 @@
 		const batch_no = item.batch_no || '';
 
 		return `
-			<div class="list-item indicator ${indicator_class}" data-item-code="${item.item_code}"
+			<div class="list-item indicator ${indicator_class}" data-item-code="${escape(item.item_code)}"
 				data-batch-no="${batch_no}" title="Item: ${item.item_name}  Available Qty: ${item.actual_qty}">
 				<div class="item-name list-item__content list-item__content--flex-1.5 ellipsis">
 					${item.item_name}
@@ -933,20 +933,21 @@
 
 	exists(item_code, batch_no) {
 		const is_exists = batch_no ?
-			`[data-batch-no="${batch_no}"]` : `[data-item-code="${item_code}"]`;
+			`[data-batch-no="${batch_no}"]` : `[data-item-code="${escape(item_code)}"]`;
 
 		let $item = this.$cart_items.find(is_exists);
+
 		return $item.length > 0;
 	}
 
 	highlight_item(item_code) {
-		const $item = this.$cart_items.find(`[data-item-code="${item_code}"]`);
+		const $item = this.$cart_items.find(`[data-item-code="${escape(item_code)}"]`);
 		$item.addClass('highlight');
 		setTimeout(() => $item.removeClass('highlight'), 1000);
 	}
 
 	scroll_to_item(item_code) {
-		const $item = this.$cart_items.find(`[data-item-code="${item_code}"]`);
+		const $item = this.$cart_items.find(`[data-item-code="${escape(item_code)}"]`);
 		if ($item.length === 0) return;
 		const scrollTop = $item.offset().top - this.$cart_items.offset().top + this.$cart_items.scrollTop();
 		this.$cart_items.animate({ scrollTop });
@@ -961,7 +962,7 @@
 			'[data-action="increment"], [data-action="decrement"]', function() {
 				const $btn = $(this);
 				const $item = $btn.closest('.list-item[data-item-code]');
-				const item_code = $item.attr('data-item-code');
+				const item_code = unescape($item.attr('data-item-code'));
 				const action = $btn.attr('data-action');
 
 				if(action === 'increment') {
@@ -984,7 +985,7 @@
 		this.$cart_items.on('change', '.quantity input', function() {
 			const $input = $(this);
 			const $item = $input.closest('.list-item[data-item-code]');
-			const item_code = $item.attr('data-item-code');
+			const item_code = unescape($item.attr('data-item-code'));
 			events.on_field_change(item_code, 'qty', flt($input.val()));
 		});
 
@@ -1252,7 +1253,7 @@
 		var me = this;
 		this.wrapper.on('click', '.pos-item-wrapper', function() {
 			const $item = $(this);
-			const item_code = $item.attr('data-item-code');
+			const item_code = unescape($item.attr('data-item-code'));
 			me.events.update_cart(item_code, 'qty', '+1');
 		});
 	}
@@ -1278,7 +1279,7 @@
 		const item_title = item_name || item_code;
 
 		const template = `
-			<div class="pos-item-wrapper image-view-item" data-item-code="${item_code}">
+			<div class="pos-item-wrapper image-view-item" data-item-code="${escape(item_code)}">
 				<div class="image-view-header">
 					<div>
 						<a class="grey list-id" data-name="${item_code}" title="${item_title}">
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index a7d5fb4..8f761e5 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -265,11 +265,11 @@
 	base_path = frappe.get_app_path("erpnext", "hr", "doctype")
 	response = frappe.read_file(os.path.join(base_path, "leave_application/leave_application_email_template.html"))
 
-	records += {'doctype': 'Email Template', 'name': _("Leave Approval Notification"), 'response': response,\
-		'subject': _("Leave Approval Notification"), 'owner': frappe.session.user}
+	records += [{'doctype': 'Email Template', 'name': _("Leave Approval Notification"), 'response': response,\
+		'subject': _("Leave Approval Notification"), 'owner': frappe.session.user}]
 
-	records += {'doctype': 'Email Template', 'name': _("Leave Status Notification"), 'response': response,\
-		'subject': _("Leave Status Notification"), 'owner': frappe.session.user}
+	records += [{'doctype': 'Email Template', 'name': _("Leave Status Notification"), 'response': response,\
+		'subject': _("Leave Status Notification"), 'owner': frappe.session.user}]
 
 	# Records for the Supplier Scorecard
 	from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 8fa34f2..552483a 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -3819,7 +3819,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-03-13 15:35:02.234116",
+ "modified": "2018-04-30 15:35:02.234116",
  "modified_by": "Administrator",
  "module": "Stock", 
  "name": "Delivery Note", 
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 123e73f..8804043 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -568,7 +568,7 @@
 					where ifnull(item_wise_tax_detail, '') != ''""".format(dt), as_dict=1):
 
 				item_wise_tax_detail = json.loads(d.item_wise_tax_detail)
-				if old_name in item_wise_tax_detail:
+				if isinstance(item_wise_tax_detail, dict) and old_name in item_wise_tax_detail:
 					item_wise_tax_detail[new_name] = item_wise_tax_detail[old_name]
 					item_wise_tax_detail.pop(old_name)
 
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index a86dea7..3342768 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -23,6 +23,10 @@
 				return erpnext.queries.warehouse(frm.doc);
 			});
 		}
+
+		if (!frm.doc.expense_account) {
+			frm.trigger("set_expense_account");
+		}
 	},
 
 	refresh: function(frm) {
@@ -114,6 +118,25 @@
 	toggle_display_account_head: function(frm) {
 		frm.toggle_display(['expense_account', 'cost_center'],
 			erpnext.is_perpetual_inventory_enabled(frm.doc.company));
+	},
+	purpose: function(frm) {
+		frm.trigger("set_expense_account");
+	},
+	set_expense_account: function(frm) {
+		if (frm.doc.company && erpnext.is_perpetual_inventory_enabled(frm.doc.company)) {
+			return frm.call({
+				method: "erpnext.stock.doctype.stock_reconciliation.stock_reconciliation.get_difference_account",
+				args: {
+					"purpose": frm.doc.purpose,
+					"company": frm.doc.company
+				},
+				callback: function(r) {
+					if (!r.exc) {
+						frm.set_value("expense_account", r.message);
+					}
+				}
+			});
+		}
 	}
 });
 
@@ -137,37 +160,12 @@
 });
 
 erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
-	onload: function() {
-		this.set_default_expense_account();
-	},
-
-	set_default_expense_account: function() {
-		var me = this;
-		if(this.frm.doc.company) {
-			if (erpnext.is_perpetual_inventory_enabled(this.frm.doc.company) && !this.frm.doc.expense_account) {
-				return this.frm.call({
-					method: "erpnext.accounts.utils.get_company_default",
-					args: {
-						"fieldname": "stock_adjustment_account",
-						"company": this.frm.doc.company
-					},
-					callback: function(r) {
-						if (!r.exc) {
-							me.frm.set_value("expense_account", r.message);
-						}
-					}
-				});
-			}
-		}
-	},
-
 	setup: function() {
 		var me = this;
 
 		this.setup_posting_date_time_check();
 
 		if (me.frm.doc.company && erpnext.is_perpetual_inventory_enabled(me.frm.doc.company)) {
-			this.frm.add_fetch("company", "stock_adjustment_account", "expense_account");
 			this.frm.add_fetch("company", "cost_center", "cost_center");
 		}
 		this.frm.fields_dict["expense_account"].get_query = function() {
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
index dc9a322..421ee77 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
@@ -42,6 +42,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 1, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -72,6 +73,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -80,28 +82,31 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
+   "default": "Stock Reconciliation", 
+   "fieldname": "purpose", 
+   "fieldtype": "Select", 
    "hidden": 0, 
-   "ignore_user_permissions": 1, 
+   "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Amended From", 
+   "label": "Purpose", 
    "length": 0, 
-   "no_copy": 1, 
-   "options": "Stock Reconciliation", 
+   "no_copy": 0, 
+   "options": "Opening Stock\nStock Reconciliation", 
    "permlevel": 0, 
-   "print_hide": 1, 
+   "precision": "", 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -130,6 +135,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -162,6 +168,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -193,6 +200,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -223,6 +231,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -252,6 +261,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -283,6 +293,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -312,6 +323,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -343,6 +355,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -374,6 +387,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -403,6 +417,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -432,6 +447,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -463,6 +479,38 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Stock Reconciliation", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -478,7 +526,7 @@
  "istable": 0, 
  "max_attachments": 1, 
  "menu_index": 0, 
- "modified": "2017-08-02 23:54:28.516007", 
+ "modified": "2018-04-26 12:01:25.377081", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Reconciliation", 
@@ -486,7 +534,6 @@
  "permissions": [
   {
    "amend": 1, 
-   "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 73a7ef3..938173d 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -8,6 +8,7 @@
 from frappe.utils import cstr, flt, cint
 from erpnext.stock.stock_ledger import update_entries_after
 from erpnext.controllers.stock_controller import StockController
+from erpnext.accounts.utils import get_company_default
 from erpnext.stock.utils import get_stock_balance
 
 class OpeningEntryAccountError(frappe.ValidationError): pass
@@ -304,3 +305,13 @@
 		'qty': qty,
 		'rate': rate
 	}
+
+@frappe.whitelist()
+def get_difference_account(purpose, company):
+	if purpose == 'Stock Reconciliation':
+		account = get_company_default(company, "stock_adjustment_account")
+	else:
+		account = frappe.db.get_value('Account', {'is_group': 0,
+			'company': company, 'account_type': 'Temporary'}, 'name')
+
+	return account
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index eed9f4a..52e4730 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -202,13 +202,14 @@
 	item_details = {}
 	if not items:
 		items = list(set([d.item_code for d in sle]))
-
-	for item in frappe.db.sql("""
-		select name, item_name, description, item_group, brand, stock_uom
-		from `tabItem`
-		where name in ({0})
-		""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1):
-			item_details.setdefault(item.name, item)
+		
+	if items:
+		for item in frappe.db.sql("""
+			select name, item_name, description, item_group, brand, stock_uom
+			from `tabItem`
+			where name in ({0})
+			""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1):
+				item_details.setdefault(item.name, item)
 
 	if filters.get('show_variant_attributes', 0) == 1:
 		variant_values = get_variant_values_for(item_details.keys())
@@ -217,11 +218,14 @@
 	return item_details
 
 def get_item_reorder_details(items):
-	item_reorder_details = frappe.db.sql("""
-		select parent, warehouse, warehouse_reorder_qty, warehouse_reorder_level
-		from `tabItem Reorder`
-		where parent in ({0})
-	""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1)
+	item_reorder_details = frappe._dict()
+
+	if items:
+		item_reorder_details = frappe.db.sql("""
+			select parent, warehouse, warehouse_reorder_qty, warehouse_reorder_level
+			from `tabItem Reorder`
+			where parent in ({0})
+		""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1)
 
 	return dict((d.parent + d.warehouse, d) for d in item_reorder_details)
 
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 5e185e0..1a91ab4 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -93,6 +93,9 @@
 	if not items:
 		items = list(set([d.item_code for d in sl_entries]))
 
+	if not items:
+		return item_details
+
 	for item in frappe.db.sql("""
 		select name, item_name, description, item_group, brand, stock_uom
 		from `tabItem`
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index e13795c..5e238e4 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -65,8 +65,8 @@
 erpnext/hr/doctype/training_result_employee/test_training_result.js
 erpnext/hr/doctype/training_feedback/test_training_feedback.js
 erpnext/hr/doctype/loan_type/test_loan_type.js
-erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
-erpnext/hr/doctype/employee_loan/test_employee_loan.js
+erpnext/hr/doctype/loan_application/test_loan_application.js
+erpnext/hr/doctype/loan/test_loan.js
 erpnext/buying/doctype/supplier/test_supplier.js
 erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation.js
 erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation.js
diff --git a/erpnext/utilities/page/leaderboard/leaderboard.js b/erpnext/utilities/page/leaderboard/leaderboard.js
index af62dad..6e4db1b 100644
--- a/erpnext/utilities/page/leaderboard/leaderboard.js
+++ b/erpnext/utilities/page/leaderboard/leaderboard.js
@@ -24,7 +24,7 @@
 			"Item": ["total_sales_amount", "total_qty_sold", "total_purchase_amount",
 				"total_qty_purchased", "available_stock_qty", "available_stock_value"],
 			"Supplier": ["total_purchase_amount", "total_qty_purchased", "outstanding_amount"],
-			"Sales Partner": ["total_sales_amount", "total_commision"],
+			"Sales Partner": ["total_sales_amount", "total_commission"],
 			"Sales Person": ["total_sales_amount"],
 		};
 
diff --git a/setup.py b/setup.py
index c293fb8..71107a9 100644
--- a/setup.py
+++ b/setup.py
@@ -1,20 +1,17 @@
 # -*- coding: utf-8 -*-
 from setuptools import setup, find_packages
-try: # for pip >= 10
-	from pip._internal.req import parse_requirements
-except ImportError: # for pip <= 9.0.3
-	from pip.req import parse_requirements
 import re, ast
 
 # get version from __version__ variable in erpnext/__init__.py
 _version_re = re.compile(r'__version__\s+=\s+(.*)')
 
+with open('requirements.txt') as f:
+	install_requires = f.read().strip().split('\n')
+
 with open('erpnext/__init__.py', 'rb') as f:
 	version = str(ast.literal_eval(_version_re.search(
 		f.read().decode('utf-8')).group(1)))
 
-requirements = parse_requirements("requirements.txt", session="")
-
 setup(
 	name='erpnext',
 	version=version,
@@ -24,6 +21,5 @@
 	packages=find_packages(),
 	zip_safe=False,
 	include_package_data=True,
-	install_requires=[str(ir.req) for ir in requirements],
-	dependency_links=[str(ir._link) for ir in requirements if ir._link]
+	install_requires=install_requires
 )