- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
263 lines
13 KiB
PHP
263 lines
13 KiB
PHP
<?php include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
|
|
// 수주내역에서 거래명세표 표시
|
|
$selectWork = '거래명세표';
|
|
?>
|
|
<title> <?=$title_message?> </title>
|
|
<link rel="stylesheet" href="css/style.css?v=<?=time()?>">
|
|
</head>
|
|
<body>
|
|
<?php
|
|
$num = isset($_REQUEST['num']) ? $_REQUEST['num'] : '';
|
|
// echo 'num: ' . $num . '<br>';
|
|
// echo 'DB: ' . $DB . '<br>';
|
|
// echo 'tablename: ' . $tablename . '<br>';
|
|
$option = isset($_REQUEST['option']) ? $_REQUEST['option'] : 'option'; // 기본 option 견적서와 산출서의 다른점을 표현하는 것
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/lib/mydb.php");
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/estimate/fetch_unitprice.php");
|
|
$pdo = db_connect();
|
|
try {
|
|
$sql = "select * from {$DB}.{$tablename} where num = ? ";
|
|
$stmh = $pdo->prepare($sql);
|
|
$stmh->bindValue(1, $num, PDO::PARAM_STR);
|
|
$stmh->execute();
|
|
$count = $stmh->rowCount();
|
|
if ($count < 1) {
|
|
print "검색결과가 없습니다.<br>";
|
|
} else {
|
|
$row = $stmh->fetch(PDO::FETCH_ASSOC);
|
|
include $_SERVER['DOCUMENT_ROOT'] . "/output/_row.php";
|
|
|
|
// output_extra 불러오기
|
|
$sql_extra = "SELECT * FROM {$DB}.output_extra WHERE parent_num = ?";
|
|
$stmh_extra = $pdo->prepare($sql_extra);
|
|
$stmh_extra->bindValue(1, $num, PDO::PARAM_STR);
|
|
$stmh_extra->execute();
|
|
$row_extra = $stmh_extra->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($row_extra) {
|
|
include $_SERVER['DOCUMENT_ROOT'] . "/output/_row_extra.php";
|
|
}
|
|
|
|
// echo '<pre> ';
|
|
// print_r($estimateSlatList);
|
|
// echo '</pre>';
|
|
}
|
|
} catch (PDOException $Exception) {
|
|
print "오류: " . $Exception->getMessage();
|
|
}
|
|
// JSON 문자열을 PHP 배열로 디코딩합니다.
|
|
if($major_category == '스크린')
|
|
// $decodedEstimateList = json_decode($estimateList, true); // 견적서의 표현
|
|
$decodedEstimateList = json_decode($estimateList, true);
|
|
if($major_category == '철재')
|
|
//$decodedEstimateList = json_decode($estimateSlatList, true); // 견적서의 표현
|
|
$decodedEstimateList = json_decode($estimateSlatList, true);
|
|
|
|
// 디코딩된 데이터가 배열인지 확인합니다.
|
|
if (!is_array($decodedEstimateList)) {
|
|
echo "데이터가 정상적이지 않습니다. 확인바랍니다.";
|
|
exit;
|
|
}
|
|
|
|
echo '<script>';
|
|
echo 'var dataList = ' . json_encode($detailJson ?? []) . ';';
|
|
echo '</script>';
|
|
|
|
$shutterboxMsg ='';
|
|
|
|
// print 'ET_total : ' . $ET_total;
|
|
|
|
?>
|
|
|
|
<form id="board_form" name="board_form" method="post" enctype="multipart/form-data">
|
|
<input type="hidden" id="mode" name="mode" value="<?= isset($mode) ? $mode : '' ?>">
|
|
<input type="hidden" id="num" name="num" value="<?= isset($num) ? $num : '' ?>">
|
|
<input type="hidden" id="user_name" name="user_name" value="<?= isset($user_name) ? $user_name : '' ?>">
|
|
<input type="hidden" id="update_log" name="update_log" value="<?= isset($update_log) ? $update_log : null ?>">
|
|
<input type="hidden" id="tablename" name="tablename" value="<?= isset($tablename) ? $tablename : '' ?>">
|
|
<input type="hidden" id="header" name="header" value="<?= isset($header) ? $header : '' ?>">
|
|
<input type="hidden" id="detailJson" name="detailJson"> <!-- 라디오버튼 저장하려면 두개의 변수가 필요하다. -->
|
|
<input type="hidden" id="estimateSurang" name="estimateSurang" value="<?= isset($estimateSurang) ? $estimateSurang : '' ?>"> <!-- 견적가 수량 -->
|
|
<input type="hidden" id="estimateTotal" name="estimateTotal" value="<?= isset($estimateTotal) ? $estimateTotal : '' ?>"> <!-- 인정제품 금액 -->
|
|
<input type="hidden" id="ET_unapproved" name="ET_unapproved" value="<?= isset($ET_unapproved) ? $ET_unapproved : '' ?>"> <!-- 비인정제품 금액 -->
|
|
<input type="hidden" id="ET_total" name="ET_total" value="<?= isset($ET_total) ? $ET_total : '' ?>"> <!-- 총 금액 -->
|
|
<input type="hidden" id="option" name="option" value="<?= isset($option) ? $option : '' ?>">
|
|
|
|
<div class="container mt-2">
|
|
<div class="d-flex align-items-center justify-content-end mt-3 m-1 mb-4">
|
|
<span class="badge bg-secondary me-5 fs-5"> ( <?=$major_category?> 거래명세표) </span>
|
|
<input type="checkbox" id="showlistCheckbox" <?php echo ($option == 'option') ? '' : ''; ?>>
|
|
<label for="showlistCheckbox" class="me-3">소요자재 </label>
|
|
<input type="checkbox" id="showEstimateCheckbox" <?php echo ($option == 'option') ? '' : ''; ?>>
|
|
<label for="showEstimateCheckbox" class="me-3">산출내역서</label>
|
|
<input type="checkbox" id="showVendorCheckbox" <?php echo ($option == 'option') ? 'checked' : ''; ?>>
|
|
<label for="showVendorCheckbox" class="me-3">업체발송용</label>
|
|
|
|
<button type="button" class="btn btn-danger btn-sm me-1 ms-1 initialBtn" > <i class="bi bi-arrow-clockwise"></i> 재계산 </button>
|
|
<button type="button" class="btn btn-dark btn-sm ms-1 me-1 saveBtn" > <i class="bi bi-floppy"></i> 산출내역 저장 </button>
|
|
<button type="button" class="btn btn-dark btn-sm ms-1 me-1" onclick="generatePDF()"> PDF 저장 </button>
|
|
<button type="button" class="btn btn-dark btn-sm me-1" onclick="sendmail();"> <i class="bi bi-envelope-arrow-up"></i> 전송 </button>
|
|
<button type="button" class="btn btn-secondary btn-sm ms-5" onclick="self.close();"> × 닫기 </button>
|
|
</div>
|
|
<br>
|
|
<div class="row">
|
|
<div class="col-5">
|
|
<div class="d-flex align-items-center justify-content-center mt-2 mb-0">
|
|
<div class="alert alert-primary mb-2" role="alert">
|
|
검사비는 제주도를 제외하고, 5만원으로 수정, <br> '산출내역 저장'버튼을 누른 후 저장해야 금액이 확정됩니다.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-7">
|
|
<div class="d-flex align-items-center justify-content-end mt-0">
|
|
<table class="table table-bordered mt-0 text-end">
|
|
<thead >
|
|
<tr>
|
|
<th colspan="6" class="text-end">
|
|
<div class="d-flex align-items-center justify-content-end">
|
|
<span class="mx-5"></span>할인율 적용</span>
|
|
<input type="text" id="EstimateDiscountRate" name="EstimateDiscountRate" class="form-control text-end w100px"
|
|
value="<?= isset($EstimateDiscountRate) ? $EstimateDiscountRate : '' ?>">
|
|
%
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th colspan="6" class="text-end">
|
|
<span class="text-danger me-5"> 💬 수정금액이 있으면 자동금액보다 수정금액이 우선됨.</span>
|
|
<span class="text-danger"> (VAT포함)</span>
|
|
</th>
|
|
</tr>
|
|
<tr class="table-secondary">
|
|
<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>
|
|
<th class="text-center">최종 결정금액</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<input type="text" id="EstimateFirstSum" name="EstimateFirstSum" class="form-control text-end" readonly
|
|
value="<?= isset($EstimateFirstSum) && $EstimateFirstSum != 0 ? number_format($EstimateFirstSum) : $EstimateFirstSum ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" id="EstimateUpdatetSum" name="EstimateUpdatetSum" class="form-control text-end text-primary" readonly
|
|
value="<?= isset($EstimateUpdatetSum) && $EstimateUpdatetSum != 0 ? number_format($EstimateUpdatetSum) : $EstimateUpdatetSum ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" id="EstimateDiffer" name="EstimateDiffer" class="form-control text-end text-danger" readonly
|
|
value="<?= isset($EstimateDiffer) && $EstimateDiffer != 0 ? number_format($EstimateDiffer) : $EstimateDiffer ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" id="EstimateFixAmount" name="EstimateFixAmount" class="form-control text-end text-dark" readonly
|
|
value="<?= isset($EstimateFixAmount) && $EstimateFixAmount != 0 ? number_format($EstimateFixAmount) : $EstimateFixAmount ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" id="EstimateDiscount" name="EstimateDiscount" class="form-control text-end text-primary" readonly
|
|
value="<?= isset($EstimateDiscount) && $EstimateDiscount != 0 ? number_format($EstimateDiscount) : $EstimateDiscount ?>">
|
|
</td>
|
|
<td>
|
|
<input type="text" id="EstimateFinalSum" name="EstimateFinalSum" class="form-control text-end fw-bold text-success" readonly
|
|
value="<?= isset($EstimateFinalSum) && $EstimateFinalSum != 0 ? number_format($EstimateFinalSum) : $EstimateFinalSum ?>">
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<div id="content-to-print">
|
|
<br>
|
|
<div class="container mt-1">
|
|
<div class="d-flex align-items-center justify-content-center ">
|
|
<table class="table table-sm" style="border-collapse: collapse;">
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center align-middle fw-bold fs-4" style="border-top:none; border-bottom:none;" >
|
|
<?php
|
|
if($option!=='option')
|
|
echo '<span class="text-dark"> ' . $title_message . ' </span> </td>'; // <span id="updateText" class="text-danger"> </span>
|
|
else
|
|
echo '<span class="text-dark"> ' . $title_message_sub . ' </span> </td>';
|
|
?>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="d-flex align-items-center justify-content-center ">
|
|
<table class="table" style="border-collapse: collapse;">
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center fw-bold yellowBold " style="width:10%;">업체명</td>
|
|
<td class="text-center yellowBold " style="width:40%;"> <?=$secondord?> (귀하) </td>
|
|
<td rowspan="5" class="text-center align-middle fw-bold" style="width:5%; border-top:none; border-bottom:none;" >공 급 자</td>
|
|
<td class="text-center fw-bold lightgray " > 상호 </td>
|
|
<td class="text-center fw-bold" colspan="3" >㈜ 경동기업 </td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">제품명</td>
|
|
<td class="text-center" > <?=$subTitle?> </td>
|
|
<td class="text-center fw-bold lightgray " style="width:10%;" >등록번호</td>
|
|
<td class="text-center" style="width:10%;"> 139-87-00333 </td>
|
|
<td class="text-center fw-bold lightgray " >대표자</td>
|
|
<td class="text-center fw-bold">
|
|
<div class="d-flex align-items-center justify-content-center ">
|
|
이 경 호
|
|
<!-- <img src="../img/daehanstamp.png" alt="도장" style="width:45px; height:45px;"> -->
|
|
</div>
|
|
</td>
|
|
<tr>
|
|
<td class="text-center fw-bold">현장명</td>
|
|
<td class="text-center fw-bold" > <?=$outworkplace?></td>
|
|
<td class="text-center fw-bold lightgray " > 사업장주소 </td>
|
|
<td colspan="3" class="text-center"> 경기도 김포시 통진읍 옹정로 45-22</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">담당자</td>
|
|
<td class="text-center"><?=$secondordman?></td>
|
|
<td class="text-center fw-bold lightgray " > 업 태 </td>
|
|
<td class="text-center" > 제조업 </td>
|
|
<td class="text-center fw-bold lightgray " >종목</td>
|
|
<td class="text-center" > 방화셔터, 금속창호 </td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center fw-bold">연락처</td>
|
|
<td class="text-center"><?=$secondordmantel?></td>
|
|
<td class="text-center fw-bold lightgray " > TEL. </td>
|
|
<td class="text-center" > 031-983-5130</td>
|
|
<td class="text-center fw-bold lightgray " > FAX </td>
|
|
<td class="text-center" > 02-6911-6315 </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="d-flex align-items-center justify-content-center ">
|
|
<table class="table" style="border-collapse: collapse;">
|
|
<tbody>
|
|
<tr>
|
|
<!-- <td class="text-center fw-bold" style="width:250px;" >
|
|
합계 금액(VAT포함) <br>
|
|
아래와 같이 계산합니다.
|
|
</td>
|
|
<td class="text-center align-middle fs-6 fw-bold" style="width:50px;"> 금 </td>
|
|
<td rowspan="5" class="text-end align-middle fw-bold fs-6" style="width:500px;" > <span id="koreantotalsum"> </span> </td>
|
|
<td class="text-center fw-bold align-middle fs-6" style="width:50px;" > 원 </td>
|
|
<td class="align-middle text-end fs-6 fw-bold" style="width:250px;"> ( ₩ <span id="totalsum"> </span> )</td> -->
|
|
|
|
<td colspan="3" class="align-middle text-end fs-6 fw-bold" style="width:250px;"> ( ₩ <span id="totalsum"> </span> )
|
|
<!-- 거래명세표는 VAT 포함) -->
|
|
<span class="text-danger"> (VAT 포함) </span>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|