Index: temp/trunk/html/admin/batch/daily.php
===================================================================
--- temp/trunk/html/admin/batch/daily.php	(revision 4987)
+++ temp/trunk/html/admin/batch/daily.php	(revision 4988)
@@ -230,6 +230,4 @@
 	$start_date = date("Y/m/d",strtotime("-10 year" ,strtotime($end_date)));
 	$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($end_date)));
-	$start_age = null;
-	$end_age = null;
 	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
 	for($i = 0; $i <= $age_loop; $i++) {
@@ -257,18 +255,21 @@
 	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
 
-	
 	$end_date = date("Y/m/d", time()); 
-	$start_date = date("Y/m/d",strtotime("-10 year"));
-	$start_age = null;
-	$end_age = null;
+	$start_date = date("Y/m/d",strtotime("-10 year" ,strtotime($end_date)));
+	$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($end_date)));
 	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
 	for($i = 0; $i <= $age_loop; $i++) {
 		$where = $base_where . " AND order_birth >= cast('$start_date' as date)";
-		if($i <= $age_loop) {
-			$where = $where . " AND order_birth <= cast('$end_date' as date)";
+		$start_age = $i * 10;
+		if($i < $age_loop) {
+			$end_age = $start_age+9;
+			$where = $where . " AND order_birth < cast('$end_date' as date)";
+		}else{
+			$where = $base_where . " AND order_birth < cast('$end_date' as date)";
+			$end_age = 999;
 		}
 		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 1);
 		$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($start_date)));
-		$start_date = date("Y/m/d",strtotime("-10 year",strtotime($end_date)));
+		$start_date = date("Y/m/d",strtotime("-10 year",strtotime($start_date)));
 	}
 
