mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
ini ar fifo
This commit is contained in:
@@ -18,6 +18,7 @@ type Expense struct {
|
||||
TransactionDate time.Time `gorm:"type:date;not null"`
|
||||
Notes string `gorm:"type:text;column:notes"`
|
||||
IsPaid bool `gorm:"column:is_paid;not null;default:false"`
|
||||
GrandTotal float64 `gorm:"column:grand_total;type:numeric(15,3);not null;default:0"`
|
||||
CreatedBy uint64 `gorm:""`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
@@ -15,6 +15,7 @@ type Marketing struct {
|
||||
SalesPersonId uint `gorm:"not null"`
|
||||
Notes string `gorm:"type:text"`
|
||||
MarketingType string `gorm:"type:varchar(50)"`
|
||||
GrandTotal float64 `gorm:"column:grand_total;type:numeric(15,3);not null;default:0"`
|
||||
CreatedBy uint `gorm:"not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// PaymentAllocation merepresentasikan hasil FIFO matching dari 1 payment ke
|
||||
// tepat 1 sub-row anak (purchase_item / marketing_delivery_product /
|
||||
// expense_realization). DB constraint memastikan hanya satu FK yang non-null.
|
||||
type PaymentAllocation struct {
|
||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||
PaymentId uint `gorm:"not null;index"`
|
||||
PurchaseItemId *uint `gorm:"column:purchase_item_id"`
|
||||
MarketingDeliveryProductId *uint `gorm:"column:marketing_delivery_product_id"`
|
||||
ExpenseRealizationId *uint64 `gorm:"column:expense_realization_id"`
|
||||
Amount float64 `gorm:"type:numeric(15,3);not null"`
|
||||
AllocatedAt time.Time `gorm:"type:timestamptz;not null;default:NOW()"`
|
||||
|
||||
Payment *Payment `gorm:"foreignKey:PaymentId;references:Id"`
|
||||
PurchaseItem *PurchaseItem `gorm:"foreignKey:PurchaseItemId;references:Id"`
|
||||
MarketingDeliveryProduct *MarketingDeliveryProduct `gorm:"foreignKey:MarketingDeliveryProductId;references:Id"`
|
||||
ExpenseRealization *ExpenseRealization `gorm:"foreignKey:ExpenseRealizationId;references:Id"`
|
||||
}
|
||||
@@ -12,6 +12,7 @@ type Purchase struct {
|
||||
SupplierId uint `gorm:"not null"`
|
||||
CreditTerm int `gorm:"column:credit_term;not null;default:0"`
|
||||
DueDate *time.Time
|
||||
GrandTotal float64 `gorm:"column:grand_total;type:numeric(15,3);not null;default:0"`
|
||||
Notes *string
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
|
||||
Reference in New Issue
Block a user