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


class Main_model extends CI_Model 
{
    function __construct()
    {
        parent::__construct();
    }

    function clear_cache()
    {
        $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
        $this->output->set_header('Pragma: no-cache');
    }
	
    /* user */
    function user()
    {
        $query = $this->db->get('user');
        return $query->result_array(); 
    }
    /* user_name */
    function user_name($user_id)
    {
        $query = $this->db->get_where('user', array('id' => $user_id))->result_array();
        foreach($query as $row)
        {
            return $row['name'];
        }   
    }    
    function user_rows()
    {
        $this->db->where('status', 'Active');
        $query = $this->db->get('user');
        return $query->num_rows();           
    }      
    
    /* School Class */
    function sclass()
    {
        $query = $this->db->get('sclass');
        return $query->result_array(); 
    }
	function store_pic_data($data){
		$insert_data['content_type'] = $data['content_type'];
		$insert_data['content_option'] = $data['content_option'];
		$insert_data['title'] = $data['title'];
		$insert_data['details'] = $data['details'];
		$insert_data['date'] = $data['date'];
		$insert_data['home_image'] = $data['pic_file'];
 
		$query = $this->db->insert('home', $insert_data);
	}
	function store_pic_data34($data){
		$insert_data['content_type'] = $data['content_type'];
		$insert_data['content_option'] = $data['content_option'];
		$insert_data['title'] = $data['title'];
		$insert_data['details'] = $data['details'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('home', $insert_data);
	}
	 /* Banner */
	function store_pic_data_banner($data){
		$insert_data['title'] = $data['title'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('banner', $insert_data);
	}
	 function banner()
    {
        $query = $this->db->get('banner');
        return $query->result_array(); 
    }
   
    function banner_info($id)
    {
        $query = $this->db->get_where('banner', array('id'=>$id)); 
        return $query->result_array();
    }
	function store_banner_pic_data_update($data){
		$iddf=$data['id'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('banner', $update_data, "id = $iddf");
	}
	/* Banner */
	/* Notice Board */
	function store_pic_data_noticeboard($data){
		$insert_data['notice_headline'] = $data['notice_headline'];
		$insert_data['notice_des'] = $data['notice_des'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('notice', $insert_data);
	}
	
	function store_pic_data_noticeboard1($data){
		$insert_data['notice_headline'] = $data['notice_headline'];
		$insert_data['notice_des'] = $data['notice_des'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('notice', $insert_data);
	}
	function store_noticeboard_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('notice', $update_data, "id = $iddf");
	}
	function store_homecontent_pic_data_update($data){
		$iddf=$data['home_id'];		
		$update_data['home_image'] = $data['pic_file'];
		$query = $this->db->update('home', $update_data, "home_id = $iddf");
	}
	 function noticeboard()
    {
        $query = $this->db->get('notice');
        return $query->result_array(); 
    }
   
    function noticeboard_info($id)
    {
        $query = $this->db->get_where('notice', array('id'=>$id)); 
        return $query->result_array();
    }
	/* Notice Board */
	 function individualsms()
    {
        $limit=500;
		$query = $this->db->get('individualsms',$limit);
        return $query->result_array(); 
    }
   
    function individualsms_info($id)
    {
        $query = $this->db->get_where('individualsms', array('id'=>$id)); 
        return $query->result_array();
    }
	
	/* Notice Board */
	 function teachersms()
    {
		$limit=500;
        $query = $this->db->get('teachersms',$limit);
        return $query->result_array(); 
    }
   
    function teachersms_info($id)
    {
        $query = $this->db->get_where('teachersms', array('id'=>$id)); 
        return $query->result_array();
    }
	
	/* Notice Board */
	 function studentsms()
    {
		$limit=500;
        $query = $this->db->get('studentsms',$limit);
        return $query->result_array(); 
    }
   
    function studentsms_info($id)
    {
        $query = $this->db->get_where('studentsms', array('id'=>$id)); 
        return $query->result_array();
    }
	
	/* Notice Board */
	 function studentattendance()
    {
		$limit=500;
        $query = $this->db->get('studentattendance',$limit);
        return $query->result_array(); 
    }
   
    function studentattendance_info($id)
    {
        $query = $this->db->get_where('studentattendance', array('id'=>$id)); 
        return $query->result_array();
    }
	/* Notice Board */
	function store_pic_data_newinformation($data){
		$insert_data['notice_headline'] = $data['notice_headline'];
		$insert_data['notice_des'] = $data['notice_des'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('newinformation', $insert_data);
	}
	
	function store_pic_data_newinformation1($data){
		$insert_data['notice_headline'] = $data['notice_headline'];
		$insert_data['notice_des'] = $data['notice_des'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('newinformation', $insert_data);
	}
	function store_newinformation_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('newinformation', $update_data, "id = $iddf");
	}
	 function newinformation()
    {
        $query = $this->db->get('newinformation');
        return $query->result_array(); 
    }
   
    function newinformation_info($id)
    {
        $query = $this->db->get_where('newinformation', array('id'=>$id)); 
        return $query->result_array();
    }
	/* New Information Board */
	
	/* Institution */
	function store_pic_data_institution($data){
		$insert_data['id'] = $data['id'];
		$insert_data['ins_title'] = $data['ins_title'];
		$insert_data['ins_name'] = $data['ins_name'];
		$insert_data['eiin'] = $data['eiin'];
		$insert_data['logo'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('institution', $insert_data);
	}
	
	 function institution()
    {
        $query = $this->db->get('institution');
        return $query->result_array(); 
    }
	
	function store_institution_pic_data_update($data){
		$iddf=$data['iid'];		
		$update_data['logo'] = $data['pic_file'];
		$query = $this->db->update('institution', $update_data, "iid = $iddf");
	}
   
    function institution_info($iid)
    {
        $query = $this->db->get_where('institution', array('iid'=>$iid)); 
        return $query->result_array();
    }
	/* Institution */
	/* Governingbody */
	 function governingbody()
    {
        $query = $this->db->get('governingbody');
        return $query->result_array(); 
    }
   
    function governingbody_info($gid)
    {
        $query = $this->db->get_where('governingbody', array('gid'=>$gid)); 
        return $query->result_array();
    }
	/* Governingbody */
	/* Important Link */
	 function importantlink()
    {
        $query = $this->db->get('importantlink');
        return $query->result_array(); 
    }
   
    function importantlink_info($rid)
    {
        $query = $this->db->get_where('importantlink', array('rid'=>$rid)); 
        return $query->result_array();
    }
	/* Important Link */
	function sclass_info($scid)
    {
        $query = $this->db->get_where('sclass', array('scid'=>$scid)); 
        return $query->result_array();
    }
	 /* School Class */
	 /* Teacher Designation */
    function googlemap()
    {
        $query = $this->db->get('googlemap');
        return $query->result_array(); 
    }
	
	function googlemap_info($id)
    {
        $query = $this->db->get_where('googlemap', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Teacher Designation */
	 /* Teacher Designation */
    function facebookpage()
    {
        $query = $this->db->get('facebookpage');
        return $query->result_array(); 
    }
	
	function facebookpage_info($id)
    {
        $query = $this->db->get_where('facebookpage', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Teacher Designation */
	 /* Teacher Designation */
    function desig()
    {
        $query = $this->db->get('designation');
        return $query->result_array(); 
    }
	
	function desig_info($did)
    {
        $query = $this->db->get_where('designation', array('did'=>$did)); 
        return $query->result_array();
    }
	 /* Teacher Designation */
	 /* Album */
    function album()
    {
        $query = $this->db->get('album');
        return $query->result_array(); 
    }
	
	function album_info($album_id)
    {
        $query = $this->db->get_where('album', array('album_id'=>$album_id)); 
        return $query->result_array();
    }
	/* Notice Board */
	function store_pic_data_bnoticeboard($data){
		$insert_data['notice_headline'] = $data['notice_headline'];
		$insert_data['notice_des'] = $data['notice_des'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('bnotice', $insert_data);
	}
	
	function store_pic_data_bnoticeboard1($data){
		$insert_data['notice_headline'] = $data['notice_headline'];
		$insert_data['notice_des'] = $data['notice_des'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('bnotice', $insert_data);
	}
	function store_bnoticeboard_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('bnotice', $update_data, "id = $iddf");
	}
	
	 function bnoticeboard()
    {
        $query = $this->db->get('bnotice');
        return $query->result_array(); 
    }
   
    function bnoticeboard_info($id)
    {
        $query = $this->db->get_where('bnotice', array('id'=>$id)); 
        return $query->result_array();
    }
	/* Gallery*/
	function store_pic_data_gallery3($data){
		
	//	$insert_data['album'] = $data['album'];
		$insert_data['title'] = $data['title'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('gallery1', $insert_data);
	}
	function store_pic_data_gallery4($data){
	//	$insert_data['album'] = $data['album'];
		$insert_data['title'] = $data['title'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('gallery1', $insert_data);
	}
	
   
	function store_gallery3_picture_data_update($data){
		$iddf=$data['id'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('gallery1', $update_data, "id = $iddf");
	}
	function gallery3()
    {
		$query = $this->db->get('gallery1');
        return $query->result_array(); 
    }
	
	function gallery3_info($id)
    {
        $query = $this->db->get_where('gallery1', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Gallery*/
	  function album3()
    {
        $query = $this->db->get('album1');
        return $query->result_array(); 
    }
	
	function album3_info($album_id)
    {
        $query = $this->db->get_where('album1', array('album_id'=>$album_id)); 
        return $query->result_array();
    }
	 /* Album */
	 /* Album */
	 function vgallery()
    {
        $query = $this->db->get('vgallery');
        return $query->result_array(); 
    }
	
	function vgallery_info($id)
    {
        $query = $this->db->get_where('vgallery', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Reslut */
    function result()
    {
        $query = $this->db->get('result');
        return $query->result_array(); 
    }
	
	function result_info($id)
    {
        $query = $this->db->get_where('result', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Reslut */
	 /* Holiday */
    function iholiday()
    {
        $query = $this->db->get('iholiday');
        return $query->result_array(); 
    }
	
	function iholiday_info($hid)
    {
        $query = $this->db->get_where('iholiday', array('hid'=>$hid)); 
        return $query->result_array();
    }
	 /* Holiday */
	/* Dept teacher */
    function deptteacher()
    {
        $query = $this->db->get('dept_teacher');
        return $query->result_array(); 
    }
	
	function deptteacher_info($dtid)
    {
        $query = $this->db->get_where('dept_teacher', array('dtid'=>$dtid)); 
        return $query->result_array();
    }
	 /* Dept teacher */
	 /* Digital Class */
    function digitalclass()
    {
        $query = $this->db->get('digital_class');
        return $query->result_array(); 
    }
	
	function digitalclass_info($dcID)
    {
        $query = $this->db->get_where('digital_class', array('dcID'=>$dcID)); 
        return $query->result_array();
    }
	 /* Album */
	  /* Head Teacher */
    function headteacher()
    {
        $query = $this->db->get('headteacher');
        return $query->result_array(); 
    }
	
	function headteacher_info($id)
    {
        $query = $this->db->get_where('headteacher', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Head Teacher */
	 /* Home Content */
	  function homecontent()
    {
        $query = $this->db->get('home');
        return $query->result_array(); 
    }
	function homecontent_info($home_id)
    {
        $query = $this->db->get_where('home', array('home_id'=>$home_id)); 
        return $query->result_array();
    }
	/* Home Content */
	  /* Gallery*/
	function store_pic_data_gallery($data){
		
		$insert_data['album'] = $data['album'];
		$insert_data['title'] = $data['title'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('gallery', $insert_data);
	}
	function store_pic_data_gallery1($data){
		$insert_data['album'] = $data['album'];
		$insert_data['title'] = $data['title'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('gallery', $insert_data);
	}
	
   // function teacher()
   // {
	//	$limit=17;
	//	$query = $this->db->get('teacher',$limit);
    //    return $query->result_array(); 
    //}
	
//function teacher()
	//{
	//	$this->db->select('*');
	//	$this->db->from('teacher');
	//	$this->db->order_by('serial','desc');
	//	$query=$this->db->get();
	//	return $query->result_array();
	//}
	function store_gallery_picture_data_update($data){
		$iddf=$data['id'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('gallery', $update_data, "id = $iddf");
	}
	function gallery()
    {
		$query = $this->db->get('gallery');
        return $query->result_array(); 
    }
	
	function gallery_info($id)
    {
        $query = $this->db->get_where('gallery', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Gallery*/
	 /* Teacher*/
	function store_pic_data_teacher($data){
		
		$insert_data['serial'] = $data['serial'];
		$insert_data['name'] = $data['name'];
		$insert_data['designation'] = $data['designation'];
		$insert_data['contact'] = $data['contact'];
		$insert_data['education'] = $data['education'];
		$insert_data['join_date'] = $data['join_date'];
		$insert_data['class_teacher'] = $data['class_teacher'];
		$insert_data['section'] = $data['section'];
		$insert_data['t_class'] = $data['t_class'];
		$insert_data['t_department'] = $data['t_department'];
		$insert_data['email'] = $data['email'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('teacher', $insert_data);
	}
	function store_pic_data_teacher1($data){
		$insert_data['serial'] = $data['serial'];
		$insert_data['name'] = $data['name'];
		$insert_data['designation'] = $data['designation'];
		$insert_data['contact'] = $data['contact'];
		$insert_data['education'] = $data['education'];
		$insert_data['join_date'] = $data['join_date'];
		$insert_data['class_teacher'] = $data['class_teacher'];
		$insert_data['section'] = $data['section'];
		$insert_data['t_class'] = $data['t_class'];
		$insert_data['t_department'] = $data['t_department'];
		$insert_data['email'] = $data['email'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('teacher', $insert_data);
	}
	function store_teacher_pic_data_update($data){
		$iddf=$data['tid'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('teacher', $update_data, "tid = $iddf");
	}
   // function teacher()
   // {
	//	$limit=17;
	//	$query = $this->db->get('teacher',$limit);
    //    return $query->result_array(); 
    //}
	
//function teacher()
	//{
	//	$this->db->select('*');
	//	$this->db->from('teacher');
	//	$this->db->order_by('serial','desc');
	//	$query=$this->db->get();
	//	return $query->result_array();
	//}
	
	function teacher()
    {
		$query = $this->db->get('teacher');
        return $query->result_array(); 
    }
	
	function teacher_info($tid)
    {
        $query = $this->db->get_where('teacher', array('tid'=>$tid)); 
        return $query->result_array();
    }
	 /* Teacher*/
	 /*teacher Attandance*/
	 function teacherattandance()
    {
        $limit=600;
		$query = $this->db->get('xpert_attendance',$limit);
        return $query->result_array(); 
    }
	/*Teacher Attandance*/
	function oeattandance()
    {
        $limit=600;
		$query = $this->db->get('xpert_attendance1',$limit);
        return $query->result_array(); 
    }
	/*Teacher Attandance*/
	/*teacher Leave*/
	 function teacherleave()
    {
        $limit=600;
		$query = $this->db->get('xpert_leave',$limit);
        return $query->result_array(); 
    }
	/*Teacher Attandance*/
	
	
	
	 /* Teacher*/
	function store_pic_data_oemployee($data){
		
		$insert_data['serial'] = $data['serial'];
		$insert_data['name'] = $data['name'];
		$insert_data['designation'] = $data['designation'];
		$insert_data['contact'] = $data['contact'];
		$insert_data['education'] = $data['education'];
		$insert_data['join_date'] = $data['join_date'];
		$insert_data['image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('oemployee', $insert_data);
	}
	function store_pic_data_oemployee1($data){
		$insert_data['serial'] = $data['serial'];
		$insert_data['name'] = $data['name'];
		$insert_data['designation'] = $data['designation'];
		$insert_data['contact'] = $data['contact'];
		$insert_data['education'] = $data['education'];
		$insert_data['join_date'] = $data['join_date'];
		
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('oemployee', $insert_data);
	}
	function store_oemployee_pic_data_update($data){
		$iddf=$data['tid'];		
		$update_data['image'] = $data['pic_file'];
		$query = $this->db->update('oemployee', $update_data, "tid = $iddf");
	}
	
	function oemployee()
    {
		$query = $this->db->get('oemployee');
        return $query->result_array(); 
    }
	
	function oemployee_info($tid)
    {
        $query = $this->db->get_where('oemployee', array('tid'=>$tid)); 
        return $query->result_array();
    }
	 /* Teacher*/
	
	
	
	
	 /* Digital COntent*/
	function store_pic_data_digitalcontent($data){
		
		$insert_data['sclass'] = $data['sclass'];
		$insert_data['steacher'] = $data['steacher'];
		$insert_data['ssubject'] = $data['ssubject'];
		$insert_data['title'] = $data['title'];
		$insert_data['file_type'] = $data['file_type'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('digital_content', $insert_data);
	}
	function store_pic_data_digitalcontent1($data){
		$insert_data['sclass'] = $data['sclass'];
		$insert_data['steacher'] = $data['steacher'];
		$insert_data['ssubject'] = $data['ssubject'];
		$insert_data['title'] = $data['title'];
		$insert_data['file_type'] = $data['file_type'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('digital_content', $insert_data);
	}
	function store_digitalcontent_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('digital_content', $update_data, "id = $iddf");
	}
    function digitalcontent()
    {
        $query = $this->db->get('digital_content');
        return $query->result_array(); 
    }
	
	function digitalcontent_info($id)
    {
        $query = $this->db->get_where('digital_content', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Digital COntent*/
	 /* Download*/
	function store_pic_data_download($data){
		
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('download', $insert_data);
	}
	function store_pic_data_download1($data){
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('download', $insert_data);
	}
	function store_download_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('download', $update_data, "id = $iddf");
	}
    function download()
    {
        $query = $this->db->get('download');
        return $query->result_array(); 
    }
	
	function download_info($id)
    {
        $query = $this->db->get_where('download', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Download*/
	 /* Download*/
	function store_pic_data_aplan($data){
		
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('aplan', $insert_data);
	}
	function store_pic_data_aplan1($data){
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('aplan', $insert_data);
	}
	function store_aplan_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('aplan', $update_data, "id = $iddf");
	}
    function aplan()
    {
        $query = $this->db->get('aplan');
        return $query->result_array(); 
    }
	
	function aplan_info($id)
    {
        $query = $this->db->get_where('aplan', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Download*/
		/* Academic Calendar */
	function store_pic_data_acalendar($data){
		
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('acalendar', $insert_data);
	}
	function store_pic_data_acalendar1($data){
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('acalendar', $insert_data);
	}
	function store_acalendar_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('acalendar', $update_data, "id = $iddf");
	}
    function acalendar()
    {
        $query = $this->db->get('acalendar');
        return $query->result_array(); 
    }
	
	function acalendar_info($id)
    {
        $query = $this->db->get_where('acalendar', array('id'=>$id)); 
        return $query->result_array();
    }
		/* Academic Calendar */
		
		
		/* Admission Info */
	function store_pic_data_ainfo($data){
		
		$insert_data['atype'] = $data['atype'];
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('ainfo', $insert_data);
	}
	function store_pic_data_ainfo1($data){
		$insert_data['atype'] = $data['atype'];
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('ainfo', $insert_data);
	}
	function store_ainfo_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('ainfo', $update_data, "id = $iddf");
	}
    function ainfo()
    {
        $query = $this->db->get('ainfo');
        return $query->result_array(); 
    }
	
	function ainfo_info($id)
    {
        $query = $this->db->get_where('ainfo', array('id'=>$id)); 
        return $query->result_array();
    }
		/* Admission Info */
		
		
		/* Exam Info */
	function store_pic_data_einfo($data){
		
		$insert_data['atype'] = $data['atype'];
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('einfo', $insert_data);
	}
	function store_pic_data_einfo1($data){
		$insert_data['atype'] = $data['atype'];
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('einfo', $insert_data);
	}
	function store_einfo_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('einfo', $update_data, "id = $iddf");
	}
    function einfo()
    {
        $query = $this->db->get('einfo');
        return $query->result_array(); 
    }
	
	function einfo_info($id)
    {
        $query = $this->db->get_where('einfo', array('id'=>$id)); 
        return $query->result_array();
    }
		/* Exam Info */
		
		
		
	  /* Academic Result*/
	function store_pic_data_aresult($data){
		
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('aresult', $insert_data);
	}
	function store_pic_data_aresult1($data){
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('aresult', $insert_data);
	}
	function store_aresult_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('aresult', $update_data, "id = $iddf");
	}
    function aresult()
    {
        $query = $this->db->get('aresult');
        return $query->result_array(); 
    }
	
	function aresult_info($id)
    {
        $query = $this->db->get_where('aresult', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Academic Result*/
	 /* Class Routine*/
	function store_pic_data_classroutine($data){
		
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('classroutine', $insert_data);
	}
	function store_pic_data_classroutine1($data){
		$insert_data['title'] = $data['title'];
		$insert_data['page'] = $data['page'];
		$insert_data['date'] = $data['date'];
		$query = $this->db->insert('classroutine', $insert_data);
	}
	function store_classroutine_file_data_update($data){
		$iddf=$data['id'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$query = $this->db->update('classroutine', $update_data, "id = $iddf");
	}
    function classroutine()
    {
        $query = $this->db->get('classroutine');
        return $query->result_array(); 
    }
	
	function classroutine_info($id)
    {
        $query = $this->db->get_where('classroutine', array('id'=>$id)); 
        return $query->result_array();
    }
	 /* Class Routine*/


	 /* Class Routine*/
	function store_pic_data_student($data){
		
		$insert_data['jbID'] = $data['jbID'];
					$insert_data['stID'] = $data['stID'];
					$insert_data['s_session'] = $data['s_session'];
					$insert_data['name'] = $data['name'];
					$insert_data['f_name'] = $data['f_name'];
					$insert_data['m_name'] = $data['m_name'];
					$insert_data['religion'] = $data['religion'];
					$insert_data['gender'] = $data['gender'];
					$insert_data['dob'] = $data['dob'];
					$insert_data['class_name'] = $data['class_name'];
					$insert_data['shift_name'] = $data['shift_name'];
					$insert_data['section_name'] = $data['section_name'];
					$insert_data['mobile'] = $data['mobile'];
					$insert_data['bg'] = $data['bg'];
		
		
		$insert_data['news_image'] = $data['pic_file'];
		$insert_data['thumb_image'] = $data['pic_file'];
		$insert_data['date'] = $data['date']; 
		$query = $this->db->insert('xpert_student', $insert_data);
	}
	function store_pic_data_student1($data){
		$insert_data['jbID'] = $data['jbID'];
					$insert_data['stID'] = $data['stID'];
					$insert_data['s_session'] = $data['s_session'];
					$insert_data['name'] = $data['name'];
					$insert_data['f_name'] = $data['f_name'];
					$insert_data['m_name'] = $data['m_name'];
					$insert_data['religion'] = $data['religion'];
					$insert_data['gender'] = $data['gender'];
					$insert_data['dob'] = $data['dob'];
					$insert_data['class_name'] = $data['class_name'];
					$insert_data['shift_name'] = $data['shift_name'];
					$insert_data['section_name'] = $data['section_name'];
					$insert_data['mobile'] = $data['mobile'];
					$insert_data['bg'] = $data['bg'];
		$query = $this->db->insert('xpert_student', $insert_data);
	}
	function store_student_file_data_update($data){
		$iddf=$data['sID'];		
		$update_data['thumb_image'] = $data['pic_file'];
		$update_data['news_image'] = $data['pic_file'];
		$query = $this->db->update('xpert_student', $update_data, "sID = $iddf");
	}
    function student()
    {
        $query = $this->db->get('xpert_student');
        return $query->result_array(); 
    }
	
	function student_info($sID)
    {
        $query = $this->db->get_where('xpert_student', array('sID'=>$sID)); 
        return $query->result_array();
    }
	 /* Teacher*/
//    /* invoice: type - debit */
//    function invoice_debit($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id'=>$invoice_id, 'type'=>'debit', 'class'=>'bill')); 
//        return $query->result_array();
//    }    
//    
//    /* invoice: type - debit */
//    function invoice_debitpi($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id'=>$invoice_id, 'type'=>'debit', 'class'=>'pi')); 
//        return $query->result_array();
//    } 
    
//    /* invoice: type - credit */
//    function invoice_credit($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id'=>$invoice_id, 'type'=>'credit')); 
//        return $query->result_array();
//    }    
//    
//    /* invoice_item */
//    function invoice_item($invoice_id)
//    {
//        $query = $this->db->get_where('invoice_item', array('invoice_id'=>$invoice_id)); 
//        return $query->result_array();
//    }     
    
//    /* invoice: bill_no - generate */
//    function invoice_bill_no()
//    {
//        $query = $this->db->get('invoice'); 
//        $billno = $query->num_rows() + 1; 
//        $bill_no = date("Y") . str_pad($billno, 4, "0", STR_PAD_LEFT);
//        return $bill_no;
//    }    
//    
//    function item_rows($invoice_id)
//    {
//        $query = $this->db->get_where('invoice_item', array('invoice_id'=>$invoice_id));
//        return $query->num_rows(); 
//    }    
    
    
//    /* invoice: description */
//    function invoice_description($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id' => $invoice_id))->result_array();
//        foreach($query as $row)
//        {   
//            return $row['description']; 
//        }                      
//    }     
    // invoice: bill_no
//    function invoice_billno($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id' => $invoice_id))->result_array();
//        foreach($query as $row)
//        {   
//            return $row['bill_no']; 
//        }                      
//    }
    
    function freight()
    {
        $query = $this->db->get('freight');
        return $query->result_array();
    }    
    function freight_info($freight_id)
    {
        $query = $this->db->get_where('freight', array('freight_id'=>$freight_id)); 
        return $query->result_array();
    } 
	 function teacher_attandance_report($user_ID)
    {
        $query = $this->db->get_where('xpert_attendance', array('user_ID'=>$user_ID)); 
        return $query->result_array();
    } 
	 function teacher7($user_ID)
    {
        $query = $this->db->get_where('teacher', array('tid'=>$user_ID)); 
        return $query->result_array();
    } 
    function freight_amount($freight_id)
    {   $amount = '';
        $query = $this->db->get_where('freight_invoice', array('freight_id'=>$freight_id))->result_array(); 
        foreach($query as $row){
            $amount += $row['amount'];            
        }
        return $amount;
    }     
    function freight_invoice_no_attn($invoice_no)
    {
        $query = $this->db->get_where('freight', array('invoice_no'=>$invoice_no)); 
        return $query->row()->ATTN; 
    }      
    function freight_to($freight_id)
    {
        $query = $this->db->get_where('freight', array('freight_id'=>$freight_id)); 
        return $query->row()->to; 
    }      
    function freight_lcno($freight_id)
    {
        $query = $this->db->get_where('freight', array('freight_id'=>$freight_id)); 
        return $query->row()->LCNO; 
    }      
    function freight_invoice_no()
    {
        $this->db->select('invoice_no');
        $query = $this->db->get('freight'); 
        return $query->result_array();
    }     
    function freight_invoiceno($freight_id)
    {
        $query = $this->db->get_where('freight', array('freight_id'=>$freight_id)); 
        return $query->row()->invoice_no; 
    }
//    function freight_invoice($freight_id)
//    {
//        $query = $this->db->get_where('freight_invoice', array('freight_id'=>$freight_id)); 
//        return $query->result_array();
//    }
    
    
    function letter_info($letter_id)
    {
        $query = $this->db->get_where('letter', array('letter_id'=>$letter_id)); 
        return $query->result_array();
    } 
    
   
    function deliveryorder_info($deliveryorder_id)
    {
        $query = $this->db->get_where('deliveryorder', array('deliveryorder_id'=>$deliveryorder_id)); 
        return $query->result_array();
    } 
//    function arrival_info($arrivalNOC_id)
//    {
//        $query = $this->db->get_where('arrivalnoc', array('arrivalNOC_id'=>$arrivalNOC_id)); 
//        return $query->result_array();
//    }
            
    function receive_payment($id)
    {
        $query = $this->db->get_where('receive_payment', array('receive_payment_id'=>$id));
        return $query->result_array();
    }
    
    function receive()
    {
        $query = $this->db->get_where('receive_payment', array('type'=>'Inflow'));
        return $query->result_array();
    }
    
    function payment()
    {
        $query = $this->db->get_where('receive_payment', array('type'=>'Outflow'));
        return $query->result_array();
    }
    
    
    function debit()
    {
        $query = $this->db->get_where('debitcredit', array('type'=>'Debit'));
        return $query->result_array();
    }      
    function credit()
    {
        $query = $this->db->get_where('debitcredit', array('type'=>'Credit'));
        return $query->result_array();
    }      
    function debitcredit_info($debitcredit_id)
    {
        $query = $this->db->get_where('debitcredit', array('debitcredit_id'=>$debitcredit_id)); 
        return $query->result_array();
    }   
    
    function debit_amount($invoice_no)
    {   
        $debitcredit_id = $this->db->get_where('debitcredit', array('invoice_no'=>$invoice_no))->row()->debitcredit_id; 
        $amount = '';
        $query = $this->db->get_where('debitcredit_invoice', array('debitcredit_id'=>$debitcredit_id))->result_array(); 
        foreach($query as $row){
            $amount += $row['unit']*$row['amount']*$row['ex_rate'];            
        }
        return $amount;
    } 
    
    function debitcredit_invoice_amount($debitcredit_id)
    {   $amount = '';
        $query = $this->db->get_where('debitcredit_invoice', array('debitcredit_id'=>$debitcredit_id))->result_array(); 
        foreach($query as $row){
            $amount += $row['amount'];            
        }
        if($amount != 0){
            return $amount;
        } else {
            return 0;            
        }
    } 
    
    function freightinvoice_info($freight_id)
    {
        $query = $this->db->get_where('freight_invoice', array('freight_id'=>$freight_id));
        return $query->result_array();
    }     
    
    function debitcreditinvoice_info($debitcredit_id)
    {
        $query = $this->db->get_where('debitcredit_invoice', array('debitcredit_id'=>$debitcredit_id));
        return $query->result_array();
    } 
    
//    function invoice_income($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id'=>$invoice_id, 'class'=>'income', 'type'=>'credit')); 
//        return $query->result_array();
//    }    
//    
//    function invoice_expense($invoice_id)
//    {
//        $query = $this->db->get_where('invoice', array('id'=>$invoice_id, 'class'=>'expense', 'type'=>'debit')); 
//        return $query->result_array();
//    }   
    
//    function expense_billing()
//    {
//        $query = $this->db->get_where('invoice', array('type' => 'debit', 'class' => 'expense'));
//        return $query->result_array();
//    }    
//    
//    
//    function debit_billing()
//    {
//        $query = $this->db->get_where('invoice', array('type' => 'debit', 'class' => 'bill'));
//        return $query->result_array();
//    }
//    
//    function debitpi_billing()
//    {
//        $query = $this->db->get_where('invoice', array('type' => 'debit', 'class' => 'pi'));
//        return $query->result_array();
//    }
    
//    function credit_billing()
//    {
//        $query = $this->db->get_where('invoice', array('class' => 'lc', 'type' => 'credit'));
//        return $query->result_array();
//    }    
//    
//    /* order */
//    function order()
//    {
//        $query = $this->db->get('orders');
//        return $query->result_array();           
//    }  
//    function order_status()
//    {
//        $this->db->order_by("id", "desc");
//        $query = $this->db->get_where('orders', array('status' => 'Active'));
//        return $query->result_array(); 
//    }      
//    function order_info($order_id)
//    {
//        $query = $this->db->get_where('orders', array('id' => $order_id));
//        return $query->result_array();           
//    }      
    /* order_style_no */
//    function order_style_no($order_id)
//    {
//        $query = $this->db->get_where('orders', array('id' => $order_id))->result_array();
//        foreach($query as $row)
//        {   
//            return $row['style_no']; 
//        }                      
//    } 
//    
//    /* get 'order: buyer' by 'invoice: party_id' through invoice_item */
//    function order_buyer($invoice_id)
//    {
//        $query = $this->db->get_where('invoice_item', array('class'=>'order','invoice_id'=>$invoice_id))->result_array(); 
//        foreach($query as $row)
//        {
//            $query_order = $this->db->get_where('orders', array('id'=>$row['head_order_id']))->result_array();
//            foreach($query_order as $row_order)
//            {   
//                return $row_order['buyer']; 
//            } 
//        }         
//            
//    } 
    /* invoice: id >> invoice_item: invoice_id -> head_order_id >> order: order_id -> style_no */ 
//    function invoice_item_order_styleno($invoice_id)
//    {
//        $query = $this->invoice_item($invoice_id); 
//        foreach($query as $row)
//        {
//            $query = $this->db->get_where('orders', array('id' => $row['head_order_id']))->result_array();
//            foreach($query as $row)
//            {
//                return $row['style_no'];
//            }
//            return $query->result_array();
//        }         
//        
//    }

//    
//    function invoice_style_no($invoice_id)
//    {
//        $query = $this->invoice_item($invoice_id); 
//        foreach($query as $row)
//        {
//            $query = $this->db->get_where('orders', array('id' => $row['id']));
//            return $query->result_array();
//        }   
//    } 
    
    
//    function order_rows()
//    {
//        $this->db->where('status', 'Active');
//        $query = $this->db->get('orders');
//        return $query->num_rows();           
//    }    
//    
//    
//    /* party */
//    function party()
//    {
//        $query = $this->db->get('party'); 
//        return $query->result_array();               
//    }    
//    function party_status()
//    {
//        $this->db->order_by("id", "desc");
//        $query = $this->db->get_where('party', array('status' => 'Active')); 
//        return $query->result_array();               
//    }
//    function party_info($party_id)
//    {
//        $query = $this->db->get_where('party', array('id' => $party_id));
//        return $query->result_array();               
//    }    
//    function party_name($party_id)
//    {
//        $query = $this->db->get_where('party', array('id' => $party_id))->result_array();
//        foreach($query as $row)
//        {
//            return $row['name'];
//        }                
//    }
//    function party_address($party_id)
//    {
//        $query = $this->db->get_where('party', array('id' => $party_id))->result_array();
//        foreach($query as $row)
//        {
//            return $row['address'];
//        }                
//    }    
//    function party_rows()
//    {
//        $this->db->where('status', 'Active'); 
//        $query = $this->db->get('party');
//        return $query->num_rows();           
//    } 
    
    /* company: name */
    function company_name()
    {
        $query = $this->db->get_where('company', array('company_id' => '1'))->result_array();
        foreach($query as $row)
        {
            return $row['name'];
        }                
    }
    
    /* company: address */
    function company_address()
    {
        $query = $this->db->get_where('company', array('company_id' => '1'))->result_array();
        foreach($query as $row)
        {
            return $row['address'];
        }                
    }    
    
    
//    /* Report | statement: receive */
//    function statement_receive($order_id)
//    {
//        $query = $this->db->get_where('statement', array('order_id' => $order_id, 'type' => 'receive'));
//        return $query->result_array();
//    }
//    
//    /* Report | statement: delivery */
//    function statement_delivery($order_id)
//    {
//        $query = $this->db->get_where('statement', array('order_id' => $order_id, 'type' => 'delivery'));
//        return $query->result_array();
//    }    
    

    /* head_name */
//    function head_name($head_id)
//    {
//        $query = $this->db->get_where('head', array('id'=>$head_id))->result_array();
//        foreach($query as $row)
//        {
//            return $row['name'];
//        }         
//    } 
    
    /* head_debit */
//    function headdr() 
//    {
//        $this->db->order_by("id", "desc"); 
//        $query = $this->db->get_where('head', array('type' => 'debit'));
//        return $query->result_array();           
//    }  
//    function headdr_status() 
//    {
//        $this->db->order_by("id", "desc");
//        $query = $this->db->get_where('head', array('type' => 'debit', 'status' => 'Active'));
//        return $query->result_array(); 
//    }      
//    function headdr_info($order_id) 
//    {
//        $query = $this->db->get_where('head', array('id' => $order_id));
//        return $query->result_array();           
//    }     
    
    /* head_credit */
//    function headcr()
//    {
//        $this->db->order_by("id", "desc");
//        $query = $this->db->get_where('head', array('type' => 'credit')); 
//        return $query->result_array(); 
//    }  
//    function headcr_status()
//    {
//        $this->db->order_by("id", "desc");
//        $query = $this->db->get_where('head', array('type' => 'credit', 'status' => 'Active'));
//        return $query->result_array(); 
//    }      
//    function headcr_info($order_id)
//    {
//        $query = $this->db->get_where('head', array('id' => $order_id));
//        return $query->result_array();           
//    }         
    
    
    // Dashboard: subtotal_income
    function subtotal_income()
    {
        $subtotal = '';
        $this->db->where('class', 'income');
        $query = $this->db->get('invoice')->result_array();
        foreach($query as $row){
            $subtotal += $row['subtotal'];
        }
        return $subtotal;  
    } 
    // Dashboard: subtotal_expense
    function subtotal_expense()
    {
        $subtotal = '';
        $this->db->where('class', 'expense');
        $query = $this->db->get('invoice')->result_array();
        foreach($query as $row){
            $subtotal += $row['subtotal'];
        }
        return $subtotal;        
        
    }     
    // Dashboard: subtotal_bill_pi
    function subtotal_bill_pi()
    {
        $subtotal = '';
        $this->db->where('class', 'bill');
        $this->db->or_where('class', 'pi');
        $query = $this->db->get('invoice')->result_array();
        foreach($query as $row){
            $subtotal += $row['subtotal'];
        }
        return $subtotal;        
    } 
    // Dashboard: subtotal_lc
    function subtotal_lc()
    {
        $subtotal = '';
        $this->db->where('class', 'lc');
        $query = $this->db->get('invoice')->result_array();
        foreach($query as $row){
            $subtotal += $row['subtotal'];
        }
        return $subtotal; 
    }    
    
//    function navigation()
//    {
//        $query = $this->db->get_where('navigation', array('active' => 1));
//        return $query->result_array();           
//    }       
//    
//    
//    
//    function dozen($value)
//    {
//        $result = $value / 12;
//        return $result;        
//    }
    
    
    /* in_words */
    function get_bd_money_format($amount) {
        $output_string = '';
        $fraction = '';
        $tokens = explode('.', $amount);
        $number = $tokens[0];

        if(count($tokens) > 1) {
            $fraction = (double)('0.' . $tokens[1]);
            $fraction = $fraction * 100;
            $fraction = round($fraction, 0);
            $fraction = '.' . $fraction;
        }

        $number = $number . '';
        $spl=str_split($number);
        $lpcount=count($spl);
        $rem=$lpcount-3;
        //echo "rem".$rem."";
		
        //even one
        if($lpcount%2==0) {
            for($i=0;$i<=$lpcount-1;$i++) { 
                if($i%2!=0 && $i!=0 && $i!=$lpcount-1) {
                    $output_string .= ",";
                }
                $output_string .= $spl[$i];
            }
        }

        //odd one
        if($lpcount%2!=0) {
            for($i=0;$i<=$lpcount-1;$i++) {
                if($i%2==0 && $i!=0 && $i!=$lpcount-1) {
                    $output_string .= ",";
                }
                $output_string .= $spl[$i];
            }
        }
        return $output_string . $fraction;
    }

    function translate_to_words($number) {
        /*****
        * A recursive function to turn digits into words
        * Numbers must be integers from -999,999,999,999 to 999,999,999,999 inclussive.
        */

        // zero is a special case, it cause problems even with typecasting if we don't deal with it here
        $max_size = pow(10,18);
        if (!$number) return "zero";
        if (is_int($number) && $number < abs($max_size)) {
            $prefix = '';
            $suffix = '';
            switch ($number) {
                // set up some rules for converting digits to words
                case $number < 0:
                    $prefix = "negative";
                    $suffix = $this->translate_to_words(-1*$number);
                    $string = $prefix . " " . $suffix;
                    break;
                case 1:
                    $string = "one";
                    break;
                case 2:
                    $string = "two";
                    break;
                case 3:
                    $string = "three";
                    break;
                case 4:
                    $string = "four";
                    break;
                case 5:
                    $string = "five";
                    break;
                case 6:
                    $string = "six";
                    break;
                case 7:
                    $string = "seven";
                    break;
                case 8:
                    $string = "eight";
                    break;
                case 9:
                    $string = "nine";
                    break;
                case 10:
                    $string = "ten";
                    break;
                case 11:
                    $string = "eleven";
                    break;
                case 12:
                    $string = "twelve";
                    break;
                case 13:
                    $string = "thirteen";
                    break;
                // fourteen handled later
                case 15:
                    $string = "fifteen";
                    break;
                case $number < 20:
                    $string = $this->translate_to_words($number%10);
                    // eighteen only has one "t"
                    if ($number == 18) {
                        $suffix = "een";
                    } else {
                        $suffix = "teen";
                    }
                    $string .= $suffix;
                    break;
                case 20:
                    $string = "twenty";
                    break;
                case 30:
                    $string = "thirty";
                    break;
                case 40:
                    $string = "forty";
                    break;
                case 50:
                    $string = "fifty";
                    break;
                case 60:
                    $string = "sixty";
                    break;
                case 70:
                    $string = "seventy";
                    break;
                case 80:
                    $string = "eighty";
                    break;
                case 90:
                    $string = "ninety";
                    break;
                case $number < 100:
                    $prefix = $this->translate_to_words($number-$number%10);
                    $suffix = $this->translate_to_words($number%10);
                    //$string = $prefix . "-" . $suffix;
                    $string = $prefix . " " . $suffix;
                    break;
                // handles all number 100 to 999
                case $number < pow(10,3):
                    // floor return a float not an integer
                    $prefix = $this->translate_to_words(intval(floor($number/pow(10,2)))) . " hundred";
                    if ($number%pow(10,2)) $suffix = " and " . $this->translate_to_words($number%pow(10,2));
                    $string = $prefix . $suffix;
                    break;
                case $number < pow(10,6):
                    // floor return a float not an integer
                    $prefix = $this->translate_to_words(intval(floor($number/pow(10,3)))) . " thousand";
                    if ($number%pow(10,3)) $suffix = $this->translate_to_words($number%pow(10,3));
                    $string = $prefix . " " . $suffix;
                    break;
                }
        } else {
            echo "ERROR with - $number Number must be an integer between -" . number_format($max_size, 0, ".", ",") . " and " . number_format($max_size, 0, ".", ",") . " exclussive.";
        }
        return $string;
    }

    function get_us_amount_in_text($amount) {

        $output_string = '';

        $tokens = explode('.', $amount);
        $current_amount = $tokens[0];
        $fraction = '';
        if(count($tokens) > 1) {
            $fraction = (double)('0.' . $tokens[1]);
            $fraction = $fraction * 100;
            $fraction = round($fraction, 0);
            $fraction = (int)$fraction;
            $fraction = $this->translate_to_words($fraction) . ' Cents';
            $fraction = ' Dollars & ' . $fraction;
        }

        $crore = 0;
        if($current_amount >= pow(10,7)) {
            $crore = (int)floor($current_amount / pow(10,7));
            $output_string .= $this->translate_to_words($crore) . ' crore ';
            $current_amount = $current_amount - $crore * pow(10,7);
        }

        $lakh = 0;
        if($current_amount >= pow(10,5)) {
            $lakh = (int)floor($current_amount / pow(10,5));
            $output_string .= $this->translate_to_words($lakh) . ' lakh ';
            $current_amount = $current_amount - $lakh * pow(10,5);
        }

        $current_amount = (int)$current_amount;
        $output_string .= $this->translate_to_words($current_amount);

        $output_string = $output_string . $fraction . ' only';
        $output_string = ucwords($output_string);
        return $output_string;
    }
    
    
    function get_bd_amount_in_text($amount) {

        $output_string = '';

        $tokens = explode('.', $amount);
        $current_amount = $tokens[0];
        $fraction = '';
        if(count($tokens) > 1) {
            $fraction = (double)('0.' . $tokens[1]);
            $fraction = $fraction * 100;
            $fraction = round($fraction, 0);
            $fraction = (int)$fraction;
            $fraction = $this->translate_to_words($fraction) . ' Poisa';
            $fraction = ' Taka & ' . $fraction;
        }

        $crore = 0;
        if($current_amount >= pow(10,7)) {
            $crore = (int)floor($current_amount / pow(10,7));
            $output_string .= $this->translate_to_words($crore) . ' crore ';
            $current_amount = $current_amount - $crore * pow(10,7);
        }

        $lakh = 0;
        if($current_amount >= pow(10,5)) {
            $lakh = (int)floor($current_amount / pow(10,5));
            $output_string .= $this->translate_to_words($lakh) . ' lakh ';
            $current_amount = $current_amount - $lakh * pow(10,5);
        }

        $current_amount = (int)$current_amount;
        $output_string .= $this->translate_to_words($current_amount);

        $output_string = $output_string . $fraction . ' only';
        $output_string = ucwords($output_string);
        return $output_string;
    }

      
    
    
    
    
    
    
    
    
    
    
}