| | |
| | | SourceType constvar.CollectionSourceType `gorm:"column:source_type;type:tinyint;not null;default 0;comment:源单类型(1销售明细2服务合同3销售发票)" json:"sourceType"` // 源单类型(1销售明细2服务合同3销售发票) |
| | | SourceId int `gorm:"column:source_id;type:int;not null;default 0;comment:源单id" json:"sourceId"` // 源单id |
| | | PrincipalId int `gorm:"column:principal_id;type:int;not null;default 0;comment:收款负责人ID" json:"principalId"` // 收款负责人ID |
| | | Principal User `gorm:"foreignKey:PrincipalId" json:"principal"` // 收款负责人ID |
| | | Term int `gorm:"column:term;type:tinyint;not null;default 0;comment:期次" json:"term"` // 期次 |
| | | Percent decimal.Decimal `gorm:"column:percent;type:decimal(5,2);not null;default 0.00;comment:收款比例" gorm:"" json:"percent"` // 比例 |
| | | Amount decimal.Decimal `gorm:"column:amount;type:decimal(12,2);not null;default '0.00';comment:金额" gorm:"" json:"amount"` // 金额 |
| | |
| | | db = db.Where("source_id = ?", slf.SourceId) |
| | | } |
| | | |
| | | if slf.SourceType != 0 { |
| | | db = db.Where("source_type = ?", slf.SourceType) |
| | | } |
| | | |
| | | db = db.Preload("Client").Preload("Principal") |
| | | return db |
| | | } |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) SetSourceType(sourceType constvar.CollectionSourceType) *ServiceCollectionPlanSearch { |
| | | slf.SourceType = sourceType |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceCollectionPlanSearch) First() (*ServiceCollectionPlan, error) { |
| | | var db = slf.build() |
| | | var record = new(ServiceCollectionPlan) |