...
|
...
|
@@ -51,13 +51,8 @@ func AllBonusStatics(orders []*domain.Order, action int) (bonus protocol.Bonus) |
|
|
bonus = protocol.Bonus{}
|
|
|
for i := range orders {
|
|
|
o := orders[i]
|
|
|
//if action == protocol.BonusTotal {
|
|
|
bonus.Received += o.OrderBonusReceive()
|
|
|
bonus.Outstanding += o.OrderBonusWait()
|
|
|
//}
|
|
|
//if action == protocol.BonusOutstanding {
|
|
|
// bonus.Outstanding += o.OrderBonusOutstanding()
|
|
|
//}
|
|
|
bonus.Received = utils.Decimal(bonus.Received + o.OrderBonusReceive())
|
|
|
bonus.Outstanding = utils.Decimal(bonus.Outstanding + o.OrderBonusWait())
|
|
|
}
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -67,17 +62,10 @@ func QuartersBonusStatics(orders []*domain.Order, action int) (bonus []protocol. |
|
|
bonus = make([]protocol.Bonus, 4)
|
|
|
for i := range orders {
|
|
|
o := orders[i]
|
|
|
quarter := o.CreateAt.Month() / 3
|
|
|
bonus[quarter].Received += o.OrderBonusReceive()
|
|
|
bonus[quarter].Outstanding += o.OrderBonusWait()
|
|
|
bonus[quarter].Expend += o.OrderBonusOutstanding()
|
|
|
//if action == protocol.BonusTotal {
|
|
|
//bonus[quarter].Received += o.OrderBonusReceive()
|
|
|
//bonus[quarter].Outstanding += o.OrderBonusWait()
|
|
|
//}
|
|
|
//if action == protocol.BonusOutstanding {
|
|
|
//bonus[quarter].Expend += o.OrderBonusOutstanding()
|
|
|
//}
|
|
|
quarter := (o.CreateAt.Month() - 1) / 3
|
|
|
bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive())
|
|
|
bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait())
|
|
|
bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding())
|
|
|
}
|
|
|
return
|
|
|
}
|
...
|
...
|
|