Ver Fonte

Merge branch 'service_types' into debug

zwxi há 1 ano atrás
pai
commit
9612683545
1 ficheiros alterados com 6 adições e 2 exclusões
  1. 6 2
      controller/census/invoice_payment.go

+ 6 - 2
controller/census/invoice_payment.go

@@ -918,6 +918,10 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 		if req.StartDate != "" && req.EndDate != "" {
 			startDate = reqStartDate.AddDate(0, i, 0).Format("2006-01")
 			prevStartDate = reqStartDate.AddDate(-1, i, 0).Format("2006-01")
+			if reqEndDate.After(latestTime) {
+				endDateTime = latestTime.AddDate(0, i-numMonth+1, -1)
+				prevEndDateTime = latestTime.AddDate(-1, i-numMonth+1, -1)
+			}
 		} else {
 			startDate = latestTime.AddDate(0, i-numMonth, 0).Format("2006-01")
 			prevStartDate = latestTime.AddDate(-1, i-numMonth, 0).Format("2006-01")
@@ -932,8 +936,8 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 			endDateTime = reqStartDate.AddDate(0, i+1, -1)
 			prevEndDateTime = reqStartDate.AddDate(-1, i+1, -1)
 			if reqEndDate.After(latestTime) {
-				endDateTime = latestTime.AddDate(0, i-numMonth+1, -1)
-				prevEndDateTime = latestTime.AddDate(-1, i-numMonth+1, -1)
+				endDateTime = latestTime.AddDate(0, i+1, -1)
+				prevEndDateTime = latestTime.AddDate(-1, i+1, -1)
 			}
 		} else {
 			endDateTime = latestTime.AddDate(0, i-numMonth+1, -1)