<?php 

/**
 * SharedController Controller
 * @category  Controller / Model
 */
class SharedController extends BaseController{
	
	/**
     * absent_count_user_id_option_list Model Action
     * @return array
     */
	function absent_count_user_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * month_locking_year_option_list Model Action
     * @return array
     */
	function month_locking_year_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT year AS value,year AS label FROM month_locking ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * user_info_user_role_id_option_list Model Action
     * @return array
     */
	function user_info_user_role_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT role_id AS value, role_name AS label FROM roles";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * user_info_username_value_exist Model Action
     * @return array
     */
	function user_info_username_value_exist($val){
		$db = $this->GetModel();
		$db->where("username", $val);
		$exist = $db->has("user_info");
		return $exist;
	}

	/**
     * user_info_email_value_exist Model Action
     * @return array
     */
	function user_info_email_value_exist($val){
		$db = $this->GetModel();
		$db->where("email", $val);
		$exist = $db->has("user_info");
		return $exist;
	}

	/**
     * user_profile_values_user_id_option_list Model Action
     * @return array
     */
	function user_profile_values_user_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,CONCAT(user_full_name,' (',email,')') AS label FROM user_info WHERE user_role_id=2 ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_name_value_exist Model Action
     * @return array
     */
	function portfolio_name_value_exist($val){
		$db = $this->GetModel();
		$db->where("name", $val);
		$exist = $db->has("portfolio");
		return $exist;
	}

	/**
     * portfolio_configurations_prct_value_1_option_list Model Action
     * @return array
     */
	function portfolio_configurations_prct_value_1_option_list($lookup_pid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? ORDER BY col_name ASC" ;
		$queryparams = array($lookup_pid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_prct_value_2_option_list Model Action
     * @return array
     */
	function portfolio_configurations_prct_value_2_option_list($lookup_pid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? ORDER BY col_name ASC" ;
		$queryparams = array($lookup_pid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_pid_option_list Model Action
     * @return array
     */
	function portfolio_configurations_pid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY name ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_col_name_option_list Model Action
     * @return array
     */
	function portfolio_configurations_col_name_option_list($lookup_pid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? and calculation_type='multivariable' OR IF(STRCMP(?,'All')=0,TRUE,FALSE) and calculation_type='multivariable'  ORDER BY col_name ASC"          ;
		$queryparams = array($lookup_pid,$lookup_pid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_prct_value_1_option_list_2 Model Action
     * @return array
     */
	function portfolio_configurations_prct_value_1_option_list_2($lookup_pid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? OR IF(STRCMP(?,'All')=0,TRUE,FALSE) ORDER BY id ASC "        ;
		$queryparams = array($lookup_pid,$lookup_pid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_prct_value_2_option_list_2 Model Action
     * @return array
     */
	function portfolio_configurations_prct_value_2_option_list_2($lookup_pid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? OR IF(STRCMP(?,'All'),TRUE,FALSE) ORDER BY id ASC "     ;
		$queryparams = array($lookup_pid,$lookup_pid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_prct_value_operation_option_list Model Action
     * @return array
     */
	function portfolio_configurations_prct_value_operation_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT department AS value,department AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_employee_name_value_exist Model Action
     * @return array
     */
	function employee_details_employee_name_value_exist($val){
		$db = $this->GetModel();
		$db->where("employee_name", $val);
		$exist = $db->has("employee_details");
		return $exist;
	}

	/**
     * employee_details_portfolio_id_option_list Model Action
     * @return array
     */
	function employee_details_portfolio_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT  id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_bank_name_option_list Model Action
     * @return array
     */
	function employee_details_bank_name_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT bank_name AS value,bank_name AS label FROM bank_name ";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_email_value_exist Model Action
     * @return array
     */
	function employee_details_email_value_exist($val){
		$db = $this->GetModel();
		$db->where("email", $val);
		$exist = $db->has("employee_details");
		return $exist;
	}

	/**
     * employee_details_department_option_list Model Action
     * @return array
     */
	function employee_details_department_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT department AS value,department AS label FROM department_master ";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_designation_option_list Model Action
     * @return array
     */
	function employee_details_designation_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT designation AS value,designation AS label FROM designation_master ";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_payscale_option_list Model Action
     * @return array
     */
	function employee_details_payscale_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT payscale AS value,payscale AS label FROM payscale_masters ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_employee_type_option_list Model Action
     * @return array
     */
	function employee_details_employee_type_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT employee_type AS value,employee_type AS label FROM employee_type_master ORDER BY employee_type ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * variable_values_employee_name_option_list Model Action
     * @return array
     */
	function variable_values_employee_name_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * variable_values_portfolio_id_option_list Model Action
     * @return array
     */
	function variable_values_portfolio_id_option_list($lookup_employee_name){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT portfolio_id AS value,p.name AS label FROM employee_details INNER JOIN portfolio as p ON employee_details.portfolio_id=p.id WHERE employee_details.id= ? ORDER BY employee_details.id ASC"     ;
		$queryparams = array($lookup_employee_name);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * variable_values_colname_option_list Model Action
     * @return array
     */
	function variable_values_colname_option_list($lookup_portfolio_id){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? and calculation_type='variable' ORDER BY id ASC"  ;
		$queryparams = array($lookup_portfolio_id);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * organization_report_format_name_value_exist Model Action
     * @return array
     */
	function organization_report_format_name_value_exist($val){
		$db = $this->GetModel();
		$db->where("report_format_name", $val);
		$exist = $db->has("organization");
		return $exist;
	}

	/**
     * report_header_footer_report_type_id_option_list Model Action
     * @return array
     */
	function report_header_footer_report_type_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,report_format_name  AS label FROM organization ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * bank_name_bank_name_option_list Model Action
     * @return array
     */
	function bank_name_bank_name_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT bank_name AS value,bank_name AS label FROM bank_name ORDER BY bank_name ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * multiple_values_empid_option_list Model Action
     * @return array
     */
	function multiple_values_empid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY employee_name ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * multiple_values_portid_option_list Model Action
     * @return array
     */
	function multiple_values_portid_option_list($lookup_empid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT portfolio_id AS value,p.name AS label FROM employee_details INNER JOIN portfolio as p ON employee_details.portfolio_id=p.id WHERE employee_details.id= ? ORDER BY employee_details.id ASC" ;
		$queryparams = array($lookup_empid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * multiple_values_col_option_list Model Action
     * @return array
     */
	function multiple_values_col_option_list($lookup_portid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT col_name AS value,col_name AS label FROM portfolio_configurations WHERE pid= ? AND calculation_type=? ORDER BY col_name ASC"  ;
		$queryparams = array($lookup_portid,'multivariable');
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * duplicate_portfolio_old_portfolio_option_list Model Action
     * @return array
     */
	function duplicate_portfolio_old_portfolio_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * duplicate_portfolio_new_portfolio_option_list Model Action
     * @return array
     */
	function duplicate_portfolio_new_portfolio_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * suspension_empid_option_list Model Action
     * @return array
     */
	function suspension_empid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * autorization_user_name_option_list Model Action
     * @return array
     */
	function autorization_user_name_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,username AS label FROM user_info ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * user_profile_reposition_empid_option_list Model Action
     * @return array
     */
	function user_profile_reposition_empid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * user_profile_reposition_new_portfolio_option_list Model Action
     * @return array
     */
	function user_profile_reposition_new_portfolio_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * user_profile_reposition_old_portfolio_option_list Model Action
     * @return array
     */
	function user_profile_reposition_old_portfolio_option_list($lookup_empid){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT portfolio.name AS value,portfolio.name AS label FROM employee_details inner join portfolio on employee_details.portfolio_id=portfolio.id WHERE employee_details.id= ? ORDER BY employee_details.id ASC"   ;
		$queryparams = array($lookup_empid);
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * delete_profile_portfolio_id_option_list Model Action
     * @return array
     */
	function delete_profile_portfolio_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_absent_data_employee_details_department_option_list Model Action
     * @return array
     */
	function leave_absent_data_employee_details_department_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT department AS value,department AS label FROM department_master ";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_absent_data_employee_details_designation_option_list Model Action
     * @return array
     */
	function leave_absent_data_employee_details_designation_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT designation AS value,designation AS label FROM designation_master ";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_calendar_pid_option_list Model Action
     * @return array
     */
	function leave_calendar_pid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_grant_leave_type_option_list Model Action
     * @return array
     */
	function leave_grant_leave_type_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT leave_type AS value,leave_type AS label FROM leave_master ORDER BY leave_type ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_grant_empid_option_list Model Action
     * @return array
     */
	function leave_grant_empid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_holidays_pid_option_list Model Action
     * @return array
     */
	function leave_holidays_pid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_master_leave_type_value_exist Model Action
     * @return array
     */
	function leave_master_leave_type_value_exist($val){
		$db = $this->GetModel();
		$db->where("leave_type", $val);
		$exist = $db->has("leave_master");
		return $exist;
	}

	/**
     * leave_requests_holiday_type_option_list Model Action
     * @return array
     */
	function leave_requests_holiday_type_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT leave_type AS value,leave_type AS label FROM leave_master ORDER BY default_days ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_requests_emp_id_option_list Model Action
     * @return array
     */
	function leave_requests_emp_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,employee_name AS label FROM employee_details ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_requests_holiday_type_option_list_2 Model Action
     * @return array
     */
	function leave_requests_holiday_type_option_list_2(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT leave_type AS value,leave_type AS label FROM leave_master ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_granter_leave_type_option_list Model Action
     * @return array
     */
	function leave_granter_leave_type_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT leave_type AS value,leave_type AS label FROM leave_master ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * leave_granter_portfolio_id_option_list Model Action
     * @return array
     */
	function leave_granter_portfolio_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * portfolio_configurations_portfolio_configurationspid_option_list Model Action
     * @return array
     */
	function portfolio_configurations_portfolio_configurationspid_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_portfolioname_option_list Model Action
     * @return array
     */
	function employee_details_portfolioname_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT name AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * employee_details_employee_detailsdepartment_option_list Model Action
     * @return array
     */
	function employee_details_employee_detailsdepartment_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT department AS value,department AS label FROM department_master ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * variable_values_variable_valuesportfolio_id_option_list Model Action
     * @return array
     */
	function variable_values_variable_valuesportfolio_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * multiple_values_employee_detailsportfolio_id_option_list Model Action
     * @return array
     */
	function multiple_values_employee_detailsportfolio_id_option_list(){
		$db = $this->GetModel();
		$sqltext = "SELECT  DISTINCT id AS value,name AS label FROM portfolio ORDER BY id ASC";
		$queryparams = null;
		$arr = $db->rawQuery($sqltext, $queryparams);
		return $arr;
	}

	/**
     * getcount_totalemployeesinorganization Model Action
     * @return Value
     */
	function getcount_totalemployeesinorganization(){
		$db = $this->GetModel();
		$sqltext = "SELECT COUNT(*) AS num FROM employee_details";
		$queryparams = null;
		$val = $db->rawQueryValue($sqltext, $queryparams);
		
		if(is_array($val)){
			return $val[0];
		}
		return $val;
	}

	/**
     * getcount_totalemployeespresenttoday Model Action
     * @return Value
     */
	function getcount_totalemployeespresenttoday(){
		$db = $this->GetModel();
		$sqltext = "SELECT COUNT(aio.id) as num FROM absent_in_out AS aio WHERE (aio.attendance_type ='ATTENDANCE' ) AND (aio.in_out ='IN' ) AND (aio.for_date = CURRENT_DATE() );
";
		$queryparams = null;
		$val = $db->rawQueryValue($sqltext, $queryparams);
		
		if(is_array($val)){
			return $val[0];
		}
		return $val;
	}

	/**
     * getcount_totalemployeespresentyesterday Model Action
     * @return Value
     */
	function getcount_totalemployeespresentyesterday(){
		$db = $this->GetModel();
		$sqltext = "SELECT COUNT(aio.id) as num FROM absent_in_out AS aio WHERE (aio.attendance_type ='ATTENDANCE' ) AND (aio.in_out ='IN' ) AND (aio.for_date = DATE_SUB(CURDATE(), INTERVAL 1 DAY) )";
		$queryparams = null;
		$val = $db->rawQueryValue($sqltext, $queryparams);
		
		if(is_array($val)){
			return $val[0];
		}
		return $val;
	}

	/**
     * getcount_totalsalarypaidincurrentmonth Model Action
     * @return Value
     */
	function getcount_totalsalarypaidincurrentmonth(){
		$db = $this->GetModel();
		$sqltext = "SELECT IFNULL(ROUND(sum(total_salary),0),0) AS num FROM salary_data WHERE year=YEAR(CURRENT_TIMESTAMP()) and month=MONTH(CURRENT_TIMESTAMP())";
		$queryparams = null;
		$val = $db->rawQueryValue($sqltext, $queryparams);
		
		if(is_array($val)){
			return $val[0];
		}
		return $val;
	}

	/**
     * getcount_totalsalarypaidinlastmonth Model Action
     * @return Value
     */
	function getcount_totalsalarypaidinlastmonth(){
		$db = $this->GetModel();
		$sqltext = "SELECT IFNULL(ROUND(sum(total_salary),0),0) AS num FROM salary_data WHERE year=YEAR(date_format(NOW(),'%Y-%m-01')  - interval 1 day) and month=MONTH(date_format(NOW(),'%Y-%m-01')  - interval 1 day)";
		$queryparams = null;
		$val = $db->rawQueryValue($sqltext, $queryparams);
		
		if(is_array($val)){
			return $val[0];
		}
		return $val;
	}

	/**
     * getcount_totalsalarypaidincurrentyear Model Action
     * @return Value
     */
	function getcount_totalsalarypaidincurrentyear(){
		$db = $this->GetModel();
		$sqltext = "SELECT IFNULL(ROUND(sum(total_salary),0),0) AS num FROM salary_data WHERE year=YEAR(CURRENT_TIMESTAMP());
";
		$queryparams = null;
		$val = $db->rawQueryValue($sqltext, $queryparams);
		
		if(is_array($val)){
			return $val[0];
		}
		return $val;
	}

}
