From f84d9c46574a2cd663105859035bc17891270923 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期一, 14 八月 2023 10:41:54 +0800
Subject: [PATCH] Merge branch 'master' into fly
---
model/serviceContract.go | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/model/serviceContract.go b/model/serviceContract.go
index 5eff55e..05eed61 100644
--- a/model/serviceContract.go
+++ b/model/serviceContract.go
@@ -39,6 +39,7 @@
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"` // 鏈紑绁ㄩ噾棰�
+ AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"` // 浠风◣鍚堣
Products []*Product `json:"products" gorm:"many2many:service_contract_product;"`
gorm.Model `json:"-"`
}
@@ -216,3 +217,40 @@
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})
+}
--
Gitblit v1.8.0