Merge pull request #17082 from Anurag810/aahi_loan_report
feat: Loan repayment report
This commit is contained in:
commit
7516e7e66e
0
erpnext/hr/report/loan_repayment/__init__.py
Normal file
0
erpnext/hr/report/loan_repayment/__init__.py
Normal file
9
erpnext/hr/report/loan_repayment/loan_repayment.js
Normal file
9
erpnext/hr/report/loan_repayment/loan_repayment.js
Normal file
@ -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": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
28
erpnext/hr/report/loan_repayment/loan_repayment.json
Normal file
28
erpnext/hr/report/loan_repayment/loan_repayment.json
Normal file
@ -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": "",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
95
erpnext/hr/report/loan_repayment/loan_repayment.py
Normal file
95
erpnext/hr/report/loan_repayment/loan_repayment.py
Normal file
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user