mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-10 04:36:50 +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" {
|
||||
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 {
|
||||
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)
|
||||
|
|
@ -122,7 +122,8 @@ func (bs Service) BuildReport(period string, month, year int) *Report {
|
|||
from bookings
|
||||
join items on bookings.id = items.booking_id
|
||||
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")).
|
||||
Scan(&lines)
|
||||
|
|
|
|||
Loading…
Reference in a new issue