<?php
class cms_gtufeesheadMgmt
{
	public $gtuhead_id;
	public $college_id;
	public $gtuhead_name;
	public $gtuhead_amount;
	public $max_amount;
	public $gtufee_type;
	public $head_active;
	public $year_id;


	function getAllRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "")
	{
		$qry = "SELECT * FROM cms_gtufeeshead WHERE college_id = '" . $_SESSION["VedantnrCollegeId"] . "'";

		if ($condition != "") {
			$qry .= $condition;
		}
		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}

		if (intval($limit) > 0 && intval($start) >= 0) {
			$qry .= " Limit $start , $limit";
		}

		$out = dbQuery($qry);
		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}


	function add()
	{
		$Qry1 = "";
		$Qry1 .= "gtuhead_id   ='" . Escape($this->gtuhead_id) . "',";

		$Qry1 .= "college_id='" . Escape($_SESSION['VedantnrCollegeId']) . "',";
		$Qry1 .= "gtuhead_name   ='" . Escape($this->gtuhead_name) . "',";
		$Qry1 .= "gtuhead_amount   ='" . Escape($this->gtuhead_amount) . "',";
		$Qry1 .= "max_amount   ='" . Escape($this->max_amount) . "',";
		$Qry1 .= "gtufee_type   ='" . Escape($this->gtufee_type) . "',";
		$Qry1 .= "head_active   ='" . Escape($this->head_active) . "',";
		$Qry1 .= "year_id='" . Escape($this->year_id) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "insert into cms_gtufeeshead set " . $Qry1 . " ";
			dbQuery($qry);
			$this->gtuhead_id = dbInsertedId();
		}

	}

	function edit()
	{
		$Qry1 = "";
		$Qry1 .= "gtuhead_id   ='" . Escape($this->gtuhead_id) . "',";
		$Qry1 .= "college_id='" . Escape($_SESSION['VedantnrCollegeId']) . "',";
		$Qry1 .= "gtuhead_name   ='" . Escape($this->gtuhead_name) . "',";
		$Qry1 .= "gtuhead_amount   ='" . Escape($this->gtuhead_amount) . "',";
		$Qry1 .= "max_amount   ='" . Escape($this->max_amount) . "',";
		$Qry1 .= "gtufee_type   ='" . Escape($this->gtufee_type) . "',";
		$Qry1 .= "head_active   ='" . Escape($this->head_active) . "',";
		$Qry1 .= "year_id='" . Escape($this->year_id) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update cms_gtufeeshead set " . $Qry1 . " where  gtuhead_id=" . $this->gtuhead_id;
			dbQuery($qry);
		}

	}


	function delete()
	{
		$qry = "delete from cms_gtufeeshead where gtuhead_id in (" . $this->gtuhead_id . ") ";
		dbQuery($qry);
	}





}/* Code For EXTJS START \n{
xtype: 'textfield',
name: 'gtuhead_id',
id:'gtuhead_id',
allowBlank:false,
tabIndex:1,
labelSeparator:'',
fieldLabel :'gtuhead_id:',
width:100
},
{
xtype: 'textfield',
name: 'college_id',
id:'college_id',
allowBlank:false,
tabIndex:2,
labelSeparator:'',
fieldLabel :'college_id:',
width:100
},
{
xtype: 'textfield',
name: 'gtuhead_name',
id:'gtuhead_name',
allowBlank:false,
tabIndex:3,
labelSeparator:'',
fieldLabel :'gtuhead_name:',
width:100
},
{
xtype: 'textfield',
name: 'gtuhead_amount',
id:'gtuhead_amount',
allowBlank:false,
tabIndex:4,
labelSeparator:'',
fieldLabel :'gtuhead_amount:',
width:100
},
{
xtype: 'textfield',
name: 'max_amount',
id:'max_amount',
allowBlank:false,
tabIndex:5,
labelSeparator:'',
fieldLabel :'max_amount:',
width:100
},
{
xtype: 'textfield',
name: 'gtufee_type',
id:'gtufee_type',
allowBlank:false,
tabIndex:6,
labelSeparator:'',
fieldLabel :'gtufee_type:',
width:100
},
{
xtype: 'textfield',
name: 'head_active',
id:'head_active',
allowBlank:false,
tabIndex:7,
labelSeparator:'',
fieldLabel :'head_active:',
width:100
},
{
xtype: 'textfield',
name: 'year_id',
id:'year_id',
allowBlank:false,
tabIndex:8,
labelSeparator:'',
fieldLabel :'year_id:',
width:100
},
Code For EXTJS END */




/* Code For Save File START 


$objcms_gtufeesheadMgmt= new cms_gtufeesheadMgmt();
$objcms_gtufeesheadMgmt->gtuhead_id=$_POST['gtuhead_id'];
$objcms_gtufeesheadMgmt->college_id=$_POST['college_id'];
$objcms_gtufeesheadMgmt->gtuhead_name=$_POST['gtuhead_name'];
$objcms_gtufeesheadMgmt->gtuhead_amount=$_POST['gtuhead_amount'];
$objcms_gtufeesheadMgmt->max_amount=$_POST['max_amount'];
$objcms_gtufeesheadMgmt->gtufee_type=$_POST['gtufee_type'];
$objcms_gtufeesheadMgmt->head_active=$_POST['head_active'];
$objcms_gtufeesheadMgmt->year_id=$_POST['year_id'];
if($objcms_gtufeesheadMgmt->gtuhead_id == "0" ||  $objcms_gtufeesheadMgmt->gtuhead_id== ""){ 
$objcms_gtufeesheadMgmt->add(); 
} 
else{
if($_REQUEST[act] == "del")
 {$objcms_gtufeesheadMgmt->delete();
 }else
 {$objcms_gtufeesheadMgmt->edit();
}
echo'{"success":"true"}'; 
 }

Code For Save File END */

?>