초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
245
askitem_ER_juil/card_detail.php
Normal file
245
askitem_ER_juil/card_detail.php
Normal file
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/session.php'; // 세션 파일 포함
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/lib/mydb.php');
|
||||
|
||||
$title_message = '카드 상세 내역';
|
||||
$card = $_REQUEST["card"] ?? '';
|
||||
$fromdate = $_REQUEST['fromdate'] ?? '';
|
||||
$todate = $_REQUEST['todate'] ?? '';
|
||||
|
||||
// fromdate 또는 todate가 빈 문자열이거나 null인 경우
|
||||
if ($fromdate === "" || $fromdate === null || $todate === "" || $todate === null) {
|
||||
// 현재 달의 첫날
|
||||
$fromdate = date('Y-m-01');
|
||||
// 현재 달의 마지막 날
|
||||
$todate = date('Y-m-t');
|
||||
$Transtodate = $todate;
|
||||
} else {
|
||||
// fromdate와 todate가 모두 설정된 경우 (기존 로직 유지)
|
||||
$Transtodate = $todate;
|
||||
}
|
||||
|
||||
// 법인카드 목록 가져오기
|
||||
$jsonFile = $_SERVER['DOCUMENT_ROOT'] . '/account_juil/cardlist.json';
|
||||
$cards = [];
|
||||
if (file_exists($jsonFile)) {
|
||||
$jsonContent = file_get_contents($jsonFile);
|
||||
$cards = json_decode($jsonContent, true);
|
||||
if (!is_array($cards)) {
|
||||
$cards = [];
|
||||
}
|
||||
}
|
||||
|
||||
// 법인카드 정보를 포맷팅하는 함수
|
||||
function formatCompanyCard($companyCard, $cardList) {
|
||||
if (empty($companyCard)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// JSON 배열에서 해당 카드번호 찾기
|
||||
foreach ($cardList as $card) {
|
||||
if (isset($card['number']) && strpos($card['number'], $companyCard) !== false) {
|
||||
// 카드번호 끝 4자리 추출
|
||||
$lastThree = substr($card['number'], -8, 3);
|
||||
return "({$card['company']}) {$lastThree} ({$card['user']})";
|
||||
}
|
||||
}
|
||||
|
||||
// 매칭되는 카드가 없으면 원본 반환
|
||||
return $companyCard;
|
||||
}
|
||||
|
||||
// 카드 사용자 정보 가져오기
|
||||
$cardUser = '';
|
||||
$cardCompany = '';
|
||||
foreach ($cards as $cardInfo) {
|
||||
if (isset($cardInfo['number']) && strpos($cardInfo['number'], $card) !== false) {
|
||||
$cardUser = $cardInfo['user'] ?? '';
|
||||
$cardCompany = $cardInfo['company'] ?? '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$SettingDate = "indate";
|
||||
$Andis_deleted = " AND (is_deleted IS NULL or is_deleted='0') AND eworks_item='지출결의서' AND companyCard = '" . addslashes($card) . "' AND al_company='주일' ";
|
||||
$Whereis_deleted = " WHERE (is_deleted IS NULL or is_deleted='0') AND eworks_item='지출결의서' AND companyCard = '" . addslashes($card) . "' AND al_company='주일' ";
|
||||
|
||||
$common = " WHERE " . $SettingDate . " BETWEEN '$fromdate' AND '$Transtodate' " . $Andis_deleted . " ORDER BY ";
|
||||
$a = $common . " num DESC "; // 내림차순 전체
|
||||
|
||||
$sql = "select * from ".$DB.".eworks " . $a;
|
||||
|
||||
$pdo = db_connect();
|
||||
|
||||
try{
|
||||
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
|
||||
$total_row = $stmh->rowCount();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= $title_message ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<link href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-size: 14px;
|
||||
}
|
||||
.table th, .table td {
|
||||
font-size: 12px;
|
||||
}
|
||||
.card-header {
|
||||
background-color: #f8f9fa;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container-fluid p-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0"><?= $title_message ?></h5>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="window.close()">
|
||||
<i class="bi bi-x-lg"></i> 닫기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- 카드 정보 요약 -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<strong>카드번호:</strong> <?= htmlspecialchars($card) ?><br>
|
||||
<strong>카드사:</strong> <?= htmlspecialchars($cardCompany) ?><br>
|
||||
<strong>사용자:</strong> <?= htmlspecialchars($cardUser) ?>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<strong>조회기간:</strong> <?= $fromdate ?> ~ <?= $todate ?><br>
|
||||
<strong>총 건수:</strong> <?= number_format($total_row) ?>건
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 상세 리스트 테이블 -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm" id="cardDetailTable">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th class="text-center" style="width:5%;">번호</th>
|
||||
<th class="text-center" style="width:120px;">작성일</th>
|
||||
<th class="text-center" style="width:120px;">지출요청일</th>
|
||||
<th class="text-center" style="width:120px;">결재일</th>
|
||||
<th class="text-center">기안자</th>
|
||||
<th class="text-center">적요</th>
|
||||
<th class="text-center">금액</th>
|
||||
<th class="text-center">비고</th>
|
||||
<th class="text-center">결재완료</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$start_num = $total_row; // 페이지당 표시되는 첫번째 글순번
|
||||
|
||||
while ($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
|
||||
include $_SERVER['DOCUMENT_ROOT'] .'/eworks/_row.php';
|
||||
|
||||
// expense_data JSON 파싱
|
||||
$expense_data = json_decode($expense_data ?? '[]', true);
|
||||
$items = [];
|
||||
$notes = [];
|
||||
$total_amount = 0;
|
||||
|
||||
if (is_array($expense_data)) {
|
||||
foreach ($expense_data as $expense) {
|
||||
if (!empty($expense['expense_item'])) {
|
||||
$items[] = $expense['expense_item'];
|
||||
}
|
||||
if (!empty($expense['expense_note'])) {
|
||||
$notes[] = $expense['expense_note'];
|
||||
}
|
||||
if (!empty($expense['expense_amount'])) {
|
||||
$total_amount += intval(str_replace(',', '', $expense['expense_amount']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 적요와 비고를 콤마로 구분된 문자열로 변환
|
||||
$items_str = implode(', ', $items);
|
||||
$notes_str = implode(', ', $notes);
|
||||
|
||||
echo '<tr style="cursor:pointer;" data-id="'. $num . '" onclick="redirectToView(' . $num . ')">';
|
||||
?>
|
||||
<td class="text-center"><?= $start_num ?></td>
|
||||
<td class="text-center" data-order="<?= $indate ?>"> <?=$indate?> </td>
|
||||
<td class="text-center" data-order="<?= $requestpaymentdate ?>"> <?= $requestpaymentdate ?> </td>
|
||||
<td class="text-center" data-order="<?= $paymentdate ?>"> <?= $paymentdate ?> </td>
|
||||
<td class="text-center"> <?= $author ?> </td>
|
||||
<td class="text-start"><?= $items_str ?></td>
|
||||
<td class="text-end"><?= number_format($total_amount) ?></td>
|
||||
<td class="text-start"><?= $notes_str ?></td>
|
||||
<td class="text-center">
|
||||
<?= ( ($status === 'end' && !empty($e_confirm)) || empty($e_line_id) ) ? '✅' : '' ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$start_num--;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// DataTables 초기 설정
|
||||
$('#cardDetailTable').DataTable({
|
||||
"paging": true,
|
||||
"ordering": true,
|
||||
"searching": true,
|
||||
"pageLength": 25,
|
||||
"lengthMenu": [10, 25, 50, 100],
|
||||
"language": {
|
||||
"lengthMenu": "페이지당 _MENU_개씩 보기",
|
||||
"search": "검색:",
|
||||
"info": "_START_ - _END_ / _TOTAL_",
|
||||
"paginate": {
|
||||
"first": "처음",
|
||||
"last": "마지막",
|
||||
"next": "다음",
|
||||
"previous": "이전"
|
||||
}
|
||||
},
|
||||
"order": [[0, 'desc']]
|
||||
});
|
||||
});
|
||||
|
||||
function redirectToView(num) {
|
||||
var url = "write_form.php?mode=view&num=" + num + "&tablename=eworks";
|
||||
// 팝업에서 팝업을 열기 위해 window.open 사용
|
||||
var popup = window.open(url, 'detail_view_' + num, 'width=800,height=800,scrollbars=yes,resizable=yes');
|
||||
if (popup) {
|
||||
popup.focus();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
294
askitem_ER_juil/insert.php
Normal file
294
askitem_ER_juil/insert.php
Normal file
@@ -0,0 +1,294 @@
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . '/session.php';
|
||||
|
||||
header("Content-Type: application/json"); //json을 사용하기 위해 필요한 구문
|
||||
|
||||
// 임시저장된 첨부파일을 확정하기 위해 검사하기
|
||||
isset($_REQUEST["timekey"]) ? $timekey=$_REQUEST["timekey"] : $timekey=''; // 신규데이터에 생성할때 임시저장키
|
||||
|
||||
$mode = $_REQUEST["mode"] ?? 'insert';
|
||||
$num = $_REQUEST["num"] ?? '';
|
||||
|
||||
include $_SERVER['DOCUMENT_ROOT'] . '/eworks/_request.php';
|
||||
|
||||
$expense_data_json = isset($_POST['expense_data']) ? $_POST['expense_data'] : null;
|
||||
|
||||
// 전자결재의 변수에 매칭 (저장변수가 다른경우 선언)
|
||||
$expense_data = null;
|
||||
if ($expense_data_json) {
|
||||
try {
|
||||
$expense_data = json_decode($expense_data_json, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new Exception('Invalid JSON data');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo json_encode([
|
||||
"error" => true,
|
||||
"message" => "지출 데이터 처리 중 오류가 발생했습니다: " . $e->getMessage()
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// 첫 번째 expense_item 추출 및 전체 건수 계산
|
||||
if (!empty($expense_data) && isset($expense_data[0]['expense_item'])) {
|
||||
$firstItem = $expense_data[0]['expense_item'];
|
||||
$total = count($expense_data);
|
||||
|
||||
if ($total > 1) {
|
||||
// 첫 번째 항목 외 나머지 건수 표시
|
||||
$e_title = $firstItem . ' 외 ' . ($total - 1) . '건';
|
||||
} else {
|
||||
// 단건일 때는 항목명만
|
||||
$e_title = $firstItem;
|
||||
}
|
||||
} else {
|
||||
$e_title = '';
|
||||
}
|
||||
|
||||
$eworks_item = '지출결의서';
|
||||
|
||||
// 전자 결재에 보여질 내용 data 수정 update
|
||||
$data = array(
|
||||
"e_title" => $e_title,
|
||||
"indate" => $indate,
|
||||
"author" => $author,
|
||||
"suppliercost" => $suppliercost, // 비용 총액 저장
|
||||
"paymentdate" => $paymentdate, // 결재일자
|
||||
"requestpaymentdate" => $requestpaymentdate, // 지출요청일자
|
||||
"expense_data" => $expense_data // 지출결의서 내역(JSON)
|
||||
);
|
||||
|
||||
$contents = json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
||||
$pdo = db_connect();
|
||||
|
||||
// 전자결재 이름찾아 결재 아이디 찾아내기
|
||||
try {
|
||||
$membersql = "SELECT * FROM {$DB}.member WHERE name = ?";
|
||||
$stmh = $pdo->prepare($membersql);
|
||||
$stmh->bindValue(1, trim($author), PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$rowMember = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// 조회된 데이터가 있는지 확인 후 설정
|
||||
$first_approval_id = trim($rowMember['first_approval_id']) ?? ''; // 값이 없으면 빈 문자열
|
||||
$first_approval_name = trim($rowMember['first_approval_name']) ?? '';
|
||||
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
|
||||
if ($mode=="modify"){
|
||||
$data=date("Y-m-d H:i:s") . " - " . $_SESSION["name"] . " " ;
|
||||
$update_log = $data . $update_log . "
"; // 개행문자 Textarea
|
||||
|
||||
// 결재금액이 10만원 미만인 경우 결재라인과 아이디를 공백으로 설정
|
||||
$numeric_cost = (int)str_replace(',', '', $suppliercost);
|
||||
if ($numeric_cost < 100000) {
|
||||
$e_line_id = '';
|
||||
$e_line = '';
|
||||
$status = 'end';
|
||||
} else {
|
||||
$e_line_id = $first_approval_id;
|
||||
$e_line = $first_approval_name;
|
||||
if($done=='done'){ // 결재완료일때는 그대로 기록되게 수정
|
||||
$status = 'end';
|
||||
} else {
|
||||
$status = 'send';
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
|
||||
// UPDATE 문 (변경된 컬럼명 반영)
|
||||
$sql = "UPDATE {$DB}.eworks SET
|
||||
indate = ?,
|
||||
outworkplace = ?,
|
||||
request_comment = ?,
|
||||
first_writer = ?,
|
||||
author = ?,
|
||||
update_log = ?,
|
||||
contents = ?,
|
||||
e_title = ?,
|
||||
eworks_item = ?,
|
||||
al_content=?,
|
||||
suppliercost=?,
|
||||
store=?,
|
||||
paymentdate=?,
|
||||
requestpaymentdate=?,
|
||||
expense_data=?,
|
||||
companyCard=?,
|
||||
status=?,
|
||||
e_line_id=?,
|
||||
e_line=? ,
|
||||
al_company=?
|
||||
WHERE num = ?
|
||||
LIMIT 1";
|
||||
|
||||
$stmh = $pdo->prepare($sql);
|
||||
|
||||
// 바인딩된 값
|
||||
$stmh->bindValue(1, $indate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $outworkplace, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $request_comment, PDO::PARAM_STR);
|
||||
$stmh->bindValue(4, $first_writer, PDO::PARAM_STR);
|
||||
$stmh->bindValue(5, $author, PDO::PARAM_STR);
|
||||
$stmh->bindValue(6, $update_log, PDO::PARAM_STR);
|
||||
$stmh->bindValue(7, $contents, PDO::PARAM_STR);
|
||||
$stmh->bindValue(8, $e_title, PDO::PARAM_STR);
|
||||
$stmh->bindValue(9, $eworks_item, PDO::PARAM_STR);
|
||||
$stmh->bindValue(10, $al_content, PDO::PARAM_STR);
|
||||
$stmh->bindValue(11, $suppliercost, PDO::PARAM_STR);
|
||||
$stmh->bindValue(12, $store, PDO::PARAM_STR);
|
||||
$stmh->bindValue(13, $paymentdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(14, $requestpaymentdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(15, json_encode($expense_data), PDO::PARAM_STR);
|
||||
$stmh->bindValue(16, $companyCard, PDO::PARAM_STR);
|
||||
$stmh->bindValue(17, $status, PDO::PARAM_STR);
|
||||
$stmh->bindValue(18, $e_line_id, PDO::PARAM_STR);
|
||||
$stmh->bindValue(19, $e_line, PDO::PARAM_STR);
|
||||
$stmh->bindValue(20, $al_company, PDO::PARAM_STR);
|
||||
$stmh->bindValue(21, $num, PDO::PARAM_STR);
|
||||
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
else if ($mode == "copy" || $mode == "insert") {
|
||||
// 데이터 신규 등록
|
||||
$registdate = date("Y-m-d H:i:s");
|
||||
|
||||
// 결재 상태 설정
|
||||
$status = 'send';
|
||||
$author_id = $user_id;
|
||||
$author = $user_name;
|
||||
|
||||
// 최초 등록자 정보
|
||||
$first_writer = $_SESSION["name"] . " _" . date("Y-m-d H:i:s");
|
||||
|
||||
// 결재금액이 10만원 미만인 경우 결재라인과 아이디를 공백으로 설정
|
||||
$numeric_cost = (int)str_replace(',', '', $suppliercost);
|
||||
if ($numeric_cost < 100000) {
|
||||
$e_line_id = '';
|
||||
$e_line = '';
|
||||
$status = 'end';
|
||||
} else {
|
||||
$e_line_id = $first_approval_id;
|
||||
$e_line = $first_approval_name;
|
||||
}
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$sql = "INSERT INTO {$DB}.eworks (
|
||||
indate, outworkplace, request_comment, first_writer, author,
|
||||
update_log, contents, e_title, eworks_item, registdate,
|
||||
author_id, status, e_line_id, e_line, al_content,
|
||||
suppliercost, store, paymentdate, requestpaymentdate, expense_data,
|
||||
companyCard, al_company
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
$stmh = $pdo->prepare($sql);
|
||||
|
||||
// 바인딩된 값 설정
|
||||
$stmh->bindValue(1, $indate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $outworkplace, PDO::PARAM_STR);
|
||||
$stmh->bindValue(3, $request_comment, PDO::PARAM_STR);
|
||||
$stmh->bindValue(4, $first_writer, PDO::PARAM_STR);
|
||||
$stmh->bindValue(5, $author, PDO::PARAM_STR);
|
||||
$stmh->bindValue(6, $update_log, PDO::PARAM_STR);
|
||||
$stmh->bindValue(7, $contents, PDO::PARAM_STR);
|
||||
$stmh->bindValue(8, $e_title, PDO::PARAM_STR);
|
||||
$stmh->bindValue(9, $eworks_item, PDO::PARAM_STR);
|
||||
$stmh->bindValue(10, $registdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(11, $author_id, PDO::PARAM_STR);
|
||||
$stmh->bindValue(12, $status, PDO::PARAM_STR);
|
||||
$stmh->bindValue(13, rtrim($e_line_id, '!'), PDO::PARAM_STR);
|
||||
$stmh->bindValue(14, rtrim($e_line, '!'), PDO::PARAM_STR);
|
||||
$stmh->bindValue(15, $al_content, PDO::PARAM_STR);
|
||||
$stmh->bindValue(16, $suppliercost, PDO::PARAM_STR);
|
||||
$stmh->bindValue(17, $store, PDO::PARAM_STR);
|
||||
$stmh->bindValue(18, $paymentdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(19, $requestpaymentdate, PDO::PARAM_STR);
|
||||
$stmh->bindValue(20, json_encode($expense_data), PDO::PARAM_STR);
|
||||
$stmh->bindValue(21, $companyCard, PDO::PARAM_STR);
|
||||
$stmh->bindValue(22, $al_company, PDO::PARAM_STR);
|
||||
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
echo json_encode([
|
||||
"error" => true,
|
||||
"message" => $Exception->getMessage()
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 신규 레코드 번호 가져오기
|
||||
try {
|
||||
$sql = "SELECT num FROM {$DB}.eworks ORDER BY num DESC LIMIT 1";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->execute();
|
||||
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
||||
$num = $row["num"];
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
|
||||
// 첨부파일의 임시 키를 정상적인 번호로 업데이트
|
||||
try {
|
||||
$pdo->beginTransaction();
|
||||
$sql = "UPDATE {$DB}.picuploads SET parentnum = ? WHERE parentnum = ?";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $timekey, PDO::PARAM_STR);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
} catch (PDOException $Exception) {
|
||||
$pdo->rollBack();
|
||||
print "오류: " . $Exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
else if ($mode == "delete") {
|
||||
try {
|
||||
// update_log에 삭제자 기록 추가
|
||||
$logEntry = date("Y-m-d H:i:s") . " - " . $_SESSION["name"] . " 삭제됨\n";
|
||||
$update_log = $logEntry . ($update_log ?? '');
|
||||
|
||||
$pdo->beginTransaction();
|
||||
$sql = "UPDATE {$DB}.eworks
|
||||
SET is_deleted = 1,
|
||||
update_log = ?
|
||||
WHERE num = ?
|
||||
LIMIT 1";
|
||||
$stmh = $pdo->prepare($sql);
|
||||
$stmh->bindValue(1, $update_log, PDO::PARAM_STR);
|
||||
$stmh->bindValue(2, $num, PDO::PARAM_INT);
|
||||
$stmh->execute();
|
||||
$pdo->commit();
|
||||
|
||||
echo json_encode(["num"=>$num, "mode"=>$mode], JSON_UNESCAPED_UNICODE);
|
||||
} catch (PDOException $e) {
|
||||
$pdo->rollBack();
|
||||
echo json_encode(["error"=>$e->getMessage()], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$data = array(
|
||||
"num" => $num,
|
||||
"mode" => $mode
|
||||
);
|
||||
|
||||
//json 출력
|
||||
echo(json_encode($data, JSON_UNESCAPED_UNICODE));
|
||||
588
askitem_ER_juil/list.php
Normal file
588
askitem_ER_juil/list.php
Normal file
@@ -0,0 +1,588 @@
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/session.php'; // 세션 파일 포함
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/lib/mydb.php');
|
||||
|
||||
// 서비스 계정 JSON 파일 경로
|
||||
$serviceAccountKeyFile = $_SERVER['DOCUMENT_ROOT'] . '/tokens/mytoken.json';
|
||||
|
||||
// Google Drive 클라이언트 설정
|
||||
$client = new Google_Client();
|
||||
$client->setAuthConfig($serviceAccountKeyFile);
|
||||
$client->addScope(Google_Service_Drive::DRIVE);
|
||||
|
||||
// Google Drive 서비스 초기화
|
||||
$service = new Google_Service_Drive($client);
|
||||
|
||||
// 특정 폴더 확인 함수
|
||||
function getFolderId($service, $folderName, $parentFolderId = null) {
|
||||
$query = "name='$folderName' and mimeType='application/vnd.google-apps.folder' and trashed=false";
|
||||
if ($parentFolderId) {
|
||||
$query .= " and '$parentFolderId' in parents";
|
||||
}
|
||||
|
||||
$response = $service->files->listFiles([
|
||||
'q' => $query,
|
||||
'spaces' => 'drive',
|
||||
'fields' => 'files(id, name)'
|
||||
]);
|
||||
|
||||
return count($response->files) > 0 ? $response->files[0]->id : null;
|
||||
}
|
||||
|
||||
// Google Drive에서 파일 썸네일 검사 및 반환
|
||||
function getThumbnail($fileId, $service) {
|
||||
try {
|
||||
$file = $service->files->get($fileId, ['fields' => 'thumbnailLink']);
|
||||
return $file->thumbnailLink ?? null; // 썸네일 URL이 있으면 반환, 없으면 null
|
||||
} catch (Exception $e) {
|
||||
error_log("썸네일 가져오기 실패: " . $e->getMessage());
|
||||
return null; // 실패 시 null 반환
|
||||
}
|
||||
}
|
||||
|
||||
$title_message = '지출결의서';
|
||||
$mode = $_REQUEST["mode"] ?? '';
|
||||
$search = $_REQUEST["search"] ?? '';
|
||||
?>
|
||||
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php'; ?>
|
||||
|
||||
<title> <?=$title_message?> </title>
|
||||
|
||||
<style>
|
||||
#showextract {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.showextractframe {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 800px;
|
||||
z-index: 1000;
|
||||
left: 50%; /* 화면 가로축의 중앙에 위치 */
|
||||
top: 110px; /* Y축은 절대 좌표에 따라 설정 */
|
||||
transform: translateX(-50%); /* 자신의 너비의 반만큼 왼쪽으로 이동 */
|
||||
}
|
||||
#autocomplete-list {
|
||||
border: 1px solid #d4d4d4;
|
||||
border-bottom: none;
|
||||
border-top: none;
|
||||
position: absolute;
|
||||
top: 87%;
|
||||
left: 65%;
|
||||
right: 30%;
|
||||
width : 10%;
|
||||
z-index: 99;
|
||||
}
|
||||
.autocomplete-item {
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #d4d4d4;
|
||||
}
|
||||
.autocomplete-item:hover {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$tablename = 'eworks';
|
||||
if(!$chkMobile)
|
||||
{
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/myheader1.php');
|
||||
}
|
||||
|
||||
// 모바일이면 특정 CSS 적용
|
||||
if ($chkMobile) {
|
||||
echo '<style>
|
||||
table th, table td, h4, .form-control, span {
|
||||
font-size: 22px;
|
||||
}
|
||||
h4 {
|
||||
font-size: 40px;
|
||||
}
|
||||
.btn-sm {
|
||||
font-size: 30px;
|
||||
}
|
||||
</style>';
|
||||
}
|
||||
|
||||
include $_SERVER['DOCUMENT_ROOT'] .'/eworks/_request.php';
|
||||
$pdo = db_connect();
|
||||
|
||||
// 현재 날짜
|
||||
$currentDate = date("Y-m-d");
|
||||
|
||||
$fromdate = $_REQUEST['fromdate'] ?? '';
|
||||
$todate = $_REQUEST['todate'] ?? '';
|
||||
|
||||
// fromdate 또는 todate가 빈 문자열이거나 null인 경우
|
||||
if ($fromdate === "" || $fromdate === null || $todate === "" || $todate === null) {
|
||||
// 현재 달의 첫날
|
||||
$fromdate = date('Y-m-01');
|
||||
// 현재 달의 마지막 날
|
||||
$todate = date('Y-m-t');
|
||||
$Transtodate = $todate;
|
||||
} else {
|
||||
// fromdate와 todate가 모두 설정된 경우 (기존 로직 유지)
|
||||
$Transtodate = $todate;
|
||||
}
|
||||
|
||||
// 법인카드 목록 가져오기
|
||||
$jsonFile = $_SERVER['DOCUMENT_ROOT'] . '/account_juil/cardlist.json';
|
||||
$cards = [];
|
||||
if (file_exists($jsonFile)) {
|
||||
$jsonContent = file_get_contents($jsonFile);
|
||||
$cards = json_decode($jsonContent, true);
|
||||
if (!is_array($cards)) {
|
||||
$cards = [];
|
||||
}
|
||||
}
|
||||
|
||||
// 법인카드 정보를 포맷팅하는 함수
|
||||
function formatCompanyCard($companyCard, $cardList) {
|
||||
if (empty($companyCard)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 같은 카드번호를 사용하는 모든 사용자 찾기
|
||||
$matchedUsers = [];
|
||||
$cardCompany = '';
|
||||
$lastFour = '';
|
||||
|
||||
foreach ($cardList as $card) {
|
||||
if (isset($card['number']) && strpos($card['number'], $companyCard) !== false) {
|
||||
// 카드번호 끝 4자리 추출
|
||||
$lastFour = substr($card['number'], -4);
|
||||
$cardCompany = $card['company'];
|
||||
// 사용자 이름 수집
|
||||
if (!empty($card['user'])) {
|
||||
$matchedUsers[] = $card['user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 매칭되는 카드가 있으면 모든 사용자 이름 표시
|
||||
if (!empty($matchedUsers)) {
|
||||
$userList = implode('/', $matchedUsers);
|
||||
return "({$cardCompany}) {$lastFour} ({$userList})";
|
||||
}
|
||||
|
||||
// 매칭되는 카드가 없으면 원본 반환
|
||||
return $companyCard;
|
||||
}
|
||||
|
||||
$SettingDate = "indate";
|
||||
|
||||
$Andis_deleted = " AND (is_deleted IS NULL or is_deleted='0') AND eworks_item='지출결의서' AND al_company='주일' ";
|
||||
$Whereis_deleted = " WHERE (is_deleted IS NULL or is_deleted='0') AND eworks_item='지출결의서' AND al_company='주일' ";
|
||||
|
||||
$common = " WHERE " . $SettingDate . " BETWEEN '$fromdate' AND '$Transtodate' " . $Andis_deleted . " ORDER BY ";
|
||||
|
||||
$a = $common . " num DESC "; // 내림차순 전체
|
||||
|
||||
$sql="select * from ".$DB.".eworks " . $a;
|
||||
|
||||
|
||||
// ——————————————————————————————
|
||||
// (1) 카드번호별 사용 합계 계산
|
||||
// ——————————————————————————————
|
||||
$cardStats = []; // ['카드번호' => 총합]
|
||||
$totalCardSum = 0;
|
||||
|
||||
try {
|
||||
// eworks 테이블에서 모든 지출결의서의 법인카드별 비용 합계 가져오기
|
||||
// $sql = "SELECT companyCard, suppliercost
|
||||
// FROM {$DB}.eworks
|
||||
// WHERE (is_deleted = '0' or is_deleted is null)
|
||||
// AND suppliercost IS NOT NULL
|
||||
// AND suppliercost != '' AND eworks_item='지출결의서'
|
||||
// ";
|
||||
$st = $pdo->query($sql);
|
||||
while ($r = $st->fetch(PDO::FETCH_ASSOC)) {
|
||||
$cardNo = trim($r['companyCard']);
|
||||
// suppliercost 필드에 콤마가 들어 있을 수 있으니 제거 후 숫자로
|
||||
$amt = floatval(str_replace(',', '', $r['suppliercost']));
|
||||
if ($cardNo === '') continue;
|
||||
if (!isset($cardStats[$cardNo])) {
|
||||
$cardStats[$cardNo] = 0;
|
||||
}
|
||||
$cardStats[$cardNo] += $amt;
|
||||
$totalCardSum += $amt;
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
// 계산 중 오류 발생 시 무시
|
||||
}
|
||||
|
||||
// 카드 목록(json)에 없는 카드번호가 쌓여 있을 수도 있으니, 정렬을 위해 키 가져오기
|
||||
// 카드번호 목록만 뽑아낼 때 (중복 제거)
|
||||
$allCardNumbers = array_map(
|
||||
function($c) {
|
||||
// PHP 7.0 이상부터 ?? 연산자는 사용 가능하므로 그대로 두셔도 됩니다.
|
||||
return isset($c['number']) ? $c['number'] : '';
|
||||
},
|
||||
$cards
|
||||
);
|
||||
|
||||
// 중복 제거 (같은 카드번호가 여러 사용자에게 할당된 경우)
|
||||
$allCardNumbers = array_unique($allCardNumbers);
|
||||
|
||||
// 정렬
|
||||
sort($allCardNumbers);
|
||||
|
||||
|
||||
|
||||
|
||||
// 검색을 위해 모든 검색변수 공백제거
|
||||
$search = str_replace(' ', '', $search);
|
||||
|
||||
if($mode=="search"){
|
||||
if($search==""){
|
||||
$sql="select * from {$DB}.eworks " . $a;
|
||||
}
|
||||
elseif($search!="") {
|
||||
$sql ="select * from {$DB}.eworks where ((outdate like '%$search%') or (replace(outworkplace,' ','') like '%$search%' ) ";
|
||||
$sql .="or (steel_item like '%$search%') or (spec like '%$search%') or (company like '%$search%') or (first_writer like '%$search%') or (payment like '%$search%') or (supplier like '%$search%') or (request_comment like '%$search%') ) " . $Andis_deleted . " order by num desc ";
|
||||
}
|
||||
}
|
||||
if($mode=="") {
|
||||
$sql="select * from {$DB}.eworks " . $a;
|
||||
}
|
||||
$nowday=date("Y-m-d"); // 현재일자 변수지정
|
||||
$dateCon =" AND between date('$fromdate') and date('$Transtodate') " ;
|
||||
|
||||
try{
|
||||
$stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh
|
||||
$total_row=$stmh->rowCount();
|
||||
?>
|
||||
|
||||
<form name="board_form" id="board_form" method="post" action="list.php?mode=search">
|
||||
<input type="hidden" id="tablename" name="tablename" value="<?=$tablename?>" >
|
||||
<div class="container-fluid">
|
||||
<div class="card mt-2">
|
||||
<div class="card-body">
|
||||
<div class="d-flex mb-3 mt-2 justify-content-center align-items-center">
|
||||
<h4> <?=$title_message?> </h4>
|
||||
<button type="button" class="btn btn-dark btn-sm mx-3" onclick='location.reload();' title="새로고침"> <i class="bi bi-arrow-clockwise"></i> </button>
|
||||
</div>
|
||||
|
||||
<!-- ======================================= -->
|
||||
<!-- (2) 법인카드별 사용 합계 통계 테이블 -->
|
||||
<!-- ======================================= -->
|
||||
<div class="d-flex justify-content-center align-items-center mb-1">
|
||||
<span class="text-success small mx-5"> ✔ 각 열을 누르면 상세내역이 나옵니다. </span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<table class="table table-bordered table-sm text-center w-75" id="cardStatsTable">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>구분</th>
|
||||
<th>카드 전체</th>
|
||||
<?php foreach ($allCardNumbers as $cardNo): ?>
|
||||
<?php if (isset($cardStats[$cardNo]) && $cardStats[$cardNo] > 0): ?>
|
||||
<th class="card-header-clickable" data-card="<?= htmlspecialchars($cardNo) ?>" style="cursor: pointer;"><?= formatCompanyCard($cardNo, $cards) ?></th>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>합계</th>
|
||||
<td><?= number_format($totalCardSum) ?></td>
|
||||
<?php foreach ($allCardNumbers as $cardNo): ?>
|
||||
<?php if (isset($cardStats[$cardNo]) && $cardStats[$cardNo] > 0): ?>
|
||||
<td class="card-data-clickable" data-card="<?= htmlspecialchars($cardNo) ?>" style="cursor: pointer;">
|
||||
<?= number_format($cardStats[$cardNo]) ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="alert alert-primary ms-5 p-2" role="alert">
|
||||
지출결의서 10만원 미만은<br> 결재과정을 생략합니다.
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex mb-1 mt-1 justify-content-center align-items-center">
|
||||
<!-- 기간부터 검색까지 연결 묶음 start -->
|
||||
<span id="showdate" class="btn btn-dark btn-sm " > 기간 </span>
|
||||
<div id="showframe" class="card showextractframe" style="width:500px;">
|
||||
<div class="card-header " style="padding:2px;">
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
기간 설정
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body ">
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<button type="button" class="btn btn-outline-success btn-sm me-1 change_dateRange" onclick='alldatesearch()' > 전체 </button>
|
||||
<button type="button" id="preyear" class="btn btn-outline-primary btn-sm me-1 change_dateRange" onclick='pre_year()'> 전년도 </button>
|
||||
<button type="button" id="three_month" class="btn btn-dark btn-sm me-1 change_dateRange " onclick='three_month_ago()'> M-3월 </button>
|
||||
<button type="button" id="prepremonth" class="btn btn-dark btn-sm me-1 change_dateRange " onclick='prepre_month()'> 전전월 </button>
|
||||
<button type="button" id="premonth" class="btn btn-dark btn-sm me-1 change_dateRange " onclick='pre_month()'> 전월 </button>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm me-1 change_dateRange " onclick='this_today()'> 오늘 </button>
|
||||
<button type="button" id="thismonth" class="btn btn-dark btn-sm me-1 change_dateRange " onclick='this_month()'> 당월 </button>
|
||||
<button type="button" id="thisyear" class="btn btn-dark btn-sm me-1 change_dateRange " onclick='this_year()'> 당해년도 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="date" id="fromdate" name="fromdate" size="12" class="form-control" style="width:100px;" value="<?=$fromdate?>" placeholder="기간 시작일"> ~
|
||||
<input type="date" id="todate" name="todate" size="12" class="form-control" style="width:100px;" value="<?=$todate?>" placeholder="기간 끝"> </span>
|
||||
|
||||
|
||||
<?php if($chkMobile) { ?>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<?php } ?>
|
||||
<div class="inputWrap">
|
||||
<input type="text" id="search" name="search" value="<?=$search?>" autocomplete="off" class="form-control w-auto mx-1" >
|
||||
<button class="btnClear"></button>
|
||||
</div>
|
||||
<div id="autocomplete-list">
|
||||
</div>
|
||||
|
||||
<button type="button" id="searchBtn" class="btn btn-dark btn-sm"> <i class="bi bi-search"></i> </button>
|
||||
<button type="button" class="btn btn-dark btn-sm me-1" id="writeBtn"> <i class="bi bi-pencil-fill"></i> 신규 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover " id="myTable">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th class="text-center" scope="col" style="width:5%;">번호</th>
|
||||
<th class="text-center" scope="col" style="width:120px;">작성일</th>
|
||||
<th class="text-center" scope="col" style="width:120px;">지출요청일</th>
|
||||
<th class="text-center" scope="col" style="width:120px;">결재일</th>
|
||||
<th class="text-center" scope="col">기안자</th>
|
||||
<th class="text-center" scope="col">적요</th>
|
||||
<th class="text-center" scope="col">금액</th>
|
||||
<th class="text-center" scope="col">비고</th>
|
||||
<th class="text-center" scope="col">법인카드</th>
|
||||
<th class="text-center" scope="col">결재완료</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$start_num = $total_row; // 페이지당 표시되는 첫번째 글순번
|
||||
|
||||
while ($row = $stmh->fetch(PDO::FETCH_ASSOC)) {
|
||||
include $_SERVER['DOCUMENT_ROOT'] .'/eworks/_row.php';
|
||||
|
||||
// expense_data JSON 파싱
|
||||
$expense_data = json_decode($expense_data ?? '[]', true);
|
||||
$items = [];
|
||||
$notes = [];
|
||||
$total_amount = 0;
|
||||
|
||||
if (is_array($expense_data)) {
|
||||
foreach ($expense_data as $expense) {
|
||||
if (!empty($expense['expense_item'])) {
|
||||
$items[] = $expense['expense_item'];
|
||||
}
|
||||
if (!empty($expense['expense_note'])) {
|
||||
$notes[] = $expense['expense_note'];
|
||||
}
|
||||
if (!empty($expense['expense_amount'])) {
|
||||
$total_amount += intval(str_replace(',', '', $expense['expense_amount']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 제목 생성 (첫 번째 적요 + 외 N건)
|
||||
$title = '';
|
||||
if (!empty($items)) {
|
||||
if (count($items) > 1) {
|
||||
$title = $items[0] . ' 외 ' . (count($items) - 1) . '건';
|
||||
} else {
|
||||
$title = $items[0];
|
||||
}
|
||||
}
|
||||
|
||||
// 적요와 비고를 콤마로 구분된 문자열로 변환
|
||||
$items_str = implode(', ', $items);
|
||||
$notes_str = implode(', ', $notes);
|
||||
|
||||
echo '<tr style="cursor:pointer;" data-id="'. $num . '" onclick="redirectToView(' . $num . ')">';
|
||||
?>
|
||||
<td class="text-center"><?= $start_num ?></td>
|
||||
<td class="text-center" data-order="<?= $indate ?>"> <?=$indate?> </td>
|
||||
<td class="text-center" data-order="<?= $requestpaymentdate ?>"> <?= $requestpaymentdate ?> </td>
|
||||
<td class="text-center" data-order="<?= $paymentdate ?>"> <?= $paymentdate ?> </td>
|
||||
<td class="text-center"> <?= $author ?> </td>
|
||||
<td class="text-start"><?= $items_str ?></td>
|
||||
<td class="text-end"><?= number_format($total_amount) ?></td>
|
||||
<td class="text-start"><?= $notes_str ?></td>
|
||||
<td class="text-start"><?= formatCompanyCard($companyCard, $cards) ?></td>
|
||||
<td class="text-center">
|
||||
<?= ( ($status === 'end' && !empty($e_confirm)) || empty($e_line_id) ) ? '✅' : '' ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$start_num--;
|
||||
}
|
||||
} catch (PDOException $Exception) {
|
||||
print "오류: ".$Exception->getMessage();
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
var dataTable; // DataTables 인스턴스 전역 변수
|
||||
var requestetcpageNumber; // 현재 페이지 번호 저장을 위한 전역 변수
|
||||
|
||||
// 페이지 로딩
|
||||
$(document).ready(function(){
|
||||
var loader = document.getElementById('loadingOverlay');
|
||||
if(loader)
|
||||
loader.style.display = 'none';
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
// DataTables 초기 설정
|
||||
dataTable = $('#myTable').DataTable({
|
||||
"paging": true,
|
||||
"ordering": true,
|
||||
"searching": true,
|
||||
"pageLength": 50,
|
||||
"lengthMenu": [25, 50, 100, 200, 500, 1000],
|
||||
"language": {
|
||||
"lengthMenu": "Show _MENU_ entries",
|
||||
"search": "Live Search:"
|
||||
},
|
||||
"order": [[0, 'desc']]
|
||||
});
|
||||
|
||||
// 페이지 번호 복원 (초기 로드 시)
|
||||
var savedPageNumber = getCookie('requestetcpageNumber');
|
||||
if (savedPageNumber) {
|
||||
dataTable.page(parseInt(savedPageNumber) - 1).draw(false);
|
||||
}
|
||||
|
||||
// 페이지 변경 이벤트 리스너
|
||||
dataTable.on('page.dt', function() {
|
||||
var requestetcpageNumber = dataTable.page.info().page + 1;
|
||||
setCookie('requestetcpageNumber', requestetcpageNumber, 10); // 쿠키에 페이지 번호 저장
|
||||
});
|
||||
|
||||
// 페이지 길이 셀렉트 박스 변경 이벤트 처리
|
||||
$('#myTable_length select').on('change', function() {
|
||||
var selectedValue = $(this).val();
|
||||
dataTable.page.len(selectedValue).draw(); // 페이지 길이 변경 (DataTable 파괴 및 재초기화 없이)
|
||||
|
||||
// 변경 후 현재 페이지 번호 복원
|
||||
savedPageNumber = getCookie('requestetcpageNumber');
|
||||
if (savedPageNumber) {
|
||||
dataTable.page(parseInt(savedPageNumber) - 1).draw(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function restorePageNumber() {
|
||||
var savedPageNumber = getCookie('requestetcpageNumber');
|
||||
if (savedPageNumber) {
|
||||
dataTable.page(parseInt(savedPageNumber) - 1).draw('page');
|
||||
}
|
||||
}
|
||||
|
||||
function blinker() {
|
||||
$('.blinking').fadeOut(500);
|
||||
$('.blinking').fadeIn(500);
|
||||
}
|
||||
setInterval(blinker, 1000);
|
||||
|
||||
$(document).ready(function() {
|
||||
// Event listener for keydown on #search
|
||||
$("#search").keydown(function(event) {
|
||||
// Check if the pressed key is 'Enter'
|
||||
if (event.key === "Enter" || event.keyCode === 13) {
|
||||
// Prevent the default action to stop form submission
|
||||
event.preventDefault();
|
||||
// Trigger click event on #searchBtn
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
// 자재현황 클릭시
|
||||
$("#rawmaterialBtn").click(function(){
|
||||
popupCenter('/ceiling/list_part_table.php?menu=no' , '부자재현황보기', 1050, 950);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#writeBtn").click(function(){
|
||||
var tablename = $("#tablename").val();
|
||||
var url = "write_form.php?tablename=" + tablename ;
|
||||
customPopup(url, '등록', 800, 800);
|
||||
});
|
||||
$("#searchBtn").click(function() {
|
||||
// 페이지 번호를 1로 설정
|
||||
currentpageNumber = 1;
|
||||
setCookie('currentpageNumber', currentpageNumber, 10); // 쿠키에 페이지 번호 저장
|
||||
|
||||
// Set dateRange to '전체' and trigger the change event
|
||||
$('#dateRange').val('전체').change();
|
||||
document.getElementById('board_form').submit();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function redirectToView(num) {
|
||||
var tablename = $("#tablename").val();
|
||||
|
||||
var url = "write_form.php?mode=view&num=" + num
|
||||
+ "&tablename=" + tablename;
|
||||
customPopup(url, '', 800, 800);
|
||||
}
|
||||
|
||||
function restorePageNumber() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
// 서버에 작업 기록
|
||||
$(document).ready(function(){
|
||||
saveLogData('<?=$title_message?>'); // 다른 페이지에 맞는 menuName을 전달
|
||||
});
|
||||
|
||||
// 카드 통계 테이블 클릭 이벤트
|
||||
$(document).ready(function() {
|
||||
// 카드 헤더 클릭 이벤트
|
||||
$(document).on('click', '.card-header-clickable', function() {
|
||||
var cardNo = $(this).data('card');
|
||||
openCardDetailPopup(cardNo);
|
||||
});
|
||||
|
||||
// 카드 데이터 클릭 이벤트
|
||||
$(document).on('click', '.card-data-clickable', function() {
|
||||
var cardNo = $(this).data('card');
|
||||
openCardDetailPopup(cardNo);
|
||||
});
|
||||
});
|
||||
|
||||
function openCardDetailPopup(cardNo) {
|
||||
var url = "card_detail.php?card=" + encodeURIComponent(cardNo) + "&fromdate=<?= $fromdate ?>&todate=<?= $todate ?>";
|
||||
popupCenter(url, '카드상세내역', 1200, 800);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
40
askitem_ER_juil/request.php
Normal file
40
askitem_ER_juil/request.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$num=$_REQUEST["num"] ?? '';
|
||||
$outdate=$_REQUEST["outdate"] ?? '';
|
||||
$registdate = $_REQUEST["registdate"] ?? '';
|
||||
$requestdate=$_REQUEST["requestdate"] ?? '';
|
||||
|
||||
$indate=$_REQUEST["indate"] ?? '';
|
||||
$outworkplace=$_REQUEST["outworkplace"] ?? '';
|
||||
|
||||
$steel_item=$_REQUEST["steel_item"] ?? '';
|
||||
$spec=$_REQUEST["spec"] ?? '';
|
||||
$steelnum=$_REQUEST["steelnum"] ?? '';
|
||||
$company=$_REQUEST["company"] ?? '';
|
||||
$supplier=$_REQUEST["supplier"] ?? '';
|
||||
$payment=$_REQUEST["payment"] ?? '';
|
||||
|
||||
$request_comment=$_REQUEST["request_comment"] ?? '';
|
||||
$which=$_REQUEST["which"] ?? '';
|
||||
$model=$_REQUEST["model"] ?? '';
|
||||
$first_writer=$_REQUEST["first_writer"] ?? '';
|
||||
$update_log=$_REQUEST["update_log"] ?? '';
|
||||
$suppliercost=$_REQUEST["suppliercost"] ?? '';
|
||||
$inventory=$_REQUEST["inventory"] ?? '';
|
||||
$status=$_REQUEST["status"] ?? '';
|
||||
|
||||
$author_id = $_REQUEST["author_id"] ?? ''; // Corrected to match the key in $_REQUEST array
|
||||
$author = $_REQUEST["author"] ?? '';
|
||||
$al_part = $_REQUEST["al_part"] ?? '';
|
||||
$al_item = $_REQUEST["al_item"] ?? '';
|
||||
$al_askdatefrom = $_REQUEST["al_askdatefrom"] ?? '';
|
||||
$al_askdateto = $_REQUEST["al_askdateto"] ?? '';
|
||||
$al_usedday = $_REQUEST["al_usedday"] ?? '';
|
||||
$al_content = $_REQUEST["al_content"] ?? '';
|
||||
$status = $_REQUEST["status"] ?? '';
|
||||
$e_confirm = $_REQUEST["e_confirm"] ?? '';
|
||||
$e_confirm_id = $_REQUEST["e_confirm_id"] ?? '';
|
||||
$al_company = $_REQUEST["al_company"] ?? '';
|
||||
$done = $_REQUEST["done"] ?? ''; // 결재완료 여부
|
||||
?>
|
||||
1555
askitem_ER_juil/write_form.php
Normal file
1555
askitem_ER_juil/write_form.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user