Files
sam-kd/lot/fetch_modal.php
hskwon aca1767eb9 초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경
- DB 연결 하드코딩 → .env 기반으로 변경
- MySQL strict mode DATE 오류 수정
2025-12-10 20:14:31 +09:00

170 lines
7.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
$num = isset($_POST['num']) ? $_POST['num'] : '';
$tablename = 'lot';
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;
$num = '';
}
// echo '<pre>';
// print_r($row);
// echo '</pre>';
$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 noborder-input" 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 noborder-input" 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 noborder-input" id="lot_number" name="lot_number" value="<?=$lot_number?>" autocomplete="off" readonly>
</td>
</tr>
<tr>
<td class="text-center fs-6 fw-bold" style="width:150px;">품목명</td>
<td class="text-center">
<select class="form-control fs-6" id="prod" name="prod">
<option value="" disabled <?= empty($prod) ? 'selected' : '' ?>>품목 선택</option>
<option value="G" <?= ($prod === 'G') ? 'selected' : '' ?>>연기차단재</option>
<option value="B" <?= ($prod === 'B') ? 'selected' : '' ?>>하단마감재(스크린)</option>
<option value="T" <?= ($prod === 'T') ? 'selected' : '' ?>>하단마감재(철재)</option>
<option value="L" <?= ($prod === 'L') ? 'selected' : '' ?>>L - Bar</option>
<option value="R" <?= ($prod === 'R') ? 'selected' : '' ?>>가이드레일(벽면형)</option>
<option value="S" <?= ($prod === 'S') ? 'selected' : '' ?>>가이드레일(측면형)</option>
<option value="C" <?= ($prod === 'C') ? 'selected' : '' ?>>케이스</option>
</select>
</td>
<td class="text-center fs-6 fw-bold" style="width:150px;">종류</td>
<td class="text-center">
<select class="form-control fs-6" id="spec" name="spec">
<option value="" disabled <?= empty($spec) ? 'selected' : '' ?>>종류 선택</option>
<option value="I" <?= ($spec === 'I') ? 'selected' : '' ?>>화이바원단</option>
<option value="S" <?= ($spec === 'S') ? 'selected' : '' ?>>SUS(마감)</option>
<option value="U" <?= ($spec === 'U') ? 'selected' : '' ?>>SUS(마감)2</option>
<option value="E" <?= ($spec === 'E') ? 'selected' : '' ?>>EGI(마감)</option>
<option value="A" <?= ($spec === 'A') ? 'selected' : '' ?>>스크린용</option>
<option value="D" <?= ($spec === 'D') ? 'selected' : '' ?>>D형</option>
<option value="C" <?= ($spec === 'C') ? 'selected' : '' ?>>C형</option>
<option value="M" <?= ($spec === 'M') ? 'selected' : '' ?>>본체</option>
<option value="T" <?= ($spec === 'T') ? 'selected' : '' ?>>본체(철재)</option>
<option value="B" <?= ($spec === 'B') ? 'selected' : '' ?>>후면코너부</option>
<option value="L" <?= ($spec === 'L') ? 'selected' : '' ?>>린텔부</option>
<option value="P" <?= ($spec === 'P') ? 'selected' : '' ?>>점검구</option>
<option value="F" <?= ($spec === 'F') ? 'selected' : '' ?>>전면부</option>
</select>
</td>
</tr>
<tr>
<td class="text-center fs-6 fw-bold" style="width:150px;">모양&길이</td>
<td class="text-center">
<select class="form-control fs-6" id="slength" name="slength">
<option value="" disabled <?= empty($slength) ? 'selected' : '' ?>>모양&길이 선택</option>
<option value="53" <?= ($slength === '53') ? 'selected' : '' ?>>W50 × 3000</option>
<option value="54" <?= ($slength === '54') ? 'selected' : '' ?>>W50 × 4000</option>
<option value="83" <?= ($slength === '83') ? 'selected' : '' ?>>W80 × 3000</option>
<option value="84" <?= ($slength === '84') ? 'selected' : '' ?>>W80 × 4000</option>
<option value="12" <?= ($slength === '12') ? 'selected' : '' ?>>1219</option>
<option value="24" <?= ($slength === '24') ? 'selected' : '' ?>>2438</option>
<option value="30" <?= ($slength === '30') ? 'selected' : '' ?>>3000</option>
<option value="35" <?= ($slength === '35') ? 'selected' : '' ?>>3500</option>
<option value="40" <?= ($slength === '40') ? 'selected' : '' ?>>4000</option>
<option value="41" <?= ($slength === '41') ? 'selected' : '' ?>>4150</option>
<option value="42" <?= ($slength === '42') ? 'selected' : '' ?>>4200</option>
<option value="43" <?= ($slength === '43') ? 'selected' : '' ?>>4300</option>
</select>
</td>
<td class="text-center fs-6 fw-bold" style="width:150px;">수량</td>
<td class="text-center">
<input type="text" class="form-control fs-6 text-start noborder-input" id="surang" name="surang" value="<?=$surang?>" autocomplete="off">
</td>
</tr>
<tr>
<td class="text-center fs-6 fw-bold" style="width:150px;">원자재(철판) LOT</td>
<td colspan="1" class="text-center">
<input type="text" class="form-control fs-6 text-start noborder-input lotnumInput" id="rawLot" name="rawLot" value="<?=$rawLot?>" autocomplete="off" >
</td>
<td class="text-center fs-6 text-danger" style="width:150px;">원단 LOT <br> (연기차단재)</td>
<td colspan="1" class="text-center">
<input type="text" class="form-control fs-6 text-start text-danger noborder-input lotnumInput_fabric" id="fabric_lot" name="fabric_lot" value="<?=$fabric_lot?>" 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 noborder-input" 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">
<i class="bi bi-floppy-fill"></i> 저장
</button>
<?php if($mode != 'insert') { ?>
<button type="button" id="deleteBtn" class="btn btn-danger btn-sm me-3">
<i class="bi bi-trash"></i> 삭제
</button>
<?php } ?>
<button type="button" id="closeBtn" class="btn btn-outline-dark btn-sm me-2">
&times; 닫기
</button>
</div>
</div>
</div>
</div>
</div>