source: schedule/function/function.php@ 16477

Last change on this file since 16477 was 16422, checked in by tanio, 11 years ago
File size: 1.9 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 var checks = 0;
66 for(var i=1;i <= cnt;i++)
67 {
68 if($('#Time'+i).val() != '')
69 {
70 Time=$('#Time'+i).val();
71 Source=$('select[id="source'+i+'"]').val();
72 measure=$('select[id="measurement'+i+'"]').val();
73 value=$('#txtData'+i).val();
74 selectedMeasurement.push(measure);
75 selectedSource.push(Source);
76 selectedTime.push(Time);
77 InputValue.push(value);
78
79 }else{
80 checks++;
81
82 }
83 }
84
85 if(checks == 0){
86 window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday+'&Date2='+fullday2;
87 }else{
88
89 alert("Please fill all the details!");
90 }
91 });
92
93 });
94 </script>
95 </div>
Note: See TracBrowser for help on using the repository browser.