default batch done in model

This commit is contained in:
gandhimathi 2018-03-23 15:21:14 +05:30
parent e695c63485
commit 0b3ac942dc

View File

@ -47,7 +47,7 @@ class Batch_model extends CI_Model {
public function getBatch()
{
$this->db->select('CU.BatchCode,CU.BatchName,CU.IsActive,CU.BatchDate,US.UniversityID,US.UniversityName');
$this->db->select('CU.BatchCode,CU.BatchName,CU.IsActive,CU.BatchDate,CU.IsDefault,US.UniversityID,US.UniversityName');
$this->db->from(BATCH.' as CU');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID');
$this->db->order_by('CU.CreatedOn','DESC');
@ -106,6 +106,35 @@ class Batch_model extends CI_Model {
$universityDetails = $this->db->get(UNIVERSITY);
return $universityDetails->result();
}
/*
* update default batch
* created by kms
* */
public function updateDefaultBatch($details=null){
$setDefaultBatch['IsDefault']=false;
$setDefaultBatch['UpdatedBy'] = $details['UpdatedBy'];
$setDefaultBatch['UpdatedOn'] = $details['UpdatedOn'];
// $this->db->where('BatchCode',$details['BatchCode']);
$this->db->where('UniversityID',$details['UniversityID']);
$upateStatus=$this->db->update(BATCH, $setDefaultBatch);
if($upateStatus){
$this->db->where('BatchCode',$details['BatchCode']);
$this->db->where('UniversityID',$details['UniversityID']);
$upateAfterStatus=$this->db->update(BATCH, $details);
$result['batchStatus'] = true;
$result['message'] = "Successfully Batch details updated";
}
else {
$result['batchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}