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

<?php

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

class Accounting extends BaseController {

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

    function get_post_values() {
        $data = array();
        foreach ($_POST as $key => $value) {
            if ($key != "submit") {
                $data[$key] = $this->input->post($key);
            }
        }
        return $data;
    }

    function deletegl_class($table, $id, $pageno = 1) {
        $result = $this->accountingsmodel->deletegl_class('cid', $table, $id);
    }

    function loaderror() {

        $this->load->view('Accounting/checkexist');
    }

    function viewglacc_class($pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['totrecord'] = $this->settingsmodel->count_alls('gl_class', $field, $value);

        $data['field'] = $field;
        $data['text'] = $value;
        $data['glclass'] = $this->accountingsmodel->Getgl_class('gl_class', $pageno, $field, $value);
        $this->load->view('Accounting/view_gl_acc_class', $data);
    }

    function addglacc_class() {
        $this->load->view('Accounting/add_gl_acc_class');
    }

    function insertglacc_class() {
        $res = $this->accountingsmodel->addgl_acc_class();
        if ($res >= 1) {
            echo "Class Added Sucessfully";
        }
    }

    function updateglacc_class() {
        $res = $this->accountingsmodel->updategl_acc_class();
        if ($res >= 1) {
            echo "Updated Sucessfully";
        }
    }

    function Get_editglclass_data($id, $pageno, $field, $text = "") {

        // echo $id."--".$field."-".$pageno;
//the argument pageno is current page no and  id is reminder id
        $data['editglclass'] = $this->accountingsmodel->Get_edit_data('cid', 'gl_class', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;
        $this->load->view('Accounting/edit-gl-class-page', $data);
    }

    function ajaxload($page) {


        $this->load->view('Accounting/' . $page . '');
    }

// ------------------------Functions of GL Account Groups--------------------------------//


    function viewglacc_group($pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['totrecord'] = $this->settingsmodel->count_alls('gl_groups', $field, $value);

        $data['field'] = $field;
        $data['text'] = $value;
        $data['glgroup'] = $this->accountingsmodel->Getgl_class('gl_groups', $pageno, $field, $value);
        $this->load->view('Accounting/view_gl_acc_group', $data);
    }

    function addglacc_group() {
        $this->load->view('Accounting/add_gl_acc_group');
    }

    function insertglacc_group() {
        $res = $this->accountingsmodel->addgl_acc_group();
        if ($res >= 1) {
            echo "Group Added Sucessfully";
        }
    }

    function deletegl_group($table, $id, $pageno = 1) {
        $result = $this->accountingsmodel->deletegl_class('id', $table, $id);
        echo $result;
    }

    function deletechart_acc($table, $id, $pageno = 1) {
        $result = $this->accountingsmodel->deletechart_acc('id', $table, $id);
        echo $result;
    }

    function deletechart_group($table, $id, $pageno = 1) {
        $result = $this->accountingsmodel->deletechart_group('id', $table, $id);
        echo $result;
    }

    function Get_editglgroup_data($id, $pageno, $field, $text = "") {

        $data['editglgroup'] = $this->accountingsmodel->Get_edit_data('id', 'gl_groups', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;
        $this->load->view('ing/edit-gl-group-page', $data);
    }

    function updateglacc_group() {
        $res = $this->accountingsmodel->updategl_acc_group();
        if ($res >= 1) {
            echo "Updated  Sucessfully";
        }
    }

    // ------------------------Functions of GL Accounts--------------------------------//

    function viewgl_acc($pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $value;
        $output = $this->accountingsmodel->showgl_class($pageno, $field, $value);
        $data['totrecord'] = $output['totcount'];
        $data['glaccount'] = $output['result'];
        $this->load->view('Accounting/view_gl_account', $data);
    }

    function loadgl_acc($pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;

        $data['field'] = $field;
        $data['text'] = $value;
        $output = $this->accountingsmodel->showgl_class($pageno, $field, $value);
        $data['totrecord'] = $output['totcount'];
        $data['glaccount'] = $output['result'];
        $this->load->view('Accounting/load_gl_account', $data);
    }

    function loadsub_accmain($mainacc, $pageno = 1, $field, $value = '') {
        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['mainacc'] = $mainacc;
        $data['field'] = $field;
        $data['text'] = $value;
        $output = $this->accountingsmodel->showsub_classmain($mainacc, $pageno, $field, $value);
        $data['totrecord'] = $output['totcount'];
        $data['glaccount'] = $output['result'];
        $this->load->view('Accounting/loadsubacc_main', $data);
    }

    function addgl_acc() {
        $this->load->view('Accounting/add_gl_account');
    }

    function addacc_settings() {
        $this->load->view('Accounting/add_subacc_settings');
    }

    function insertgl_acc() {
        $res = $this->accountingsmodel->addgl_acc();
        if ($res == 1) {
            echo "Account Added Sucessfully";
        } else if ($res == 'BEYOND') {
            echo "Account Beyond the Limit";
        } else {
            echo "Error While Adding";
        }
    }

    function insertacc_settings() {
        $res = $this->accountingsmodel->add_acc_settings();
        if ($res >= 1) {
            echo "Settings Added";
        }
    }

    function Get_editgl_acc($id, $pageno, $field, $text = "") {
        $text = urldecode($text);
        $data['editglacc'] = $this->accountingsmodel->Get_edit_data('id', 'chart_master', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;

        $this->load->view('Accounting/edit-gl-account-page', $data);
    }

    function Get_editacc_setting($id) {


        $data['id'] = $id;
        $this->load->view('Accounting/editacc_setting', $data);
    }

    function updategl_acc() {

        $res = $this->accountingsmodel->updategl_acc();
        if ($res >= 1) {
            echo "Updated Sucessfully";
        }
    }

    function updateacc_settings() {

        $res = $this->accountingsmodel->updateacc_settings();
        if ($res >= 1) {
            echo "Updated  Successfully";
        }
    }

    /*     * **********************************functions for bank accounts************************************* */

    function viewbank_acc($pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['totrecord'] = $this->settingsmodel->count_alls('bank_accounts', $field, $value);

        $data['field'] = $field;
        $data['text'] = $value;
        $data['ba_acc'] = $this->accountingsmodel->get_bank_accounts('bank_accounts', $pageno, $field, $value);
        $this->load->view('Accounting/view_bank_accounts', $data);
    }

    function add_bank_accounts() {
        $this->load->view('Accounting/add_bank_accounts');
    }

    function add_accounts_type() {
        $this->load->view('Accounting/add_accounts_type');
    }

    function view_account_type($pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['totrecord'] = $this->settingsmodel->count_alls('char_type', $field, $value);

        $data['field'] = $field;
        $data['text'] = $value;
        $data['accounting'] = $this->accountingsmodel->Getgl_class('char_type', $pageno, $field, $value);
        $this->load->view('Accounting/view_account_type', $data);
    }

//    function view_account_type_settings($pageno = 1, $field, $value = '') {
//         $value = str_replace("~", " ", $value);
//        $value = str_replace("_", "/", $value);
//        $data['currpage'] = $pageno;
//        $data['totrecord'] = $this->settingsmodel->count_alls('char_type', $field, $value);
//
//        $data['field'] = $field;
//        $data['text'] = $value;
//        $data['accounting'] = $this->mastermodel->get_data_joined('chart_type', $table2, $field1, $field2, $id = '', $field = '', $sortfield = "");
//        $this->load->view('Accounting/view_account_type_settings', $data);
//    }

    function insertbank_acc() {


        $res = $this->accountingsmodel->addbank_acc();
        if ($res >= 1) {
            echo "Bank Account Added Sucessfully";
        }
    }

    function editbank_acc($id, $pageno, $field, $text = "") {

        $data['editbank_acc'] = $this->accountingsmodel->Get_edit_data('id', 'bank_accounts', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;
        $this->load->view('Accounting/edit-bank-accounts', $data);
    }

    function updatebank_acc() {

        $res = $this->accountingsmodel->updatebank_acc();
        if ($res >= 1) {
            echo "Updated  Sucessfully";
        }
    }

    /*     * *************************************Bank Payment and deposit functions starts here*****-********************************* */

    function viewcustaccount_pages($page, $type, $pagenum) 
    {
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->countcust_tra_val('customer_trans', 'amount', '-');

        $data['bank'] = $this->accountingsmodel->custom_trans('customer_trans', $pagenum, 'amount', '-');
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewacc_statement_pages($page) 
    {
        $this->load->view('Accounting/' . $page);
    }

    function viewunpostcust_payment($page, $type, $pagenum) 
    {
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->banktrans_unpost($pagenum, 'count', $type);
        $data['bank'] = $this->accountingsmodel->banktrans_unpost($pagenum, 'data', $type);

        $this->load->view('Accounting/' . $page, $data);
    }
    
    function viewsinglecustaccount_pages($page, $id) {



        $data['bank'] = $this->accountingsmodel->singlecustom_trans($id);
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewsinglecustpayment($cusid, $tid) {
        //echo $type.'---'.$refid;
        $data['transaction_id'] = $tid;
        $data['single'] = $this->accountingsmodel->single_transact($cusid);
        $data['allocate'] = $this->accountingsmodel->single_allocate($tid);
        $this->load->view('Accounting/viewallocation_page', $data);
    }

    function viewsinglepayment($type, $refid) {
        //echo $type.'---'.$refid;
        $data['refid'] = $refid;
        $data['type'] = $type;

        $data['single'] = $this->accountingsmodel->single_trans('gl_trans', $refid);
        $data['count'] = $this->accountingsmodel->get_transtype_count($type, $refid);
        $this->load->view('Accounting/viewtransaction_page', $data);
    }

    function viewsinglepslippayment($type, $pid, $qref) {


        $data['type'] = $type;
        $qref = str_replace("~", " ", $qref);
        $qref = str_replace("_", "/", $qref);
        $data['qref'] = $qref;

        $data['single'] = $this->accountingsmodel->show_trans_pslip($pid, $type);
        $data['refid'] = $this->accountingsmodel->get_ref_pslip($pid, $type);
        $data['count'] = $this->accountingsmodel->get_transtype_count($type, $data['refid']);

        $this->load->view('Accounting/viewtransaction_page_pslip', $data);
    }

    function showdebitcreditnotegl($refid, $type, $plid, $qid, $trtype) {
        $data['single'] = $this->accountingsmodel->show_trans_pslip($refid);
        $data['type'] = $type;
        $data['refid'] = $refid;

        if ($trtype == 'issue') {
            $pdet = $this->policiesmodel->getplacingpayment($plid);
            $data['qtnref'] = $pdet[0]['quotation_ref'];
            $data['policyno'] = $pdet[0]['policyno'];
        } else if ($trtype == 'endorsement') {
            $enddet = $this->policiesmodel->getendorsementpayment($qid, $plid);


            $data['qtnref'] = $enddet[0]['endrefno'];
            $data['policyno'] = $enddet[0]['endpolicyno'];
        } else if ($trtype == 'cancellation') {
            $candet = $this->policiesmodel->getcancellationpayment($qid, $plid);


            $data['qtnref'] = $candet[0]['canrefno'];
            $data['policyno'] = $candet[0]['canpolicyno'];
        } else {
            $pdet = $this->policiesmodel->getdeclarationpayment($plid);
            $data['qtnref'] = $pdet[0]['certificate_refno'];
            $data['policyno'] = $pdet[0]['policyno'];
        }

        $this->load->view('Accounting/viewtransaction_page_pslip', $data);
    }

    function viewsingleunpostpayment($type, $refid) {
        //echo $type.'---'.$refid;
        $data['refid'] = $refid;
        $data['type'] = $type;

        $data['single'] = $this->accountingsmodel->single_unpost('unposted_journal', $refid);
        $this->load->view('Accounting/viewunposttransaction_page', $data);
    }

    function post_unposted_postdated_cheque($type, $refid) {
        $data['refid'] = $refid;
        $data['type'] = $type;

        $data['single'] = $this->accountingsmodel->single_unpost('unposted_pay_dep', $refid);
        $this->load->view('Accounting/post_unposted_postdated_cheque', $data);
    }

    function viewsingleunpostbank($type, $refid) {
        //echo $type.'---'.$refid;
        $data['refid'] = $refid;
        $data['type'] = $type;

        $data['single'] = $this->accountingsmodel->single_unpost('unposted_pay_dep', $refid);
        $this->load->view('Accounting/viewunposted_banktrans', $data);
    }

    function viewsingleautopayment($type, $refid) {
        //echo $type.'---'.$refid;
        $data['refid'] = $refid;
        $data['type'] = $type;

        $data['single'] = $this->accountingsmodel->single_unpost('auto_journal', $refid);
        $this->load->view('Accounting/viewautotransaction_page', $data);
    }

    function addallocation() {
        $res = $this->accountingsmodel->addtoallocate();
        redirect('master/index/106/12');
    }

    function addcommissionallocation() {
        $res = $this->accountingsmodel->addcommissionallocate();
        redirect('master/index/106/12');
    }
    
    function addemployeeallocation() {
        $res = $this->accountingsmodel->addemployeeallocate();

        $trans = $_POST['trans_table'];

        redirect('master/index/106/12');
    }

    function viewbankdeposit_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->bankdep_trans('0', 'count');

        $data['bank'] = $this->accountingsmodel->bankdep_trans($pagenum, 'data');
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewpostDatedCheque_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->post_dated_cheque('0', 'count');
        $data['bank'] = $this->accountingsmodel->post_dated_cheque($pagenum, 'data');
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewbankpayment_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->bankpayment_trans('0', 'count');

        $data['bank'] = $this->accountingsmodel->bankpayment_trans($pagenum, 'data');
        $this->load->view('Accounting/' . $page, $data);
    }

    function Insertpayment($refid) {
        $res = $this->accountingsmodel->bank_payment($refid);
    }

    function Insertunpostpayment() {
        $res = $this->accountingsmodel->unpostcust_payment();
        if ($res == 1) {
            redirect('master/index/65/12');
        }
    }

    function updatecustpayment() {

        $res = $this->accountingsmodel->updatecust_payment();
        redirect('master/index/65/12');
    }

    function InsertPostDatedCheque() {
        $type = $_POST['pay_n_dep'];
        $res = $this->accountingsmodel->postdatedcheque_unpostpayment();
        if ($res == 1) {
            redirect('master/index/118/12');
        }
    }

    function Insertbankpayment() {

        $type = $_POST['pay_n_dep'];
        $res = $this->accountingsmodel->bankaccount_unpostpayment();
        if ($res == 1) {

            if ($type == 1) {
                redirect('master/index/89/12');
            } else if ($type == 2) {
                redirect('master/index/67/12');
            }
        }
    }

    function data_exist($table, $data) {

        $res = $this->accountingsmodel->data_exist($table, $data);
    }

    function code_exist($table, $field, $data) {
        $res = $this->accountingsmodel->code_exist($table, $field, $data);
    }

    /*     * *************************************Bank Account Transfer functions starts here*****-********************************* */

    function bank_bal($id) {
        $res = $this->accountingsmodel->bank_bal($id);
    }

    function viewaccount_page($page) {

        $this->load->view('Accounting/' . $page);
    }

    function Geteditpayment($page, $refid) {

        $data['result'] = $this->mastermodel->get_data_srow('unposted_pay_dep', $refid, 'reference');
        $this->load->view('Accounting/' . $page, $data);
    }

    function GeteditPostDatedCheque($page, $refid) {

        $data['result'] = $this->mastermodel->get_data('unposted_pay_dep', $refid, 'reference');
        $this->load->view('Accounting/' . $page, $data);
    }

    function Geteditbankpay($page, $refid) {

        $data['result'] = $this->mastermodel->get_data('unposted_pay_dep', $refid, 'reference');
        $this->load->view('Accounting/' . $page, $data);
    }

    function Geteditbankjournal($page, $refid) {

        $data['result'] = $this->mastermodel->get_data('unposted_journal', $refid, 'reference');
        $this->load->view('Accounting/' . $page, $data);
    }

    function Geteditpostbankjournal($page, $refid) {

        $data['result'] = $this->mastermodel->get_data('gl_trans', $refid, 'type_no');
        $this->load->view('Accounting/' . $page, $data);
    }

    function Geteditautojournal($page, $refid) {

        $data['result'] = $this->mastermodel->get_data('auto_journal', $refid, 'reference');
        $this->load->view('Accounting/' . $page, $data);
    }

    function Geteditbank_transfer($page, $refid) {

        $data['result'] = $this->mastermodel->get_data_srow('bank_to_bank', $refid, 'ref');
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewjournal_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->journal_trans('0', 'count');


        $data['bank'] = $this->accountingsmodel->journal_trans($pagenum, 'data');
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewautojournal_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->autojournal_trans($pagenum, 'count');


        $data['bank'] = $this->accountingsmodel->autojournal_trans($pagenum, 'data');
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewreverse_trans_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;

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

    function viewunpostedjournal_pages($page, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->journal_unpost('0', 'count');
        $data['bank'] = $this->accountingsmodel->journal_unpost($pagenum, 'data');
        $this->load->view('Accounting/' . $page, $data);
    }

    /* Receipt voucher */

    function viewunpostedbank_deposit($page, $pagenum, $trans) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->banktrans_unpost('0', 'count', $trans);
        $data['bank'] = $this->accountingsmodel->banktrans_unpost($pagenum, 'data', $trans);
        $this->load->view('Accounting/' . $page, $data);
    }

    /* Post Dated Cheque */

    function viewunposted_pdc($page, $pagenum, $trans) {
        $trans = "";
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->pdc_unpost('0', 'count', $trans);
        $data['bank'] = $this->accountingsmodel->pdc_unpost($pagenum, 'data', $trans);
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewbank_pages($page, $type, $pagenum) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->count_val('bank_to_bank', 'type', $type);

        $data['bank'] = $this->accountingsmodel->bank_trans('bank_to_bank', $pagenum, 'type', $type);
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewbanktransfer_pages($page, $pagenum, $post) {

        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->bank_trans('0', 'count', $post);

        $data['bank'] = $this->accountingsmodel->bank_trans($pagenum, 'data', $post);
        $this->load->view('Accounting/' . $page, $data);
    }

    function Insertbanktransfer() {
        $res = $this->accountingsmodel->bank_transfer();

        if ($res == 1) {
            redirect('master/index/68/12');
        }
    }

    function updatebanktransfer() {
        $res = $this->accountingsmodel->updatebank_transfer();

        if ($res == 1) {
            redirect('master/index/68/12');
        }
    }

    function delete_trans_custdata($type, $refid, $pageno = 1) {
        // $result=$this->accountingsmodel->deletetrans($type,$refid);
    }

    /*     * **********************************function for journal entry********************************************* */

    function Insertjournal() {

        $res = $this->accountingsmodel->add_unposted_journal();

        if ($res == 1) {
            redirect('master/index/69/12');
        }
    }

    function Insertreverse_journal() {

        //echo "<script>alert('hi! Controller')</script>";
        $res = $this->accountingsmodel->add_reverse_posted_journal();
        //echo $res;
             if($res==1)
             {
                   redirect('customer/index/91/12');
             }
    }

    function Insertautojournal() {

        $res = $this->accountingsmodel->add_auto_journal();

        if ($res == 1) {
            redirect('master/index/91/12');
        }
    }

    function post_journal($rid) {
        $res = $this->accountingsmodel->add_journal($rid);
    }

    function post_pdc() {
        $rid = $_POST['reference'];
//        echo $rid;
        $this->accountingsmodel->update_pdc($rid);
        $res = $this->accountingsmodel->bankaccount_payment($rid);
        if ($res == 1) {
            redirect('master/index/118/12');
        }
    }

    function post_bank_trans($rid) {
        $res = $this->accountingsmodel->bankaccount_payment($rid);
    }

    function post_banktobank_trans($id) {
        $res = $this->accountingsmodel->post_banktobank_trans($id);
    }

    function post_autojournal($rid, $date) {
        $res = $this->accountingsmodel->add_autojournal($rid, $date);
    }

    function deleteunpost_journal($table, $id) {

        $res = $this->accountingsmodel->delete_up_journal($table, $id);
        ;
    }

    function loadacc_type($acctype) {
        $data['bankacc'] = $this->accountingsmodel->getbank_acc($acctype);
        $this->load->view('Accounting/loadacc_type', $data);
    }

    function loadsubacc_type($acctype) {
        $data['bankacc'] = $this->accountingsmodel->get_acc_sub($acctype);
        $this->load->view('Accounting/loadacc_type', $data);
    }

    function load_account_page($acctype) {
        $data['acctype'] = $acctype;
        $this->load->view('Accounting/load_account_page', $data);
    }

    function loadpayment_list($table, $value) {
        $dat = explode("~", $value);
        $data['type'] = $dat[0];
        $data['account'] = $dat[1];
        $data['fromid'] = $dat[2];
        $data['totalpaid'] = $this->accountingsmodel->get_emp_paid_amount($dat[2], $table);
        $data['totalalloc'] = $this->accountingsmodel->get_emp_alloc_amount($dat[2], $table);
        $data['bankpayment'] = $this->accountingsmodel->getpayment_list($value);
        $this->load->view('Accounting/loadpayment_list', $data);
    }

    function checkaccountisset($account, $table) {
        $res = $this->accountingsmodel->checkaccountisset($account, $table);
        echo $res;
    }

    function checkaccountsetting() {
        $res = $this->accountingsmodel->checkaccountsetting();
        echo $res;
    }

    function checktrans_codeset($val) {
        $res = $this->accountingsmodel->checktrans_codeset($val);
        echo $res;
    }

    function get_trans_code($val) {
        $res = $this->accountingsmodel->get_reference_code($val);
        echo $res;
    }

    function viewacc_settings() {


        $data['acc_setting'] = $this->accountingsmodel->Getsubacc_settings();
        $this->load->view('Accounting/viewsubacc_setting', $data);
    }

    function addreportpage($page) {

        $this->load->view('Accounting/' . $page);
    }

    function chart_report() {

        $this->load->plugin('to_pdf');
        $data['report'] = $this->accountingsmodel->get_chart_report();
        $page = 'pdf_chart_report';
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function journal_entry_report($date1 = '', $date2 = '') {

        $data['fdate'] = $date1;
        $data['tdate'] = $date2;
        $this->load->plugin('to_pdf');
        $data['report'] = $this->accountingsmodel->get_journal_report($date1, $date2);
        $page = 'pdf_journal_report';
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function customer_bal_report($customer_id, $date1, $date2) {
        $data['fdate'] = $date1;
        $data['tdate'] = $date2;
        $cust = explode("~", $customer_id);
        $cus_id = $cust[0];
        $cus_code = $cust[1];
        $data['cust_id'] = $cus_id;
        $this->load->plugin('to_pdf');
        $data['report'] = $this->accountingsmodel->get_customer_balance($cus_id, $date1, $date2);
        $data['alloc_detail'] = $this->accountingsmodel->get_cust_allocate_bal($cus_code, $date1, $date2);
        // var_dump($data['alloc_detail']);
        $page = 'pdf_customer_balance';
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function updatetrans_code() {
        $res = $this->accountingsmodel->updatetrans_code();
        if ($res >= 1) {
            echo "Updated  Sucessfully";
        }
    }

    function updateaccount_type() {
        $res = $this->accountingsmodel->updateaccount_type();
        if ($res >= 1) {
            echo "Updated  Sucessfully";
        }
    }

    function bank_statement_report($bankid, $date1, $date2) {
        $data['fdate'] = $date1;
        $data['tdate'] = $date2;
        $data['bank_id'] = $bankid;
        $this->load->plugin('to_pdf');
        $data['report'] = $this->accountingsmodel->get_bank_statement($bankid, $date1, $date2);
        $page = 'pdf_bank_statement';
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function chart_trans_report($acc, $date1 = '', $date2 = '') {

        $data['fdate'] = $date1;
        $data['tdate'] = $date2;
        $data['acc_code'] = $acc;
        $this->load->plugin('to_pdf');
        $data['report'] = $this->accountingsmodel->get_chart_trans_report($acc, $date1, $date2);
        $page = 'pdf_chart_trans_report';
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function viewtransactioncode($page, $pageno = 1, $field, $value = '') {

        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $value;
        $data['totrecord'] = $this->accountingsmodel->countchart_group('transaction_code', $field, $value);
        $data['transcode'] = $this->accountingsmodel->Getchart_group('transaction_code', $pageno, $field, $value);
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function viewchart_group($pageno = 1, $field, $value = '') {


        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $output = $this->accountingsmodel->showchart_group($pageno, $field, $value);
        $data['chart_group'] = $output['result'];
        $data['totrecord'] = $output['totcount'];

        $data['field'] = $field;
        $data['text'] = $value;

        $this->load->view('Accounting/view_chart_group', $data);
    }

    function load_chart_group($pageno = 1, $field, $value = '') {


        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $output = $this->accountingsmodel->showchart_group($pageno, $field, $value);
        $data['chart_group'] = $output['result'];
        $data['totrecord'] = $output['totcount'];

        $data['field'] = $field;
        $data['text'] = $value;

        $this->load->view('Accounting/load_chart_group', $data);
    }

    function load_chart_groupjournal($pageno = 1, $field, $count = '', $value = '') {


        $value = str_replace("~", " ", $value);
        $value = str_replace("_", "/", $value);
        $data['currpage'] = $pageno;
        $output = $this->accountingsmodel->showchart_group($pageno, $field, $value);
        $data['chart_group'] = $output['result'];
        $data['totrecord'] = $output['totcount'];
        $data['countdiv'] = $count;
        $data['field'] = $field;
        $data['text'] = $value;

        $this->load->view('Accounting/load_chart_groupjournal', $data);
    }

    function load_add_page($page) {

        $this->load->view('Accounting/' . $page);
    }

    function insertchart_group() {
        $res = $this->accountingsmodel->addchart_group();
        if ($res == 1) {
            echo "Group Added Sucessfully";
        } else {
            echo "Error While Adding";
        }
    }

    function inserttrans_code() {
        $res = $this->accountingsmodel->addtransaction_code();
        if ($res == 1) {
            echo "Code Added Sucessfully";
        } else {
            echo "Error While Adding";
        }
    }

    function insert_chart_code() {
        $res = $this->accountingsmodel->addaccount_type();

        if ($res == 1) {
            echo "Code Added Sucessfully";
        } else {
            echo "Error While Adding";
        }
    }

    function insertaccount_type() {
        $res = $this->accountingsmodel->addaccount_type();
        if ($res == 1) {
            echo "Code Added Sucessfully";
        } else {
            echo "Error While Adding";
        }
    }

    function Get_editchart_group($id, $pageno, $field, $text = "") {

        $data['editchart_group'] = $this->accountingsmodel->Get_edit_data('id', 'chart_master', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;
        $this->load->view('Accounting/edit_chart_group', $data);
    }

    function Get_edittrans_code($id, $pageno, $field, $text = "") {

        $data['edittrans_code'] = $this->accountingsmodel->Get_edit_data('id', 'transaction_code', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;
        $this->load->view('Accounting/edit_trans_code', $data);
    }

    function edit_account_type($id, $pageno, $field, $text = "") {

        $data['editaccnt'] = $this->accountingsmodel->Get_edit_data('id', 'char_type', $id);
        $data['currpage'] = $pageno;
        $data['field'] = $field;
        $data['text'] = $text;
        $this->load->view('Accounting/edit_account_type', $data);
    }

    function updatechart_group() {
        $res = $this->accountingsmodel->updatechart_group();
        if ($res >= 1) {
            echo "Updated Sucessfully";
        }
    }

    function search_autojournal($page, $seloption, $pagenum = "", $searchtext = "") {
        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_autojournal($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_autojournal($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_unposted_journal($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_unposted_journal($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'tran_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_posted_journal($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_posted_journal($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'trans_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_bank_transfer($seloption, $searchtext, '', '', 'true', $post);
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_bank_transfer($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false', $post);
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'trans_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_posted_bank_deposit($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_posted_bank_deposit($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 't.date' || $seloption == 'ch_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        if ($seloption == 'r.type') {
            if (strpos($searchtext, 'R') === 0 || strpos($searchtext, 'r') === 0)
                $searchtext = 2;
            else
                $searchtext = 1;
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_unposted_pdc($seloption, $searchtext, '', '', 'true', 'post_dated_cheque');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_unposted_pdc($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false', 'post_dated_cheque');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 't.date' || $seloption == 'ch_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        if ($seloption == 'r.type') {
            if (strpos($searchtext, 'R') === 0 || strpos($searchtext, 'r') === 0)
                $searchtext = 2;
            else
                $searchtext = 1;
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_posted_pdc($seloption, $searchtext, '', '', 'true', 'post_dated_cheque');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_posted_pdc($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false', 'post_dated_cheque');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 't.date' || $seloption == 'ch_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_unposted_bank_deposit($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_unposted_bank_deposit($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 't.date' || $seloption == 'ch_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_unposted_bank_payment($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_unposted_bank_payment($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'trans_date' || $seloption == 'ch_date')  {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_posted_bank_payment($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_posted_bank_payment($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 't.date' || $seloption == 'ch_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_unposted_customer_payment($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_unposted_customer_payment($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

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

        $searchtext = str_replace("~", " ", $searchtext);
        $searchtext = str_replace("_", "/", $searchtext);
        if ($seloption == 'tran_date' || $seloption == 'ch_date') {
            $searchtext = $this->mastermodel->convdatformat($searchtext);
        }
        if ($seloption == 'c.amount') {
            $searchtext = "-" . $searchtext;
        }
        $data['mode'] = $searchtext;
        $data['perpage'] = '10';
        $data['searchoption'] = $seloption;
        $data['searchtxt'] = $searchtext;
        $data['nooflist'] = '4';
        $data['count'] = $this->accountingsmodel->search_posted_customer_payment($seloption, $searchtext, '', '', 'true');
        $data['totrecord'] = $data['count'];
        $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['currpage'] = $pagenum;
        $data['bank'] = $this->accountingsmodel->search_posted_customer_payment($seloption, $searchtext, $data['pagenum'], $data['perpage'], 'false');
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function viewcustalloc_pages($page, $type, $pagenum, $seloption, $searchtext = "") {
        $searchtext = str_replace('~', ' ', $searchtext);
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->countcust_alloc_val('customer_trans', $seloption, $searchtext);
        $data['seloption'] = $seloption;
        $data['searchtext'] = $searchtext;
        $data['bank'] = $this->accountingsmodel->custom_allocat('customer_trans', $pagenum, $seloption, $searchtext);
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewempalloc_pages($page, $type, $pagenum, $seloption, $searchtext = "") {
        $searchtext = str_replace('~', ' ', $searchtext);
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->countemp_alloc_val('agent_trans', $seloption, $searchtext);
        $data['seloption'] = $seloption;
        $data['searchtext'] = $searchtext;
        $data['bank'] = $this->accountingsmodel->emplo_allocat('agent_trans', $pagenum, $seloption, $searchtext);
        $this->load->view('Accounting/' . $page, $data);
    }

    function viewcompalloc_pages($page, $type, $pagenum, $seloption, $searchtext = "") {
        $searchtext = str_replace('~', ' ', $searchtext);
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->countemp_alloc_val('company_trans', $seloption, $searchtext);
        $data['seloption'] = $seloption;
        $data['searchtext'] = $searchtext;
        $data['bank'] = $this->accountingsmodel->emplo_allocat('company_trans', $pagenum, $seloption, $searchtext);
        $this->load->view('Accounting/' . $page, $data);
    }
             
    function viewcommissionalloc_pages($page, $type, $pagenum, $seloption, $searchtext = "") {
        $searchtext = str_replace('~', ' ', $searchtext);
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->countcommission_alloc_val('company_trans', $seloption, $searchtext);
        $data['seloption'] = $seloption;
        $data['searchtext'] = $searchtext;
        $data['bank'] = $this->accountingsmodel->commission_allocat('company_trans', $pagenum, $seloption, $searchtext);
        $this->load->view('Accounting/' . $page, $data);
    }

    function pdf_receipt_voucher($id) {


        $this->load->plugin('to_pdf');
        $data['receipt'] = $this->accountingsmodel->get_receipt_voucher($id);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_receipt_voucher';


        $data['id'] = $id;

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

    function pdf_receipt_voucherforall($id) {


        $this->load->plugin('to_pdf');
        $data['receipt'] = $this->accountingsmodel->generate_rv($id);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_receipt_voucherforall';


        $data['id'] = $id;

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

    function pdf_payment_voucherforall($id) {


        $this->load->plugin('to_pdf');
        $data['receipt'] = $this->accountingsmodel->generate_pv($id);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_payment_voucherforall';


        $data['id'] = $id;

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

    function searchtransaction($page, $pagenum, $type, $from = '', $to = '', $ref = "") {
        $ref = str_replace("~", " ", $ref);
        $ref = str_replace("_", "/", $ref);
        if ($from == '~')
            $from = '';
        if ($to == '~')
            $to = '';
        if ($ref == '~')
            $ref = '';
        $data['currpage'] = $pagenum;
        $data['totrecord'] = $this->accountingsmodel->search_trans($pagenum, 'count', $ref, $type, $from, $to);
        $data['bank'] = $this->accountingsmodel->search_trans($pagenum, 'data', $ref, $type, $from, $to);
        $this->load->view('Accounting/' . $page, $data);
    }

    function pdf_trail_bal($from, $reportin, $mainacc = "", $rangefrom = "", $rangeto = "") {


        $to1 = explode('-', $from);
        $days = $this->accountingsmodel->monthdays($to1[1], $to1[2]);
        $to = $days . '-' . $to1[1] . '-' . $to1[2];
        $from = '01-' . $to1[1] . '-' . $to1[2];

        $this->load->plugin('to_pdf');
        $data['receipt'] = $this->accountingsmodel->get_trail_balance($from, $to, $mainacc, $rangefrom, $rangeto);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_trail_balance';

        $data['date1'] = $from;
        $data['date2'] = $to;
        $data['sub'] = 'true';
        $data['heading'] = "Sub Account Trial Balance";
        $data['rfrom'] = $rangefrom;
        $data['rto'] = $rangeto;
        $data['reportin'] = $reportin;

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

    function pdf_main_trail_bal($from, $reportin) {
        $to1 = explode('-', $from);
        $days = $this->accountingsmodel->monthdays($to1[1], $to1[2]);
        $to = $days . '-' . $to1[1] . '-' . $to1[2];
        $from = '01-' . $to1[1] . '-' . $to1[2];

        $this->load->plugin('to_pdf');
        $data['receipt'] = $this->accountingsmodel->get_main_trail_balance($from, $to);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_trail_balance';
        $data['sub'] = 'false';
        $data['date1'] = $from;
        $data['date2'] = $to;
        $data['heading'] = "Trial Balance";
        $data['rfrom'] = "";
        $data['rto'] = "";
        $data['reportin'] = $reportin;
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function pdf_sub_gl($from, $to, $mainacc, $rfrom = '', $rto = '', $reportin = 'xls') {
        $this->load->plugin('to_pdf');
        $output = $this->accountingsmodel->get_sub_gl($from, $to, $mainacc, $rfrom, $rto);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $data['receipt'] = $output['transdet'];

        $page = 'pdf_gl';
        $data['sub'] = 'true';
        $data['date1'] = $from;
        $data['date2'] = $to;
        $data['acctitle'] = 'Sub A/c Total';
        $data['heading'] = "Sub Account Ledger";
        $data['fname'] = "Sub Account Ledger";
        $data['rfrom'] = $rfrom;
        $data['rto'] = $rto;
        $data['reportin'] = $reportin;
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function pdf_balance_sheet($fromdate, $todate, $reportin = 'xls') {
        $this->load->plugin('to_pdf');
        $output = $this->accountingsmodel->get_balance_sheet($fromdate, $todate);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $data['viewinfo'] = $output;
        $page = 'pdf_balance_sheet';
        $data['sub'] = 'false';
        $data['acctitle'] = 'A/c Total';
        $data['date1'] = $fromdate;
        $data['date2'] = $todate;
        $data['heading'] = "Balance Sheet";
        $data['fname'] = "Balance Sheet";
        $data['rfrom'] = '';
        $data['rto'] = '';
        $data['reportin'] = $reportin;

        $fname = "Balance sheet";
        if ($reportin == 'pdf') {
            $html = $this->load->view('Accounting/' . $page . '', $data, true);
            pdf_create($html, $fname, 'true');
        } else {
            $this->load->view('Accounting/' . $page . '', $data);
        }
    }

    function pdf_profit_loss($fromdate, $todate, $reportin = 'xls') {
        $this->load->plugin('to_pdf');
        $output = $this->accountingsmodel->get_balance_sheet($fromdate, $todate);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $data['viewinfo'] = $output;
        $page = 'pdf_profit_loss';
        $data['sub'] = 'false';
        $data['acctitle'] = 'A/c Total';
        $data['date1'] = $fromdate;
        $data['date2'] = $todate;
        $data['heading'] = "INCOME STATEMENT";
        $data['fname'] = "INCOME STATEMENT";
        $data['rfrom'] = '';
        $data['rto'] = '';
        $data['reportin'] = $reportin;
        $html = $this->load->view('Accounting/' . $page . '', $data, true);
//        echo $html;
        $fname = "Profit Loss";
        if ($reportin == 'pdf') {
            $html = $this->load->view('Accounting/' . $page . '', $data, true);
            pdf_create($html, $fname, 'true');
        } else {
            $this->load->view('Accounting/' . $page . '', $data);
        }
    }

    function pdf_main_gl($rangefrom, $rangeto, $fromdate, $todate) {
        $this->load->plugin('to_pdf');
        $output = $this->accountingsmodel->get_main_gl($rangefrom, $rangeto, $fromdate, $todate);
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $data['receipt'] = $output['transdet'];

        $page = 'pdf_gl';
        $data['sub'] = 'false';
        $data['acctitle'] = 'A/c Total';
        $data['date1'] = $fromdate;
        $data['date2'] = $todate;
        $data['heading'] = "General Ledger";
        $data['fname'] = "General Ledger";
        $data['rfrom'] = $rangefrom;
        $data['rto'] = $rangeto;
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function pdf_ageing_report($from, $accval, $reportin) {
        $this->load->plugin('to_pdf');
        $sbstr = substr($accval, 0, 3);

        switch ($sbstr) {
            case 'CRP':
                $data['maintype'] = 3;
                $data['cid'] = $this->customermodel->getSingleFieldValue('customers', 'id', 'code', $accval);
                break;
            case 'EMP':
                $data['maintype'] = 1;
                $data['cid'] = $this->customermodel->getSingleFieldValue('staffpersonaldetails', 'id', 'employeeid', $accval);
                break;
            case 'INS':
                $data['maintype'] = 2;
                $data['cid'] = $this->customermodel->getSingleFieldValue('insurance_company', 'id', 'company_code', $accval);
                break;
            case 'IDL':
                $data['maintype'] = 3;
                $data['cid'] = $this->customermodel->getSingleFieldValue('customers', 'id', 'code', $accval);
                break;
        }
        $output = $this->accountingsmodel->get_ageing_report($from, $accval, $data['maintype'], $data['cid']);
        $data['balance'] = $output['balance'];
        $data['current'] = $output['current'];
        $data['lthirty'] = $output['lthirty'];
        $data['lninty'] = $output['lninty'];
        $data['loneeighty'] = $output['loneeighty'];
        $data['ltseventy'] = $output['ltseventy'];
        $data['ltsixty'] = $output['ltsixty'];
        $data['statement'] = $output['transdet'];
        $data['accdet'] = $output['accdet'];
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_ageing_report';
        $data['reportin'] = $reportin;
        $data['accountcode'] = $accval;
        $data['date1'] = $from;
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function pdf_ageingsummary_report($from, $accval, $empid = "", $reportin) 
    {
        $this->load->plugin('to_pdf');
        $output = $this->accountingsmodel->get_ageingsummary_report($from, $accval, $empid);

        $data['statement'] = $output['transdet'];
        $data['accdet'] = $output['accdet'];
        $data['accounttype'] = $accval;
        if (!empty($empid))
            $accval = 3;

        $data['maintype'] = $accval;

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


        $data['date1'] = $from;
        $data['reportin'] = $reportin;

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

    function pdf_ageingsummary_report_new($from, $accval, $empid = "", $reportin) 
    {
        $this->load->plugin('to_pdf');
        $output = $this->accountingsmodel->get_ageingsummary_report_new($from, $accval, $empid);

        $data['statement'] = $output['transdet'];
        $data['accdet'] = $output['accdet'];
        $data['accounttype'] = $accval;
        if (!empty($empid))
            $accval = 3;

        $data['maintype'] = $accval;

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


        $data['date1'] = $from;
        $data['reportin'] = $reportin;

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

    function pdf_pdc_report($cheque_from_date, $cheque_to_date, $tr_type, $reportin, $customer_id = "") {

        $this->load->plugin('to_pdf');

        $data['maintype'] = 3;

        if ($customer_id != "" && $customer_id > 0) {
            $data['cid'] = $customer_id;
            $value = $this->customermodel->getSingleFieldValue('customers', 'code', 'id', $customer_id);
        } else {
            $data['cid'] = 0;
            $value = "";
        }

        $output = $this->accountingsmodel->get_pdc_report($data['maintype'], $data['cid'], $cheque_from_date,$cheque_to_date, $tr_type, $value);

//        $output = $this->accountingsmodel->get_statement_account($value, $data['maintype'], $data['cid'], $cheque_date, $cheque_date);
        $data['statement'] = $output['transdet'];
        $data['refs_count']=$output['refs_count'];
        $data['customer'] = $output['customer'];
        $data['tr_type'] = $tr_type;
        $data['openingbalance'] = $output['openbalance'];
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_pdc_report';

        $data['date1'] = $cheque_from_date;
        $data['date2'] = $cheque_to_date;
        $data['reportin'] = $reportin;


//var_dump($data['statement']);

        $this->load->view('Accounting/' . $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('Accounting/loadcustomerlist', $data);
    }

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


        //echo 'page no:'. $pagenum .' Searchby:'. $searchBy.' valuie:'.$staffname;

        $data['per_page'] = 6;

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


        $data['searchBy'] = $searchBy;
        $data['currentpage'] = $pagenum;
        $data['custname'] = $staffname;
        $counts = $this->documentsmodel->count_alls('staffpersonaldetails', 'id', '');
        if ($counts == 0) {
            $data['Maxpage'] = 1;
        } else {
            $data['Maxpage'] = ceil($counts / $data['per_page']);
        }



        $data['viewinfo'] = $this->hrmodel->employeelistpagination($pagenum, $data['per_page'], $staffname, $searchBy);

        $this->load->view('Accounting/loadstafflist', $data);
    }

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

        $data['count'] = $this->mastermodel->search_company($seloption, $searchtext, 'true');

        $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->mastermodel->search_company($seloption, $searchtext, 'false', $data['pagenum'], $data['perpage']);
        $this->load->view('Accounting/loadcomplist', $data);
    }

    function pdf_statement_account($value, $from, $to, $reportin) {
        $this->load->plugin('to_pdf');
        $sbstr = substr($value, 0, 3);

        switch ($sbstr) {
            case 'CRP':
                $data['maintype'] = 3;
                $data['cid'] = $this->customermodel->getSingleFieldValue('customers', 'id', 'code', $value);
                break;
            case 'EMP':
                $data['maintype'] = 1;
                $data['cid'] = $this->customermodel->getSingleFieldValue('staffpersonaldetails', 'id', 'employeeid', $value);
                break;
            case 'INS':
                $data['maintype'] = 2;
                $data['cid'] = $this->customermodel->getSingleFieldValue('insurance_company', 'id', 'company_code', $value);
                break;
            case 'IDL':
                $data['maintype'] = 3;
                $data['cid'] = $this->customermodel->getSingleFieldValue('customers', 'id', 'code', $value);
                break;
        }


        $output = $this->accountingsmodel->get_statement_account($value, $data['maintype'], $data['cid'], $from, $to);
        $data['accdet'] = $output['accdet'];
        $data['statement'] = $output['transdet'];
        $data['openingbalance'] = $output['openbalance'];
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_statement_account';
        $data['payment_info']=$output['payments'];
        $data['date1'] = $from;
        $data['date2'] = $to;
        $data['reportin'] = $reportin;
        $this->load->view('Accounting/' . $page . '', $data);
    }

    function fiscaldate_check($date) {
        $data = $this->accountingsmodel->fiscaldate_check($date);
        echo $data;
    }

    function searchchartaccountmain($mainaccount, $counter = "") {
        $data['mainacc'] = $mainaccount;
        $data['counter'] = $counter;
        $this->load->view('Accounting/searchchartaccountmain', $data);
    }

    function searchmainaccount($counter = "") {

        $data['counter'] = $counter;
        $this->load->view('Accounting/searchmainaccount', $data);
    }

    function searchmainaccountjournal($count = "") {
        $data['count'] = $count;
        $this->load->view('Accounting/searchmainaccountjournal', $data);
    }

    function loadaccountid($accid) {
        $id = $this->customermodel->getSingleFieldValue('chart_master', 'id', 'account_code', $accid);
        echo $id;
    }

    function loadaccountname($accid) {
        $id = $this->customermodel->getSingleFieldValue('chart_master', 'account_name', 'account_code', $accid);
        echo $id;
    }

    function findCustomerAccount($code) {
//        $code = explode("-", $code);
//       $code=str_replace("~","/",$code);
//       var_dump( $code);die();
//         $cust_id = $_POST['customer_id'];
        $cust_acc = $this->customermodel->getSingleFieldValue('customers', 'code', 'id', $code);
        $data = $this->accountingsmodel->findaccountbyno($cust_acc);
        echo $data;
    }

    function findaccountbyno($code) {
        $code = explode("-", $code);
//       $code=str_replace("~","/",$code);
//       var_dump( $code);die();
        $data = $this->accountingsmodel->findaccountbyno($code[0]);
        echo $data;
    }

    function pdf_allocation_report($value, $from, $to, $reportin, $payment_status) {

        $this->load->plugin('to_pdf');
        $sbstr = substr($value, 0, 3);

        switch ($sbstr) {
            case 'CRP':
                $data['maintype'] = 3;
                $data['cid'] = $this->customermodel->getSingleFieldValue('customers', 'id', 'code', $value);
                break;
            case 'EMP':
                $data['maintype'] = 1;
                $data['cid'] = $this->customermodel->getSingleFieldValue('staffpersonaldetails', 'id', 'employeeid', $value);
                break;
            case 'INS':
                $data['maintype'] = 2;
                $data['cid'] = $this->customermodel->getSingleFieldValue('insurance_company', 'id', 'company_code', $value);
                break;
            case 'IDL':
                $data['maintype'] = 3;
                $data['cid'] = $this->customermodel->getSingleFieldValue('customers', 'id', 'code', $value);
                break;
        }


        $output = $this->accountingsmodel->get_allocation_report($value, $data['maintype'], $data['cid'], $from, $to);
        $data['accdet'] = $output['accdet'];
        $data['statement'] = $output['transdet'];
        $data['payment_status'] = $payment_status;
        $data['company'] = $this->mastermodel->getdatas('mycompany');
        $page = 'pdf_allocation_report';

        $data['date1'] = $from;
        $data['date2'] = $to;
        $data['reportin'] = $reportin;




        $this->load->view('Accounting/' . $page . '', $data);
    }
    
    function autosuggestchartaccounts() {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;
        $chart_master_list = $this->mastermodel->listchartofaccounts();
        foreach ($chart_master_list as $items) {
            $code = $items['account_code'];
            $chart_account_name = $items['account_name'];
            $id = $items['id'];
            if (strpos(strtolower($code), $q) !== false) {
                echo '' . $code . '-' . $chart_account_name . '#' . $id . '#';
                echo "\n";
            } else if (strpos(strtolower($chart_account_name), $q) !== false) {
                echo '' . $code . '-' . $chart_account_name . '#' . $id . '#';
                echo "\n";
            }
        }
    }
    
    
    function view_customer_receipt($pagenum,$searchopt='',$searchtext='') 
    {
        $searchopt = urldecode($searchopt);
        $searchtext = urldecode($searchtext);
        $perpage = $this->config->item('perpage');
        $_SESSION['pagenum'] = $pagenum;
        $data['pagenum'] = $pagenum;
        if ($pagenum == 1) {
            $data['id'] = 1;
        } else {
            $data['id'] = (($pagenum - 1) * $perpage) + 1;
        }

        if ($searchopt !== '' && $searchtext !== '') {
            $_SESSION['searchdata']['searchopt'] = $searchopt;
            $_SESSION['searchdata']['searchtext'] = $searchtext;
        } else {
            $_SESSION['searchdata'] = "";
        }
        /* <---------------- For pagination purpose------------>         */

        $output = $this->accountingsmodel->search_customer_receipt($pagenum);
        $data['startpage'] = $output['startpage'];
        $data['endpage'] = $output['endpage'];
        $data['viewinfo'] = $output['results'];
        $this->load->view('Accounting/view_customer_receipt' . '', $data);
    }

    function add_customer_receipt() 
    {
        $this->load->view('Accounting/add_customer_receipt');
    }
    
    function insert_customer_receipt() 
    {
        $res = $this->accountingsmodel->insert_customer_receipt();
        
        redirect('master/index/126/12');
    }

    function edit_customer_receipt($receipt_id) 
    {
        $data = array();
        $data['viewinfo'] = $this->accountingsmodel->get_receipt_details($receipt_id);
        $this->load->view('Accounting/edit_customer_receipt',$data);
    }
    
    function update_customer_receipt() 
    {
        $res = $this->accountingsmodel->update_customer_receipt();
        
        redirect('master/index/126/12');
    }

    function single_customer_receipt($receipt_id) 
    {
        $data = array();
        $data['viewinfo'] = $this->accountingsmodel->get_receipt_details($receipt_id);
        $this->load->view('Accounting/single_customer_receipt',$data);
    }
    
    function delete_customer_receipt($customer_receipt_id,$pagenum=1) 
    {
        $res = $this->accountingsmodel->delete_customer_receipt($customer_receipt_id);
        
        $perpage = $this->config->item('perpage');
        $_SESSION['pagenum'] = $pagenum;
        $data['pagenum'] = $pagenum;
        $data['id'] = 1;
        
        /* <---------------- For pagination purpose------------>         */

        $output = $this->accountingsmodel->search_customer_receipt($pagenum);
        $data['startpage'] = $output['startpage'];
        $data['endpage'] = $output['endpage'];
        $data['viewinfo'] = $output['results'];
        $this->load->view('Accounting/view_customer_receipt' . '', $data);
    }
    
    function view_customer_receipt_allocation($customer_receipt_id)
    {
        $data = array();
        $viewinfo = $this->accountingsmodel->get_receipt_details($customer_receipt_id);
        $data['policy_details'] = $this->accountingsmodel->get_policy_details($viewinfo->customer_id,$viewinfo->insurance_company_id);
        $data['allocation'] = $this->accountingsmodel->get_receipt_allocated_amount($customer_receipt_id);
        $data['viewinfo'] = $viewinfo;
        $this->load->view('Accounting/view_customer_receipt_allocation', $data);
    }
    
    function add_customer_receipt_allocation()
    {
        $res = $this->accountingsmodel->add_customer_receipt_allocation();
        
        redirect('master/index/126/12');
    }
}

?>

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