|
|
@ -60,7 +60,7 @@ func InsertContracttab(ctx iris.Context) { |
|
|
|
} |
|
|
|
//初始化合同
|
|
|
|
me := new(models.Contracttab) |
|
|
|
me.Cid = data.Cid |
|
|
|
me.Cid = user.Pid |
|
|
|
me.Contractid = data.Contractid |
|
|
|
me.Chargetype = data.Chargetype |
|
|
|
me.Chargeway = data.Contracttab.Chargeway |
|
|
@ -74,10 +74,11 @@ func InsertContracttab(ctx iris.Context) { |
|
|
|
me.Lengthdate = lengthdate |
|
|
|
me.Chargetime = data.Chargetime |
|
|
|
me.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
me.Createby = data.Contracttab.Createby |
|
|
|
if utils.ValueIsEmpty(me.Createby) { |
|
|
|
me.Createby = user.Name |
|
|
|
} |
|
|
|
if utils.ValueIsEmpty(me.Contractid) { |
|
|
|
if utils.ValueIsEmpty(strings.TrimSpace(me.Contractid)) { |
|
|
|
err = me.Add(data) |
|
|
|
} else { |
|
|
|
err = me.Update(data) |
|
|
@ -120,7 +121,7 @@ func InsertContracttab(ctx iris.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
me := new(models.Contracttab) |
|
|
|
me.Cid = data.Cid |
|
|
|
me.Cid = user.Pid |
|
|
|
me.Chargetype = data.Chargetype |
|
|
|
me.Chargeway = data.Contracttab.Chargeway |
|
|
|
me.Contractid = result.Contractid |
|
|
@ -131,15 +132,16 @@ func InsertContracttab(ctx iris.Context) { |
|
|
|
me.Begdate = data.Begindate |
|
|
|
begtime, _ := utils.TimeParseyyyyMMdd(data.Begindate) |
|
|
|
months := utils.ValueToInt(lengthdate,0) |
|
|
|
Begdate := begtime.AddDate(0, months, 0) |
|
|
|
me.Enddate = utils.TimeFormat(Begdate, "yyyy-MM-dd") |
|
|
|
enddate := begtime.AddDate(0, months, -1) |
|
|
|
me.Enddate = utils.TimeFormat(enddate, "yyyy-MM-dd") |
|
|
|
me.Lengthdate = fmt.Sprintf("%0.0f",lengthdate) + " 月 " |
|
|
|
me.Chargetime = data.Chargetime |
|
|
|
me.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
me.Createby = data.Contracttab.Createby |
|
|
|
if utils.ValueIsEmpty(me.Createby) { |
|
|
|
me.Createby = user.Name |
|
|
|
} |
|
|
|
if utils.ValueIsEmpty(me.Contractid) { |
|
|
|
if utils.ValueIsEmpty(strings.TrimSpace(me.Contractid)) { |
|
|
|
err = me.Add(data) |
|
|
|
} else { |
|
|
|
err = me.Update(data) |
|
|
@ -158,15 +160,15 @@ func InsertContracttab(ctx iris.Context) { |
|
|
|
lengthdate := data.Contracttab.Chargedexpense / data.Unitprice |
|
|
|
carport := new(models.Carporttab) |
|
|
|
carport.Cid = user.Pid |
|
|
|
carport.Cid = user.Pid |
|
|
|
carport.Carportid = data.Carportid |
|
|
|
_, err := carport.SelectOne() |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) |
|
|
|
return |
|
|
|
} |
|
|
|
glog.InfoExtln("Carporttab","carport: ",carport) |
|
|
|
me := new(models.Contracttab) |
|
|
|
me.Cid = data.Cid |
|
|
|
me.Cid = user.Pid |
|
|
|
me.Chargetype = data.Chargetype |
|
|
|
me.Chargeway = data.Contracttab.Chargeway |
|
|
|
me.Contractid = data.Contractid |
|
|
@ -177,17 +179,20 @@ func InsertContracttab(ctx iris.Context) { |
|
|
|
me.Begdate = data.Begindate |
|
|
|
begtime, _ := utils.TimeParseyyyyMMdd(data.Begindate) |
|
|
|
months := utils.ValueToInt(lengthdate,0) |
|
|
|
Begdate := begtime.AddDate(0, months, 0) |
|
|
|
me.Enddate = utils.TimeFormat(Begdate, "yyyy-MM-dd") |
|
|
|
enddate := begtime.AddDate(0, months, -1) |
|
|
|
me.Enddate = utils.TimeFormat(enddate, "yyyy-MM-dd") |
|
|
|
me.Lengthdate = fmt.Sprintf("%0.0f",lengthdate) + " 月 " |
|
|
|
me.Chargetime = data.Chargetime |
|
|
|
me.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
me.Createby = data.Contracttab.Createby |
|
|
|
if utils.ValueIsEmpty(me.Createby) { |
|
|
|
me.Createby = user.Name |
|
|
|
} |
|
|
|
if utils.ValueIsEmpty(me.Contractid) { |
|
|
|
if utils.ValueIsEmpty(strings.TrimSpace(me.Contractid)) { |
|
|
|
glog.InfoExtln("Carporttab","add: ","add") |
|
|
|
err = me.Add(data) |
|
|
|
} else { |
|
|
|
glog.InfoExtln("Carporttab","add: ","Update") |
|
|
|
err = me.Update(data) |
|
|
|
} |
|
|
|
|
|
|
|