- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
301 lines
9.2 KiB
PHP
301 lines
9.2 KiB
PHP
<?php
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
|
|
|
if(!isset($_SESSION["level"]) || $_SESSION["level"]>5) {
|
|
sleep(1);
|
|
header("Location:" . $WebSite . "login/login_form.php");
|
|
exit;
|
|
}
|
|
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
|
|
|
|
// 첫 화면 표시 문구
|
|
$title_message = '발주처 주소록';
|
|
?>
|
|
|
|
<title> <?=$title_message?> </title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
|
|
$option = isset($_REQUEST['option']) ? $_REQUEST['option'] : '';
|
|
// 담당자 추가하면 option=add
|
|
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
|
|
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
|
|
$header = isset($_REQUEST['header']) ? $_REQUEST['header'] : '';
|
|
|
|
$tablename = 'pb_juil';
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
$pdo = db_connect();
|
|
|
|
$num = isset($_REQUEST["num"]) ? $_REQUEST["num"] : 0;
|
|
|
|
|
|
// 수정일 경우
|
|
if($num>0)
|
|
{
|
|
|
|
try{
|
|
$sql = "select * from ". $DB . "." . $tablename . " where num=?";
|
|
$stmh = $pdo->prepare($sql);
|
|
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
|
$stmh->execute();
|
|
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
|
include '_row.php';
|
|
|
|
}catch (PDOException $Exception) {
|
|
print "오류: ".$Exception->getMessage();
|
|
}
|
|
|
|
|
|
if($option !=='add')
|
|
{
|
|
$mode = 'update';
|
|
}
|
|
else
|
|
{
|
|
$mode = 'insert';
|
|
$manager_name = '';
|
|
$contact_info = '010-';
|
|
$represent = ''; // 대표자가 아닌 경우 직원추가인 경우 해당됨
|
|
$title_message = '업체 담당자 추가화면 ';
|
|
|
|
// 부모코드 넣어줌
|
|
$parentnum = $num;
|
|
$secondordnum = $num;
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
include '_request.php';
|
|
|
|
$mode = 'insert';
|
|
$representative_name = $search;
|
|
$manager_name = $search;
|
|
$phone = '010-';
|
|
$represent = '대표코드'; // 대표코드
|
|
$registdate = date('Y-m-d'); // 현재일자 기록
|
|
}
|
|
?>
|
|
|
|
|
|
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data">
|
|
|
|
<input type="hidden" id="mode" name="mode" value="<?=$mode?>">
|
|
<input type="hidden" id="num" name="num" value=<?=$num?> >
|
|
<input type="hidden" id="mode" name="mode" value=<?=$mode?> >
|
|
<input type="hidden" id="tablename" name="tablename" value=<?=$tablename?> >
|
|
<input type="hidden" id="update_log" name="update_log" value=<?=$update_log?> >
|
|
<input type="hidden" id="parentnum" name="parentnum" value=<?=$parentnum?> >
|
|
<input type="hidden" id="header" name="header" value="<?=$header?>" >
|
|
<input type="hidden" id="represent" name="represent" value="<?=$represent?>" >
|
|
<input type="hidden" id="registdate" name="registdate" value="<?=$registdate?>" >
|
|
|
|
|
|
<div class="container-fluid" >
|
|
<div class="d-flex align-items-center justify-content-center" >
|
|
<div class="card justify-content-center" >
|
|
<div class="card-header text-center">
|
|
<span class="text-center fs-5" > <?=$title_message?> </span>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row justify-content-center text-center">
|
|
<?php
|
|
// 담당자 추가이면 추가 버튼
|
|
if($option !=='add')
|
|
{
|
|
?>
|
|
<div class="d-flex align-items-center">
|
|
|
|
<span class="input-group-text badge bg-secondary text-white fw-bold fs-6" style="width:100px;"> CODE </span>
|
|
<input type="text" class="form-control mt-1" style="width:100px;" id="secondordnum" name="secondordnum" value="<?=$secondordnum?>" readonly >
|
|
|
|
</div>
|
|
<?php } else {
|
|
// 담당자 추가는 secondordnum 발주처 코드 넣어줘야 함.
|
|
?>
|
|
<div class="d-flex align-items-center">
|
|
|
|
<span class="input-group-text badge bg-secondary text-white fw-bold fs-6" style="width:100px;"> CODE </span>
|
|
<input type="text" class="form-control mt-1" style="width:100px;" id="secondordnum" name="secondordnum" value="<?=$secondordnum?>" readonly >
|
|
|
|
</div>
|
|
<?php } ?>
|
|
<div class="d-flex align-items-center justify-content-center m-2">
|
|
<table class="table table-bordered" >
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="2" class="text-center fw-bold" >거래처코드(사업자번호) </td>
|
|
<td colspan="2" class="text-center" >
|
|
<input type="text" class="form-control" id="vendor_code" name="vendor_code" value="<?=$vendor_code?>">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold" style="width:150px;" >거래처 명</td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="vendor_name" name="vendor_name" style="width:250px;" value="<?=$vendor_name?>">
|
|
</td>
|
|
<td class="text-center fw-bold" style="width:170px;" >대표자 성함</td>
|
|
<td class="text-center fw-bold" >
|
|
<input type="text" class="form-control" id="representative_name" name="representative_name" style="width:200px;" value="<?=$representative_name?>">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="text-center fw-bold">주소</td>
|
|
<td colspan="3" class="text-center">
|
|
<input type="text" class="form-control" id="address" name="address" value="<?=$address?>">
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">업태</td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="business_type" name="business_type" value="<?=$business_type?>">
|
|
</td>
|
|
<td class="text-center fw-bold" > 종목 </td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="item_type" name="item_type" value="<?=$item_type?>">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">전화</td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="phone" name="phone" value="<?=$phone?>">
|
|
</td>
|
|
<td class="text-center fw-bold" > 모바일 </td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="mobile" name="mobile" value="<?=$mobile?>">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">이메일</td>
|
|
<td class="text-center">
|
|
<input type="email" class="form-control" id="email" name="email" value="<?=$email?>">
|
|
</td>
|
|
<td class="text-center fw-bold" > 팩스 </td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="fax" name="fax" value="<?=$fax?>">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">담당자명</td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="manager_name" name="manager_name" value="<?=$manager_name?>">
|
|
</td>
|
|
<td class="text-center fw-bold" > 담당자Tel </td>
|
|
<td class="text-center">
|
|
<input type="text" class="form-control" id="contact_info" name="contact_info" value="<?=$contact_info?>">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="text-center fw-bold">비고</td>
|
|
<td colspan="3" class="text-center">
|
|
<textarea class="form-control" id="note" name="note"><?=$note?></textarea>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-center">
|
|
|
|
<button type="button" id="saveBtn" class="btn btn-dark btn-sm me-3">
|
|
<ion-icon name="save-outline"></ion-icon> 저장
|
|
</button>
|
|
<button type="button" id="closeBtn" class="btn btn-outline-dark btn-sm me-2">
|
|
<ion-icon name="close-circle-outline"></ion-icon> Close
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</form>
|
|
</body>
|
|
</html>
|
|
|
|
<!-- 페이지로딩 -->
|
|
<script>
|
|
// 페이지 로딩
|
|
$(document).ready(function(){
|
|
var loader = document.getElementById('loadingOverlay');
|
|
loader.style.display = 'none';
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
|
|
ajaxRequest_write = null;
|
|
/* ESC 키 누를시 팝업 닫기 */
|
|
// $(document).keydown(function(e){
|
|
// //keyCode 구 브라우저, which 현재 브라우저
|
|
// var code = e.keyCode || e.which;
|
|
|
|
// if (code == 27) { // 27은 ESC 키번호
|
|
// self.close();
|
|
// }
|
|
// });
|
|
|
|
$(document).ready(function(){
|
|
|
|
// 창닫기 버튼
|
|
$("#closeBtn").on("click", function() {
|
|
self.close();
|
|
});
|
|
|
|
// 저장 버튼 서버에 저장하고 Ecount 전송함
|
|
$("#saveBtn").on("click", function() {
|
|
|
|
var header = $("#header").val();
|
|
|
|
let msg = '저장완료';
|
|
|
|
if (ajaxRequest_write !== null) {
|
|
ajaxRequest_write.abort();
|
|
}
|
|
ajaxRequest_write = $.ajax({
|
|
url: "process.php",
|
|
type: "post",
|
|
data: $("#board_form").serialize(),
|
|
success : function( data ){
|
|
|
|
console.log(data);
|
|
|
|
Toastify({
|
|
text: msg ,
|
|
duration: 3000,
|
|
close:true,
|
|
gravity:"top",
|
|
position: "center",
|
|
backgroundColor: "#4fbe87",
|
|
}).showToast();
|
|
|
|
$(opener.location).attr("href", "javascript:reloadlist();");
|
|
|
|
setTimeout(function() {
|
|
// 창 닫기
|
|
self.close();
|
|
}, 500);
|
|
|
|
},
|
|
error : function( jqxhr , status , error ){
|
|
console.log( jqxhr , status , error );
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
}); // end of ready
|
|
|
|
</script>
|