Index: schedule/js/function.php
===================================================================
--- schedule/js/function.php	(revision 16930)
+++ schedule/js/function.php	(revision 16930)
@@ -0,0 +1,153 @@
+ <div id="saving">
+ 
+ <script type="text/javascript"> 
+	$(document).ready(function GetDate(day ,month ,year){
+	 // for fupdate
+	<?php
+	
+	
+	
+		$cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
+		$rowcnt=mysql_fetch_array($cntsource);
+		$Total= $rowcnt['SourceID'];
+	?>
+	$('#save').click(function(){
+var dtr;
+	dtr = '<?php 
+		 
+		 if(isset($_GET['days'])){ 
+						echo $_GET['days'];
+						 }
+						 else
+						 {
+						 
+					echo date("Y-m-d");
+						 
+						 }
+		 
+		  ?>';
+		
+		var InputValue = [];
+		var selectedSource = [];
+		var selectedTime = [];
+		var selectedMeasurement = [];
+		var Time;
+		var Source;
+		var measure;
+		var value;
+		var checks = 0;
+		for(var i=1;i <= cnt;i++)
+		{
+			if($('#Time'+i).val() != '')
+			{
+				Time=$('#Time'+i).val();
+				Source=$('select[id="source'+i+'"]').val();
+				measure=$('select[id="measurement'+i+'"]').val();
+				value=$('#txtData'+i).val();
+				selectedMeasurement.push(measure);
+				selectedSource.push(Source);
+				selectedTime.push(Time);
+				InputValue.push(value);
+				
+			}
+			else
+			{
+			checks++;
+			
+			}
+		}
+		if(checks == 0)
+		{
+		alert(dtr);
+		$.ajax({
+			type: "POST",
+			cache: false,
+			url: "Transaction/insert.php",
+			data: "Time="+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+dtr,
+			dataType: "json",
+			success: function(data) {
+				alert('Success: The text is now stored in the database.');
+			}
+		});
+		//window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+dtr;
+		}
+		else
+		{
+	
+		alert("Please fill all the details!");
+		}
+	});
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	$('#update').click(function()
+	{
+			//alert(dtr);
+		var InputValue = [];
+		var selectedSource = [];
+		var selectedTime = [];
+		var selectedMeasurement = [];
+		var Time;
+		var Source;
+		var measure;
+		var value;
+		var checks = 0;
+		for(var i=1;i <= cnt;i++)
+		{
+			if($('#Time'+i).val() != '')
+			{
+				Time=$('#Time'+i).val();
+				Source=$('select[id="source'+i+'"]').val();
+				measure=$('select[id="measurement'+i+'"]').val();
+				value=$('#txtData'+i).val();
+				selectedMeasurement.push(measure);
+				selectedSource.push(Source);
+				selectedTime.push(Time);
+				InputValue.push(value);
+				
+			}else{
+			checks++;
+			
+			}
+		}
+		
+		if(checks == 0)
+		{
+		
+		$.ajax({
+			type: "POST",
+			cache: false,
+			url: "Transaction/update.php",
+			data: "Time="+selectedTime,
+			dataType: "json",
+			success: function(data) {
+				alert('Success: The text is now stored in the database.');
+			}
+		});
+		//window.location = 'Transaction/update.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+dtr;
+		}
+	else
+	{
+	
+	alert("Please fill all the details!");
+	}
+	});
+	
+	
+	
+	
+	
+	
+	
+	
+	});
+ </script>
+ </div>
