mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Merge branch 'date-range' into 'master'
fix date range issue in reports See merge request mohit.panjvani/crater-web!635
This commit is contained in:
@ -163,6 +163,14 @@ 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: {
|
||||
@ -174,11 +182,7 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.siteURL = `/reports/expenses/${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: {
|
||||
@ -243,6 +247,7 @@ export default {
|
||||
setRangeToCustom() {
|
||||
this.selectedRange = 'Custom'
|
||||
},
|
||||
|
||||
async viewReportsPDF() {
|
||||
let data = await this.getReports()
|
||||
window.open(this.getReportUrl, '_blank')
|
||||
@ -257,7 +262,7 @@ export default {
|
||||
return true
|
||||
}
|
||||
|
||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.dateRangeUrl
|
||||
return true
|
||||
},
|
||||
|
||||
@ -269,7 +274,7 @@ export default {
|
||||
window.open(this.getReportUrl + '&download=true')
|
||||
|
||||
setTimeout(() => {
|
||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.dateRangeUrl
|
||||
}, 200)
|
||||
},
|
||||
},
|
||||
|
||||
@ -162,6 +162,14 @@ 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: {
|
||||
@ -173,17 +181,14 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.siteURL = `/reports/profit-loss/${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()
|
||||
},
|
||||
|
||||
getPreDate(type, time) {
|
||||
return moment().subtract(1, time)[type](time).toString()
|
||||
},
|
||||
@ -257,7 +262,7 @@ export default {
|
||||
return true
|
||||
}
|
||||
|
||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.dateRangeUrl
|
||||
return true
|
||||
},
|
||||
|
||||
@ -268,7 +273,7 @@ export default {
|
||||
|
||||
window.open(this.getReportUrl + '&download=true')
|
||||
setTimeout(() => {
|
||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.dateRangeUrl
|
||||
}, 200)
|
||||
},
|
||||
},
|
||||
|
||||
@ -147,6 +147,7 @@ export default {
|
||||
|
||||
computed: {
|
||||
...mapGetters('company', ['getSelectedCompany']),
|
||||
|
||||
getReportUrl() {
|
||||
return this.url
|
||||
},
|
||||
@ -180,6 +181,22 @@ export default {
|
||||
return this.$t('validation.required')
|
||||
}
|
||||
},
|
||||
|
||||
customerDateRangeUrl () {
|
||||
return `${this.customerSiteURL}?from_date=${moment(
|
||||
this.formData.from_date
|
||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
||||
'YYYY-MM-DD'
|
||||
)}`
|
||||
},
|
||||
|
||||
itemDateRangeUrl () {
|
||||
return `${this.itemsSiteURL}?from_date=${moment(
|
||||
this.formData.from_date
|
||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
||||
'YYYY-MM-DD'
|
||||
)}`
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
@ -197,6 +214,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
...mapActions('salesReport', ['loadLinkByCustomer', 'loadLinkByItems']),
|
||||
|
||||
getThisDate(type, time) {
|
||||
return moment()[type](time).toString()
|
||||
},
|
||||
@ -263,18 +281,10 @@ export default {
|
||||
|
||||
async getInitialReport() {
|
||||
if (this.selectedType === 'By Customer') {
|
||||
this.url = `${this.customerSiteURL}?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.customerDateRangeUrl
|
||||
return true
|
||||
}
|
||||
this.url = `${this.itemsSiteURL}?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.itemDateRangeUrl
|
||||
return true
|
||||
},
|
||||
|
||||
@ -291,10 +301,10 @@ export default {
|
||||
return true
|
||||
}
|
||||
if (this.selectedType === 'By Customer') {
|
||||
this.url = `${this.customerSiteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.customerDateRangeUrl
|
||||
return true
|
||||
}
|
||||
this.url = `${this.itemsSiteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.itemDateRangeUrl
|
||||
return true
|
||||
},
|
||||
|
||||
@ -306,10 +316,10 @@ export default {
|
||||
window.open(this.getReportUrl + '&download=true')
|
||||
setTimeout(() => {
|
||||
if (this.selectedType === 'By Customer') {
|
||||
this.url = `${this.customerSiteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.customerDateRangeUrl
|
||||
return true
|
||||
}
|
||||
this.url = `${this.itemsSiteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
||||
this.url = this.itemDateRangeUrl
|
||||
return true
|
||||
}, 200)
|
||||
},
|
||||
|
||||
@ -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)
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user