enhance(model):增加总表电度电费的字段。
This commit is contained in:
parent
922659de94
commit
36854c8be6
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user