Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 714)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 716)
@@ -337,5 +337,6 @@
                 $data = $this->user_model->update_user($src, $token, $user, $us_id);
                 parse_str($data);
-                switch ($status) {
+				error_log('API return ---- Data: '. var_export($data, TRUE). "\n", 3, '/srv/www/sbg/log/changepass.log');
+                switch ((int)$status) {
                     case 0:
                         $result['success'] = 1;
Index: pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 714)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 716)
@@ -404,5 +404,6 @@
 	public function isExistcollaborator($collaborator) {
 		$this->db->query ( 'UNLOCK TABLES' );
-		$this->db->select ( '*' )->from ( 'tblcollaborator' )->where ( 'login_name', $collaborator )->limit ( 1 );
+		//$this->db->select ( '*' )->from ( 'tblcollaborator' )->where ( 'login_name', $collaborator )->limit ( 1 );
+		$this->db->select ( '*' )->from ( 'tblcollaborator' )->where ( 'cellphone', $collaborator )->limit ( 1 );
 		$result = $this->db->get ()->row_array ();
 		if ($result)
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php	(revision 714)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php	(revision 716)
@@ -298,5 +298,5 @@
                                         <div class="alert alert-block alert-success">						
                                             <p>
-                                                QuÃœ vá» cÅ©ng cÃ³ thá» sá»­ dá»¥ng sá» Äiá»n thoáº¡i <strong><?php echo $username;?></strong> vÃ  soáº¡n tin theo cÃº phÃ¡p: <strong>SBG VIP 1</strong> (hay VIP 3, VIP 6, VIP 12) <strong>gá»­i tá»i 8062</strong> (Há» thá»ng sáºœ trá»« tiá»n trÃªn tÃ i khoáº£n chÃ­nh cá»§a sá» Äiá»n thoáº¡i <strong><?php echo $username;?></strong>)
+                                                QuÃœ vá» cÅ©ng cÃ³ thá» sá»­ dá»¥ng sá» Äiá»n thoáº¡i&nbsp;<strong><?php echo $username;?></strong> vÃ  soáº¡n tin theo cÃº phÃ¡p: <strong>SBG VIP 1</strong> (hay VIP 3, VIP 6, VIP 12) <strong>gá»­i tá»i 8062</strong> (Há» thá»ng sáºœ trá»« tiá»n trÃªn tÃ i khoáº£n chÃ­nh cá»§a sá» Äiá»n thoáº¡i&nbsp;<strong><?php echo $username;?></strong>)
                                         </p>
                                         </div>
Index: pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php	(revision 714)
+++ pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php	(revision 716)
@@ -35,4 +35,7 @@
 		function messageReceiver(){
 			$aryArgs = func_get_args();
+			$aryExport = array('Username' => $aryArgs[0], 'Password' => $aryArgs[1], 'RequestID' => $aryArgs[2],'UserID' => $aryArgs[3],'ReceiverID' => $aryArgs[4],'ServiceID' => $aryArgs[5],'CommandCode' => $aryArgs[6], 'Info' => $aryArgs[7], 'ReceiveTime' => $aryArgs[8]);
+
+			error_log(date('Y-m-d H:i:s').' -- VARIABLES: '. var_export($aryExport, TRUE). "\n", 3, '/srv/www/sbg/log/sms.log');
 			list($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $info, $receiveTime) = $aryArgs;
 			
@@ -56,6 +59,7 @@
 			$CI->load->model('frontend/User_model', 'objUserModel');
 			$result = $CI->Services_model->processMORequest($userID, $info);
+			error_log(date('Y-m-d H:i:s').' -- INFO VAR: '. var_export($info, TRUE). "\n\n", 3, '/srv/www/sbg/log/sms.log');
 			$CI->objUserModel->insertSmslog($receiverID, $serviceID, $commandCode, $info, $receiveTime);
-					
+			
 			$aryResult = explode ('|', $result);
 			return $aryResult[0].'|'.$msgType.'|'.$aryResult[1];
Index: pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php	(revision 714)
+++ pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php	(revision 716)
@@ -25,4 +25,6 @@
 if ( ! defined('_SBG_CHARGING_GENERAL_ERROR')) 			define('_SBG_CHARGING_GENERAL_ERROR', 440);
 if ( ! defined('_SBG_CHARGING_NUMBER_NOT_REGISTED')) 	define('_SBG_CHARGING_NUMBER_NOT_REGISTED', 501);
+if ( ! defined('_SBG_CHARGING_MAX_VALUE')) 				define('_SBG_CHARGING_MAX_VALUE', 50000);
+
 
 if ( ! defined('_SBG_SEND_MT_FAIL')) 					define('_SBG_SEND_MT_FAIL', -1);
@@ -36,5 +38,5 @@
 if ( ! defined('_SBG_MO_PROCCESS_ERR')) 				define('_SBG_MO_PROCCESS_ERR', 0);
 
-if ( ! defined('_SBG_GET_COLLABORATOR_FAIL')) 				define('_SBG_GET_COLLABORATOR_FAIL', -1);
+if ( ! defined('_SBG_GET_COLLABORATOR_FAIL')) 			define('_SBG_GET_COLLABORATOR_FAIL', -1);
 
 Class Services_model extends CI_Model 
@@ -170,10 +172,16 @@
 					
 					$amount = $packageData ['p_price'];
-					$result = $this->chargeRootAccountProcess($sentNumber, $amount, $sentNumber.' paid for SBG');
+					$count = $amount > $maxCharging ? ceil($amount/ _SBG_CHARGING_MAX_VALUE) : 1;
+					$value = 0;
+					for ($i = 1; $i <= $count; $i++) {
+						$value = $amount > _SBG_CHARGING_MAX_VALUE ? _SBG_CHARGING_MAX_VALUE : $amount;
+						$amount -= $value;							
+						$result = $this->chargeRootAccountProcess($sentNumber, $value, $sentNumber.' paid for SBG');
+					}	
 
 					if ($result == _SBG_CHARGING_SUCCESS) {
+						$amount = $packageData ['p_price'];
 						$this->objUserModel->rechargeAccount($sentNumber, $amount);
 						$smsReturn = $this->objUserModel->registerVip($sentNumber, $p_code, $packageData);
-						
 						$paidTime = date('Y-m-d H:i:s');
 						$this->objUserModel->insertPaidlog($sentNumber, $sentNumber, _SBG_PAIDTYPE_SMS, $amount, $paidTime);
@@ -187,7 +195,6 @@
 			case _SBG_MO_PAY_TO_ACCOUNT:
 			case _SBG_MO_PAY_TO_ACCOUNT_FOR:
-
+				error_log(date('Y-m-d H:i:s').' -- DATA: '. var_export($aryContents, TRUE).' -- CASE: '. $case . "\n", 3, '/srv/www/sbg/log/pay.log');
 				$userName = isset($aryContents[1]) ? $this->formatPhoneNumber($aryContents[1]) : $sentNumber;
-				
 				if ($case == _SBG_MO_PAY_TO_ACCOUNT_FOR && !preg_match('/^(09\d{8}|01\d{9})$/', $userName)) {
 					$smsReturn = _SBG_MO_PROCCESS_ERR.'|'.lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG');
