source: schedule/function/function.php@ 16013

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