<?php
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/shopsaleorder.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/shopsaleordercont.php');
require($netsFileConfig['sysCoreRoot'].'Inc/m_Shop/Sale/shopsaleorder.php');


class PaDefault extends CustomPage {
	public $ssetParid=2;
	
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnBInitial(){
		$this->sMetaTitle='订单列表';
		$this->getUser('1,2,3,4,5,');
		$this->sTemplatePath='shop/orderList_Normal.php';

		//-- ------ #Option ------ --
		//State
		$tmpAR0=$this->sControl->sDbInTemplate;
		$tmpAR0['Connection']=$this->sConnString;
		$tmpAR0['SQL']=$this->sOptionSQL;
		$tmpAR0['InitialString']=110;
		$tmpAR0['Parid']='sotID';
		$tmpAR0['Text']='sotName';
		$tmpAR0['Value']='sotValue';
		$tmpAR0['Type']=1;
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		$tmpCacheFlag='nets/option_Shoporder_state';
		$this->sControl->getOptions($tmpAR0,$tmpCacheFlag,$this->sControl->sDpReturnTemplate,$this->sState1);
		$this->sState2=$this->sState1;
		$tmpAR0=$this->sControl->sDpReturnTemplate;
		$tmpAR0['Text']='[所有状态]';
		$tmpAR0['Value']='-1';
		$tmpAR0['Style']='';
		$tmpAR0['Title']='';
		$tmpAR0['AddOne']='';
		array_push($this->sState2,$tmpAR0);
		
		//-- #sCondition_Order --
		$this->sCondition_Order=array('按总金额','按时间',);
		
	}
	public function OnList(){
		$tmpAR0=$this->AnalyerRequest('ID',-1,0);
		$this->sMainID=$tmpAR0[0];
		$tmpAR0=$this->AnalyerRequest('DKeyword','',0);
		$this->sKeyword=$tmpAR0[0];
		$this->sSearchAR=$this->AnalyerRequest('DSearch','0,0,-1,-1',0);
		//-- ------ #Datas ------ --
		$tmpListSTR0='DList0';
		$tmpListAR0=$this->AnalyerRequest($tmpListSTR0,'1,0,30,0',0);
		$tmpSortSTR0='DSort0';
		$tmpSortAR0=$this->AnalyerRequest($tmpSortSTR0,'shsotID,2',0);
		//-- #Spell SQL --
		$tmpSQL=' SELECT *
			
			FROM {Nets.TableHead}shopsaleorder AS A
			INNER JOIN {Nets.TableHead}shopsaleordercont AS B ON B.shsoctIndexID=A.shsotID
			WHERE 1=1 ';

		if ($this->sSearchAR[3]!=-1) {
			$tmpSQL.=' AND A.shsotState='.$this->sSearchAR[3].' ';
		}
		if ($this->sKeyword!='') {
			$tmpSQL.=' AND A.shsotNumCode LIKE \'%'.$this->sKeyword.'%\' ';
		}
		$tmpSQL.=' ORDER BY A.shsotID DESC ';
		
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$this->sListData=$this->sDb->SearchP($tmpSTR,$tmpListAR0);
		$this->sRecordCount=$this->sDb->sysPageInfo[3];
		//#Set page button
		$this->sPButton->resetTemlate('../../../Config/m_default/File/pageButton3.htm');
		$this->sPButton->sPage=$this->sysPage;
		$this->sPButton->sExtendParameter='&ID='.$this->sMainID.'&DKeyword='.$this->sKeyword.'&DSearch='.$this->sSearchAR[0].$this->sysSPLIT1.$this->sSearchAR[1].$this->sysSPLIT1.$this->sSearchAR[2].$this->sysSPLIT1.$this->sSearchAR[3];
		$this->sPButton->setPage($this->sDb->sysPageInfo);
		
	}
	public function getSearch($pValue,$pType){
/*
Parid
Keyword

ListType
OrderBy
Type
State
*/
		$tmpAR0=array(
			$this->sMainID,
			$this->sKeyword,
			$this->sSearchAR[0],
			$this->sSearchAR[1],
			$this->sSearchAR[2],
			$this->sSearchAR[3],
			);
		if($pType==0) $tmpAR0[0]=$pValue;
		if($pType==1) $tmpAR0[1]=$pValue;
		if($pType==2) $tmpAR0[2]=$pValue;
		if($pType==3) $tmpAR0[3]=$pValue;
		if($pType==4) $tmpAR0[4]=$pValue;
		if($pType==5) $tmpAR0[5]=$pValue;

		//#SPICAL
		if ($pType==100) {
			/*
			$tmpAR0[8]=0;
			$tmpAR0[9]=0;
			$tmpAR0[10]=0;
			$tmpAR0[11]=0;
			$tmpAR0[12]=0;
			*/
		}else if ($pType==101) {
		}
		//#SPELL
		$tmpSTR=$this->sysPage.'?ID='.$tmpAR0[0].'&DKeyword='.$tmpAR0[1].'&DSearch='.
			$tmpAR0[2].$this->sysSPLIT1.$tmpAR0[3].$this->sysSPLIT1.$tmpAR0[4].$this->sysSPLIT1.$tmpAR0[5];
		return $tmpSTR;
	}
	
	
	
}

?>