db->select('BaseT.SupplierID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.Exiseregistration, BaseT.TIN, BaseT.PAN,,BaseT.GSTNO,BaseT.GSTRange,BaseT.CollectrateAddress,BaseT.UANumber,BaseT.CreatedOn,BaseT.PaymentID,pmt.PaymentTerms,BaseT.CSTDate');//,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT,pmt.Details'); $this->db->from('T_SupplierDetailsN as BaseT'); $this->db->join('T_PaymentTerms as pmt', 'pmt.PaymentID = BaseT.PaymentID','left'); $query = $this->db->get(); $result = $query->result(); return $result; } /** * To get Config information by config id and config value * @param number $Configvalue :Optional : To get config value * @return $query->result() : This is result of the query (config information) */ function getpayment($Configvalue = '') { $ConfigID = 'C009'; $this->db->select('ConfigValue'); $this->db->from('T_ConfigDetails'); $this->db->where('Config_id ',$ConfigID ); if ($Configvalue!= '') { $this->db->where('ConfigValue !=',$Configvalue ); } $query = $this->db->get(); return $query->result(); } /** * To get Payment information * @param number $payment : Optional : This is payment value * @return array $result : This is result of the query(payment information) */ function getPaymentTerms($payment = '') { $this->db->select('*'); $this->db->from('T_PaymentTerms'); $query = $this->db->get(); $result = $query->result(); return $result; } /** * To Check PAN number is already exists are not * @param number $SID : Optional : This is Supplier ID * @param number $PAN : To get PAN number from the controller - for check purpose if already exists are not * @return $query->result_array() : This is result of the query (PAN Number information based on supplier ID) */ function checkPAN($PAN,$SID = '') { $this->db->select('PAN'); $this->db->from('T_SupplierDetailsN'); $this->db->where('PAN',$PAN); if ($SID != '') { $this->db->where('SupplierID !=',$SID); } $query = $this->db->get(); if ($query->num_rows > 0) { return $query->result_array(); } } /** * To Check GST number is already exists are not * @param number $SID :Optional: This is Supplier ID * @param number $GST : This is GST number from the controller - for check purpose if already exists are not * @return $query->result_array() : This is result of the query (This is GST Number information based on supplier ID) */ function checkGST($GST,$SID = '') { $this->db->select('GSTNO'); $this->db->from('T_SupplierDetailsN'); $this->db->where('GSTNO',$GST); if ($SID != '') { $this->db->where('SupplierID !=',$SID); } $query = $this->db->get(); if ($query->num_rows > 0) { return $query->result_array(); } } /** * To Store the values * @param number $supplier : This will have all the Supplier information * @return $SID : This will return how many value are inserted (return as number/count) */ function addNewsupplier($supplier) { $this->db->insert('T_SupplierDetailsN', $supplier); $SID = $this->db->affected_rows(); return $SID; } /** * To get Supplier information on respective supplier id * @param number $supplierID : Optional : This is Supplier ID * @return $query->result() : This is result of the query */ function getSupplierInfo($supplierID='') { $this->db->select('SD.*,PT.PaymentTerms'); $this->db->from('T_SupplierDetailsN SD'); $this->db->join('T_PaymentTerms PT','PT.PaymentID = SD.PaymentID','left'); $this->db->where('SD.SupplierID', $supplierID); $query = $this->db->get(); return $query->result(); } /** * To get the Supplier Address on respective Supplier ID * @param number $supplierID : This is Supplier ID * @return $query->result_array() : This is result of the query (Supplier's address information) */ function GetSupplierAddress($supplierID) { $this->db->select('Address'); $this->db->from('T_SupplierDetailsN'); $this->db->where('SupplierID', $supplierID); $query = $this->db->get(); return $query->result_array(); } /** * To Update the values of supplier on respective Supplier ID * @param number $supplier : Thiss will have all theedited Supplier information * @param number $supplierID : This is Supplier ID */ function UpdateSupplier($supplier, $supplierID) { $this->db->where('SupplierID', $supplierID); $this->db->update('T_SupplierDetailsN', $supplier); return TRUE; } /** * To updated the Supplier information * @param number $supplier : This will have all the Supplier information * @param number $supplierID : This is Supplier ID * * Note : This function Temporary not in use */ function viewsupplier($supplier, $supplierID) { $this->db->where('SupplierID', $supplierID); $this->db->update('T_SupplierDetailsN', $supplier); return TRUE; } /** * To store the Supplier Certificate details * @param number $cerificate : This will have all the Supplier information of from the controller * * Note : This function Temporary not in use */ function SupplierCertification($cerificate) { $this->db->insert_id('T_Supplier_Certification',$cerificate); $insert_id = $this->db->affected_rows(); return $insert_id; } function checkSupplierExists($supp_name) { $this->db->select('SupplierID,SupplierName,Address'); $this->db->from('T_SupplierDetailsN'); $this->db->like('REPLACE(SupplierName, " ", "")', $supp_name); $query = $this->db->get(); return $query->result(); } /** * To get Supplier's information for export xl */ function export_excel(){ $this->db->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN, det.PAN,det.CSTNO,det.CSTDate,det.GSTNO,det.GSTRange,det.CollectrateAddress,det.UANumber,pmt.PaymentTerms,emp.firstname ,emp1.firstname as Update_by,det.IsActive, det.Cert_EMS,det.Cert_TS,det.Cert_OSHAS,det.Cert_ISO,det.Cert_IMS,det.BankAcNumber,det.IFSCCode,det.BranchName,det.BankAddress, det.IsService,det.IsMaintanance,det.IsRawMaterial'); $this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left'); $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left'); $this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left'); $this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left'); $this->db->join('T_PaymentTerms as pmt', 'pmt.PaymentID = det.PaymentID','left'); return $this->db->get('T_SupplierDetailsN as det')->result_array(); } } ?>