fix: don't append year if values have same year in Appointment Analytics
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js
index e4a9a46..18d252e 100644
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js
+++ b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.js
@@ -85,7 +85,6 @@
return column.content;
})
-
entry = {
'name': row_name,
'values': row_values
@@ -95,8 +94,7 @@
let new_datasets = raw_data.datasets;
let found = false;
-
- for(let i=0; i < new_datasets.length;i++) {
+ for (let i=0; i < new_datasets.length;i++) {
if (new_datasets[i].name == row_name) {
found = true;
new_datasets.splice(i,1);
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
index 15ad48c..f2cfd75 100644
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
+++ b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
@@ -84,14 +84,14 @@
self.columns.append({
'label': _(period),
'fieldname': scrub(period),
- 'fieldtype': 'Float',
+ 'fieldtype': 'Int',
'width': 120
})
self.columns.append({
'label': _('Total'),
'fieldname': 'total',
- 'fieldtype': 'Float',
+ 'fieldtype': 'Int',
'width': 120
})
@@ -106,15 +106,18 @@
def get_period(self, appointment_date):
if self.filters.range == 'Weekly':
- period = 'Week ' + str(appointment_date.isocalendar()[1]) + ' ' + str(appointment_date.year)
+ period = 'Week ' + str(appointment_date.isocalendar()[1])
elif self.filters.range == 'Monthly':
- period = str(self.months[appointment_date.month - 1]) + ' ' + str(appointment_date.year)
+ period = str(self.months[appointment_date.month - 1])
elif self.filters.range == 'Quarterly':
- period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1) + ' ' + str(appointment_date.year)
+ period = 'Quarter ' + str(((appointment_date.month - 1) // 3) + 1)
else:
year = get_fiscal_year(appointment_date, company=self.filters.company)
period = str(year[0])
+ if getdate(self.filters.from_date).year != getdate(self.filters.to_date).year:
+ period += ' ' + str(appointment_date.year)
+
return period
def get_appointments_based_on_healthcare_practitioner(self):
@@ -180,7 +183,7 @@
def get_chart_data(self):
length = len(self.columns)
- labels = [d.get("label") for d in self.columns[3:length - 1]]
+ labels = [d.get("label") for d in self.columns[1:length - 1]]
self.chart = {
"data": {
'labels': labels,