Index: schedule/function/SplitDelete.php
===================================================================
--- schedule/function/SplitDelete.php	(revision 16915)
+++ schedule/function/SplitDelete.php	(revision 16918)
@@ -1,9 +1,11 @@
 <script type="text/javascript">
  $(document).ready(function(){
- var name='';
-var value='';
+ var name;
+var value;
  var timeValue;
 var meas;
 var meas2;
+var x=0;
+var measurement=0;
 var getTableId;
 var is=0;
@@ -282,4 +284,5 @@
 getTableId =get;
 name="name"; value = '#table2';
+measurement = 0;
 						  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name'); 
 						split2();    }else{   alert("please enter value for time to add measurement");   }
@@ -343,5 +346,5 @@
 					aa = $(this).val();
 					});
-			if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name');  meas = "hidden"; meas2 = true;  getTableId = $(this).attr('name');  split2();    }else{   alert("please enter value for time to add measurement");   }
+			if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name'); measurement = 1; meas = "hidden"; meas2 = true;  getTableId = $(this).attr('name');  split2();    }else{   alert("please enter value for time to add measurement");   }
 
 				
@@ -462,5 +465,5 @@
 getTableId =get;
 name="name"; value = '#table1';
-						
+						measurement = 0;
   meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name'); 
 split2();    }else{   alert("please enter value for time to add measurement");   }
@@ -525,5 +528,5 @@
 					});
 			
-			if(aa != ""){ timeValue = aa; name="name"; value="#table1"; meas = "hidden"; meas2 = true;  getTableId = $(this).attr('name'); split2();    }else{   alert("please enter value for time to add measurement");   }
+			if(aa != ""){ timeValue = aa; name="name"; value="#table1"; measurement=1; meas = "hidden"; meas2 = true;  getTableId = $(this).attr('name'); split2();    }else{   alert("please enter value for time to add measurement");   }
 
 				
@@ -577,5 +580,5 @@
 			table.setAttribute('id',"table"+cnt);
 			table.setAttribute('width','100%');
-			table.setAttribute(name,value);
+			if(measurement==1){ table.setAttribute(name,value); }
 		var tr = document.createElement('tr');
 			tr.setAttribute('id','');
@@ -604,5 +607,5 @@
 			button.setAttribute('id','btnAddTime'),
 			button.setAttribute(meas,meas2),
-			button.setAttribute('name','#table'+cnt),
+			button.setAttribute('name','table'+cnt),
 			
 			button.onclick=function(){
@@ -611,5 +614,7 @@
 					aa = $(this).val();
 					});
-					bb =  $(this).closest('table').attr('name'); 
+					
+					if(value == 'undefined'){  bb =  $(this).closest('table').attr('name'); }else{
+					 bb = value; }
 			if(aa != ""){var splitting = aa.split(':'); var add = 01;   
 
@@ -630,5 +635,5 @@
 					var s = 0; var	get;
 						var nn;
-						nn = bb;
+						nn = '#'+$(this).attr("name");
 				$("table").each(function() {
 				if($(this).attr("name")==nn){
@@ -645,5 +650,5 @@
 
 name="name"; value = bb;
-meas = "class"; meas2 = "time";  getTableId = get;   split1();    }else{   alert("please enter value for time to add measurement");   }
+meas = "class"; meas2 = "time";  getTableId = get; measurement =0;   split1();    }else{   alert("please enter value for time to add measurement");   }
 
 				
@@ -702,10 +707,24 @@
 			button.setAttribute('name','#table'+cnt),
 			button.onclick=function(){
-		var aa;
-		var bb;
+		var aa,cc=0;
+		var bb,dd;
 			$('div#TableHolder #table'+cnt+' #Time').each(function(){
 					aa = $(this).val();
+					
+					
+					
 					});
-		bb =  $(this).closest('table').attr('name'); 
+					 dd= $(this).attr('name');
+					//alert(dd);
+					if($('div#TableHolder '+dd+' #Time').is(':visible')){
+					cc=0;
+					//alert(cc);
+					}else{
+					cc=1;
+					}
+					//alert(value);
+					 x = 1;
+					if(meas2 == 'time' && measurement == 0 && cc != 1){  bb =  '#'+$(this).closest('table').attr('id'); }else{
+					 bb = value; } 
 			if(aa != "")
 			{ 
@@ -717,4 +736,6 @@
 				meas2 = true;
 				getTableId = $(this).attr('name'); 
+				//alert(getTableId);
+				measurement = 1;
 				split1();    
 			}
@@ -772,5 +793,5 @@
 			table.setAttribute('id',"table"+cnt);
 			table.setAttribute('width','100%');
-			table.setAttribute(name,value);
+				if(measurement==1){ table.setAttribute(name,value); }
 		var tr = document.createElement('tr');
 			tr.setAttribute('id','');
@@ -797,5 +818,5 @@
 			button.setAttribute('id','btnAddTime'),
 			button.setAttribute(meas,meas2),
-			button.setAttribute('name','#table'+cnt),
+			button.setAttribute('name','table'+cnt),
 			
 			button.onclick=function(){
@@ -804,5 +825,6 @@
 					aa = $(this).val();
 					});
-					bb =  $(this).closest('table').attr('name'); 
+						if(value == 'undefined'){  bb =  $(this).closest('table').attr('name'); }else{
+					 bb = value; }
 			if(aa != ""){ var splitting = aa.split(':'); var add = 01;   
 
@@ -835,5 +857,5 @@
 				});
 
-				name="name"; value=bb;		meas = "class"; meas2 = "time";   getTableId = get; split1();    }else{   alert("please enter value for time to add measurement");   }
+				name="name"; value=bb;	measurement=0;	meas = "class"; meas2 = "time";   getTableId = get; split1();    }else{   alert("please enter value for time to add measurement");   }
 
 				
@@ -890,15 +912,24 @@
 			button.setAttribute('type','button'),
 			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
+			button.setAttribute('id','btnAddTimes'),
 			button.setAttribute('name','#table'+cnt),
 			button.onclick=function(){
 		
-			var aa;
-		var bb;
+			var aa,cc=0;
+		var bb,dd;
 			$('div#TableHolder #table'+cnt+' #Time').each(function(){
 					aa = $(this).val();
+					
 					});
-			
-						bb =  $(this).closest('table').attr('name'); 
+					dd= $(this).attr('name');
+					if($('div#TableHolder '+dd+' #Time').is(':visible')){
+					cc=0;
+					//alert(cc);
+					}else{
+					cc=1;
+					}
+			 x=1;
+						if(meas2 == 'time' && measurement == 0 && cc!=1){  bb =  '#'+$(this).closest('table').attr('id'); }else{
+					 bb = value; }
 					
 			if(aa != "")
@@ -911,4 +942,5 @@
 				meas2 = true;
 				getTableId = $(this).attr('name'); 
+				measurement =1;
 				split1();    
 			}
Index: schedule/js/function.js
===================================================================
--- schedule/js/function.js	(revision 16915)
+++ schedule/js/function.js	(revision 16918)
@@ -18,7 +18,27 @@
 			Table.push(id);
 		});
+		alert(Table);
 		GetSaveData(Time,Data,Source,Measure); // Function call of saving the data
+	});
+	
+	/*$('#update').click(function(){
+		Time = [];
+		Data = [];
+		Source = [];
+		Measure = [];
+		Table = [];
+		$('div#TableHolder table').each(function(){
+			id=$(this).attr('id');
+			Table.push(id);
+			Time.push('#'+id+' input#Time');
+			Data.push('#'+id+' input#txtData');
+			Source.push('#'+id+' select#source :selected');
+			Measure.push('#'+id+' select#measurement :selected');
+			Table.push(id);
+		});
 		alert(Table);
-	});
+		GetUpdatedData(Time,Data,Source,Measure);
+	});*/
+
 	
 };
@@ -33,4 +53,5 @@
 	for(i=0;i<$('div#TableHolder table').length;i++)
 	{
+		//Table[i].val();
 		$(Time[i]).each(function(){
 			TimeSave.push($(this).val()); // extracting each data into a value
@@ -45,4 +66,5 @@
 			MeasureSave.push($(this).val()); // extracting each data into a value
 		});
+		alert(DataSave);
 	}
 	if($('#save').val()=='UPDATE')
@@ -93,2 +115,42 @@
 	
 };
+/*
+function GetUpdatedData(Time,Data,Source,Measure){
+	var checks=0;
+	TimeSave = [];
+	DataSave = [];
+	SourceSave = [];
+	MeasureSave = [];
+	for(i=0;i<Time.length;i++)
+	{
+		$(Time[i]).each(function(){
+			TimeSave.push($(this).val());
+		});
+		$(Data[i]).each(function(){
+			DataSave.push($(this).val());
+		});
+		$(Source[i]).each(function(){
+			SourceSave.push($(this).val());
+		});
+		$(Measure[i]).each(function(){
+			MeasureSave.push($(this).val());
+		});
+	}
+	if(checks == 0)
+	{
+		$.ajax({
+			type: "POST",
+			cache: false,
+			url: "Transaction/update.php",
+			data: "Time="+TimeSave+'&Source='+SourceSave+'&measure='+MeasureSave+'&Data='+DataSave+'&Date='+year+'-'+month+'-'+day,
+			success: function(data) {
+				alert('Successfully updated ! '+year+'-'+month+'-'+day);
+			}
+		});
+	}
+	else
+	{
+
+	alert("Please fill all the details!");
+	}
+}*/
