- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
396 lines
13 KiB
PHP
396 lines
13 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 = '악성 채권 추심';
|
|
?>
|
|
<link href="css/style.css" rel="stylesheet" >
|
|
<title> <?=$title_message?> </title>
|
|
</head>
|
|
<body>
|
|
<?php
|
|
|
|
// 메뉴를 표현할지 판단하는 header
|
|
$header = isset($_REQUEST['header']) ? $_REQUEST['header'] : '';
|
|
$searchItem = isset($_REQUEST['searchItem']) ? $_REQUEST['searchItem'] : ''; // 제품검사요청서의 searchItem 설정 distributor 인 경우 return 변수 바꿈
|
|
|
|
// 메뉴를 표현할지 판단하는 header
|
|
$header = isset($_REQUEST['header']) ? $_REQUEST['header'] : '';
|
|
|
|
// 세무사아이디면 다른 메뉴 연결
|
|
if($_SESSION["userid"] == '0266771300') {
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/myheader_accountant.php';
|
|
}
|
|
else {
|
|
include $_SERVER['DOCUMENT_ROOT'] . '/myheader.php';
|
|
}
|
|
|
|
function checkNull($strtmp) {
|
|
if ($strtmp === null || trim($strtmp) === '') {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
|
|
$enterpress = isset($_REQUEST["enterpress"]) ? $_REQUEST["enterpress"] : '';
|
|
$belong = isset($_REQUEST["belong"]) ? $_REQUEST["belong"] : '';
|
|
$vendor_name = isset($_REQUEST["vendor_name"]) ? $_REQUEST["vendor_name"] : '';
|
|
$mode = isset($_REQUEST["mode"]) ? $_REQUEST["mode"] : '';
|
|
|
|
$tablename = 'phonebook';
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
$pdo = db_connect();
|
|
|
|
$a=" order by num desc";
|
|
|
|
if(checkNull($search))
|
|
{
|
|
$sql = "SELECT * FROM ".$DB.".".$tablename."
|
|
WHERE searchtag LIKE '%$search%' AND is_deleted IS NULL AND baddebt = '1' " . $a;
|
|
}
|
|
else
|
|
{
|
|
$sql ="select * from ".$DB.".".$tablename . " where is_deleted IS NULL AND baddebt = '1' " . $a;
|
|
}
|
|
|
|
// print 'mode : ' . $mode;
|
|
// print 'search : ' . $search;
|
|
// print $sql;
|
|
|
|
try{
|
|
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
|
|
$total_row=$stmh->rowCount();
|
|
|
|
?>
|
|
|
|
<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" >
|
|
<input type="hidden" id="tablename" name="tablename" value="<?=$tablename?>" >
|
|
<input type="hidden" id="header" name="header" value="<?=$header?>" >
|
|
<input type="hidden" id="secondordnum" name="secondordnum" value="<?=$secondordnum?>" >
|
|
<input type="hidden" id="searchItem" name="searchItem" value="<?=$searchItem?>" >
|
|
|
|
<?php if($header !== 'header')
|
|
{
|
|
print '<div class="container-fluid" > ';
|
|
print '<div class="card justify-content-center text-center mt-1" >';
|
|
}
|
|
else
|
|
{
|
|
print '<div class="container" > ';
|
|
print '<div class="card justify-content-center text-center mt-5" >';
|
|
}
|
|
?>
|
|
<div class="card-header">
|
|
<div class="d-flex justify-content-center text-center align-items-center " >
|
|
<span class="text-center fs-5" > <i class="bi bi-exclamation-octagon-fill text-danger"></i> <?=$title_message?> </span>
|
|
</div>
|
|
</div>
|
|
<div class="card-body" >
|
|
<div class="d-flex justify-content-center text-center align-items-center mb-2" >
|
|
<i class="bi bi-caret-right"></i> <?= $total_row ?>
|
|
<div class="inputWrap30">
|
|
<input type="text" id="search" class="form-control" style="width:150px;" name="search" value="<?=$search?>" autocomplete="off" onKeyPress="if (event.keyCode==13){ enter(); }" >
|
|
<button class="btnClear"> </button>
|
|
</div>
|
|
|
|
<button class="btn btn-outline-dark btn-sm " type="button" id="searchBtn" > <i class="bi bi-search"></i> </button> </span>
|
|
<?php if($header !== 'header')
|
|
print '<button id="closeBtn" type="button" class="btn btn-outline-dark btn-sm"> <i class="bi bi-x-lg"></i> 창닫기 </button>';
|
|
?>
|
|
</div>
|
|
|
|
<div class="table-reponsive" >
|
|
<table class="table table-hover" id="myTable">
|
|
<thead class="table-primary">
|
|
<th class="text-center" >거래처명</th>
|
|
<th class="text-center" >대표자</th>
|
|
<th class="text-center" >담당자</th>
|
|
<th class="text-center" >전화번호</th>
|
|
<th class="text-center w100px"> 채권금액 </th>
|
|
<th class="text-center w100px"> 악성채권 시작일 </th>
|
|
<th class="text-center w100px"> 악성채권 종료일 </th>
|
|
<th class="text-center w300px"> 진행내역 </th>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$start_num=$total_row;
|
|
while($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
|
|
include '_row.php';
|
|
if(empty($contact_info))
|
|
$contact_info = $phone;
|
|
|
|
if(intval($secondordnum) > 0)
|
|
$savenum= $secondordnum;
|
|
else
|
|
$savenum= $num;
|
|
?>
|
|
|
|
<?php
|
|
// 엔터 키와 <br> 태그 제거
|
|
$safe_address = preg_replace('/\s+/', ' ', str_replace(['<br>', '<br/>'], ' ', $address));
|
|
?>
|
|
|
|
<tr onclick="maketext('<?= $manager_name ?>', '<?= $representative_name ?>', '<?= $phone ?>', '<?= $vendor_name ?>', '<?= $contact_info ?>', '<?= $savenum ?>', '<?= $num ?>', '<?= htmlspecialchars($safe_address, ENT_QUOTES) ?>');">
|
|
<td class="text-start text-dark fw-bold" title="<?=$vendor_name?>"><?= $vendor_name ?></td>
|
|
<td class="text-center" title="<?=$representative_name?>"><?= $representative_name ?></td>
|
|
<td class="text-center" title="<?=$manager_name?>"><?= $manager_name ?></td>
|
|
<td class="text-center" title="<?=$contact_info?>"><?= $contact_info ?></td>
|
|
<td class="text-end"><?= is_numeric($debtAmount) ? number_format($debtAmount) : $debtAmount ?></td>
|
|
<td class="text-center"><?= ($fixdate === '0000-00-00' || empty($fixdate)) ? '' : $fixdate ?></td>
|
|
<td class="text-center"><?= ($enddate === '0000-00-00' || empty($enddate)) ? '' : $enddate ?></td>
|
|
<td class="text-start text-primary "><?= $progress_memo ?></td>
|
|
</tr>
|
|
<?php
|
|
$start_num--;
|
|
}
|
|
} catch (PDOException $Exception) {
|
|
print "오류: ".$Exception->getMessage();
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
<script>
|
|
// 페이지 로딩
|
|
$(document).ready(function(){
|
|
var loader = document.getElementById('loadingOverlay');
|
|
if(loader)
|
|
loader.style.display = 'none';
|
|
});
|
|
</script>
|
|
<script>
|
|
var ajaxRequest_write = null;
|
|
var dataTable; // DataTables 인스턴스 전역 변수
|
|
var pbpageNumber; // 현재 페이지 번호 저장을 위한 전역 변수
|
|
|
|
$(document).ready(function() {
|
|
// 포커스를 이동시킴, 강제로 포커스를 얻으면 계속 창이 뜨는 것을 방지함
|
|
if (opener && opener.document) {
|
|
$("#workplacename", opener.document).focus(); // 오프너 문서의 특정 요소에 포커스 설정
|
|
}
|
|
|
|
// DataTables 초기 설정
|
|
dataTable = $('#myTable').DataTable({
|
|
"paging": true,
|
|
"ordering": true,
|
|
"searching": false,
|
|
"pageLength": 20, // 한 페이지에 표시할 항목 수
|
|
"lengthMenu": [20, 50, 100, 200, 500, 1000, 2000], // 페이지당 표시 항목 선택 메뉴
|
|
"language": {
|
|
"lengthMenu": "Show _MENU_ entries"
|
|
},
|
|
"order": [[1, 'desc']] // 첫 번째 열을 기준으로 내림차순 정렬
|
|
// "serverSide": true, // 서버 사이드 처리 활성화
|
|
// "ajax": {
|
|
// "url": "/phonebook/path_to_your_server_side_script.php", // 서버 측 스크립트 URL
|
|
// "type": "POST",
|
|
// "data": function (d) {
|
|
// // 필요에 따라 추가 데이터를 서버로 전송할 수 있음
|
|
// d.search = $('#search').val(); // 검색 값 추가
|
|
// }
|
|
// }
|
|
});
|
|
|
|
// 페이지 번호 복원 (초기 로드 시)
|
|
var savedPageNumber = getCookie('pbpageNumber');
|
|
if (savedPageNumber) {
|
|
dataTable.page(parseInt(savedPageNumber) - 1).draw(false); // 쿠키에 저장된 페이지 번호로 이동
|
|
}
|
|
|
|
// 페이지 변경 이벤트 리스너
|
|
dataTable.on('page.dt', function() {
|
|
var pbpageNumber = dataTable.page.info().page + 1;
|
|
setCookie('pbpageNumber', pbpageNumber, 10); // 쿠키에 현재 페이지 번호 저장
|
|
});
|
|
|
|
// 페이지 길이 셀렉트 박스 변경 이벤트 처리
|
|
$('#myTable_length select').on('change', function() {
|
|
var selectedValue = $(this).val();
|
|
dataTable.page.len(selectedValue).draw(); // 페이지 길이 변경
|
|
|
|
// 변경 후 현재 페이지 번호 복원
|
|
savedPageNumber = getCookie('pbpageNumber');
|
|
if (savedPageNumber) {
|
|
dataTable.page(parseInt(savedPageNumber) - 1).draw(false);
|
|
}
|
|
});
|
|
});
|
|
|
|
function restorePageNumber() {
|
|
var savedPageNumber = getCookie('pbpageNumber');
|
|
location.reload(true); // 페이지를 새로고침하여 저장된 페이지 번호를 복원
|
|
}
|
|
|
|
// Enterkey 동작
|
|
function enter()
|
|
{
|
|
$("#board_form").submit();
|
|
}
|
|
|
|
/* ESC 키 누를시 팝업 닫기 */
|
|
$(document).keydown(function(e){
|
|
//keyCode 구 브라우저, which 현재 브라우저
|
|
var code = e.keyCode || e.which;
|
|
|
|
if (code == 27) { // 27은 ESC 키번호
|
|
self.close();
|
|
}
|
|
});
|
|
|
|
function maketext(managerName, representativeName, phone, vendorName, contact_info, savenum, num, vendorAddr)
|
|
{
|
|
var searchItem = $("#searchItem").val();
|
|
|
|
if(searchItem == 'distributor')
|
|
{
|
|
var managerFieldID = 'distributor_name'; // ID of the manager input field in the parent document
|
|
var phoneFieldID = 'distributor_tel'; // ID of the phone input field in the parent document
|
|
var vendorFieldID = 'distributor_corp'; // ID of the vendor input field in the parent document
|
|
var address = 'distributor_addr';
|
|
var textmsg;
|
|
|
|
managerName = representativeName;
|
|
|
|
if(contact_info ==='') // 담당자 전화가 없으면 대표전화
|
|
{
|
|
contact_info = phone;
|
|
}
|
|
if (opener && opener.document) {
|
|
// Set the values in the parent document
|
|
$("#" + managerFieldID, opener.document).val(managerName);
|
|
$("#" + phoneFieldID, opener.document).val(contact_info);
|
|
$("#" + vendorFieldID, opener.document).val(vendorName);
|
|
$("#" + address, opener.document).val(vendorAddr);
|
|
setTimeout(function() {
|
|
self.close();
|
|
}, 500);
|
|
}
|
|
|
|
} else {
|
|
var managerFieldID = 'secondordman'; // ID of the manager input field in the parent document
|
|
var phoneFieldID = 'secondordmantel'; // ID of the phone input field in the parent document
|
|
var vendorFieldID = 'secondord'; // ID of the vendor input field in the parent document
|
|
var vendorFieldCode = 'secondordnum';
|
|
var textmsg;
|
|
var header = $("#header").val();
|
|
|
|
// display(text)
|
|
|
|
// 업체코드 세팅
|
|
$("#secondordnum").val(savenum);
|
|
|
|
// alert('발주처 코드 : '+ savenum);
|
|
|
|
if(header=='header'){
|
|
updateFn(num);
|
|
return;
|
|
}
|
|
|
|
if(managerName ==='') // 담당자가 없으면 대표자
|
|
{
|
|
managerName = representativeName;
|
|
}
|
|
if(contact_info ==='') // 담당자 전화가 없으면 대표전화
|
|
{
|
|
contact_info = phone;
|
|
}
|
|
if (opener && opener.document) {
|
|
// Set the values in the parent document
|
|
$("#" + managerFieldID, opener.document).val(managerName);
|
|
$("#" + phoneFieldID, opener.document).val(contact_info);
|
|
$("#" + vendorFieldID, opener.document).val(vendorName);
|
|
$("#" + vendorFieldCode, opener.document).val(savenum);
|
|
setTimeout(function() {
|
|
self.close();
|
|
}, 500);
|
|
}
|
|
}
|
|
}
|
|
|
|
$("#searchBtn").on("click", function() {
|
|
$("#board_form").submit();
|
|
});
|
|
|
|
$("#search_directinput").on("click", function() {
|
|
$("#custreg_search").hide();
|
|
});
|
|
|
|
// 창닫기 버튼
|
|
$("#closeBtn").on("click", function() {
|
|
self.close();
|
|
});
|
|
|
|
|
|
function updateFn(num) {
|
|
var header = $("#header").val();
|
|
|
|
popupCenter('./write.php?num=' + num + '&header=' + header , '수정', 800, 850);
|
|
}
|
|
|
|
|
|
|
|
// 자식창에서 돌아와서 이걸 실행한다
|
|
function reloadlist() {
|
|
const search = $("#search").val();
|
|
$("#board_form").submit();
|
|
}
|
|
</script>
|
|
|
|
<!-- 발주처 배송지 선택 모달창 -->
|
|
<script>
|
|
// ajax 중복처리를 위한 구문
|
|
var ajaxRequest = null;
|
|
var ajaxRequest1 = null;
|
|
var ajaxRequest2 = null;
|
|
var ajaxRequest3 = null;
|
|
var ajaxRequest4 = null;
|
|
var ajaxRequest5 = null;
|
|
var ajaxRequest6 = null;
|
|
var ajaxRequest7 = null;
|
|
var ajaxRequest8 = null;
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.closemodal').click(function() {
|
|
// Hide the modal with the id 'deliveryModal'
|
|
$('#deliveryModal').modal('hide');
|
|
self.close(); // Close the popup window after confirming
|
|
});
|
|
});
|
|
|
|
function display(text) {
|
|
Toastify({
|
|
text: text,
|
|
duration: 2000,
|
|
close: true,
|
|
gravity: "top",
|
|
position: "center",
|
|
style: {
|
|
background: "linear-gradient(to right, #00b09b, #96c93d)",
|
|
fontSize: '20px' // 글씨 크기를 20px로 설정
|
|
},
|
|
}).showToast();
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|