diff --git a/internal/pdf/service.go b/internal/pdf/service.go index ef6fb42..ca4439e 100644 --- a/internal/pdf/service.go +++ b/internal/pdf/service.go @@ -97,23 +97,23 @@ func (ps PdfService) BuildReport(r *booking.Report, period string, month, year i Context: map[string]any{ "month": month, "year": year, - "total": r.Total, + "total": strconv.FormatFloat(r.Total, 'f', 2, 64), "platform_fees": r.PlatformFees, - "fee": r.Fee, - "profit": r.Profit, - "card_total": r.CardTotal, - "booking_fees": r.BookingFees, + "fee": strconv.FormatFloat(r.Fee, 'f', 2, 64), + "profit": strconv.FormatFloat(r.Profit, 'f', 2, 64), + "card_total": strconv.FormatFloat(r.CardTotal, 'f', 2, 64), + "booking_fees": strconv.FormatFloat(r.BookingFees, 'f', 2, 64), "lines": u.Map(r.Lines, func(l *booking.Line) map[string]any { return map[string]any{ "id": l.Id, "name": l.CustomerName, - "from": l.From.Format("2006-01-02"), - "to": l.To.Format("2006-01-02"), - "total": l.Total, + "from": l.From.Format("02 01 2006"), + "to": l.To.Format("02 02 2006"), + "total": strconv.FormatFloat(l.Total, 'f', 2, 64), "platform": l.Platform, - "platform_fees": l.PlatformFees, - "fee": l.Fee(), - "profit": l.Profit(), + "platform_fees": strconv.FormatFloat(l.PlatformFees, 'f', 2, 64), + "fee": strconv.FormatFloat(l.Fee(), 'f', 2, 64), + "profit": strconv.FormatFloat(l.Profit(), 'f', 2, 64), } }), }, diff --git a/internal/server/handle_reports.go b/internal/server/handle_reports.go index fa7d462..cf7eac2 100644 --- a/internal/server/handle_reports.go +++ b/internal/server/handle_reports.go @@ -18,11 +18,6 @@ import ( func handleReportsPage() echo.HandlerFunc { return func(c echo.Context) error { - period := c.QueryParam("period") - if !u.Contains([]string{"month", "year"}, period) { - period = "month" - } - monthStr := c.QueryParam("month") month, err := strconv.Atoi(monthStr) if err != nil || month < 1 || month > 12 { diff --git a/internal/server/server.go b/internal/server/server.go index faf82a8..9420245 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -27,7 +27,6 @@ type Server struct { bs *booking.Service ps *pdf.PdfService hc *config.Host - fs *embed.FS addr string }