mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
39 lines
821 B
Go
39 lines
821 B
Go
package booking
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/rjNemo/rentease/config"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Booking struct {
|
|
From time.Time
|
|
To time.Time
|
|
gorm.Model
|
|
Name string `gorm:"column:customer_name"`
|
|
PhoneNumber string
|
|
Email string
|
|
Platform string
|
|
Items []Item
|
|
Id int
|
|
CustomerNumber int `gorm:"column:customers"`
|
|
PlatformFees float64 `gorm:"type:decimal(10,2)"`
|
|
}
|
|
|
|
type Item struct {
|
|
gorm.Model
|
|
Item string
|
|
PaymentMethod string
|
|
PaymentStatus string `gorm:"default:Pending"`
|
|
Id int
|
|
BookingId int
|
|
Quantity int
|
|
Price float64 `gorm:"type:decimal(10,2)"`
|
|
}
|
|
|
|
func (b Booking) InvoiceNumber(hc *config.Host) string {
|
|
return fmt.Sprintf("%s%04s", hc.InvoicePrefix, strconv.Itoa(b.Id+hc.CustomerSeed))
|
|
}
|