source: schedule/function/function.php@ 16840

Last change on this file since 16840 was 16738, checked in by tanio, 11 years ago
File size: 2.5 KB
Line 
1 <div id="saving">
2
3 <script type="text/javascript">
4
5
6
7
8
9
10
11
12 $(document).ready(function GetDate(){
13 // for fupdate
14 <?php
15
16
17
18 $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
19 $rowcnt=mysql_fetch_array($cntsource);
20 $Total= $rowcnt['SourceID'];
21 ?>
22 $('#save').click(function(){
23var dtr;
24 dtr = '<?php
25
26 if(isset($_GET['days'])){
27 echo $_GET['days']; ;
28 }else{
29
30 echo date("Y-m-d");
31
32 }
33
34 ?>';
35 //alert(dtr);
36 var InputValue = [];
37 var selectedSource = [];
38 var selectedTime = [];
39 var selectedMeasurement = [];
40 var Time;
41 var Source;
42 var measure;
43 var value;
44 var checks = 0;
45 for(var i=1;i <= cnt;i++)
46 {
47 if($('#Time'+i).val() != '')
48 {
49 Time=$('#Time'+i).val();
50 Source=$('select[id="source'+i+'"]').val();
51 measure=$('select[id="measurement'+i+'"]').val();
52 value=$('#txtData'+i).val();
53 selectedMeasurement.push(measure);
54 selectedSource.push(Source);
55 selectedTime.push(Time);
56 InputValue.push(value);
57
58 }else{
59 checks++;
60
61 }
62 }
63
64 if(checks == 0){
65 window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+dtr;
66 }else{
67
68 alert("Please fill all the details!");
69 }
70 });
71
72
73
74
75
76
77
78
79
80
81
82 $('#update').click(function(){
83var dtr;
84 dtr = '<?php
85
86 if(isset($_GET['days'])){
87 echo $_GET['days']; ;
88 }else{
89
90 echo date("Y-m-d");
91
92 }
93
94 ?>';
95 //alert(dtr);
96 var InputValue = [];
97 var selectedSource = [];
98 var selectedTime = [];
99 var selectedMeasurement = [];
100 var Time;
101 var Source;
102 var measure;
103 var value;
104 var checks = 0;
105 for(var i=1;i <= cnt;i++)
106 {
107 if($('#Time'+i).val() != '')
108 {
109 Time=$('#Time'+i).val();
110 Source=$('select[id="source'+i+'"]').val();
111 measure=$('select[id="measurement'+i+'"]').val();
112 value=$('#txtData'+i).val();
113 selectedMeasurement.push(measure);
114 selectedSource.push(Source);
115 selectedTime.push(Time);
116 InputValue.push(value);
117
118 }else{
119 checks++;
120
121 }
122 }
123
124 if(checks == 0){
125 window.location = 'Transaction/update.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+dtr;
126 }else{
127
128 alert("Please fill all the details!");
129 }
130 });
131
132
133
134
135
136
137
138
139 });
140 </script>
141 </div>
Note: See TracBrowser for help on using the repository browser.