here i want to show dynamic schedule date
this my code
from future import unicode_literals
import frappe
from frappe import _
import math
def execute(filters=None):
return columns(filters), data()
def columns(filters):
# from_date=filters.get(‘from_date’)
# to_date=filters.get(‘to_date’)
# day=frappe.utils.date_diff(to_date,from_date)
# if(day<30 or day<31):
# month=1
# else:
# month=math.ceil(float(day)/30)
if filters.get('from_date'):
filters['schedule_date'] = ('>=', filters.from_date)
del filters['from_date']
if filters.get('to_date'):
filters['schedule_date'] = ('<=', filters.to_date)
del filters['to_date']
conditions, values = frappe.db.build_conditions(filters)
sql="""SELECT * FROM `tabDepreciation Schedule` {}""".format("WHERE "+ conditions if conditions else "")
schedule_date_get=frappe.db.sql(sql,values=values)
colum=[
{
"fieldname":"asset_name",
"fieldtype":"Data",
"label":_("Particulars"),
"width":120
},
{
"fieldname":"warehouse",
"fieldtype":"Data",
"label":_("Location"),
"width":120,
},
{
"fieldname":"id",
"fieldtype":"Data",
"label":_("ID No"),
"width":120,
},
{
"fieldname":"rate",
"fieldtype":"Data",
"label":_("Rate"),
"width":120,
},
{
"fieldname":"quantity",
"fieldtype":"Data",
"label":_("Quantity"),
"width":120,
},
{
"fieldname":"purchase_date",
"fieldtype":"Data",
"label":_("Acquisition Date"),
"width":120,
},
{
"fieldname":"gross_purchase_amount",
"fieldtype":"Data",
"label":_("Acquisition Value"),
"width":120,
},
{
"fieldname":"opening_accumulated_depreciation",
"fieldtype":"Data",
"label":_("Accu. Depr.Opening"),
"width":120,
},
for x in schedule_date_get:
{
"fieldname":"opening_accumulated_depreciation",
"fieldtype":"Data",
"label":_("01-01-2017"),
"width":120,
}
,{
"fieldname":"total_depreciation",
"fieldtype":"Data",
"label":_("Total Deprection"),
"width":120,
},
{
"fieldname":"accumulated_depreciation_closing",
"fieldtype":"Data",
"label":_("Accu. Dep.Closing"),
"width":120,
},
{
"fieldname":"wdv",
"fieldtype":"Data",
"label":_("W. D. V"),
"width":120,
},
]
frappe.msgprint(str(colum))
return colum
def test():
return [‘11’,‘3’,‘2’]
def data():
data=[]
return data