Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php	(revision 740)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php	(revision 741)
@@ -73,8 +73,8 @@
         }
 
-        $data['max'] = 50000;
+        $data['max'] = $max;
         $chard[] = array("color" => "#e67e22", "label" => "LÆ°á»£ng ngÆ°á»i dÃ¹ng giá»i thiá»u bá»i cá»ng tÃ¡c viÃªn theo tá»«ng thÃ¡ng", "data" => $chart);
         $data['chard'] = $chard;
-
+         
         return $this->load->view('reportAsistant/statistics', $data, true);
     }
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php	(revision 740)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php	(revision 741)
@@ -56,5 +56,4 @@
         }
         //$sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id WHERE tbluser.created_time > '".$from."'".$where."";
-
 		$sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone WHERE tbluser.created_time > '".$from."'".$where."";
 
@@ -64,4 +63,5 @@
             $result[$index]['time']=  strtotime($paidlog['user_created_time']);
         }
+        
         return $result;
     }
@@ -238,10 +238,12 @@
     function getStatistics()
     {
+      
+       $day = date('w');
         $data = array();
-        $last_month['start'] = strtotime(date("Y-m-d", strtotime("first day of previous month")) . " 00:00:00");
-        $last_month['end'] = strtotime(date("Y-m-d", strtotime("last day of previous month")) . " 23:59:59");
-
-        $last_week['start'] = strtotime(date("Y-m-d", strtotime("first day of previous week")) . " 00:00:00");
-        $last_week['end'] = strtotime(date("Y-m-d", strtotime("last day of previous week")) . " 23:59:59");
+        $last_month['start'] = strtotime(date("Y-m-d", strtotime(date("Y-m-d", mktime(0, 0, 0, date("m")-1, 1, date("Y"))))) . " 00:00:00");
+        $last_month['end'] = strtotime(date("Y-m-d", strtotime(date("Y-m-d", mktime(0, 0, 0, date("m"), 0, date("Y"))))) . " 23:59:59");
+
+        $last_week['start'] = strtotime(date("Y-m-d", strtotime(date('m-d-Y', strtotime('-'.$day.' days')))) . " 00:00:00");
+        $last_week['end'] = strtotime(date("Y-m-d", strtotime(date('m-d-Y', strtotime('+'.(6-$day).' days')))) . " 23:59:59");
 
         $last_week['end'] = strtotime('last sunday') + (24 * 60 * 60 - 1);
@@ -266,6 +268,6 @@
         $revenue['last_year'] = 0;
 
-        $lastmonth = strtotime("first day of previous month");
-        $thismonth = strtotime("first day of this month");
+        $lastmonth = strtotime(date("Y-m-d", mktime(0, 0, 0, date("m")-1, 1, date("Y"))));
+        $thismonth = strtotime(date('Y-m-01'));
         $charts['last_month'] = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0);
         $charts['this_month'] = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0);
@@ -279,17 +281,22 @@
         $top['this_month']['card']=0;
         $top['this_month']['collaborator']=0;
+        
         foreach ($paidlogs as $paidlog) {
 
             
             if (($paidlog['time'] < $last_week['end']) && ($paidlog['time'] > $last_week['start'])) {
+                
                 $revenue['last_week']+=$paidlog['amount'];
             }
             if (($paidlog['time'] < $last_month['end']) && ($paidlog['time'] > $last_month['start'])) {
+           
                 $revenue['last_month']+=$paidlog['amount'];
             }
             if (($paidlog['time'] < $last_quarter['end']) && ($paidlog['time'] > $last_quarter['start'])) {
+             
                 $revenue['last_quarter']+=$paidlog['amount'];
             }
             if (($paidlog['time'] < $last_year['end']) && ($paidlog['time'] > $last_year['start'])) {
+              
                 $revenue['last_year']+=$paidlog['amount'];
             }
@@ -331,16 +338,21 @@
 
             if (($paidlog['time'] < $thismonth + (7 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth)) {
-                $charts['this_month'][0]+=$paidlog['amount'];
+              
+                $charts['this_month'][0] += $paidlog['amount'];
             }
             if (($paidlog['time'] < $thismonth + (14 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (7 * 24 * 60 * 60))) {
+                
                 $charts['this_month'][1]+=$paidlog['amount'];
             }
             if (($paidlog['time'] < $thismonth + (21 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (14 * 24 * 60 * 60))) {
+               
                 $charts['this_month'][2]+=$paidlog['amount'];
             }
             if (($paidlog['time'] < $thismonth + (28 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (21 * 24 * 60 * 60))) {
+                
                 $charts['this_month'][3]+=$paidlog['amount'];
             }
             if (($paidlog['time'] < $thismonth + (31 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (28 * 24 * 60 * 60))) {
+               
                 $charts['this_month'][4]+=$paidlog['amount'];
             }
@@ -361,4 +373,5 @@
             }
         }
+     
         $percent=array();
         foreach ($top['this_month'] as $index=>$value)
@@ -394,9 +407,10 @@
 
         $data['revenue'] = $revenue;
-        $data['max'] = 50000;
+        $data['max'] = $max;
         $chard[] = array("color" => "#e67e22", "label" => "Tháng hiện tại", "data" => $chart_this_month);
         $chard[] = array("color" => "#1abc9c", "label" => "Tháng trước", "data" => $chart_last_month);
-
+         
         $data['chard'] = $chard;
+        
         return $data;
     }
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php	(revision 740)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php	(revision 741)
@@ -76,7 +76,5 @@
             $result[$index]['time']=  strtotime($paidlog['paid_time']);
         }
-        $file = fopen("/srv/www/sbg/log/dump.log","w");
-        fwrite($file,  serialize($result));
-        fclose($file); 
+         
         return $result;
     }
