<?php
    class HOME_MARSAL extends HOME
    {
        public function home_marsal_javainit()
        {

        }

        public function fn_marsal_init()
        {
            if(isset($_REQUEST['task'])){$task=trim(strtolower($_REQUEST['task']));}
            if(isset($_POST['task'])){$task=trim(strtolower($_POST['task']));}
            if($_REQUEST||$_POST){if($_REQUEST['sec']||$_POST['sec']){$task=$this->dec($task);}}

            switch($task)
            {
                case "default":
                    $this->fn_default_sum();
                break;

                case $task:
                    $task="fn_".$task;
                    if(method_exists($this,$task)){$this->$task();}
                break;

                default:
                    $this->fn_default_sum();
                break;
            }
        }
        
        public function fn_default_sum()
        {
            echo $this->FN_CREATEHEADER();

            echo "<style>
                       .besidebtnsave {margin-left:80px;margin-top:-6px;position:absolute;}
                  </style>";
            echo "<script>
                       var myForm,myFormsearch,dgtra;
                       function initObject()
                       {";

            echo "     };
                  </script>";
            echo $this->FN_CLOSEHEADER();
            echo $this->FN_CREATEBODY();

            echo $this->FN_CREATEFOOTER();

        }
        
        public function fn_sumofyears()
        {
            $years=$_REQUEST['years'];
            //            $qry="select sum(totalsms) sumofyears from ".DB_DMCS.".tbl_smsc_sumyears where years='$years' and isdeleted=0";
            //            $sumofyears=$this->fn_get_fieldvalue("sumofyears",$qry);
            //echo $sumofyears;
            echo "5234";
        }
        
        public function fn_sumoftop5()
        {
            $years=$_REQUEST['years'];
            $months=$_REQUEST['months'];
//            $qry="select uptname,totalsms from ".DB_DMCS.".tbl_smsc_sumtop5month where years='$years' and period='$months' and isdeleted=0 order by totalsms desc";
//            $rs=$this->selectquery($qry);
//            if($rs)
//            {
//                $res=array();
//                while($rw=$this->data_row_object($rs))
//                {
//                    array_push($res,array($rw->uptname."|".$rw->totalsms));
//                }
//                echo json_encode($res);
//            }
//            $this->clearrecordset($rs);
            
        }
        
        public function fn_sumoftop3()
        {
            $years=$_REQUEST['years'];
            $months=$_REQUEST['months'];
//            $qry="select uptname,totalsms from ".DB_DMCS.".tbl_smsc_sumtop3years where years='$years' and isdeleted=0 order by totalsms desc";
//            $rs=$this->selectquery($qry);
//            if($rs)
//            {
//                $res=array();
//                while($rw=$this->data_row_object($rs))
//                {
//                    array_push($res,array($rw->uptname."|".$rw->totalsms));
//                }
//                echo json_encode($res);
//            }
//            $this->clearrecordset($rs);
            
        }
    }
?>