mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
fix the report query
This commit is contained in:
parent
3cf56095b7
commit
322f440716
1 changed files with 3 additions and 2 deletions
|
|
@ -111,7 +111,7 @@ func (bs Service) BuildReport(period string, month, year int) *Report {
|
||||||
|
|
||||||
if period == "month" {
|
if period == "month" {
|
||||||
startDate = time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC)
|
startDate = time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.UTC)
|
||||||
endDate = time.Date(year, time.Month(month), 31, 0, 0, 0, 0, time.UTC)
|
endDate = time.Date(year, time.Month(month)+1, 1, 0, 0, 0, 0, time.UTC).Add(-24 * time.Hour)
|
||||||
} else {
|
} else {
|
||||||
startDate = time.Date(year, time.January, 1, 0, 0, 0, 0, time.UTC)
|
startDate = time.Date(year, time.January, 1, 0, 0, 0, 0, time.UTC)
|
||||||
endDate = time.Date(year, time.December, 31, 0, 0, 0, 0, time.UTC)
|
endDate = time.Date(year, time.December, 31, 0, 0, 0, 0, time.UTC)
|
||||||
|
|
@ -122,7 +122,8 @@ func (bs Service) BuildReport(period string, month, year int) *Report {
|
||||||
from bookings
|
from bookings
|
||||||
join items on bookings.id = items.booking_id
|
join items on bookings.id = items.booking_id
|
||||||
where "from" between ? and ?
|
where "from" between ? and ?
|
||||||
group by bookings.id;
|
group by bookings.id
|
||||||
|
order by bookings.id;
|
||||||
`,
|
`,
|
||||||
startDate.Format("2006-01-02"), endDate.Format("2006-01-02")).
|
startDate.Format("2006-01-02"), endDate.Format("2006-01-02")).
|
||||||
Scan(&lines)
|
Scan(&lines)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue