Implementasi HPP std dan real
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type StandardHPPRequest struct {
|
||||
OrganizationID uuid.UUID `validate:"required"`
|
||||
ProductID *uuid.UUID `validate:"omitempty"`
|
||||
CategoryID *uuid.UUID `validate:"omitempty"`
|
||||
}
|
||||
|
||||
type StandardHPPResponse struct {
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
Summary HPPSummary `json:"summary"`
|
||||
Products []StandardHPPProduct `json:"products"`
|
||||
Ingredients []StandardHPPIngredient `json:"ingredients,omitempty"`
|
||||
}
|
||||
|
||||
type StandardHPPProduct 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 StandardHPPIngredient 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 `validate:"required"`
|
||||
OutletID *uuid.UUID `validate:"omitempty"`
|
||||
ProductID *uuid.UUID `validate:"omitempty"`
|
||||
CategoryID *uuid.UUID `validate:"omitempty"`
|
||||
DateFrom time.Time `validate:"required"`
|
||||
DateTo time.Time `validate:"required"`
|
||||
GroupBy string `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 []RealHPPProduct `json:"products"`
|
||||
TimeSeries []RealHPPTimeSeries `json:"time_series,omitempty"`
|
||||
}
|
||||
|
||||
type RealHPPProduct 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 RealHPPTimeSeries 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