mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -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')
|
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: {
|
watch: {
|
||||||
@ -174,11 +182,7 @@ export default {
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.siteURL = `/reports/expenses/${this.getSelectedCompany.unique_hash}`
|
this.siteURL = `/reports/expenses/${this.getSelectedCompany.unique_hash}`
|
||||||
this.url = `${this.siteURL}?from_date=${moment(
|
this.url = this.dateRangeUrl
|
||||||
this.formData.from_date
|
|
||||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
)}`
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@ -243,6 +247,7 @@ export default {
|
|||||||
setRangeToCustom() {
|
setRangeToCustom() {
|
||||||
this.selectedRange = 'Custom'
|
this.selectedRange = 'Custom'
|
||||||
},
|
},
|
||||||
|
|
||||||
async viewReportsPDF() {
|
async viewReportsPDF() {
|
||||||
let data = await this.getReports()
|
let data = await this.getReports()
|
||||||
window.open(this.getReportUrl, '_blank')
|
window.open(this.getReportUrl, '_blank')
|
||||||
@ -257,7 +262,7 @@ export default {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.dateRangeUrl
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -269,7 +274,7 @@ export default {
|
|||||||
window.open(this.getReportUrl + '&download=true')
|
window.open(this.getReportUrl + '&download=true')
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.dateRangeUrl
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -162,6 +162,14 @@ export default {
|
|||||||
return this.$t('validation.required')
|
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: {
|
watch: {
|
||||||
@ -173,17 +181,14 @@ export default {
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.siteURL = `/reports/profit-loss/${this.getSelectedCompany.unique_hash}`
|
this.siteURL = `/reports/profit-loss/${this.getSelectedCompany.unique_hash}`
|
||||||
this.url = `${this.siteURL}?from_date=${moment(
|
this.url = this.dateRangeUrl
|
||||||
this.formData.from_date
|
|
||||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
)}`
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getThisDate(type, time) {
|
getThisDate(type, time) {
|
||||||
return moment()[type](time).toString()
|
return moment()[type](time).toString()
|
||||||
},
|
},
|
||||||
|
|
||||||
getPreDate(type, time) {
|
getPreDate(type, time) {
|
||||||
return moment().subtract(1, time)[type](time).toString()
|
return moment().subtract(1, time)[type](time).toString()
|
||||||
},
|
},
|
||||||
@ -257,7 +262,7 @@ export default {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.dateRangeUrl
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -268,7 +273,7 @@ export default {
|
|||||||
|
|
||||||
window.open(this.getReportUrl + '&download=true')
|
window.open(this.getReportUrl + '&download=true')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.dateRangeUrl
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -147,6 +147,7 @@ export default {
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('company', ['getSelectedCompany']),
|
...mapGetters('company', ['getSelectedCompany']),
|
||||||
|
|
||||||
getReportUrl() {
|
getReportUrl() {
|
||||||
return this.url
|
return this.url
|
||||||
},
|
},
|
||||||
@ -180,6 +181,22 @@ export default {
|
|||||||
return this.$t('validation.required')
|
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: {
|
watch: {
|
||||||
@ -197,6 +214,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('salesReport', ['loadLinkByCustomer', 'loadLinkByItems']),
|
...mapActions('salesReport', ['loadLinkByCustomer', 'loadLinkByItems']),
|
||||||
|
|
||||||
getThisDate(type, time) {
|
getThisDate(type, time) {
|
||||||
return moment()[type](time).toString()
|
return moment()[type](time).toString()
|
||||||
},
|
},
|
||||||
@ -263,18 +281,10 @@ export default {
|
|||||||
|
|
||||||
async getInitialReport() {
|
async getInitialReport() {
|
||||||
if (this.selectedType === 'By Customer') {
|
if (this.selectedType === 'By Customer') {
|
||||||
this.url = `${this.customerSiteURL}?from_date=${moment(
|
this.url = this.customerDateRangeUrl
|
||||||
this.formData.from_date
|
|
||||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
)}`
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
this.url = `${this.itemsSiteURL}?from_date=${moment(
|
this.url = this.itemDateRangeUrl
|
||||||
this.formData.from_date
|
|
||||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
)}`
|
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -291,10 +301,10 @@ export default {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (this.selectedType === 'By Customer') {
|
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
|
return true
|
||||||
}
|
}
|
||||||
this.url = `${this.itemsSiteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.itemDateRangeUrl
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -306,10 +316,10 @@ export default {
|
|||||||
window.open(this.getReportUrl + '&download=true')
|
window.open(this.getReportUrl + '&download=true')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.selectedType === 'By Customer') {
|
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
|
return true
|
||||||
}
|
}
|
||||||
this.url = `${this.itemsSiteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.itemDateRangeUrl
|
||||||
return true
|
return true
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -151,21 +151,28 @@ export default {
|
|||||||
return this.$t('validation.required')
|
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: {
|
watch: {
|
||||||
range(newRange) {
|
range(newRange) {
|
||||||
this.formData.from_date = moment(newRange).startOf('year').toString()
|
this.formData.from_date = moment(newRange).startOf('year').toString()
|
||||||
this.formData.to_date = moment(newRange).endOf('year').toString()
|
this.formData.to_date = moment(newRange).endOf('year').toString()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.siteURL = `/reports/tax-summary/${this.getSelectedCompany.unique_hash}`
|
this.siteURL = `/reports/tax-summary/${this.getSelectedCompany.unique_hash}`
|
||||||
this.url = `${this.siteURL}?from_date=${moment(
|
this.url = this.dateRangeUrl
|
||||||
this.formData.from_date
|
|
||||||
).format('YYYY-MM-DD')}&to_date=${moment(this.formData.to_date).format(
|
|
||||||
'YYYY-MM-DD'
|
|
||||||
)}`
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getThisDate(type, time) {
|
getThisDate(type, time) {
|
||||||
return moment()[type](time).toString()
|
return moment()[type](time).toString()
|
||||||
@ -240,7 +247,7 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.dateRangeUrl
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
downloadReport() {
|
downloadReport() {
|
||||||
@ -251,7 +258,7 @@ export default {
|
|||||||
window.open(this.url + '&download=true')
|
window.open(this.url + '&download=true')
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.url = `${this.siteURL}?from_date=${this.formData.from_date}&to_date=${this.formData.to_date}`
|
this.url = this.dateRangeUrl
|
||||||
}, 200)
|
}, 200)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user