121 lines
3.4 KiB
PHP
Executable File
121 lines
3.4 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by Visual Studio Code.
|
|
* User: Surendiran
|
|
* Date: 11/13/17
|
|
* Time: 8:03 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Status_model extends CI_Model {
|
|
|
|
/*
|
|
* add status details
|
|
* params:StatusID,StatusName,activestatus
|
|
* created by Surendiran
|
|
* */
|
|
|
|
public function addstatus($arrayDetails=null)
|
|
{
|
|
$this->db->select('ListCode');
|
|
$this->db->where('ListGroup', '1');
|
|
$this->db->where('ListName', $arrayDetails['ListName']);
|
|
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
|
|
$result['Status'] = false;
|
|
$result['message'] = "Status name is already exist!";
|
|
} else {
|
|
$this->db->insert(PICK_LIST_DETAILS, $arrayDetails);
|
|
if($this->db->affected_rows() == '1'){
|
|
$result['Status'] = true;
|
|
$result['message'] = "Successfully status details added";
|
|
}
|
|
else {
|
|
$result['Status'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
|
|
}
|
|
// $checkExistActivity = $this->db->get(PICK_LIST_DETAILS);
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
* get status details
|
|
* parama id
|
|
* created by Surendiran
|
|
* */
|
|
|
|
public function getStatus()
|
|
{
|
|
$this->db->select('ListCode,ListName,IsActive');
|
|
$this->db->where('ListGroup','1');
|
|
$this->db->order_by('ListCode','DESC');
|
|
$statusDetails = $this->db->get(PICK_LIST_DETAILS);
|
|
if($statusDetails->result()){
|
|
|
|
$result['Status'] = true;
|
|
$result['details'] = $statusDetails->result();
|
|
}
|
|
else {
|
|
$result['Status'] = false;
|
|
$result['message'] = "No records found!";
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
/*
|
|
* update status details
|
|
* created by Surendiran
|
|
* */
|
|
|
|
public function update($arrayDetails=null,$ListCode=null)
|
|
{
|
|
$this->db->select('ListName');
|
|
$this->db->where('ListName', $arrayDetails['ListName']);
|
|
$this->db->where_not_in('ListCode', $ListCode);
|
|
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
|
|
$result['Status'] = false;
|
|
$result['message'] = "Status name is already exist!";
|
|
} else {
|
|
$this->db->where('ListCode',$ListCode);
|
|
$this->db->update(PICK_LIST_DETAILS, $arrayDetails);
|
|
if($this->db->affected_rows() == '1'){
|
|
$result['Status'] = true;
|
|
$result['message'] = "Successfully status details updated";
|
|
}
|
|
else {
|
|
$result['Status'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
public function getStatusBranchList( $id ) {
|
|
$this->db->select('BranchCode, BranchName');
|
|
$this->db->from(BRANCH);
|
|
$getBranchDetails = $this->db->get();
|
|
$branchDetails = $getBranchDetails->result();
|
|
if (count($branchDetails) > 0) {
|
|
$results['branchListStatus'] = true;
|
|
$results['branch_list_details'] = $branchDetails;
|
|
} else {
|
|
$results['branchListStatus'] = false;
|
|
$results['message'] = "Branch Is Not Avail.";
|
|
}
|
|
return $results;
|
|
}
|
|
|
|
public function getBranchStatusList($branchCode) {
|
|
echo $branchCode;exit();
|
|
}
|
|
|
|
} |