source: schedule/js/function.js@ 17433

Last change on this file since 17433 was 17422, checked in by tanio, 11 years ago
File size: 2.8 KB
Line 
1// This module prepare by : Jaypee Tanio
2// June 16, 2013
3
4function GetDate(d,m,y)
5{
6 $('document').ready(function(){
7 /*var currentdate = new Date();
8 var datetime = currentdate.getFullYear()+ "-"+(currentdate.getMonth()+1)
9 + "-" + (currentdate.getDay()+1); /* + " @ "
10 + currentdate.getHours() + ":"
11 + currentdate.getMinutes() + ":" + currentdate.getSeconds(); */
12 var Gdate = y+'-'+m+'-'+d;
13 //alert(Gdate);
14 $('#save').click(function(){
15 if($('#save').val()=='SAVE')
16 {
17 $('.datalisting').each(function(){
18 var get_seq = 0;
19 get_time = $(this).find(".time").val();
20 countchild = $(this).find(".tr").length;
21 $(this).find(".tr").each(function(){
22
23 get_measure = $(this).find(".measure").val();
24 get_source = $(this).find(".source").val();
25 get_selected = $(this).find(".selected").val();
26 GetSaveData(get_time, get_selected, get_source, get_measure, Gdate,get_seq);
27 get_seq++;
28 });
29 });
30 }
31 else
32 {
33 GetDelete(Gdate);
34 $('.datalisting').each(function(){
35 var get_seq = 0;
36 get_time = $(this).find(".time").val();
37 countchild = $(this).find(".tr").length;
38 $(this).find(".tr").each(function(){
39
40 get_measure = $(this).find(".measure").val();
41 get_source = $(this).find(".source").val();
42 get_selected = $(this).find(".selected").val();
43 GetUpdateData(get_time, get_selected, get_source, get_measure, Gdate,get_seq);
44 get_seq++;
45 });
46 });
47 }
48 });
49
50
51
52 function GetSaveData(Time,Data,Source,Measure,date,seq){
53 //alert("Time:"+Time+" | Measure:"+Measure +" | Source:"+Source+" | Data:"+Data);
54 $.ajax({
55 type: "POST",
56 cache: false,
57 url: "Transaction/insert.php",
58 data: "GTime="+Time+'&Source='+Source+'&measure='+Measure+'&Data='+Data+'&GDate='+date+'&seq='+seq, //posting the data to save
59 success: function(data) {
60 alert('Successfully added ! '+date);
61 //$("#Data").append("Ok"+date);
62
63 }
64 });
65 };
66 function GetDelete(date){
67 //alert('del');
68 $.ajax({
69 type:"POST",
70 cache:false,
71 url:"Transaction/delete.php",
72 data:"Gdate="+date,
73 success:function(data){
74
75 }
76 });
77 };
78 function GetUpdateData(Time,Data,Source,Measure,date,seq){
79 //alert("Time:"+Time+" | Measure:"+Measure +" | Source:"+Source+" | Data:"+Data);
80 $.ajax({
81 type: "POST",
82 cache: false,
83 url: "Transaction/update.php",
84 data: "GTime="+Time+'&Source='+Source+'&measure='+Measure+'&Data='+Data+'&GDate='+date+'&seq='+seq, //posting the data to save
85 success: function(data) {
86 alert('Successfully added ! '+date);
87 //$("#Data").append("Ok"+date);
88
89 }
90 });
91 };
92 });
93};
Note: See TracBrowser for help on using the repository browser.