add total out

This commit is contained in:
Aditya Siregar
2025-08-14 01:35:19 +07:00
parent 07b3eda263
commit 13d8c75be7
7 changed files with 320 additions and 77 deletions
+35 -35
View File
@@ -63,23 +63,23 @@ func (i *Inventory) AdjustQuantity(delta int) int {
// Inventory Report Models
type InventoryReportSummary struct {
TotalProducts int `json:"total_products"`
TotalIngredients int `json:"total_ingredients"`
TotalValue float64 `json:"total_value"`
LowStockProducts int `json:"low_stock_products"`
LowStockIngredients int `json:"low_stock_ingredients"`
ZeroStockProducts int `json:"zero_stock_products"`
ZeroStockIngredients int `json:"zero_stock_ingredients"`
TotalSoldProducts float64 `json:"total_sold_products"`
TotalSoldIngredients float64 `json:"total_sold_ingredients"`
OutletID uuid.UUID `json:"outlet_id"`
OutletName string `json:"outlet_name"`
GeneratedAt time.Time `json:"generated_at"`
TotalProducts int `json:"total_products"`
TotalIngredients int `json:"total_ingredients"`
TotalValue float64 `json:"total_value"`
LowStockProducts int `json:"low_stock_products"`
LowStockIngredients int `json:"low_stock_ingredients"`
ZeroStockProducts int `json:"zero_stock_products"`
ZeroStockIngredients int `json:"zero_stock_ingredients"`
TotalSoldProducts float64 `json:"total_sold_products"`
TotalSoldIngredients float64 `json:"total_sold_ingredients"`
OutletID uuid.UUID `json:"outlet_id"`
OutletName string `json:"outlet_name"`
GeneratedAt time.Time `json:"generated_at"`
}
type InventoryReportDetail struct {
Summary *InventoryReportSummary `json:"summary"`
Products []*InventoryProductDetail `json:"products"`
Summary *InventoryReportSummary `json:"summary"`
Products []*InventoryProductDetail `json:"products"`
Ingredients []*InventoryIngredientDetail `json:"ingredients"`
}
@@ -88,31 +88,31 @@ type InventoryProductDetail struct {
ProductID uuid.UUID `json:"product_id"`
ProductName string `json:"product_name"`
CategoryName string `json:"category_name"`
Quantity int `json:"quantity"`
Quantity int `json:"quantity"`
ReorderLevel int `json:"reorder_level"`
UnitCost float64 `json:"unit_cost"`
TotalValue float64 `json:"total_value"`
TotalIn float64 `json:"total_in"`
TotalOut float64 `json:"total_out"`
IsLowStock bool `json:"is_low_stock"`
IsZeroStock bool `json:"is_zero_stock"`
UpdatedAt time.Time `json:"updated_at"`
UnitCost float64 `json:"unit_cost"`
TotalValue float64 `json:"total_value"`
TotalIn float64 `json:"total_in"`
TotalOut float64 `json:"total_out"`
IsLowStock bool `json:"is_low_stock"`
IsZeroStock bool `json:"is_zero_stock"`
UpdatedAt time.Time `json:"updated_at"`
}
type InventoryIngredientDetail struct {
ID uuid.UUID `json:"id"`
IngredientID uuid.UUID `json:"ingredient_id"`
IngredientName string `json:"ingredient_name"`
UnitName string `json:"unit_name"`
Quantity int `json:"quantity"`
ReorderLevel int `json:"reorder_level"`
UnitCost float64 `json:"unit_cost"`
TotalValue float64 `json:"total_value"`
TotalIn float64 `json:"total_in"`
TotalOut float64 `json:"total_out"`
IsLowStock bool `json:"is_low_stock"`
IsZeroStock bool `json:"is_zero_stock"`
UpdatedAt time.Time `json:"updated_at"`
ID uuid.UUID `json:"id"`
IngredientID uuid.UUID `json:"ingredient_id"`
IngredientName string `json:"ingredient_name"`
UnitName string `json:"unit_name"`
Quantity int `json:"quantity"`
ReorderLevel int `json:"reorder_level"`
UnitCost float64 `json:"unit_cost"`
TotalValue float64 `json:"total_value"`
TotalIn float64 `json:"total_in"`
TotalOut float64 `json:"total_out"`
IsLowStock bool `json:"is_low_stock"`
IsZeroStock bool `json:"is_zero_stock"`
UpdatedAt time.Time `json:"updated_at"`
}
type InventoryReportFilter struct {