- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
100 lines
4.8 KiB
PHP
100 lines
4.8 KiB
PHP
<?php
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
|
|
|
$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
|
|
$num = isset($_POST['num']) ? $_POST['num'] : '';
|
|
|
|
$tablename = 'lot_sales';
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
$pdo = db_connect();
|
|
|
|
if ($mode === 'update' && $num) {
|
|
try {
|
|
$sql = "SELECT * FROM ". $DB . "." . $tablename . " WHERE num=?";
|
|
$stmh = $pdo->prepare($sql);
|
|
$stmh->bindValue(1, $num, PDO::PARAM_INT);
|
|
$stmh->execute();
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
|
|
|
include '_row.php';
|
|
} catch (PDOException $Exception) {
|
|
echo "오류: ".$Exception->getMessage();
|
|
exit;
|
|
}
|
|
} else {
|
|
include '_request.php';
|
|
$mode = 'insert';
|
|
$reg_date = date('Y-m-d');
|
|
$author = $user_name;
|
|
$workplacename = '';
|
|
$num = '';
|
|
}
|
|
|
|
$title_message = ($mode === 'update') ? 'LOT 번호 수정' : 'LOT 번호 신규 등록';
|
|
?>
|
|
|
|
<input type="hidden" id="update_log" name="update_log" value="<?=$update_log?>">
|
|
|
|
<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">
|
|
<div class="d-flex align-items-center justify-content-center m-2">
|
|
<table class="table table-bordered">
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center fs-6 fw-bold" style="width:150px;">등록일</td>
|
|
<td class="text-center" style="width:200px;">
|
|
<input type="date" class="form-control fs-6" id="reg_date" name="reg_date" value="<?=$reg_date?>">
|
|
</td>
|
|
<td class="text-center fs-6 fw-bold" style="width:150px;">작성자</td>
|
|
<td class="text-center" style="width:200px;">
|
|
<div class="d-flex">
|
|
<input class="form-control fs-6" id="author" name="author" value="<?=$author?>" autocomplete="off">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fs-6 fw-bold" style="width:150px;">LOT 번호</td>
|
|
<td colspan="3" class="text-center" >
|
|
<input type="text" class="form-control fs-6 text-start" id="lot_number" name="lot_number" value="<?=$lot_number?>" autocomplete="off">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fs-6 fw-bold" style="width:150px;">현장명</td>
|
|
<td colspan="3" class="text-center" >
|
|
<input type="text" class="form-control fs-6 text-start" id="workplacename" name="workplacename" value="<?=$workplacename?>" autocomplete="off">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fs-6 fw-bold" style="width:150px;">비고</td>
|
|
<td colspan="3" class="text-center" >
|
|
<input type="text" class="form-control fs-6 text-start" id="remark" name="remark" value="<?=$remark?>" autocomplete="off">
|
|
</td>
|
|
</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>
|
|
<?php if($mode != 'insert') { ?>
|
|
<button type="button" id="deleteBtn" class="btn btn-danger btn-sm me-3">
|
|
<ion-icon name="trash-outline"></ion-icon> 삭제
|
|
</button>
|
|
<?php } ?>
|
|
<button type="button" id="closeBtn" class="btn btn-outline-dark btn-sm me-2">
|
|
<ion-icon name="close-circle-outline"></ion-icon> 닫기
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|