fix date range issue in reports

This commit is contained in:
raishvaria
2020-12-07 12:34:12 +05:30
parent fd3742b926
commit 599e6270e8
4 changed files with 62 additions and 35 deletions

View File

@ -151,21 +151,28 @@ export default {
return this.$t('validation.required')
}
},
dateRangeUrl () {
return `${this.siteURL}?from_date=${moment(
this.formData.from_date
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
'YYYY-MM-DD'
)}`
}
},
watch: {
range(newRange) {
this.formData.from_date = moment(newRange).startOf('year').toString()
this.formData.to_date = moment(newRange).endOf('year').toString()
},
},
mounted() {
this.siteURL = `/reports/tax-summary/${this.getSelectedCompany.unique_hash}`
this.url = `${this.siteURL}?from_date=${moment(
this.formData.from_date
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
'YYYY-MM-DD'
)}`
this.url = this.dateRangeUrl
},
methods: {
getThisDate(type, time) {
return moment()[type](time).toString()
@ -240,7 +247,7 @@ export default {
return false
}
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
this.url = this.dateRangeUrl
return true
},
downloadReport() {
@ -251,7 +258,7 @@ export default {
window.open(this.url + '&download=true')
setTimeout(() => {
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
this.url = this.dateRangeUrl
}, 200)
},
},