mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat[BE]:: adjust marketing report API
This commit is contained in:
@@ -152,12 +152,22 @@ func (s *repportService) calculateHppPricePerKg(ctx context.Context, projectFloc
|
||||
return 0
|
||||
}
|
||||
|
||||
totalActualCost := float64(0)
|
||||
costBop := float64(0)
|
||||
|
||||
for _, realization := range realizations {
|
||||
cost := realization.Price * realization.Qty
|
||||
totalActualCost += cost
|
||||
category := ""
|
||||
if realization.ExpenseNonstock != nil && realization.ExpenseNonstock.Expense != nil {
|
||||
category = realization.ExpenseNonstock.Expense.Category
|
||||
}
|
||||
|
||||
if category == "BOP" {
|
||||
costBop += cost
|
||||
}
|
||||
}
|
||||
|
||||
totalActualCost := costBop
|
||||
|
||||
if totalActualCost == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user