mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 05:21:57 +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 {
|
||||
TotalQty int `json:"total_qty"`
|
||||
TotalWeightKg float64 `json:"total_weight_kg"`
|
||||
TotalSalesAmount int64 `json:"total_sales_amount"`
|
||||
TotalHppAmount int64 `json:"total_hpp_amount"`
|
||||
TotalQty int `json:"total_qty"`
|
||||
TotalWeightKg float64 `json:"total_weight_kg"`
|
||||
TotalSalesAmount int64 `json:"total_sales_amount"`
|
||||
TotalHppAmount int64 `json:"total_hpp_amount"`
|
||||
TotalHppPricePerKg float64 `json:"total_hpp_price_per_kg"`
|
||||
}
|
||||
|
||||
type RepportMarketingResponseDTO struct {
|
||||
@@ -130,11 +131,17 @@ func ToSummary(mdps []entity.MarketingDeliveryProduct, hppPricePerKg float64) *S
|
||||
totalHppAmount += int64(calculatedTotalWeight * hppPricePerKg)
|
||||
}
|
||||
|
||||
totalHppPricePerKg := float64(0)
|
||||
if totalWeightKg > 0 {
|
||||
totalHppPricePerKg = float64(totalHppAmount) / totalWeightKg
|
||||
}
|
||||
|
||||
return &Summary{
|
||||
TotalQty: totalQty,
|
||||
TotalWeightKg: totalWeightKg,
|
||||
TotalSalesAmount: totalSalesAmount,
|
||||
TotalHppAmount: totalHppAmount,
|
||||
TotalQty: totalQty,
|
||||
TotalWeightKg: totalWeightKg,
|
||||
TotalSalesAmount: totalSalesAmount,
|
||||
TotalHppAmount: totalHppAmount,
|
||||
TotalHppPricePerKg: totalHppPricePerKg,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user