|
@@ -112,11 +112,12 @@ func (d *ContractPaidDao) UpdatePaidTotalPrice(projectId int, bidsectionId int,
|
|
for _, item := range datalist {
|
|
for _, item := range datalist {
|
|
price, _ := strconv.ParseFloat(item.Price, 64)
|
|
price, _ := strconv.ParseFloat(item.Price, 64)
|
|
priceTotal = priceTotal + price
|
|
priceTotal = priceTotal + price
|
|
- contractDeduction, _ := strconv.ParseFloat(item.ContractDeduction, 64)
|
|
|
|
- contractDeductionTotal = contractDeductionTotal + contractDeduction
|
|
|
|
|
|
|
|
if item.ContractsId == contractsId {
|
|
if item.ContractsId == contractsId {
|
|
contractsPrice = contractsPrice + price
|
|
contractsPrice = contractsPrice + price
|
|
|
|
+
|
|
|
|
+ contractDeduction, _ := strconv.ParseFloat(item.ContractDeduction, 64)
|
|
|
|
+ contractDeductionTotal = contractDeductionTotal + contractDeduction
|
|
}
|
|
}
|
|
}
|
|
}
|
|
priceTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", priceTotal), 64)
|
|
priceTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", priceTotal), 64)
|
|
@@ -131,14 +132,15 @@ func (d *ContractPaidDao) UpdatePaidTotalPrice(projectId int, bidsectionId int,
|
|
}
|
|
}
|
|
|
|
|
|
// 2.更新合同表 合同下回款总金额
|
|
// 2.更新合同表 合同下回款总金额
|
|
- _, err = session.Exec("UPDATE cm_contracts SET `paid` = ? , contract_deduction_total= ?, status = ?,locking=0 where id = ? ", contractsPrice, contractDeductionTotal, contractStatus, contractsId)
|
|
|
|
|
|
+ _, err = session.Exec("UPDATE cm_contracts SET `paid` = ? , contract_deduction_total= ?, status = ?,locking=0 where id = ? ",
|
|
|
|
+ contractsPrice, contractDeductionTotal, contractStatus, contractsId)
|
|
if err != nil {
|
|
if err != nil {
|
|
session.Rollback()
|
|
session.Rollback()
|
|
return errors.New("金额更新失败")
|
|
return errors.New("金额更新失败")
|
|
}
|
|
}
|
|
// 3.更新项目节 合同下回款总金额
|
|
// 3.更新项目节 合同下回款总金额
|
|
- _, err = session.Exec("UPDATE cm_tree_contracts SET `contracts_paid` = ? , contract_status = ?,contract_locking=0 where project_id = ? and bidsection_id=? and contract_id=? ",
|
|
|
|
- contractsPrice, contractStatus, projectId, bidsectionId, contractsId)
|
|
|
|
|
|
+ _, err = session.Exec("UPDATE cm_tree_contracts SET `contracts_paid` = ?,contract_deduction_total = ? , contract_status = ?,contract_locking=0 where project_id = ? and bidsection_id=? and contract_id=? ",
|
|
|
|
+ contractsPrice, contractDeductionTotal, contractStatus, projectId, bidsectionId, contractsId)
|
|
if err != nil {
|
|
if err != nil {
|
|
session.Rollback()
|
|
session.Rollback()
|
|
return errors.New("金额更新失败")
|
|
return errors.New("金额更新失败")
|