mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-10 04:36:50 +00:00
complete data for pdf
This commit is contained in:
parent
ec853f6b66
commit
43ab1f59d2
1 changed files with 11 additions and 4 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in a new issue