mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
Merge pull request #4 from rjNemo/2-pdf-report
2: Formatting for PDF report
This commit is contained in:
commit
3ece623a27
3 changed files with 11 additions and 17 deletions
|
|
@ -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),
|
||||
}
|
||||
}),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ type Server struct {
|
|||
bs *booking.Service
|
||||
ps *pdf.PdfService
|
||||
hc *config.Host
|
||||
fs *embed.FS
|
||||
addr string
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue