| | |
| | | Addressee string `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"` |
| | | Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:条件"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:text;comment:备注"` |
| | | Products []Product `json:"products" gorm:"many2many:sales_details_product;"` |
| | | Products []*Product `json:"products" gorm:"many2many:sales_details_product;"` |
| | | LogisticCompany string `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"` |
| | | LogisticNumber string `json:"logisticNumber" gorm:"column:logistic_number;type:varchar(255);comment:物流单号"` |
| | | LogisticCost float64 `json:"logisticCost" gorm:"column:logistic_cost;type:decimal(10,2);comment:物流费用"` |
| | | AmountReceivable decimal.Decimal `gorm:"amount_receivable" json:"amountReceivable"` // 应收金额 |
| | | AmountReceived decimal.Decimal `gorm:"amount_received" json:"amountReceived"` // 已收金额 |
| | | AmountInvoiced decimal.Decimal `gorm:"amount_invoiced" json:"amountInvoiced"` // 已开票金额 |
| | | AmountUnInvoiced decimal.Decimal `gorm:"-" json:"amountUnInvoiced"` // 未开票金额 |
| | | AmountReceivable decimal.Decimal `gorm:"column:amount_receivable;type:decimal(12,2);comment:应收金额" json:"amountReceivable"` // 应收金额 |
| | | AmountReceived decimal.Decimal `gorm:"column:amount_received;type:decimal(12,2);comment:已收金额" json:"amountReceived"` // 已收金额 |
| | | AmountInvoiced decimal.Decimal `gorm:"column:amount_invoiced;type:decimal(12,2);comment:已开票金额" json:"amountInvoiced"` // 已开票金额 |
| | | AmountUnInvoiced decimal.Decimal `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:未开票金额" json:"amountUnInvoiced"` // 未开票金额 |
| | | gorm.Model `json:"-"` |
| | | } |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) Find() (*SalesDetails, error) { |
| | | func (slf *SalesDetailsSearch) First() (*SalesDetails, error) { |
| | | var db = slf.build() |
| | | var record = new(SalesDetails) |
| | | err := db.First(record).Error |
| | |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsSearch) UpdateByMap(upMap map[string]interface{}) error { |
| | | var ( |
| | | db = slf.build() |
| | | ) |
| | | |
| | | if err := db.Updates(upMap).Error; err != nil { |
| | | return fmt.Errorf("update by map err: %v, upMap: %+v", err, upMap) |
| | | } |
| | | |
| | | return nil |
| | | } |