source: schedule/function/function.php@ 16151

Last change on this file since 16151 was 16112, 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 var day;
20 var month;
21 var year;
22 var fullday;
23 <?php
24 if($_GET['day'] || $_GET['month'] || $_GET['year']){
25
26 ?>
27
28 day = <?php echo $_GET['day']; ?>;
29 month = <?php echo $_GET['month']; ?>;
30 year = <?php echo $_GET['year']; ?>;
31 fullday=day+'-'+month+'-'+year;
32
33
34
35 <?php
36
37
38 }else{
39
40 ?>
41 var currentDate = new Date();
42 day = currentDate.getDate();
43 month = currentDate.getMonth() + 1;
44 year = currentDate.getFullYear();
45 fullday=day+'-'+month+'-'+year;
46 <?php } ?>
47
48 <?php
49
50
51
52 $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
53 $rowcnt=mysql_fetch_array($cntsource);
54 $Total= $rowcnt['SourceID'];
55 ?>
56 $('#save').click(function(){
57 var InputValue = [];
58 var selectedSource = [];
59 var selectedTime = [];
60 var selectedMeasurement = [];
61 var Time;
62 var Source;
63 var measure;
64 var value;
65 for(var i=1;i<<?php echo $Total; ?>;i++)
66 {
67 if($('#Time'+i).val()||$('#Time'+i).val()>0)
68 {
69 Time=$('#Time'+i).val();
70 Source=$('select[id="source'+i+'"]').val();
71 measure=$('select[id="measurement'+i+'"]').val();
72 value=$('#txtData'+i).val();
73 selectedMeasurement.push(measure);
74 selectedSource.push(Source);
75 selectedTime.push(Time);
76 InputValue.push(value);
77 }
78 }
79 window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday+'&Date2='+fullday2;
80 });
81
82 });
83 </script>
84 </div>
Note: See TracBrowser for help on using the repository browser.