|
@@ -60,7 +60,7 @@ type ContractService interface {
|
|
|
Delete(projectId int, bidsectionId int, treeId int, id int) error
|
|
|
Close(projectId int, bidsectionId int, treeId int, id int) error
|
|
|
Unlock(projectId int, bidsectionId int, treeId int, id int) error
|
|
|
- GetIncomeSurvey(bidsectionId int, projectId int) map[string]interface{}
|
|
|
+ GetSurvey(bidsectionId int, projectId int, contractsType int) map[string]interface{}
|
|
|
|
|
|
ReturnCreate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, projectAccountId int) error
|
|
|
ReturnUpdate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, id int) error
|
|
@@ -516,20 +516,44 @@ func (s *contractService) Unlock(projectId int, bidsectionId int, treeId int, id
|
|
|
}
|
|
|
|
|
|
//获得合同收入概况
|
|
|
-func (s *contractService) GetIncomeSurvey(bidsectionId int, projectId int) map[string]interface{} {
|
|
|
+func (s *contractService) GetSurvey(bidsectionId int, projectId int, contractsType int) map[string]interface{} {
|
|
|
// 1.获得收入合同
|
|
|
- incomeList := s.contractDao.GetType(bidsectionId, projectId, 1)
|
|
|
+ year := time.Now().Year()
|
|
|
+ incomeList := s.contractDao.GetTypeYear(bidsectionId, projectId, contractsType, year)
|
|
|
+ // 2.初始化
|
|
|
totalContractPrice := 0.00
|
|
|
- totalReturnPrice := 0.00
|
|
|
+ totalTypePrice := 0.00
|
|
|
performNumber := 0
|
|
|
closeNumber := 0
|
|
|
uncloseNumber := 0
|
|
|
+ // 3.当年数据初始化
|
|
|
+ returnDate := map[string]float64{
|
|
|
+ fmt.Sprintf("%d-01", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-02", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-03", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-04", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-05", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-06", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-07", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-08", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-09", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-10", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-11", year): 0.00,
|
|
|
+ fmt.Sprintf("%d-12", year): 0.00,
|
|
|
+ }
|
|
|
|
|
|
for _, item := range incomeList {
|
|
|
contractPrice, _ := strconv.ParseFloat(item.Price, 64)
|
|
|
totalContractPrice = totalContractPrice + contractPrice
|
|
|
- returnPrice, _ := strconv.ParseFloat(item.Returned, 64)
|
|
|
- totalReturnPrice = totalReturnPrice + returnPrice
|
|
|
+ typePrice := 0.00
|
|
|
+ if contractsType == 1 {
|
|
|
+ typePrice, _ = strconv.ParseFloat(item.Returned, 64)
|
|
|
+ totalTypePrice = totalTypePrice + typePrice
|
|
|
+ } else {
|
|
|
+ typePrice, _ = strconv.ParseFloat(item.Paid, 64)
|
|
|
+ totalTypePrice = totalTypePrice + typePrice
|
|
|
+ }
|
|
|
+
|
|
|
if item.Status == 0 {
|
|
|
performNumber = performNumber + 1
|
|
|
} else if item.Status == 1 {
|
|
@@ -537,13 +561,27 @@ func (s *contractService) GetIncomeSurvey(bidsectionId int, projectId int) map[s
|
|
|
} else if item.Status == 2 {
|
|
|
closeNumber = closeNumber + 1
|
|
|
}
|
|
|
+ returnDate[item.SignerTime.Format(conf.SysTimeformMonth)] = returnDate[item.SignerTime.Format(conf.SysTimeformMonth)] + typePrice
|
|
|
}
|
|
|
totalContractPrice, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", totalContractPrice), 64)
|
|
|
- fmt.Println(totalContractPrice)
|
|
|
- // surveryData := make(map[string]interface{},0)
|
|
|
+ totalTypePrice, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", totalTypePrice), 64)
|
|
|
+
|
|
|
ac := accounting.Accounting{Symbol: "", Precision: 2}
|
|
|
+
|
|
|
surveryData := map[string]interface{}{
|
|
|
- "totalContractPrice": ac.FormatMoney(totalContractPrice),
|
|
|
+ "totalContractPrice": totalContractPrice,
|
|
|
+ "totalContractPriceShow": ac.FormatMoney(totalContractPrice),
|
|
|
+ // "totalReturnPrice": ac.FormatMoney(totalReturnPrice),
|
|
|
+ "performNumber": performNumber,
|
|
|
+ "closeNumber": closeNumber,
|
|
|
+ "uncloseNumber": uncloseNumber,
|
|
|
+ "returnDate": returnDate,
|
|
|
+ }
|
|
|
+
|
|
|
+ if contractsType == 1 {
|
|
|
+ surveryData["totalReturnPriceShow"] = ac.FormatMoney(totalTypePrice)
|
|
|
+ } else {
|
|
|
+ surveryData["totalPaidPriceShow"] = ac.FormatMoney(totalTypePrice)
|
|
|
}
|
|
|
|
|
|
return surveryData
|