<?php
class cms_gtufeesreceiveMgmt
{
	public $feesreceive_id;
	public $gtuhead_id;
	public $branch_id;
	public $semester_id;
	public $division;
	public $student_id;
	public $noofsub;
	public $receive_amount;
	public $paid;
	public $year_id;


	function getAllRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "")
	{
		$qry = "SELECT * FROM cms_gtufeesreceive 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 .= "feesreceive_id   ='"  .Escape($this->feesreceive_id)."',";
		$Qry1 .= "gtuhead_id   ='" . Escape($this->gtuhead_id) . "',";
		$Qry1 .= "branch_id   ='" . Escape($this->branch_id) . "',";
		$Qry1 .= "semester_id   ='" . Escape($this->semester_id) . "',";
		$Qry1 .= "division   ='" . Escape($this->division) . "',";
		$Qry1 .= "student_id   ='" . Escape($this->student_id) . "',";
		$Qry1 .= "noofsub   ='" . Escape($this->noofsub) . "',";
		$Qry1 .= "receive_amount   ='" . Escape($this->receive_amount) . "',";
		$Qry1 .= "paid   ='" . Escape($this->paid) . "',";
		$Qry1 .= "year_id='" . Escape($this->year_id) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "insert into cms_gtufeesreceive set " . $Qry1 . " ";
			dbQuery($qry);
			$this->feesreceive_id = dbInsertedId();
		}

	}

	function edit()
	{
		$Qry1 = "";
		$Qry1 .= "feesreceive_id   ='" . Escape($this->feesreceive_id) . "',";
		$Qry1 .= "gtuhead_id   ='" . Escape($this->gtuhead_id) . "',";
		$Qry1 .= "branch_id   ='" . Escape($this->branch_id) . "',";
		$Qry1 .= "semester_id   ='" . Escape($this->semester_id) . "',";
		$Qry1 .= "division   ='" . Escape($this->division) . "',";
		$Qry1 .= "student_id   ='" . Escape($this->student_id) . "',";
		$Qry1 .= "noofsub   ='" . Escape($this->noofsub) . "',";
		$Qry1 .= "receive_amount   ='" . Escape($this->receive_amount) . "',";
		$Qry1 .= "paid   ='" . Escape($this->paid) . "',";
		$Qry1 .= "year_id='" . Escape($this->year_id) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update cms_gtufeesreceive set " . $Qry1 . " where  feesreceive_id=" . $this->feesreceive_id;
			dbQuery($qry);
		}

	}


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

	function checkfeesreceived($condition)
	{
		$qry = "";
		$qry = "SELECT * 
					FROM `cms_gtufeesreceive`
				where 1=1";
		if ($condition != "") {
			$qry .= $condition;
		}
		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			return "1";
		} else {
			return "0";
		}
	}



}/* Code For EXTJS START \n{
xtype: 'textfield',
name: 'feesreceive_id',
id:'feesreceive_id',
allowBlank:false,
tabIndex:1,
labelSeparator:'',
fieldLabel :'feesreceive_id:',
width:100
},
{
xtype: 'textfield',
name: 'gtuhead_id',
id:'gtuhead_id',
allowBlank:false,
tabIndex:2,
labelSeparator:'',
fieldLabel :'gtuhead_id:',
width:100
},
{
xtype: 'textfield',
name: 'branch_id',
id:'branch_id',
allowBlank:false,
tabIndex:3,
labelSeparator:'',
fieldLabel :'branch_id:',
width:100
},
{
xtype: 'textfield',
name: 'semester_id',
id:'semester_id',
allowBlank:false,
tabIndex:4,
labelSeparator:'',
fieldLabel :'semester_id:',
width:100
},
{
xtype: 'textfield',
name: 'division',
id:'division',
allowBlank:false,
tabIndex:5,
labelSeparator:'',
fieldLabel :'division:',
width:100
},
{
xtype: 'textfield',
name: 'student_id',
id:'student_id',
allowBlank:false,
tabIndex:6,
labelSeparator:'',
fieldLabel :'student_id:',
width:100
},
{
xtype: 'textfield',
name: 'noofsub',
id:'noofsub',
allowBlank:false,
tabIndex:7,
labelSeparator:'',
fieldLabel :'noofsub:',
width:100
},
{
xtype: 'textfield',
name: 'receive_amount',
id:'receive_amount',
allowBlank:false,
tabIndex:8,
labelSeparator:'',
fieldLabel :'receive_amount:',
width:100
},
{
xtype: 'textfield',
name: 'paid',
id:'paid',
allowBlank:false,
tabIndex:9,
labelSeparator:'',
fieldLabel :'paid:',
width:100
},
{
xtype: 'textfield',
name: 'year_id',
id:'year_id',
allowBlank:false,
tabIndex:10,
labelSeparator:'',
fieldLabel :'year_id:',
width:100
},
Code For EXTJS END */




/* Code For Save File START 


$objcms_gtufeesreceiveMgmt= new cms_gtufeesreceiveMgmt();
$objcms_gtufeesreceiveMgmt->feesreceive_id=$_POST['feesreceive_id'];
$objcms_gtufeesreceiveMgmt->gtuhead_id=$_POST['gtuhead_id'];
$objcms_gtufeesreceiveMgmt->branch_id=$_POST['branch_id'];
$objcms_gtufeesreceiveMgmt->semester_id=$_POST['semester_id'];
$objcms_gtufeesreceiveMgmt->division=$_POST['division'];
$objcms_gtufeesreceiveMgmt->student_id=$_POST['student_id'];
$objcms_gtufeesreceiveMgmt->noofsub=$_POST['noofsub'];
$objcms_gtufeesreceiveMgmt->receive_amount=$_POST['receive_amount'];
$objcms_gtufeesreceiveMgmt->paid=$_POST['paid'];
$objcms_gtufeesreceiveMgmt->year_id=$_POST['year_id'];
if($objcms_gtufeesreceiveMgmt->feesreceive_id == "0" ||  $objcms_gtufeesreceiveMgmt->feesreceive_id== ""){ 
$objcms_gtufeesreceiveMgmt->add(); 
} 
else{
if($_REQUEST[act] == "del")
 {$objcms_gtufeesreceiveMgmt->delete();
 }else
 {$objcms_gtufeesreceiveMgmt->edit();
}
echo'{"success":"true"}'; 
 }

Code For Save File END */

?>