Try ERPNext Buy Support Partners Foundation Foundation Members

Customize Report with text field

Hello Team,

I am creating script report on payment entry.


I want to add one text field in report later user add data in field.

Service charges to aas group services is the text filed I want to add.

How i can add text field in report,Can anyone help me???

share your script here

def execute(filters=None):
columns, data = [], []
columns = get_colums()
data = get_data(filters)
validate_filters(filters)
return columns, data

def validate_filters(filters):
if filters.from_date > filters.to_date:
frappe.throw(_(“From Date must be before To Date”))
def get_colums():
columns = [“PAY. DATE:Date:110”] +[“NAME:Link/Payment Entry:145”] + [“MODE OF PAYMENT:Data:165”] + [“REFERENCE NO:Data:120”]
+ [“CASH:Currency:110”] + [“CHEQUE:Currency:110”] + [“GIRO:Currency:100”]+[“NET AMT REC:Currency:140”]
return columns

def get_data(filters):
query = “”"
select posting_date,name, mode_of_payment, reference_no,
case
when (mode_of_payment = “Cash”)
then (paid_amount)
else 0
end as Cash,
case when (mode_of_payment = “Cheque”)
then (paid_amount)
else 0
end as Cheque,
case when (mode_of_payment = “Giro”)
then (paid_amount)
else 0
end as Giro, name, paid_amount
from tabPayment Entry where docstatus=1
and company = ‘{0}’ and
posting_date between ‘{1}’ and ‘{2}’""".format(filters.get(“company”),filters.get(“from_date”),filters.get(“to_date”))
dl = frappe.db.sql(query,as_list=1,debug=1)
return dl

def execute(filters=None):
columns, data = [], []
columns = get_colums()
data = get_data(filters)
validate_filters(filters)
return columns, data

def validate_filters(filters):
if filters.from_date > filters.to_date:
frappe.throw(_(“From Date must be before To Date”))
def get_colums():
columns = [“PAY. DATE:Date:110”] +[“NAME:Link/Payment Entry:145”] + [“MODE OF PAYMENT:Data:165”] + [“REFERENCE NO:Data:120”]
+ [“CASH:Currency:110”] + [“CHEQUE:Currency:110”] + [“GIRO:Currency:100”]+[“NET AMT REC:Currency:140”]+**["Field Name:Data:130"]**
return columns

def get_data(filters):
query = “”“
select posting_date,name, mode_of_payment, reference_no,
case
when (mode_of_payment = “Cash”)
then (paid_amount)
else 0
end as Cash,
case when (mode_of_payment = “Cheque”)
then (paid_amount)
else 0
end as Cheque,
case when (mode_of_payment = “Giro”)
then (paid_amount)
else 0
end as Giro, name, paid_amount,**field_name**
from tabPayment Entry where docstatus=1
and company = ‘{0}’ and
posting_date between ‘{1}’ and ‘{2}’”"".format(filters.get(“company”),filters.get(“from_date”),filters.get(“to_date”))
dl = frappe.db.sql(query,as_list=1,debug=1)
return dl`Preformatted text`

@Maheshwari_Bhavesh I dont have this field in Payment Entry doctype.
I want ot add text field when report generates.

@Bhagyashree_Aher, Did you got a solution for this?