course details changes done
This commit is contained in:
parent
48f57757cd
commit
dcd72f3623
118
Apollo/api/application/models/DaybookMaster_model.php
Normal file
118
Apollo/api/application/models/DaybookMaster_model.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: karthi
|
||||
* Date: 12/26/17
|
||||
* Time: 4:10 PM
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class DaybookMaster_model extends CI_Model {
|
||||
|
||||
/*
|
||||
* add day book details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function addDetails($arrayDetails=null)
|
||||
{
|
||||
$this->db->select('TypeName');
|
||||
$this->db->where('TypeName', $arrayDetails['TypeName']);
|
||||
$this->db->where('TypeID', $arrayDetails['TypeID']);
|
||||
if($this->db->get(INCOMEOUTCOMEMASTER)->first_row()){
|
||||
$result['addStatus'] = false;
|
||||
$result['message'] = "Name is already exist!";
|
||||
} else {
|
||||
$this->db->insert(INCOMEOUTCOMEMASTER, $arrayDetails);
|
||||
if($this->db->affected_rows() == '1'){
|
||||
$result['addStatus'] = true;
|
||||
$result['message'] = "Successfully day book details is added";
|
||||
}
|
||||
else {
|
||||
$result['addStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* get day book details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function getDayBookDetails($requestedBy=null)
|
||||
{
|
||||
$this->db->select('IOM.ID,IOM.TypeName,IOM.TypeID,IOM.IsActive,PLD.ListName');
|
||||
|
||||
$this->db->from(INCOMEOUTCOMEMASTER .' as IOM');
|
||||
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = IOM.TypeID');
|
||||
$this->db->order_by('IOM.ID','DESC');
|
||||
$details = $this->db->get();
|
||||
if($details->result()){
|
||||
|
||||
$result['daybookStatus'] = true;
|
||||
$result['details'] = $details->result();
|
||||
}
|
||||
else {
|
||||
$result['daybookStatus'] = false;
|
||||
$result['message'] = "No records found!";
|
||||
}
|
||||
$result['getDayBooktype'] = $this->getDayBookType('10');
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
/*
|
||||
* get day book type
|
||||
* created by kms
|
||||
* */
|
||||
public function getDayBookType($typeID=null){
|
||||
$this->db->select('ListCode,ListName');
|
||||
$this->db->where('ListGroup', $typeID);
|
||||
$typeDetails=$this->db->get(PICK_LIST_DETAILS);
|
||||
return $typeDetails->result();
|
||||
}
|
||||
/*
|
||||
* update day book details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function updateDayBook($arrayDetails=null)
|
||||
{
|
||||
$this->db->select('TypeName');
|
||||
$this->db->where('TypeName', $arrayDetails['TypeName']);
|
||||
$this->db->where('TypeID', $arrayDetails['TypeID']);
|
||||
$this->db->where_not_in('ID', $arrayDetails['ID']);
|
||||
if($this->db->get(INCOMEOUTCOMEMASTER)->first_row()){
|
||||
$result['updateStatus'] = false;
|
||||
$result['message'] = "Name is already exist!";
|
||||
} else {
|
||||
$this->db->where('ID',$arrayDetails['ID']);
|
||||
$this->db->update(INCOMEOUTCOMEMASTER, $arrayDetails);
|
||||
if($this->db->affected_rows() == '1'){
|
||||
$result['updateStatus'] = true;
|
||||
$result['message'] = "Successfully day book details is updated";
|
||||
}
|
||||
else {
|
||||
$result['updateStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user