mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
use booking.com logic for reports
This commit is contained in:
parent
788711e8c9
commit
da38546c3d
2 changed files with 7 additions and 3 deletions
|
|
@ -16,6 +16,10 @@ Manage your holiday rental
|
|||
- [x] Seed the database with the existing data before using the new system with customer data
|
||||
- [ ] Create a dashboard page with the Host details, bookings and revenue this month
|
||||
- [x] Edit campaigns and lines
|
||||
- [ ] Filter bookings per date, name
|
||||
- [ ] Paginate booking list
|
||||
- [ ] Add a note field
|
||||
- [ ] Update booking and lines
|
||||
|
||||
## Built With
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ func (bs Service) BuildReport(period string, month, year int) *Report {
|
|||
select bookings.id, customer_name, "from", "to", platform, sum(price * quantity) as total, platform_fees
|
||||
from bookings
|
||||
join items on bookings.id = items.booking_id
|
||||
where "from" between ? and ?
|
||||
where "to" between ? and ?
|
||||
group by bookings.id
|
||||
order by bookings.id;
|
||||
`,
|
||||
|
|
@ -134,9 +134,9 @@ func (bs Service) BuildReport(period string, month, year int) *Report {
|
|||
from (select sum(price * quantity) as total
|
||||
from bookings
|
||||
join items on bookings.id = items.booking_id
|
||||
where "from" between ? and ?
|
||||
where "to" between ? and ?
|
||||
and payment_method = 'Card'
|
||||
group by booking_id);
|
||||
group by booking_id) as t;
|
||||
`,
|
||||
startDate.Format("2006-01-02"), endDate.Format("2006-01-02")).
|
||||
Scan(&cardTotal)
|
||||
|
|
|
|||
Loading…
Reference in a new issue