source: schedule/function/function.php@ 16022

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