diff --git a/model/report_summary.go b/model/report_summary.go index 3a2e206..52ad108 100644 --- a/model/report_summary.go +++ b/model/report_summary.go @@ -10,6 +10,7 @@ type ReportSummary struct { ReportId string `xorm:"varchar(120) pk not null" json:"-"` Overall decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"overall"` OverallFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"overallFee"` + ConsumptionFee decimal.NullDecimal `xorm:"numeric(14,2)" json:"consumptionFee"` OverallPrice decimal.NullDecimal `xorm:"numeric(16,8)" json:"overallPrice"` Critical decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"critical"` CriticalFee decimal.Decimal `xorm:"numeric(14,2) not null default 0" json:"criticalFee"` @@ -74,7 +75,8 @@ func (s ReportSummary) Validate() (bool, error) { } func (s *ReportSummary) CalculatePrices() { - s.OverallPrice = decimal.NewNullDecimal(s.OverallFee.Div(s.Overall).RoundBank(8)) + s.ConsumptionFee = decimal.NewNullDecimal(s.OverallFee.Sub(s.BasicFee).Sub(s.AdjustFee)) + s.OverallPrice = decimal.NewNullDecimal(s.ConsumptionFee.Decimal.Div(s.Overall).RoundBank(8)) if s.Critical.GreaterThan(decimal.Zero) { s.CriticalPrice = decimal.NewNullDecimal(s.CriticalFee.Div(s.Critical).RoundBank(8)) } else {