Analytics report bug fixes and code cleaning

This commit is contained in:
deepeshgarg007 2018-11-29 08:34:47 +05:30
parent 305c8b1fba
commit 1a1c013b2a
6 changed files with 25 additions and 42 deletions

View File

@ -68,12 +68,6 @@ frappe.query_reports["Purchase Analytics"] = {
}
],
"formatter": function(value, row, column, data) {
if(!value){
value = 0
}
return value;
},
get_datatable_options(options) {
return Object.assign(options, {
checkboxColumn: true,
@ -113,16 +107,16 @@ frappe.query_reports["Purchase Analytics"] = {
setTimeout(() => {
frappe.query_report.chart.update(new_data)
},200)
},500)
setTimeout(() => {
frappe.query_report.chart.draw(true);
}, 800)
}, 1000)
frappe.query_report.raw_chart_data = new_data;
},
}
})
},
});
}
}

View File

@ -39,8 +39,5 @@ frappe.query_reports["Production Analytics"] = {
default: "Monthly",
reqd: 1
}
],
"formatter": function(value, row, column, data) {
return value;
}
]
}

View File

@ -106,12 +106,12 @@ frappe.query_reports["Sales Analytics"] = {
setTimeout(() => {
frappe.query_report.chart.update(new_data)
},200)
}, 500)
setTimeout(() => {
frappe.query_report.chart.draw(true);
}, 800)
}, 1000)
frappe.query_report.raw_chart_data = new_data;
},

View File

@ -212,11 +212,11 @@ class Analytics(object):
def get_period(self, posting_date):
if self.filters.range == 'Weekly':
period = "Week " + str(posting_date.isocalendar()[1])
period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
elif self.filters.range == 'Monthly':
period = self.months[posting_date.month - 1]
period = str(self.months[posting_date.month - 1]) + " " + str(posting_date.year)
elif self.filters.range == 'Quarterly':
period = "Quarter " + str(((posting_date.month-1)//3)+1)
period = "Quarter " + str(((posting_date.month-1)//3)+1) +" " + str(posting_date.year)
else:
year = get_fiscal_year(posting_date, company=self.filters.company)
period = str(year[2])
@ -277,11 +277,14 @@ class Analytics(object):
def get_chart_data(self):
length = len(self.columns)
labels = [d.get("label") for d in self.columns[2:length-1]]
entry = {
'name':self.data[0].get('entity_name')
}
print("##########")
self.chart = {
"data": {
'labels': labels,
'datasets':[
]
'datasets':[]
},
"type": "line"
}

View File

@ -71,17 +71,6 @@ frappe.query_reports["Stock Analytics"] = {
reqd: 1
}
],
"formatter": function(value, row, column, data) {
if(!value && (column.fieldname == 'brand' || column.fieldname == 'uom')){
value = ""
}
if(Number(value)){
value = value.toFixed(2)
}
return value;
},
get_datatable_options(options) {
return Object.assign(options, {
checkboxColumn: true,
@ -120,16 +109,16 @@ frappe.query_reports["Stock Analytics"] = {
setTimeout(() => {
frappe.query_report.chart.update(new_data)
},200)
},500)
setTimeout(() => {
frappe.query_report.chart.draw(true);
}, 800)
}, 1000)
frappe.query_report.raw_chart_data = new_data;
},
}
})
},
});
}
}

View File

@ -99,11 +99,11 @@ def get_period(posting_date, filters):
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
if filters.range == 'Weekly':
period = "Week " + str(posting_date.isocalendar()[1])
period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
elif filters.range == 'Monthly':
period = months[posting_date.month - 1]
period = str(months[posting_date.month - 1]) + " " + str(posting_date.year)
elif filters.range == 'Quarterly':
period = "Quarter " + str(((posting_date.month-1)//3)+1)
period = "Quarter " + str(((posting_date.month-1)//3)+1) +" " + str(posting_date.year)
else:
year = get_fiscal_year(posting_date, company=filters.company)
period = str(year[2])