mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
FIX[BE]: Fix wrong calculation avg sales on report penjualan harian
This commit is contained in:
@@ -190,16 +190,13 @@ func ToSummaryFromDTOItems(items []RepportMarketingItemDTO) *Summary {
|
||||
totalWeightKg += item.TotalWeightKg
|
||||
totalSalesAmount += int64(item.SalesAmount)
|
||||
totalHppAmount += int64(item.HppAmount)
|
||||
avgSalesPrice += item.SalesPricePerKg
|
||||
}
|
||||
|
||||
totalHppPricePerKg := float64(0)
|
||||
|
||||
if totalWeightKg > 0 {
|
||||
totalHppPricePerKg = float64(totalHppAmount) / totalWeightKg
|
||||
}
|
||||
|
||||
if len(items) > 0 {
|
||||
avgSalesPrice = avgSalesPrice / float64(len(items))
|
||||
avgSalesPrice = float64(totalSalesAmount) / totalWeightKg
|
||||
}
|
||||
|
||||
if totalQty > 0 {
|
||||
|
||||
Reference in New Issue
Block a user