| 1 | <script>
|
|---|
| 2 | 'use strict';
|
|---|
| 3 | var ctr;
|
|---|
| 4 | var testdata = "old data";
|
|---|
| 5 | var pastdata = false;
|
|---|
| 6 |
|
|---|
| 7 | function clearNode(node){
|
|---|
| 8 | var child = node.childNodes[0];
|
|---|
| 9 | while(child != null)
|
|---|
| 10 | {
|
|---|
| 11 | node.removeChild(child);
|
|---|
| 12 | child = node.childNodes[0];
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | function addRow(table){
|
|---|
| 17 | var targetView = table;
|
|---|
| 18 | var cctr=$('.dataTable tr').length;
|
|---|
| 19 | ctr=cctr+1;
|
|---|
| 20 | var input_data;
|
|---|
| 21 | var select;
|
|---|
| 22 | var option;
|
|---|
| 23 | var selection;
|
|---|
| 24 | // CREATE ELEMENT
|
|---|
| 25 | var newtr = document.createElement("tr");
|
|---|
| 26 | newtr.setAttribute("class","tr");
|
|---|
| 27 | var newtd_c1 = document.createElement("td");
|
|---|
| 28 | newtd_c1.setAttribute("width","147");
|
|---|
| 29 | newtd_c1.setAttribute("align","center");
|
|---|
| 30 | newtd_c1.appendChild(
|
|---|
| 31 | input_data = document.createElement("input"),
|
|---|
| 32 | input_data.setAttribute("type","time"),
|
|---|
| 33 | input_data.setAttribute("size","10"),
|
|---|
| 34 | input_data.setAttribute("autofocus","true"),
|
|---|
| 35 | input_data.setAttribute("hidden","true")
|
|---|
| 36 | );
|
|---|
| 37 | var newtd_c2 = document.createElement("td");
|
|---|
| 38 | newtd_c2.setAttribute("width","138");
|
|---|
| 39 | newtd_c2.setAttribute("align","center");
|
|---|
| 40 | newtd_c2.appendChild(
|
|---|
| 41 | select = document.createElement("select"),
|
|---|
| 42 | select.setAttribute("class","measure"),
|
|---|
| 43 | $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
|
|---|
| 44 | type:"post",
|
|---|
| 45 | url:"Transaction/measurement.php",
|
|---|
| 46 | success:function(data){
|
|---|
| 47 | var obj=$.parseJSON(data);
|
|---|
| 48 | $.each(obj,function(){
|
|---|
| 49 | select.appendChild(
|
|---|
| 50 | option = document.createElement("option"),
|
|---|
| 51 | option.setAttribute('value',this['fMeasurementKey']),
|
|---|
| 52 | option.appendChild(document.createTextNode(this['fMeasurement']))
|
|---|
| 53 | )
|
|---|
| 54 | })
|
|---|
| 55 | }
|
|---|
| 56 | }) // End of retrieving
|
|---|
| 57 | );
|
|---|
| 58 | newtd_c2.setAttribute("width","115");
|
|---|
| 59 | newtd_c2.setAttribute("align","center");
|
|---|
| 60 | newtd_c2.appendChild(
|
|---|
| 61 | input_data = document.createElement("input"),
|
|---|
| 62 | input_data.setAttribute("type","button"),
|
|---|
| 63 | input_data.setAttribute("value","+"),
|
|---|
| 64 | input_data.onclick = function(){ return addRow(newtr);
|
|---|
| 65 | ctr++;
|
|---|
| 66 | }
|
|---|
| 67 | );
|
|---|
| 68 | var newtd_c3 = document.createElement("td");
|
|---|
| 69 | newtd_c3.setAttribute("width","98");
|
|---|
| 70 | newtd_c3.setAttribute("align","center");
|
|---|
| 71 | newtd_c3.appendChild(
|
|---|
| 72 | selection = document.createElement("select"),
|
|---|
| 73 | selection.setAttribute("class","source"),
|
|---|
| 74 | $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
|
|---|
| 75 | type:"post",
|
|---|
| 76 | url:"Transaction/source.php",
|
|---|
| 77 | success:function(data)
|
|---|
| 78 | {
|
|---|
| 79 | var obj = $.parseJSON(data);
|
|---|
| 80 | $.each(obj,function(){
|
|---|
| 81 | selection.appendChild(
|
|---|
| 82 | option=document.createElement('option'),
|
|---|
| 83 | option.setAttribute('value',this['fSourceKEY']),
|
|---|
| 84 | option.appendChild(document.createTextNode(this['fSourceName']))
|
|---|
| 85 | )
|
|---|
| 86 | });
|
|---|
| 87 | }
|
|---|
| 88 | }) // End of retrieving
|
|---|
| 89 | );
|
|---|
| 90 | var newtd_c4 = document.createElement("td");
|
|---|
| 91 | newtd_c4.setAttribute("width","119");
|
|---|
| 92 | newtd_c4.setAttribute("align","center");
|
|---|
| 93 | newtd_c4.appendChild(
|
|---|
| 94 | input_data = document.createElement("input"),
|
|---|
| 95 | input_data.setAttribute("type","text"),
|
|---|
| 96 | input_data.setAttribute("class","selected"),
|
|---|
| 97 | input_data.setAttribute("size","12"),
|
|---|
| 98 | input_data.setAttribute("placeholder","Value")
|
|---|
| 99 | );
|
|---|
| 100 | var newtd_c5 = document.createElement("td");
|
|---|
| 101 | newtd_c5.setAttribute("width","115");
|
|---|
| 102 | newtd_c5.setAttribute("align","center");
|
|---|
| 103 | newtd_c5.appendChild(
|
|---|
| 104 | input_data = document.createElement("input"),
|
|---|
| 105 | input_data.setAttribute("type","button"),
|
|---|
| 106 | input_data.setAttribute("value","Delete"),
|
|---|
| 107 | input_data.onclick = function(){ return clearNode(newtr); }
|
|---|
| 108 | );
|
|---|
| 109 |
|
|---|
| 110 | newtr.appendChild(newtd_c2);
|
|---|
| 111 | newtr.appendChild(newtd_c3);
|
|---|
| 112 | newtr.appendChild(newtd_c4);
|
|---|
| 113 | newtr.appendChild(newtd_c5);
|
|---|
| 114 |
|
|---|
| 115 | $(targetView).after(newtr);
|
|---|
| 116 | }
|
|---|
| 117 | function deleteRow(tableID){
|
|---|
| 118 | try{
|
|---|
| 119 | var table = document.getElementById(tableID);
|
|---|
| 120 | var rowCount = table.rows.length;
|
|---|
| 121 |
|
|---|
| 122 | for(var i = 0; i < rowCount; i++){
|
|---|
| 123 | var row = table.rows[i];
|
|---|
| 124 | var chkbox = row.cells[0].childNodes[0];
|
|---|
| 125 | if(null != chkbox && true == chkbox.checked){
|
|---|
| 126 | if(rowCount <= 1){
|
|---|
| 127 | alert("Cannot delete all the rows.");
|
|---|
| 128 | break;
|
|---|
| 129 | }
|
|---|
| 130 | table.deleteRow(i);
|
|---|
| 131 | rowCount--;
|
|---|
| 132 | i--;
|
|---|
| 133 | }
|
|---|
| 134 | }
|
|---|
| 135 | }catch(e){
|
|---|
| 136 | alert(e);
|
|---|
| 137 | }
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | <?php
|
|---|
| 141 | $cnt=0;
|
|---|
| 142 | $pastdate = 'false';
|
|---|
| 143 | $day=0;
|
|---|
| 144 | if(isset($_GET['days']))
|
|---|
| 145 | {
|
|---|
| 146 | $day = $_GET['days'];
|
|---|
| 147 | ?> addRowClone(); <?php
|
|---|
| 148 | }
|
|---|
| 149 | else
|
|---|
| 150 | {
|
|---|
| 151 | $day =date("Y-m-d");
|
|---|
| 152 | }
|
|---|
| 153 | $prev_time = array();
|
|---|
| 154 | ?>
|
|---|
| 155 |
|
|---|
| 156 | function addRowCloneNew(nextrow){
|
|---|
| 157 | var targetView = document.getElementById("Data");
|
|---|
| 158 | // CREATE ELEMENT
|
|---|
| 159 | // COUNT LIST
|
|---|
| 160 | var list = $(".datalisting").length;
|
|---|
| 161 | var newlist = list+1;
|
|---|
| 162 | var cctr=$('.dataTable tr').length;
|
|---|
| 163 | ctr=cctr+1;
|
|---|
| 164 | var input_data;
|
|---|
| 165 | var select;
|
|---|
| 166 | var option;
|
|---|
| 167 | var selection;
|
|---|
| 168 | var newdiv = document.createElement("div");
|
|---|
| 169 | newdiv.setAttribute("id","list_"+newlist);
|
|---|
| 170 | newdiv.setAttribute("class","datalisting");
|
|---|
| 171 | newdiv.setAttribute("style","margin:5px 0;");
|
|---|
| 172 | var newtable = document.createElement("table");
|
|---|
| 173 | newtable.setAttribute("class","dataTable");
|
|---|
| 174 | newtable.setAttribute("width","100%");
|
|---|
| 175 | newtable.setAttribute("border","1");
|
|---|
| 176 | newtable.setAttribute("cellspacing","0");
|
|---|
| 177 | newtable.setAttribute("cellpadding","0");
|
|---|
| 178 | var newInnertable = document.createElement("table");
|
|---|
| 179 | newInnertable.setAttribute("class","dataTable");
|
|---|
| 180 | newInnertable.setAttribute("width","100%");
|
|---|
| 181 | newInnertable.setAttribute("border","1");
|
|---|
| 182 |
|
|---|
| 183 | newInnertable.setAttribute("cellspacing","0");
|
|---|
| 184 | newInnertable.setAttribute("cellpadding","0");
|
|---|
| 185 |
|
|---|
| 186 | var newtr = document.createElement("tr");
|
|---|
| 187 | newtr.setAttribute('class','tr');
|
|---|
| 188 | var newtd_c1 = document.createElement("td");
|
|---|
| 189 | newtd_c1.setAttribute("width","200");
|
|---|
| 190 | newtd_c1.setAttribute("align","center");
|
|---|
| 191 | newtd_c1.setAttribute("valign", "top");
|
|---|
| 192 | newtd_c1.appendChild(
|
|---|
| 193 | input_data = document.createElement("input"),
|
|---|
| 194 | input_data.setAttribute("type","time"),
|
|---|
| 195 | input_data.setAttribute("class","time"),
|
|---|
| 196 | input_data.setAttribute("size","10"),
|
|---|
| 197 | input_data.setAttribute("autofocus","true")
|
|---|
| 198 | );
|
|---|
| 199 | newtd_c1.appendChild(
|
|---|
| 200 | input_data = document.createElement("input"),
|
|---|
| 201 | input_data.setAttribute("type","button"),
|
|---|
| 202 | input_data.setAttribute("value","+"),
|
|---|
| 203 | input_data.onclick = function(){
|
|---|
| 204 | addRowCloneNew("list_"+newlist);
|
|---|
| 205 | }
|
|---|
| 206 | );
|
|---|
| 207 | var newtd_c2 = document.createElement("td");
|
|---|
| 208 |
|
|---|
| 209 | newtd_c2.setAttribute("width","138");
|
|---|
| 210 | newtd_c2.setAttribute("align","center");
|
|---|
| 211 | newtd_c2.appendChild(
|
|---|
| 212 | select = document.createElement("select"),
|
|---|
| 213 | select.setAttribute("class","measure"),
|
|---|
| 214 | $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
|
|---|
| 215 | type:"post",
|
|---|
| 216 | url:"Transaction/measurement.php",
|
|---|
| 217 | success:function(data){
|
|---|
| 218 | var obj=$.parseJSON(data);
|
|---|
| 219 | $.each(obj,function(){
|
|---|
| 220 | select.appendChild(
|
|---|
| 221 | option = document.createElement("option"),
|
|---|
| 222 | option.setAttribute('value',this['fMeasurementKey']),
|
|---|
| 223 | option.appendChild(document.createTextNode(this['fMeasurement']))
|
|---|
| 224 | )
|
|---|
| 225 | })
|
|---|
| 226 |
|
|---|
| 227 | }
|
|---|
| 228 | }) // End of retrieving
|
|---|
| 229 |
|
|---|
| 230 | );
|
|---|
| 231 | newtd_c2.setAttribute("width","115");
|
|---|
| 232 | newtd_c2.setAttribute("align","center");
|
|---|
| 233 | newtd_c2.appendChild(
|
|---|
| 234 | input_data = document.createElement("input"),
|
|---|
| 235 | input_data.setAttribute("type","button"),
|
|---|
| 236 | input_data.setAttribute("value","+"),
|
|---|
| 237 | input_data.onclick = function(){
|
|---|
| 238 | return addRow(newtr);
|
|---|
| 239 | ctr++;
|
|---|
| 240 | });
|
|---|
| 241 | var newtd_c3 = document.createElement("td");
|
|---|
| 242 | newtd_c3.setAttribute("width","98");
|
|---|
| 243 | newtd_c3.setAttribute("align","center");
|
|---|
| 244 | newtd_c3.appendChild(
|
|---|
| 245 | selection = document.createElement("select"),
|
|---|
| 246 | selection.setAttribute("class","source"),
|
|---|
| 247 | $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
|
|---|
| 248 | type:"post",
|
|---|
| 249 | url:"Transaction/source.php",
|
|---|
| 250 | success:function(data)
|
|---|
| 251 | {
|
|---|
| 252 | var obj = $.parseJSON(data);
|
|---|
| 253 | $.each(obj,function(){
|
|---|
| 254 | selection.appendChild(
|
|---|
| 255 | option=document.createElement('option'),
|
|---|
| 256 | option.setAttribute('value',this['fSourceKEY']),
|
|---|
| 257 | option.appendChild(document.createTextNode(this['fSourceName']))
|
|---|
| 258 | )
|
|---|
| 259 | });
|
|---|
| 260 | }
|
|---|
| 261 | }) // End of retrieving
|
|---|
| 262 | );
|
|---|
| 263 | var newtd_c4 = document.createElement("td");
|
|---|
| 264 | newtd_c4.setAttribute("width","119");
|
|---|
| 265 | newtd_c4.setAttribute("align","center");
|
|---|
| 266 | newtd_c4.appendChild(
|
|---|
| 267 | input_data = document.createElement("input"),
|
|---|
| 268 | input_data.setAttribute("type","text"),
|
|---|
| 269 | input_data.setAttribute("class","selected"),
|
|---|
| 270 | input_data.setAttribute("size","12"),
|
|---|
| 271 | input_data.setAttribute("placeholder","Value")
|
|---|
| 272 | );
|
|---|
| 273 | var newtd_c5 = document.createElement("td");
|
|---|
| 274 | newtd_c5.setAttribute("width","115");
|
|---|
| 275 | newtd_c5.setAttribute("align","center");
|
|---|
| 276 | newtd_c5.setAttribute("width","115");
|
|---|
| 277 | newtd_c5.setAttribute("align","center");
|
|---|
| 278 | newtd_c5.appendChild(
|
|---|
| 279 | input_data = document.createElement("input"),
|
|---|
| 280 | input_data.setAttribute("type","button"),
|
|---|
| 281 | input_data.setAttribute("value","Delete"),
|
|---|
| 282 | input_data.onclick = function(){ return clearNode(newtr);
|
|---|
| 283 | }
|
|---|
| 284 | );
|
|---|
| 285 | newtr.appendChild(newtd_c2);
|
|---|
| 286 | newtr.appendChild(newtd_c3);
|
|---|
| 287 | newtr.appendChild(newtd_c4);
|
|---|
| 288 | newtr.appendChild(newtd_c5);
|
|---|
| 289 | newInnertable.appendChild(newtr);
|
|---|
| 290 | var newtd_c6 = document.createElement("td");
|
|---|
| 291 | newtd_c6.appendChild(newInnertable);
|
|---|
| 292 |
|
|---|
| 293 | var newtd_c7 = document.createElement("td");
|
|---|
| 294 | newtd_c7.setAttribute("width","115");
|
|---|
| 295 | newtd_c7.setAttribute("align","center");
|
|---|
| 296 | newtd_c7.setAttribute("valign", "top");
|
|---|
| 297 | newtd_c7.appendChild(
|
|---|
| 298 | input_data = document.createElement("input"),
|
|---|
| 299 | input_data.setAttribute("type","button"),
|
|---|
| 300 | input_data.setAttribute("value","Delete Main"),
|
|---|
| 301 | input_data.onclick = function(){ return clearNode(newdiv); }
|
|---|
| 302 | );
|
|---|
| 303 |
|
|---|
| 304 | var newOutertr = document.createElement("tr");
|
|---|
| 305 |
|
|---|
| 306 | newtable.appendChild(newtd_c1);
|
|---|
| 307 | newtable.appendChild(newtd_c6);
|
|---|
| 308 | newtable.appendChild(newtd_c7);
|
|---|
| 309 |
|
|---|
| 310 | newdiv.appendChild(newtable);
|
|---|
| 311 | if(nextrow != null){
|
|---|
| 312 | var doc = document.getElementById(nextrow);
|
|---|
| 313 | $(doc).after(newdiv);
|
|---|
| 314 | }else{
|
|---|
| 315 | targetView.appendChild(newdiv);
|
|---|
| 316 | }
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | function addRowClone(nextrow){
|
|---|
| 320 | <?php
|
|---|
| 321 | $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$day' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error());
|
|---|
| 322 | $observationsTime = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE date(fStart) = '$day'");
|
|---|
| 323 | $cnt3=0;
|
|---|
| 324 | $cnt2=0;
|
|---|
| 325 | $cnt4 = 0;
|
|---|
| 326 | $cnt5 = 0;
|
|---|
| 327 | $cnt = 0;
|
|---|
| 328 | $cntrow = 0;
|
|---|
| 329 | $pastdate = 'false';
|
|---|
| 330 | $pasttime = 'false';
|
|---|
| 331 | date_default_timezone_set("UTC");
|
|---|
| 332 | //$data = array();
|
|---|
| 333 | //$counter=0;
|
|---|
| 334 | while($times = mysql_fetch_array($observationsTime))
|
|---|
| 335 | {
|
|---|
| 336 | $timestamp=strtotime($times['fStart']);
|
|---|
| 337 | $testdate = date('Y-m-d H:i:s', $times['fStart']);
|
|---|
| 338 | $testing = date('Y-m-d H:i', $timestamp);
|
|---|
| 339 | $actualtime = date('Y-m-d H:i:s', $timestamp);
|
|---|
| 340 | if(strtotime(date('Y-m-d', $timestamp)) == strtotime(date('Y-m-d', time()))) {
|
|---|
| 341 | $fetch_next = mysql_query("SELECT * FROM schedule WHERE (fStart > '$testing' AND date(fStart) = '$day') ORDER BY fStart LIMIT 1");
|
|---|
| 342 | $next_data = mysql_fetch_array($fetch_next);
|
|---|
| 343 | if (mysql_num_rows($fetch_next) > 0) {
|
|---|
| 344 | $next_date = strtotime($next_data['fStart']);
|
|---|
| 345 | $test = date('Y-m-d H:i', $next_date);
|
|---|
| 346 | if(strtotime(date('Y-m-d H:i', $next_date)) > strtotime(date('Y-m-d H:i', time()))) {
|
|---|
| 347 | $pasttime = 'true';
|
|---|
| 348 | } else {
|
|---|
| 349 | $pasttime = 'false';
|
|---|
| 350 | }
|
|---|
| 351 | } else {
|
|---|
| 352 | $pasttime = 'true';
|
|---|
| 353 | }
|
|---|
| 354 | }
|
|---|
| 355 | else {
|
|---|
| 356 | $pasttime = 'false';
|
|---|
| 357 | }
|
|---|
| 358 | $timestamp2 = date('Y-m-d',$timestamp);
|
|---|
| 359 | $date_time = date('H:i',$timestamp);
|
|---|
| 360 | $prev_time[$cnt3]= $date_time;
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 | if(strtotime(date('Y-m-d H:i', $timestamp)) < strtotime(date('Y-m-d H:i', time()))) {
|
|---|
| 364 | $pastdate = 'true';
|
|---|
| 365 | }
|
|---|
| 366 | else {
|
|---|
| 367 | $pastdate = 'false';
|
|---|
| 368 | }
|
|---|
| 369 | ?>
|
|---|
| 370 | $('#save').attr('value','UPDATE');
|
|---|
| 371 | var targetView = document.getElementById("Data");
|
|---|
| 372 | // CREATE ELEMENT
|
|---|
| 373 | // COUNT LIST
|
|---|
| 374 | var list = $(".datalisting").length;
|
|---|
| 375 | var newlist = list+1;
|
|---|
| 376 | <?php $cnt++;?>
|
|---|
| 377 |
|
|---|
| 378 | var cctr=$('.dataTable tr').length;
|
|---|
| 379 | ctr=cctr+1;
|
|---|
| 380 | var select;
|
|---|
| 381 | var input_data;
|
|---|
| 382 | var option;
|
|---|
| 383 | var selection;
|
|---|
| 384 |
|
|---|
| 385 | var newdiv<?php echo $cnt; ?> = document.createElement("div");
|
|---|
| 386 | newdiv<?php echo $cnt; ?>.setAttribute("id", "list_<?php echo $cnt; ?>");
|
|---|
| 387 | newdiv<?php echo $cnt; ?>.setAttribute("class","datalisting");
|
|---|
| 388 | newdiv<?php echo $cnt; ?>.setAttribute("style","margin:5px 0;");
|
|---|
| 389 |
|
|---|
| 390 | var newtable = document.createElement("table");
|
|---|
| 391 | newtable.setAttribute("class","dataTable");
|
|---|
| 392 | newtable.setAttribute("width","100%");
|
|---|
| 393 | newtable.setAttribute("border","1");
|
|---|
| 394 | newtable.setAttribute("cellspacing","0");
|
|---|
| 395 | newtable.setAttribute("cellpadding","0");
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 | var newInnertable = document.createElement("table");
|
|---|
| 399 | newInnertable.setAttribute("class","dataTable");
|
|---|
| 400 | newInnertable.setAttribute("width","100%");
|
|---|
| 401 | newInnertable.setAttribute("border","1");
|
|---|
| 402 |
|
|---|
| 403 | newInnertable.setAttribute("cellspacing","0");
|
|---|
| 404 | newInnertable.setAttribute("cellpadding","0");
|
|---|
| 405 |
|
|---|
| 406 | var newtd_c1 = document.createElement("td");
|
|---|
| 407 | newtd_c1.setAttribute("width","200");
|
|---|
| 408 | newtd_c1.setAttribute("align","center");
|
|---|
| 409 | newtd_c1.setAttribute("valign", "top");
|
|---|
| 410 | <?php if ($pastdate == 'true') { ?>
|
|---|
| 411 | newtd_c1.appendChild(
|
|---|
| 412 | input_data = document.createElement("input"),
|
|---|
| 413 | input_data.setAttribute("type","time"),
|
|---|
| 414 | input_data.setAttribute("class","time"),
|
|---|
| 415 | input_data.setAttribute("size","10"),
|
|---|
| 416 | input_data.setAttribute("value","<?php echo $date_time; ?>"),
|
|---|
| 417 | input_data.setAttribute("autofocus","true"),
|
|---|
| 418 | input_data.setAttribute("disabled")
|
|---|
| 419 | );
|
|---|
| 420 | <?php } else { ?>
|
|---|
| 421 | newtd_c1.appendChild(
|
|---|
| 422 | input_data = document.createElement("input"),
|
|---|
| 423 | input_data.setAttribute("type","time"),
|
|---|
| 424 | input_data.setAttribute("class","time"),
|
|---|
| 425 | input_data.setAttribute("size","10"),
|
|---|
| 426 | input_data.setAttribute("value","<?php echo $date_time; ?>"),
|
|---|
| 427 | input_data.setAttribute("autofocus","true")
|
|---|
| 428 | );
|
|---|
| 429 | <?php }
|
|---|
| 430 | if($pasttime == 'true') { ?>
|
|---|
| 431 | newtd_c1.appendChild(
|
|---|
| 432 | input_data = document.createElement("input"),
|
|---|
| 433 | input_data.setAttribute("type","button"),
|
|---|
| 434 | input_data.setAttribute("value","+"),
|
|---|
| 435 | input_data.onclick = function(){
|
|---|
| 436 | addRowCloneNew("list_<?php echo $cnt; ?>");
|
|---|
| 437 | }
|
|---|
| 438 | );
|
|---|
| 439 | <?php } else { if ($pastdate == 'true') { ?>
|
|---|
| 440 | newtd_c1.appendChild(
|
|---|
| 441 | input_data = document.createElement("input"),
|
|---|
| 442 | input_data.setAttribute("type","button"),
|
|---|
| 443 | input_data.setAttribute("value","+"),
|
|---|
| 444 | input_data.setAttribute("disabled"),
|
|---|
| 445 | input_data.onclick = function(){
|
|---|
| 446 | addRowCloneNew("list_<?php echo $cnt; ?>");
|
|---|
| 447 | }
|
|---|
| 448 | );
|
|---|
| 449 | <?php } else { ?>
|
|---|
| 450 | newtd_c1.appendChild(
|
|---|
| 451 | input_data = document.createElement("input"),
|
|---|
| 452 | input_data.setAttribute("type","button"),
|
|---|
| 453 | input_data.setAttribute("value","+"),
|
|---|
| 454 | input_data.onclick = function(){
|
|---|
| 455 | addRowCloneNew("list_<?php echo $cnt; ?>");
|
|---|
| 456 | }
|
|---|
| 457 | );
|
|---|
| 458 | <?php } }
|
|---|
| 459 | $observations = mysql_query("SELECT * FROM schedule WHERE fStart = '$actualtime'");
|
|---|
| 460 |
|
|---|
| 461 | while($rows = mysql_fetch_array($observations))
|
|---|
| 462 | {
|
|---|
| 463 | $cntrow++;
|
|---|
| 464 | ?>
|
|---|
| 465 |
|
|---|
| 466 | var newtr<?php echo $cntrow; ?> = document.createElement("tr");
|
|---|
| 467 | newtr<?php echo $cntrow; ?>.setAttribute('class','tr');
|
|---|
| 468 |
|
|---|
| 469 | <?php if ($pastdate == 'true') { ?>
|
|---|
| 470 | var newtd_c2 = document.createElement("td");
|
|---|
| 471 | newtd_c2.setAttribute("width","138");
|
|---|
| 472 | newtd_c2.setAttribute("align","center");
|
|---|
| 473 | newtd_c2.appendChild(
|
|---|
| 474 | selection = document.createElement("select"),
|
|---|
| 475 | <?php
|
|---|
| 476 | $selectm = mysql_query("SELECT * FROM measurement");
|
|---|
| 477 | while($rowmeasure = mysql_fetch_array($selectm))
|
|---|
| 478 | {
|
|---|
| 479 | ?>
|
|---|
| 480 | selection.appendChild(
|
|---|
| 481 | option = document.createElement("option"),
|
|---|
| 482 | option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),
|
|---|
| 483 | <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?>
|
|---|
| 484 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 485 | ),
|
|---|
| 486 | <?php
|
|---|
| 487 | }
|
|---|
| 488 | ?>
|
|---|
| 489 | selection.setAttribute('id','measure'),
|
|---|
| 490 | selection.setAttribute('class','measure'),
|
|---|
| 491 | selection.setAttribute("disabled")
|
|---|
| 492 | );
|
|---|
| 493 | newtd_c2.setAttribute("width","115");
|
|---|
| 494 | newtd_c2.setAttribute("align","center");
|
|---|
| 495 | newtd_c2.appendChild(
|
|---|
| 496 | input_data = document.createElement("input"),
|
|---|
| 497 | input_data.setAttribute("type","button"),
|
|---|
| 498 | input_data.setAttribute("value","+"),
|
|---|
| 499 | input_data.setAttribute("disabled"),
|
|---|
| 500 | input_data.onclick = function(){
|
|---|
| 501 | return addRow(newtr<?php echo $cntrow; ?>);
|
|---|
| 502 | ctr++;
|
|---|
| 503 | });
|
|---|
| 504 |
|
|---|
| 505 | var newtd_c3 = document.createElement("td");
|
|---|
| 506 | newtd_c3.setAttribute("width","98");
|
|---|
| 507 | newtd_c3.setAttribute("align","center");
|
|---|
| 508 | newtd_c3.appendChild(
|
|---|
| 509 | selection = document.createElement("select"),
|
|---|
| 510 | <?php
|
|---|
| 511 | $select = mysql_query("SELECT * FROM source");
|
|---|
| 512 | while($rowsource = mysql_fetch_array($select))
|
|---|
| 513 | {
|
|---|
| 514 | ?>
|
|---|
| 515 | selection.appendChild(
|
|---|
| 516 | option = document.createElement("option"),
|
|---|
| 517 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 518 | <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo "option.setAttribute('selected',true),"; } ?>
|
|---|
| 519 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 520 | ),
|
|---|
| 521 | <?php
|
|---|
| 522 | }
|
|---|
| 523 | ?>
|
|---|
| 524 | selection.setAttribute('id','source'), // End of retrieving
|
|---|
| 525 | selection.setAttribute('class','source'),
|
|---|
| 526 | selection.setAttribute("disabled")
|
|---|
| 527 | // End of retrieving
|
|---|
| 528 | );
|
|---|
| 529 |
|
|---|
| 530 | var newtd_c4 = document.createElement("td");
|
|---|
| 531 | newtd_c4.setAttribute("width","119");
|
|---|
| 532 | newtd_c4.setAttribute("align","center");
|
|---|
| 533 | newtd_c4.appendChild(
|
|---|
| 534 | input_data = document.createElement("input"),
|
|---|
| 535 | input_data.setAttribute("type","text"),
|
|---|
| 536 | input_data.setAttribute("class","selected"),
|
|---|
| 537 | input_data.setAttribute("size","12"),
|
|---|
| 538 | input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),
|
|---|
| 539 | input_data.setAttribute("placeholder","Value"),
|
|---|
| 540 | input_data.setAttribute("disabled")
|
|---|
| 541 | );
|
|---|
| 542 |
|
|---|
| 543 | var newtd_c5 = document.createElement("td");
|
|---|
| 544 | newtd_c5.setAttribute("width","115");
|
|---|
| 545 | newtd_c5.setAttribute("align","center");
|
|---|
| 546 | newtd_c5.setAttribute("width","115");
|
|---|
| 547 | newtd_c5.setAttribute("align","center");
|
|---|
| 548 | newtd_c5.appendChild(
|
|---|
| 549 | input_data = document.createElement("input"),
|
|---|
| 550 | input_data.setAttribute("type","button"),
|
|---|
| 551 | input_data.setAttribute("value","Delete"),
|
|---|
| 552 | input_data.setAttribute("disabled"),
|
|---|
| 553 | input_data.onclick = function(){
|
|---|
| 554 | return clearNode(newtr<?php echo $cntrow; ?>);
|
|---|
| 555 | }
|
|---|
| 556 | );
|
|---|
| 557 | <?php } else { ?>
|
|---|
| 558 | var newtd_c2 = document.createElement("td");
|
|---|
| 559 | newtd_c2.setAttribute("width","138");
|
|---|
| 560 | newtd_c2.setAttribute("align","center");
|
|---|
| 561 | newtd_c2.appendChild(
|
|---|
| 562 | selection = document.createElement("select"),
|
|---|
| 563 | <?php
|
|---|
| 564 | $selectm = mysql_query("SELECT * FROM measurement");
|
|---|
| 565 | while($rowmeasure = mysql_fetch_array($selectm))
|
|---|
| 566 | {
|
|---|
| 567 | ?>
|
|---|
| 568 | selection.appendChild(
|
|---|
| 569 | option = document.createElement("option"),
|
|---|
| 570 | option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),
|
|---|
| 571 | <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?>
|
|---|
| 572 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 573 | ),
|
|---|
| 574 | <?php
|
|---|
| 575 | }
|
|---|
| 576 | ?>
|
|---|
| 577 | selection.setAttribute('id','measure'),
|
|---|
| 578 | selection.setAttribute('class','measure')
|
|---|
| 579 | );
|
|---|
| 580 | newtd_c2.setAttribute("width","115");
|
|---|
| 581 | newtd_c2.setAttribute("align","center");
|
|---|
| 582 | newtd_c2.appendChild(
|
|---|
| 583 | input_data = document.createElement("input"),
|
|---|
| 584 | input_data.setAttribute("type","button"),
|
|---|
| 585 | input_data.setAttribute("value","+"),
|
|---|
| 586 | input_data.onclick = function(){
|
|---|
| 587 | return addRow(newtr<?php echo $cntrow; ?>);
|
|---|
| 588 | ctr++;
|
|---|
| 589 | });
|
|---|
| 590 |
|
|---|
| 591 | var newtd_c3 = document.createElement("td");
|
|---|
| 592 | newtd_c3.setAttribute("width","98");
|
|---|
| 593 | newtd_c3.setAttribute("align","center");
|
|---|
| 594 | newtd_c3.appendChild(
|
|---|
| 595 | selection = document.createElement("select"),
|
|---|
| 596 | <?php
|
|---|
| 597 | $select = mysql_query("SELECT * FROM source");
|
|---|
| 598 | while($rowsource = mysql_fetch_array($select))
|
|---|
| 599 | {
|
|---|
| 600 | ?>
|
|---|
| 601 | selection.appendChild(
|
|---|
| 602 | option = document.createElement("option"),
|
|---|
| 603 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 604 | <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo "option.setAttribute('selected',true),"; } ?>
|
|---|
| 605 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 606 | ),
|
|---|
| 607 | <?php
|
|---|
| 608 | }
|
|---|
| 609 | ?>
|
|---|
| 610 | selection.setAttribute('id','source'), // End of retrieving
|
|---|
| 611 | selection.setAttribute('class','source') // End of retrieving
|
|---|
| 612 | );
|
|---|
| 613 |
|
|---|
| 614 | var newtd_c4 = document.createElement("td");
|
|---|
| 615 | newtd_c4.setAttribute("width","119");
|
|---|
| 616 | newtd_c4.setAttribute("align","center");
|
|---|
| 617 | newtd_c4.appendChild(
|
|---|
| 618 | input_data = document.createElement("input"),
|
|---|
| 619 | input_data.setAttribute("type","text"),
|
|---|
| 620 | input_data.setAttribute("class","selected"),
|
|---|
| 621 | input_data.setAttribute("size","12"),
|
|---|
| 622 | input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),
|
|---|
| 623 | input_data.setAttribute("placeholder","Value")
|
|---|
| 624 | );
|
|---|
| 625 |
|
|---|
| 626 | var newtd_c5 = document.createElement("td");
|
|---|
| 627 | newtd_c5.setAttribute("width","115");
|
|---|
| 628 | newtd_c5.setAttribute("align","center");
|
|---|
| 629 | newtd_c5.setAttribute("width","115");
|
|---|
| 630 | newtd_c5.setAttribute("align","center");
|
|---|
| 631 | newtd_c5.appendChild(
|
|---|
| 632 | input_data = document.createElement("input"),
|
|---|
| 633 | input_data.setAttribute("type","button"),
|
|---|
| 634 | input_data.setAttribute("value","Delete"),
|
|---|
| 635 | input_data.onclick = function(){ return clearNode(newtr<?php echo $cntrow; ?>);
|
|---|
| 636 |
|
|---|
| 637 | }
|
|---|
| 638 | );
|
|---|
| 639 | <?php } ?>
|
|---|
| 640 | newtr<?php echo $cntrow; ?>.appendChild(newtd_c2);
|
|---|
| 641 | newtr<?php echo $cntrow; ?>.appendChild(newtd_c3);
|
|---|
| 642 | newtr<?php echo $cntrow; ?>.appendChild(newtd_c4);
|
|---|
| 643 | newtr<?php echo $cntrow; ?>.appendChild(newtd_c5);
|
|---|
| 644 | newInnertable.appendChild(newtr<?php echo $cntrow; ?>);
|
|---|
| 645 |
|
|---|
| 646 | <?php
|
|---|
| 647 |
|
|---|
| 648 | $prevtimestamp = $timestamp;
|
|---|
| 649 | }
|
|---|
| 650 | ?>
|
|---|
| 651 |
|
|---|
| 652 | var newtd_c6 = document.createElement("td");
|
|---|
| 653 | newtd_c6.appendChild(newInnertable);
|
|---|
| 654 |
|
|---|
| 655 | var newtd_c7 = document.createElement("td");
|
|---|
| 656 | newtd_c7.setAttribute("width","115");
|
|---|
| 657 | newtd_c7.setAttribute("align","center");
|
|---|
| 658 | newtd_c7.setAttribute("valign", "top");
|
|---|
| 659 | <?php if ($pastdate == 'true') { ?>
|
|---|
| 660 | newtd_c7.appendChild(
|
|---|
| 661 | input_data = document.createElement("input"),
|
|---|
| 662 | input_data.setAttribute("type","button"),
|
|---|
| 663 | input_data.setAttribute("value","Delete Main"),
|
|---|
| 664 | input_data.setAttribute("disabled"),
|
|---|
| 665 | input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
|
|---|
| 666 | );
|
|---|
| 667 | <?php } else { ?>
|
|---|
| 668 | newtd_c7.appendChild(
|
|---|
| 669 | input_data = document.createElement("input"),
|
|---|
| 670 | input_data.setAttribute("type","button"),
|
|---|
| 671 | input_data.setAttribute("value","Delete Main"),
|
|---|
| 672 | input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
|
|---|
| 673 | );
|
|---|
| 674 | <?php } ?>
|
|---|
| 675 |
|
|---|
| 676 | var newOutertr = document.createElement("tr");
|
|---|
| 677 |
|
|---|
| 678 | newtable.appendChild(newtd_c1);
|
|---|
| 679 | newtable.appendChild(newtd_c6);
|
|---|
| 680 | newtable.appendChild(newtd_c7);
|
|---|
| 681 |
|
|---|
| 682 | newdiv<?php echo $cnt; ?>.appendChild(newtable);
|
|---|
| 683 | if(nextrow != null){
|
|---|
| 684 | var doc = document.getElementById(nextrow);
|
|---|
| 685 | $(doc).after(newdiv<?php echo $cnt;?>);
|
|---|
| 686 | }else{
|
|---|
| 687 | targetView.appendChild(newdiv<?php echo $cnt;?>);
|
|---|
| 688 | //$(targetView).after(newtr<?php echo $cnt; ?>);
|
|---|
| 689 | }
|
|---|
| 690 | <?php
|
|---|
| 691 | }
|
|---|
| 692 | if(mysql_num_rows($fetch)<1)
|
|---|
| 693 | {
|
|---|
| 694 | ?>
|
|---|
| 695 | $('#save').attr('value','SAVE');
|
|---|
| 696 | addRowCloneNew();
|
|---|
| 697 | <?php
|
|---|
| 698 | }
|
|---|
| 699 |
|
|---|
| 700 | ?>
|
|---|
| 701 |
|
|---|
| 702 |
|
|---|
| 703 | }
|
|---|
| 704 |
|
|---|
| 705 | $('#LoadPrev').click(function() {
|
|---|
| 706 | });
|
|---|
| 707 | </script>
|
|---|
| 708 |
|
|---|