일반발주서 양식 수정

This commit is contained in:
2026-03-10 13:52:05 +09:00
parent 98864c6079
commit 4eee03ebc4
4 changed files with 179 additions and 155 deletions

View File

@@ -84,25 +84,7 @@ input.date_icon {
letter-spacing: 20px;
border: none !important;
}
/* 결재란 */
.approval-table {
border-collapse: collapse;
float: right;
}
.approval-table th, .approval-table td {
border: 1px solid #000;
text-align: center;
padding: 3px 10px;
font-size: 11px;
width: 55px;
}
.approval-table th {
background-color: #d9d9d9;
font-weight: normal;
}
.approval-table td {
height: 35px;
}
/* 기본정보 라벨 */
.info-label {
font-weight: bold;
@@ -163,34 +145,6 @@ input.date_icon {
overflow-y: scroll !important;
max-height: 350px !important;
}
/* 합계 테이블 */
.total-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.total-table td {
border: 1px solid #000;
padding: 8px;
font-size: 12px;
}
.total-table .label {
text-align: center;
font-weight: bold;
width: 60%;
letter-spacing: 5px;
}
.total-table .currency {
width: 30px;
text-align: center;
font-weight: bold;
border-right: none !important;
}
.total-table .amount {
text-align: right;
font-weight: bold;
}
/* 버튼 영역 */
.btn-area {
text-align: left;
@@ -199,6 +153,54 @@ input.date_icon {
.graycolor {
background-color: #d9d9d9;
}
.total-section {
border: 1px solid #333;
width: 50%;
}
.total-section table {
width: 100%;
border-collapse: collapse;
}
.total-section td {
padding: 10px;
border: 1px solid #333;
font-size: 14px;
}
.total-section .label {
background-color: #e2efda;
font-weight: bold;
text-align: center;
width: 40%;
white-space: nowrap;
}
.total-section .amount {
text-align: right;
font-weight: bold;
}
.confidential-notice {
padding: 10px;
font-size: 12px;
text-align: right;
color: #cb3333;
}
/* jqGrid 내 Select2 스타일 */
.ui-jqgrid .select2-container {
z-index: 9999;
}
.ui-jqgrid .select2-container--default .select2-selection--single {
height: 24px;
min-height: 24px;
border: none;
background: transparent;
}
.ui-jqgrid .select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 24px;
padding-left: 4px;
font-size: 12px;
}
.ui-jqgrid .select2-container--default .select2-selection--single .select2-selection__arrow {
height: 24px;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
@@ -218,25 +220,23 @@ $(document).ready(function(){
$(this).val(fnc_addComma($(this).val().replace(/[^0-9]/g,"")));
});
// 결재라인 가져오기
fn_getApprLine();
var unit_cd = $.parseJSON($("#unit_cd").val());
var delivery_place_grid = $.parseJSON($("#delivery_place_grid").val());
// 그리드 초기화
grid = $("#grid1").jqGrid({
url: ""
,datatype: "local"
,data: $.parseJSON($("#gridDetailList").val())
,colNames: ["OBJID","PART_OBJID","PART_NO","No","품명","규격","수량","단위","배송지","단가","공급가액","비고"]
,colNames: ["OBJID","PART_OBJID","PART_NO","No","품명","규격","수량","단위","배송지","단가","공급가액","비고","입고요청일"]
,colModel: [
{name:"OBJID" , hidden: true, sortable:false, editable:false}
,{name:"PART_OBJID" , hidden: true, sortable:false, editable:false}
,{name:"PART_NO" , hidden: true, sortable:false, editable:false}
,{name:"ROW_NUM" , width:40, align:"center", sortable:false, editable:false}
,{name:"PART_NAME" , width:170, align:"left", sortable:false, editable:false}
,{name:"SPEC" , width:180, align:"left", sortable:false, editable:<%= isModify %>}
,{name:"ORDER_QTY" , width:60, align:"right", sortable:false, editable:<%= isModify %>
,{name:"PART_NAME" , width:160, align:"left", sortable:false, editable:false}
,{name:"SPEC" , width:120, align:"left", sortable:false, editable:false}
,{name:"ORDER_QTY" , width:50, align:"right", sortable:false, editable:<%= isModify %>
,formatter:"integer", formatoptions:{thousandsSeparator:","}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; }
@@ -247,18 +247,38 @@ $(document).ready(function(){
,edittype:"select", formatter:"select"
,editoptions:{ value: unit_cd }
}
,{name:"PART_DELIVERY_PLACE" , width:80, align:"center", sortable:false, editable:<%= isModify %>}
,{name:"PARTNER_PRICE" , width:90, align:"right", sortable:false, editable:<%= isModify %>
,formatter:"integer", formatoptions:{thousandsSeparator:","}
,{name:"PART_DELIVERY_PLACE", width:130, align:"center", sortable:false, editable:<%= isModify %>
,edittype:"select", formatter:"select"
,editoptions:{
value: delivery_place_grid
,defaultValue: "RPS"
,dataInit: function(elem) {
var $el = $(elem);
if(!$el.val() || $el.val() === '') {
$el.val('RPS');
}
setTimeout(function(){
$el.select2({
width: '100%'
,dropdownAutoWidth: true
,dropdownParent: $el.closest('.ui-jqgrid')
});
}, 50);
}
}
}
,{name:"PARTNER_PRICE" , width:80, align:"right", sortable:false, editable:<%= isModify %>
,formatter:"number", formatoptions:{thousandsSeparator:",", decimalPlaces:2}
,editoptions:{
dataInit: function(e){ e.style.textAlign = "right"; }
,dataEvents: [{type:"change", fn:function(e){ gridFn.calcRowAll(e); }}]
}
}
,{name:"SUPPLY_UNIT_PRICE", width:100, align:"right", sortable:false, editable:false
,formatter:"integer", formatoptions:{thousandsSeparator:","}
,{name:"SUPPLY_UNIT_PRICE", width:90, align:"right", sortable:false, editable:false
,formatter:"number", formatoptions:{thousandsSeparator:",", decimalPlaces:2}
}
,{name:"REMARK" , width:120, align:"left", sortable:false, editable:<%= isModify %>}
,{name:"REMARK" , width:100, align:"left", sortable:false, editable:<%= isModify %>}
,{name:"DELIVERY_REQUEST_DATE", width:90, align:"center", sortable:false, editable:<%= isModify %>}
]
,rownumbers : false
,viewrecords : true
@@ -346,17 +366,7 @@ $(document).ready(function(){
$("#btnAdd").click(function(){ fn_openPartMngListPopUp(); });
$("#btnDel").click(function(){ gridFn.delRow(); });
$("#btnSave").click(function(){ fn_save(); });
$("#btnAppr").click(function(){
if(fnc_valitate("form1")){
var objId = "${objId}";
if(""==grid.getRowData()){
Swal.fire('저장할 품목이 존재 하지 않습니다');
return;
}
var title = encodeURIComponent($("#TITLE").val());
window.open("/approval/registApproval.do?targetType=PURCHASE_ORDER_GENERAL&targetObjId="+objId+"&approvalTitle="+title,"registApproval","width=700,height=700");
}
});
<% }else{ %>
$("#btnDown").click(function(){
document.form1.action = "/purchaseOrder/purchaseOrderFormPopup_general.do?actType=DOWN&PURCHASE_ORDER_MASTER_OBJID=${objId}";
@@ -371,28 +381,6 @@ $(document).ready(function(){
gridFn.calcAllRows();
});
// 결재라인 가져오기
function fn_getApprLine(){
if('${objId}'!=''){
$.ajax({
url:"/common/getApprovalLine.do",
type:"POST",
data:{"objId":"${objId}"},
dataType:"json",
async:false,
success:function(data){
$.each(data.RESULT, function(i,o){
if(i==0){
$("#appr_writer").html(o.WRITER);
}
if(i < 3){
$("#appr"+(i+1)).html(o.TARGET_USER_NAME +"<br/>"+ (o.PROC_DATE!=undefined?o.PROC_DATE:""));
}
});
}
});
}
}
// 행추가 팝업
function fn_openPartMngListPopUp(){
@@ -418,6 +406,7 @@ function fn_addRow(rowData){
,"PARTNER_PRICE" : v2
,"SUPPLY_UNIT_PRICE": _rowSum
,"REMARK" : ""
,"DELIVERY_REQUEST_DATE" : ""
};
grid.addRowData(newId, addData);
@@ -538,12 +527,18 @@ var gridFn = {
var vat = Math.floor(totalSupplyPrice * 0.1);
var totalWithVat = totalSupplyPrice + vat;
$("#TOTAL_SUPPLY_PRICE").val(numberWithCommas(totalSupplyPrice));
$("#TOTAL_VAT").val(numberWithCommas(vat));
$("#TOTAL_PRICE_ALL").val(numberWithCommas(totalWithVat));
$("#TOTAL_SUPPLY_PRICE").val(numberWithCommasDecimal(totalSupplyPrice));
$("#TOTAL_VAT").val(numberWithCommasDecimal(vat));
$("#TOTAL_PRICE_ALL").val(numberWithCommasDecimal(totalWithVat));
$("#TOTAL_AMOUNT_DISPLAY").text(numberWithCommasDecimal(totalSupplyPrice) + " 원");
}
}
function numberWithCommasDecimal(num) {
var n = Number(num);
return n.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
// 라이브러리 로드 완료 후 dataLoaded 플래그 설정
$(window).on('load', function() {
setTimeout(function() {
@@ -762,18 +757,6 @@ function fn_generateAndUploadPdf(callback) {
발 주 서
</td>
<td colspan="2" style="border-left:none; padding:5px;">
<table class="approval-table">
<tr>
<th>담당자</th>
<th>부사장</th>
<th>대표이사</th>
</tr>
<tr>
<td id="appr1"></td>
<td id="appr2">전결</td>
<td id="appr3">전결</td>
</tr>
</table>
</td>
</tr>
@@ -783,7 +766,7 @@ function fn_generateAndUploadPdf(callback) {
<!-- 좌측: 기본정보 -->
<table style="width:100%; border:none;">
<tr>
<td class="info-label" style="width:120px; border:none;">1. 발 주 번 호 :</td>
<td class="info-label" style="width:40%; border:none; white-space:nowrap;">1. 발 주 번 호 :</td>
<td style="border:none;">
<input type="text" name="PURCHASE_ORDER_NO" id="PURCHASE_ORDER_NO" value="${info.PURCHASE_ORDER_NO}" readonly style="border:none; width:200px; font-weight:bold;"/>
<!-- <span style="color:#888; font-size:10px;">(자동생성)</span> -->
@@ -804,7 +787,7 @@ function fn_generateAndUploadPdf(callback) {
</select>
</td>
</tr>
<tr>
<!-- <tr>
<td class="info-label" style="border:none;">4. 납 기 일 :</td>
<td style="border:none;">
<input type="text" name="DELIVERY_DATE" id="DELIVERY_DATE" class="date_icon" value="${info.DELIVERY_DATE}" <% if(!isModify){ %>readonly<% } %> style="width:100%;"/>
@@ -818,20 +801,20 @@ function fn_generateAndUploadPdf(callback) {
${code_map.delivery_place_cd}
</select>
</td>
</tr> -->
<tr>
<td class="info-label" style="border:none;">4. 합 계 금 액(VAT별도) :</td>
<td style="border:none;"><span id="TOTAL_AMOUNT_DISPLAY" style="font-weight:bold;"></span></td>
</tr>
<tr>
<td class="info-label" style="border:none;">6. 결 제 방 식 :</td>
<td class="info-label" style="border:none;">5. 결 제 방 식 :</td>
<td style="border:none;">
<select name="PAYMENT_TERMS" id="PAYMENT_TERMS" class="select2" style="width:100%;" <% if(!isModify){ %>disabled<% } %>>
<option value="">선택</option>
${code_map.payment_terms_cd}
</select>
</td>
</tr>
<tr>
<td class="info-label" style="border:none;">7. 합 계 금 액 :</td>
<td style="border:none;"></td>
</tr>
</tr>
</table>
</td>
<td colspan="3" style="vertical-align:top; padding:10px;">
@@ -842,7 +825,7 @@ function fn_generateAndUploadPdf(callback) {
<td rowspan="4" class="graycolor" style="width:50px; text-align:center; font-weight:bold; border:1px solid #000; letter-spacing:3px; vertical-align:middle; font-size:11px;">담 당 자</td>
<td style="border:1px solid #000; padding:2px 6px; text-align:center;">
<% if(isModify){ %>
<select name="SALES_MNG_USER_ID" id="SALES_MNG_USER_ID" style="width:150px; font-size:10px;">
<select name="SALES_MNG_USER_ID" id="SALES_MNG_USER_ID" class="select2" style="width:150px; font-size:10px;">
<option value="">선택</option>
<%
for(int u=0; u<userList.size(); u++){
@@ -874,7 +857,7 @@ function fn_generateAndUploadPdf(callback) {
</tr>
<tr>
<td style="border:1px solid #000; padding:2px 6px; text-align:center; position:relative;">
<span id="manager1_info">(<span id="display_phone1">${info.MANAGER_PHONE}</span> / <span id="display_email1">${info.MANAGER_EMAIL}</span>)</span>
<span id="manager1_info" style="font-size:12px;">(<span id="display_phone1">${info.MANAGER_PHONE}</span> / <span id="display_email1">${info.MANAGER_EMAIL}</span>)</span>
<!-- 직인 이미지 -->
<img src="<%=request.getContextPath()%>/images/stamp_rps.png" alt="직인" style="position:absolute; right:5px; top:-10px; width:45px; height:45px; opacity:0.9;" onerror="this.style.display='none'">
</td>
@@ -882,7 +865,7 @@ function fn_generateAndUploadPdf(callback) {
<tr>
<td style="border:1px solid #000; padding:2px 6px; text-align:center;">
<% if(isModify){ %>
<select name="SALES_MNG_USER_ID2" id="SALES_MNG_USER_ID2" style="width:150px; font-size:10px;">
<select name="SALES_MNG_USER_ID2" id="SALES_MNG_USER_ID2" class="select2" style="width:150px; font-size:10px;">
<option value="">선택</option>
<%
for(int u=0; u<userList.size(); u++){
@@ -914,52 +897,30 @@ function fn_generateAndUploadPdf(callback) {
</tr>
<tr>
<td style="border:1px solid #000; padding:2px 6px; text-align:center;">
<span id="manager2_info">(<span id="display_phone2">${info.MANAGER_PHONE2}</span> / <span id="display_email2">${info.MANAGER_EMAIL2}</span>)</span>
<span id="manager2_info" style="font-size:12px;">(<span id="display_phone2">${info.MANAGER_PHONE2}</span> / <span id="display_email2">${info.MANAGER_EMAIL2}</span>)</span>
</td>
</tr>
<tr>
<td colspan="2" class="company-name">㈜알피에스 대표이사 이 동 헌</td>
<td colspan="2" style="border:1px solid #000; border-bottom:none; padding:5px; text-align:center; font-size:14px; font-weight:bold;">㈜알피에스 대표이사 이 동 헌</td>
</tr>
<tr>
<td colspan="2" class="company-address">대전광역시 유성구 국제과학10로8(둔곡동 402-4번지)</td>
<td colspan="2" style="border:1px solid #000; border-top:none; padding:5px; text-align:center; font-size:11px; font-weight:bold;">대전광역시 유성구 국제과학10로8(둔곡동 402-4번지)</td>
</tr>
<!-- <tr>
<td colspan="2" class="company-address">대전광역시 유성구 국제과학10로8(둔곡동 402-4번지)</td>
</tr> -->
</table>
<!-- 요청사항 박스 -->
<div class="request-box">
<!-- <div class="request-box">
<span style="font-weight:bold;">요청사항 :</span><br/>
<textarea name="REQUEST_CONTENT" id="REQUEST_CONTENT" style="width:100%; height:40px; border:none; resize:none; margin-top:5px;" <% if(!isModify){ %>readonly<% } %>>${info.REQUEST_CONTENT}</textarea>
</div>
</div> -->
</td>
</tr>
</table>
<!-- 그리드 영역 -->
<div id="plm_table_wrap1" style="width:100%; margin:0;">
<table id="grid1"></table>
<textarea style="display:none;" id="gridDetailList">${gridDetailList}<c:if test="${empty gridDetailList}">[]</c:if></textarea>
</div>
<!-- 합계 테이블 -->
<table class="total-table" style="width:100%; margin:10px 0 0 0;">
<tr>
<td class="label">공 급 가 액</td>
<td class="currency" style="border-right:none;">₩</td>
<td class="amount" style="border-left:none;"><input type="text" name="TOTAL_SUPPLY_PRICE" id="TOTAL_SUPPLY_PRICE" value="" readonly style="border:none; text-align:right; width:100%; font-weight:bold;"/></td>
</tr>
<tr>
<td class="label">부 가 세</td>
<td class="currency" style="border-right:none;">₩</td>
<td class="amount" style="border-left:none;"><input type="text" name="TOTAL_VAT" id="TOTAL_VAT" value="" readonly style="border:none; text-align:right; width:100%; font-weight:bold;"/></td>
</tr>
<tr>
<td class="label graycolor">총 결 제 금 액 (VAT포함)</td>
<td class="currency" style="border-right:none;">₩</td>
<td class="amount" style="border-left:none;"><input type="text" name="TOTAL_PRICE_ALL" id="TOTAL_PRICE_ALL" value="" readonly style="border:none; text-align:right; width:100%; font-weight:bold; font-size:14px;"/></td>
</tr>
</table>
<!-- 버튼 영역 (하단) -->
<div style="width:100%; margin:15px 0; text-align:right;">
<% if(isModify){ %>
@@ -969,8 +930,32 @@ function fn_generateAndUploadPdf(callback) {
<% } %>
<input type="button" value="닫기" class="" style="background:#dfeffc; padding:5px 15px; cursor:pointer; font-size:14px; border-radius: 5px;" onclick="window.close();">
</div>
<!-- 그리드 영역 -->
<div id="plm_table_wrap1" style="width:100%; margin:0;">
<table id="grid1"></table>
<textarea style="display:none;" id="gridDetailList">${gridDetailList}<c:if test="${empty gridDetailList}">[]</c:if></textarea>
</div>
<!-- 합계 영역 -->
<div class="total-section" style="margin-left:auto;">
<table>
<tr>
<td class="label">총 공 급 가 액 (VAT별도)</td>
<td class="amount"><input type="text" name="TOTAL_SUPPLY_PRICE" id="TOTAL_SUPPLY_PRICE" value="" readonly style="border:none; text-align:right; width:100%; font-weight:bold; font-size:16px;"/></td>
</tr>
</table>
</div>
<input type="hidden" name="TOTAL_VAT" id="TOTAL_VAT" value=""/>
<input type="hidden" name="TOTAL_PRICE_ALL" id="TOTAL_PRICE_ALL" value=""/>
<!-- 보안문서 안내 -->
<div class="confidential-notice">
※ 보안문서(CONFIDENTIAL) : ㈜알피에스의 승인(APPROVAL) 없이 외부로 반출하거나 공유 할수 없습니다.
</div>
<textarea style="display:none;" id="unit_cd">${code_map.unit_cd}</textarea>
<textarea style="display:none;" id="delivery_place_grid">${code_map.delivery_place_grid}</textarea>
</form>
</body>
</html>

View File

@@ -757,24 +757,36 @@ public class PurchaseOrderController {
detailRow.put("UNIT", "".equals(unit) ? "0001400" : unit);
// 배송지
detailRow.put("DELIVERY_PLACE", "RPS");
detailRow.put("PART_DELIVERY_PLACE", "RPS");
// 단가 (대소문자 모두 체크)
Object priceObj = partRow.get("UNIT_PRICE");
if(priceObj == null) priceObj = partRow.get("unit_price");
String priceStr = CommonUtils.checkNull(priceObj, "0").toString().replaceAll(",", "");
int unitPrice = 0;
try { unitPrice = (int)Double.parseDouble(priceStr.equals("") ? "0" : priceStr); } catch(Exception e) { unitPrice = 0; }
double unitPrice = 0;
try { unitPrice = Double.parseDouble(priceStr.equals("") ? "0" : priceStr); } catch(Exception e) { unitPrice = 0; }
detailRow.put("PARTNER_PRICE", unitPrice);
// 공급가액 = 수량 * 단가
detailRow.put("SUPPLY_UNIT_PRICE", qty * unitPrice);
// 비고 (대소문자 모두 체크)
String remark = CommonUtils.checkNull(partRow.get("REMARK"));
if("".equals(remark)) remark = CommonUtils.checkNull(partRow.get("remark"));
// 비고: 제품명 / 부품명 형태
String projectProductName = CommonUtils.checkNull(partRow.get("PROJECT_PRODUCT_NAME"));
String componentPartName = CommonUtils.checkNull(partRow.get("COMPONENT_PART_NAME"));
String remark = "";
if(!"".equals(projectProductName) && !"".equals(componentPartName)) {
remark = projectProductName + " / " + componentPartName;
} else if(!"".equals(projectProductName)) {
remark = projectProductName;
} else if(!"".equals(componentPartName)) {
remark = componentPartName;
}
detailRow.put("REMARK", remark);
// 입고요청일
Object deliveryDateObj = partRow.get("DELIVERY_REQUEST_DATE");
detailRow.put("DELIVERY_REQUEST_DATE", deliveryDateObj != null ? String.valueOf(deliveryDateObj).trim() : "");
detailList.add(detailRow);
}
}
@@ -793,6 +805,9 @@ public class PurchaseOrderController {
param.put("code","0001399");
code_map.put("unit_cd", commonService.getJqGridSelectBoxJsonData2("common.getCodeselect", param, "선택", "CODE", "NAME"));
// 배송지 (jqGrid 셀렉트박스용 - 수신업체와 동일 데이터)
code_map.put("delivery_place_grid", commonService.getJqGridSelectBoxJsonData2("common.getClientMngSupplySelect", new HashMap(), "선택", "NAME", "NAME"));
// 결제조건
code_map.put("payment_terms_cd", commonService.bizMakeOptionList("0001074", (String)info.get("PAYMENT_TERMS"),"common.getCodeselect"));

View File

@@ -890,6 +890,16 @@
COALESCE(NULLIF(SRP.UNIT, ''), PM.UNIT) AS UNIT,
PM.MAKER,
(SELECT PJ.PART_NAME FROM PROJECT_MGMT PJ WHERE PJ.OBJID::VARCHAR = SRM.PROJECT_NO) AS PROJECT_PRODUCT_NAME,
CASE WHEN COALESCE(SRP.MATERIAL_YN, 'N') = 'Y' AND SRM.MBOM_HEADER_OBJID IS NOT NULL THEN
COALESCE(
(SELECT MIN(PM2.PART_NAME) FROM MBOM_DETAIL MD2
JOIN PART_MNG PM2 ON MD2.PART_OBJID::VARCHAR = PM2.OBJID::VARCHAR
WHERE MD2.RAW_MATERIAL_PART_NO = PM.PART_NO
AND MD2.MBOM_HEADER_OBJID::VARCHAR = SRM.MBOM_HEADER_OBJID::VARCHAR),
PM.PART_NAME
)
ELSE PM.PART_NAME
END AS COMPONENT_PART_NAME,
COALESCE(SRP.DELIVERY_REQUEST_DATE,
CASE WHEN SRM.MBOM_HEADER_OBJID IS NOT NULL THEN
CASE WHEN COALESCE(SRP.MATERIAL_YN, 'N') = 'Y' THEN

View File

@@ -1944,6 +1944,20 @@ public class PurchaseOrderService {
partParam.put("PRODUCT_NAME", CommonUtils.checkNull(partMap.get("project_product_name")));
Object deliveryDateObj = partMap.get("delivery_request_date");
partParam.put("DELIVERY_REQUEST_DATE", deliveryDateObj != null ? String.valueOf(deliveryDateObj).trim() : "");
// 비고: 제품명 / 부품명 형태
String projectProductName = CommonUtils.checkNull(partMap.get("project_product_name"));
String componentPartName = CommonUtils.checkNull(partMap.get("component_part_name"));
String remark = "";
if(!"".equals(projectProductName) && !"".equals(componentPartName)) {
remark = projectProductName + " / " + componentPartName;
} else if(!"".equals(projectProductName)) {
remark = projectProductName;
} else if(!"".equals(componentPartName)) {
remark = componentPartName;
}
partParam.put("REMARK", remark);
partParam.put("WRITER", writer);
partParam.put("STATUS", "create");