<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php   
    require "commonincludefiles.php";
	
	$rs = dbQuery("select * from cms_feesreceivemaster fm,cms_feesreceivedetail fd where fd.head_id=5 and fm.feesreceive_id=fd.feesreceive_id order by fm.year_id,fm.branch_id,fm.semester_id,fm.student_id");
	
	if(dbRows($rs) > 0)
	{
		$i=0;
		while($row = dbArray($rs))
		{
			$Qry1 = "";
			//$Qry1 .= "feesreceive_id   ='"  .Escape($this->feesreceive_id)."',";
			$Qry1 .= "gtuhead_id   ='5',";
			$Qry1 .= "branch_id   ='"  .$row['branch_id']."',";
			$Qry1 .= "semester_id   ='"  .$row['semester_id']."',";
			$Qry1 .= "division   ='"  .$row['division_id']."',";
			$Qry1 .= "student_id   ='"  .$row['student_id']."',";
			$Qry1 .= "noofsub   ='0',";
			$Qry1 .= "receive_amount   ='550',";
			$Qry1 .= "paid   ='1',";
			$Qry1 .= "year_id='"	.$row['year_id']."',";
			if($Qry1 != ""){
			$Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
			$qry = "insert into cms_gtufeesreceive set " . $Qry1 . " ";
			dbQuery($qry);
			echo $row['student_id'].",".$row['semester_id'];
			$i++;
		}
		
		}
		echo $i ." rows inserted!";
	}
	
	?>
</body>
</html>