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 = currentDate.getDate();
|
---|
14 | var month2 = currentDate.getMonth() + 1;
|
---|
15 | var year2 = currentDate.getFullYear();
|
---|
16 | var fullday2=day2+'-'+month2+'-'+year2;
|
---|
17 |
|
---|
18 | <?php
|
---|
19 | if($_GET['day'] || $_GET['month'] || $_GET['year']){
|
---|
20 |
|
---|
21 | ?>
|
---|
22 |
|
---|
23 | var day = <?php echo $_GET['day']; ?>
|
---|
24 | var month = <?php echo $_GET['month']; ?>
|
---|
25 | var year = <?php echo $_GET['year']; ?>
|
---|
26 | var fullday=day+'-'+month+'-'+year;
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 | <?php
|
---|
31 |
|
---|
32 |
|
---|
33 | }else{
|
---|
34 |
|
---|
35 | ?>
|
---|
36 | var currentDate = new Date();
|
---|
37 | var day = currentDate.getDate();
|
---|
38 | var month = currentDate.getMonth() + 1;
|
---|
39 | var year = currentDate.getFullYear();
|
---|
40 | var fullday=day+'-'+month+'-'+year;
|
---|
41 | <?php } ?>
|
---|
42 | <?php
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 | $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
|
---|
47 | $rowcnt=mysql_fetch_array($cntsource);
|
---|
48 | $Total= $rowcnt['SourceID'];
|
---|
49 | ?>
|
---|
50 | $('#save').click(function(){
|
---|
51 | var InputValue = [];
|
---|
52 | var selectedSource = [];
|
---|
53 | var selectedTime = [];
|
---|
54 | var selectedMeasurement = [];
|
---|
55 | var Time;
|
---|
56 | var Source;
|
---|
57 | var measure;
|
---|
58 | var value;
|
---|
59 | for(var i=1;i<<?php echo $Total; ?>;i++)
|
---|
60 | {
|
---|
61 | if($('#Time'+i).val()||$('#Time'+i).val()>0)
|
---|
62 | {
|
---|
63 | Time=$('#Time'+i).val();
|
---|
64 | Source=$('select[id="source'+i+'"]').val();
|
---|
65 | measure=$('select[id="measurement'+i+'"]').val();
|
---|
66 | value=$('#txtData'+i).val();
|
---|
67 | selectedMeasurement.push(measure);
|
---|
68 | selectedSource.push(Source);
|
---|
69 | selectedTime.push(Time);
|
---|
70 | InputValue.push(value);
|
---|
71 | }
|
---|
72 | }
|
---|
73 | window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday+'&Date2='+fullday2;
|
---|
74 | });
|
---|
75 |
|
---|
76 | });
|
---|
77 | </script> |
---|