? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/sibsmoved/system/application/models/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/public_html/savoyglobal.net/sibsmoved/system/application/models/salesmodel.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class salesmodel extends Model
{
     function salesmodel()
     {
         parent::Model();

     }
   
    function insertdailyactivity()
    {
        $date=$this->mastermodel->convdatformat($_POST['date']);
        $query=$this->db->query("insert into dailyactivity values('', '$date','$_POST[staffid]')");
        $activityid=mysql_insert_id();
        $time[1]=$_POST['txt_conTime_1'];
        $name[1]=$_POST['txt_conName_1'];
        $contact_person[1]=$_POST['txt_conPers_1'];
        $designation[1]=$_POST['txt_conDesg_1'];
        $tel_no[1]=$_POST['txt_conTel_1'];
        $status[1]=$_POST['txt_conStat_1'];
        $x = 2;
	while (isset($_POST['txt_conName_'.$x]))
        {
            $time[$x]=$_POST['txt_conTime_'.$x];
            $name[$x]=$_POST['txt_conName_'.$x];
            $contact_person[$x]=$_POST['txt_conPers_'.$x];
            $designation[$x]=$_POST['txt_conDesg_'.$x];
            $tel_no[$x]=$_POST['txt_conTel_'.$x];
            $status[$x]=$_POST['txt_conStat_'.$x];
            $x++;
        }
        $i=1;
        while($x!=1)
        {
            $sql="insert into dailyactivitydetails values ('', '$activityid','$time[$i]','$name[$i]','$contact_person[$i]','$designation[$i]','$tel_no[$i]','$status[$i]')";
            $query=$this->db->query($sql);
            $x--;
            $i++;
        }
   }
   function insertsalesleads()
   {
        $renewaldate= $this->mastermodel->convdatformat($_POST['rendate']);
        $date= $this->mastermodel->convdatformat($_POST['date']);
        $query=$this->db->query("insert into salesleads  (`leadname`, `business`, `contactperson`, `email`, `officeno`, `rendate`, `cover_id`, `staffid`, `remarks`,designation, mobile, fax, date, status)  values('$_POST[leadname]','$_POST[business]','$_POST[contactperson]','$_POST[email]','$_POST[officeno]','$renewaldate','$_POST[cover_id]','$_POST[employee_id]','$_POST[remarks]','$_POST[designation]','$_POST[mobile]','$_POST[fax]','$date','$_POST[status]')") ;
        $saleslead_id=mysql_insert_id();
        if($query>0)
        {
            return 1;
        }
        else
           {
           return 0;
       }
    }
  function updatestaffcustomer($table)
    {
      $date= $this->mastermodel->convertdateformat($_POST['date']);
      $entrydate= $this->mastermodel->convertdateformat($_POST['entrydate']);
      $query=$this->db->query("update $table set description = '$_POST[description]', date = '".$date."', entrydate = '".$entrydate."' where id='$_POST[staffcustomerid]'");
      if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
     function updatetelecalling($table)
    {
       $date=$this->mastermodel->convdatformat($_POST['repdate']);
      $query=$this->db->query("update $table set staffid='$_POST[staffid]', leadname = '$_POST[leadname]', email = '$_POST[email]', contactno = '$_POST[contactno]', repdate = '$date', reptitle = '$_POST[reptitle]', report = '$_POST[report]' where id='$_POST[telecallingid]'");
       if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
    function insertsettarget()
    {
     $startdate = date("Y-m-d", strtotime($_POST['startdate'])) ;
      switch ($_POST['targettype'])
      {
          case 'Monthly':
              $enddate =  date("Y-m-d", strtotime($_POST['startdate'] . "+1 month -1 day"));
              break;
          case 'Quarterly':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+3 month -1 day"));
              break;
          case 'Semi-Annually':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+6 month -1 day"));
              break;
          case 'Annually':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+12 month -1 day"));
              break;
          case 'Others':
              $enddate = date("Y-m-d", strtotime($_POST['enddate'])) ;
              break;
          default:
               $enddate = date("Y-m-d", strtotime($_POST['enddate'])) ;
          
      }
      $query=$this->db->query("insert into settarget values ('', '$_POST[employee_id]', '$startdate', '$enddate', '$_POST[target]', '$_POST[target_income]', '$_POST[curr_id]', '$_POST[targettype]')");
       if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
    function updatesettarget($table)
    {
        $startdate = date("Y-m-d", strtotime($_POST['startdate'])) ;
      switch ($_POST['targettype'])
      {
          case 'Monthly':
              $enddate =  date("Y-m-d", strtotime($_POST['startdate'] . "+1 month -1 day"));
              break;
          case 'Quarterly':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+3 month -1 day"));
              break;
          case 'Semi-Annually':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+6 month -1 day"));
              break;
          case 'Annually':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+12 month -1 day"));
              break;
          case 'Others':
              $enddate = date("Y-m-d", strtotime($_POST['enddate'])) ;
              break;
          default:
               $enddate = date("Y-m-d", strtotime($_POST['enddate'])) ;

      }
      $query=$this->db->query("update $table set staffid='$_POST[staffid]', startdate = '$startdate', enddate = '$enddate', target = '$_POST[target]', target_income = '$_POST[target_income]', curr_id = '$_POST[curr_id]', targettype = '$_POST[targettype]' where id='$_POST[settargetid]'");
       if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
    function insertbranchtarget()
    {
     $startdate = date("Y-m-d", strtotime($_POST['startdate'])) ;
      switch ($_POST['targettype'])
      {
          case 'Monthly':
              $enddate =  date("Y-m-d", strtotime($_POST['startdate'] . "+1 month -1 day"));
              break;
          case 'Quarterly':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+3 month -1 day"));
              break;
          case 'Semi-Annually':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+6 month -1 day"));
              break;
          case 'Annually':
              $enddate = date("Y-m-d", strtotime($_POST['startdate'] . "+12 month -1 day"));
              break;
          case 'Others':
              $enddate = date("Y-m-d", strtotime($_POST['enddate'])) ;
              break;
          default:
               $enddate = date("Y-m-d", strtotime($_POST['enddate'])) ;

      }
      $query=$this->db->query("insert into branchtarget values ('', '$_POST[branch]', '$startdate', '$enddate', '$_POST[target]', '$_POST[target_income]', '$_POST[curr_id]', '$_POST[targettype]')");
       if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
     function updatebranchtarget($table)
    {
      $query=$this->db->query("update $table set branch='$_POST[branch]', startdate = '$_POST[startdate]', enddate = '$_POST[enddate]', target = '$_POST[target]', target_income = '$_POST[target_income]', curr_id = '$_POST[curr_id]', targettype = '$_POST[targettype]' where id='$_POST[settargetid]'");
       if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
    function addstaffcustomer()
    {
        $date=$this->mastermodel->convertdateformat($_POST['date']);
        $entrydate=$this->mastermodel->convertdateformat($_POST['entrydate']);
        $query=$this->db->query("insert into staffcustomer  (`customerid`, `description`, `staffid`, `date`, `entrydate`)  values('$_POST[customer_id]','$_POST[description]','$_POST[employee_id]','".$date."','".$entrydate."')") ;
        if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }
    }
    function addtelecalling()
    {
        $date=$this->mastermodel->convdatformat($_POST['repdate']);
        $query=$this->db->query("insert into telecalling  (`staffid`, `leadname`, `email`, `contactno`, `repdate`, `reptitle`, `report`)  values('$_POST[employee_id]','$_POST[leadname]','$_POST[email]','$_POST[contactno]','$date','$_POST[reptitle]','$_POST[report]')") ;
       $saleslead_id=mysql_insert_id();

        if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }
    }
    function updatedailyactivity()
    {
        $date=$this->mastermodel->convdatformat($_POST['date']);
        $dailyactivityid = $_POST['dailyactivityid'];
       
        $query=$this->db->query("update dailyactivity set `date`='$date' where id='$dailyactivityid'");
         $activityid=$dailyactivityid;

   $query=$this->db->query("delete from  dailyactivitydetails  where activityid='$dailyactivityid'");



        $x = 1;
	while (isset($_POST['txt_conName_'.$x]))
        {
             $time[$x]=$_POST['txt_conTime_'.$x];
    $name[$x]=$_POST['txt_conName_'.$x];

     $contact_person[$x]=$_POST['txt_conPers_'.$x];
    $designation[$x]=$_POST['txt_conDesg_'.$x];
    $tel_no[$x]=$_POST['txt_conTel_'.$x];
    $status[$x]=$_POST['txt_conStat_'.$x];


          $x++;
        }

        $i=1;
        while($x!=1)
        {
          $sql="insert into dailyactivitydetails values ('', '$activityid','$time[$i]','$name[$i]','$contact_person[$i]','$designation[$i]','$tel_no[$i]','$status[$i]')";
        $query=$this->db->query($sql);

        $x--;
        $i++;
        }
   }
  function updatesalesleads($table)
    {
      $renewaldate= $this->mastermodel->convdatformat($_POST['rendate']);
      $date= $this->mastermodel->convdatformat($_POST['date']);
      $query=$this->db->query("update $table set staffid='$_POST[staffid]', leadname = '$_POST[leadname]', email = '$_POST[email]', officeno = '$_POST[officeno]', rendate = '$renewaldate', cover_id = '$_POST[cover_id]', business = '$_POST[business]',remarks = '$_POST[remarks]',contactperson = '$_POST[contactperson]',mobile = '$_POST[mobile]',date = '$date',status = '$_POST[status]',fax = '$_POST[fax]',designation = '$_POST[designation]' where id='$_POST[salesleadsid]'");

    
      if($query>0)
       {
           return 1;
       }
       else
           {
           return 0;
       }

    }
  function getautosugestList($content="",$table="")
	{

		$data=array();
		
                
		$sql = "SELECT id, name FROM $table where name  like '". $content . "%'";
                
			$query=$this->db->query($sql);
			foreach ($query->result_array() as $row)
	        {
	       	 	$data[] = $row;
	        }
		
		
		

       return $data;
	}
	function get_data_search($table,$id,$field,$page,$per_page)
         {




                $staffids=$this->mastermodel->tracestaff();
                 $staffids=implode(',', $staffids);



  if ($this->mastermodel->ret_private())
  {
      $where=' where  staffid in ('.$staffids.')';
      $where1=' where staffid in ('.$staffids.') and';
  }
  else
  {
       $where='';
       $where1=' where ';
  }


            if($page)
        {
        $start = ($page-1)*$per_page;
        }
        else
        {
        $start=0;
         }


         if($table=='staffcustomer')
                $get='staffcustomer.id,staffcustomer.entrydate,staffcustomer.customerid,staffcustomer.description,staffcustomer.staffid,staffcustomer.date';
         elseif ($table=='dailyactivity')
                 $get='dailyactivity.id,dailyactivity.staffid,dailyactivity.date';
         elseif ($table=='settarget')
                 $get='settarget.id,settarget.staffid,settarget.startdate,settarget.enddate,settarget.target,settarget.curr_id,settarget.targettype';
         elseif ($table=='salesleads')
             $get='salesleads.id,salesleads.staffid,salesleads.rendate,salesleads.cover_id,salesleads.leadname';
         elseif($table=='telecalling')
             $get='telecalling.id,telecalling.staffid,telecalling.leadname,telecalling.email,telecalling.repdate';
         else
             $get='*';
            if($field == "staffname")
                {


                $sql = "select $get from $table   join staffpersonaldetails on $table.staffid = staffpersonaldetails.id and staffpersonaldetails.name  like '".$id."%' $where";
            
                
            }
            elseif($field=='customername')
            {

               $sql="SELECT $get  FROM staffcustomer   LEFT JOIN customer_personal_ind ON (customer_personal_ind.customer_id = staffcustomer.customerid) LEFT JOIN customer_corp_info ON (customer_corp_info.customer_id = staffcustomer.customerid) $where1 (customer_corp_info.insured like '$id%' or customer_personal_ind.insured like '$id%')";
              

            }
            else if($field == "covername")
        {

            $qry = "select id from covers where cover like '".$id."%'";

              $sql = "select $get from $table $where1 cover_id in ($qry) ";
          
     }
   
 else if($field == "branch_name")
                 {
                    $sql = "SELECT bt.branch,bt.id,bt.startdate,bt.enddate,bt.target,bt.curr_id,bt.targettype from branchtarget bt inner join ourbranch ob on bt.branch=ob.id where ob.branchname  like '".$id."%'";
                 }
            else
                {

        $sql = "select $get from $table $where1 $field like '%".$id."%'";
       
                }
          $sql.=" order by id desc limit $start,$per_page";
     
        return $sql;

    }

    function get_data_search_all($table,$id,$field)
         {

                $staffids=$this->mastermodel->tracestaff();
                 $staffids=implode(',', $staffids);


  if ($this->mastermodel->ret_private())
  {
      $where=' where  staffid in ('.$staffids.')';
      $where1=' where staffid in ('.$staffids.') and';
  }
  else
  {
       $where='';
       $where1=' where ';
  }



                 if($table=='staffcustomer')
                        $get='staffcustomer.id,staffcustomer.entrydate,staffcustomer.customerid,staffcustomer.description,staffcustomer.staffid,staffcustomer.date';
                 elseif ($table=='dailyactivity')
                         $get='dailyactivity.id,dailyactivity.staffid,dailyactivity.date';
                 elseif ($table=='settarget')
                         $get='settarget.id,settarget.staffid,settarget.startdate,settarget.enddate,settarget.target,settarget.curr_id,settarget.targettype';
                 elseif ($table=='salesleads')
                     $get='salesleads.id,salesleads.staffid,salesleads.rendate,salesleads.cover_id,salesleads.leadname';
                 elseif($table=='telecalling')
                     $get='telecalling.id,telecalling.staffid,telecalling.leadname,telecalling.email,telecalling.repdate';
                 else
                     $get='*';


                if($field == "staffname")
                {
                 $sql = "select * from $table  join staffpersonaldetails on $table.staffid = staffpersonaldetails.id and staffpersonaldetails.name like '".$id."%' $where ";


            }
            elseif($field=='customername')
            {

               $sql="SELECT *  FROM staffcustomer   LEFT JOIN customer_personal_ind ON (customer_personal_ind.customer_id = staffcustomer.customerid) LEFT JOIN customer_corp_info ON (customer_corp_info.customer_id = staffcustomer.customerid) $where1 (customer_corp_info.insured like '$id%' or customer_personal_ind.insured like '$id%')  ";
              

            }
              else if($field == "covername")
                    {

                        $qry = "select id from covers where cover like '".$id."%'";

                          $sql = "select * from $table $where1 cover_id in ($qry) ";
                       
                 }
                 else if($field == "branch_name")
                 {
                    $sql = "SELECT bt.branch,bt.id,bt.startdate,bt.enddate,bt.target,bt.curr_id,bt.targettype from branchtarget bt inner join ourbranch ob on bt.branch=ob.id where ob.branchname  like '".$id."%'  ";
                 }
            else
                {

                    $sql = "select * from $table $where1 $field like '".$id."%'  ";
                }
              
          $res = $this->db->query($sql);
          
         return  $res->num_rows();
           

    }
  function ListofCustomers($custname="",$searchBy="customers~code")//Function for Search Customer and List Customer Details
	{
		 $data=array();
         if($searchBy=="insured")
         {
            $qry="SELECT customer_id  FROM customer_personal_ind where insured like '" . $custname . "%' ";
            $qry1="SELECT customer_id FROM customer_corp_info where insured like '" . $custname . "%'";
            $Q=$this->db->query($qry);
            $rows=$Q->result_array();
            foreach ($rows as $rw)
            {
                $newRow['id']=$rw['customer_id'];
                $type=$this->customermodel->getSingleFieldValue('customers','type','id',$rw['customer_id']);
                if($type=="Individual")
                {
                  $newRow['insured']=$this->customermodel->getSingleFieldValue('customer_personal_ind','insured','customer_id',$rw['customer_id']);
                }
				else
                {
                  $newRow['insured']=$this->customermodel->getSingleFieldValue('customer_corp_info','insured','customer_id',$rw['customer_id']);
                  $newRow['business']=$this->customermodel->getSingleFieldValue('customer_corp_info','Business_activity','customer_id',$rw['customer_id']);
                }
		$newRow['code']=$this->customermodel->getSingleFieldValue('customers','code','id', $rw['customer_id']);
                $newRow['phone_office']=$this->customermodel->getSingleFieldValue('customer_contact','phone_office','customer_id',$rw['customer_id']);
                $newRow['fax']=$this->customermodel->getSingleFieldValue('customer_contact','fax','customer_id',$rw['customer_id']);
                $newRow['email']=$this->customermodel->getSingleFieldValue('customer_contact','email','customer_id',$rw['customer_id']);
                $newRow['type']=$type;
                $data[]=$newRow;
                $newRow="";
			}
         	$R=$this->db->query($qry1);
            $rows1=$R->result_array();
            foreach ($rows1 as $rw1)
            {
                $newRow1['id']=$rw1['customer_id'];
                $type1=$this->customermodel->getSingleFieldValue('customers','type','id',$rw1['customer_id']);
                if($type1=="Individual")
                {
                  $newRow1['insured']=$this->customermodel->getSingleFieldValue('customer_personal_ind','insured','customer_id',$rw1['customer_id']);
                }
				else
                {
                  $newRow1['insured']=$this->customermodel->getSingleFieldValue('customer_corp_info','insured','customer_id',$rw1['customer_id']);
                  $newRow1['business']=$this->customermodel->getSingleFieldValue('customer_corp_info','Business_activity','customer_id',$rw1['customer_id']);
                }
		$newRow1['code']=$this->customermodel->getSingleFieldValue('customers','code','id', $rw1['customer_id']);
                $newRow1['phone_office']=$this->customermodel->getSingleFieldValue('customer_contact','phone_office','customer_id',$rw1['customer_id']);
                $newRow1['fax']=$this->customermodel->getSingleFieldValue('customer_contact','fax','customer_id',$rw1['customer_id']);
                $newRow1['email']=$this->customermodel->getSingleFieldValue('customer_contact','email','customer_id',$rw1['customer_id']);
                 $newRow1['type']=$type1;
                $data[]=$newRow1;
                $newRow1="";
			}
		}
		else
        {
			$filed= explode("~",$searchBy);
			if($filed[0]=="customers")
			{
				$qry="SELECT id FROM " . $filed[0] . " where ". $filed[1] . " like '" . $custname . "%'";
				$index="id";
			}
			else
			{
            	$qry="SELECT customer_id FROM " . $filed[0] . " where ". $filed[1] . " like '" . $custname . "%'";
                $index="customer_id";
			}
         	$Q=$this->db->query($qry);
            $rows=$Q->result_array();
			foreach ($rows as $rw)
            {
	            $newRow['id']=$rw[$index];
	            $type=$this->customermodel->getSingleFieldValue('customers','type','id',$rw[$index]);
				if($type=="Individual")
	            {
	            	$newRow['insured']=$this->customermodel->getSingleFieldValue('customer_personal_ind','insured','customer_id',$rw[$index]);
				}
	            else
	            {
	            	$newRow['insured']=$this->customermodel->getSingleFieldValue('customer_corp_info','insured','customer_id',$rw[$index]);
                        $newRow['business']=$this->customermodel->getSingleFieldValue('customer_corp_info','Business_activity','customer_id',$rw[$index]);
				}
	            $newRow['code']=$this->customermodel->getSingleFieldValue('customers','code','id', $rw[$index]);
	            $newRow['phone_office']=$this->customermodel->getSingleFieldValue('customer_contact','phone_office','customer_id',$rw[$index]);
	            $newRow['fax']=$this->customermodel->getSingleFieldValue('customer_contact','fax','customer_id',$rw[$index]);
	            $newRow['email']=$this->customermodel->getSingleFieldValue('customer_contact','email','customer_id',$rw[$index]);
                   // $newRow['business']=$this->customermodel->getSingleFieldValue('customer_corp_info','Business_activity','customer_id',$rw[$index]);
                    $newRow['type']=$type;
	            $data[]=$newRow;
	            $newRow="";
			}
		}
	return $data;
    }

    function findemployeebycode($code)
    {
        $this->db->select('sp.name,sp.id,d.designation,dp.departmentname');
        $this->db->from('staffpersonaldetails sp');
        $this->db->join('staffemployeedetails','staffemployeedetails.staffid=sp.id');
        $this->db->join('department dp','dp.id=staffemployeedetails.deptid');
        $this->db->join('designation d','d.id=staffemployeedetails.designationid');
        $this->db->where('sp.employeeid',$code);
        $q=$this->db->get();
        $row=$q->row();
        if($q->num_rows() > 0)
        {
            $result=$row->name.'~'.$row->id.'~'.$row->designation.'~'.$row->departmentname;
        }
        else {
            $result="";
        }

        return $result;
    }

   
    
 }

?>

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net