67 lines
1.1 KiB
Go
67 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/jinzhu/gorm"
|
|
)
|
|
|
|
type Invoice struct {
|
|
gorm.Model
|
|
BuyerID uint
|
|
BuyerName string
|
|
BuyerAddress string
|
|
BuyerEmail string
|
|
BuyerPhone string
|
|
SellerID uint
|
|
SellerName string
|
|
SellerAddress string
|
|
SellerEmail string
|
|
SellerPhone string
|
|
PriceCents int64 `gorm:"column:price_cents"`
|
|
Discount int64
|
|
Tax int64
|
|
TermsAndConditions string
|
|
InvoiceName string
|
|
InvoiceDate time.Time
|
|
InvoiceDueDate time.Time
|
|
ContractID uint
|
|
InvoiceItem [] InvoiceItem
|
|
Status string
|
|
}
|
|
|
|
|
|
type ListInvoiceResponse struct {
|
|
Status KeyValue `json:"Status"`
|
|
Buyer CompanyShortResponse `json:"Buyer"`
|
|
ContractID int
|
|
DateCreated time.Time
|
|
DueDate time.Time
|
|
Amount string
|
|
|
|
}
|
|
|
|
type KeyValue struct {
|
|
Key string
|
|
Value string
|
|
}
|
|
|
|
|
|
|
|
func GetInvoiceStatuses() []Status {
|
|
return []Status{
|
|
{Key: "Insurance claimed", Value: "insurance_claimed"},
|
|
{Key: "Invoice issued", Value: "invoice_issued"},
|
|
}
|
|
}
|
|
|
|
func (Invoice) Update() (bool, error) {
|
|
return false, nil
|
|
}
|
|
func (Invoice) Create() (bool, error) {
|
|
return false, nil
|
|
}
|
|
func (Invoice) Delete() (bool, error) {
|
|
return false, nil
|
|
}
|