AdminProductionSpec.php 6.35 KB
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;?>
<?
if (! class_exists("AdminProductionSpec")){
	class AdminProductionSpec extends AdminBase{
		
		function __construct($req)
		{
			parent::__construct($req);
		}
		
		function getListOfProductionSpec(){
			$searchType=$this->req["searchType"];
			$searchText=$this->req["searchText"];
			$dateFormer=$this->req["dateFormer"];
			$dateLatter=$this->req["dateLatter"];
				
			$where=" WHERE PS.status=1";
				
			if($searchType=="CN")
				$where.=" AND companyName LIKE '%{$searchText}%'";
			else if($searchType=="PN")
				$where.=" AND productName LIKE '%{$searchText}%'";
			else if($searchType=="MN")
				$where.=" AND userName LIKE '%{$searchText}%'";
			else if($searchType=="")
				$where.=" AND (companyName LIKE '%{$searchText}%' OR productName LIKE '%{$searchText}%' OR userName LIKE '%{$searchText}%')";
							
			if($dateFormer != "")
				$where.=" AND DATE_FORMAT(PS.regDate, '%Y%m%d') >= DATE_FORMAT('{$dateFormer}', '%Y%m%d')";
			if($dateLatter != "")
				$where.=" AND DATE_FORMAT(PS.regDate, '%Y%m%d') <= DATE_FORMAT('{$dateLatter}', '%Y%m%d')";
										
		
			$sql="
				SELECT COUNT(*) AS rn
				FROM tblProductionSpec PS
				JOIN tblUser U ON PS.userFk=U.userNo
				{$where}
				ORDER BY PS.regDate DESC
				";
			$this->initPage();
			$this->rownum=$this->getValue($sql, 'rn');
			$this->setPage($this->rownum);
			$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
						
		
			$sql="
				SELECT productionNo, DATE_FORMAT(PS.requestDate, '%Y-%m-%d') AS requestDate, PS.companyName, PS.productName, U.userName
				FROM tblProductionSpec PS
				JOIN tblUser U ON PS.userFk=U.userNo
				{$where}
				ORDER BY PS.productionNo DESC
				{$limit}
				";
									
			$result=$this->getArray($sql);
			//echo json_encode($result);
			return $result;
		}
		
		function getInfoOfProductionSpec(){
			$productionNo=$this->req["no"];
			$sql="
			SELECT *
			FROM tblProductionSpec
			WHERE productionNo='{$productionNo}'
			";
			$result=$this->getRow($sql);
			//echo json_encode($result);
			return $result;
		}
		
		function getListOfManager(){
			$sql="
				SELECT userNo, userName
				FROM tblUser
				WHERE userType=2 AND status=1
				ORDER BY userNo ASC
			";
			$result=$this->getArray($sql);
			return $result;
		}
		
		function saveProductionSpec(){
			$productionNo=$this->req["productionNo"];
				
			$managerFk=$this->req["managerFk"];
			$requestDate=$this->req["requestDate"];
			$customerName=$this->req["customerName"];
			$companyName=$this->req["companyName"];
			$vehicleTON=$this->req["vehicleTON"];
			$vehicleText=$this->req["vehicleText"];
			$vehicleType=$this->req["vehicleType"];
			$productName=$this->req["productName"];
			$telephone=$this->req["telephone1"].$this->req["telephone2"].$this->req["telephone3"];
			$type=$this->req["type"];
			$typeValue=$this->req["typeValue"];
			$internalLength=$this->req["internalLength"];
			$internalHeight=$this->req["internalHeight"];
			$internalWidth=$this->req["internalWidth"];
			$alCoil=$this->req["alCoil"];
			$alCoilValue=$this->req["alCoilValue"];
			$floor=$this->req["floor"];
			$floorValueT=$this->req["floorValueT"];
			$floorValueText=$this->req["floorValueText"];
			$tent=$this->req["tent"];
			$sideBoard=$this->req["sideBoard"];
			$sideBoardValue=$this->req["sideBoardValue"];
			$windStopper=$this->req["windStopper"];
			$windStopperValue=$this->req["windStopperValue"];
			$freezer=$this->req["freezer"];
			$freezerValue=$this->req["freezerValue"];
			$gateType=$this->req["gateType"];
			$gateSize=$this->req["gateSize"];
			$gateValue=$this->req["gateValue"];
			$load=$this->req["load"];
			$frontBack=$this->req["frontBack"];
			$eTrackGate=$this->req["eTrackGate"];
			$eTrackWing=$this->req["eTrackWing"];
			$eTrackValue=$this->req["eTrackValue"];
			$toolBucket=$this->req["toolBucket"];
			$toolBucketValue=$this->req["toolBucketValue"];
			$bumperFootHold=$this->req["bumperFootHold"];
			$wingProtector=$this->req["wingProtector"];
			$axis=$this->req["axis"];
			$axisValue=$this->req["axisValue"];
			$balance=$this->req["balance"];
			$specialAddition1=$this->req["specialAddition1"];
			$specialAddition2=$this->req["specialAddition2"];
			$specialAddition3=$this->req["specialAddition3"];
			$specialAddition4=$this->req["specialAddition4"];
			$specialAddition5=$this->req["specialAddition5"];
			$sql = "
			UPDATE `tblProductionSpec`
			SET
			`userFk` = '{$managerFk}',
			`requestDate` = '{$requestDate}',
			`customerName` = '{$customerName}',
			`companyName` = '{$companyName}',
			`vehicleTON` = '{$vehicleTON}',
			`vehicleText` = '{$vehicleText}',
			`vehicleType` = '{$vehicleType}',
			`productName` = '{$productName}',
			`telephone` = '{$telephone}',
			`type` = '{$type}',
			`typeValue` = '{$typeValue}',
			`internalLength` = '{$internalLength}',
			`internalHeight` = '{$internalHeight}',
			`internalWidth` = '{$internalWidth}',
			`alCoil` = '{$alCoil}',
			`alCoilValue` = '{$alCoilValue}',
			`floor` = '{$floor}',
			`floorValueT` = '{$floorValueT}',
			`floorValueText` = '{$floorValueText}',
			`tent` = '{$tent}',
			`sideBoard` = '{$sideBoard}',
			`sideBoardValue` = '{$sideBoardValue}',
			`windStopper` = '{$windStopper}',
			`windStopperValue` = '{$windStopperValue}',
			`freezer` = '{$freezer}',
			`freezerValue` = '{$freezerValue}',
			`gateType` = '{$gateType}',
			`gateSize` = '{$gateSize}',
			`gateValue` = '{$gateValue}',
			`load` = '{$load}',
			`frontBack` = '{$frontBack}',
			`eTrackGate` = '{$eTrackGate}',
			`eTrackWing` = '{$eTrackWing}',
			`eTrackValue` = '{$eTrackValue}',
			`toolBucket` = '{$toolBucket}',
			`toolBucketValue` = '{$toolBucketValue}',
			`bumperFootHold` = '{$bumperFootHold}',
			`wingProtector` = '{$wingProtector}',
			`axis` = '{$axis}',
			`axisValue` = '{$axisValue}',
			`balance` = '{$balance}',
			`specialAddition1` = '{$specialAddition1}',
			`specialAddition2` = '{$specialAddition2}',
			`specialAddition3` = '{$specialAddition3}',
			`specialAddition4` = '{$specialAddition4}',
			`specialAddition5` = '{$specialAddition5}'
			WHERE `productionNo` = '{$productionNo}';
			";
			$this->update($sql);
			return $this->makeResultJson(1, "저장되었습니다");
		}
		
		function deleteProductionSpec(){
			$noArr = $this->req["no"];
				
			$noStr = implode(',', $noArr);
				
			$sql = "
			UPDATE tblProductionSpec
			SET status = 0
			WHERE `productionNo` IN({$noStr})
			";
			$this->update($sql);
		}
		
	}
}
?>