403Webshell
Server IP : 27.254.152.13  /  Your IP : 216.73.217.38
Web Server : Apache/2
System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64
User : coloflew ( 1072)
PHP Version : 5.6.40
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coloflew/domains/fulltion.com/public_html/administrator/jquery/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/coloflew/domains/fulltion.com/public_html/administrator/jquery/jsquerydata.php
<?php
session_start();
########## Load the config file ##########
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/sys_config.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/class/SC_Query.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/class/SC_Mysql.php');
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/class/SC_Master.php');
// connect  
$objConn = new SQL_DB();
$db = new SC_Query();
$objMaster = new SC_Master();

if(isset($_SESSION['lang_code']) && @$_GET['lang']){
	//$la = $_GET['lang'] ? $_GET['lang'] : "En";
	$_SESSION['lang_code'] = $_GET['lang'];
	$lang_code =  $_SESSION['lang_code'];
}elseif(isset($_SESSION['lang_code'])){
	$lang_code =  $_SESSION['lang_code'];
}else{
	$lang_code = "En";
	$_SESSION['lang_code'] = $lang_code;
}

$lang_value = $db->getAll('language_value','*',"lang_code='".$lang_code."'");
//echo "<pre>"; print_r($lang_value);
if($lang_value){
	$lang_set = array();
	foreach($lang_value as $ke => $va){
		$lang_set[$va['name']] = $va['value'];
		//echo $lang_set[$va['name']];
		//$lang = $lang_f;
	}	
}
?>

<?php
	$arrForm=$_POST;
	//echo "<pre>=>";print_r($arrForm);
	//exit;
	//Select MODE
	switch ($arrForm['mode']) {
		case 'Get_Contact' :
			$field_value = $arrForm['field_value'];
			$arrPType = $db->getAll( "customer","*"," CustomerName = '".$field_value."'","" );
			
 			getcontactJS($arrForm['mode'],$arrPType);
			break;
			
		case 'getss' :
			$field_id = $arrForm['field_id'];
			
			unset($_SESSION['SSUpdateBusProduct']);
			$_SESSION['SSUpdateBusProduct'] = $field_id;
			break;
		
		case 'UpdateValues':
			$arrUpdate = array();
			
			$arrUpdate['value'] = $arrForm['Values'];
						
			$datasu = $db->updateData("language_value",$arrUpdate," name='".$arrForm['Name'] ."'");
			
 			if($datasu){
				$temp = "success";
			}else{
				$temp = "";	
			}
			
			break;
		case 'UpdateStatusProduct':
			$productID = $arrForm['field_id'];
			$status = $arrForm['field_values'];
			
			$getdetail = $db->getOne( "invoicedetail", "*","InvoiceDetailID ='".$productID."'");
			$arrDataHist = array();
			$arrDataHist['InvoiceDetailID'] = $getdetail['InvoiceDetailID'];
			$arrDataHist['InvoiceID'] 		= $getdetail['InvoiceID'];
			$arrDataHist['status'] 			= $status;	
			$arrDataHist['EmpReviceID'] 	= $_SESSION['member']['userid']; //changer
			$arrDataHist['HistDatetime'] 	= date("Y-m-d H:i:s");
			$arrDataHist['LastPoint'] 		= $getdetail['LastPoint'];
					
			$db->insertData("hist",$arrDataHist);
			
			$arrUpdateProduct = array();
			$arrUpdateProduct['status'] = $status;	
			$datasu2 = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceDetailID ='".$productID."'");
			
			if($getdetail['InvoiceID']){
				$getAllDetail = $db->getAll("invoicedetail", "*","InvoiceID ='".$getdetail['InvoiceID']."'");
				$getChkD = $db->getAll("invoicedetail", "*","InvoiceID ='".$getdetail['InvoiceID']."' and status='".$status."'");
				$arrUpdate = array();
				if(count($getAllDetail)==count($getChkD)){
					$arrUpdate['InvoiceStatus'] = $status;	
					$db->updateData("invoice",$arrUpdate," InvoiceID ='".$getdetail['InvoiceID']."'");
					//echo "1";
				}else{
					$arrUpdate['InvoiceStatus'] = 2;
					$db->updateData("invoice",$arrUpdate," InvoiceID ='".$getdetail['InvoiceID']."'");
					//echo "1";
				}
				
				
			}
			//echo "<pre>";print_r($getAllDetail);
			//exit;
			break;
		/* add by nui */
		case 'UpdateChangeStatusProduct':
			$productID = $arrForm['field_id'];
			$detail = $arrForm['detail'];
			$arrData = array();
			$arrD = array();
		   // $arrData['cause_change'] = $detail;
		    $arrData['comment'] = $detail;
			//$RstChange = $db->updateData("hist",$arrData,"HistID='".$productID."'");
			@$getrchist = @$db->getOne( "hist", "*","InvoiceDetailID = '".$productID."'","order by HistID desc","limit 1");
			
			$arrD['cause_change'] = $detail;
			$Rsthistcause = $db->updateData("hist",$arrD," HistID='".@$getrchist['HistID']."'");
			//echo $Rsthistcause ;
			$RstChange = $db->updateData("invoicedetail",$arrData," InvoiceDetailID='".$productID."'");
			echo $RstChange ;

		break;
		/* add by nui */
		
		
		case 'UpdateStatusInvoice':
			$GetInvoice = $db->getOne( "invoice", "*"," InvoiceID = ".$arrForm['field_id'],"" );
			//echo "<pre>";print_r($GetInvoice);
			//exit;
			$arrUpdate = array();
			if($arrForm['field_values'] == 5){
				$arrUpdate['InvoiceEndPoint'] = $GetInvoice['InvoiceStartPoint'];
				$arrUpdate['InvoiceStartPoint'] = $GetInvoice['InvoiceEndPoint'];
				$arrUpdate['InvoiceReceiveID'] = $GetInvoice['InvoiceSendID'];
			}
				$arrUpdate['InvoiceStatus'] = $arrForm['field_values'];
			
			$datasu = $db->updateData("invoice",$arrUpdate," InvoiceID ='".$arrForm['field_id']."'");
			
			//if($arrForm['field_values'] == 1 or $arrForm['field_values'] == 3){
				$arrUpdateProduct = array();
				$arrUpdateProduct['status'] = $arrForm['field_values'];	
				$datasu2 = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceID ='".$arrForm['field_id']."'");
			//}
			//if($arrForm['field_values'] == 6 ){
				$arrDataHist = array();
				$getdetail = $db->getAll( "invoicedetail", "*","InvoiceID ='".$arrForm['field_id']."'","" );
				foreach($getdetail as $key => $val){
					$arrDataHist['InvoiceDetailID'] = $val['InvoiceDetailID'];
					$arrDataHist['InvoiceID'] 		= $val['InvoiceID'];
					$arrDataHist['status'] 			= $arrForm['field_values'];	
					$arrDataHist['EmpReviceID'] 	= $_SESSION['member']['userid'];
					$arrDataHist['HistDatetime'] 	= date("Y-m-d H:i:s");
					$arrDataHist['LastPoint'] 		= $val['LastPoint'];
					
					$db->insertData("hist",$arrDataHist);
				}
				
				//$arrUpdateProduct = array();
				//$arrUpdateProduct['status'] = $arrForm['field_values'];	
				//$datasu2 = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceID ='".$arrForm['field_id']."'");
			//}
			
			if($arrForm['field_values'] == 5){
				$arrUpdateProduct = array();
				$arrUpdateProduct['status'] = '1';	
				$datasu2 = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceID ='".$arrForm['field_id']."'");
			}
			
			$temp = $arrForm['field_values'];
			echo $temp;
			break;
		case 'UpdateRunInvoice':
			$arrUpdate = array();
			
			$arrUpdate['RunText'] = $arrForm['RunText'];
			$arrUpdate['RunNum'] = $arrForm['RunNum'];
			$arrUpdate['RunUpDate'] = date("Y-m-d H:i:s");
						
			$datasu = $db->updateData("invoiceruning",$arrUpdate," RunID='".$arrForm['RunID'] ."'");
			
 			if($datasu){
				$temp = "success";
			}else{
				$temp = "";	
			}
			
			break;
		case 'UpdateInvoiceStatus':
			$arrUpdate = array();

			$arrUpdate['statusdesc'] = $arrForm['StatusText'];
			$datasu = $db->updateData("invoidestatus",$arrUpdate," statusid='".$arrForm['StatusID'] ."'");
			
 			if($datasu){
				$temp = "success";
			}else{
				$temp = "";	
			}
			
			break;
		case 'SelectDeliveryPoint' :
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			$where_f = "";
			if($field_id != '0'){
				$where_f .= "p.DeliveryPointID = '".$field_id."' and p.lang_code = '".$field_lang."'";
			}else{
				$where_f .= "p.lang_code = ".$field_lang;
			}
			
			$arrPType = $db->getJoin("d.EmpID,d.EmpName,d.EmpSurName",DB_PREFIX."admin d left outer join ".DB_PREFIX."deliverypoint p on d.DeliveryPointID = p.DeliveryPointID ",$where_f,"","");
 			getcontactJS($arrForm['mode'],$arrPType);
			break;	
			
		case 'SelectDeliveryPointNoAll' :
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			$where_f = "";
			if($field_id != '0'){
				$where_f .= "p.DeliveryPointID = '".$field_id."' and p.lang_code = '".$field_lang."'";
			}else{
				$where_f .= "p.lang_code = ".$field_lang;
			}
			
			$arrPType = $db->getJoin("d.EmpID,d.EmpName,d.EmpSurName",DB_PREFIX."admin d left outer join ".DB_PREFIX."deliverypoint p on d.DeliveryPointID = p.DeliveryPointID ",$where_f,"","");
 			getcontactJS($arrForm['mode'],$arrPType);
			break;		
			
		case 'SelectProviceRoute' :
			$field_id = $arrForm['field_id'];
			$field_set = $arrForm['field_set'];
			$field_lang = $arrForm['field_lang'];
			
			if($field_set == "admin"){
				$arrPType = $db->getAll( "deliverypoint", "*"," lang_code='".$lang_code."' and DeliveryPointStatus='1' and DeliveryPointProvince = '".$field_id."'","" );
			}else{
				$arrPType = $db->getJoin(" distinct d.DeliveryPointID , d.DeliveryPointName","tasoft_routexpoint a LEFT OUTER JOIN tasoft_busxroute b ON a.RouteID = b.RouteID LEFT OUTER JOIN tasoft_route c ON a.RouteID = c.RouteID LEFT OUTER JOIN tasoft_deliverypoint d ON a.DeliveryPointID = d.DeliveryPointID"," a.RouteID in ( SELECT RouteID FROM `tasoft_routexpoint` WHERE DeliveryPointID = '".$field_set."') and d.lang_code = '".$field_lang."' and c.lang_code = '".$field_lang."' and d.DeliveryPointProvince = '".$field_id."'","","");
			}
	
			getcontactJS($arrForm['mode'],$arrPType);
			break;	
			
		case 'selectprovince' :
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			
			$arrPType = $db->getJoin("d.AMPHUR_ID,d.AMPHUR_NAME",DB_PREFIX."district d left outer join ".DB_PREFIX."province p on d.PROVINCE_ID = p.PROVINCE_ID "," p.PROVINCE_ID = '".$field_id."' and d.lang_code = '".$field_lang."' and p.lang_code = '".$field_lang."'","group by d.AMPHUR_ID","");
 			getcontactJS($arrForm['mode'],$arrPType);
			break;
			
		case 'selectdistrict' :
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			
			$arrPType = $db->getJoin("p.PROVINCE_ID,p.PROVINCE_NAME",DB_PREFIX."district d left outer join ".DB_PREFIX."province p on d.PROVINCE_ID = p.PROVINCE_ID "," d.AMPHUR_ID = '".$field_id."' and d.lang_code = '".$field_lang."' and p.lang_code = '".$field_lang."'","group by d.AMPHUR_ID","");
 			getcontactJS($arrForm['mode'],$arrPType);
			break;	
			
		case 'selectgettime' :
			$field_values = $arrForm['field_values'];
			$field_id = $arrForm['field_id'];
			$field_date = $objMaster->getdateformat($field_id);
			$arrPType = $db->getAll( "busxroute", "*"," SetDate = '".$field_date."' and RouteCode = '".$field_values."'","" );
			getcontactJS($arrForm['mode'],$arrPType);
			break;	
		case 'selectroute' :
			$field_id = $arrForm['field_id'];
			$arrPType = $db->getAll( "routexpoint", "*"," RouteCode = '".$field_id."'","" );
			getcontactJS($arrForm['mode'],$arrPType);
			break;	
		case 'selectdetail' :
			$field_time = $arrForm['field_time'];
			$field_values = $arrForm['field_values'];
			$field_id = $arrForm['field_id'];
			$field_date = $objMaster->getdateformat($field_id);
			
			$arrPType = $db->getAll( "busxroute", "*"," SetDate = '".$field_date."' and RouteCode = '".$field_values."' and SetTime = '".$field_time."'","" );
			getcontactJS($arrForm['mode'],$arrPType);
			break;
			
		case 'selectdepartment' :
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			$arrPType = $db->getAll( "position", "*"," DepartmentID = '".$field_id."' and lang_code = '".$field_lang."'","" );
 			getcontactJS($arrForm['mode'],$arrPType);
			break;	
			
		case 'selectposition' :
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			
			$GetPoint = $db->getOne( "position", "*"," PositionID = ".$field_id,"" );
			
			$arrPType = $db->getAll( "department", "*"," DepartmentID = '".$GetPoint['DepartmentID']."' and lang_code = '".$field_lang."'","" );
 			getcontactJS($arrForm['mode'],$arrPType);
			break;	
			
		case 'searchcustomer' :
			$field1 = @$arrForm['field1'] ? @$arrForm['field1'] : "";
			$field2 = @$arrForm['field2'] ? @$arrForm['field2'] : "";
			$field3 = @$arrForm['field3'] ? @$arrForm['field3'] : "";
			$field4 = @$arrForm['field4'] ? @$arrForm['field4'] : "";
			$field_type = $arrForm['field_type'];
			$field_point = $arrForm['field_point'];
			$where_f = "";
			if($field1){
				if($where_f){
					$where_f .= " and CustomerName = '".$field1."'";
				}else{
					$where_f = " CustomerName = '".$field1."'";	
				}
			}
			if($field2){
				if($where_f){
					$where_f .= " and CustomerIdentification = '".$field2."'";
				}else{
					$where_f = "CustomerIdentification = '".$field2."'";	
				}
			}
			if($field3){
				if($where_f){
					$where_f .= " and CustomerPhon = '".$field3."'";
				}else{
					$where_f = "CustomerPhon = '".$field3."'";	
				}
			}
			if($field4){
				if($where_f){
					$where_f .= " and CustomerSurName = '".$field4."'";
				}else{
					$where_f = "CustomerSurName = '".$field4."'";	
				}
			}
			if($where_f){
				$arrPType = $db->getAll( "customer", "*",$where_f,"" );
			}else{
				$arrPType = "";
			}
			//echo '<pre>'; print_r($arrPType); exit;
			
			if($field_type == "Send")
			{ $field_type  = 1 ; $typeName="Send";} 
			else 
			if($field_type == "Receive")
			{$field_type  = 2; $typeName="Receive";}
			else
			{ $field_type  = 3; $typeName="ReceiveAgent";}
 			getcontactJSType($arrForm['mode'],$arrPType,$field_type,$typeName,$field_point,@$arrForm['chkT']);
			break;	
		case 'getcustomer' :
			$field_id = $arrForm['field_id'];
			
			$arrPType = $db->getOne( "customer", "*"," CustomerID = ".$field_id,"" );
			getcontactJS($arrForm['mode'],$arrPType);
			break;	
		case 'UpdateStatusTrack' :
			$field_code = $arrForm['field_code'];
			$field_point = $arrForm['field_point'];
			
			$getcode = $db->getOne( "invoicedetail", "*"," ProductCode = '".$field_code."'" );
			if($getcode){
			$getinvoice = $db->getOne( "invoice", "*"," InvoiceID = ".$getcode['InvoiceID'],"" );
			
			if($getinvoice['InvoiceEndPoint'] == $field_point){
			
			$arrDataHist = array();
			$getiddetail = $db->getOne("invoicedetail","*","InvoiceDetailID='".$getcode['InvoiceDetailID']."'","","");
			$getend = $db->getOne("invoice","*","InvoiceID='".$getiddetail['InvoiceID']."'","","");
			$arrDataHist['InvoiceDetailID'] = $getiddetail['InvoiceDetailID'];
			$arrDataHist['InvoiceID'] 		= $getiddetail['InvoiceID'];
			$arrDataHist['LastPoint'] 		= $field_point;
			$arrDataHist['BusXRouteID']		= $getiddetail['BusXRouteID'];
			$arrDataHist['EmpSendID'] 		= $getiddetail['EmpSendID'];
			$arrDataHist['EmpReviceID'] 	= $_SESSION['member']['userid'];
			$arrDataHist['StartPoint']		= $getend['InvoiceStartPoint'];
			$arrDataHist['EndPoint']		= $getend['InvoiceEndPoint'];
			$arrDataHist['status'] 			= '3';
			$arrDataHist['HistDatetime'] 	= date("Y-m-d H:i:s");
			
			$db->insertData("hist",$arrDataHist);
                        

			
			$arrUpdateProduct = array();
			$arrUpdateProduct['status'] = '3';	
			$arrUpdateProduct['LastPoint'] = $field_point;
			$arrUpdateProduct['EmpReviceID'] = $_SESSION['member']['userid'];
			$arrUpdateProduct['BusXRouteID'] = '0';
			$datasu = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceDetailID ='".$getcode['InvoiceDetailID']."'");
			
			$getcount = $db->getOne( "invoicedetail", "count(*) as counts"," InvoiceID = ".$getcode['InvoiceID'],"" );
			$getcomplate = $db->getOne( "invoicedetail", "count(*) as counts"," InvoiceID = ".$getcode['InvoiceID']." and status = 3","" );
			
				if($getcount['counts'] == $getcomplate['counts']){
				$arrUpdateComplate = array();
				$arrUpdateComplate['InvoiceStatus'] = '3';	
				$datasu = $db->updateData("invoice",$arrUpdateComplate," InvoiceID ='".$getcode['InvoiceID']."'");
				}
			$st = "3";
			}else{
			
			$arrDataHist = array();
			$getiddetail = $db->getOne("invoicedetail","*","InvoiceDetailID='".$getcode['InvoiceDetailID']."'","","");
			$getend = $db->getOne("invoice","*","InvoiceID='".$getiddetail['InvoiceID']."'","","");
			$arrDataHist['InvoiceDetailID'] = $getiddetail['InvoiceDetailID'];
			$arrDataHist['InvoiceID'] 		= $getiddetail['InvoiceID'];
			$arrDataHist['LastPoint'] 		= $field_point;
			$arrDataHist['BusXRouteID']		= $getiddetail['BusXRouteID'];
			$arrDataHist['EmpSendID'] 		= $getiddetail['EmpSendID'];
			$arrDataHist['EmpReviceID'] 	= $_SESSION['member']['userid'];
			$arrDataHist['StartPoint']		= $getend['InvoiceStartPoint'];
			$arrDataHist['EndPoint']		= $getend['InvoiceEndPoint'];
			$arrDataHist['status'] 			= '7';
			$arrDataHist['HistDatetime'] 	= date("Y-m-d H:i:s");
			
			$db->insertData("hist",$arrDataHist);
                        
                        $arrDataHist2 = array();
                        $arrDataHist2['ProductCode'] 	= $getiddetail['ProductCode'];			
			$db->insertData("productreturn",$arrDataHist2);
			
			$arrUpdateProduct = array();
			$arrUpdateProduct['status'] = '7';	
			$arrUpdateProduct['LastPoint'] = $field_point;
			$arrUpdateProduct['EmpReviceID'] = $_SESSION['member']['userid'];
			$arrUpdateProduct['BusXRouteID'] = '0';
			$datasu = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceDetailID ='".$getcode['InvoiceDetailID']."'");
			
			$arrUpdateComplate = array();
			$arrUpdateComplate['InvoiceStatus'] = '7';	
			$datasu = $db->updateData("invoice",$arrUpdateComplate," InvoiceID ='".$getcode['InvoiceID']."'");
				
			$st = "7";
			}
			$getstatusproduct = $db->getOne("invoidestatus","*"," statusid='".$st."'");
			
			$temp = "/".$getcode['InvoiceDetailID']."/".$st."/".$getstatusproduct['statusdesc'];
			echo $temp;
			}else{
			$temp = "/error";
			echo $temp;
			}
			break;
			
			case 'UpdateStatusComplate' :
			$field_code = $arrForm['field_code'];
			$field_invoice = $arrForm['field_invoice'];
			$field_id = $arrForm['field_id'];
			
			$getcode = $db->getOne( "invoicedetail", "*"," ProductCode = '".$field_code."'" );
			if($getcode){
			$getinvoice = $db->getOne( "invoice", "*"," InvoiceID = ".$getcode['InvoiceID'],"" );
			
				if($getinvoice['InvoiceID'] == $field_invoice){
				$arrUpdateProduct = array();
				$arrUpdateProduct['status'] = '4';	
				$arrUpdateProduct['EmpSendID'] = '0';
				$arrUpdateProduct['EmpReviceID'] = '0';
				$arrUpdateProduct['CustomerReceiveID'] = $field_id;
				$datasu = $db->updateData("invoicedetail",$arrUpdateProduct," InvoiceDetailID ='".$getcode['InvoiceDetailID']."'");
				
				$getcount = $db->getOne( "invoicedetail", "count(*) as counts"," InvoiceID = ".$getcode['InvoiceID'],"" );
				$getcomplate = $db->getOne( "invoicedetail", "count(*) as counts"," InvoiceID = ".$getcode['InvoiceID']." and status = 4","" );
				
					if($getcount['counts'] == $getcomplate['counts']){
					$arrUpdateComplate = array();
					$arrUpdateComplate['InvoiceStatus'] = '4';	
					$datasu = $db->updateData("invoice",$arrUpdateComplate," InvoiceID ='".$getcode['InvoiceID']."'");
					}
				$st = "4";
				$getstatusproduct = $db->getOne("invoidestatus","*"," statusid='".$st."'");
				
				$temp = "/".$getcode['InvoiceDetailID']."/".$st."/".$getstatusproduct['statusdesc'];
				echo $temp;
				}else{
				$temp = "/errorinvoice";
				echo $temp;
				}
				
			
			}else{
			$temp = "/errorcode";
			echo $temp;
			}
			break;
			
			case 'ShowComment' :
			$field_id = $arrForm['field_id'];
			$getdetail = $db->getOne( "invoicedetail", "*"," InvoiceDetailID = '".$field_id."'","" );
			$getinvoice = $db->getOne( "invoice", "*"," InvoiceID = '".$getdetail['InvoiceID']."'","" );
			$getendname = $db->getOne("deliverypoint","*","DeliveryPointID = ".$getinvoice['InvoiceEndPoint']);
			$getstatusproduct = $db->getOne("invoidestatus","*"," statusid='".$getdetail['status']."'");
			$temp = "";
			$temp .= "<div class='content-box-header'>";
			$temp .= "<h3>Error Track</h3>";
			$temp .= "</div>";
			$temp .= "<div class='content-box-content'>";
			$temp .= '<form>';
			$temp .= "<table>";
			$temp .= "<thead>";
			$temp .= "<tr>";
			$temp .= "<th width='20'></th>";
			$temp .= "<th width='100'>".$lang_set['endpoint']."</th>";
			$temp .= "<th width='100'>".$lang_set['CodeProduct']."</th>";
			$temp .= "<th width='100'>".$lang_set['NameProduct']."</th>";
			$temp .= "<th width='50'>".$lang_set['WeightProduct']."</th>";
			$temp .= "<th width='50'>".$lang_set['SizeProducr']."</th>";
			$temp .= "<th width='100'>".$lang_set['totalmoney']."</th>";
			$temp .= "<th width='75'>".$lang_set['invoice_status']."</th>";
			$temp .= "<th width='75'>".$lang_set['comment']."</th>";
			$temp .= "<th width='47'>".$lang_set['action']."</th>";
			$temp .= "</tr>";
			$temp .= "</thead>";
			$temp .= "<tr>";
			$temp .= "<th><span id='ajax_loader'></span><span id='ajax_success'></span></th>";
			$temp .= "<th>".$getendname['DeliveryPointName']."</th>";
			$temp .= "<th>".$getdetail['ProductCode']."</th>";
			$temp .= "<th>".$getdetail['ProductName']."</th>";
			$temp .= "<th>".$getdetail['ProductWeight']."</th>";
			$temp .= "<th>".$getdetail['ProductSize']."</th>";
			$temp .= "<th>".$getdetail['totalmoney']."</th>";
			$temp .= "<th>".$getstatusproduct['statusdesc']."</th>";
			$temp .= '<th><input type="text" class="text-input large-input" name="Comment" id="Comment" value="'.$getdetail['comment'].'"/></th>';
			
			$temp .= '<th><a href="javascript:void();" onclick="UpdateComment('.$getdetail['InvoiceDetailID'].');" title="Edit"><img src="resources/images/icons/ico_update.gif" alt="Edit" /></a></th>';
			$temp .= "</tr>";
			$temp .= "</table>";
			$temp .= "</form>";
			$temp .= "</div>";
			echo $temp;
			break;
		case 'UpdateComment':
			$arrUpdate = array();
			
			$arrUpdate['comment'] = $arrForm['field_value'];
						
			$datasu = $db->updateData("invoicedetail",$arrUpdate," InvoiceDetailID ='".$arrForm['field_id'] ."'");
			
 			if($datasu){
				$temp = "success";
			}else{
				$temp = "";	
			}
			
			break;
			
		case 'ProcessPrice':
			$temp = "";
			$size = $arrForm['size'];//ขนาด
			$weight = $arrForm['weight'];//น้ำหนัก
			$saleper = $arrForm['saleper'];//ส่วนลด			
			$endpoint = $arrForm['endpoint'];//ปลายทาง
			
			$endpointdb = $db->getOne( "deliverypoint", "*"," DeliveryPointID = '".$endpoint."'","" );
			$pointprice = $endpointdb['DeliveryPointPrice'];
			//echo "<pre>";print_r($endpointdb);
			$sizepricedb = $db->getOne( "setupsize", "*"," SetupSizeID = '".$size."'","" );
			$weightid = $db->getOne( "setupsize", "*"," SetupSizeSize = ".$weight."","" );
			$unit = $sizepricedb['unit'];

			if ($sizepricedb['SetupSizeID'] > $weightid['SetupSizeID']) {
				$sizeprice = $sizepricedb['SetupSizePrice'];
			}else{
				$sizeprice = $weightid['SetupSizePrice'];
			}

			//$weightprice = floor(((float)$weight/2))*10;
			//$weightprice = $weight * $unit;
			$saleperprice = $saleper;
				
			//$sum = ((float)$sizeprice + (float)$weightprice);
			$sum = ((float)$sizeprice);
				
			$sumPro = ((float)$sum * ((float)$pointprice / 100));
			//echo (float)$sum."++".$pointprice ;
			$sumComplete = ceil($sumPro - ((float)$sumPro * ((float)$saleperprice / 100)));
			$rest = substr($sumComplete, -1);
			if($rest < 5){
				$last = 0;
			}else{
				$last = 5;
			}
			//$sumComplete = substr_replace($sumComplete ,$last,-1);
			$temp =  $sumComplete;

			echo $temp;
			
			break;
			
		case 'SelectBusType':
		
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			$arrPType = $db->getAll( "bus", "*"," BusType = '".$field_id."' and lang_code = '".$field_lang."' and BusID not in (select BusID from ".DB_PREFIX."busxroute where SetDate = '".date("Y-m-d")."')","" );
 			getcontactJS($arrForm['mode'],$arrPType);
			
			break;
		
		case 'SelectDepartmentAddBus':
		
			$field_id = $arrForm['field_id'];
			$field_lang = $arrForm['field_lang'];
			$field_busid = $arrForm['field_busid'];
			
			$arrPType = @$db->getAll( "admin", "*"," EmpStatus = '1' and DepartmentID= '".$field_id."' and EmpID NOT IN (select EmpID from ".DB_PREFIX."busxemp where BusID <> ".$field_busid.")","" );
 			getcontactJS($arrForm['mode'],$arrPType);
			
			break;
			
		case 'UpdateStatusTrackToBus':
			
			echo ":";
			$field_code = $arrForm['field_code'];
			$field_point = $arrForm['field_point'];
			$field_bus_x_routeid = $arrForm['field_bus_x_routeid'];
			
			@$getbusxroute = @$db->getOne( "busxroute", "*"," BusXRouteID = '".@$field_bus_x_routeid."'","" );
			@$getroute = @$db->getOne( "route", "*"," RouteID = '".@$getbusxroute['RouteID']."'","" );
			@$getroutepoint = @$db->getAll( "routexpoint", "*"," RouteID = '".@$getroute['RouteID']."'","" );
			@$getsequence = @$db->getOne( "routexpoint", "*"," RouteID = '".@$getroute['RouteID']."' and DeliveryPointID = '".@$setpoint."'","" );
			
			@$getproductchk = @$db->gettest("select count(*) as cost from `tasoft_invoicedetail` a
			LEFT OUTER JOIN `tasoft_invoice` b ON a.InvoiceID = b.InvoiceID
			LEFT OUTER JOIN `tasoft_routexpoint` c ON a.LastPoint = c.DeliveryPointID
			LEFT OUTER JOIN `tasoft_routexpoint` d ON b.InvoiceEndPoint = d.DeliveryPointID Where c.RouteID = '".@$getbusxroute['RouteID']."' 
			AND d.RouteID = '".@$getbusxroute['RouteID']."' AND c.PointSequence < d.PointSequence 
			AND d.PointSequence >= '".@$getsequence['PointSequence']."' AND (a.status = 1 or a.status = 7)
			And a.LastPoint = '".@$field_point."' AND a.ProductCode = '".$field_code."'");

			if(@$getproductchk['cost'] == '0'){
				echo "error";
				break;
			}else{
				@$arrData = array();
				@$arrData['status'] = 2;
				@$arrData['BusXRouteID'] = $field_bus_x_routeid;
				@$arrData['EmpSendID'] = @$_SESSION['member']['userid'];
				@$arrData['EmpReviceID'] = '0';
				@$db->updateData("invoicedetail",@$arrData," ProductCode='".@$field_code."'");
				
				@$getiddetail = @$db->getOne("invoicedetail","*","ProductCode='".@$field_code."'","","");
				@$getend = @$db->getOne("invoice","*","InvoiceID='".@$getiddetail['InvoiceID']."'","","");
				
				@$getcode = @$db->getOne("busxroute","*"," BusXRouteID='".@$field_bus_x_routeid."'");
				
				@$getbusxemp = @$db->getAll( "busxemp", "*"," BusID = '".@$getcode['BusID']."'","" );
				
				@$logtext = json_encode(@$getbusxemp);
	
				@$arrDataHist['InvoiceDetailID'] = @$getiddetail['InvoiceDetailID'];
				@$arrDataHist['InvoiceID'] 		= @$getiddetail['InvoiceID'];
				@$arrDataHist['LastPoint'] 		= @$getiddetail['LastPoint'];
				@$arrDataHist['BusXRouteID'] 	= @$field_bus_x_routeid;
				@$arrDataHist['EmpSendID'] 		= @$_SESSION['member']['userid'];
				@$arrDataHist['StartPoint']		= @$getiddetail['LastPoint'];
				@$arrDataHist['EndPoint']		= @$getend['InvoiceEndPoint'];
				@$arrDataHist['status'] 			= '2';
				@$arrDataHist['HistDatetime'] 	= date("Y-m-d H:i:s");
				@$arrDataHist['Detaillog'] 		= @$logtext;
	
				@$db->insertData("hist",@$arrDataHist);
				
				
				@$getinvoice = @$db->getOne( "invoicedetail", "*"," ProductCode = ".@$field_code,"" );
				
				@$arrDataInvoice['InvoiceStatus'] = 2;
				@$db->updateData("invoice",@$arrDataInvoice," InvoiceID='".@$getinvoice['InvoiceID']."'");
				
				
				echo @$field_code;
				break;
			}
	}

function getcontactJS($mode,$arrData) {
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/class/SC_Query.php');
$db = new SC_Query();

	switch ($mode) {		
		case 'Get_Contact' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= "/".$va['CustomerName']."/".$va['CustomerAddress']."/".$va['CustomerProvince']."/".$va['CustomerDistrict']."/".$va['CustomerPostCode']."/".$va['CustomerPhon']."";
				}
			}
			
			echo $temp;
			break;
			
		case 'SelectDeliveryPoint' :
			$temp = "";
			if($arrData){
				$temp .= '<option value="0">Select All</option>';
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["EmpID"].'>'.$va["EmpName"].' '.$va["EmpSurName"].'</option>';
				}
			}else{
				$temp = '<option value="0">No data</option>';
			}
			
			echo $temp;
			break;
			
		case 'SelectDeliveryPointNoAll' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["EmpID"].'>'.$va["EmpName"].' '.$va["EmpSurName"].'</option>';
				}
			}else{
				$temp = '<option value="0">No data</option>';
			}
			
			echo $temp;
			break;
				
		case 'SelectProviceRoute' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["DeliveryPointID"].'>'.$va["DeliveryPointName"].'</option>';
				}
			}
			
			echo $temp;
			break;
			
		case 'selectprovince' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["AMPHUR_ID"].'>'.$va["AMPHUR_NAME"].'</option>';
				}
			}
			
			echo $temp;
			break;
		
		case 'selectdistrict' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["PROVINCE_ID"].'>'.$va["PROVINCE_NAME"].'</option>';
				}
			}
			
			echo $temp;
			break;
		case 'selectgettime' :
			$temp = '<option value="">Select Time</option>';
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option>'.$va["SetTime"].'</option>';
				}
			}
			
			echo $temp;
			break;
		case 'selectroute' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$GetPoint = $db->getOne( "deliverypoint", "*"," DeliveryPointID = '".$va["DeliveryPointID"]."'","" );
					$temp .= '<option value='.$va["DeliveryPointID"].'>'.$GetPoint["DeliveryPointName"].'</option>';
				}
			}
			
			echo $temp;
			break;
			
		case 'selectdetail' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$GetBus = $db->getOne( "bus", "*"," BusID = '".$va["BusID"]."'","" );
					$GetDriver = $db->getOne( "driver", "*"," DriverID  = '".$va["DriverID"]."'","" );
					$temp .= "/".$GetBus['BusName']."/".$GetDriver['DriverName']."";
				}
			}
			
			echo $temp;
			break;
			
		case 'selectdepartment' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["PositionID"].'>'.$va["PositionName"].'</option>';
				}
			}
			
			echo $temp;
			break;
			
		case 'selectposition' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["DepartmentID"].'>'.$va["DepartmentName"].'</option>';
				}
			}
			
			echo $temp;
			break;
			
		case 'getcustomer' :
			$temp = "";
			if($arrData){
					$temp .= ":".$arrData['CustomerName'].":".$arrData['CustomerSurName'].":".$arrData['CustomerIdentification'].":".$arrData['CustomerAddress'].":".$arrData['CustomerProvince'].":".$arrData['CustomerDistrict'].":".$arrData['CustomerTambon'].":".$arrData['CustomerPostCode'].":".$arrData['CustomerPhon'].":".$arrData['CustomerHomePhon'].":".$arrData['CustomerOtherPhon'].":".$arrData['CustomerVilla'].":".$arrData['CustomerRoom'].":".$arrData['CustomerFloor'].":".$arrData['CustomerHome'].":".$arrData['CustomerMuu'].":".$arrData['CustomerZoy'].":".$arrData['CustomerRode'].":".$arrData['CustomerID'];
					
			}
			echo $temp;
			break;
			
		case 'SelectBusType' :
			$temp = "";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["BusID"].'>'.$va["BusName"].'/'.@$va['BusBrand'].'/'.@$va['BusPlate'].'</option>';
				}
			}
			
			echo $temp;
			break;
			
		case 'SelectDepartmentAddBus' :
			$temp = "<option value='0'>Not Data</option>";
			if($arrData){
				foreach($arrData as $ke => $va){
					$temp .= '<option value='.$va["EmpID"].'>'.$va["EmpName"].'</option>';
				}
			}
			
			echo $temp;
			break;
	}
}

function getcontactJSType($mode,$arrData,$type,$typeName,$point,$chkT="") {
	//echo "<pre>";print_r($arrData);
	switch ($mode) {
		case 'searchcustomer' :
			$temp  = "";
			if(@$arrData || $chkT !=1){
				$temp .= "<script src='js/smartpaginator.js' type='text/javascript'></script>";
				$temp .= "<script type='text/javascript'>";
				$temp .= "$(document).ready(function () {";
				$temp .= "$('#green').smartpaginator({"; 
				$temp .= "totalrecords: ".count($arrData).", ";
				$temp .= "recordsperpage: 10, ";
				$temp .= "datacontainer: 'mtSearch',"; 
				$temp .= "dataelement: 'tr',";
				//$temp .= "//initval: 0,"; 
				$temp .= "next: 'Next',"; 
				$temp .= "prev: 'Prev',";
				$temp .= "first: 'First',"; 
				$temp .= "last: 'Last',"; 
				$temp .= "theme: 'green'"; 
				$temp .= "	});";
				$temp .= "});</script>";
				$temp .= '<div style="margin-left:20px; height:50px;">
				<table>
					<tr>
						<td rowspan="2"><strong>ค้นหาเพิ่มเติม</strong></td>
						<td>ชื่อ :</td>
						<td>เลขที่บัตรประชาชน :</td>
						<td>หมายเลขโทรศัพท์ :</td>
						<td>&nbsp;</td>
					</tr>';
				if(($typeName=="Send" || $typeName=="Receive" )&& $point==0){
				$temp .='
						<td><input type="text" name="keyword" id="keyword"></td>
						<td><input type="text" name="keyword2" id="keyword2"></td>
						<td><input type="text" name="keyword3" id="keyword3"></td>
						';
				}elseif($typeName=="Receive" && $point!=0){
				$temp .='
						<td><input type="text" name="keyword_'.$point.'" id="keyword_'.$point.'"></td>
						<td><input type="text" name="keyword2_'.$point.'" id="keyword2_'.$point.'"></td>
						<td><input type="text" name="keyword3_'.$point.'" id="keyword3_'.$point.'"></td>
						';
				}else{
				$temp .='
						<td><input type="text" name="keyword" id="keyword"></td>
						<td><input type="text" name="keyword2" id="keyword2"></td>
						<td><input type="text" name="keyword3" id="keyword3"></td>
						';
				}
				$temp .='
						<td>&nbsp;<button class="button" style="width:50px;" id="selectCus" onclick="SearchCustomerAgain(\''.$typeName.'\',\''.$point.'\');">ค้นหา</button></td>
				</table>
				</div>';
				$temp .= '<div id="wrapper"><div id="green-contents" class="contents" style="border: solid 1px #5f9000;">';
				$temp .= '<table id="mtSearch" cellpadding="0" cellspacing="0" border="0" class="table">';
				$temp .= '<tr class="header">';
				$temp .= '<th style="text-align:center;">ชื่อ</th>';
				$temp .= '<th style="text-align:center;">นามสกุล</th>';
				$temp .= '<th style="text-align:center;">เลขที่บัตรประชาชน</th>';
				$temp .= '<th style="text-align:center;">หมายเลขโทรศัพท์</th>';
				$temp .= '<th style="text-align:center;"></th>';
				$temp .= "</tr>";
				//$temp .= "<tbody>";
				if($arrData){
					foreach($arrData as $ke => $va){
						$temp .= "<tr height='30' style='border-bottom: solid 1px #5f9000;'>";
						$temp .= '<td>'.$va['CustomerName'].'</td>';
						$temp .= '<td>'.$va['CustomerSurName'].'</td>';
						$temp .= '<td>'.$va['CustomerIdentification'].'</td>';
						$temp .= '<td>'.$va['CustomerPhon'].'</td>';
						$temp .= '<td style="text-align:center;"><button class="button" onclick="javascript:GetSearchCustomer('.$va['CustomerID'].','.$type.','.$point.');" style="width:50px;" id="selectCus">เลือก</button></td>';
						$temp .= "</tr>";
					}
				}else{
					$temp .= "<tr height='30' style='border-bottom: solid 1px #5f9000;'><td colspan='5' style='text-align:center;'>ไม่มีข้อมูลค่ะ</td></tr>";
				}
				//$temp  .= "</tbody>";
				$temp  .= "</table>";
				$temp  .= ' <div id="green"></div></div> ';
			}else{
				$temp = 1;
			}
			echo $temp;
			break;	
		
		
		
	}
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit