| Server IP : 14.225.204.176 / Your IP : 216.73.216.6 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/wit-crm/modules/commission/helpers/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/**
* add commission staff
* @param integer
*/
function add_commission_staff($payment_id) {
$CI = &get_instance();
$CI->load->model('commission/commission_model');
$result = $CI->commission_model->add_commission($payment_id);
if ($result == true) {
return 1;
}
return 0;
}
/**
* delete commission staff
* @param integer
*/
function delete_commission_staff($invoice_id) {
$CI = &get_instance();
$CI->db->where('invoice_id', $invoice_id);
$CI->db->delete(db_prefix().'commission');
if ($CI->db->affected_rows() > 0) {
return 1;
}
return 0;
}
/**
* get commission
* @param string $staffid
* @param string $date
* @return integer
*/
function get_commission($staffid = '', $date = '') {
if ($staffid == '') {
$staffid = get_staff_user_id();
}
if ($date == true) {
$count = sum_from_table(db_prefix() . 'commission', array('field' => 'amount', 'where' => array('staffid' => $staffid, 'year(date)' => date('Y'), 'month(date)' => date('m'))));
if ($count) {
return $count;
}
return 0;
}
$count = sum_from_table(db_prefix() . 'commission', array('field' => 'amount', 'where' => array('staffid' => $staffid)));
if ($count) {
return $count;
}
return 0;
}
function check_applicable_client($clientid){
$CI = &get_instance();
$CI->db->where('applicable_staff', $clientid);
$CI->db->where('is_client', 1);
$applicable_staff = $CI->db->get(db_prefix().'applicable_staff')->result_array();
if ($applicable_staff) {
return true;
}
return false;
}
/**
* get status modules for all
* @param string $module_name
* @return boolean
*/
function commission_get_status_modules_all($module_name){
$CI = &get_instance();
$sql = 'select * from '.db_prefix().'modules where module_name = "'.$module_name.'" AND active =1 ';
$module = $CI->db->query($sql)->row();
if($module){
return true;
}else{
return false;
}
}