| | |
| | | |
| | | return record, nil |
| | | } |
| | | |
| | | func (slf *ServiceContractSearch) AmountReceivableAdd(tx *gorm.DB, id int, amount decimal.Decimal) error { |
| | | slf.Orm = tx |
| | | record, err := slf.SetId(id).First() |
| | | if err != nil { |
| | | return err |
| | | } |
| | | amount = record.AmountReceivable.Add(amount) |
| | | return slf.UpdateByMap(map[string]interface{}{"amount_receivable": amount}) |
| | | } |
| | | func (slf *ServiceContractSearch) AmountReceivedAdd(tx *gorm.DB, id int, amount decimal.Decimal) error { |
| | | slf.Orm = tx |
| | | record, err := slf.SetId(id).First() |
| | | if err != nil { |
| | | return err |
| | | } |
| | | amount = record.AmountReceived.Add(amount) |
| | | return slf.UpdateByMap(map[string]interface{}{"amount_received": amount}) |
| | | } |
| | | func (slf *ServiceContractSearch) AmountInvoicedAdd(tx *gorm.DB, id int, amount decimal.Decimal) error { |
| | | slf.Orm = tx |
| | | record, err := slf.SetId(id).First() |
| | | if err != nil { |
| | | return err |
| | | } |
| | | amount = record.AmountInvoiced.Add(amount) |
| | | return slf.UpdateByMap(map[string]interface{}{"amount_invoiced": amount}) |
| | | } |
| | | func (slf *ServiceContractSearch) AmountNotInvoicedAdd(tx *gorm.DB, id int, amount decimal.Decimal) error { |
| | | slf.Orm = tx |
| | | record, err := slf.SetId(id).First() |
| | | if err != nil { |
| | | return err |
| | | } |
| | | amount = record.AmountUnInvoiced.Add(amount) |
| | | return slf.UpdateByMap(map[string]interface{}{"amount_not_invoiced": amount}) |
| | | } |