batch master changes done

This commit is contained in:
gandhimathi 2018-04-20 12:36:45 +05:30
parent 3aed74a904
commit 0ba019c118

View File

@ -20,6 +20,7 @@ class Batch_model extends CI_Model {
$this->db->select('BatchCode');
$this->db->where('BatchCode', $arrayDetails['BatchCode']);
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
if($this->db->get(BATCH)->first_row()){
$result['batchStatus'] = false;
$result['message'] = "This batch code is already exist.";
@ -45,11 +46,13 @@ class Batch_model extends CI_Model {
* created by srk
* */
public function getBatch()
public function getBatch($requestedBy=null,$branchCode=null)
{
$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->where('CU.BranchCode',$branchCode);
$this->db->where('US.BranchCode',$branchCode);
$this->db->order_by('CU.CreatedOn','DESC');
$batchDetails = $this->db->get();
@ -63,7 +66,7 @@ class Batch_model extends CI_Model {
$result['message'] = "No records found!";
}
$result['universityDetails'] = $this->getUniversityDetails();
$result['universityDetails'] = $this->getUniversityDetails($requestedBy,$branchCode);
return $result;
@ -76,6 +79,7 @@ class Batch_model extends CI_Model {
public function updateBatch($arrayDetails=null)
{
$this->db->where('BatchCode',$arrayDetails['BatchCode']);
$this->db->where('BranchCode',$arrayDetails['BranchCode']);
$upateStatus=$this->db->update(BATCH, $arrayDetails);
if($upateStatus){
@ -97,11 +101,12 @@ class Batch_model extends CI_Model {
* Get university details
* created by Srk
* */
public function getUniversityDetails()//doubt
public function getUniversityDetails($requestedBy,$branchCode)
{
$this->db->select('UniversityID,UniversityName');
$this->db->order_by('UniversityID','ASC');
$this->db->where('IsActive','1');
$this->db->where('BranchCode',$branchCode);
// $this->db->where_not_in('ID', $id);
$universityDetails = $this->db->get(UNIVERSITY);
return $universityDetails->result();
@ -118,6 +123,7 @@ class Batch_model extends CI_Model {
$setDefaultBatch['UpdatedOn'] = $details['UpdatedOn'];
// $this->db->where('BatchCode',$details['BatchCode']);
$this->db->where('UniversityID',$details['UniversityID']);
$this->db->where('BranchCode',$details['BranchCode']);
$upateStatus=$this->db->update(BATCH, $setDefaultBatch);
if($upateStatus){
$this->db->where('BatchCode',$details['BatchCode']);