Fix HPP
This commit is contained in:
@@ -101,18 +101,23 @@ type ProductAnalyticsResponse struct {
|
||||
Data []ProductAnalyticsData `json:"data"`
|
||||
}
|
||||
|
||||
// ProductAnalyticsData represents individual product analytics data
|
||||
type ProductAnalyticsData 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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// ProductAnalyticsPerCategoryRequest represents the request for product analytics per category
|
||||
@@ -125,21 +130,23 @@ type ProductAnalyticsPerCategoryRequest struct {
|
||||
|
||||
// ProductAnalyticsPerCategoryResponse represents the response for product analytics per category
|
||||
type ProductAnalyticsPerCategoryResponse struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
OutletID *uuid.UUID `json:"outlet_id,omitempty"`
|
||||
DateFrom time.Time `json:"date_from"`
|
||||
DateTo time.Time `json:"date_to"`
|
||||
Data []ProductAnalyticsPerCategoryData `json:"data"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
OutletID *uuid.UUID `json:"outlet_id,omitempty"`
|
||||
DateFrom time.Time `json:"date_from"`
|
||||
DateTo time.Time `json:"date_to"`
|
||||
Data []ProductAnalyticsPerCategoryData `json:"data"`
|
||||
}
|
||||
|
||||
// ProductAnalyticsPerCategoryData represents individual category analytics data
|
||||
type ProductAnalyticsPerCategoryData 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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// DashboardAnalyticsRequest represents the request for dashboard analytics
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type StandardHPPRequest struct {
|
||||
OrganizationID uuid.UUID `form:"-"`
|
||||
ProductID *uuid.UUID `form:"product_id,omitempty"`
|
||||
CategoryID *uuid.UUID `form:"category_id,omitempty"`
|
||||
}
|
||||
|
||||
type StandardHPPResponse struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
Summary HPPSummary `json:"summary"`
|
||||
Products []StandardHPPProductData `json:"products"`
|
||||
Ingredients []StandardHPPIngredientData `json:"ingredients,omitempty"`
|
||||
}
|
||||
|
||||
type StandardHPPProductData 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"`
|
||||
SellingPrice float64 `json:"selling_price"`
|
||||
ProductCost float64 `json:"product_cost"`
|
||||
StandardCost float64 `json:"standard_cost"`
|
||||
StandardHPPPercentage float64 `json:"standard_hpp_percentage"`
|
||||
HasRecipe bool `json:"has_recipe"`
|
||||
}
|
||||
|
||||
type StandardHPPIngredientData struct {
|
||||
ProductID uuid.UUID `json:"product_id"`
|
||||
IngredientID uuid.UUID `json:"ingredient_id"`
|
||||
IngredientName string `json:"ingredient_name"`
|
||||
Quantity float64 `json:"quantity"`
|
||||
UnitName string `json:"unit_name"`
|
||||
CostPerUnit float64 `json:"cost_per_unit"`
|
||||
WastePercentage float64 `json:"waste_percentage"`
|
||||
TotalCost float64 `json:"total_cost"`
|
||||
}
|
||||
|
||||
type RealHPPRequest struct {
|
||||
OrganizationID uuid.UUID `form:"-"`
|
||||
OutletID *uuid.UUID `form:"outlet_id,omitempty"`
|
||||
ProductID *uuid.UUID `form:"product_id,omitempty"`
|
||||
CategoryID *uuid.UUID `form:"category_id,omitempty"`
|
||||
DateFrom string `form:"date_from" validate:"required"`
|
||||
DateTo string `form:"date_to" validate:"required"`
|
||||
GroupBy string `form:"group_by,default=day" validate:"omitempty,oneof=day hour week month"`
|
||||
}
|
||||
|
||||
type RealHPPResponse struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
OutletID *uuid.UUID `json:"outlet_id,omitempty"`
|
||||
DateFrom time.Time `json:"date_from"`
|
||||
DateTo time.Time `json:"date_to"`
|
||||
GroupBy string `json:"group_by"`
|
||||
Summary HPPSummary `json:"summary"`
|
||||
Products []RealHPPProductData `json:"products"`
|
||||
TimeSeries []RealHPPTimeSeriesData `json:"time_series,omitempty"`
|
||||
}
|
||||
|
||||
type RealHPPProductData 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"`
|
||||
SellingPrice float64 `json:"selling_price"`
|
||||
RealTotalCost float64 `json:"real_total_cost"`
|
||||
RealTotalRevenue float64 `json:"real_total_revenue"`
|
||||
RealHPPPercentage float64 `json:"real_hpp_percentage"`
|
||||
TotalQuantitySold int64 `json:"total_quantity_sold"`
|
||||
TotalOrders int64 `json:"total_orders"`
|
||||
}
|
||||
|
||||
type RealHPPTimeSeriesData struct {
|
||||
Date time.Time `json:"date"`
|
||||
RealTotalCost float64 `json:"real_total_cost"`
|
||||
RealTotalRevenue float64 `json:"real_total_revenue"`
|
||||
RealHPPPercentage float64 `json:"real_hpp_percentage"`
|
||||
TotalOrders int64 `json:"total_orders"`
|
||||
}
|
||||
|
||||
type HPPSummary struct {
|
||||
AverageStandardHPP float64 `json:"average_standard_hpp"`
|
||||
AverageRealHPP float64 `json:"average_real_hpp"`
|
||||
HPPVariance float64 `json:"hpp_variance"`
|
||||
TotalProducts int64 `json:"total_products"`
|
||||
}
|
||||
Reference in New Issue
Block a user