source: schedule/function/function.php@ 16016

Last change on this file since 16016 was 16016, checked in by tanio, 12 years ago
File size: 1.8 KB
Line 
1 <div id="saving">
2 <script type="text/javascript">
3
4
5
6
7
8
9
10
11 $(document).ready(function(){
12 // for fupdate
13 var currentDate2 = new Date();
14 var day2 = currentDate2.getDate();
15 var month2 = currentDate2.getMonth() + 1;
16 var year2 = currentDate2.getFullYear();
17 var fullday2=day2+'-'+month2+'-'+year2;
18
19 <?php
20 if($_GET['day'] || $_GET['month'] || $_GET['year']){
21
22 ?>
23
24 var day = <?php echo $_GET['day']; ?>
25 var month = <?php echo $_GET['month']; ?>
26 var year = <?php echo $_GET['year']; ?>
27 var fullday=day+'-'+month+'-'+year;
28
29
30
31 <?php
32
33
34 }else{
35
36 ?>
37 var currentDate = new Date();
38 var day = currentDate.getDate();
39 var month = currentDate.getMonth() + 1;
40 var year = currentDate.getFullYear();
41 var fullday=day+'-'+month+'-'+year;
42 <?php } ?>
43 <?php
44
45
46
47 $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
48 $rowcnt=mysql_fetch_array($cntsource);
49 $Total= $rowcnt['SourceID'];
50 ?>
51 $('#save').click(function(){
52 var InputValue = [];
53 var selectedSource = [];
54 var selectedTime = [];
55 var selectedMeasurement = [];
56 var Time;
57 var Source;
58 var measure;
59 var value;
60 for(var i=1;i<<?php echo $Total; ?>;i++)
61 {
62 if($('#Time'+i).val()||$('#Time'+i).val()>0)
63 {
64 Time=$('#Time'+i).val();
65 Source=$('select[id="source'+i+'"]').val();
66 measure=$('select[id="measurement'+i+'"]').val();
67 value=$('#txtData'+i).val();
68 selectedMeasurement.push(measure);
69 selectedSource.push(Source);
70 selectedTime.push(Time);
71 InputValue.push(value);
72 }
73 }
74 window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday+'&Date2='+fullday2;
75 });
76
77 });
78 </script>
79 </div>
Note: See TracBrowser for help on using the repository browser.