Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php	(revision 756)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php	(revision 757)
@@ -95,5 +95,3 @@
         $writer->save('php://output');
     }
-  
-
 }
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php	(revision 756)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php	(revision 757)
@@ -16,5 +16,9 @@
 
     function getProvinces($input) {
-
+        $ext="";
+        if (isset($input['to_month']))
+        {
+            $ext="AND tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-01 23:59:59'";
+        }
         $provinces = lang('_PROVINCES_');
         // Tinh doanh thu theo tinh theo nam
@@ -23,10 +27,13 @@
         $dtns = $query->result_array();
         // tinh doanh thu theo thang
-        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-01'  GROUP BY tbluser.province";
+        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-01' $ext  GROUP BY tbluser.province";
         $query = $this->db->query($sql);
         $dtts = $query->result_array();
         // tinh doanh thu trong ngay hien tai
         $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time > '" . date('Y') . "-" . date('m') . "-".date('d')." 00:00:00' AND  tblpaidlog.paid_time <'" . date('Y') . "-" . date('m') . "-".date('d')." 23:59:59'  GROUP BY tbluser.province";
-       
+        if (isset($input['to_month']))
+        {
+        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time > '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND  tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59'  GROUP BY tbluser.province";
+        }
         $query = $this->db->query($sql);
         $dtng = $query->result_array();
@@ -38,5 +45,5 @@
 
         // tinh thue bao theo thang
-        $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01'  GROUP BY tbluser.province";
+        $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01'  $ext GROUP BY tbluser.province";
         $query = $this->db->query($sql);
         $tbts = $query->result_array();
@@ -44,4 +51,8 @@
          // tinh thue bao theo ngay
         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . date('Y') . "-" . date('m') . "-".date('d')." 00:00:00' AND tbluser.created_time < '" . date('Y') . "-" . date('m') . "-".date('d')." 23:59:59'  GROUP BY tbluser.province";
+        if (isset($input['to_month']))
+        {
+            $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND tbluser.created_time < '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59'  GROUP BY tbluser.province";
+        }
         $query = $this->db->query($sql);
         $tbng = $query->result_array(); 
@@ -154,4 +165,7 @@
         //$input['month']=1;
         //$input['year']=2014;
+        //$input['to_month']=1;
+        //$input['to_year']=2015;
+        //$input['to_date']=15;
         $data=$this->getProvinces($input);
         return $data;
@@ -159,6 +173,6 @@
     public function exportPackage($input)
     {
-       // $input['month']=1;
-       //svn  $input['year']=2014;
+        //$input['month']=1;
+        //svn  $input['year']=2014;
         $data=$this->getPackages($input);
         return $data;
