166 lines
3.7 KiB
PHP
Executable File
166 lines
3.7 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class Companydetails_model extends Model
|
|
{
|
|
/**
|
|
* This function is used to get the user listing count
|
|
* @param string $searchText : This is optional search text
|
|
* @return number $count : This is row count
|
|
*/
|
|
|
|
//inserted data into companydetails table//
|
|
function Companyadd($Company)
|
|
{
|
|
$builder = $this->db->table('t_company_details');
|
|
$builder->insert($Company);
|
|
$res = $this->db->affectedRows();
|
|
return $res;
|
|
}
|
|
|
|
|
|
//inserted data into file table//
|
|
function filedetails($myfile)
|
|
{
|
|
$builder = $this->db->table('file');
|
|
$builder->insert($myfile);
|
|
$res = $this->db->affectedRows();
|
|
return $res;
|
|
}
|
|
|
|
|
|
//for listing file//
|
|
function filelist()
|
|
{
|
|
$sql = " select ID,filename,filedescription,createdDate from file where isDeleted IS NULL OR isDeleted=0";
|
|
$query = $this->db->query($sql);
|
|
return $query->getResult();
|
|
}
|
|
|
|
|
|
//for deleting file//
|
|
function deletefile($ID, $userInfo)
|
|
{
|
|
$this->db->table('file')
|
|
->where('ID', $ID)
|
|
->update($userInfo);
|
|
$res = $this->db->affectedRows();
|
|
return $res;
|
|
}
|
|
|
|
|
|
|
|
function Updatecompany($Comp, $CompID)
|
|
{
|
|
$this->db->table('t_company_details')
|
|
->where('CompID', $CompID)
|
|
->update($Comp);
|
|
$res = $this->db->affectedRows();
|
|
return $res;
|
|
}
|
|
|
|
|
|
function checkPhotoExists($Pic)
|
|
{
|
|
$builder = $this->db->table('t_company_details')
|
|
->select('ProfilePic')
|
|
->where($Pic);
|
|
$query = $builder->get();
|
|
if ($query->getNumRows() > 0) {
|
|
return $query->getResultArray();
|
|
}
|
|
}
|
|
|
|
// updated by //
|
|
function companylisting()
|
|
{
|
|
$builder = $this->db->table('t_company_details com')
|
|
->select('com.*,emp.firstname,pmt.PaymentTerms,tbl.userId')
|
|
->join('t_paymentterms pmt', 'com.paymentID = pmt.PaymentID', 'left')
|
|
->join('tbl_users as tbl', ' com.Createdby = tbl.userId', 'left')
|
|
->join('t_employee_details as emp', 'emp.empid=tbl.empid', 'left');
|
|
$query = $builder->get();
|
|
$result = $query->getResult();
|
|
return $result;
|
|
}
|
|
|
|
// dropdown for payaple terms @ companydetails//
|
|
// function getpayment($Configvalue = '')
|
|
// {
|
|
// $ConfigID = 'C009';
|
|
// ->select('ConfigValue');
|
|
// $builder = $this->db->table('t_configdetails');
|
|
// $this->db->where('Config_ID ',$ConfigID );
|
|
// $query =$builder->get();
|
|
// return $query->getResult();
|
|
// }
|
|
function getPaymentTerms()
|
|
{
|
|
$builder = $this->db->table('t_paymentterms')->select('*');
|
|
$query = $builder->get();
|
|
$result = $query->getResult();
|
|
return $result;
|
|
}
|
|
|
|
|
|
// dropdown for file description @ companydetails//
|
|
function getfilename($Configvalue = '')
|
|
{
|
|
$ConfigID = 'C025';
|
|
$builder = $this->db->table('t_configdetails')->select('ConfigValue')
|
|
->where('Config_ID ', $ConfigID);
|
|
$query = $builder->get();
|
|
return $query->getResult();
|
|
}
|
|
|
|
|
|
// for display the bankdetails//
|
|
function getBankDetails()
|
|
{
|
|
|
|
$builder = $this->db->table('t_bank_details')->select('*');
|
|
|
|
$query = $builder->get();
|
|
$result = $query->getResult();
|
|
return $result;
|
|
}
|
|
|
|
// for add and update the bankdetails//
|
|
function BankDetails($Bank)
|
|
{
|
|
$bankname = $Bank['Bank_name'];
|
|
$bankifsc = $Bank['IFSC'];
|
|
$count = 0;
|
|
|
|
$builder = $this->db->table('t_bank_details')->select('count(*) as count')
|
|
->where('Bank_name', $bankname)
|
|
->where('IFSC', $bankifsc);
|
|
|
|
$isExits = $builder->get();
|
|
$res = $isExits->getResultArray();
|
|
|
|
|
|
if (!empty($res)) {
|
|
|
|
$count = $res[0]['count'];
|
|
}
|
|
|
|
|
|
if ($count == 0) {
|
|
$builder = $this->db->table('t_bank_details');
|
|
$builder->insert($Bank);
|
|
$res = $this->db->affectedRows();
|
|
return $res;
|
|
} elseif ($count == 1) {
|
|
$this->db->table('t_bank_details')
|
|
->where('Bank_name', $bankname)
|
|
->where('IFSC', $bankifsc)
|
|
->update($Bank);
|
|
$res = $this->db->affectedRows();
|
|
return $res;
|
|
}
|
|
}
|
|
} |