영문발주서 양식 추가(발주서 발송 계정 purchase@rps-korea.com -> sales@rps-korea.com으로 임시 변경)
This commit is contained in:
@@ -0,0 +1,727 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ page import="com.pms.common.utils.*"%>
|
||||
<%@ page import="java.util.*"%>
|
||||
<%@include file="/init_jqGrid.jsp"%>
|
||||
<%
|
||||
Map info = (HashMap)(request.getAttribute("info"));
|
||||
boolean isModify = true;
|
||||
if(info!=null &&
|
||||
( CommonUtils.checkNull(info.get("APPR_STATUS")).equals( "결재중" )
|
||||
||CommonUtils.checkNull(info.get("APPR_STATUS")).equals( "결재완료" )
|
||||
||CommonUtils.checkNull(info.get("STATUS")).equals( "cancel" )
|
||||
)
|
||||
){
|
||||
isModify = false;
|
||||
}
|
||||
String actType = (String)request.getAttribute("actType");
|
||||
|
||||
List userList = (List)request.getAttribute("userList");
|
||||
if(userList == null) userList = new ArrayList();
|
||||
|
||||
String managerId = CommonUtils.checkNull(info != null ? info.get("SALES_MNG_USER_ID") : "");
|
||||
String managerId2 = CommonUtils.checkNull(info != null ? info.get("SALES_MNG_USER_ID2") : "");
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<c:set var="now" value="<%=new java.util.Date() %>" />
|
||||
<c:set var="sysYear"><fmt:formatDate value="${now}" pattern="yyyy" /></c:set>
|
||||
<title><%=Constants.SYSTEM_NAME%> - Purchase Order</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Times New Roman', 'Georgia', serif;
|
||||
font-size: 11px;
|
||||
margin: 0;
|
||||
padding: 15px 25px;
|
||||
background-color: #fff;
|
||||
overflow-x: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
input.date_icon {
|
||||
border: 1px solid #aaa !important;
|
||||
border-radius: 4px;
|
||||
padding: 5px 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 헤더 */
|
||||
.po-header {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.po-header .company-name {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.po-header .company-info {
|
||||
font-size: 10px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* Purchase Order 타이틀 */
|
||||
.po-title {
|
||||
text-align: center;
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 3px;
|
||||
margin: 15px 0;
|
||||
font-family: 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
/* 기본정보 테이블 */
|
||||
.po-info-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #000;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.po-info-table td {
|
||||
border: 1px solid #000;
|
||||
padding: 4px 8px;
|
||||
font-size: 11px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.po-info-table .label-cell {
|
||||
background-color: #d9e2f3;
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
width: 90px;
|
||||
}
|
||||
.po-info-table .value-cell {
|
||||
min-width: 180px;
|
||||
}
|
||||
.po-info-table .right-label {
|
||||
background-color: #d9e2f3;
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
width: 80px;
|
||||
}
|
||||
.po-info-table .right-value {
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
/* 품목 테이블 */
|
||||
.po-item-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 2px solid #000;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.po-item-table th {
|
||||
border: 1px solid #000;
|
||||
padding: 6px 4px;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
background-color: #d9e2f3;
|
||||
}
|
||||
.po-item-table td {
|
||||
border: 1px solid #000;
|
||||
padding: 4px 6px;
|
||||
font-size: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* TOTAL 행 */
|
||||
.po-total-row {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.po-total-row td {
|
||||
padding: 8px 10px;
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
border: 2px solid #000;
|
||||
}
|
||||
|
||||
/* 서명 영역 */
|
||||
.po-signature {
|
||||
text-align: right;
|
||||
margin-top: 40px;
|
||||
padding: 20px;
|
||||
}
|
||||
.po-signature .sign-name {
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
.po-signature .sign-company {
|
||||
font-size: 11px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
/* 버튼 영역 */
|
||||
.btn-area {
|
||||
text-align: right;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
/* jqGrid 스타일 */
|
||||
.ui-jqgrid-view { max-height: 400px; }
|
||||
.ui-jqgrid-bdiv { overflow-y: scroll !important; max-height: 350px !important; }
|
||||
.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>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var grid;
|
||||
window.dataLoaded = false;
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("input[numberOnly='']").each(function(){
|
||||
$(this).css({'text-align':'right'})
|
||||
})
|
||||
.on("keyup", function() {
|
||||
$(this).val(fnc_addComma($(this).val().replace(/[^0-9.]/g,"")));
|
||||
});
|
||||
|
||||
var unit_cd = $.parseJSON($("#unit_cd").val());
|
||||
var currency_cd = $.parseJSON($("#currency_cd").val());
|
||||
|
||||
grid = $("#grid1").jqGrid({
|
||||
url: ""
|
||||
,datatype: "local"
|
||||
,data: $.parseJSON($("#gridDetailList").val())
|
||||
,colNames: ["OBJID","PART_OBJID","Item No.","Commodity & Description","Spec","Unit","Q'ty","Currency","Unit Price","Amount","Delivery"]
|
||||
,colModel: [
|
||||
{name:"OBJID" , hidden: true, sortable:false, editable:false}
|
||||
,{name:"PART_OBJID" , hidden: true, sortable:false, editable:false}
|
||||
,{name:"PART_NO" , width:90, align:"center", sortable:false, editable:false}
|
||||
,{name:"PART_NAME" , width:200, align:"left", sortable:false, editable:false}
|
||||
,{name:"SPEC" , width:120, align:"left", sortable:false, editable:false}
|
||||
,{name:"UNIT" , width:50, align:"center", sortable:false, editable:<%= isModify %>
|
||||
,edittype:"select", formatter:"select"
|
||||
,editoptions:{ value: unit_cd }
|
||||
}
|
||||
,{name:"ORDER_QTY" , width:60, align:"right", sortable:false, editable:<%= isModify %>
|
||||
,formatter:"integer", formatoptions:{thousandsSeparator:","}
|
||||
,editoptions:{
|
||||
dataInit: function(e){ e.style.textAlign = "right"; }
|
||||
,dataEvents: [{type:"change", fn:function(e){ gridFn.calcRowAll(e); }}]
|
||||
}
|
||||
}
|
||||
,{name:"CURRENCY" , width:65, align:"center", sortable:false, editable:<%= isModify %>
|
||||
,edittype:"select", formatter:"select"
|
||||
,editoptions:{ value: currency_cd, defaultValue: "USD" }
|
||||
}
|
||||
,{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";
|
||||
var val = parseFloat($(e).val().replace(/,/g, ''));
|
||||
if(!isNaN(val)) $(e).val(numberWithCommasDecimal(val));
|
||||
}
|
||||
,dataEvents: [
|
||||
{type:"change", fn:function(e){ gridFn.calcRowAll(e); }}
|
||||
,{type:"blur", fn:function(e){
|
||||
var val = parseFloat($(e.target).val().replace(/,/g, ''));
|
||||
if(!isNaN(val)) $(e.target).val(numberWithCommasDecimal(val));
|
||||
}}
|
||||
]
|
||||
}
|
||||
}
|
||||
,{name:"SUPPLY_UNIT_PRICE", width:90, align:"right", sortable:false, editable:false
|
||||
,formatter:"number", formatoptions:{thousandsSeparator:",", decimalPlaces:2}
|
||||
}
|
||||
,{name:"DELIVERY_REQUEST_DATE", width:120, align:"center", sortable:false, editable:<%= isModify %>
|
||||
,editoptions:{
|
||||
dataInit: function(elem) {
|
||||
$(elem).datepicker({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
,rownumbers : false
|
||||
,viewrecords : true
|
||||
,height : '300'
|
||||
,multiselect : <% if(isModify){ %>true<% }else{ %>false<% } %>
|
||||
,shrinkToFit : true
|
||||
,autowidth : true
|
||||
,sortable : false
|
||||
,rowNum : 10000
|
||||
,forceFit : true
|
||||
,jsonReader : {repeatitems: false}
|
||||
,mtype :"POST"
|
||||
,loadComplete: function(){
|
||||
var gid = this.id;
|
||||
setTimeout("fn_jqGrid_init($('#"+gid+"'), false);", 50);
|
||||
var ids = $(this).jqGrid('getDataIDs');
|
||||
for(var i = 0; i < ids.length; i++){
|
||||
$(this).jqGrid('setCell', ids[i], 'ROW_NUM', i+1);
|
||||
}
|
||||
setTimeout(function(){ gridFn.calcAllRows(); }, 100);
|
||||
}
|
||||
});
|
||||
|
||||
gridFn.opennEdit();
|
||||
gridFn.calcAllRows();
|
||||
|
||||
$(window).on('resize', function(){
|
||||
var newWidth = $("#grid1").closest(".ui-jqgrid").parent().width();
|
||||
$("#grid1").jqGrid('setGridWidth', newWidth, true);
|
||||
});
|
||||
|
||||
<% if(isModify){ %>
|
||||
$("#PARTNER_OBJID").prop("disabled","");
|
||||
$("#SHIPMENT,#PACKING,#VALIDITY,#REMARK,#ATTN_TO").removeAttr("readonly");
|
||||
|
||||
$("#btnAdd").click(function(){ fn_openPartMngListPopUp(); });
|
||||
$("#btnDel").click(function(){ gridFn.delRow(); });
|
||||
$("#btnSave").click(function(){ fn_save(); });
|
||||
|
||||
<% }else{ %>
|
||||
$("#btnDown").click(function(){
|
||||
document.form1.action = "/purchaseOrder/purchaseOrderFormPopup_english.do?actType=DOWN&PURCHASE_ORDER_MASTER_OBJID=${objId}";
|
||||
document.form1.submit();
|
||||
});
|
||||
<% } %>
|
||||
|
||||
// 영문 날짜 표시용 datepicker
|
||||
var MONTH_NAMES_EN = ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];
|
||||
|
||||
function toEnglishDateDisplay(dateStr) {
|
||||
if(!dateStr) return "";
|
||||
var d = new Date(dateStr.replace(/\./g, "-"));
|
||||
if(isNaN(d.getTime())) return dateStr;
|
||||
return MONTH_NAMES_EN[d.getMonth()] + ". " + ("0"+d.getDate()).slice(-2) + ". " + d.getFullYear();
|
||||
}
|
||||
|
||||
// 저장값(hidden) → 표시값 초기 세팅
|
||||
var initDate = $("#PURCHASE_DATE").val();
|
||||
$("#PURCHASE_DATE_DISPLAY").val(toEnglishDateDisplay(initDate));
|
||||
|
||||
$("#PURCHASE_DATE_DISPLAY").datepicker({
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
dateFormat: "yy-mm-dd",
|
||||
onSelect: function(dateText) {
|
||||
$("#PURCHASE_DATE").val(dateText);
|
||||
$(this).val(toEnglishDateDisplay(dateText));
|
||||
}
|
||||
});
|
||||
|
||||
$(".select2").select2();
|
||||
|
||||
gridFn.opennEdit();
|
||||
gridFn.calcAllRows();
|
||||
});
|
||||
|
||||
function fn_openPartMngListPopUp(){
|
||||
var url = "/partMng/partMngListPopUp.do?callbackFnc=fn_addRow&callType=purchaseOrder";
|
||||
window.open(url,"purchaseOrderPartSelectListPopUp","width=1480,height=850");
|
||||
}
|
||||
|
||||
function fn_addRow(rowData){
|
||||
var v1 = Number(fnc_checkNullDefaultValue(rowData.map.ORDER_QTY, 0));
|
||||
var v2 = Number(fnc_checkNullDefaultValue(rowData.map.PARTNER_PRICE, 0));
|
||||
var _rowSum = v1 * v2;
|
||||
|
||||
var newId = grid.getGridParam("reccount")+1;
|
||||
var addData = {
|
||||
"PART_OBJID" : rowData.map.PART_OBJID
|
||||
,"PART_NO" : rowData.map.PART_NO
|
||||
,"PART_NAME" : rowData.map.PART_NAME
|
||||
,"SPEC" : rowData.map.SPEC
|
||||
,"ORDER_QTY" : v1
|
||||
,"UNIT" : fnc_checkNullDefaultValue(rowData.map.UNIT, '0001400')
|
||||
,"CURRENCY" : "USD"
|
||||
,"PARTNER_PRICE" : v2
|
||||
,"SUPPLY_UNIT_PRICE": _rowSum
|
||||
,"DELIVERY_REQUEST_DATE" : ""
|
||||
};
|
||||
|
||||
grid.addRowData(newId, addData);
|
||||
grid.jqGrid("editRow", newId);
|
||||
gridFn.footerSummary();
|
||||
}
|
||||
|
||||
function fn_save(){
|
||||
if(fnc_valitate("form1")){
|
||||
if(""==grid.getRowData()){
|
||||
Swal.fire('No items to save.');
|
||||
return;
|
||||
}
|
||||
if(confirm("Save this Purchase Order?")){
|
||||
fn_save_process();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<% if(isModify){ %>
|
||||
function fn_save_process(){
|
||||
$("input[name*='PRICE']").each(function(){
|
||||
$(this).val($(this).val().replace(/,/gi,""));
|
||||
});
|
||||
$("input[name*='QTY']").each(function(){
|
||||
$(this).val($(this).val().replace(/,/gi,""));
|
||||
});
|
||||
|
||||
gridFn.closeEdit();
|
||||
$.ajax({
|
||||
url:"/purchaseOrder/purchaseOrderFormPopup_englishSave.do"
|
||||
,type:"POST"
|
||||
,data: $("#form1").serialize() + "&jqGrid="+ encodeURIComponent(JSON.stringify(grid.getRowData()))
|
||||
,dataType:"json"
|
||||
,success:function(data){
|
||||
if(data && data.RESULT == 'S'){
|
||||
alert("Saved successfully.");
|
||||
if(typeof opener.fn_search =="function"){ opener.fn_search() };
|
||||
self.close();
|
||||
}else{
|
||||
alert(data.MSG);
|
||||
}
|
||||
}
|
||||
,error: function(jqxhr, status, error){
|
||||
alert('An error occurred. Please contact the system administrator.');
|
||||
}
|
||||
});
|
||||
}
|
||||
<% } %>
|
||||
|
||||
var gridFn = {
|
||||
delRow : function(){
|
||||
var selectedRowIds = grid.jqGrid("getGridParam","selarrrow");
|
||||
if(selectedRowIds.length==0){
|
||||
Swal.fire("Please select a row to delete.");
|
||||
return false;
|
||||
}
|
||||
for(var i = selectedRowIds.length - 1; i >= 0; i--){
|
||||
grid.delRowData(selectedRowIds[i]);
|
||||
}
|
||||
var ids = grid.jqGrid('getDataIDs');
|
||||
for(var i = 0; i < ids.length; i++){
|
||||
grid.jqGrid('setCell', ids[i], 'ROW_NUM', ids[i]);
|
||||
}
|
||||
gridFn.footerSummary();
|
||||
}
|
||||
,opennEdit : function() {
|
||||
var ids = grid.jqGrid("getDataIDs");
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
grid.jqGrid("editRow",ids[i]);
|
||||
}
|
||||
}
|
||||
,closeEdit : function() {
|
||||
var ids = grid.jqGrid("getDataIDs");
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
grid.jqGrid("saveRow", ids[i], null, "clientArray");
|
||||
}
|
||||
}
|
||||
,calcRowAll : function(e){
|
||||
var $g = $("#grid1");
|
||||
var rowId = e.target.id.split("_")[0];
|
||||
|
||||
var qty = Number(fnc_checkNullDefaultValue($g.find("#"+rowId+"_ORDER_QTY").val(), grid.jqGrid('getCell', rowId, "ORDER_QTY")).toString().replace(/,/g,""));
|
||||
var unitPrice = Number(fnc_checkNullDefaultValue($g.find("#"+rowId+"_PARTNER_PRICE").val(), grid.jqGrid('getCell', rowId, "PARTNER_PRICE")).toString().replace(/,/g,""));
|
||||
|
||||
var supplyPrice = qty * unitPrice;
|
||||
$g.jqGrid('setCell', rowId, "SUPPLY_UNIT_PRICE", supplyPrice);
|
||||
|
||||
this.footerSummary();
|
||||
}
|
||||
,calcAllRows: function(){
|
||||
var $g = $("#grid1");
|
||||
var ids = grid.jqGrid('getDataIDs');
|
||||
for(var i = 0; i < ids.length; i++){
|
||||
var rowId = ids[i];
|
||||
var qtyVal = $g.find("#"+rowId+"_ORDER_QTY").val();
|
||||
var priceVal = $g.find("#"+rowId+"_PARTNER_PRICE").val();
|
||||
var qty = Number(fnc_checkNullDefaultValue(qtyVal, grid.jqGrid('getCell', rowId, "ORDER_QTY")).toString().replace(/,/g,""));
|
||||
var unitPrice = Number(fnc_checkNullDefaultValue(priceVal, grid.jqGrid('getCell', rowId, "PARTNER_PRICE")).toString().replace(/,/g,""));
|
||||
grid.jqGrid('setCell', rowId, "SUPPLY_UNIT_PRICE", qty * unitPrice);
|
||||
}
|
||||
this.footerSummary();
|
||||
}
|
||||
,footerSummary: function(){
|
||||
var totalAmount = 0;
|
||||
|
||||
$.each($("#grid1").jqGrid('getDataIDs'), function(i, rowId){
|
||||
var supplyPrice = grid.jqGrid('getCell', rowId, "SUPPLY_UNIT_PRICE");
|
||||
supplyPrice = fnc_checkNullDefaultValue(supplyPrice, "0").toString().replace(/,/g,"");
|
||||
if($.isNumeric(supplyPrice)){
|
||||
totalAmount += Number(supplyPrice);
|
||||
}
|
||||
});
|
||||
|
||||
var vat = Math.floor(totalAmount * 0.1);
|
||||
var totalWithVat = totalAmount + vat;
|
||||
|
||||
$("#TOTAL_AMOUNT").val(numberWithCommasDecimal(totalAmount));
|
||||
$("#TOTAL_SUPPLY_PRICE").val(numberWithCommasDecimal(totalAmount));
|
||||
$("#TOTAL_VAT").val(numberWithCommasDecimal(vat));
|
||||
$("#TOTAL_PRICE_ALL").val(numberWithCommasDecimal(totalWithVat));
|
||||
$("#TOTAL_AMOUNT_DISPLAY").text("US$" + numberWithCommasDecimal(totalAmount));
|
||||
}
|
||||
}
|
||||
|
||||
function numberWithCommasDecimal(num) {
|
||||
var n = Number(num);
|
||||
return n.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
$(window).on('load', function() {
|
||||
setTimeout(function() {
|
||||
if(typeof html2canvas !== 'undefined' && typeof jspdf !== 'undefined') {
|
||||
window.dataLoaded = true;
|
||||
} else if(typeof html2canvas !== 'undefined' && typeof window.jspdf !== 'undefined') {
|
||||
window.dataLoaded = true;
|
||||
} else {
|
||||
setTimeout(function() { window.dataLoaded = true; }, 1000);
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
|
||||
function fn_generateAndUploadPdf(callback) {
|
||||
if(typeof html2canvas === 'undefined') {
|
||||
if(callback && typeof callback === 'function') callback(null);
|
||||
return;
|
||||
}
|
||||
var jsPDF = window.jspdf ? window.jspdf.jsPDF : null;
|
||||
if(!jsPDF) {
|
||||
if(callback && typeof callback === 'function') callback(null);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#btnSave, #btnDown, #btnAdd, #btnDel, input[value="Close"]').closest('div').hide();
|
||||
$('.select2-container').hide();
|
||||
|
||||
var inputBackups = [];
|
||||
$('input[type="text"], input:not([type])').each(function(){
|
||||
var $input = $(this);
|
||||
var value = $input.val();
|
||||
if(value) {
|
||||
inputBackups.push({ element: $input, html: $input[0].outerHTML, parent: $input.parent() });
|
||||
var $span = $('<span class="pdf-temp-span">').text(value).css({
|
||||
'display':'inline-block','white-space':'nowrap',
|
||||
'text-align':$input.css('text-align')||'left',
|
||||
'font-size':$input.css('font-size')||'12px',
|
||||
'padding':'2px 5px','color':'#000','background':'transparent'
|
||||
});
|
||||
$input.replaceWith($span);
|
||||
inputBackups[inputBackups.length - 1].span = $span;
|
||||
}
|
||||
});
|
||||
$('select').each(function(){
|
||||
var $select = $(this);
|
||||
var value = $select.find('option:selected').text();
|
||||
if(value && value.trim() !== '' && value !== 'Select' && value !== '선택') {
|
||||
inputBackups.push({ element: $select, html: $select[0].outerHTML, parent: $select.parent(), wasHidden: $select.is(':hidden') });
|
||||
var $span = $('<span class="pdf-temp-span">').text(value).css({
|
||||
'display':'inline-block','white-space':'nowrap',
|
||||
'font-size':'12px','padding':'2px 5px','color':'#000','background':'transparent'
|
||||
});
|
||||
$select.after($span).hide();
|
||||
inputBackups[inputBackups.length - 1].span = $span;
|
||||
}
|
||||
});
|
||||
|
||||
var captureElement = document.getElementById('form1');
|
||||
html2canvas(captureElement, {
|
||||
scale: 1.5, useCORS: true, logging: false, backgroundColor: '#ffffff',
|
||||
windowWidth: captureElement.scrollWidth, windowHeight: captureElement.scrollHeight
|
||||
}).then(function(canvas) {
|
||||
$('.pdf-temp-span').remove();
|
||||
for(var i = 0; i < inputBackups.length; i++) {
|
||||
var backup = inputBackups[i];
|
||||
if(backup.element && backup.element.is('select')) { backup.element.show(); }
|
||||
else if(backup.span && backup.parent) { backup.span.replaceWith(backup.html); }
|
||||
}
|
||||
$('.select2-container').show();
|
||||
$('#btnSave, #btnDown, #btnAdd, #btnDel, input[value="Close"]').closest('div').show();
|
||||
|
||||
try {
|
||||
var imgData = canvas.toDataURL('image/jpeg', 0.7);
|
||||
var pdf = new jsPDF('p', 'mm', 'a4');
|
||||
var imgWidth = 210;
|
||||
var pageHeight = 297;
|
||||
var imgHeight = canvas.height * imgWidth / canvas.width;
|
||||
var heightLeft = imgHeight;
|
||||
var position = 0;
|
||||
pdf.addImage(imgData, 'JPEG', 0, position, imgWidth, imgHeight, undefined, 'FAST');
|
||||
heightLeft -= pageHeight;
|
||||
while (heightLeft >= 0) {
|
||||
position = heightLeft - imgHeight;
|
||||
pdf.addPage();
|
||||
pdf.addImage(imgData, 'JPEG', 0, position, imgWidth, imgHeight, undefined, 'FAST');
|
||||
heightLeft -= pageHeight;
|
||||
}
|
||||
var pdfBase64 = pdf.output('dataurlstring').split(',')[1];
|
||||
if(callback && typeof callback === 'function') callback(pdfBase64);
|
||||
} catch(pdfError) {
|
||||
if(callback && typeof callback === 'function') callback(null);
|
||||
}
|
||||
}).catch(function(error) {
|
||||
for(var i = 0; i < inputBackups.length; i++) {
|
||||
if(inputBackups[i].span) inputBackups[i].span.replaceWith(inputBackups[i].html);
|
||||
}
|
||||
$('#btnSave, #btnDown, #btnAdd, #btnDel, input[value="Close"]').closest('div').show();
|
||||
if(callback && typeof callback === 'function') callback(null);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form name="hiddenForm" id="hiddenForm" method="post">
|
||||
<input type="hidden" name="OBJID" id="OBJID">
|
||||
</form>
|
||||
|
||||
<form name="form1" id="form1" action="" method="post">
|
||||
<input type="hidden" name="MASTER_OBJID" id="MASTER_OBJID" value="${objId}" />
|
||||
<input type="hidden" name="PROPOSAL_OBJID" id="PROPOSAL_OBJID" value="${info.PROPOSAL_OBJID}" />
|
||||
<input type="hidden" name="FORM_TYPE" id="FORM_TYPE" value="english" />
|
||||
<input type="hidden" name="CONTRACT_MGMT_OBJID" id="CONTRACT_MGMT_OBJID" value="${info.CONTRACT_MGMT_OBJID}" />
|
||||
<input type="hidden" name="SALES_REQUEST_OBJID" id="SALES_REQUEST_OBJID" value="${info.SALES_REQUEST_OBJID}" />
|
||||
<input type="hidden" name="TYPE" id="TYPE" value="${info.TYPE}" />
|
||||
<input type="hidden" name="TOTAL_AMOUNT" id="TOTAL_AMOUNT" value="" />
|
||||
<input type="hidden" name="SALES_MNG_USER_ID" id="SALES_MNG_USER_ID" value="${info.SALES_MNG_USER_ID}" />
|
||||
<input type="hidden" name="SALES_MNG_USER_ID2" id="SALES_MNG_USER_ID2" value="${info.SALES_MNG_USER_ID2}" />
|
||||
<input type="hidden" name="MANAGER_NAME" id="MANAGER_NAME" value="${info.MANAGER_NAME}" />
|
||||
<input type="hidden" name="MANAGER_POSITION" id="MANAGER_POSITION" value="${info.MANAGER_POSITION}" />
|
||||
<input type="hidden" name="MANAGER_PHONE" id="MANAGER_PHONE" value="${info.MANAGER_PHONE}" />
|
||||
<input type="hidden" name="MANAGER_EMAIL" id="MANAGER_EMAIL" value="${info.MANAGER_EMAIL}" />
|
||||
<input type="hidden" name="TOTAL_SUPPLY_PRICE" id="TOTAL_SUPPLY_PRICE" value="" />
|
||||
<input type="hidden" name="TOTAL_VAT" id="TOTAL_VAT" value="" />
|
||||
<input type="hidden" name="TOTAL_PRICE_ALL" id="TOTAL_PRICE_ALL" value="" />
|
||||
|
||||
<!-- 회사 헤더 -->
|
||||
<div class="po-header">
|
||||
<table style="width:100%; border:none;">
|
||||
<tr>
|
||||
<td style="border:none; vertical-align:top; width:120px;">
|
||||
<img src="<%=request.getContextPath()%>/images/logo.png" alt="RPS Logo" style="max-width:110px; height:auto;">
|
||||
</td>
|
||||
<td style="border:none; vertical-align:top;">
|
||||
<div class="company-name">R P S CO., LTD.</div>
|
||||
<div class="company-info">
|
||||
www.rps-korea.com<br/>
|
||||
8, Gukjegwahak 10-ro, Yuseong-gu, Daejeon, Republic of Korea<br/>
|
||||
Tel : +82-42-602-3300 / Fax : +82-42-672-3399 / E-mail : ady1225@rps-korea.com<br/>
|
||||
Purchasing Team Manager, An-Dong-Yoon
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Purchase Order 타이틀 -->
|
||||
<div class="po-title" style="text-decoration:underline;">Purchase Order</div>
|
||||
|
||||
<p style="font-size:11px; margin-bottom:8px;">We are pleased to issue Purchase Order with the terms and condition described as below.</p>
|
||||
|
||||
<!-- 기본정보 테이블 -->
|
||||
<table class="po-info-table">
|
||||
<tr>
|
||||
<td class="label-cell">Messrs.</td>
|
||||
<td class="value-cell">
|
||||
<select name="PARTNER_OBJID" id="PARTNER_OBJID" class="select2" style="width:100%;" <% if(!isModify){ %>disabled<% } %>>
|
||||
<option value="">Select</option>
|
||||
${code_map.partner_cd}
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="5" style="width:1px; border:none; padding:0;"></td>
|
||||
<td class="right-label">Shipment</td>
|
||||
<td class="right-value" style="background-color:#ebf1de;">
|
||||
<input type="text" name="SHIPMENT" id="SHIPMENT" value="${info.SHIPMENT}" style="width:100%; border:none; background-color:#ebf1de;" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label-cell">Attn. to</td>
|
||||
<td class="value-cell">
|
||||
<input type="text" name="ATTN_TO" id="ATTN_TO" value="${info.ATTN_TO}" style="width:100%; border:none;" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
<td class="right-label">Payment</td>
|
||||
<td class="right-value">
|
||||
<input type="text" name="PAYMENT_TERMS" id="PAYMENT_TERMS" value="${info.PAYMENT_TERMS}" style="width:100%; border:none;" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label-cell">Date</td>
|
||||
<td class="value-cell">
|
||||
<input type="hidden" name="PURCHASE_DATE" id="PURCHASE_DATE" value="${info.PURCHASE_DATE}" />
|
||||
<input type="text" id="PURCHASE_DATE_DISPLAY" class="date_icon" value="" style="width:100%;" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
<td class="right-label">Packing</td>
|
||||
<td class="right-value">
|
||||
<input type="text" name="PACKING" id="PACKING" value="${info.PACKING}" style="width:100%; border:none;" placeholder="Export Standard" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label-cell">Ref. NO</td>
|
||||
<td class="value-cell">
|
||||
<input type="text" name="PURCHASE_ORDER_NO" id="PURCHASE_ORDER_NO" value="${info.PURCHASE_ORDER_NO}" style="width:100%; border:none; font-weight:bold;" readonly />
|
||||
</td>
|
||||
<td class="right-label">Validity</td>
|
||||
<td class="right-value">
|
||||
<input type="text" name="VALIDITY" id="VALIDITY" value="${info.VALIDITY}" style="width:100%; border:none;" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label-cell"> </td>
|
||||
<td class="value-cell"> </td>
|
||||
<td class="right-label">Remarks</td>
|
||||
<td class="right-value">
|
||||
<input type="text" name="REMARK" id="REMARK" value="${info.REMARK}" style="width:100%; border:none;" <% if(!isModify){ %>readonly<% } %> />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 버튼 영역 -->
|
||||
<div style="width:100%; margin:10px 0; text-align:right;">
|
||||
<% if(isModify){ %>
|
||||
<!-- <input type="button" value="Add" class="dtn" id="btnAdd" style="background:#dfeffc; padding:5px 15px; cursor:pointer; font-size:12px; border-radius:5px;">
|
||||
<input type="button" value="Delete" class="dtn" id="btnDel" style="background:#fce4ec; padding:5px 15px; cursor:pointer; font-size:12px; border-radius:5px;"> -->
|
||||
<input type="button" value="Save" class="dtn" id="btnSave" style="background:#dfeffc; padding:5px 15px; cursor:pointer; font-size:14px; border-radius:5px;">
|
||||
<% }else{ %>
|
||||
<input type="button" value="Download PO" class="" id="btnDown" style="background:#dfeffc; padding:5px 15px; cursor:pointer; font-size:14px; border-radius:5px;">
|
||||
<% } %>
|
||||
<input type="button" value="Close" 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>
|
||||
|
||||
<!-- TOTAL 영역 -->
|
||||
<table class="po-total-row" style="width:100%; margin-top:5px;">
|
||||
<tr>
|
||||
<td style="text-align:center; width:70%; background-color:#d9e2f3; font-size:14px;">TOTAL</td>
|
||||
<td style="text-align:right; width:30%;"><span id="TOTAL_AMOUNT_DISPLAY" style="font-size:14px;">US$0.00</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 하단 메시지 -->
|
||||
<p style="font-size:11px; margin:15px 0; font-style:italic;">Look forward to your soonest delivery with good condition.</p>
|
||||
|
||||
<!-- 서명 영역 -->
|
||||
<div class="po-signature" style="position:relative;">
|
||||
<hr style="width:250px; margin:0 0 10px auto; border:none; border-top:1px solid #000;"/>
|
||||
<div class="sign-name" style="margin-right:70px;">Signed by Dong-Heon Lee / President</div>
|
||||
<div class="sign-company" style="margin-right:70px;">RPS CO.,LTD</div>
|
||||
<img src="<%=request.getContextPath()%>/images/stamp_seal.png" alt="Stamp" style="position:absolute; right:0; bottom:0; width:65px; height:65px; opacity:0.85;" onerror="this.style.display='none'">
|
||||
</div>
|
||||
|
||||
<textarea style="display:none;" id="unit_cd">${code_map.unit_cd}</textarea>
|
||||
<textarea style="display:none;" id="currency_cd">${code_map.currency_cd}</textarea>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -507,19 +507,21 @@ function fn_formPopUp(objId, copy, formType){
|
||||
var url = "";
|
||||
|
||||
if(formType == 'outsourcing'){
|
||||
// 외주가공 발주서 양식
|
||||
target = "purchaseOrderFormPopup_outsourcing";
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_outsourcing.do";
|
||||
popup_width = 1200;
|
||||
popup_height = 900;
|
||||
} else if(formType == 'english'){
|
||||
target = "purchaseOrderFormPopup_english";
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_english.do";
|
||||
popup_width = 1100;
|
||||
popup_height = 900;
|
||||
} else if(formType == 'general'){
|
||||
// 일반 발주서 양식
|
||||
target = "purchaseOrderFormPopup_general";
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_general.do";
|
||||
popup_width = 1000;
|
||||
popup_height = 900;
|
||||
} else {
|
||||
// 기존 발주서 양식 (FORM_TYPE이 없거나 기존 데이터)
|
||||
target = "purchaseOrderFormPopup_new";
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_new.do";
|
||||
}
|
||||
|
||||
@@ -529,21 +529,24 @@ function fn_generatePdfAndSend(){
|
||||
}
|
||||
});
|
||||
|
||||
// 발주서 양식 타입 확인 (일반/외주)
|
||||
// 발주서 양식 타입 확인 (일반/외주/영문)
|
||||
var formType = fnc_checkNull(purchaseOrderInfo.FORM_TYPE) || 'general';
|
||||
var url = "";
|
||||
|
||||
if(formType === 'outsourcing') {
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_outsourcing.do?actType=VIEW&PURCHASE_ORDER_MASTER_OBJID=" + purchaseOrderObjId;
|
||||
} else if(formType === 'english') {
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_english.do?actType=VIEW&PURCHASE_ORDER_MASTER_OBJID=" + purchaseOrderObjId;
|
||||
} else {
|
||||
url = "/purchaseOrder/purchaseOrderFormPopup_general.do?actType=VIEW&PURCHASE_ORDER_MASTER_OBJID=" + purchaseOrderObjId;
|
||||
}
|
||||
|
||||
// 숨겨진 iframe으로 발주서 페이지 로드
|
||||
var iframeWidth = (formType === 'english') ? '1100px' : '900px';
|
||||
var iframe = $('<iframe>', {
|
||||
id: 'pdfGeneratorFrame',
|
||||
src: url,
|
||||
style: 'position:absolute;left:-9999px;top:-9999px;width:900px;height:1200px;border:none;'
|
||||
style: 'position:absolute;left:-9999px;top:-9999px;width:' + iframeWidth + ';height:1200px;border:none;'
|
||||
}).appendTo('body');
|
||||
|
||||
// iframe 로드 완료 대기
|
||||
|
||||
@@ -55,6 +55,9 @@ String menuName = CommonUtils.getMenuName(menuObjId, "구매관리_품의서관
|
||||
max-height: 48px !important;
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
.swal2-styled {
|
||||
padding: 1em 1.5em !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var _tabulGrid;
|
||||
@@ -112,23 +115,24 @@ $(document).ready(function(){
|
||||
// 발주서생성 - 양식 선택 팝업
|
||||
$("#btnCreatePO").click(function(){
|
||||
var selectedRowIds = _tabulGrid.getSelectedData();
|
||||
if(selectedRowIds.length < 1){
|
||||
Swal.fire("발주서를 생성할 행을 선택해주십시오.");
|
||||
return false;
|
||||
}
|
||||
// if(selectedRowIds.length < 1){
|
||||
// Swal.fire("발주서를 생성할 행을 선택해주십시오.");
|
||||
// //return false;
|
||||
// }
|
||||
|
||||
var statusTitle = fnc_checkNull(selectedRowIds[0].STATUS_TITLE);
|
||||
if(statusTitle != '결재완료'){
|
||||
Swal.fire("결재완료 상태만 발주서 생성이 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
// var statusTitle = fnc_checkNull(selectedRowIds[0].STATUS_TITLE);
|
||||
// if(statusTitle != '결재완료'){
|
||||
// Swal.fire("결재완료 상태만 발주서 생성이 가능합니다.");
|
||||
// //return false;
|
||||
// }
|
||||
|
||||
// 발주서 양식 선택 팝업
|
||||
Swal.fire({
|
||||
title: '발주서 양식을 선택하세요',
|
||||
html: '<div style="margin: 20px 0;">' +
|
||||
'<button onclick="window.openGeneralPO()" class="swal2-confirm swal2-styled" style="margin: 0 10px; background-color: #3085d6; min-width: 140px;">일반 발주서</button>' +
|
||||
'<button onclick="window.openOutsourcingPO()" class="swal2-confirm swal2-styled" style="margin: 0 10px; background-color: #28a745; min-width: 140px;">외주가공 발주서</button>' +
|
||||
html: '<div style="display:flex; justify-content:center; gap:12px; margin:20px 0;">' +
|
||||
'<button onclick="window.openGeneralPO()" class="swal2-confirm swal2-styled" style="margin:0; background-color:#3085d6; min-width:140px;">일반 발주서</button>' +
|
||||
'<button onclick="window.openOutsourcingPO()" class="swal2-confirm swal2-styled" style="margin:0; background-color:#28a745; min-width:140px;">외주가공 발주서</button>' +
|
||||
'<button onclick="window.openEnglishPO()" class="swal2-confirm swal2-styled" style="margin:0; background-color:#6f42c1; min-width:140px;">영문 발주서</button>' +
|
||||
'</div>',
|
||||
showConfirmButton: false,
|
||||
showCancelButton: true,
|
||||
@@ -147,13 +151,21 @@ $(document).ready(function(){
|
||||
Swal.close();
|
||||
fn_createPurchaseOrder(selectedRowIds, "outsourcing");
|
||||
};
|
||||
|
||||
// 영문 발주서 양식으로 발주서 자동 생성
|
||||
window.openEnglishPO = function() {
|
||||
Swal.close();
|
||||
// TODO: 테스트 후 아래 주석 해제하고 window.open 라인 삭제할 것
|
||||
// fn_createPurchaseOrder(selectedRowIds, "english");
|
||||
window.open("/purchaseOrder/purchaseOrderFormPopup_english.do", "purchaseOrderFormPopup_english", "width=1100,height=900,scrollbars=yes,resizable=yes");
|
||||
};
|
||||
});
|
||||
|
||||
// 발주서 자동 생성 (기존 로직 + 양식 타입 추가)
|
||||
function fn_createPurchaseOrder(selectedRowIds, formType) {
|
||||
Swal.fire({
|
||||
title: '발주서 생성',
|
||||
text: '선택한 품의서로 ' + (formType == 'general' ? '일반' : '외주가공') + ' 발주서를 생성하시겠습니까?',
|
||||
text: '선택한 품의서로 ' + (formType == 'general' ? '일반' : formType == 'outsourcing' ? '외주가공' : '영문') + ' 발주서를 생성하시겠습니까?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '생성',
|
||||
|
||||
@@ -863,6 +863,180 @@ public class PurchaseOrderController {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 영문 발주서 양식 팝업
|
||||
*/
|
||||
@RequestMapping("/purchaseOrder/purchaseOrderFormPopup_english.do")
|
||||
public String purchaseOrderFormPopup_english(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
||||
Map code_map = new HashMap();
|
||||
Map info = new HashMap();
|
||||
List detailList = new ArrayList();
|
||||
HashMap oemInfo = new HashMap();
|
||||
|
||||
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||||
String objId = CommonUtils.checkNull(paramMap.get("PURCHASE_ORDER_MASTER_OBJID"), "");
|
||||
String proposalObjId = CommonUtils.checkNull(paramMap.get("PROPOSAL_OBJID"), "");
|
||||
String writer = CommonUtils.checkNull(person.getUserId());
|
||||
String writerName = person.getUserName();
|
||||
|
||||
try{
|
||||
oemInfo = (HashMap)adminService.getSupMngInfo("-1130201617");
|
||||
|
||||
if(objId.equals("")){
|
||||
request.setAttribute("actType", "C");
|
||||
objId = CommonUtils.createObjId();
|
||||
info.put("actType", "C");
|
||||
info.put("OBJID", objId);
|
||||
info.put("PROPOSAL_OBJID", proposalObjId);
|
||||
info.put("SALES_MNG_USER_ID", writer);
|
||||
info.put("PURCHASE_ORDER_NO", "RPS" + new java.text.SimpleDateFormat("yy").format(new java.util.Date()) + "-" + new java.text.SimpleDateFormat("MMdd").format(new java.util.Date()) + "-rev1");
|
||||
info.put("PURCHASE_DATE", new java.text.SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date()));
|
||||
info.put("SHIPMENT", "OCS");
|
||||
info.put("PACKING", "Export Standard");
|
||||
info.put("MANAGER_NAME", "An-Dong-Yoon");
|
||||
info.put("MANAGER_POSITION", "Team Manager");
|
||||
info.put("MANAGER_PHONE", "+82-42-602-3300");
|
||||
info.put("MANAGER_EMAIL", "ady1225@rps-korea.com");
|
||||
|
||||
// 품의서 마스터 정보 조회 (프로젝트번호, 품의서OBJID 등)
|
||||
if(!"".equals(proposalObjId)){
|
||||
Map proposalInfoParam = new HashMap();
|
||||
proposalInfoParam.put("PROPOSAL_OBJID", proposalObjId);
|
||||
Map proposalMaster = (Map) commonService.selectOne("salesMng.getProposalInfo", request, proposalInfoParam);
|
||||
if(proposalMaster != null){
|
||||
info.put("SALES_REQUEST_OBJID", proposalObjId);
|
||||
String projectNo = CommonUtils.checkNull(proposalMaster.get("PROJECT_NO"));
|
||||
if("".equals(projectNo)) projectNo = CommonUtils.checkNull(proposalMaster.get("project_no"));
|
||||
if(!"".equals(projectNo)) info.put("CONTRACT_MGMT_OBJID", projectNo);
|
||||
}
|
||||
}
|
||||
|
||||
if(!"".equals(proposalObjId)){
|
||||
Map proposalParam = new HashMap();
|
||||
proposalParam.put("PROPOSAL_OBJID", proposalObjId);
|
||||
List proposalPartList = commonService.selectList("salesMng.getProposalPartList", request, proposalParam);
|
||||
if(proposalPartList != null && proposalPartList.size() > 0){
|
||||
for(int i = 0; i < proposalPartList.size(); i++){
|
||||
Map partRow = (Map)proposalPartList.get(i);
|
||||
Map detailRow = new HashMap();
|
||||
detailRow.put("OBJID", "");
|
||||
|
||||
String partObjId = CommonUtils.checkNull(partRow.get("PART_OBJID"));
|
||||
if("".equals(partObjId)) partObjId = CommonUtils.checkNull(partRow.get("part_objid"));
|
||||
detailRow.put("PART_OBJID", partObjId);
|
||||
|
||||
String partNo = CommonUtils.checkNull(partRow.get("PART_NO"));
|
||||
if("".equals(partNo)) partNo = CommonUtils.checkNull(partRow.get("part_no"));
|
||||
detailRow.put("PART_NO", partNo);
|
||||
|
||||
String partName = CommonUtils.checkNull(partRow.get("PART_NAME"));
|
||||
if("".equals(partName)) partName = CommonUtils.checkNull(partRow.get("part_name"));
|
||||
detailRow.put("PART_NAME", partName);
|
||||
|
||||
String spec = CommonUtils.checkNull(partRow.get("SPEC"));
|
||||
if("".equals(spec)) spec = CommonUtils.checkNull(partRow.get("spec"));
|
||||
detailRow.put("SPEC", spec);
|
||||
|
||||
Object qtyObj = partRow.get("QTY");
|
||||
if(qtyObj == null) qtyObj = partRow.get("qty");
|
||||
String qtyStr = CommonUtils.checkNull(qtyObj, "0").toString().replaceAll(",", "");
|
||||
int qty = 0;
|
||||
try { qty = (int)Double.parseDouble(qtyStr.equals("") ? "0" : qtyStr); } catch(Exception e) { qty = 0; }
|
||||
detailRow.put("ORDER_QTY", qty);
|
||||
|
||||
// 단위: 품의서의 DB 코드값 사용
|
||||
String unit = CommonUtils.checkNull(partRow.get("UNIT"));
|
||||
if("".equals(unit)) unit = CommonUtils.checkNull(partRow.get("unit"));
|
||||
detailRow.put("UNIT", "".equals(unit) ? "0001400" : unit);
|
||||
|
||||
// 환종: 기본 USD
|
||||
detailRow.put("CURRENCY", "USD");
|
||||
|
||||
Object priceObj = partRow.get("UNIT_PRICE");
|
||||
if(priceObj == null) priceObj = partRow.get("unit_price");
|
||||
String priceStr = CommonUtils.checkNull(priceObj, "0").toString().replaceAll(",", "");
|
||||
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);
|
||||
|
||||
// 입고요청일
|
||||
Object deliveryDateObj = partRow.get("DELIVERY_REQUEST_DATE");
|
||||
detailRow.put("DELIVERY_REQUEST_DATE", deliveryDateObj != null ? String.valueOf(deliveryDateObj).trim() : "");
|
||||
|
||||
detailList.add(detailRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
info = purchaseOrderService.getPurchaseOrderMasterInfo(request, paramMap);
|
||||
paramMap.put("MULTI_MASTER_OBJID", objId);
|
||||
detailList = commonService.selectList("purchaseOrder.getPURCHASE_ORDER_PART", request, paramMap);
|
||||
}
|
||||
|
||||
code_map.put("partner_cd", commonService.bizMakeOptionList("", (String)info.get("PARTNER_OBJID"),"common.getClientMngSupplySelect"));
|
||||
|
||||
// 단위 코드 (그리드 select용)
|
||||
Map param = new HashMap();
|
||||
param.put("code","0001399");
|
||||
code_map.put("unit_cd", commonService.getJqGridSelectBoxJsonData2("common.getCodeselect", param, "Select", "CODE", "NAME"));
|
||||
|
||||
// 환종 코드 (그리드 select용)
|
||||
Map currencyParam = new HashMap();
|
||||
currencyParam.put("code","0001533");
|
||||
code_map.put("currency_cd", commonService.getJqGridSelectBoxJsonData2("common.getCodeselect", currencyParam, "Select", "CODE", "NAME"));
|
||||
|
||||
code_map.put("payment_terms_cd", commonService.bizMakeOptionList("0001074", (String)info.get("PAYMENT_TERMS"),"common.getCodeselect"));
|
||||
|
||||
request.setAttribute("oemInfo", oemInfo);
|
||||
request.setAttribute("info", info);
|
||||
request.setAttribute("gridDetailList", JsonUtil.ListToJson(detailList));
|
||||
request.setAttribute("code_map", code_map);
|
||||
request.setAttribute("objId", objId);
|
||||
request.setAttribute("writer", writer);
|
||||
request.setAttribute("writerName", writerName);
|
||||
|
||||
Map userParam = new HashMap();
|
||||
List userList = commonService.selectList("common.getUserList", request, userParam);
|
||||
request.setAttribute("userList", userList);
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(CommonUtils.checkNull(paramMap.get("actType")).equals("DOWN")){
|
||||
request.setAttribute("detailList", detailList);
|
||||
Map apprParam = new HashMap();
|
||||
apprParam.put("objId", objId);
|
||||
request.setAttribute("apprList", commonService.getApprovalLine(apprParam));
|
||||
return "/purchaseOrder/purchaseOrderFormPopup_englishDOWN";
|
||||
}else{
|
||||
return "/purchaseOrder/purchaseOrderFormPopup_english";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 영문 발주서 저장
|
||||
*/
|
||||
@RequestMapping("/purchaseOrder/purchaseOrderFormPopup_englishSave.do")
|
||||
@ResponseBody
|
||||
public Map purchaseOrderFormPopup_englishSave(HttpSession session, HttpServletRequest request, @RequestParam Map paramMap){
|
||||
Map resultMap = new HashMap();
|
||||
try{
|
||||
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||||
paramMap.put("WRITER", CommonUtils.checkNull(person.getUserId()));
|
||||
paramMap.put("FORM_TYPE", "english");
|
||||
|
||||
purchaseOrderService.savePurchaseOrder_new(request, paramMap);
|
||||
CommonUtils.setReqResult(request, "", "S", null, resultMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
CommonUtils.setReqResult(request, "", "F", e, resultMap);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 외주가공 발주서 양식 팝업
|
||||
*/
|
||||
|
||||
@@ -583,6 +583,10 @@
|
||||
,DELIVERY_PLAN_DATE
|
||||
,DELIVERY_PLAN_QTY
|
||||
,PURCHASE_ORDER_NO_ORG
|
||||
,SHIPMENT
|
||||
,PACKING
|
||||
,VALIDITY
|
||||
,ATTN_TO
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -640,6 +644,10 @@
|
||||
,#{DELIVERY_PLAN_DATE}
|
||||
,#{DELIVERY_PLAN_QTY}
|
||||
,#{PURCHASE_ORDER_NO_ORG}
|
||||
,#{SHIPMENT}
|
||||
,#{PACKING}
|
||||
,#{VALIDITY}
|
||||
,#{ATTN_TO}
|
||||
) ON CONFLICT (OBJID) DO
|
||||
UPDATE
|
||||
SET
|
||||
@@ -699,6 +707,10 @@
|
||||
,MULTI_YN = #{MULTI_YN}
|
||||
,MULTI_MASTER_YN = #{MULTI_MASTER_YN}
|
||||
,PURCHASE_ORDER_NO_ORG = #{PURCHASE_ORDER_NO_ORG}
|
||||
,SHIPMENT = #{SHIPMENT}
|
||||
,PACKING = #{PACKING}
|
||||
,VALIDITY = #{VALIDITY}
|
||||
,ATTN_TO = #{ATTN_TO}
|
||||
</update>
|
||||
<!--
|
||||
<update id="mergePurchaseOrderMulti" parameterType="map">
|
||||
@@ -1218,6 +1230,7 @@
|
||||
,PRODUCT_NAME
|
||||
,WORK_ORDER_NO
|
||||
,DELIVERY_REQUEST_DATE
|
||||
,CURRENCY
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -1261,6 +1274,7 @@
|
||||
,#{PRODUCT_NAME}
|
||||
,#{WORK_ORDER_NO}
|
||||
,#{DELIVERY_REQUEST_DATE}
|
||||
,#{CURRENCY}
|
||||
) ON CONFLICT (OBJID) DO
|
||||
UPDATE
|
||||
SET
|
||||
@@ -1292,6 +1306,7 @@
|
||||
,PRODUCT_NAME = #{PRODUCT_NAME}
|
||||
,WORK_ORDER_NO = #{WORK_ORDER_NO}
|
||||
,DELIVERY_REQUEST_DATE = #{DELIVERY_REQUEST_DATE}
|
||||
,CURRENCY = #{CURRENCY}
|
||||
</update>
|
||||
|
||||
<select id="getMyCompanyInfo" parameterType="map" resultType="map">
|
||||
@@ -1462,8 +1477,14 @@
|
||||
|
||||
-- 요청사항
|
||||
,POM.REQUEST_CONTENT
|
||||
|
||||
-- 양식 타입 (general/outsourcing)
|
||||
|
||||
-- 영문발주서 전용 필드
|
||||
,POM.SHIPMENT
|
||||
,POM.PACKING
|
||||
,POM.VALIDITY
|
||||
,POM.ATTN_TO
|
||||
|
||||
-- 양식 타입 (general/outsourcing/english)
|
||||
,COALESCE(POM.FORM_TYPE, 'general') AS FORM_TYPE
|
||||
FROM
|
||||
PURCHASE_ORDER_MASTER POM
|
||||
|
||||
@@ -1570,11 +1570,14 @@ public class PurchaseOrderService {
|
||||
sqlParamMap.clear();
|
||||
sqlParamMap.put("project_objid", CONTRACT_MGMT_OBJID);
|
||||
sqlParamMap.put("unitCode", UNIT_CODE);
|
||||
List<Map<String, Object>> resultListUnit = (ArrayList)sqlSession.selectList("common.getUnitCodeList", sqlParamMap); //unit 조회
|
||||
if(resultListUnit == null || resultListUnit.isEmpty()) {
|
||||
throw new Exception("UNIT이 존재하지 않습니다.");
|
||||
}{
|
||||
UNIT_NAME = (String)resultListUnit.get(0).get("task_name");
|
||||
// 프로젝트/유닛 정보가 있는 경우에만 UNIT 검증 (영문발주서 등 프로젝트 미연결 시 건너뜀)
|
||||
if(StringUtils.isNotBlank(CONTRACT_MGMT_OBJID) && StringUtils.isNotBlank(UNIT_CODE)) {
|
||||
List<Map<String, Object>> resultListUnit = (ArrayList)sqlSession.selectList("common.getUnitCodeList", sqlParamMap); //unit 조회
|
||||
if(resultListUnit == null || resultListUnit.isEmpty()) {
|
||||
throw new Exception("UNIT이 존재하지 않습니다.");
|
||||
}{
|
||||
UNIT_NAME = (String)resultListUnit.get(0).get("task_name");
|
||||
}
|
||||
}
|
||||
|
||||
//동시발주
|
||||
@@ -3137,8 +3140,9 @@ public class PurchaseOrderService {
|
||||
fromUser = CommonUtils.checkNull((String)masterInfo.get("WRITER"));
|
||||
}
|
||||
|
||||
// 발주서 메일은 PURCHASE 계정 사용
|
||||
boolean sendResult = MailUtil.sendMailWithAttachFile(fromUser, fromEmail, toUserIdList, toEmailList, ccEmailList, null, null, subject, mailContents, attachFileList, "PURCHASE_ORDER", Constants.Mail.ACCOUNT_TYPE_PURCHASE);
|
||||
// 발주서 메일 발송 (PURCHASE 계정 수신 불가 이슈로 SALES 계정 임시 사용 - TODO: PURCHASE 계정 정상화 후 원복)
|
||||
boolean sendResult = MailUtil.sendMailWithAttachFile(fromUser, fromEmail, toUserIdList, toEmailList, ccEmailList, null, null, subject, mailContents, attachFileList, "PURCHASE_ORDER", Constants.Mail.ACCOUNT_TYPE_SALES);
|
||||
//boolean sendResult = MailUtil.sendMailWithAttachFile(fromUser, fromEmail, toUserIdList, toEmailList, ccEmailList, null, null, subject, mailContents, attachFileList, "PURCHASE_ORDER", Constants.Mail.ACCOUNT_TYPE_PURCHASE);
|
||||
|
||||
if(sendResult) {
|
||||
// 메일 발송 성공 시 DB 업데이트
|
||||
|
||||
Reference in New Issue
Block a user