Implementasi HPP std dan real
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
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