complete data for pdf

This commit is contained in:
Ruidy 2024-02-18 20:16:53 +01:00
parent ec853f6b66
commit 43ab1f59d2
No known key found for this signature in database
GPG key ID: E00F51288CB857CC

View file

@ -42,11 +42,18 @@ func (ps PdfService) BuildInvoice(b *booking.Booking) error {
"id": fmt.Sprintf("VFNI%04s", strconv.Itoa(b.Id)),
"name": b.Name,
"phone_number": b.PhoneNumber,
"custumers_number": b.CustomerNumber,
"customers_number": b.CustomerNumber,
"platform": b.Platform,
"from": b.From.Format("Monday 02 January 2006"),
"to": b.To.Format("Monday 02 January 2006"),
"lines": b.Items,
"from": b.From.Format("02/01/2006"),
"to": b.To.Format("02/01/2006"),
"lines": u.Map(b.Items, func(i booking.Item) map[string]any {
return map[string]any{
"name": i.Item,
"quantity": i.Quantity,
"price": i.Price,
"total": i.Price * float64(i.Quantity),
}
}),
"total": strconv.FormatFloat(u.Reduce(b.Items, func(i booking.Item, sum float64) float64 {
return sum + i.Price*float64(i.Quantity)
}, 0.0), 'f', 2, 64),