fd91b0e8 by sayhoChun

end of day commit

1 parent 10e833b5
Showing 315 changed files with 1299 additions and 2194 deletions
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/php/LoginUtil.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiBase.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiUser.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiShop.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiProcess.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiBoard.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/Admin.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminUser.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminVehicle.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminCompany.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBoard.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminPush.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminEtc.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminRent.php" ; ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/php/AnyGo.php" ;?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiStatic.php" ;?>
<?
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminUser.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBoard.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftBoardManage.php" ?>
<?
$obj = new AdminUser($_REQUEST) ;
$obj = new AdminBoard($_REQUEST) ;
//$list = $obj->getListOfUser() ;
$list = $obj->getListOfBoard() ;
$boardType=$_REQUEST["boardType"];
$vnum = $obj->virtualNum ;
?>
<script>
......@@ -59,7 +61,7 @@
// 회원 탈퇴
$(".jDelUser").click2(function(){
$(".jDel").click2(function(){
var no = $(this).attr("no");
......@@ -73,11 +75,11 @@
// 단체 삭제
$(".jDelUserMulti").click2(function(){
$(".jDelMulti").click2(function(){
var noArr = new Array();
var noCount = $(".jUserNo:checked").length;
var noCount = $(".jNo:checked").length;
if(noCount == 0)
{
......@@ -90,10 +92,10 @@
{
for(var i = 0; i < noCount; i++ )
{
noArr[i] = $(".jUserNo:checked:eq(" + i + ")").val();
noArr[i] = $(".jNo:checked:eq(" + i + ")").val();
}
deleteUser(noArr);
deleteAction(noArr);
}
});
......@@ -121,24 +123,26 @@
$("#jCheckAll").change(function(){
if($(this).is(":checked"))
$(".jUserNo").prop("checked", true);
$(".jNo").prop("checked", true);
else
$(".jUserNo").prop("checked", false);
$(".jNo").prop("checked", false);
});
}) ;
function deleteUser(noArr)
function deleteAction(noArr)
{
var boardType='<?=$_REQUEST["boardType"]?>';
$.ajax({
url : "/action_front.php?cmd=AdminUser.deleteUser",
url : "/action_front.php?cmd=AdminBoard.deleteBoard",
async : false,
cache : false,
dataType : "json",
data : {
"no" : noArr
"no" : noArr,
"boardType" : boardType
},
success : function(data){
alert("삭제되었습니다");
......@@ -207,13 +211,13 @@
<?=$vnum--?>
</td>
<td class="center">
<input type="checkbox" class="jUserNo" value="<?=$list[$i]["no"] ?>" >
<input type="checkbox" class="jNo" value="<?=$list[$i]["no"] ?>" >
</td>
<td class="center">
<?=$list[$i]["title"]?>
</td>
<td class="center">
<?=$list[$i]["regDate"]?>
</td>
<td class="center">
<input type="button" class="button searchsmall white jView" value="상세보기" no="<?=$list[$i]["no"]?>" />
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBoard.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftBoardManage.php" ?>
<?
$obj = new AdminOperate($_REQUEST, "");
//$info = $obj->getInfoOfShop();
$obj = new AdminBoard($_REQUEST, "");
$info = $obj->getInfoOfBoard();
//$cateCodeList = $obj->getShopCategoryCodeList();
//$shopImgList = $obj->getShopImgList($info["no"]);
$boardType=$_REQUEST[boardType];
$boardNo=$_REQUEST[no];
if($boardType=="EV")
$commentList=$obj->getListOfEComment($boardNo);
$admin_type = $obj->admUser["admin_type"];
......@@ -48,18 +52,20 @@
$(".jSave").click2(function(){
$("#jData").ajaxSubmit({
url:"/action_front.php?cmd=AdminOperate.saveShop",
type : "post",
forceSync : true,
dataType : "json",
success : function(data){
alert(data.returnMessage);
location.href = _rurl;
}
});
if(confirm("내용을 저장하시겠습니까?")){
$("#jData").ajaxSubmit({
url:"/action_front.php?cmd=AdminBoard.saveBoard",
type : "post",
forceSync : true,
dataType : "json",
success : function(data){
alert(data.returnMessage);
location.href = _rurl;
}
});
}
});
$("#jCategorCd").change(function(){
......@@ -124,6 +130,7 @@
<form id="jData" method="post" enctype="multipart/form-data">
<input type="hidden" name="no" value="<?=$_REQUEST[no]?>" />
<input type="hidden" name="boardType" value="<?=$_REQUEST[boardType]?>" />
<table class="datav" style="width:100%;">
<colgroup>
<col width="10%" />
......@@ -132,14 +139,14 @@
<tr>
<th style="height:25px;">제목</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="" />
<input type="text" name="title" class="wl" style="width:70%;" value="<?=$info["title"]?>" />
</td>
</tr>
<tr>
<th style="height:25px;">내용</th>
<td class="l">
<textarea name="special_contract" rows="7" style="width:90%;resize:vertical;"><?=$info["special_contract"]?></textarea>
<textarea name="content" rows="7" style="width:90%;resize:vertical;"><?=$info["content"]?></textarea>
</td>
</tr>
......@@ -148,11 +155,12 @@
<td class="l">
<?
$fileIndex = "101";
$fileName = "img1";
$filePath = ($shopImgList[0]["file_vir_name"] == "" ? "" : $shopImgList[0]["file_vir_name"]);
$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
$fileName = "imgPath1";
$filePath = ($info["imgPath1"] == "" ? "" : $info["imgPath1"]);
//$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPath1" value="<?=$info["imgPath1"]?>" />
</td>
</tr>
<tr>
......@@ -160,11 +168,12 @@
<td class="l">
<?
$fileIndex = "102";
$fileName = "img2";
$filePath = ($shopImgList[1]["file_vir_name"] == "" ? "" : $shopImgList[1]["file_vir_name"]);
$fileNumber = ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
$fileName = "imgPath2";
$filePath = ($info["imgPath2"] == "" ? "" : $info["imgPath2"]);
//$fileNumber = ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPath2" value="<?=$info["imgPath2"]?>" />
</td>
</tr>
<tr>
......@@ -172,11 +181,12 @@
<td class="l">
<?
$fileIndex = "103";
$fileName = "img3";
$filePath = ($shopImgList[2]["file_vir_name"] == "" ? "" : $shopImgList[2]["file_vir_name"]);
$fileNumber = ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
$fileName = "imgPath3";
$filePath = ($info["imgPath3"] == "" ? "" : $info["imgPath3"]);
//$fileNumber = ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPath3" value="<?=$info["imgPath3"]?>" />
</td>
</tr>
<tr>
......@@ -184,11 +194,12 @@
<td class="l">
<?
$fileIndex = "104";
$fileName = "img4";
$filePath = ($shopImgList[3]["file_vir_name"] == "" ? "" : $shopImgList[3]["file_vir_name"]);
$fileNumber = ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
$fileName = "imgPath4";
$filePath = ($info["imgPath4"] == "" ? "" : $info["imgPath4"]);
//$fileNumber = ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPath4" value="<?=$info["imgPath4"]?>" />
</td>
</tr>
<tr>
......@@ -196,15 +207,31 @@
<td class="l">
<?
$fileIndex = "105";
$fileName = "img5";
$filePath = ($shopImgList[4]["file_vir_name"] == "" ? "" : $shopImgList[4]["file_vir_name"]);
$fileNumber = ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
$fileName = "imgPath5";
$filePath = ($info["imgPath5"] == "" ? "" : $info["imgPath5"]);
//$fileNumber = ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPath5" value="<?=$info["imgPath5"]?>" />
</td>
</tr>
</table>
</form>
<h3>
<?
if(sizeof($commentList)>0)
echo "댓글";
?>
</h3>
<table class="datav">
<? for($i=0; $i<sizeof($commentList); $i++){ ?>
<tr>
<th style="width:10%;"><?=$commentList[$i]["userName"]?></td>
<td style="width:50%;"><?=$commentList[$i]["content"]?></td>
<td style="width:20%;"><?=$commentList[$i]["regDate"]?></td>
</tr>
<?}?>
</table>
<div class="btngroupcenter">
<span class="button bigrounded blue jCancel">취소 </span>
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBoard.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftBoardManage.php" ?>
<?
$obj = new AdminOperate($_REQUEST, "") ;
$obj = new AdminBoard($_REQUEST, "") ;
//$list = $obj->getListOfPopup("2") ;
$list = $obj->getListOfOrganizationCert() ;
$vnum = $obj->virtualNum ;
?>
<script src="/admin/inc/fileUpload/fileUploadJS.js"></script>
......@@ -40,7 +40,7 @@
$(".jView").click2(function(){
var no = $(this).attr("no");
location.href = "/admin/boardManage/certificateView.php?no=" + no + "&rurl=" + jQuery.rich.bin2hex(document.URL);
location.href = "/admin/boardManage/certificateView.php?certNo=" + no + "&rurl=" + jQuery.rich.bin2hex(document.URL);
});
......@@ -97,7 +97,7 @@
function deleteAction(noArr)
{
$.ajax({
url : "/action_front.php?cmd=AdminOperate.delPopup",
url : "/action_front.php?cmd=AdminBoard.deleteCert",
async : false,
cache : false,
dataType : "json",
......@@ -144,16 +144,16 @@
<?=$vnum--?>
</td>
<td class="center">
<input type="checkbox" class="jNo" value="<?=$list[$i]["no"] ?>" >
<input type="checkbox" class="jNo" value="<?=$list[$i]["certNo"] ?>" >
</td>
<td class="center">
<?= ($list[$i]["status"] == "Y") ? "노출" : "미노출" ?>
<?=$list[$i]["name"]?>
</td>
<td class="center">
<img alt="" src="/upload_img/<?=$list[$i]["img_path"]?>" style="width: 95%;">
<img alt="" src="/720/<?=$list[$i]["imgPathCert"]?>" style="width:100%; height:700%;">
</td>
<td class="center">
<?=$list[$i]["regist_dt"]?>
<input type="button" class="button searchsmall white jView" value="상세보기" no="<?=$list[$i]["certNo"]?>" />
</td>
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBoard.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftBoardManage.php" ?>
<?
$obj = new AdminOperate($_REQUEST, "");
//$info = $obj->getInfoOfShop();
$obj = new AdminBoard($_REQUEST, "");
$info = $obj->getInfoOfOrganizationCert();
//$cateCodeList = $obj->getShopCategoryCodeList();
//$shopImgList = $obj->getShopImgList($info["no"]);
......@@ -21,10 +21,6 @@
$(document).ready(function(){
initFileUpload(101);
initFileUpload(102);
initFileUpload(103);
initFileUpload(104);
initFileUpload(105);
<?if($admin_type == 3) { ?>
setReadOnly();
......@@ -50,7 +46,7 @@
$(".jSave").click2(function(){
$("#jData").ajaxSubmit({
url:"/action_front.php?cmd=AdminOperate.saveShop",
url:"/action_front.php?cmd=AdminBoard.saveOrganizationCert",
type : "post",
forceSync : true,
dataType : "json",
......@@ -116,7 +112,7 @@
<div class="data" style="width:80%;">
<form id="jData" method="post" enctype="multipart/form-data">
<input type="hidden" name="no" value="<?=$_REQUEST[no]?>" />
<input type="hidden" name="certNo" value="<?=$_REQUEST[certNo]?>" />
<table class="datav" style="width:100%;">
<colgroup>
<col width="10%" />
......@@ -125,8 +121,7 @@
<tr>
<th style="height:25px;">제목</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="" />
<input type="text" name="name" class="wl" style="width:70%;" value="<?=$info["name"]?>" />
</td>
</tr>
<tr>
......@@ -134,11 +129,12 @@
<td class="l">
<?
$fileIndex = "101";
$fileName = "img1";
$filePath = ($shopImgList[0]["file_vir_name"] == "" ? "" : $shopImgList[0]["file_vir_name"]);
$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
$fileName = "imgPathCert1";
$filePath = ($info["imgPathCert"] == "" ? "" : $info["imgPathCert"]);
//$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" value="<?=$info["imgPathCert"]?>" />
</td>
</tr>
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminUser.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminCompany.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftCompanyManage.php" ?>
<?
$obj = new AdminUser($_REQUEST) ;
$obj = new AdminCompany($_REQUEST) ;
//$list = $obj->getListOfUser() ;
$list = $obj->getListOfCompany() ;
$productCode=$_REQUEST["productCode"];
$productType=$_REQUEST["productCode"];
$vnum = $obj->virtualNum ;
......@@ -47,7 +47,7 @@
$(".jView").click2(function(){
var no = $(this).attr("no");
var type='<?=$productType?>';
location.href = "/admin/companyManage/companyView.php?no=" + no + "&productType=" + type +"&rurl=" + jQuery.rich.bin2hex(document.URL);
location.href = "/admin/companyManage/companyView.php?companyNo=" + no + "&productCode=" + type +"&rurl=" + jQuery.rich.bin2hex(document.URL);
});
......@@ -60,7 +60,7 @@
// 회원 탈퇴
$(".jDelUser").click2(function(){
$(".jDel").click2(function(){
var no = $(this).attr("no");
......@@ -68,17 +68,17 @@
if(confirm("정말 삭제하시겠습니까?"))
{
deleteUser(noArr);
deleteAction(noArr);
}
}) ;
// 단체 삭제
$(".jDelUserMulti").click2(function(){
$(".jDelMulti").click2(function(){
var noArr = new Array();
var noCount = $(".jUserNo:checked").length;
var noCount = $(".jNo:checked").length;
if(noCount == 0)
{
......@@ -91,10 +91,10 @@
{
for(var i = 0; i < noCount; i++ )
{
noArr[i] = $(".jUserNo:checked:eq(" + i + ")").val();
noArr[i] = $(".jNo:checked:eq(" + i + ")").val();
}
deleteUser(noArr);
deleteAction(noArr);
}
});
......@@ -131,10 +131,10 @@
function deleteUser(noArr)
function deleteAction(noArr)
{
$.ajax({
url : "/action_front.php?cmd=AdminUser.deleteUser",
url : "/action_front.php?cmd=AdminCompany.deleteCompany",
async : false,
cache : false,
dataType : "json",
......@@ -208,13 +208,22 @@
<?=$vnum--?>
</td>
<td class="center">
<input type="checkbox" class="jUserNo" value="<?=$list[$i]["no"] ?>" >
<input type="checkbox" class="jNo" value="<?=$list[$i]["companyNo"] ?>" >
</td>
<td class="center">
<?=$list[$i]["name"]?>
</td>
<td>
<?=$list[$i]["provinceCode"]?>
</td>
<td>
<?=$list[$i]["address"]?>
</td>
<td>
<?=$list[$i]["telephone"]?>
</td>
<td class="center">
<input type="button" class="button searchsmall white jView" value="상세보기" no="<?=$list[$i]["no"]?>" />
<input type="button" class="button searchsmall white jView" value="상세보기" no="<?=$list[$i]["companyNo"]?>" />
</td>
</tr>
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminCompany.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftCompanyManage.php" ?>
<?
$obj = new AdminOperate($_REQUEST, "");
//$info = $obj->getInfoOfShop();
$obj = new AdminCompany($_REQUEST, "");
$info = $obj->getInfoOfCompany();
$provinceList = $obj->getListOfProvince();
//$cateCodeList = $obj->getShopCategoryCodeList();
//$shopImgList = $obj->getShopImgList($info["no"]);
......@@ -50,7 +51,7 @@
$(".jSave").click2(function(){
$("#jData").ajaxSubmit({
url:"/action_front.php?cmd=AdminOperate.saveShop",
url:"/action_front.php?cmd=AdminCompany.saveCompany",
type : "post",
forceSync : true,
dataType : "json",
......@@ -123,7 +124,8 @@
<div class="data" style="width:80%;">
<form id="jData" method="post" enctype="multipart/form-data">
<input type="hidden" name="no" value="<?=$_REQUEST[no]?>" />
<input type="hidden" name="companyNo" value="<?=$_REQUEST[companyNo]?>" />
<input type="hidden" name="productCode" value="<?=$_REQUEST[productCode]?>" />
<table class="datav" style="width:100%;">
<colgroup>
<col width="10%" />
......@@ -132,14 +134,19 @@
<tr>
<th style="height:25px;">업체명</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="" />
<input type="text" name="name" class="wl" style="width:70%;" value="<?=$info["name"]?>" />
</td>
</tr>
<tr>
<th style="height:25px;">지역</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="" />
<select name="provinceCode">
<option value="">선택</option>
<? for($i=0; $i<sizeof($provinceList); $i++){ ?>
<option value="<?=$provinceList[$i]["provinceNumber"]?>" <?=$info["provinceCode"] == $provinceList[$i]["provinceNumber"] ? "SELECTED" : ""?>><?=$provinceList[$i]["desc"]?></option>
<?}?>
</select>
</td>
</tr>
......@@ -147,32 +154,36 @@
<tr>
<th style="height:25px;">상세주소</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="<?=$info["discount_rate"] ?>" />
<input type="text" name="address" class="wl" style="width:70%;" value="<?=$info["address"] ?>" />
</td>
</tr>
<tr>
<th style="height:25px;">전화번호</th>
<td class="l">
<input type="text" style="width:50px"/>&nbsp; - &nbsp;<input type="text" style="width:50px"/>&nbsp; - &nbsp;<input type="text" style="width:50px"/>
<input type="text" name="telephone1" style="width:50px" value="<?=substr($info["telephone"], 0, 3)?>"/>&nbsp; - &nbsp;
<input type="text" name="telephone2" style="width:50px" value="<?=substr($info["telephone"], 3, 4)?>"/>&nbsp; - &nbsp;
<input type="text" name="telephone3" style="width:50px" value="<?=substr($info["telephone"], 7, 4)?>"/>
</td>
</tr>
<tr>
<th style="height:25px;">FAX</th>
<td class="l">
<input type="text" style="width:50px"/>&nbsp; - &nbsp;<input type="text" style="width:50px"/>&nbsp; - &nbsp;<input type="text" style="width:50px"/>
<input type="text" name="fax1" style="width:50px" value="<?=substr($info["fax"], 0, 3)?>"/>&nbsp; - &nbsp;
<input type="text" name="fax2" style="width:50px" value="<?=substr($info["fax"], 3, 4)?>"/>&nbsp; - &nbsp;
<input type="text" name="fax3" style="width:50px" value="<?=substr($info["fax"], 7, 4)?>"/>
</td>
</tr>
<tr>
<th style="height:25px;">E-mail</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="<?=$info["discount_rate"] ?>" />
<input type="text" name="eMail" class="wl" style="width:70%;" value="<?=$info["eMail"] ?>" />
</td>
</tr>
<tr>
<th style="height:25px;">주요 담당제품</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:70%;" value="<?=$info["discount_rate"] ?>" />
<input type="text" name="companyProductList" class="wl" style="width:70%;" value="<?=$info["companyProductList"] ?>" />
</td>
</tr>
......@@ -181,11 +192,12 @@
<td class="l">
<?
$fileIndex = "101";
$fileName = "img1";
$filePath = ($shopImgList[0]["file_vir_name"] == "" ? "" : $shopImgList[0]["file_vir_name"]);
$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
$fileName = "imgPathCompany1";
$filePath = ($info["imgPathCompany1"] == "" ? "" : $info["imgPathCompany1"]);
//$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathCompany1" value="<?=$info["imgPathCompany1"]?>" />
</td>
</tr>
<tr>
......@@ -193,11 +205,12 @@
<td class="l">
<?
$fileIndex = "102";
$fileName = "img2";
$filePath = ($shopImgList[1]["file_vir_name"] == "" ? "" : $shopImgList[1]["file_vir_name"]);
$fileNumber = ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
$fileName = "imgPathCompany2";
$filePath = ($info["imgPathCompany2"] == "" ? "" : $info["imgPathCompany2"]);
//$fileNumber = ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathCompany2" value="<?=$info["imgPathCompany2"]?>" />
</td>
</tr>
<tr>
......@@ -205,11 +218,12 @@
<td class="l">
<?
$fileIndex = "103";
$fileName = "img3";
$filePath = ($shopImgList[2]["file_vir_name"] == "" ? "" : $shopImgList[2]["file_vir_name"]);
$fileNumber = ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
$fileName = "imgPathCompany3";
$filePath = ($info["imgPathCompany3"] == "" ? "" : $info["imgPathCompany3"]);
//$fileNumber = ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathCompany3" value="<?=$info["imgPathCompany3"]?>" />
</td>
</tr>
<tr>
......@@ -217,11 +231,12 @@
<td class="l">
<?
$fileIndex = "104";
$fileName = "img4";
$filePath = ($shopImgList[3]["file_vir_name"] == "" ? "" : $shopImgList[3]["file_vir_name"]);
$fileNumber = ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
$fileName = "imgPathCompany4";
$filePath = ($info["imgPathCompany4"] == "" ? "" : $info["imgPathCompany4"]);
//$fileNumber = ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathCompany4" value="<?=$info["imgPathCompany4"]?>" />
</td>
</tr>
<tr>
......@@ -229,11 +244,12 @@
<td class="l">
<?
$fileIndex = "105";
$fileName = "img5";
$filePath = ($shopImgList[4]["file_vir_name"] == "" ? "" : $shopImgList[4]["file_vir_name"]);
$fileNumber = ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
$fileName = "imgPathCompany5";
$filePath = ($info["imgPathCompany5"] == "" ? "" : $info["imgPathCompany5"]);
//$fileNumber = ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathCompany5" value="<?=$info["imgPathCompany5"]?>" />
</td>
</tr>
</table>
......
......@@ -4,7 +4,7 @@
<?
$obj = new AdminUser($_REQUEST) ;
//$list = $obj->getListOfUser() ;
$list = $obj->getListOfUser() ;
$vnum = $obj->virtualNum ;
?>
<script>
......@@ -47,12 +47,39 @@
location.href = "/admin/userManage/userView.php?isMS=0&no=" + no + "&rurl=" + jQuery.rich.bin2hex(document.URL);
});
$(".jInitialize").click2(function(){
var no = $(this).attr("no");
if(confirm("초기화를 하시겠습니까? \n변경 후 수정은 불가능합니다")){
$.ajax({
url : "/action_front.php?cmd=AdminUser.initializePwd",
async : false,
cache : false,
dataType : "json",
data : {
"userNo" : no
},
success : function(data){
alert(data.returnMessage);
location.reload();
/*
if(_no != "")
location.reload();
else
location.href = _rurl;
*/
}
});
}
});
$(".jAddUserExcel").click2(function(){
var s=$("#search_text").val();
location.href = "/admin/excel/userListExcel.php?search_text="+s;
});
......@@ -96,25 +123,6 @@
});
$(".jBtnMS").click2(function(){
var no = $(this).attr("no");
var member_type = $(this).attr("member_type");
$.ajax({
url : "/action_front.php?cmd=AdminUser.processRequestMemberShipUser",
async : false,
cache : false,
dataType : "json",
data : {
"no" : no
, "member_type" : member_type
},
success : function(data){
alert(data.returnMessage);
location.reload();
}
});
});
$("#jCheckAll").change(function(){
......@@ -161,7 +169,14 @@
<label>
<span>조회 조건</span>
<input type="text" id="search_text" name="search_text" class="wm" value="<?=$_REQUEST['search_text']?>" />
<select name="searchType">
<option value="">전체 </option>
<option value="userName" <?=$_REQUEST["searchType"] == "userName" ? "SELECTED" : ""?>>이름</option>
<option value="userID" <?=$_REQUEST["searchType"] == "userID" ? "SELECTED" : ""?>>아이디</option>
<option value="nickName" <?=$_REQUEST["searchType"] == "nickName" ? "SELECTED" : ""?>>닉네임</option>
<option value="userVehicleType" <?=$_REQUEST["searchType"] == "userVehicleType" ? "SELECTED" : ""?>>차종</option>
</select>
<input type="text" id="searchText" name="searchText" class="wm" value="<?=$_REQUEST['searchText']?>" />
</label>
<input type="button" class="button smallgrounded blue jSearch btnright_y" value="검색" />
......@@ -179,12 +194,11 @@
<thead>
<tr>
<th class="no" width="5%">No</th>
<th width="2%"><input type="checkbox" id="jCheckAll"></th>
<th width="6%">이름</th>
<th width="10%">아이디</th>
<th width="10%">닉네임</th>
<th width="10%">전화번호</th>
<th width="20%">차종</th>
<th width="10%">차종</th>
<th width="6%">비밀번호 <br>초기화</th>
</tr>
</thead>
......@@ -195,41 +209,45 @@
<?=$vnum--?>
</td>
<td class="center">
<input type="checkbox" class="jUserNo" value="<?=$list[$i]["no"] ?>" >
</td>
<td class="center">
<?
if($list[$i]["regi_type"] == "E")
echo $list[$i]["id"];
else if($list[$i]["regi_type"] == "K")
echo "카카오톡 가입";
else if($list[$i]["regi_type"] == "F")
echo "페이스북 가입";
?>
</td>
<td class="center">
<?=$list[$i]["name"]?>
<?=$list[$i]["userName"]?>
</td>
<td class="center">
<?=$list[$i]["tel"]?>
<?=$list[$i]["userID"]?>
</td>
<td class="center">
<?=$list[$i]["group_name"]?>
<?=$list[$i]["nickName"]?>
</td>
<td class="center">
<?=($list[$i]["member_type"] == "V") ? "O" : "X"?>
<?=$list[$i]["userTel"]?>
</td>
<td class="center">
<?=($list[$i]["member_type"] == "M") ? "O" : "X"?>
</td>
<td class="center">
<?=$list[$i]["reg_dt"]?>
<?echo $list[$i]["userVehicleTON"]."TON / ".$list[$i]["userVehicleName"]." / "?>
<?
switch($list[$i]["userVehicleType"]){
case "HY":
echo "현대";
break;
case "DW":
echo "대우";
break;
case "VV":
echo "볼보";
break;
case "SC":
echo "스카니아";
break;
case "MB":
echo "벤츠";
break;
case "MA":
echo "";
break;
}
?>
</td>
<td class="center">
<input type="button" class="button searchsmall white jViewUser" value="상세보기" no="<?=$list[$i]["no"]?>" />
<?if($loginInfo["admin_type"] == "1"){ ?>
<input type="button" class="button searchsmall white jDelUser" value="삭제" no="<?=$list[$i]["no"]?>" />
<?} ?>
<input type="button" class="button searchsmall white jInitialize" value="초기화" no="<?=$list[$i]["userNo"]?>" />
</td>
</tr>
<? } ?>
......
......@@ -4,7 +4,7 @@
<?
$obj = new AdminUser($_REQUEST) ;
//$list = $obj->getListOfUser() ;
$list = $obj->getListOfManager() ;
$vnum = $obj->virtualNum ;
?>
<script>
......@@ -97,6 +97,32 @@
});
$(".jInitialize").click2(function(){
var no = $(this).attr("no");
if(confirm("초기화를 하시겠습니까? \n변경 후 수정은 불가능합니다")){
$.ajax({
url : "/action_front.php?cmd=AdminUser.initializePwd",
async : false,
cache : false,
dataType : "json",
data : {
"userNo" : no
},
success : function(data){
alert(data.returnMessage);
location.reload();
/*
if(_no != "")
location.reload();
else
location.href = _rurl;
*/
}
});
}
});
$(".jBtnMS").click2(function(){
var no = $(this).attr("no");
var member_type = $(this).attr("member_type");
......@@ -162,7 +188,13 @@
<label>
<span>조회 조건</span>
<input type="text" id="search_text" name="search_text" class="wm" value="<?=$_REQUEST['search_text']?>" />
<select name="searchType">
<option value="">전체 </option>
<option value="userName" <?=$_REQUEST["searchType"] == "userName" ? "SELECTED" : ""?>>이름</option>
<option value="userID" <?=$_REQUEST["searchType"] == "userID" ? "SELECTED" : ""?>>아이디</option>
<option value="nickName" <?=$_REQUEST["searchType"] == "nickName" ? "SELECTED" : ""?>>닉네임</option>
</select>
<input type="text" id="searchText" name="searchText" class="wm" value="<?=$_REQUEST['searchText']?>" />
</label>
<input type="button" class="button smallgrounded blue jSearch btnright_y" value="검색" />
......@@ -185,7 +217,6 @@
<th width="10%">아이디</th>
<th width="10%">닉네임</th>
<th width="10%">전화번호</th>
<th width="20%">차종</th>
<th width="6%">비밀번호 <br>초기화</th>
</tr>
</thead>
......@@ -195,42 +226,24 @@
<td class="no center">
<?=$vnum--?>
</td>
<td class="center">
<input type="checkbox" class="jUserNo" value="<?=$list[$i]["no"] ?>" >
</td>
<td class="center">
<?
if($list[$i]["regi_type"] == "E")
echo $list[$i]["id"];
else if($list[$i]["regi_type"] == "K")
echo "카카오톡 가입";
else if($list[$i]["regi_type"] == "F")
echo "페이스북 가입";
?>
<input type="checkbox" class="jUserNo" value="<?=$list[$i]["userNo"] ?>" >
</td>
<td class="center">
<?=$list[$i]["name"]?>
<?=$list[$i]["userName"]?>
</td>
<td class="center">
<?=$list[$i]["tel"]?>
</td>
<td class="center">
<?=$list[$i]["group_name"]?>
</td>
<td class="center">
<?=($list[$i]["member_type"] == "V") ? "O" : "X"?>
<td class="center">
<?=$list[$i]["userID"]?>
</td>
<td class="center">
<?=($list[$i]["member_type"] == "M") ? "O" : "X"?>
<?=$list[$i]["nickName"]?>
</td>
<td class="center">
<?=$list[$i]["reg_dt"]?>
<?=$list[$i]["userTel"]?>
</td>
<td class="center">
<input type="button" class="button searchsmall white jViewUser" value="상세보기" no="<?=$list[$i]["no"]?>" />
<?if($loginInfo["admin_type"] == "1"){ ?>
<input type="button" class="button searchsmall white jDelUser" value="삭제" no="<?=$list[$i]["no"]?>" />
<?} ?>
<input type="button" class="button searchsmall white jInitialize" value="초기화" no="<?=$list[$i]["userNo"]?>" />
</td>
</tr>
<? } ?>
......
......@@ -9,38 +9,12 @@
?>
<script language="javascript">
var _rurl = "<?=$rurl?>";
var _no = "<?=$_REQUEST[no]?>";
var _rurl = "<?=$rurl != "" ? $rurl : 0?>";
var _no = "<?=$_REQUEST[no] != "" ? $_REQUEST[no] : 0?>";
$(document).ready(function(){
//=====프레입웤 변수들==================================================================================//
var FORM_TARGET_CLS_NM = ".data" ; // 폼을 동적 wrap 할 타겟 ID이름
var FORM_NAME = "alf" ; // 폼이름
var FORM_METHOD = "POST" ; // 폼 메쏘드
var FORM_USE_FILE = false ; // 파일폼 사용 여부
var FORM_ACTION = "/action_front.php" ;
var NEXT_CMD = "" ; // 다은 수행 할 cmd
//=====================================================================================================//
var dates = $("[name='birthDT[]']").datepicker({
showMonthAfterYear:true,
inline: true,
changeMonth: true,
changeYear: true,
yearRange: '1970',
dateFormat : 'yy-mm-dd',
dayNamesMin:['일', '월', '화', '수', '목', '금', ' 토'],
monthNames:['1월','2월','3월','4월','5월','6월','7 월','8월','9월','10월','11월','12월'],
monthNamesShort:['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
showButtonPanel: true, currentText: '오늘 ' , closeText: '닫기'
});
var jForm = $(FORM_TARGET_CLS_NM).mf({ "name" : FORM_NAME , "method" : FORM_METHOD , "action" : FORM_ACTION , "useFile" : FORM_USE_FILE }) ;
$(".jCancel").click2(function(){
location.href = _rurl;
});
......@@ -54,11 +28,69 @@
deleteUser(noArr);
}
});
$(".jAdd").click2(function(){
var data = $("#jData").serialize();
if(confirm("직원회원 계정을 등록하시겠습니까?")){
$.ajax({
url : "/action_front.php?cmd=AdminUser.saveManager",
async : false,
cache : false,
dataType : "json",
data : data,
success : function(data){
alert(data.returnMessage);
if(data.returnCode == "1")
location.href=_rurl;
/*
if(_no != "")
location.reload();
else
location.href = _rurl;
*/
}
});
}
});
$(".jCheckIDRedundancy").click2(function(){
var data = $("#jData").serialize();
$.ajax({
url : "/action_front.php?cmd=AdminUser.checkIDRedundancy",
async : false,
cache : false,
dataType : "json",
data : data,
success : function(data){
alert(data.returnMessage);
}
});
});
$(".jCheckNickRedundancy").click2(function(){
var data = $("#jData").serialize();
$.ajax({
url : "/action_front.php?cmd=AdminUser.checkNickRedundancy",
async : false,
cache : false,
dataType : "json",
data : data,
success : function(data){
alert(data.returnMessage);
}
});
});
}) ;
function deleteUser(noArr)
{
$.ajax({
......@@ -70,7 +102,7 @@
"no" : noArr
},
success : function(data){
alert("삭제되었습니다");
//alert("삭제되었습니다");
location.href = _rurl;
}
});
......@@ -88,8 +120,8 @@
</h2>
<!-- location area -->
<div class="data" style="width:50%;">
<form id="jData">
<div class="jData" style="width:50%;">
<table class="datav" style="width:100%;">
<colgroup>
<col width="30%" />
......@@ -98,44 +130,42 @@
<tr>
<th style="height:25px;">아이디</th>
<td >
<input type="text" style="width:200px"/>
<span class="button bigrounded blue" style="color:white; width:70px">&nbsp;중복확인&nbsp;</span>
<input name="userID" type="text" style="width:200px"/>
<span class="button bigrounded blue jCheckIDRedundancy" style="color:white; width:70px">&nbsp;중복확인&nbsp;</span>
</td>
</tr>
<tr>
<th style="height:25px;">비밀번호</th>
<td >
<input type="text" style="width:200px"/>
<input name="userPwd" type="text" style="width:200px"/>
</td>
</tr>
<tr>
<th style="height:25px;">직원명</th>
<td class="l">
<input type="text" style="width:200px" />
<input name="userName" type="text" style="width:200px" />
</td>
</tr>
<tr>
<th style="height:25px;">닉네임</th>
<td class="l">
<input type="text" style="width:200px" />
<span class="button bigrounded blue" style="color:white; width:70px">&nbsp;중복확인&nbsp;</span>
<input name="nickName" type="text" style="width:200px" />
<span class="button bigrounded blue jCheckNickRedundancy" style="color:white; width:70px">&nbsp;중복확인&nbsp;</span>
</td>
</tr>
<tr>
<th style="height:25px;">전화번호</th>
<td class="l">
<input type="text" style="width:50px"/>&nbsp; - &nbsp;<input type="text" style="width:50px"/>&nbsp; - &nbsp;<input type="text" style="width:50px"/>
<input name="userTel1" type="text" style="width:50px"/>&nbsp; - &nbsp;<input name="userTel2" type="text" style="width:50px"/>&nbsp; - &nbsp;<input name="userTel3" type="text" style="width:50px"/>
</td>
</tr>
</table>
<div class="btngroupcenter">
<span class="button bigrounded blue jCancel">등록</span>
<?if($loginInfo["admin_type"] == "1"){ ?>
<span class="button bigrounded blue jDelUser" >삭제</span>
<?} ?>
<span class="button bigrounded blue jAdd">등록</span>
</div>
</div>
</form>
</div>
\ No newline at end of file
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminUser.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminVehicle.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftVehicleManage.php" ?>
<?
$obj = new AdminUser($_REQUEST) ;
$obj = new AdminVehicle($_REQUEST) ;
//$list = $obj->getListOfUser() ;
$list = $obj->getListOfVehicle() ;
$vehicleType=$_REQUEST["vehicleType"];
$vnum = $obj->virtualNum ;
?>
......@@ -46,7 +46,7 @@
$(".jViewVehicle").click2(function(){
var no = $(this).attr("no");
var type='<?=$vehicleType?>';
location.href = "/admin/vehicleManage/vehicleView.php?no=" + no + "&vehicleType=" + type +"&rurl=" + jQuery.rich.bin2hex(document.URL);
location.href = "/admin/vehicleManage/vehicleView.php?vehicleNo=" + no + "&vehicleType=" + type +"&rurl=" + jQuery.rich.bin2hex(document.URL);
});
......@@ -58,8 +58,7 @@
// 회원 탈퇴
$(".jDelUser").click2(function(){
$(".jDel").click2(function(){
var no = $(this).attr("no");
......@@ -67,21 +66,21 @@
if(confirm("정말 삭제하시겠습니까?"))
{
deleteUser(noArr);
deleteAction(noArr);
}
}) ;
// 단체 삭제
$(".jDelUserMulti").click2(function(){
$(".jDelMulti").click2(function(){
var noArr = new Array();
var noCount = $(".jUserNo:checked").length;
var noCount = $(".jNo:checked").length;
if(noCount == 0)
{
alert("삭제할 관리자를 하나 이상 선택해주세요.");
alert("삭제할 항목을 하나 이상 선택해주세요.");
return false;
}
......@@ -90,10 +89,10 @@
{
for(var i = 0; i < noCount; i++ )
{
noArr[i] = $(".jUserNo:checked:eq(" + i + ")").val();
noArr[i] = $(".jNo:checked:eq(" + i + ")").val();
}
deleteUser(noArr);
deleteAction(noArr);
}
});
......@@ -130,10 +129,10 @@
function deleteUser(noArr)
function deleteAction(noArr)
{
$.ajax({
url : "/action_front.php?cmd=AdminUser.deleteUser",
url : "/action_front.php?cmd=AdminVehicle.deleteVehicle",
async : false,
cache : false,
dataType : "json",
......@@ -243,13 +242,13 @@
<?=$vnum--?>
</td>
<td class="center">
<input type="checkbox" class="jUserNo" value="<?=$list[$i]["no"] ?>" >
<input type="checkbox" class="jNo" value="<?=$list[$i]["vehicleNo"] ?>" >
</td>
<td class="center">
<?=$list[$i]["name"]?>
</td>
<td class="center">
<input type="button" class="button searchsmall white jViewVehicle" value="상세보기" no="<?=$list[$i]["no"]?>" />
<input type="button" class="button searchsmall white jViewVehicle" value="상세보기" no="<?=$list[$i]["vehicleNo"]?>" />
</td>
</tr>
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminVehicle.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftVehicleManage.php" ?>
<?
$obj = new AdminOperate($_REQUEST, "");
//$info = $obj->getInfoOfShop();
$obj = new AdminVehicle($_REQUEST, "");
$info = $obj->getInfoOfVehicle();
//$cateCodeList = $obj->getShopCategoryCodeList();
//$shopImgList = $obj->getShopImgList($info["no"]);
$admin_type = $obj->admUser["admin_type"];
$rurl = pack("H*", $_REQUEST["rurl"]) ;
?>
......@@ -48,18 +46,22 @@
$(".jSave").click2(function(){
$("#jData").ajaxSubmit({
url:"/action_front.php?cmd=AdminOperate.saveShop",
type : "post",
forceSync : true,
dataType : "json",
success : function(data){
alert(data.returnMessage);
location.href = _rurl;
}
});
if(confirm("내용을 저장하시겠습니까?")){
$("#jData").ajaxSubmit({
url:"/action_front.php?cmd=AdminVehicle.saveVehicle",
type : "post",
forceSync : true,
dataType : "json",
success : function(data){
alert(data.returnMessage);
location.href = _rurl;
},
error : function(req, res, error){
alert(req+res+error);
}
});
}
});
$("#jCategorCd").change(function(){
......@@ -110,7 +112,9 @@
<div class="data" style="width:80%;">
<form id="jData" method="post" enctype="multipart/form-data">
<input type="hidden" name="no" value="<?=$_REQUEST[no]?>" />
<input type="hidden" name="vehicleNo" value="<?=$_REQUEST["vehicleNo"]?>" />
<input type="hidden" name="vehicleType" value="<?=$_REQUEST["vehicleType"]?>" />
<table class="datav" style="width:100%;">
<colgroup>
<col width="10%" />
......@@ -119,14 +123,14 @@
<tr>
<th style="height:25px;">제품명</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:90%;" value="" />
<input type="text" name="name" class="wl" style="width:90%;" value="<?=$info["name"]?>" />
</td>
</tr>
<tr>
<th style="height:25px;">제품소개</th>
<td class="l">
<textarea name="special_contract" rows="7" style="width:90%;resize:vertical;"><?=$info["special_contract"]?></textarea>
<textarea name="spec" rows="7" style="width:90%;resize:vertical;"><?=$info["spec"]?></textarea>
</td>
</tr>
......@@ -134,7 +138,7 @@
<tr>
<th style="height:25px;">이동 URL</th>
<td class="l">
<input type="text" name="discount_rate" class="wl" style="width:90%;" value="<?=$info["discount_rate"] ?>" />
<input type="text" name="videoURL" class="wl" style="width:90%;" value="<?=$info["videoURL"] ?>" />
</td>
</tr>
......@@ -143,11 +147,13 @@
<td class="l">
<?
$fileIndex = "101";
$fileName = "img1";
$filePath = ($shopImgList[0]["file_vir_name"] == "" ? "" : $shopImgList[0]["file_vir_name"]);
$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
$fileName = "imgPathVehicle1";
$filePath = ($info["imgPathVehicle1"] == "" ? "" : $info["imgPathVehicle1"]);
//$fileNumber = ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathVehicle1" value="<?=$info["imgPathVehicle1"]?>" />
</td>
</tr>
<tr>
......@@ -155,11 +161,12 @@
<td class="l">
<?
$fileIndex = "102";
$fileName = "img2";
$filePath = ($shopImgList[1]["file_vir_name"] == "" ? "" : $shopImgList[1]["file_vir_name"]);
$fileNumber = ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
$fileName = "imgPathVehicle2";
$filePath = ($info["imgPathVehicle2"] == "" ? "" : $info["imgPathVehicle2"]);
//$fileNumber = ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathVehicle2" value="<?=$info["imgPathVehicle2"]?>" />
</td>
</tr>
<tr>
......@@ -167,11 +174,12 @@
<td class="l">
<?
$fileIndex = "103";
$fileName = "img3";
$filePath = ($shopImgList[2]["file_vir_name"] == "" ? "" : $shopImgList[2]["file_vir_name"]);
$fileNumber = ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
$fileName = "imgPathVehicle3";
$filePath = ($info["imgPathVehicle3"] == "" ? "" : $info["imgPathVehicle3"]);
//$fileNumber = ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathVehicle3" value="<?=$info["imgPathVehicle3"]?>" />
</td>
</tr>
<tr>
......@@ -179,11 +187,12 @@
<td class="l">
<?
$fileIndex = "104";
$fileName = "img4";
$filePath = ($shopImgList[3]["file_vir_name"] == "" ? "" : $shopImgList[3]["file_vir_name"]);
$fileNumber = ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
$fileName = "imgPathVehicle4";
$filePath = ($info["imgPathVehicle4"] == "" ? "" : $info["imgPathVehicle4"]);
//$fileNumber = ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathVehicle4" value="<?=$info["imgPathVehicle4"]?>" />
</td>
</tr>
<tr>
......@@ -191,11 +200,12 @@
<td class="l">
<?
$fileIndex = "105";
$fileName = "img5";
$filePath = ($shopImgList[4]["file_vir_name"] == "" ? "" : $shopImgList[4]["file_vir_name"]);
$fileNumber = ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
$fileName = "imgPathVehicle5";
$filePath = ($info["imgPathVehicle5"] == "" ? "" : $info["imgPathVehicle5"]);
//$fileNumber = ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
?>
<input type="hidden" name="imgPathVehicle5" value="<?=$info["imgPathVehicle5"]?>" />
</td>
</tr>
</table>
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;
include $_SERVER[DOCUMENT_ROOT] . "/common/php/LoginUtil.php";
if (! class_exists("AdminCompany")){
class AdminCompany extends AdminBase{
function __construct($req)
{
parent::__construct($req);
}
function getListOfCompany(){
$productCode=$this->req["productCode"];
$sql="
SELECT COUNT(*) AS rn
FROM tblCompany
WHERE productCode='{$productCode}' AND status=1
";
$this->initPage();
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
$sql="
SELECT companyNo, name, provinceCode, address, telephone
FROM tblCompany
WHERE productCode='{$productCode}' AND status=1
ORDER BY regDate DESC
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
function getInfoOfCompany(){
$companyNo=$_REQUEST["companyNo"];
$sql="
SELECT *
FROM tblCompany
WHERE companyNo='{$companyNo}' AND status=1
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
function getListOfProvince(){
$sql="
SELECT *
FROM tblZipProvince
ORDER BY provinceNumber ASC
";
$result=$this->getArray($sql);
return $result;
}
function saveCompany(){
$companyType=$this->req["companyType"];
$companyNo=$this->req["companyNo"];
$name=$this->req["name"];
$productCode=$this->req["productCode"];
$provinceCode=$this->req["provinceCode"];
$address=$this->req["address"];
$telephone1=$this->req["telephone1"];
$telephone2=$this->req["telephone2"];
$telephone3=$this->req["telephone3"];
$telephone=$telephone1.$telephone2.$telephone3;
$fax1=$this->req["fax1"];
$fax2=$this->req["fax2"];
$fax3=$this->req["fax3"];
$fax=$fax1.$fax2.$fax3;
$eMail=$this->req["eMail"];
$companyProductList=$this->req["companyProductList"];
$imgResult = $this->inFn_Common_fileSave($_FILES);
$imgPathCompany1 = $imgResult["imgPathCompany1"]["saveURL"] != "" ? $imgResult["imgPathCompany1"]["saveURL"] : $this->req["imgPathCompany1"];
$imgPathCompany2 = $imgResult["imgPathCompany2"]["saveURL"] != "" ? $imgResult["imgPathCompany2"]["saveURL"] : $this->req["imgPathCompany2"];
$imgPathCompany3 = $imgResult["imgPathCompany3"]["saveURL"] != "" ? $imgResult["imgPathCompany3"]["saveURL"] : $this->req["imgPathCompany3"];
$imgPathCompany4 = $imgResult["imgPathCompany4"]["saveURL"] != "" ? $imgResult["imgPathCompany4"]["saveURL"] : $this->req["imgPathCompany4"];
$imgPathCompany5 = $imgResult["imgPathCompany5"]["saveURL"] != "" ? $imgResult["imgPathCompany5"]["saveURL"] : $this->req["imgPathCompany5"];
if($companyNo == ""){
$sql="
insert INTO `tblCompany`
(
`name`,
`imgPathCompany1`,
`imgPathCompany2`,
`imgPathCompany3`,
`imgPathCompany4`,
`imgPathCompany5`,
`provinceCode`,
`productCode`,
`address`,
`telephone`,
`fax`,
`eMail`,
`companyProductList`,
`status`,
`regDate`
)
VALUES
(
'{$name}',
'{$imgPathCompany1}',
'{$imgPathCompany2}',
'{$imgPathCompany3}',
'{$imgPathCompany4}',
'{$imgPathCompany5}',
'{$provinceCode}',
'{$productCode}',
'{$address}',
'{$telephone}',
'{$fax}',
'{$eMail}',
'{$companyProductList}',
1,
NOW()
);
";
$this->update($sql);
return $this->makeResultJson(1, "저장되었습니다");
}
else{
$sql="
UPDATE tblCompany
SET
name='{$name}',
`imgPathCompany1`= '{$imgPathCompany1}',
`imgPathCompany2`= '{$imgPathCompany2}',
`imgPathCompany3`= '{$imgPathCompany3}',
`imgPathCompany4`= '{$imgPathCompany4}',
`imgPathCompany5`= '{$imgPathCompany5}',
provinceCode='{$provinceCode}',
productCode='{$productCode}',
address='{$address}',
telephone='{$telephone}',
fax='{$fax}',
eMail='{$eMail}',
companyProductList='{$companyProductList}'
WHERE companyNo='{$companyNo}'
";
$this->update($sql);
return $this->makeResultJson(1, "수정되었습니다");
}
}
function deleteCompany(){
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql = "
UPDATE tblCompany
SET status = 0
WHERE `companyNo` IN({$noStr})
";
$this->update($sql);
}
}
}
?>
\ No newline at end of file
......@@ -16,15 +16,15 @@ if(!class_exists("AdminEtc")){
// 관리자 비밀번호 변경
function chageAdminPWD()
{
$no = $this->admUser["no"];
$no = $this->admUser["adminNo"];
$nowPWD = $this->req["nowPWD"];
$newPWD = $this->req["newPWD"];
$sql = "
SELECT *
FROM tbl_admin
WHERE `no` = '{$no}'
FROM tblAdmin
WHERE `adminNo` = '{$no}'
LIMIT 1
";
$result = $this->getRow($sql);
......@@ -36,7 +36,7 @@ if(!class_exists("AdminEtc")){
}
if($result["admin_pwd"] != MD5($nowPWD))
if($result["adminPwd"] != MD5($nowPWD))
{
$_REQUEST["msg"] = "현재 비밀번호가 일치하지 않습니다.";
return false;
......@@ -44,10 +44,9 @@ if(!class_exists("AdminEtc")){
$sql = "
UPDATE tbl_admin
SET admin_pwd = MD5('{$newPWD}')
, admin_pwd_enc = HEX('{$newPWD}')
WHERE `no` = '{$no}'
UPDATE tblAdmin
SET adminPwd = MD5('{$newPWD}')
WHERE `adminNo` = '{$no}'
";
$this->update($sql);
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;?>
<?
/*
* Admin process
* add by dev.lee
*/
if (! class_exists("AdminRent"))
{
class AdminRent extends AdminBase
{
function __construct($req)
{
parent::__construct($req);
}
public function saveBuilding()
{
$no = $this->req["no"];
$name = $this->req["name"];
$sql="SELECT no FROM tbl_user_group WHERE name='{$name}'";
$result=$this->getRow($sql);
$group_fk=$result["no"];
$vip_fk=$this->req["vip_fk"];
$type = $this->req["type"];
$address = $this->req["address"];
$expire_date = $this->req["expire_date"];
$manage_type = $this->req["manage_type"];
$owner_name = $this->req["owner_name"];
$owner_tel = $this->req["owner_tel"];
$owner_address = $this->req["owner_address"];
$month_account_no = $this->req["month_account_no"];
$month_account_bank = $this->req["month_account_bank"];
$month_account_owner = $this->req["month_account_owner"];
$util_account_no = $this->req["util_account_no"];
$util_account_bank = $this->req["util_account_bank"];
$util_account_owner = $this->req["util_account_owner"];
$owner_account_no = $this->req["owner_account_no"];
$owner_account_bank = $this->req["owner_account_bank"];
$owner_account_owner = $this->req["owner_account_owner"];
$rent_manager = $this->req["rent_manager"];
$manage_pay_date = $this->req["manage_pay_date"];
$note = $this->req["note"];
$expire_date = !strlen($expire_date)?"NULL":"'$expire_date'";
if($no == "")
{
$sql = "
INSERT INTO
tbl_building(group_fk, vip_fk, name, type, address, expire_date, manage_type, owner_name, owner_tel, owner_address, month_account_no, month_account_bank, month_account_owner, util_account_no, util_account_bank, util_account_owner, owner_account_no, owner_account_bank, owner_account_owner, rent_manager, manage_pay_date, note, insert_datetime, status)
VALUES
('{$group_fk}', '{$vip_fk}', '{$name}', '{$type}', '{$address}', '{$expire_date}', '{$manage_type}', '{$owner_name}', '{$owner_tel}', '{$owner_address}', '{$month_account_no}', '{$month_account_bank}', '{$month_account_owner}', '{$util_account_no}', '{$util_account_bank}', '{$util_account_owner}', '{$owner_account_no}', '{$owner_account_bank}', '{$owner_account_owner}', '{$rent_manager}', '{$manage_pay_date}', '{$note}', NOW(), 'Y')
";
$this->update($sql);
$sql="
UPDATE tbl_user_group
SET
`is_matched` = 'Y'
WHERE `no`='{$group_fk}'
";
$this->update($sql);
if(!empty($vip_fk)){
$sql="
UPDATE tbl_user
SET is_matched = 1
where no='{$vip_fk}'
";
$this->update($sql);
}
return $this->makeResultJson(1, "등록되었습니다.");
}
else
{
$sql = "
UPDATE tbl_building
SET
`group_fk` = '{$group_fk}',
`vip_fk` = '{$vip_fk}',
`name` = '{$name}',
`type` = '{$type}',
`address` = '{$address}',
`expire_date` = $expire_date,
`manage_type` = '{$manage_type}',
`owner_name` = '{$owner_name}',
`owner_tel` = '{$owner_tel}',
`owner_address` = '{$owner_address}',
`month_account_no` = '{$month_account_no}',
`month_account_bank` = '{$month_account_bank}',
`month_account_owner` = '{$month_account_owner}',
`util_account_no` = '{$util_account_no}',
`util_account_bank` = '{$util_account_bank}',
`util_account_owner` = '{$util_account_owner}',
`owner_account_no` = '{$owner_account_no}',
`owner_account_bank` = '{$owner_account_bank}',
`owner_account_owner` = '{$owner_account_owner}',
`rent_manager` = '{$rent_manager}',
`manage_pay_date` = '{$manage_pay_date}',
`note` = '{$note}',
`update_datetime` = NOW()
WHERE `no` = '{$no}'
";
$this->update($sql);
if($vip_fk!=0){
$sql="
UPDATE tbl_user
SET is_matched = 1
where no='{$vip_fk}'
";
$this->update($sql);
}
$vip=$this->req["current_vip"];
if($vip != $vip_fk){
$sql="
UPDATE tbl_user
SET is_matched=0
WHERE no='{$vip}'
";
$this->update($sql);
}
return $this->makeResultJson(1, "수정되었습니다.");
}
}
public function delBuilding()
{
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql="
SELECT vip_fk
FROM tbl_building
WHERE `no` IN({$noStr})
";
$result=$this->getArray($sql);
for($i=0;$i<sizeof($result); $i++){
$userStr = implode(',', $result[$i]);
}
$sql="
SELECT group_fk
FROM tbl_building
WHERE `no` IN({$noStr})
";
$result=$this->getArray($sql);
for($i=0;$i<sizeof($result); $i++){
$groupStr = implode(',', $result[$i]);
}
$sql="
UPDATE tbl_user
SET is_matched=0
WHERE `no` IN({$userStr})
";
$this->update($sql);
$sql="
UPDATE tbl_user_group
SET is_matched='N'
WHERE `no` IN({$groupStr})
";
$this->update($sql);
$sql = "
UPDATE tbl_building
SET status = 'N'
WHERE `no` IN({$noStr})
";
$this->update($sql);
}
public function saveRoom()
{
$no=$this->req["no"];
$building_fk=$this->req["building_fk"];
$name=$this->req["name"];
$manage_type=$this->req["manage_type"];
$pw=$this->req["pw"];
$contract_status=$this->req["contract_status"];
$contractor_name=$this->req["contractor_name"];
$contractor_tel=$this->req["contractor_tel"];
$contractor_car_no=$this->req["contractor_car_no"];
$contractor_account_no=$this->req["contractor_account_no"];
$contractor_account_bank=$this->req["contractor_account_bank"];
$contractor_account_owner=$this->req["contractor_account_owner"];
$contract_date=$this->req["contract_date"];
$contract_expire_date=$this->req["contract_expire_date"];
$move_in_date=$this->req["move_in_date"];
$deposit=$this->req["deposit"];
$balance=$this->req["balance"];
$payment_owner=$this->req["payment_owner"];
$monthly_rent=$this->req["monthly_rent"];
$maintenance_fee=$this->req["maintenance_fee"];
$cable=$this->req["cable"];
$internet=$this->req["internet"];
$rent_1=$this->req["rent_1"];
$rent_2=$this->req["rent_2"];
$etc=$this->req["etc"];
$monthly_rent_date=$this->req["monthly_rent_date"];
$payment_owner_date=$this->req["payment_owner_date"];
$electricity_check_date=$this->req["electricity_check_date"];
$gas_check_date=$this->req["gas_check_date"];
$water_check_date=$this->req["water_check_date"];
$billing_date=$this->req["billing_date"];
/*
$gas_charge=$this->req["gas_charge"];
$electricity_charge=$this->req["electricity_charge"];
$water_charge=$this->req["water_charge"];
$community_electricity_charge=$this->req["community_electricity_charge"];
$community_water_charge=$this->req["community_water_charge"];
*/
$entering_due_date=$this->req["entering_due_date"];
$leaving_due_date=$this->req["leaving_due_date"];
$special_contract=$this->req["special_contract"];
if($this->req["move_in_date"]==""){
$move_in_date = NULL;
}
$sql="
SELECT U.name
FROM tbl_user AS U
JOIN tbl_building AS B ON U.group_fk=B.group_fk
WHERE U.no='{$contractor_name}'
LIMIT 1
";
$result=$this->getRow($sql);
$user_fk=$contractor_name;
$contractor_name=$result["name"];
$contract_expire_date = !strlen($contract_expire_date)?"NULL":"'$contract_expire_date'";
$move_in_date = !strlen($move_in_date)?"NULL":"'$move_in_date'";
$contract_date = !strlen($contract_date)?"NULL":"'$contract_date'";
$entering_due_date = !strlen($entering_due_date)?"NULL":"'$entering_due_date'";
$leaving_due_date = !strlen($leaving_due_date)?"NULL":"'$leaving_due_date'";
$returnMessage = "" ;
if($no==""){
$sql="
INSERT INTO
tbl_room(building_fk, name, manage_type, pw, contract_status, contractor_name, contractor_tel,
contractor_car_no, contractor_account_no, contractor_account_bank,
contractor_account_owner, contract_date, contract_expire_date, move_in_date, deposit, balance, payment_owner,
monthly_rent, maintenance_fee, cable, internet, rent_1, rent_2, etc, monthly_rent_date, payment_owner_date,
electricity_check_date, gas_check_date, water_check_date, billing_date, entering_due_date, leaving_due_date,
special_contract, status, user_fk, insert_date)
VALUES
('{$building_fk}', '{$name}', '{$manage_type}', '{$pw}', '{$contract_status}', '{$contractor_name}', '{$contractor_tel}',
'{$contractor_car_no}', '{$contractor_account_no}', '{$contractor_account_bank}', '{$contractor_account_owner}', $contract_date,
$contract_expire_date, $move_in_date, '{$deposit}', '{$balance}', '{$payment_owner}', '{$monthly_rent}',
'{$maintenance_fee}', '{$cable}', '{$internet}', '{$rent_1}', '{$rent_2}', '{$etc}', '{$monthly_rent_date}',
'{$payment_owner_date}', '{$electricity_check_date}', '{$gas_check_date}', '{$water_check_date}', '{$billing_date}',
$entering_due_date,
$leaving_due_date, '{$special_contract}', 'Y', '{$user_fk}', NOW())
";
$this->update($sql);
$no = $this->mysql_insert_id() ;
if(!empty($user_fk)){
$sql="
UPDATE tbl_user
SET is_matched = 1
where no='{$user_fk}'
";
$this->update($sql);
}
$returnMessage = "저장되었습니다." ;
}
else{
$sql="
UPDATE tbl_room
SET
`building_fk`='{$building_fk}',
`name`='{$name}',
`manage_type`='{$manage_type}',
`pw`='{$pw}',
`contract_status`= '{$contract_status}',
`contractor_name`= '{$contractor_name}',
`contractor_tel`='{$contractor_tel}',
`contractor_car_no`='{$contractor_car_no}',
`contractor_account_no`='{$contractor_account_no}',
`contractor_account_bank`='{$contractor_account_bank}',
`contractor_account_owner`='{$contractor_account_owner}',
`contract_date`={$contract_date},
`contract_expire_date`={$contract_expire_date},
`move_in_date`={$move_in_date},
`deposit`='{$deposit}',
`balance`= '{$balance}',
`payment_owner`='{$payment_owner}',
`monthly_rent`='{$monthly_rent}',
`maintenance_fee`='{$maintenance_fee}',
`cable`='{$cable}',
`internet`='{$internet}',
`rent_1`='{$rent_1}',
`rent_2`='{$rent_2}',
`etc`='{$etc}',
`monthly_rent_date`='{$monthly_rent_date}',
`payment_owner_date`='{$payment_owner_date}',
`electricity_check_date`='{$electricity_check_date}',
`gas_check_date`='{$gas_check_date}',
`water_check_date`='{$water_check_date}',
`billing_date`='{$billing_date}',
`entering_due_date`={$entering_due_date},
`leaving_due_date`={$leaving_due_date},
`special_contract`='{$special_contract}',
`user_fk`='{$user_fk}'
WHERE `no` = '{$no}'
";
$this->update($sql);
if($user_fk!=0){
$sql="
UPDATE tbl_user
SET is_matched = 1
where no='{$user_fk}'
";
$this->update($sql);
}
$user_fk2=$this->req["current_contractor"];
if($user_fk != $user_fk2){
$sql="
UPDATE tbl_user
SET is_matched = 0
where no='{$user_fk2}'
";
$this->update($sql);
}
$returnMessage = "수정되었습니다." ;
}
$sql = "
INSERT INTO
tbl_room_history(no, building_fk, name, manage_type, pw, contract_status, contractor_name, contractor_tel,
contractor_car_no, contractor_account_no, contractor_account_bank,
contractor_account_owner, contract_date, contract_expire_date, move_in_date, deposit, balance, payment_owner,
monthly_rent, maintenance_fee, cable, internet, rent_1, rent_2, etc, monthly_rent_date, payment_owner_date,
electricity_check_date, gas_check_date, water_check_date, billing_date, entering_due_date, leaving_due_date,
special_contract, status, user_fk, insert_date, history_month)
SELECT
no, building_fk, name, manage_type, pw, contract_status, contractor_name, contractor_tel,
contractor_car_no, contractor_account_no, contractor_account_bank,
contractor_account_owner, contract_date, contract_expire_date, move_in_date, deposit, balance, payment_owner,
monthly_rent, maintenance_fee, cable, internet, rent_1, rent_2, etc, monthly_rent_date, payment_owner_date,
electricity_check_date, gas_check_date, water_check_date, billing_date, entering_due_date, leaving_due_date,
special_contract, status, user_fk, insert_date, NOW()
FROM tbl_room
WHERE `no` = '{$no}'
";
$this->update($sql);
return $this->makeResultJson(1, $returnMessage);
}
public function saveRequestCharge()
{
$no=$this->req["no"];
$building_name=$this->req["building_name"];
$room_name=$this->req["room_name"];
$request_date=$this->req["request_date"];
$handled_date=$this->req["handled_date"];
$charge=$this->req["charge"];
$info=$this->req["info"];
if($no==""){
$sql="
SELECT `R`.no
FROM tbl_room AS `R`
JOIN tbl_building AS `B` ON `R`.building_fk=`B`.no
WHERE `B`.name='{$building_name}' AND `R`.name='{$room_name}'
";
$result=$this->getRow($sql);
$room_fk=$result["no"];
$sql="
INSERT INTO
tbl_request_charge(`room_fk`, `building_name`, `room_name`, `request_date`, `handled_date`, `charge`, `info`, `status`)
VALUES('{$room_fk}', '{$building_name}', '{$room_name}','{$request_date}', '{$handled_date}', '{$charge}', '{$info}', 'Y')
";
$this->update($sql);
return $this->makeResultJson(1, "저장되었습니다");
}
else{
$sql="
UPDATE tbl_request_charge
SET
`building_name`='{$building_name}',
`room_name`='{$room_name}',
`request_date`='{$request_date}',
`handled_date`='{$handled_date}',
`charge`='{$charge}',
`info`='{$info}'
WHERE `no`='{$no}'
";
$this->update($sql);
return $this->makeResultJson(1, "수정되었습니다");
}
}
public function delRoom()
{
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql="
SELECT user_fk
FROM tbl_room
WHERE `no` IN({$noStr})
";
$result=$this->getArray($sql);
for($i=0;$i<sizeof($result); $i++){
$userStr = implode(',', $result[$i]);
}
$sql="
UPDATE tbl_user
SET is_matched=0
WHERE `no` IN({$userStr})
";
$this->update($sql);
$sql = "
UPDATE tbl_room
SET status = 'N'
WHERE `no` IN({$noStr})
";
$this->update($sql);
}
public function getInfoOfBill()
{
$no=$this->req["no"];
$sql="
SELECT electricity_check_date, gas_check_date, water_check_date, electricity_charge, gas_charge, water_charge, community_electricity_check_date, community_electricity_charge, community_water_check_date, community_water_charge
FROM tbl_bill_chunggu
WHERE room_fk = '{$no}'
ORDER BY no desc
LIMIT 1
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
public function getInfoOfBuilding()
{
$no = $this->req['no'];
if(empty($no)){
return array();
}
$select = '*';
$from = 'FROM tbl_building';
$where = "WHERE `no` = {$no}";
$sql = "SELECT {$select} {$from} {$where}";
$result = $this->getRow($sql);
//echo json_encode($result);
return $result;
}
public function getInfoOfRequstCharge()
{
$no=$this->req["no"];
$sql="
SELECT *
FROM tbl_request_charge
WHERE no='{$no}'
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
public function getInfoOfBuildingsRoom()
{
$no=$this->req["no"];
$month=date("m");
$sql=
"
SELECT
(SELECT COUNT(*) from tbl_room WHERE building_fk='{$no}' AND status='Y') AS room_cnt,
(SELECT COUNT(*) from tbl_room WHERE building_fk='{$no}' AND (contract_status='RD' OR contract_status='CE') AND status='Y') AS resident_cnt,
(SELECT COUNT(*) from tbl_room WHERE building_fk='{$no}' AND (contract_status='EP' OR contract_status='UC') AND status='Y') AS empty_cnt,
(SELECT COUNT(*) from tbl_room WHERE building_fk='{$no}' AND DATE_FORMAT(leaving_due_date, '%Y%m%d')>DATE_FORMAT(NOW(), '%Y%m%d') AND DATE_FORMAT(leaving_due_date, '%Y%m')=DATE_FORMAT(NOW(), '%Y%m') AND status='Y') AS leaving_cnt,
(SELECT COUNT(*) from tbl_room WHERE building_fk='{$no}' AND DATE_FORMAT(entering_due_date, '%Y%m%d')>DATE_FORMAT(NOW(), '%Y%m%d') AND DATE_FORMAT(entering_due_date, '%Y%m')=DATE_FORMAT(NOW(), '%Y%m') AND status='Y') AS entering_cnt
FROM
DUAL
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
public function getInfoOfPastBuildingsRoom($type)
{
$no=$this->req["no"];
$month=date("m");
if($type==1){
$sql=
"
SELECT
(
SELECT COUNT(DISTINCT no)
from tbl_room_history
WHERE building_fk='{$no}'
AND DATE_FORMAT(history_month, '%Y%m') <= DATE_FORMAT(NOW() - INTERVAL 1 MONTH, '%Y%m')
AND status='Y'
) AS room_cnt,
(
SELECT COUNT(*)
FROM
(
SELECT TEMP.*
FROM
(
SELECT *
FROM tbl_room_history
WHERE building_fk='{$no}'
AND DATE_FORMAT(history_month, '%Y%m') <= DATE_FORMAT(NOW() - INTERVAL 1 MONTH, '%Y%m')
AND STATUS='Y'
ORDER BY pno DESC
) TEMP
GROUP BY TEMP.no
) tmp
WHERE tmp.contract_status='EP' OR tmp.contract_status='UC'
) AS empty_cnt
FROM
DUAL
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
else if($type==2){
$sql="
SELECT
(
SELECT COUNT(DISTINCT no)
from tbl_room_history
WHERE building_fk='{$no}'
AND DATE_FORMAT(history_month, '%Y%m') <= DATE_FORMAT(NOW() - INTERVAL 2 MONTH, '%Y%m')
AND status='Y'
) AS room_cnt,
(
SELECT COUNT(*)
FROM
(
SELECT TEMP.*
FROM
(
SELECT *
FROM tbl_room_history
WHERE building_fk='{$no}'
AND DATE_FORMAT(history_month, '%Y%m') <= DATE_FORMAT(NOW() - INTERVAL 2 MONTH, '%Y%m')
AND STATUS='Y'
ORDER BY pno DESC
) TEMP
GROUP BY TEMP.no
) tmp
WHERE tmp.contract_status='EP' OR tmp.contract_status='UC'
) AS empty_cnt
FROM
DUAL
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
else if($type==3){
$sql="
SELECT
(
SELECT COUNT(DISTINCT no)
from tbl_room_history
WHERE building_fk='{$no}'
AND DATE_FORMAT(history_month, '%Y%m') <= DATE_FORMAT(NOW() - INTERVAL 3 MONTH, '%Y%m')
AND status='Y'
) AS room_cnt,
(
SELECT COUNT(*)
FROM
(
SELECT TEMP.*
FROM
(
SELECT *
FROM tbl_room_history
WHERE building_fk='{$no}'
AND DATE_FORMAT(history_month, '%Y%m') <= DATE_FORMAT(NOW() - INTERVAL 3 MONTH, '%Y%m')
AND STATUS='Y'
ORDER BY pno DESC
) TEMP
GROUP BY TEMP.no
) tmp
WHERE tmp.contract_status='EP' OR tmp.contract_status='UC'
) AS empty_cnt
FROM
DUAL
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
}
public function getInfoOfRoom(){
$no=$this->req['no'];
if(empty($no)){
return array();
}
$select = 'R.*';
$from = 'FROM tbl_room AS R ';
$where = "WHERE R.`no` = {$no}";
$sql = "SELECT {$select} {$from} {$where}";
$result = $this->getRow($sql);
//echo json_encode($result);
return $result;
}
public function getListOfVIPForBuilding(){
$sql="
SELECT no, name
FROM tbl_user
WHERE member_type='V' AND status='Y' AND is_matched = 0
";
$result=$this->getArray($sql);
// echo json_encode($result);
return $result;
}
public function getListOfGroupForBuilding(){
$sql="
SELECT no, name
FROM tbl_user_group
WHERE is_matched = 'N' AND status='Y'
";
$result=$this->getArray($sql);
//echo json_encode($result);
return $result;
}
public function getListOfUserForRoom(){
$no=$this->req['Bno'];
if(empty($no)){
return array();
}
$select='group_fk';
$from = 'FROM tbl_building';
$where = "WHERE no = {$no}";
$sql = "SELECT {$select} {$from} {$where}";
$result=$this->getRow($sql);
$group_fk=$result["group_fk"];
$sql="
SELECT U.no, U.name
FROM tbl_user AS U
WHERE U.group_fk='{$group_fk}' AND U.status='Y' AND U.member_type = 'M' AND U.is_matched = 0
";
$result=$this->getArray($sql);
//echo json_encode($result);
return $result;
}
public function getListOfBuilding(){
$search_text = $this->req["search_text"];
$login_type = $this->admUser["admin_type"];
$target_fk = $this->admUser["target_fk"];
$manage_type = $this->req["manage_type"];
$expire_date= $this->req["expire_date"];
//최초 페이지 설정
$this->initPage();
$where = 'WHERE `B`.`status` = "Y"';
if(($login_type == "2" || $login_type == "3") && $target_fk != ""){
$where .= " AND `B`.`group_fk` = '{$target_fk}' ";
}
if(!empty($search_text)){
switch($search_text){
case "원룸" : $where .= " AND `B`.`type` = 'SG'";
break;
case "오피스텔" : $where .= " AND `B`.`type` = 'OF'";
break;
case "도생" : $where .= " AND `B`.`type` = 'UB'";
break;
case "아파트" : $where .= " AND `B`.`type` = 'AP'";
break;
case "주택" : $where .= " AND `B`.`type` = 'HS'";
break;
case "기타" : $where .= " AND `B`.`type` = 'ET'";
break;
default :
$where .= "
AND (
`G`.`name` LIKE '%{$search_text}%'
OR `B`.`name` LIKE '%{$search_text}%'
OR `B`.`address` LIKE '%{$search_text}%'
OR `B`.`owner_name` LIKE '%{$search_text}%'
OR `B`.`owner_tel` LIKE '%{$search_text}%'
) ";
break;
}
}
if(!empty($manage_type)){
$where.=" AND `B`.`manage_type`='{$manage_type}'";
}
if(!empty($expire_date)){
$where .= " AND `B`.`expire_date` = '{$expire_date}'";
}
$select = '`B`.`no`, `B`.`name`, `B`.`manage_type`, `B`.`type`, `B`.`owner_name`, `B`.`address`, `B`.`owner_tel`, DATE(`B`.`expire_date`) AS `expire_date`';
$from = 'FROM tbl_building AS B LEFT JOIN tbl_user_group AS G ON `B`.`group_fk` = `G`.`no`';
$sql = "SELECT COUNT(*) AS rn {$from} {$where}";
$this->rownum = $this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum);
$limit = " LIMIT {$this->startNum}, {$this->endNum} ; ";
$where .= "ORDER BY `B`.`no` DESC";
$sql = "SELECT {$select} {$from} {$where} {$limit}";
$result = $this->getArray($sql);
return $result;
}
public function getListOfBuildingForRequest(){
$search_text = $this->req["search_text"];
$login_type = $this->admUser["admin_type"];
$target_fk = $this->admUser["target_fk"];
//최초 페이지 설정
$this->initPage();
$where = 'WHERE `B`.`status` = "Y"';
if(($login_type == "2" || $login_type == "3") && $target_fk != ""){
$where .= " AND `B`.`group_fk` = '{$target_fk}' ";
}
if(!empty($search_text)){
$where .= " AND (
`G`.`name` LIKE '%{$search_text}%'
OR `B`.`name` LIKE '%{$search_text}%'
OR `B`.`address` LIKE '%{$search_text}%'
OR `B`.`rent_manager` LIKE '%{$search_text}%'
OR `B`.`owner_tel` LIKE '%{$search_text}%'
) ";
}
$select = '`B`.`no`, `B`.`name`, `B`.`manage_type`, `B`.`type`, `B`.`owner_name`, `B`.`address`, `B`.`owner_tel`, `B`.`expire_date`';
$from = 'FROM tbl_building AS B LEFT JOIN tbl_user_group AS G ON `B`.`group_fk` = `G`.`no`';
$sql = "SELECT COUNT(*) AS rn {$from} {$where}";
$this->rownum = $this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum);
$limit = " LIMIT 0, 99999 ; ";
$sql = "SELECT {$select} {$from} {$where} {$limit}";
$result = $this->getArray($sql);
return $result;
}
public function getListOfRoom()
{
$building_fk=$_REQUEST["no"];
$search_text=$this->req["search_text"];
$in_date=$this->req["in_date"];
$expire_date=$this->req["expire_date"];
$search_type=$this->req["search_type"];
$this->initPage();
$where="WHERE `R`.`status`='Y' AND `R`.`building_fk`= '$building_fk'";
if(!empty($search_type)){
if($search_type=="RD" || $search_type=="EP" || $search_type=="UC" || $search_type=="CE"){
$where .= "AND `R`.`contract_status` = '{$search_type}'";
}
if($search_type=="LV"){
$where .= "AND YEAR(`R`.`leaving_due_date`) = YEAR(NOW()) AND MONTH(`R`.`leaving_due_date`) = MONTH(NOW())";
}
if($search_type=="ET"){
$where .= "AND YEAR(`R`.`entering_due_date`) = YEAR(NOW()) AND MONTH(`R`.`entering_due_date`) = MONTH(NOW())";
}
}
if(!empty($search_text)){
$where .= " AND (
`R`.`name` LIKE '%{$search_text}%'
OR `R`.`contractor_name` LIKE '%{$search_text}%'
OR `R`.`contractor_tel` LIKE '%{$search_text}%'
OR `R`.`contractor_car_no` LIKE '%{$search_text}%')";
}
if(!empty($in_date)) $where .= " AND (`R`.`move_in_date` LIKE '%{$in_date}%')";
if(!empty($expire_date)) $where .= " AND (`R`.`contract_expire_date` LIKE '%{$expire_date}%')";
$select='`R`.`no`, `R`.`name`, `R`.`manage_type`, `R`.`contractor_name`, `R`.`contractor_tel`, `R`.`contract_status`, DATE(`R`.`contract_date`) AS contract_date, DATE(`R`.`move_in_date`) AS move_in_date, DATE(`R`.`contract_expire_date`) AS contract_expire_date, `R`.`contractor_car_no`';
$from='FROM tbl_room AS R JOIN tbl_building AS B ON `R`.`building_fk` = `B`.`no`';
$sql = "SELECT COUNT(*) AS rn {$from} {$where}";
$this->rownum = $this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum);
$limit = " LIMIT {$this->startNum}, {$this->endNum} ; ";
$sql = "SELECT {$select} {$from} {$where} ORDER BY no DESC {$limit}";
$result = $this->getArray($sql);
return $result;
}
public function getListOfRoomForChargeSend()
{
$building_fk=$_REQUEST["no"];
$sql="
SELECT no, name
FROM tbl_room
WHERE building_fk='{$building_fk}'
";
$result=$this->getArray($sql);
return json_encode($result);
}
public function getListOfVacancyForExcel($search_text, $manage_type)
{
$where="WHERE `B`.`status`='Y'";
$where2 = " WHERE `Q`.vacancy_rate LIKE '%{$search_text}%'";
$select="
`B`.`no`,
`G`.`name`,
`B`.`manage_type`,
`G`.`manager_name`,
`B`.`address`,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no`) AS room_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND (contract_status='RD' OR contract_status='CE') AND status='Y') AS resident_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND (contract_status='EP' OR contract_status='UC') AND status='Y') AS empty_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND MONTH(leaving_due_date)=MONTH(NOW()) AND YEAR(leaving_due_date)=YEAR(NOW())) AS leaving_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND MONTH(entering_due_date)=MONTH(NOW()) AND YEAR(leaving_due_date)=YEAR(NOW())) AS entering_cnt,
(SELECT (room_cnt - resident_cnt + entering_cnt)/room_cnt)*100 AS vacancy_rate
";
$from=" FROM tbl_building AS `B` JOIN tbl_user_group AS `G` ON `B`.`group_fk`=`G`.`no`";
if(!empty($search_text)){
$where2.=" WHERE `Q`.vacancy_rate LIKE '%{$search_text}%' OR `name` LIKE '%{$search_text}%' OR `manager_name` LIKE '%{$search_text}%' OR `address` LIKE '%{$search_text}%'";
}
if(!empty($manage_type)){
$where.=" AND `B`.`manage_type`='{$manage_type}'";
}
$this->initPage();
$sql="SELECT COUNT(*) AS rn FROM (SELECT {$select} {$from} {$where}) AS `Q` {$where2}";
$this->rownum =$this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum);
$limit = " LIMIT 0, 999999 ; ";
$sql="SELECT * FROM (SELECT {$select} {$from} {$where}) AS `Q` {$where2} ORDER BY no DESC {$limit}";
$result=$this->getArray($sql);
return $result;
}
public function getListOfVacancy()
{
$search_text=$this->req["search_text"];
$manage_type=$this->req["manage_type"];
$where="WHERE `B`.`status`='Y'";
$where2 = "";
$select="
`B`.`no`,
`G`.`name`,
`B`.`manage_type`,
`G`.`manager_name`,
`B`.`address`,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND status='Y') AS room_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND (contract_status='RD' OR contract_status='CE') AND status='Y') AS resident_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND (contract_status='EP' OR contract_status='UC') AND status='Y') AS empty_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND MONTH(leaving_due_date)=MONTH(NOW()) AND YEAR(leaving_due_date)=YEAR(NOW())) AS leaving_cnt,
(SELECT COUNT(*) FROM tbl_room WHERE building_fk=`B`.`no` AND MONTH(entering_due_date)=MONTH(NOW()) AND YEAR(leaving_due_date)=YEAR(NOW())) AS entering_cnt,
(SELECT (room_cnt - resident_cnt + entering_cnt)/room_cnt)*100 AS vacancy_rate
";
$from=" FROM tbl_building AS `B` JOIN tbl_user_group AS `G` ON `B`.`group_fk`=`G`.`no`";
if(!empty($search_text)){
$where2.=" WHERE `Q`.vacancy_rate LIKE '%{$search_text}%' OR `name` LIKE '%{$search_text}%' OR `manager_name` LIKE '%{$search_text}%' OR `address` LIKE '%{$search_text}%'";
}
if(!empty($manage_type)){
$where.=" AND `B`.`manage_type`='{$manage_type}'";
}
$this->initPage();
$sql="SELECT COUNT(*) AS rn FROM (SELECT {$select} {$from} {$where}) AS `Q` {$where2}";
$this->rownum =$this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum);
$limit = " LIMIT {$this->startNum}, {$this->endNum} ; ";
$sql="SELECT * FROM (SELECT {$select} {$from} {$where}) AS `Q` {$where2} ORDER BY no DESC {$limit}";
$result=$this->getArray($sql);
//echo json_encode($result);
return $result;
}
public function getListOfRequestCharge()
{
$where="WHERE status='Y'";
$search_text=$this->req["search_text"];
$request_date=$this->req["request_date"];
$handled_date=$this->req["handled_date"];
if(!empty($search_text)){
$where.=" AND building_name LIKE '%{$search_text}%' OR room_name LIKE '%{$search_text}%' OR info LIKE '%{$search_text}%'";
}
if(!empty($request_date)){
$where.=" AND request_date LIKE '%{$request_date}%'";
}
if(!empty($handled_date)){
$where.=" AND handled_date LIKE '%{$handled_date}%'";
}
$this->initPage();
$sql="
SELECT COUNT(*) as rn
FROM tbl_request_charge
{$where}
";
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit = " LIMIT {$this->startNum}, {$this->endNum} ; ";
$where.="ORDER BY `no` DESC";
$sql="
SELECT *
FROM tbl_request_charge
{$where}
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
public function getListOfRequestChargeForExcel()
{
$where="WHERE status='Y'";
$search_text=$this->req["search_text"];
$request_date=$this->req["request_date"];
$handled_date=$this->req["handled_date"];
if(!empty($search_text)){
$where.=" AND building_name LIKE '%{$search_text}%' OR room_name LIKE '%{$search_text}%' OR info LIKE '%{$search_text}%'";
}
if(!empty($request_date)){
$where.=" AND request_date LIKE '%{$request_date}%'";
}
if(!empty($handled_date)){
$where.=" AND handled_date LIKE '%{$handled_date}%'";
}
$this->initPage();
$sql="
SELECT COUNT(*) as rn
FROM tbl_request_charge
{$where}
";
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit = " LIMIT 0, 999999 ; ";
$sql="
SELECT *
FROM tbl_request_charge
{$where}
ORDER BY no DESC
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
public function getListOfUser($member_type = "", $target_fk = "")
{
$search_text = $this->req["search_text"];
$login_type = $this->admUser["admin_type"];
$where = " WHERE status = 'Y' ";
if(($login_type == "2" || $login_type == "3") && $target_fk != "")
{
$where .= " AND group_fk = '{$target_fk}' ";
}
if($member_type == "M")
{
$where .= " AND U.member_type = '{$member_type}' ";
// add all type
//$addSelect .= " , IFNULL((SELECT G.name FROM tbl_user_group G WHERE G.no = U.group_fk AND G.status = 'Y' LIMIT 1), '') AS group_name ";
}
if($search_text != "")
$where .= " AND ((U.id LIKE '%{$search_text}%' AND U.regi_type = 'E') OR U.tel LIKE '%{$search_text}%' OR U.name LIKE '%{$search_text}%' )";
if($this->req["page"] != "-1")
{
//최초 페이지 설정
$this->initPage() ;
$sql = "
SELECT COUNT(*) AS rn
FROM tbl_user U
{$where}
";
$this->rownum = $this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum) ;
$limit = " LIMIT {$this->startNum}, {$this->endNum} ; ";
}
$sql = "
SELECT
U.*
{$addSelect}
FROM tbl_user U
{$where}
ORDER BY U.no DESC
{$limit}
";
$result = $this->getArray($sql);
return $result;
}
}
}
?>
\ No newline at end of file
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;?>
<?
/*
* Admin process
* add by dev.lee
* */
if(!class_exists("AdminStats")){
class AdminStats extends AdminBase {
function __construct($req)
{
parent::__construct($req);
}
/**
* 일별 통계실 필요한 월 일 데이터
* @param unknown $year
* @param unknown $month
*/
function getMonthDayListData($year, $month)
{
$sql = "
SELECT *
FROM tbl_stats_date SD
WHERE SD.year = '{$year}' AND SD.month = '{$month}'
ORDER BY SD.date ASC
";
$result = $this->getArray($sql);
return $result;
}
/**
* 마이포인트 통계
*/
function getListOfPointStatsForUser()
{
$year = $this->req["year"] == "" ? date("Y", time()) : $this->req["year"];
$month = $this->req["month"] == "" ? date("n", time()) : $this->req["month"];
$sql = "
SELECT
SD.date
, IFNULL(SUM(CASE WHEN PT.pay_type = '{$this->PAY_TYPE_ADMIN}' AND PT.trans_type = 'I' THEN PT.amt ELSE 0 END), 0) AS input_point
, IFNULL(SUM(CASE WHEN PT.pay_type = '{$this->PAY_TYPE_USE}' AND PT.trans_type = 'O' THEN PT.amt ELSE 0 END), 0) AS output_point
FROM tbl_stats_date SD
LEFT JOIN tbl_point_trans PT ON(SD.date = PT.reg_date AND PT.pay_type != '{$this->PAY_TYPE_RETRIEVE}')
WHERE SD.year = '{$year}' AND SD.month = '{$month}'
GROUP BY SD.date
ORDER BY SD.date ASC
";
$result = $this->getArray($sql);
return $result;
}
/**
* 통계 정보 조회
* @return unknown[][]|mixed[][]
*/
function getGroupPointStatsData()
{
$year = $this->req["year"] == "" ? date("Y", time()) : $this->req["year"];
$pointArr = Array();
$where = " WHERE G.status = 'Y' ";
$subWhere = " WHERE PT.pay_type != '{$this->PAY_TYPE_RETRIEVE}' AND PT.group_fk > 0 AND YEAR(PT.reg_date) = '{$year}' ";
if($this->admUser["admin_type"] == "2")
{
$where .= " AND G.no = '{$this->admUser["target_fk"]}' ";
$subWhere .= " AND PT.group_fk = '{$this->admUser["target_fk"]}'";
}
$sql = "
SELECT
P.month, P.input_point, P.output_point, G.name AS group_name, G.no AS group_fk
, IFNULL((SELECT A.admin_name FROM tbl_admin A WHERE A.target_fk = G.no AND A.admin_type = '2' AND A.is_apply = 1 LIMIT 1), '-') AS manager_name
FROM tbl_user_group G
LEFT JOIN (
SELECT
PT.group_fk
, MONTH(PT.reg_date) AS `month`
, IFNULL(SUM(CASE WHEN PT.pay_type = '{$this->PAY_TYPE_ADMIN}' AND PT.trans_type = 'I' THEN PT.amt ELSE 0 END), 0) AS input_point
, IFNULL(SUM(CASE WHEN PT.pay_type = '{$this->PAY_TYPE_USE}' AND PT.trans_type = 'O' THEN PT.amt ELSE 0 END), 0) AS output_point
FROM tbl_point_trans PT
{$subWhere}
GROUP BY PT.group_fk, `month`
ORDER BY PT.group_fk ASC, `month` ASC
) P ON(P.group_fk = G.no)
{$where}
";
$result = $this->getArray($sql);
$monthIndex = 0;
$tmp_group_fk = "0";
$groupData = Array();
for($i=0; $i<sizeof($result); $i++)
{
if($result[$i]["group_fk"] != $tmp_group_fk)
{
if($i > 0)
$pointArr[] = $groupData;
$monthIndex = 1;
$tmp_group_fk = $result[$i]["group_fk"];
$groupData = Array(
"group_fk" => $result[$i]["group_fk"],
"group_name" => $result[$i]["group_name"],
"manager_name" => $result[$i]["manager_name"],
"list" => Array()
);
}
$groupData["list"][$result[$i]["month"]] = Array("input_point" => $result[$i]["input_point"], "output_point" => $result[$i]["output_point"]);
}
$pointArr[] = $groupData;
return $pointArr;
}
/**
* 상점별 통계
* @return unknown[][]|mixed[][]
*/
function getShopPointStatsData()
{
$year = $this->req["year"] == "" ? date("Y", time()) : $this->req["year"];
$pointArr = Array();
$where = " WHERE S.status = 'Y' ";
$subWhere = " WHERE PT.trans_type = 'O' AND PT.pay_type = '{$this->PAY_TYPE_USE}' AND PT.shop_fk > 0 AND YEAR(PT.reg_date) = '{$year}' ";
if($this->admUser["admin_type"] == "3")
{
$where .= " AND S.no = '{$this->admUser["target_fk"]}' ";
$subWhere .= " AND PT.shop_fk = '{$this->admUser["target_fk"]}'";
}
$sql = "
SELECT
P.month, P.output_point, S.name AS shop_name, S.no AS shop_fk
, IFNULL((SELECT A.admin_name FROM tbl_admin A WHERE A.target_fk = S.no AND A.admin_type = '3' AND A.is_apply = 1 LIMIT 1), '-') AS manager_name
FROM tbl_shop S
LEFT JOIN (
SELECT
PT.shop_fk
, MONTH(PT.reg_date) AS `month`
, IFNULL(SUM(PT.amt), 0) AS output_point
FROM tbl_point_trans PT
{$subWhere}
GROUP BY PT.shop_fk, `month`
ORDER BY PT.shop_fk ASC, `month` ASC
) P ON(P.shop_fk = S.no)
{$where}
";
$result = $this->getArray($sql);
$monthIndex = 0;
$tmp_shop_fk = "0";
$shopData = Array();
for($i=0; $i<sizeof($result); $i++)
{
if($result[$i]["shop_fk"] != $tmp_shop_fk)
{
if($i > 0)
$pointArr[] = $shopData;
$monthIndex = 1;
$tmp_shop_fk = $result[$i]["shop_fk"];
$shopData = Array(
"shop_fk" => $result[$i]["shop_fk"],
"shop_name" => $result[$i]["shop_name"],
"manager_name" => $result[$i]["manager_name"],
"list" => Array()
);
}
$shopData["list"][$result[$i]["month"]] = $result[$i]["output_point"];
}
$pointArr[] = $shopData;
return $pointArr;
}
/**
* 그룹별 상점 통계
* @return unknown[][]|mixed[][]
*/
function getShopPointStatsDataForGroup()
{
$no = $this->req["no"];
$year = $this->req["year"] == "" ? date("Y", time()) : $this->req["year"];
$month = $this->req["month"] == "" ? date("n", time()) : $this->req["month"];
$pointArr = Array();
$sql = "
SELECT G.no AS group_fk, G.name AS group_name, SD.date, IFNULL(SUM(PT.amt), 0) AS output_point
FROM
(
SELECT *
FROM tbl_user_group G
WHERE G.no IN(
SELECT T.group_fk
FROM tbl_point_trans T
WHERE T.shop_fk = '{$no}' AND T.trans_type = 'O' AND T.pay_type = 'use' AND YEAR(T.reg_date) = '{$year}' AND MONTH(T.reg_date) = '{$month}'
GROUP BY T.group_fk
)
) G
JOIN tbl_stats_date SD ON (SD.year = '{$year}' AND SD.month = '{$month}')
LEFT JOIN tbl_point_trans PT ON(PT.shop_fk = '{$no}' AND PT.trans_type = 'O' AND PT.pay_type = 'use' AND SD.date = PT.reg_date AND G.no = PT.group_fk)
GROUP BY G.no, SD.date
ORDER BY G.no ASC, SD.date ASC
";
$result = $this->getArray($sql);
$monthIndex = 0;
$tmp_group_fk = "0";
$groupData = Array();
for($i=0; $i<sizeof($result); $i++)
{
if($result[$i]["group_fk"] != $tmp_group_fk)
{
if($i > 0)
$pointArr[] = $groupData;
$monthIndex = 1;
$tmp_group_fk = $result[$i]["group_fk"];
$groupData = Array(
"group_fk" => $result[$i]["group_fk"],
"group_name" => $result[$i]["group_name"],
"total_point" => 0,
"list" => Array()
);
}
$groupData["list"][$result[$i]["date"]] = $result[$i]["output_point"];
$groupData["total_point"] += $result[$i]["output_point"];
}
$pointArr[] = $groupData;
return $pointArr;
}
/**
* 상점 통계 회원별
* @return mixed[][]
*/
function getShopPointStatsDataForUser()
{
$no = $this->req["no"];
$year = $this->req["year"] == "" ? date("Y", time()) : $this->req["year"];
$month = $this->req["month"] == "" ? date("n", time()) : $this->req["month"];
$pointArr = Array();
$sql = "
SELECT
U.no AS user_fk, U.name AS user_name, SD.date, IFNULL(SUM(PT.amt), 0) AS output_point
FROM
(
SELECT *
FROM tbl_user U
WHERE U.no IN(
SELECT T.user_fk
FROM tbl_point_trans T
WHERE T.shop_fk = '{$no}' AND T.trans_type = 'O' AND T.pay_type = 'use' AND YEAR(T.reg_date) = '{$year}' AND MONTH(T.reg_date) = '{$month}'
GROUP BY T.user_fk
)
) U
JOIN tbl_stats_date SD ON (SD.year = '{$year}' AND SD.month = '{$month}')
LEFT JOIN tbl_point_trans PT ON(PT.shop_fk = '{$no}' AND PT.trans_type = 'O' AND PT.pay_type = 'use' AND SD.date = PT.reg_date AND U.no = PT.user_fk)
GROUP BY U.no, SD.date
ORDER BY U.no ASC, SD.date ASC
";
$result = $this->getArray($sql);
$tmp_user_fk = "0";
$groupData = Array();
for($i=0; $i<sizeof($result); $i++)
{
if($result[$i]["user_fk"] != $tmp_user_fk)
{
if($i > 0)
$pointArr[] = $groupData;
$monthIndex = 1;
$tmp_user_fk = $result[$i]["user_fk"];
$groupData = Array(
"user_fk" => $result[$i]["user_fk"],
"user_name" => $result[$i]["user_name"],
"total_point" => 0,
"list" => Array()
);
}
$groupData["list"][$result[$i]["date"]] = $result[$i]["output_point"];
$groupData["total_point"] += $result[$i]["output_point"];
}
$pointArr[] = $groupData;
return $pointArr;
}
} // class end
}
?>
\ No newline at end of file
......@@ -272,48 +272,52 @@ if(!class_exists("AdminUser")){
// 회원 리스트
function getListOfUser($member_type = "", $vip_status = 0)
function getListOfUser()
{
$search_text = $this->req["search_text"];
$login_type = $this->admUser["admin_type"];
$target_fk = $this->admUser["target_fk"];
$searchText = $this->req["searchText"];
$searchType = $this->req["searchType"];
$where = " WHERE status = 'Y' ";
$where = " WHERE status = 1 AND userType=1";
if($login_type != "1")
{
$where .= " AND group_fk = '{$target_fk}' ";
if($searchType == "userName"){
$where.=" AND userName LIKE '%{$searchText}%'";
}
$addSelect = "";
$addSelect .= " , IFNULL((SELECT G.name FROM tbl_user_group G WHERE G.no = U.group_fk AND G.status = 'Y' LIMIT 1), '') AS group_name ";
if($member_type == "M")
{
$where .= " AND U.member_type = '{$member_type}' ";
// add all type
//$addSelect .= " , IFNULL((SELECT G.name FROM tbl_user_group G WHERE G.no = U.group_fk AND G.status = 'Y' LIMIT 1), '') AS group_name ";
if($searchType == "userID"){
$where.=" AND userID LIKE '%{$searchText}%'";
}
if($member_type == "V")
{
$where .= " AND (U.member_type = '{$member_type}' OR U.member_type = 'VH') ";
// add all type
//$addSelect .= " , IFNULL((SELECT G.name FROM tbl_user_group G WHERE G.no = U.group_fk AND G.status = 'Y' LIMIT 1), '') AS group_name ";
if($searchType == "nickName"){
$where.=" AND nickName LIKE '%{$searchText}%'";
}
if($vip_status == 1){
$where .= "AND U.vip_status = {$vip_status} ";
if($searchType == "userVehicleType"){
switch($searchText){
case "현대":
$searchText="HY";
break;
case "대우":
$searchText="DW";
break;
case "볼보":
$searchText="VV";
break;
case "스카니아":
$searchText="SC";
break;
case "벤츠":
$searchText="MB";
break;
case "만":
$searchText="MA";
break;
}
$where.=" AND userVehicleType LIKE '%{$searchText}%'";
}
if($search_text != ""){
$where .= " AND ((U.id LIKE '%{$search_text}%' AND U.regi_type = 'E') OR U.tel LIKE '%{$search_text}%' OR U.name LIKE '%{$search_text}%' ) ";
if($searchText=="" && $searchType != ""){
$where.=" AND userNo=0";
}
if($this->req["page"] != "-1")
{
......@@ -322,7 +326,7 @@ if(!class_exists("AdminUser")){
$sql = "
SELECT COUNT(*) AS rn
FROM tbl_user U
FROM tblUser U
{$where}
";
......@@ -337,10 +341,9 @@ if(!class_exists("AdminUser")){
$sql = "
SELECT
U.*
{$addSelect}
FROM tbl_user U
FROM tblUser U
{$where}
ORDER BY U.no DESC
ORDER BY U.regDate DESC
{$limit}
";
......@@ -350,6 +353,176 @@ if(!class_exists("AdminUser")){
return $result;
}
function getListOfManager(){
$searchText = $this->req["searchText"];
$searchType=$this->req["searchType"];
$login_type = $this->admUser["admin_type"];
$target_fk = $this->admUser["target_fk"];
$where = " WHERE status = 1 AND userType=2";
if($searchType == "userName"){
$where.=" AND userName LIKE '%{$searchText}%'";
}
if($searchType == "userID"){
$where.=" AND userID LIKE '%{$searchText}%'";
}
if($searchType == "nickName"){
$where.=" AND nickName LIKE '%{$searchText}%'";
}
if($searchText=="" && $searchType != ""){
$where.=" AND userNo=0";
}
if($this->req["page"] != "-1")
{
//최초 페이지 설정
$this->initPage() ;
$sql = "
SELECT COUNT(*) AS rn
FROM tblUser U
{$where}
";
$this->rownum = $this->getValue($sql, 'rn');
//총 로우수를 획득후 페이지 최종 설정
$this->setPage($this->rownum) ;
$limit = " LIMIT {$this->startNum}, {$this->endNum} ; ";
}
$sql = "
SELECT
U.*
FROM tblUser U
{$where}
ORDER BY U.regDate DESC
{$limit}
";
$result = $this->getArray($sql);
//echo json_encode($result);
return $result;
}
function initializePwd(){
$userNo=$this->req["userNo"];
$sql="
UPDATE tblUser
SET userPwd=md5('abc123')
WHERE userNo='{$userNo}'
";
$this->update($sql);
return $this->makeResultJson(1, "초기화 되었습니다");
}
function checkIDRedundancy(){
$userID=$this->req["userID"];
$sql="
SELECT *
FROM tblUser
WHERE userID='{$userID}' AND status=1
LIMIT 0, 1
";
$result=$this->getRow($sql);
if($result != null)
return $this->makeResultJson(-100, "사용할 수 없는 아이디 입니다");
else
return $this->makeResultJson(1, "사용할 수 있는 아이디 입니다");
}
function checkNickRedundancy(){
$nickName=$this->req["nickName"];
$sql="
SELECT *
FROM tblUser
WHERE nickName='{$nickName}' AND status=1
LIMIT 0, 1
";
$result=$this->getRow($sql);
if($result != null)
return $this->makeResultJson(-100, "사용할 수 없는 닉네임 입니다");
else
return $this->makeResultJson(1, "사용할 수 있는 닉네임 입니다");
}
function saveManager(){
$userNo=$this->req["userNo"];
$userID=$this->req["userID"];
$userPwd=md5($this->req["userPwd"]);
$userName=$this->req["userName"];
$nickName=$this->req["nickName"];
$userTel1=$this->req["userTel1"];
$userTel2=$this->req["userTel2"];
$userTel3=$this->req["userTel3"];
$userTel=$userTel1.$userTel2.$userTel3;
$sql="
SELECT *
FROM tblUser
WHERE userID='{$userID}' AND status=1
LIMIT 0, 1
";
$result=$this->getRow($sql);
if($result != null)
return $this->makeResultJson(-100, "사용할 수 없는 아이디 입니다");
$sql="
SELECT *
FROM tblUser
WHERE nickName='{$nickName}' AND status=1
LIMIT 0, 1
";
$result=$this->getRow($sql);
if($result != null)
return $this->makeResultJson(-100, "사용할 수 없는 닉네임 입니다");
$sql="
INSERT INTO `tblUser`
(`userNo`,
`userType`,
`userID`,
`userPwd`,
`userName`,
`nickName`,
`userTel`,
`push`,
`status`,
`regDate`)
VALUES
('{$userNo}',
2,
'{$userID}',
'{$userPwd}',
'{$userName}',
'{$nickName}',
'{$userTel}',
1,
1,
NOW());
";
$this->update($sql);
return $this->makeResultJson(1, "등록되었습니다");
}
function getListOfUserForExcel($member_type = "")
{
$search_text = $this->req["search_text"];
......@@ -502,53 +675,11 @@ if(!class_exists("AdminUser")){
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql="
SELECT no
FROM tbl_building
WHERE `vip_fk` IN({$noStr}) AND `status` = 'Y'
";
$result=$this->getArray($sql);
for($i=0;$i<sizeof($result); $i++){
$vipStr = implode(',', $result[$i]);
}
$sql="
SELECT no
FROM tbl_room
WHERE `user_fk` IN({$noStr}) AND `status` = 'Y'
";
$result=$this->getArray($sql);
for($i=0;$i<sizeof($result); $i++){
$userStr = implode(',', $result[$i]);
}
if(!empty($vipStr)){
$sql="
UPDATE tbl_building
SET vip_fk = 0, owner_name = NULL
WHERE `no` IN({$vipStr})
";
$this->update($sql);
}
if(!empty($userStr)){
$sql="
UPDATE tbl_room
SET user_fk = 0, contractor_name = NULL
WHERE `no` IN({$userStr})
";
$this->update($sql);
}
$sql = "
UPDATE tbl_user
SET status = 'N'
WHERE `no` IN({$noStr})
UPDATE tblUser
SET status = 0
WHERE `userNo` IN({$noStr})
";
$this->update($sql);
}
......
......@@ -16,8 +16,9 @@ if (! class_exists("ApiBoard"))
function getListOfNotice(){
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblNotice
WHERE status=1
ORDER BY noticeNo DESC
";
......@@ -28,6 +29,7 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT *
FROM tblNotice
WHERE status=1
ORDER BY noticeNo DESC
";
......@@ -52,8 +54,9 @@ if (! class_exists("ApiBoard"))
//이벤트 리스트
function getListOfEvent(){
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblEvent
WHERE status=1
ORDER BY eventNo DESC
";
$this->rownum=$this->getValue($sql, "rn");
......@@ -63,6 +66,7 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT *
FROM tblEvent
WHERE status=1
ORDER BY eventNo DESC
";
$result=$this->getArray($sql);
......@@ -100,13 +104,15 @@ if (! class_exists("ApiBoard"))
}
function getListCountBoard(){
$sql="SELECT COUNT(*) FROM tblBoard WHERE status=1";
$sql="SELECT COUNT(*) AS rn FROM tblBoard WHERE status=1";
$result=$this->getValue($sql, "rn");
return $this->makeResultJson("1", "", $result);
}
function getListCountCS(){
$sql="SELECT COUNT(*) FROM tblCustomerService WHERE status=1";
$sql="SELECT COUNT(*) AS rn FROM tblCustomerService WHERE status=1";
$result=$this->getValue($sql, "rn");
return $this->makeResultJson("1", "", $result);
}
......@@ -168,14 +174,15 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblBoard B
JOIN tblUser U ON B.userFk=U.userNo
{$where}
ORDER BY boardNo DESC
";
$this->rownum = $this->getValue($sql, "rn");
$this->initPage();
$this->rownum = $this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
$sql="
......@@ -369,14 +376,15 @@ if (! class_exists("ApiBoard"))
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblCustomerService CS
JOIN tblUser U ON CS.userFk=U.userNo
WHERE CS.status=1
ORDER BY csNo DESC
";
$this->rownum = $this->getValue($sql, "rn");
$this->initPage();
$this->rownum = $this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
$sql="
......@@ -449,13 +457,14 @@ if (! class_exists("ApiBoard"))
}
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblCompany
{$where}
ORDER BY companyNo DESC
";
$this->rownum=$this->getValue($sql, "rn");
$this->initPage();
$this->rownum=$this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
$sql="
......@@ -773,13 +782,14 @@ if (! class_exists("ApiBoard"))
$userFk=1;
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblProductionSpec
WHERE userFk='{$userFk}' AND status=1
ORDER BY productionNo DESC
";
$this->rownum=$this->getValue($sql, "rn");
$this->initPage();
$this->rownum=$this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
$sql="
......@@ -814,13 +824,14 @@ if (! class_exists("ApiBoard"))
}
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblProductionSpec
{$where}
ORDER BY productionNo DESC
";
$this->rownum=$this->getValue($sql, "rn");
$this->initPage();
$this->rownum=$this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
......@@ -886,14 +897,15 @@ if (! class_exists("ApiBoard"))
$userNo=$this->appUser["no"];
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblProductionSpec PS
JOIN tblLike L ON PS.productionNo=L.productionNo
WHERE L.userNo='{$userNo}' AND PS.status=1
ORDER BY regDate DESC
";
$this->rownum=$this->getValue($sql, "rn");
$this->initPage();
$this->rownum=$this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
$sql="
......@@ -909,13 +921,14 @@ if (! class_exists("ApiBoard"))
function getListOfProductionPortrait(){
$sql="
SELECT COUNT(*)
SELECT COUNT(*) AS rn
FROM tblProductionPortrait
WHERE status=1
ORDER BY regDate DESC
";
$this->rownum=$this->getValue($sql, "rn");
$this->initPage();
$this->rownum=$this->getValue($sql, "rn");
$this->setPageForDevice($this->rownum);
$sql="
......
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/ApiBase.php" ;?>
<?
/*
* Admin process
* add by dev.lee
*/
if (! class_exists("ApiShop"))
{
class ApiShop extends ApiBase
{
function __construct($req)
{
parent::__construct($req);
}
// 카테고리 (http://106.240.232.36:8004/action_front.php?cmd=ApiShop.getListOfCategory)
function getListOfCategory()
{
$sql = "
SELECT *
FROM v_alive_category
ORDER BY no ASC
";
$list = $this->getArray($sql);
if (sizeof($list) > 0)
return $this->makeResultJson("1", "", $list);
else
return $this->makeResultJson("-1000", "내역이 없습니다.");
}
// 상점리스트 (http://106.240.232.36:8004/action_front.php?cmd=ApiShop.getListOfShop)
function getListOfShop()
{
$categoryCD = $this->req["categoryCD"];
$promotion = $this->req["promotion"];
$isAll = $this->req["isAll"];
$isUnlimitDistance = $this->req["isUnlimitDistance"];
$name = $this->req["name"];
$page = $this->req["page"];
$lat = $this->req["lat"] == "" ? 0 : (int) ($this->req["lat"] * 1E6);
$lng = $this->req["lng"] == "" ? 0 : (int) ($this->req["lng"] * 1E6);
$disKM = 1;
$latRadius = $this->LAT_ONE_KM * $disKM;
$lngRadius = $this->LNG_ONE_KM * $disKM;
// $group_fk = $this->appUser["group_fk"];
// $memberType = $this->appUser["member_type"];
$group_fk = 8;
$memberType = M;
if ($lat == 0 && lng == 0)
{
// 멤버쉽일 경우 지정된 그룹의 주소 기반으로
if ($memberType == $this->MEM_TYPE_MEMBER)
{
$sql = "
SELECT *
FROM v_alive_user_group
WHERE `no`='{$group_fk}'
LIMIT 0, 1
";
$memRow = $this->getRow($sql);
$lat = $memRow["latitude"];
$lng = $memRow["longitude"];
}
else
{
$lat = 37565852;
$lng = 126977984;
}
}
$where = " WHERE 1=1 ";
if($isUnlimitDistance != "1")
{
$where .= " AND sh.latitude BETWEEN ({$lat} - $latRadius) AND ({$lat} + $latRadius) ";
$where .= " AND sh.longitude BETWEEN ({$lng} - $lngRadius) AND ({$lng} + $lngRadius) ";
$outWhere = " WHERE distance_km < {$disKM} ";
}
// rowPerPage
if ($categoryCD != "")
$where .= " AND sh.category_cd='{$categoryCD}' ";
if ($promotion != "")
$where .= " AND sh.promotion='{$promotion}' ";
if ($name != "")
$where .= " AND sh.name like '%{$name}%' ";
$orderBy = " ORDER BY promotion DESC, distance_m ASC";
$limitStr = "";
if ($isAll == "N")
{
$this->initPage();
$sql = "
SELECT COUNT(TMP.no) AS rn
FROM
(
SELECT
sh.*,
(FLOOR(SQRT(POWER(ABS({$lat} - sh.latitude), 2) + POWER(ABS({$lng} - sh.longitude), 2)) / 10) / 1000) AS distance_km
FROM v_alive_shop sh
{$where}
) AS TMP
{$outWhere}
";
$this->rownum = $this->getValue($sql, "rn");
$this->setPage($this->rownum);
$limitStr = " LIMIT {$this->startNum}, {$this->endNum} ";
}
else
{
$limitStr = " LIMIT 1000; ";
}
$sql = "
SELECT
TMP.*
, (TMP.longitude / 1E6) AS longitude
, (TMP.latitude / 1E6) AS latitude
FROM
(
SELECT
sh.no
, sh.name
, sh.tel
, sh.addr_old
, sh.addr_new
, sh.latitude
, sh.longitude
, sh.discount_desc
, sh.category_cd
, sh.promotion
, IFNULL((SELECT F.file_vir_name FROM tbl_file F WHERE F.pa_no= sh.no AND F.file_type='{$this->FILE_TYPE_SHOP}' ORDER BY RAND() DESC LIMIT 1), '') AS img_path
, IFNULL((SELECT GR.discount_rate FROM tbl_shop_group_rate GR WHERE sh.no = GR.shop_fk AND GR.group_fk = '{$group_fk}' LIMIT 1), sh.discount_rate) AS discount_rate
, COUNT(co.no) AS comment_count
, TRUNCATE(IFNULL(AVG(co.rank), 0), 0) AS rank
, (FLOOR(SQRT(POWER(ABS('{$lat}' - sh.latitude), 2) + POWER(ABS('{$lng}' - sh.longitude), 2))) / 10.0) AS distance_m
, (FLOOR(SQRT(POWER(ABS({$lat} - sh.latitude), 2) + POWER(ABS({$lng} - sh.longitude), 2)) / 10) / 1000) AS distance_km
FROM v_alive_shop sh
LEFT JOIN tbl_comment co ON(co.target_fk = sh.no AND comm_type = '{$this->COMMENT_TYPE_SHOP}')
{$where}
GROUP BY sh.no
{$orderBy}
) TMP
{$outWhere}
{$limitStr}
";
$list = $this->getArray($sql);
if (sizeof($list) > 0)
return $this->makeResultJson("1", "", $list);
else
return $this->makeResultJson("-1000", "내역이 없습니다.");
}
// 상점상세보기 (http://106.240.232.36:8004/action_front.php?cmd=ApiShop.getInfoOfShop)
function getInfoOfShop()
{
$no = $this->req["no"];
$lat = $this->req["lat"] == "" ? 0 : (int) ($this->req["lat"] * 1E6);
$lng = $this->req["lng"] == "" ? 0 : (int) ($this->req["lng"] * 1E6);
$memberType = $this->appUser["member_type"];
$group_fk = $this->appUser["group_fk"];
if ($lat == 0 && lng == 0)
{
// 멤버쉽일 경우 지정된 그룹의 주소 기반으로
if ($memberType == $this->MEM_TYPE_MEMBER)
{
$sql = "
SELECT *
FROM v_alive_user_group
WHERE `no` = '{$group_fk}'
LIMIT 0, 1
";
$memRow = $this->getRow($sql);
$lat = $memRow["latitude"];
$lng = $memRow["longitude"];
}
else
{
$lat = 37565852;
$lng = 126977984;
}
}
$sql = "
SELECT
sh.no
, sh.name
, sh.tel
, sh.addr_new
, sh.addr_old
, sh.latitude
, sh.longitude
, sh.discount_desc
, sh.category_cd
, sh.promotion
, IFNULL((SELECT GR.discount_rate FROM tbl_shop_group_rate GR WHERE sh.no = GR.shop_fk AND GR.group_fk = '{$group_fk}' LIMIT 1), sh.discount_rate) AS discount_rate
, (sh.longitude / 1E6) AS longitude
, (sh.latitude / 1E6) AS latitude
, COUNT(co.no) AS comment_count
, TRUNCATE(IFNULL(AVG(co.rank), 0), 0) AS rank
, (FLOOR(SQRT(POWER(ABS('{$lat}' - sh.latitude), 2) + POWER(ABS('{$lng}' - sh.longitude), 2))) / 10.0) AS distance_m
, (FLOOR(SQRT(POWER(ABS({$lat} - sh.latitude), 2) + POWER(ABS({$lng} - sh.longitude), 2)) / 10) / 1000) AS distance_km
FROM v_alive_shop sh
LEFT JOIN tbl_comment co ON(co.target_fk = sh.no AND comm_type = '{$this->COMMENT_TYPE_SHOP}')
WHERE sh.no = '{$no}'
GROUP BY sh.no
LIMIT 0, 1
";
$row = $this->getRow($sql);
$sql = "
SELECT *
FROM tbl_file
WHERE pa_no='{$no}' and file_type='{$this->FILE_TYPE_SHOP}'
";
$list = $this->getArray($sql);
$entity = array(
"row" => $row,
"files" => $list
);
return $this->makeResultJson("1", "", $entity);
}
// 상점에 달린 코멘트 보기 (http://106.240.232.36:8004/action_front.php?cmd=ApiShop.getListOfShopComment&no=1)
function getListOfShopComment()
{
$no = $this->req["no"];
$this->initPage();
$sql = "
SELECT COUNT(*)
FROM v_alive_shop_comment co, v_alive_user us
WHERE
co.target_fk='{$no}'
AND co.user_fk = us.no
ORDER BY co.no ASC
";
$this->rownum = $this->getValue($sql, "rn");
$this->setPage($this->rownum);
$sql = "
SELECT
co.*
, us.name as mem_name
, (SELECT f.file_vir_name FROM tbl_file f WHERE f.pa_no=us.no AND f.file_type='{$this->FILE_TYPE_MEM}' LIMIT 0, 1) AS mem_file
FROM
v_alive_shop_comment co, v_alive_user us
WHERE
co.target_fk='{$no}'
AND co.user_fk = us.no
ORDER BY co.no ASC
LIMIT {$this->startNum}, {$this->endNum}
";
$list = $this->getArray($sql);
if (sizeof($list) > 0)
return $this->makeResultJson("1", "", $list);
else
return $this->makeResultJson("-1000", "내역이 없습니다.");
}
// 할인 금액
// /action_front.php?cmd=ApiShop.useUserPoint&no=1&usePoint=100
function useUserPoint()
{
$userNo = $this->appUser["no"];
$groupNo = $this->appUser["group_fk"];
$shopNo = $this->req["no"];
$usePoint = $this->req["usePoint"];
$payAmount = $this->req["payAmount"];
$userBalanceAmt = $this->inFn_Common_getUserPointBalance($userNo);
if ($userBalanceAmt < $usePoint)
return $this->makeResultJson("-100", "보유 포인트가 부족합니다.", $userBalanceAmt);
$result = $this->inFn_Common_savePointTrans("O", $userNo, $usePoint, $groupNo, $shopNo, $this->PAY_TYPE_USE, $payAmount);
if ($result)
return $this->makeResultJson("1", "포인트가 차감되었습니다.", ($userBalanceAmt - $usePoint));
else
return $this->makeResultJson("-1", "포인트 차감에 실패했습니다.", $userBalanceAmt);
}
/**
* 상점 리뷰 등록
* /action_front.php?cmd=ApiShop.saveShopComment&shopNo=1&rank=1&comment=테스트
*
* @return string
*/
function saveShopComment()
{
$shopNo = $this->req["shopNo"];
$userNo = $this->appUser["no"];
$rank = $this->req["rank"];
$comment = $this->req["comment"];
//$userNo = 1;
if ($shopNo == "")
return $this->makeResultJson("-100", "비정상 접근");
if ($rank == "" || $rank == "0")
return $this->makeResultJson("-101", "별점을 입력해주세요.");
if ($comment == "")
return $this->makeResultJson("-102", "리뷰 내용을 입력해주세요.");
$sql = "
INSERT INTO tbl_comment(user_fk, target_fk, comment, comm_type, rank, reg_dt)
VALUES('{$userNo}', '{$shopNo}', '{$comment}', '{$this->COMMENT_TYPE_SHOP}', '{$rank}', NOW())
";
$result = $this->update($sql);
if ($result > 0)
return $this->makeResultJson("1", "등록되었습니다.");
else
return $this->makeResultJson("-1", "등록에 실패했습니다.");
}
} // 클래스 종료
}
?>
\ No newline at end of file
......@@ -25,6 +25,7 @@ if (! class_exists("ApiStatic")){
$sql="
SELECT *
FROM tblOrganizationCert
WHERE status=1
ORDER BY certNo DESC
";
$list=$this->getArray($sql);
......@@ -59,6 +60,7 @@ if (! class_exists("ApiStatic")){
$sql="
SELECT title
FROM tblNotice
WHERE status=1
ORDER BY noticeNo DESC
LIMIT 1
";
......@@ -71,6 +73,7 @@ if (! class_exists("ApiStatic")){
$sql="
SELECT title
FROM tblEvent
WHERE status=1
ORDER BY eventNo DESC
LIMIT 1
";
......@@ -103,7 +106,7 @@ if (! class_exists("ApiStatic")){
$vehicleType=$this->req["vehicleType"];
$vehicleType="IS";
$sql="
SELECT vehicleNo, name, imgPathVehicle
SELECT vehicleNo, name, imgPathVehicle1, imgPathVehicle2, imgPathVehicle3, imgPathVehicle4, imgPathVehicle5
FROM tblVehicle
WHERE vehicleType='{$vehicleType}' AND status=1
ORDER BY regDate DESC
......
<?
include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;
include $_SERVER[DOCUMENT_ROOT] . "/common/php/LoginUtil.php";
if (! class_exists("AdminBoard")){
class AdminBoard extends AdminBase{
function __construct($req)
{
parent::__construct($req);
}
function getListOfBoard(){
$boardType=$this->req["boardType"];
if($boardType == "NO"){
$sql="
SELECT COUNT(*) AS rn
FROM tblNotice
WHERE status=1
";
$this->initPage();
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
$sql="
SELECT N.noticeNo AS no, N.title, DATE_FORMAT(N.regDATE, '%Y%m%d') AS regDate
FROM tblNotice N
WHERE N.status=1
ORDER BY N.regDate DESC
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
else if($boardType == "EV"){
$sql="
SELECT COUNT(*) AS rn
FROM tblEvent
WHERE status=1
";
$this->initPage();
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
$sql="
SELECT E.eventNo AS no, E.title, DATE_FORMAT(E.regDATE, '%Y%m%d') AS regDate
FROM tblEvent E
WHERE E.status=1
ORDER BY E.regDate DESC
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
}
function getInfoOfBoard(){
$boardType=$this->req["boardType"];
$boardNo=$this->req["no"];
if($boardType == "NO"){
$sql="
SELECT noticeNo AS no, title, imgPathNotice1 AS imgPath1, imgPathNotice2 AS imgPath2, imgPathNotice3 AS imgPath3, imgPathNotice4 AS imgPath4, imgPathNotice5 AS imgPath5, content, regDate
FROM tblNotice
WHERE noticeNo='{$boardNo}'
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
else if($boardType == "EV"){
$sql="
SELECT eventNo AS no, title, imgPathEvent1 AS imgPath1, imgPathEvent2 AS imgPath2, imgPathEvent3 AS imgPath3, imgPathEvent4 AS imgPath4, imgPathEvent5 AS imgPath5, content, regDate
FROM tblEvent
WHERE eventNo='{$boardNo}'
";
$result=$this->getRow($sql);
return $result;
}
}
function getListOfEComment($boardNo){
$no=$this->req["no"];
if($boardNo != ""){
$sql="
SELECT C.*, U.userName
FROM tblComment C
JOIN tblUser U ON C.userFk=U.userNo
WHERE C.commentType='EV' AND C.targetFk='{$no}' AND C.status=1 AND U.status=1
ORDER BY commentGroup DESC, gOrder ASC
";
$result=$this->getArray($sql);
//echo json_encode($result);
return $result;
}
}
function saveBoard(){
$no=$this->req["no"];
$boardType=$this->req["boardType"];
$title=$this->req["title"];
$content=$this->req["content"];
$imgResult = $this->inFn_Common_fileSave($_FILES);
$imgPath1 = $imgResult["imgPath1"]["saveURL"] != "" ? $imgResult["imgPath1"]["saveURL"] : $this->req["imgPath1"];
$imgPath2 = $imgResult["imgPath2"]["saveURL"] != "" ? $imgResult["imgPath2"]["saveURL"] : $this->req["imgPath2"];
$imgPath3 = $imgResult["imgPath3"]["saveURL"] != "" ? $imgResult["imgPath3"]["saveURL"] : $this->req["imgPath3"];
$imgPath4 = $imgResult["imgPath4"]["saveURL"] != "" ? $imgResult["imgPath4"]["saveURL"] : $this->req["imgPath4"];
$imgPath5 = $imgResult["imgPath5"]["saveURL"] != "" ? $imgResult["imgPath5"]["saveURL"] : $this->req["imgPath5"];
if($no == ""){
if($boardType=="NO"){
$sql="
INSERT INTO `tblNotice`
(
`title`,
`imgPathNotice1`,
`imgPathNotice2`,
`imgPathNotice3`,
`imgPathNotice4`,
`imgPathNotice5`,
`content`,
`status`,
`regDate`
)
VALUES
(
'{$title}',
'{$imgPath1}',
'{$imgPath2}',
'{$imgPath3}',
'{$imgPath4}',
'{$imgPath5}',
'{$content}',
1,
NOW()
);
";
$this->update($sql);
return $this->makeResultJson(1, "공지사항이 저장되었습니다");
}
else if($boardType=="EV"){
$sql="
INSERT INTO `tblEvent`
(
`title`,
`imgPathEvent1`,
`imgPathEvent2`,
`imgPathEvent3`,
`imgPathEvent4`,
`imgPathEvent5`,
`content`,
`status`,
`regDate`)
VALUES
(
'{$title}',
'{$imgPath1}',
'{$imgPath2}',
'{$imgPath3}',
'{$imgPath4}',
'{$imgPath5}',
'{$content}',
1,
NOW()
);
";
$this->update($sql);
return $this->makeResultJson(1, "이벤트가 저장되었습니다");
}
}
else{
if($boardType=="NO"){
$sql="
UPDATE `tblNotice`
SET
`title` = '{$title}',
`imgPathNotice1` = '{$imgPath1}',
`imgPathNotice2` = '{$imgPath2}',
`imgPathNotice3` = '{$imgPath3}',
`imgPathNotice4` = '{$imgPath4}',
`imgPathNotice5` = '{$imgPath5}',
`content` = '{$content}'
WHERE `noticeNo` = '{$no}';
";
$this->update($sql);
return $this->makeResultJson(1, "공지사항이 수정되었습니다");
}
else if($boardType=="EV"){
$sql="
UPDATE `tblEvent`
SET
`title` = '{$title}',
`imgPathEvent1` = '{$imgPath1}',
`imgPathEvent2` = '{$imgPath2}',
`imgPathEvent3` = '{$imgPath3}',
`imgPathEvent4` = '{$imgPath4}',
`imgPathEvent5` = '{$imgPath5}',
`content` = '{$content}'
WHERE `eventNo` = '{$no}';
";
$this->update($sql);
return $this->makeResultJson(1, "이벤트가 수정되었습니다");
}
}
}
function deleteBoard(){
$noArr = $this->req["no"];
$boardType=$this->req["boardType"];
$noStr = implode(',', $noArr);
if($boardType == "NO"){
$sql = "
UPDATE tblNotice
SET status = 0
WHERE `noticeNo` IN({$noStr})
";
$this->update($sql);
}
else if($boardType=="EV"){
$sql = "
UPDATE tblEvent
SET status = 0
WHERE `eventNo` IN({$noStr})
";
$this->update($sql);
}
}
function getListOfOrganizationCert(){
$sql="
SELECT COUNT(*) AS rn
FROM tblOrganizationCert
WHERE status=1
";
$this->initPage();
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
$sql="
SELECT *
FROM tblOrganizationCert
WHERE status=1
ORDER BY regDate DESC
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
function getInfoOfOrganizationCert(){
$certNo=$this->req["certNo"];
$sql="
SELECT *
FROM tblOrganizationCert
WHERE certNo='{$certNo}'
LIMIT 1
";
$result=$this->getRow($sql);
return $result;
}
function saveOrganizationCert(){
$name=$this->req["name"];
$imgResult = $this->inFn_Common_fileSave($_FILES);
$imgPathCert = $imgResult["imgPathCert1"]["saveURL"] != "" ? $imgResult["imgPathCert1"]["saveURL"] : $this->req["imgPathCert"];
$certNo=$this->req["certNo"];
if($certNo == ""){
$sql="
INSERT INTO tblOrganizationCert(name, imgPathCert, status, regDate)
VALUES
(
'{$name}',
'{$imgPathCert}',
1,
NOW()
)
";
$this->update($sql);
return $this->makeResultJson(1, "저장되었습니다");
}
else{
$sql="
UPDATE tblOrganizationCert
SET
name='{$name}',
imgPathCert='{$imgPathCert}'
WHERE certNo='{$certNo}'
";
$this->update($sql);
return $this->makeResultJson(1, "수정되었습니다");
}
}
function deleteCert(){
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql = "
UPDATE tblOrganizationCert
SET status = 0
WHERE `certNo` IN({$noStr})
";
$this->update($sql);
}
}
}
?>
\ No newline at end of file
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;
include $_SERVER[DOCUMENT_ROOT] . "/common/php/LoginUtil.php";
if (! class_exists("AdminVehicle")){
class AdminVehicle extends AdminBase{
function __construct($req)
{
parent::__construct($req);
}
function getListOfVehicle(){
$vehicleType=$this->req["vehicleType"];
$sql="
SELECT COUNT(*) AS rn
FROM tblVehicle
WHERE vehicleType='{$vehicleType}' AND status=1
";
$this->initPage();
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
$sql="
SELECT vehicleNo, name
FROM tblVehicle
WHERE vehicleType='{$vehicleType}' AND status=1
ORDER BY regDate DESC
{$limit}
";
$result=$this->getArray($sql);
return $result;
}
function getInfoOfVehicle(){
$vehicleNo=$this->req["vehicleNo"];
$sql="
SELECT *
FROM tblVehicle
WHERE vehicleNo='{$vehicleNo}' AND status=1
";
$result=$this->getRow($sql);
return $result;
}
function saveVehicle(){
$vehicleType=$this->req["vehicleType"];
$vehicleNo=$this->req["vehicleNo"];
$name=$this->req["name"];
$spec=$this->req["spec"];
$videoURL=$this->req["videoURL"];
$imgResult = $this->inFn_Common_fileSave($_FILES);
$imgPathVehicle1 = $imgResult["imgPathVehicle1"]["saveURL"] != "" ? $imgResult["imgPathVehicle1"]["saveURL"] : $this->req["imgPathVehicle1"];
$imgPathVehicle2 = $imgResult["imgPathVehicle2"]["saveURL"] != "" ? $imgResult["imgPathVehicle2"]["saveURL"] : $this->req["imgPathVehicle2"];
$imgPathVehicle3 = $imgResult["imgPathVehicle3"]["saveURL"] != "" ? $imgResult["imgPathVehicle3"]["saveURL"] : $this->req["imgPathVehicle3"];
$imgPathVehicle4 = $imgResult["imgPathVehicle4"]["saveURL"] != "" ? $imgResult["imgPathVehicle4"]["saveURL"] : $this->req["imgPathVehicle4"];
$imgPathVehicle5 = $imgResult["imgPathVehicle5"]["saveURL"] != "" ? $imgResult["imgPathVehicle5"]["saveURL"] : $this->req["imgPathVehicle5"];
if($vehicleNo == ""){
$sql="
INSERT INTO tblVehicle(vehicleType, name, spec, videoURL, status, regDate)
VALUES
(
'{$vehicleType}',
'{$name}',
'{$spec}',
'{$videoURL}',
1,
NOW()
)
";
$this->update($sql);
$lastNo=$this->mysql_insert_id();
$sql="
UPDATE tblVehicle
SET
imgPathVehicle1='{$imgPathVehicle1}',
imgPathVehicle2='{$imgPathVehicle2}',
imgPathVehicle3='{$imgPathVehicle3}',
imgPathVehicle4='{$imgPathVehicle4}',
imgPathVehicle5='{$imgPathVehicle5}'
WHERE vehicleNo='{$lastNo}'
";
$this->update($sql);
return $this->makeResultJson(1, "저장되었습니다");
}
else{
$sql="
UPDATE tblVehicle
SET
name='{$name}',
spec='{$spec}',
videoURL='{$videoURL}',
imgPathVehicle1='{$imgPathVehicle1}',
imgPathVehicle2='{$imgPathVehicle2}',
imgPathVehicle3='{$imgPathVehicle3}',
imgPathVehicle4='{$imgPathVehicle4}',
imgPathVehicle5='{$imgPathVehicle5}'
WHERE vehicleNo='{$vehicleNo}'
";
$this->update($sql);
return $this->makeResultJson(1, "수정되었습니다");
}
}
function deleteVehicle()
{
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql = "
UPDATE tblVehicle
SET status = 0
WHERE `vehicleNo` IN({$noStr})
";
$this->update($sql);
}
}
}
?>
\ No newline at end of file