Index: temp/trunk/html/admin/batch/daily.php
===================================================================
--- temp/trunk/html/admin/batch/daily.php	(revision 4832)
+++ temp/trunk/html/admin/batch/daily.php	(revision 4833)
@@ -226,15 +226,42 @@
 	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id <> 0 AND del_flg = 0 ";
 	//$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
-	$where = $base_where . " AND order_birth BETWEEN ? AND ? ";
-	
-	sfprintr(	date("Y/m/d",strtotime(time())));
-	
+	//$where = $base_where . " AND order_birth BETWEEN ? AND ? ";
 	
 	$end_date = date("Y/m/d",strtotime("-10 year"));
 	$start_date = date("Y/m/d",strtotime("1 day" ,strtotime($end_date)));
 	
-	
 	$end_date = date("Y/m/d H:i:s", time()); 
 	$start_date = date("Y/m/d",strtotime("-10 year"));
+	
+	sfprintr($start_date);
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$where = $base_where . " AND order_birth >= $start_date";
+		if($i <= $age_loop) {
+			$where = $where . " AND order_birth <= $end_date";
+		}
+		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)));
+	}
+/*
+	for($i = 0; $i <= $age_loop; $i++) {
+		$start_age = $i * 10;
+		$end_age = $start_age + 9;
+		if($i >= $age_loop) {
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 1);
+	}
+*/
+
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$where = $base_where . " AND order_birth IS NULL ";
+	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 1);
+
+	/* Èó²ñ°÷½¸·× */
+	
+	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id = 0 AND del_flg = 0";
+	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
 	
 	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
@@ -245,23 +272,4 @@
 			$end_age = 999;
 		}
-		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 1);
-	}
-
-	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
-	$where = $base_where . " AND order_birth IS NULL ";
-	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 1);
-
-	/* Èó²ñ°÷½¸·× */
-	
-	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id = 0 AND del_flg = 0";
-	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
-	
-	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
-	for($i = 0; $i <= $age_loop; $i++) {
-		$start_age = $i * 10;
-		$end_age = $start_age + 9;
-		if($i >= $age_loop) {
-			$end_age = 999;
-		}
 		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 0);
 	}
