Browse Source

[fixes] pregdueday should have been added to temp and not subtracted from it ... result was an error of up to two month in due date calculation

julzor 5 years ago
parent
commit
9aed8b75aa
1 changed files with 28 additions and 36 deletions
  1. 28 36
      locations/din_bad.qsrc

+ 28 - 36
locations/din_bad.qsrc

@@ -695,56 +695,48 @@ $d_cycreport_upduedate = {
 	pregdueday = day
 	pregduemonth = month
 	pregdueyear = year
+	
+	temp += pregdueday
+	pregdueday = 0
+	
 	:pregduedateloop
-	if pregduemonth = 1 and temp > 31 - pregdueday:
+	if pregduemonth = 1 and temp > 31:
 		pregduemonth += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 2 and temp > 28 - pregdueday:
+		temp -= 31
+	elseif pregduemonth = 2 and temp > 28:
 		pregduemonth += 1
-		temp -= 28 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 3 and temp > 31 - pregdueday:
+		temp -= 28
+	elseif pregduemonth = 3 and temp > 31:
 		pregduemonth += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 4 and temp > 30 - pregdueday:
+		temp -= 31
+	elseif pregduemonth = 4 and temp > 30:
 		pregduemonth += 1
-		temp -= 30 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 5 and temp > 31 - pregdueday:
+		temp -= 30
+	elseif pregduemonth = 5 and temp > 31:
 		pregduemonth += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 6 and temp > 30 - pregdueday:
+		temp -= 31
+	elseif pregduemonth = 6 and temp > 30:
 		pregduemonth += 1
-		temp -= 30 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 7 and temp > 31 - pregdueday:
+		temp -= 30
+	elseif pregduemonth = 7 and temp > 31:
 		pregduemonth += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 8 and temp > 31 - pregdueday:
+		temp -= 31
+	elseif pregduemonth = 8 and temp > 31:
 		pregduemonth += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 9 and temp > 30 - pregdueday:
+		temp -= 31
+	elseif pregduemonth = 9 and temp > 30:
 		pregduemonth += 1
-		temp -= 30 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 10 and temp > 31 - pregdueday:
+		temp -= 30
+	elseif pregduemonth = 10 and temp > 31:
 		pregduemonth += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 11 and temp > 30 - pregdueday:
+		temp -= 31
+	elseif pregduemonth = 11 and temp > 30:
 		pregduemonth += 1
-		temp -= 30 - pregdueday
-		pregdueday = 0
-	elseif pregduemonth = 12 and temp > 31 - pregdueday:
+		temp -= 30
+	elseif pregduemonth = 12 and temp > 31:
 		pregduemonth = 1
 		pregdueyear += 1
-		temp -= 31 - pregdueday
-		pregdueday = 0
+		temp -= 31
 	else
 		pregdueday = temp
 		temp = 0