|
|
@@ -1148,7 +1148,7 @@ func (this *OilContractController) ImportExcel() {
|
|
|
if con.PerformAmount == "" {
|
|
|
con.PerformAmount = "0"
|
|
|
}
|
|
|
- con.IsYearMoney = con.PerformAmount
|
|
|
+ con.IsYearMoney = con.Amount
|
|
|
con.IsInternal = 0
|
|
|
//if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
// con.IsInternal = 1
|
|
|
@@ -1432,10 +1432,12 @@ func (this *OilContractController) AddEntity() {
|
|
|
var errinfo ErrorDataInfo
|
|
|
|
|
|
var model contract.OilContract
|
|
|
+ var model2 contract.OilContractMoney
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
svc := contract.GetOilContractService(utils.DBE)
|
|
|
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
+ json.Unmarshal(jsonBlob, &model2)
|
|
|
|
|
|
if model.IsYear == 1 && model.IsYearMoney == "" {
|
|
|
errinfo.Message = "跨年当年结算金额必填"
|
|
|
@@ -1477,10 +1479,10 @@ func (this *OilContractController) AddEntity() {
|
|
|
if err == nil {
|
|
|
if model.IsYear == 1 {
|
|
|
svc.GetEntityByWhere(OilContractName, "ContractNo = '"+model.ContractNo+"'", &model)
|
|
|
- svc.GetEntityByWhere("OilContractMoney", "Year = '"+time.Now().Format("2006")+"' and ContractId = "+strconv.Itoa(model.Id), &model1)
|
|
|
+ //svc.GetEntityByWhere("OilContractMoney", "Year = '"+time.Now().Format("2006")+"' and ContractId = "+strconv.Itoa(model.Id), &model1)
|
|
|
model1.ContractId = model.Id
|
|
|
model1.Money = model.IsYearMoney
|
|
|
- model1.Year = time.Now().Format("2006")
|
|
|
+ model1.Year = model2.Year
|
|
|
model1.CreateOn = time.Now()
|
|
|
model1.CreateBy = this.User.Realname
|
|
|
model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
@@ -1518,10 +1520,12 @@ func (this *OilContractController) UpdateEntity() {
|
|
|
|
|
|
var model contract.OilContract
|
|
|
var model1 contract.OilContractMoney
|
|
|
+ var model2 contract.OilContractMoney
|
|
|
svc := contract.GetOilContractService(utils.DBE)
|
|
|
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
+ json.Unmarshal(jsonBlob, &model2)
|
|
|
|
|
|
if model.IsYear == 1 && model.IsYearMoney == "" {
|
|
|
errinfo.Message = "跨年当年结算金额必填"
|
|
|
@@ -1687,7 +1691,7 @@ func (this *OilContractController) UpdateEntity() {
|
|
|
err := svc.UpdateEntityBytbl(OilContractName, id, &model, cols)
|
|
|
if err == nil {
|
|
|
if model.IsYear == 1 && model.IsYearMoney != "" {
|
|
|
- svc.GetEntityByWhere("OilContractMoney", "Year = '"+time.Now().Format("2006")+"' and ContractId = "+id, &model1)
|
|
|
+ svc.GetEntityByWhere("OilContractMoney", "Year = '"+model2.Year+"' and ContractId = "+id, &model1)
|
|
|
if model1.Id > 0 {
|
|
|
model1.Money = model.IsYearMoney
|
|
|
model1.ModifiedOn = time.Now()
|
|
|
@@ -1697,7 +1701,7 @@ func (this *OilContractController) UpdateEntity() {
|
|
|
} else {
|
|
|
model1.ContractId, _ = strconv.Atoi(id)
|
|
|
model1.Money = model.IsYearMoney
|
|
|
- model1.Year = time.Now().Format("2006")
|
|
|
+ model1.Year = model2.Year
|
|
|
model1.CreateOn = time.Now()
|
|
|
model1.CreateBy = this.User.Realname
|
|
|
model1.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|