Index: trunk/www/db_po/view_po.php
===================================================================
--- trunk/www/db_po/view_po.php	(revision 11504)
+++ trunk/www/db_po/view_po.php	(revision 11504)
@@ -0,0 +1,124 @@
+<?php
+{
+    ini_set("display_errors", "On");
+    ini_set("mysql.trace_mode", "On");
+
+    echo (file_get_contents("index-header.html"));
+
+    //call get_progs() at startup
+    printf("<script type=\"text/javascript\" >\n");
+    printf("window.onload = function () { get_progs(\"all\",1,'view'); get_keys(\"all\",\"all\",1,'view'); }\n");
+    printf("</script>\n");
+
+    include("db.php");
+    printf("This page is to <u>view</u> the DB <b>%s</b>.\n", $db);
+    printf("For edit, please go <a href='edit_po.php'>here</a>.<br><br>\n");
+
+    $db_id = mysql_pconnect($host, $user, $pw);
+    if ($db_id==FALSE)
+    {
+        printf("mysql_connect returned the following error: %s\n", mysql_error());
+        die("");
+    }
+    mysql_select_db($db);
+
+    printf("<table><tbody>\n");
+
+    printf("<tr>\n");
+    printf("<td valign='top' id='progfield'></td>\n");
+    printf("<td valign='top' id='keyfield'></td>\n");
+    printf("</tr>\n");
+
+    printf("<tr><td colspan='2'>\n");
+    //printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");alert(\"wait\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
+    printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
+    printf("<button onClick='reset_dates(\"year\", \"empty\", \"empty\", 2);reset_dates(\"year\", \"empty\", \"empty\", 3)' id='resetdates' style='display:inline'>Reset Dates</button></div>\n");
+    printf("</td></tr>\n");
+
+    printf("<tr>\n");
+    for ($i=2; $i<4; $i++)
+    {
+        printf("<td>\n");
+        printf("<input name='dateformat%d' type='radio' onclick='ShowDatePulldown(%d)' value='pulldown' checked>pulldown \n", $i, $i);
+        printf("<input name='dateformat%d' type='radio' onclick='ShowDateInput(%d)' value='textinput'>text input \n", $i, $i);
+        printf("</td>\n");
+    }
+    printf("</tr>\n");
+
+    $query0="SELECT DATE_FORMAT(fValidFrom, '%Y') AS valid FROM History WHERE NOT fValidFrom='0000-00-00 00:00:00' group by valid";
+    $result0=mysql_query($query0, $db_id);
+
+
+    //date fields
+    printf("<tr>\n");
+    $rowcount=0;
+    for ($i=2; $i<4; $i++)
+    {
+        printf("<td>\n");
+        //input field
+        printf("<div id='dateinput%d' style='display:none'>Date (YYYY-MM-DD hh:mm:ss) \n", $i);
+        printf("<input id=\"statusdate%d\" type=\"text\" size=\"19\" maxlength=\"19\">\n", $i);
+        printf("<button onClick='get_timestamp(%s, \"next\");' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
+        printf("<button onClick='get_timestamp(%s, \"prev\");' id='nextimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
+        printf("</div>\n");
+        //pull down menus
+        printf("<div id='datepulldown%d' style='display:inline'>Date:\n", $i);
+        //select for years
+        printf("<div id='yearselect%d' style='display:inline'>\n", $i);
+        printf("<select id='year%d' onchange=\"get_dates('month', this.value, this.value, %d, 'yes')\">\n", $i, $i);
+        printf("<option value='empty'>year</option>\n");
+        while ($row0 = mysql_fetch_row($result0))
+        {
+            printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
+            $rowcount++;
+        }
+        printf("</select></div>\n");
+        //select for months
+        printf("<div id='monthselect%d' style='display:inline'>\n", $i);
+        printf("<select id='month%d' onchange=\"get_dates('day', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
+        printf("<option value='empty'>-</option>\n");
+        printf("</select></div>\n");
+        //select for days
+        printf("<div id='dayselect%d' style='display:inline'>\n", $i);
+        printf("<select id='day%d' onchange=\"get_dates('hour', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
+        printf("<option value='empty'>-</option>\n");
+        printf("</select></div>\n");
+        //select for hours
+        printf("<div id='hourselect%d' style='display:inline'>\n", $i);
+        printf("<select id='hour%d' onchange=\"get_dates('min', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
+        printf("<option value='empty'>-</option>\n");
+        printf("</select></div>\n");
+        //select for minutes
+        printf("<div id='minselect%d' style='display:inline'>\n", $i);
+        printf("<select id='min%d' onchange=\"get_dates('sec', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
+        printf("<option value='empty'>-</option>\n");
+        printf("</select></div>\n");
+        //select for seconds
+        printf("<div id='secselect%d' style='display:inline'><select id='sec%d'>\n", $i, $i);
+        printf("<option value='empty'>-</option>\n");
+        printf("</select></div>\n");
+        //buttton to show next timestamp
+        //printf("<button onClick='get_next_timestamp(%s);' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
+        printf("<button onClick='get_timestamp(%s, \"next\");' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
+        printf("<button onClick='get_timestamp(%s, \"prev\");' id='nextimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
+        printf("</td>\n");
+        if ($i==2 && $rowcount > 0)
+            mysql_data_seek($result0, 0);
+    }
+    printf("</tr>\n");
+    mysql_free_result($result0);
+
+    //list of POs
+    printf("<tr>\n");
+    printf("<td><div id='valuefield2'></div></td>\n");
+    printf("<td><div id='valuefield3'></div></td>\n");
+    printf("</tr>\n");
+
+    printf("</tbody>\n</table>\n");
+
+    echo (file_get_contents("index-footer.html"));
+
+    ini_set("display_errors", "Off");
+    ini_set("mysql.trace_mode", "Off");
+}
+?>
