- 견적/주문서/판매관리 전 페이지 금액 필드 소수점 2자리 + 천단위 콤마 표시 - parseInt → parseFloat, Math.round 제거로 소수점 계산 정확성 확보 - estimateTemplate1 fn_save() 소수점 제거 버그 수정 (/[^0-9]/g → /[^0-9.]/g) - contractMgmt.xml, salesNcollectMgmt.xml VARCHAR→NUMERIC CAST 시 REPLACE 안전 처리 - EST_TOTAL_AMOUNT_KRW 환율 변경 시 동적 재계산 (SQL 쿼리 수정) Made-with: Cursor
382 lines
10 KiB
Plaintext
382 lines
10 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|
<%@ page import="com.pms.common.utils.*"%>
|
|
<%@ page import="java.util.*" %>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
|
<%@include file="/init.jsp"%>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>주문서</title>
|
|
<style>
|
|
@media print {
|
|
body { margin: 0; padding: 10px; }
|
|
.no-print { display: none !important; }
|
|
}
|
|
body {
|
|
margin: 0;
|
|
padding: 15px 20px;
|
|
font-family: '맑은 고딕', 'Malgun Gothic', sans-serif;
|
|
font-size: 12px;
|
|
background: #fff;
|
|
}
|
|
.order-wrap {
|
|
max-width: 860px;
|
|
margin: 0 auto;
|
|
}
|
|
.order-title {
|
|
text-align: center;
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
letter-spacing: 25px;
|
|
padding: 10px 0 8px 0;
|
|
border-bottom: 2px solid #000;
|
|
margin-bottom: 3px;
|
|
}
|
|
.header-row {
|
|
font-size: 11px;
|
|
padding: 2px 0;
|
|
}
|
|
/* 공통 테이블 */
|
|
table.doc-tbl {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
table-layout: fixed;
|
|
}
|
|
table.doc-tbl td, table.doc-tbl th {
|
|
border: 1px solid #000;
|
|
padding: 2px 4px;
|
|
font-size: 11px;
|
|
vertical-align: middle;
|
|
word-break: break-all;
|
|
}
|
|
table.doc-tbl .vl {
|
|
text-align: center;
|
|
font-weight: bold;
|
|
background-color: #e8faff;
|
|
font-size: 12px;
|
|
letter-spacing: 5px;
|
|
}
|
|
table.doc-tbl .lbl {
|
|
text-align: center;
|
|
font-weight: bold;
|
|
background-color: #e8faff;
|
|
font-size: 11px;
|
|
letter-spacing: 3px;
|
|
}
|
|
/* 품목 테이블 */
|
|
table.item-tbl {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
table.item-tbl th {
|
|
border: 1px solid #000;
|
|
padding: 3px 4px;
|
|
background-color: #e8faff;
|
|
text-align: center;
|
|
font-size: 11px;
|
|
font-weight: bold;
|
|
}
|
|
table.item-tbl td {
|
|
border: 1px solid #000;
|
|
padding: 2px 4px;
|
|
font-size: 11px;
|
|
}
|
|
.tc { text-align: center; }
|
|
.tr { text-align: right; }
|
|
.total-row td {
|
|
background-color: #fff8dc;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
padding: 3px 4px;
|
|
}
|
|
.btn-area {
|
|
text-align: center;
|
|
margin-top: 12px;
|
|
}
|
|
.btn-area button {
|
|
padding: 5px 18px;
|
|
margin: 0 4px;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
border: 1px solid #999;
|
|
border-radius: 2px;
|
|
background: #fff;
|
|
}
|
|
.btn-area button.btn-print {
|
|
background-color: #3085d6;
|
|
color: white;
|
|
border-color: #3085d6;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="order-wrap" id="orderContainer">
|
|
<!-- 제목 -->
|
|
<div class="order-title">주 문 서</div>
|
|
|
|
<!-- 주문일자 / 증빙번호 -->
|
|
<div class="header-row">주문일자 : <span id="orderDate"></span></div>
|
|
<div class="header-row">증빙번호 : <span id="poNo"></span></div>
|
|
|
|
<!-- 발주자 / 공급자 -->
|
|
<table class="doc-tbl" style="margin-top:2px;">
|
|
<colgroup>
|
|
<col style="width:28px;"><!-- 발주자 세로 -->
|
|
<col style="width:62px;"><!-- 라벨 -->
|
|
<col><!-- 값1 -->
|
|
<col style="width:45px;"><!-- 성명/종목 라벨 -->
|
|
<col style="width:70px;"><!-- 값2 -->
|
|
<col style="width:28px;"><!-- 공급자 세로 -->
|
|
<col style="width:62px;"><!-- 라벨 -->
|
|
<col><!-- 값1 -->
|
|
<col style="width:45px;"><!-- 성명/종목 라벨 -->
|
|
<col style="width:90px;"><!-- 값2 -->
|
|
</colgroup>
|
|
<tr>
|
|
<td rowspan="4" class="vl" style="writing-mode:vertical-rl;">공급받는자</td>
|
|
<td class="lbl">등록번호</td>
|
|
<td colspan="3" id="clientBusRegNo"></td>
|
|
<td rowspan="4" class="vl" style="writing-mode:vertical-rl;">공 급 자</td>
|
|
<td class="lbl">등록번호</td>
|
|
<td colspan="3">314-81-75146</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lbl">상 호</td>
|
|
<td id="clientNm"></td>
|
|
<td class="lbl">성명</td>
|
|
<td id="clientCeoNm"></td>
|
|
<td class="lbl">상 호</td>
|
|
<td>주식회사알피에스본사</td>
|
|
<td class="lbl">성명</td>
|
|
<td>이동헌</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lbl">주 소</td>
|
|
<td colspan="3" id="clientAddr"></td>
|
|
<td class="lbl">주 소</td>
|
|
<td colspan="3">대전광역시 유성구 국제과학10로 8(둔곡동)</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lbl">업 태</td>
|
|
<td id="clientBusType"></td>
|
|
<td class="lbl">종목</td>
|
|
<td id="clientBusItem"></td>
|
|
<td class="lbl">업 태</td>
|
|
<td>제조업</td>
|
|
<td class="lbl">종목</td>
|
|
<td style="font-size:9px;">금속절삭가공기계,반도체제조용기계</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<!-- 납품처 / 담당자 -->
|
|
<table class="doc-tbl" style="margin-top:-1px;">
|
|
<colgroup>
|
|
<col style="width:70px;">
|
|
<col>
|
|
<col style="width:70px;">
|
|
<col style="width:130px;">
|
|
<col style="width:70px;">
|
|
<col style="width:130px;">
|
|
</colgroup>
|
|
<tr>
|
|
<td class="lbl">납 품 처</td>
|
|
<td id="deliveryPlace"></td>
|
|
<td class="lbl">전화번호</td>
|
|
<td id="clientTelNo"></td>
|
|
<td class="lbl">팩스번호</td>
|
|
<td id="clientFaxNo"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lbl">주 소</td>
|
|
<td id="deliveryAddr"></td>
|
|
<td class="lbl">담 당 자</td>
|
|
<td id="writerName"></td>
|
|
<td class="lbl">C.P.번호</td>
|
|
<td id="writerContact"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<!-- 품목 테이블 -->
|
|
<table class="item-tbl" style="margin-top:-1px;">
|
|
<colgroup>
|
|
<col style="width:32px;">
|
|
<col style="width:85px;">
|
|
<col>
|
|
<col>
|
|
<col style="width:38px;">
|
|
<col style="width:78px;">
|
|
<col style="width:48px;">
|
|
<col style="width:68px;">
|
|
<col style="width:78px;">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>No.</th>
|
|
<th>품번</th>
|
|
<th>품명</th>
|
|
<th>규격</th>
|
|
<th>단위</th>
|
|
<th>납기일</th>
|
|
<th>수량</th>
|
|
<th>단가</th>
|
|
<th>금액</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="itemBody">
|
|
</tbody>
|
|
<tfoot>
|
|
<tr class="total-row">
|
|
<td colspan="9" style="text-align:center; background-color:#ffffcc; font-weight:bold; letter-spacing:8px;">합 계</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="6" class="tc" style="font-weight:bold;"></td>
|
|
<td class="tr" id="totalQty" style="font-weight:bold;"></td>
|
|
<td class="tr"></td>
|
|
<td class="tr" id="totalSupplyPrice" style="font-weight:bold;"></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
<!-- 비고 (합계 요약) -->
|
|
<table class="doc-tbl" style="margin-top:-1px;">
|
|
<colgroup>
|
|
<col style="width:40px;">
|
|
<col>
|
|
<col style="width:120px;">
|
|
<col style="width:150px;">
|
|
</colgroup>
|
|
<tr>
|
|
<td rowspan="3" class="vl" style="writing-mode:vertical-rl; letter-spacing:8px; font-size:13px;">비 고</td>
|
|
<td rowspan="3"></td>
|
|
<td class="lbl" style="letter-spacing:2px;">공 급 가 액 합 계</td>
|
|
<td class="tr" id="summarySupply"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lbl" style="letter-spacing:2px;">부 가 가 치 세</td>
|
|
<td class="tr" id="summaryVat"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="lbl" style="letter-spacing:5px;">총 계</td>
|
|
<td class="tr" id="summaryTotal" style="font-weight:bold;"></td>
|
|
</tr>
|
|
</table>
|
|
<!-- 하단 부가세 구분 + 날짜 -->
|
|
<div style="display:flex; justify-content:space-between; padding:3px 5px; font-size:11px; border:1px solid #000; border-top:none;">
|
|
<span id="vatNote"></span>
|
|
<span id="regDatetime"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="btn-area no-print">
|
|
<button class="btn-print" onclick="window.print();">인쇄</button>
|
|
<button onclick="window.close();">닫기</button>
|
|
</div>
|
|
|
|
<script>
|
|
var objId = '${info.OBJID}';
|
|
|
|
$(document).ready(function(){
|
|
fn_loadOrderForm();
|
|
});
|
|
|
|
function fn_loadOrderForm(){
|
|
$.ajax({
|
|
url: "/contractMgmt/getOrderFormData.do",
|
|
type: "POST",
|
|
data: { objId: objId },
|
|
dataType: "json",
|
|
success: function(data){
|
|
if(data.result === "success"){
|
|
fn_renderOrderForm(data.info, data.items);
|
|
} else {
|
|
Swal.fire("주문서 데이터를 불러올 수 없습니다.");
|
|
}
|
|
},
|
|
error: function(){
|
|
Swal.fire("주문서 데이터 조회 중 오류가 발생했습니다.");
|
|
}
|
|
});
|
|
}
|
|
|
|
function fn_renderOrderForm(info, items){
|
|
// 주문일자
|
|
var orderDate = fnc_checkNull(info.ORDER_DATE);
|
|
if(orderDate !== ''){
|
|
var parts = orderDate.split('-');
|
|
if(parts.length === 3){
|
|
$("#orderDate").text(parts[0] + '년 ' + parts[1] + '월 ' + parts[2] + '일');
|
|
} else {
|
|
$("#orderDate").text(orderDate);
|
|
}
|
|
}
|
|
// 중방번호 = PO_NO (발주번호)
|
|
$("#poNo").text(fnc_checkNull(info.PO_NO));
|
|
|
|
// 발주자(고객사)
|
|
$("#clientBusRegNo").text(fnc_checkNull(info.CLIENT_BUS_REG_NO));
|
|
$("#clientNm").text(fnc_checkNull(info.CLIENT_NM));
|
|
$("#clientCeoNm").text(fnc_checkNull(info.CLIENT_CEO_NM));
|
|
$("#clientAddr").text(fnc_checkNull(info.CLIENT_ADDR));
|
|
$("#clientBusType").text(fnc_checkNull(info.CLIENT_BUS_TYPE));
|
|
$("#clientBusItem").text(fnc_checkNull(info.CLIENT_BUS_ITEM));
|
|
$("#clientTelNo").text(fnc_checkNull(info.CLIENT_TEL_NO));
|
|
$("#clientFaxNo").text(fnc_checkNull(info.CLIENT_FAX_NO));
|
|
|
|
// 납품처
|
|
$("#deliveryPlace").text(fnc_checkNull(info.CLIENT_NM));
|
|
$("#deliveryAddr").text(fnc_checkNull(info.CLIENT_ADDR));
|
|
$("#writerName").text(fnc_checkNull(info.WRITER_NAME));
|
|
|
|
// 품목
|
|
var html = '';
|
|
var totalQty = 0;
|
|
var totalSupply = 0;
|
|
if(items && items.length > 0){
|
|
for(var i = 0; i < items.length; i++){
|
|
var item = items[i];
|
|
var qty = parseFloat(item.ORDER_QUANTITY || 0);
|
|
var unitPrice = parseFloat(item.ORDER_UNIT_PRICE || 0);
|
|
var supplyPrice = parseFloat(item.ORDER_SUPPLY_PRICE || 0);
|
|
totalQty += qty;
|
|
totalSupply += supplyPrice;
|
|
|
|
html += '<tr>';
|
|
html += '<td class="tc">' + (i + 1) + '</td>';
|
|
html += '<td class="tc">' + fnc_checkNull(item.PART_NO) + '</td>';
|
|
html += '<td>' + fnc_checkNull(item.PART_NAME) + '</td>';
|
|
html += '<td>' + fnc_checkNull(item.SPEC) + '</td>';
|
|
html += '<td class="tc">' + fnc_checkNull(item.UNIT_NAME) + '</td>';
|
|
html += '<td class="tc">' + fnc_checkNull(item.DUE_DATE) + '</td>';
|
|
html += '<td class="tr">' + (qty > 0 ? fn_fmt(qty) : '') + '</td>';
|
|
html += '<td class="tr">' + (unitPrice > 0 ? fn_fmt(unitPrice) : '') + '</td>';
|
|
html += '<td class="tr">' + (supplyPrice > 0 ? fn_fmt(supplyPrice) : '') + '</td>';
|
|
html += '</tr>';
|
|
}
|
|
}
|
|
$("#itemBody").html(html);
|
|
$("#totalQty").text(totalQty > 0 ? fn_fmt(totalQty) : '');
|
|
$("#totalSupplyPrice").text(totalSupply > 0 ? fn_fmt(totalSupply) : '');
|
|
|
|
// 합계
|
|
var sp = parseFloat(info.ORDER_SUPPLY_PRICE || 0);
|
|
var vt = parseFloat(info.ORDER_VAT || 0);
|
|
var ta = parseFloat(info.ORDER_TOTAL_AMOUNT || 0);
|
|
|
|
$("#summarySupply").text(sp > 0 ? fn_fmt(sp) : '');
|
|
$("#summaryVat").text(vt > 0 ? fn_fmt(vt) : '');
|
|
$("#summaryTotal").text(ta > 0 ? fn_fmt(ta) : '');
|
|
$("#vatNote").text(fnc_checkNull(info.VAT_NOTE));
|
|
$("#regDatetime").text(fnc_checkNull(info.REG_DATETIME));
|
|
}
|
|
|
|
function fn_fmt(n){
|
|
return Number(n).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|