Index: trunk/tools/examine_burntool_pcontrol.pl
===================================================================
--- trunk/tools/examine_burntool_pcontrol.pl	(revision 28886)
+++ trunk/tools/examine_burntool_pcontrol.pl	(revision 30638)
@@ -145,5 +145,5 @@
     # Get the data.  The limit is there to keep the database happy.  I don't think you can observe that many
     # images on a single night.
-    $sth = "SELECT exp_id,exp_name,obs_mode,dateobs,class_id,burntool_state,comment FROM rawImfile WHERE dateobs >= '${dmin}' AND dateobs <= '${dmax}' order by dateobs limit 600000";
+    $sth = "SELECT exp_id,rawImfile.exp_name,rawImfile.obs_mode,rawImfile.dateobs,class_id,burntool_state,rawImfile.comment,rawExp.state FROM rawImfile JOIN rawExp USING(exp_id) WHERE rawImfile.dateobs >= '${dmin}' AND rawImfile.dateobs <= '${dmax}' order by rawImfile.dateobs limit 600000";
 
     $data_ref = $db->selectall_arrayref( $sth );
@@ -168,5 +168,5 @@
     }
     print "#                                                     0       1       2       3       4       5       6       7       \n";
-    print "#exp_i exp_name       obs_mode dateobs             nB 0123456701234567012345670123456701234567012345670123456701234567 comment\n";
+    print "#exp_i exp_name       obs_mode dateobs             nB 0123456701234567012345670123456701234567012345670123456701234567 rawExp.state    comment\n";
     
     # If the database returns no entries (because we have a mistake in pcontrol.pro perhaps), return a null entry.
@@ -180,5 +180,5 @@
     
     foreach $row_ref (@{ $data_ref }) {
-	($exp_id,$exp_name, $obs_mode,$dateobs,$class_id,$burntool_state,$comment) = @{ $row_ref };
+	($exp_id,$exp_name, $obs_mode,$dateobs,$class_id,$burntool_state,$comment,$exp_state) = @{ $row_ref };
 
 	# Correct for nulls in the database.
@@ -202,6 +202,6 @@
 	    
 	    if ($cur_exp_id != -99) {
-		printf("%6d %11s %11s %19s %2d %64s %s\n",
-		       $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_comment);
+		printf("%6d %11s %11s %19s %2d %64s %15s %s\n",
+		       $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_exp_state,$cur_comment);
 
 		if (($burncount != 60)&&(exists($opt{A}))) {
@@ -228,12 +228,13 @@
 	    }
 	    ($cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$cur_comment) = ($exp_id,$exp_name,$obs_mode,$dateobs,$comment);
+	    $cur_exp_state = $exp_state;
 	    class_to_vector($class_id,$burntool_state);
 	}
     }
     # Final entry needs a manual print to clear it out. Let's tack on a footer as well.
-    printf("%6d %11s %11s %19s %2d %64s %s\n",
-	   $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_comment);
+    printf("%6d %11s %11s %19s %2d %64s %15s %s\n",
+	   $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_exp_state,$cur_comment);
     print "#                                                     0       1       2       3       4       5       6       7       \n";
-    print "#exp_i exp_name       obs_mode dateobs             nB 0123456701234567012345670123456701234567012345670123456701234567 comment\n";
+    print "#exp_i exp_name       obs_mode dateobs             nB 0123456701234567012345670123456701234567012345670123456701234567 rawExp.state    comment\n";
     print"\n";
 
