757 lines
26 KiB
Plaintext
757 lines
26 KiB
Plaintext
<%@ 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;
|
|
}
|
|
.ui-jqgrid tr.jqgrow td {
|
|
white-space: normal !important;
|
|
word-wrap: break-word;
|
|
word-break: break-all;
|
|
}
|
|
</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());
|
|
var _gridData = $.parseJSON($("#gridDetailList").val());
|
|
for(var i = 0; i < _gridData.length; i++) {
|
|
if(_gridData[i].SPEC && _gridData[i].SPEC.trim() !== '') {
|
|
_gridData[i].PART_NAME = _gridData[i].PART_NAME + '/' + _gridData[i].SPEC;
|
|
}
|
|
}
|
|
console.log("=== gridDetailList ===", JSON.stringify(_gridData));
|
|
console.log("=== currency_cd ===", JSON.stringify(currency_cd));
|
|
|
|
grid = $("#grid1").jqGrid({
|
|
url: ""
|
|
,datatype: "local"
|
|
,data: _gridData
|
|
,colNames: ["OBJID","PART_OBJID","Item No.","Commodity & Description","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:120, align:"center", sortable:false, editable:false}
|
|
,{name:"PART_NAME" , width:260, 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:50, 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: "0001534" }
|
|
}
|
|
,{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:90, 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();
|
|
if(!initDate || initDate.trim() === '') {
|
|
var today = new Date();
|
|
initDate = today.getFullYear() + '-' + ('0'+(today.getMonth()+1)).slice(-2) + '-' + ('0'+today.getDate()).slice(-2);
|
|
$("#PURCHASE_DATE").val(initDate);
|
|
}
|
|
$("#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 + (rowData.map.SPEC ? '/' + rowData.map.SPEC : '')
|
|
,"ORDER_QTY" : v1
|
|
,"UNIT" : fnc_checkNullDefaultValue(rowData.map.UNIT, '0001400')
|
|
,"CURRENCY" : "0001534"
|
|
,"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;
|
|
|
|
var ids = grid.jqGrid('getDataIDs');
|
|
var currencyCode = '0001534';
|
|
if(ids.length > 0) {
|
|
var $sel = $("#grid1").find("#" + ids[0] + "_CURRENCY");
|
|
currencyCode = $sel.length > 0 ? $sel.val() : (grid.jqGrid('getCell', ids[0], 'CURRENCY') || '0001534');
|
|
}
|
|
var currencySymbol = getCurrencySymbol(currencyCode);
|
|
|
|
$("#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(currencySymbol + numberWithCommasDecimal(totalAmount));
|
|
}
|
|
}
|
|
|
|
function numberWithCommasDecimal(num) {
|
|
var n = Number(num);
|
|
return n.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
|
|
function getCurrencySymbol(currencyCode) {
|
|
var symbolMap = { '0001534': 'US$', '0001535': '€', '0001536': '¥', '0001537': '¥', '0001566': '₩' };
|
|
return symbolMap[currencyCode] || 'US$';
|
|
}
|
|
|
|
$(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>
|