167 lines
6.7 KiB
Go
167 lines
6.7 KiB
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// PaymentMethodAnalytics represents payment method analytics data
|
|
type PaymentMethodAnalytics struct {
|
|
PaymentMethodID uuid.UUID `json:"payment_method_id"`
|
|
PaymentMethodName string `json:"payment_method_name"`
|
|
PaymentMethodType string `json:"payment_method_type"`
|
|
TotalAmount float64 `json:"total_amount"`
|
|
OrderCount int64 `json:"order_count"`
|
|
PaymentCount int64 `json:"payment_count"`
|
|
}
|
|
|
|
// SalesAnalytics represents sales analytics data
|
|
type SalesAnalytics struct {
|
|
Date time.Time `json:"date"`
|
|
Sales float64 `json:"sales"`
|
|
Orders int64 `json:"orders"`
|
|
Items int64 `json:"items"`
|
|
Tax float64 `json:"tax"`
|
|
Discount float64 `json:"discount"`
|
|
NetSales float64 `json:"net_sales"`
|
|
}
|
|
|
|
// PurchasingAnalytics represents purchasing analytics data
|
|
type PurchasingAnalytics struct {
|
|
OutletName *string `json:"outlet_name,omitempty"`
|
|
Summary PurchasingSummary `json:"summary"`
|
|
Data []PurchasingAnalyticsData `json:"data"`
|
|
IngredientData []PurchasingIngredientData `json:"ingredient_data"`
|
|
VendorData []PurchasingVendorData `json:"vendor_data"`
|
|
}
|
|
|
|
type PurchasingSummary struct {
|
|
TotalPurchases float64 `json:"total_purchases"`
|
|
TotalPurchaseOrders int64 `json:"total_purchase_orders"`
|
|
TotalQuantity float64 `json:"total_quantity"`
|
|
AveragePurchaseOrderValue float64 `json:"average_purchase_order_value"`
|
|
TotalIngredients int64 `json:"total_ingredients"`
|
|
TotalVendors int64 `json:"total_vendors"`
|
|
}
|
|
|
|
type PurchasingAnalyticsData struct {
|
|
Date time.Time `json:"date"`
|
|
Purchases float64 `json:"purchases"`
|
|
PurchaseOrders int64 `json:"purchase_orders"`
|
|
Quantity float64 `json:"quantity"`
|
|
Ingredients int64 `json:"ingredients"`
|
|
Vendors int64 `json:"vendors"`
|
|
}
|
|
|
|
type PurchasingIngredientData struct {
|
|
IngredientID uuid.UUID `json:"ingredient_id"`
|
|
IngredientName string `json:"ingredient_name"`
|
|
Quantity float64 `json:"quantity"`
|
|
TotalCost float64 `json:"total_cost"`
|
|
AverageUnitCost float64 `json:"average_unit_cost"`
|
|
PurchaseOrderCount int64 `json:"purchase_order_count"`
|
|
}
|
|
|
|
type PurchasingVendorData struct {
|
|
VendorID uuid.UUID `json:"vendor_id"`
|
|
VendorName string `json:"vendor_name"`
|
|
TotalCost float64 `json:"total_cost"`
|
|
PurchaseOrderCount int64 `json:"purchase_order_count"`
|
|
IngredientCount int64 `json:"ingredient_count"`
|
|
Quantity float64 `json:"quantity"`
|
|
}
|
|
|
|
type ProductAnalytics struct {
|
|
ProductID uuid.UUID `json:"product_id"`
|
|
ProductName string `json:"product_name"`
|
|
ProductSku string `json:"product_sku"`
|
|
CategoryID uuid.UUID `json:"category_id"`
|
|
CategoryName string `json:"category_name"`
|
|
CategoryOrder int `json:"category_order"`
|
|
QuantitySold int64 `json:"quantity_sold"`
|
|
Revenue float64 `json:"revenue"`
|
|
AveragePrice float64 `json:"average_price"`
|
|
OrderCount int64 `json:"order_count"`
|
|
StandardHppPerUnit float64 `json:"standard_hpp_per_unit"`
|
|
StandardHppTotal float64 `json:"standard_hpp_total"`
|
|
FifoHppPerUnit float64 `json:"fifo_hpp_per_unit"`
|
|
FifoHppTotal float64 `json:"fifo_hpp_total"`
|
|
MovingAverageHppPerUnit float64 `json:"moving_average_hpp_per_unit"`
|
|
MovingAverageHppTotal float64 `json:"moving_average_hpp_total"`
|
|
}
|
|
|
|
type ProductAnalyticsPerCategory struct {
|
|
CategoryID uuid.UUID `json:"category_id"`
|
|
CategoryName string `json:"category_name"`
|
|
TotalRevenue float64 `json:"total_revenue"`
|
|
TotalQuantity int64 `json:"total_quantity"`
|
|
ProductCount int64 `json:"product_count"`
|
|
OrderCount int64 `json:"order_count"`
|
|
TotalStandardHpp float64 `json:"total_standard_hpp"`
|
|
TotalFifoHpp float64 `json:"total_fifo_hpp"`
|
|
TotalMovingAverageHpp float64 `json:"total_moving_average_hpp"`
|
|
}
|
|
|
|
// DashboardOverview represents dashboard overview data
|
|
type DashboardOverview struct {
|
|
TotalSales float64 `json:"total_sales"`
|
|
TotalOrders int64 `json:"total_orders"`
|
|
AverageOrderValue float64 `json:"average_order_value"`
|
|
TotalCustomers int64 `json:"total_customers"`
|
|
VoidedOrders int64 `json:"voided_orders"`
|
|
RefundedOrders int64 `json:"refunded_orders"`
|
|
}
|
|
|
|
// ProfitLossAnalytics represents profit and loss analytics data
|
|
type ProfitLossAnalytics struct {
|
|
Summary ProfitLossSummary `json:"summary"`
|
|
Data []ProfitLossData `json:"data"`
|
|
ProductData []ProductProfitData `json:"product_data"`
|
|
}
|
|
|
|
// ProfitLossSummary represents profit and loss summary data
|
|
type ProfitLossSummary struct {
|
|
TotalRevenue float64 `json:"total_revenue"`
|
|
TotalCost float64 `json:"total_cost"`
|
|
GrossProfit float64 `json:"gross_profit"`
|
|
GrossProfitMargin float64 `json:"gross_profit_margin"`
|
|
TotalTax float64 `json:"total_tax"`
|
|
TotalDiscount float64 `json:"total_discount"`
|
|
NetProfit float64 `json:"net_profit"`
|
|
NetProfitMargin float64 `json:"net_profit_margin"`
|
|
TotalOrders int64 `json:"total_orders"`
|
|
AverageProfit float64 `json:"average_profit"`
|
|
ProfitabilityRatio float64 `json:"profitability_ratio"`
|
|
}
|
|
|
|
// ProfitLossData represents profit and loss data by time period
|
|
type ProfitLossData struct {
|
|
Date time.Time `json:"date"`
|
|
Revenue float64 `json:"revenue"`
|
|
Cost float64 `json:"cost"`
|
|
GrossProfit float64 `json:"gross_profit"`
|
|
GrossProfitMargin float64 `json:"gross_profit_margin"`
|
|
Tax float64 `json:"tax"`
|
|
Discount float64 `json:"discount"`
|
|
NetProfit float64 `json:"net_profit"`
|
|
NetProfitMargin float64 `json:"net_profit_margin"`
|
|
Orders int64 `json:"orders"`
|
|
}
|
|
|
|
// ProductProfitData represents profit data for individual products
|
|
type ProductProfitData struct {
|
|
ProductID uuid.UUID `json:"product_id"`
|
|
ProductName string `json:"product_name"`
|
|
CategoryID uuid.UUID `json:"category_id"`
|
|
CategoryName string `json:"category_name"`
|
|
QuantitySold int64 `json:"quantity_sold"`
|
|
Revenue float64 `json:"revenue"`
|
|
Cost float64 `json:"cost"`
|
|
GrossProfit float64 `json:"gross_profit"`
|
|
GrossProfitMargin float64 `json:"gross_profit_margin"`
|
|
AveragePrice float64 `json:"average_price"`
|
|
AverageCost float64 `json:"average_cost"`
|
|
ProfitPerUnit float64 `json:"profit_per_unit"`
|
|
}
|