Merge branch 'develop' into aahi_loan_report
diff --git a/erpnext/hr/report/loan_repayment/__init__.py b/erpnext/hr/report/loan_repayment/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/report/loan_repayment/__init__.py
diff --git a/erpnext/hr/report/loan_repayment/loan_repayment.js b/erpnext/hr/report/loan_repayment/loan_repayment.js
new file mode 100644
index 0000000..21aa206
--- /dev/null
+++ b/erpnext/hr/report/loan_repayment/loan_repayment.js
@@ -0,0 +1,9 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["Loan Repayment"] = {
+ "filters": [
+
+ ]
+}
diff --git a/erpnext/hr/report/loan_repayment/loan_repayment.json b/erpnext/hr/report/loan_repayment/loan_repayment.json
new file mode 100644
index 0000000..23b6977
--- /dev/null
+++ b/erpnext/hr/report/loan_repayment/loan_repayment.json
@@ -0,0 +1,28 @@
+{
+ "add_total_row": 0,
+ "creation": "2019-03-29 18:58:00.166032",
+ "disable_prepared_report": 0,
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "letter_head": "Gadgets International",
+ "modified": "2019-03-29 18:58:00.166032",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Loan Repayment",
+ "owner": "Administrator",
+ "prepared_report": 0,
+ "ref_doctype": "Loan",
+ "report_name": "Loan Repayment",
+ "report_type": "Script Report",
+ "roles": [
+ {
+ "role": "HR Manager"
+ },
+ {
+ "role": "Employee"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/hr/report/loan_repayment/loan_repayment.py b/erpnext/hr/report/loan_repayment/loan_repayment.py
new file mode 100644
index 0000000..9e310de
--- /dev/null
+++ b/erpnext/hr/report/loan_repayment/loan_repayment.py
@@ -0,0 +1,95 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+
+def execute(filters=None):
+
+ columns = create_columns()
+ data = get_record()
+ return columns, data
+
+def create_columns():
+ return [
+ {
+ "label": _("Employee"),
+ "fieldtype": "Data",
+ "fieldname": "employee",
+ "options": "Employee",
+ "width": 200
+ },
+ {
+ "label": _("Loan"),
+ "fieldtype": "Link",
+ "fieldname": "loan_name",
+ "options": "Loan",
+ "width": 200
+ },
+ {
+ "label": _("Loan Amount"),
+ "fieldtype": "Currency",
+ "fieldname": "loan_amount",
+ "options": "currency",
+ "width": 100
+ },
+ {
+ "label": _("Interest"),
+ "fieldtype": "Data",
+ "fieldname": "interest",
+ "width": 100
+ },
+ {
+ "label": _("Payable Amount"),
+ "fieldtype": "Currency",
+ "fieldname": "payable_amount",
+ "options": "currency",
+ "width": 100
+ },
+ {
+ "label": _("EMI"),
+ "fieldtype": "Currency",
+ "fieldname": "emi",
+ "options": "currency",
+ "width": 100
+ },
+ {
+ "label": _("Paid Amount"),
+ "fieldtype": "Currency",
+ "fieldname": "paid_amount",
+ "options": "currency",
+ "width": 100
+ },
+ {
+ "label": _("Outstanding Amount"),
+ "fieldtype": "Currency",
+ "fieldname": "out_amt",
+ "options": "currency",
+ "width": 100
+ },
+ ]
+
+def get_record():
+ data = []
+ loans = frappe.get_all("Loan",
+ filters=[("status", "=", "Fully Disbursed")],
+ fields=["applicant", "applicant_name", "name", "loan_amount", "rate_of_interest",
+ "total_payment", "monthly_repayment_amount", "total_amount_paid"]
+ )
+
+ for loan in loans:
+ row = {
+ "employee": loan.applicant + ": " + loan.applicant_name,
+ "loan_name": loan.name,
+ "loan_amount": loan.loan_amount,
+ "interest": str(loan.rate_of_interest) + "%",
+ "payable_amount": loan.total_payment,
+ "emi": loan.monthly_repayment_amount,
+ "paid_amount": loan.total_amount_paid,
+ "out_amt": loan.total_payment - loan.total_amount_paid
+ }
+
+ data.append(row)
+
+ return data