mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
feat[BE]:: add totalHppPricePerKg to marketing report summary
This commit is contained in:
@@ -33,10 +33,11 @@ type RepportMarketingItemDTO struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Summary struct {
|
type Summary struct {
|
||||||
TotalQty int `json:"total_qty"`
|
TotalQty int `json:"total_qty"`
|
||||||
TotalWeightKg float64 `json:"total_weight_kg"`
|
TotalWeightKg float64 `json:"total_weight_kg"`
|
||||||
TotalSalesAmount int64 `json:"total_sales_amount"`
|
TotalSalesAmount int64 `json:"total_sales_amount"`
|
||||||
TotalHppAmount int64 `json:"total_hpp_amount"`
|
TotalHppAmount int64 `json:"total_hpp_amount"`
|
||||||
|
TotalHppPricePerKg float64 `json:"total_hpp_price_per_kg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RepportMarketingResponseDTO struct {
|
type RepportMarketingResponseDTO struct {
|
||||||
@@ -130,11 +131,17 @@ func ToSummary(mdps []entity.MarketingDeliveryProduct, hppPricePerKg float64) *S
|
|||||||
totalHppAmount += int64(calculatedTotalWeight * hppPricePerKg)
|
totalHppAmount += int64(calculatedTotalWeight * hppPricePerKg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalHppPricePerKg := float64(0)
|
||||||
|
if totalWeightKg > 0 {
|
||||||
|
totalHppPricePerKg = float64(totalHppAmount) / totalWeightKg
|
||||||
|
}
|
||||||
|
|
||||||
return &Summary{
|
return &Summary{
|
||||||
TotalQty: totalQty,
|
TotalQty: totalQty,
|
||||||
TotalWeightKg: totalWeightKg,
|
TotalWeightKg: totalWeightKg,
|
||||||
TotalSalesAmount: totalSalesAmount,
|
TotalSalesAmount: totalSalesAmount,
|
||||||
TotalHppAmount: totalHppAmount,
|
TotalHppAmount: totalHppAmount,
|
||||||
|
TotalHppPricePerKg: totalHppPricePerKg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user