<?php

class salesctrl{
    
    public function sales_contact_update_closedate($cid, $date1,  $uby, $utype){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_contact_update_closedate($cid, $date1,  $uby, $utype);
        //print_r($em);
        return $em;
    }
    
    public function sales_contact_update_closecomment($cid, $comment,  $uby, $utype, $date1){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_contact_update_closecomment($cid, $comment,  $uby, $utype, $date1);
        //print_r($em);
        return $em;
    }
    
    public function salesselectactionstream($companyname, $na_assign, $searchboolean, $searchvalue, $filterboolean, $filtersubtype, $filtervalue, $value, $admin, $actiontype){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_select_actionstream($companyname, $na_assign, $searchboolean, $searchvalue, $filterboolean, $filtersubtype, $filtervalue, $value, $admin, $actiontype);
        //print_r($em);
        return $em;
    }
    
    public function salesemployeeemailiidname($companyname, $tablename){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_employee_emailiid_name($companyname, $tablename);
        //print_r($em);
        return $em;
    }
    
    public function salesemployeenextactionpending($contid, $emailid){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_employee_nextaction_pending($contid, $emailid);
        //print_r($em);
        return $em;
    }
    
    public function salesemployeeselectall($companyname, $emailid, $tablename, $deleted){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_employee_select_all($companyname, $emailid, $tablename, $deleted);
        //print_r($em);
        return $em;
    }
    
    public function salesselectallemployee($companyname, $emailid, $tablename, $deleted){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_select_all_employee($companyname, $emailid, $tablename, $deleted);
        //print_r($em);
        return $em;
    }
    
    public function salesselectall($companyname, $emailid, $tablename, $deleted){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_select_all($companyname, $emailid, $tablename, $deleted);
        //print_r($em);
        return $em;
    }
    
    public function salesselectedid($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_selected_id($table, $id);
        return $em;
    }
    
    public function salestagname($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_selected_id($table, $id);
        foreach($em as $row){
            $tagname=$row['tag_name'];
        }
        return $tagname;
    }
    
    public function salesstatusname($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_selected_id($table, $id);
        foreach($em as $row){
            $statusname=$row['status_name'];
        }
        return $statusname;
    }
    
    public function salesleadname($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_selected_id($table, $id);
        foreach($em as $row){
            $statusname=$row['lead_name'];
        }
        return $statusname;
    }
    
    public function salespipelinename($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_selected_id($table, $id);
        foreach($em as $row){
            $pipename=$row['pipe_percentage'];
        }
        return $pipename;
    }
    
    public function salesselectcontid($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_select_cont_id($table, $id);
        return $em;
    }
    
    public function salesselectstatustagleadsourceteamstream($column, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_select_status_tag_leadsource_teamstream($column, $id);
        return $em;
    }
    
    public function salesemployeeselectstatustagleadsourceteamstream($column, $id, $email_id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_employee_select_status_tag_leadsource_teamstream($column, $id, $email_id);
        return $em;
    }
    
    public function salesinsertstatustagleadsource($tablename, $companyname, $adminemailid, $name, $desc1, $color, $createby, $createtype, $tabletype, $id12){
        require_once ('../Model/sales.php');
        date_default_timezone_set("Asia/Kolkata");
        $dt=date("Y-m-d H:i:s");
        $dbobj=new salesdb();
        $em=$dbobj->sales_insert_status_tag_leadsource($tablename, $companyname, $adminemailid, $name, $desc1, $color, $createby, $createtype, $dt, $tabletype, $id12);
        return $em;
        
    }
    
    public function salesdeletestatustagleadsource($table, $id){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_delete_status_tag_leadsource($table, $id);
        return $em;
    }
    
    public function salesview($table){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->sales_view($table);
        return $em;
    }
    
    public function sales_per_select($companyname,$stage,$per_mon,$per_year){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->salesperselect($companyname,$stage,$per_mon,$per_year);
        foreach($em as $r){
            $value=$r['per_amount'];
        }
        
        return $value;
    }
    
    public function sales_per_yearly_select($companyname,$stage,$per_year){
        require_once ('../Model/sales.php');
        $dbobj=new salesdb();
        $em=$dbobj->salesperyearlyselect($companyname,$stage,$per_year);
        foreach($em as $r){
            $value=$r['per_amount'];
        }
        
        return $value;
    }
}
?>