ERP-node/WebContent/WEB-INF/view/materMgmt/surtaxInfoSave.jsp

305 lines
7.9 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="java.util.*" %>
<%@include file= "/init.jsp" %>
<%
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
String userId = CommonUtils.checkNull(person.getUserId());
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<script>
$(document).ready(function(){
$("#btnClose").click(function(){
self.close(0);
});
//수정
$("#btnSave").click(function(){
fn_save();
});
//수정
$("#price").change(function(){
inputNumberFormat(this)
});
//수정
$("#qty").change(function(){
inputNumberFormat(this)
});
$("#project_no").change(function(){
fn_change_region_cd(this.value);
});
fnc_datepick();
});
//if($.isNumeric($(this).val())){ colSum3 += parseInt($(this).val()); } });
function inputNumberFormat(obj) {
var sup_price ="";
var sur_price ="";
var total_price ="";
if($("#region_cd").val()==""){
Swal.fire('Project No를 선택해 주세요');
$("#project_no").focus();
obj.value = "0";
return;
}
var gubun = $("#region_cd").val();
if(obj.id=="price" || obj.id=="qty"){
if($.isNumeric(obj.value)){
if(obj.id=="price"){
sup_price = Number($("#price").val().replace(/,/gi,"")) * Number($("#qty").val().replace(/,/gi,""));
$("#sup_price").val(sup_price);
}else{
sup_price = Number($("#qty").val().replace(/,/gi,"")) * Number($("#price").val().replace(/,/gi,""));
$("#sup_price").val(sup_price);
}
//국내
if(gubun=="REG01000"){
sur_price = sup_price * 0.1
$("#sur_price").val(sur_price);
}else{
sur_price = 0;
$("#sur_price").val("0");
}
total_price = sup_price + sur_price;
$("#total_price").val(total_price);
}else{
$("#price").val("0");
$("#qty").val("0");
$("#sup_price").val("0");
$("#sur_price").val("0");
$("#total_price").val("0");
}
}
//obj.value = comma(uncomma(obj.value));
}
function comma(str) {
str = String(str);
return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
}
function uncomma(str) {
str = String(str);
return str.replace(/[^\d]+/g, '');
}
//수저ㅗㅇ
function fn_save(){
if(fnc_valitate("form1")){
var message="수정";
if("${actionType}"=='regist'){
message="등록";
}
if(confirm(message+"하시겠습니까?")){
saveProcess();
}
}
}
function saveProcess(){
$.ajax({
url:"/materMgmt/saveSurtaxInfo.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
Swal.fire(data.RESULT.msg);
opener.fn_search();
self.close();
},
error: function(jqxhr, status, error){
}
});
}
//코드값을 받아와서 동적으로 selectbox 생성
function fn_change_region_cd(code){
var val=code;
var params = "codeId="+val;
//초기화
$("#h_region_cd").val("");
$("#h_customer_cd").val("");
$("#region_cd").val("");
$("#customer_cd").val("");
$.ajax({
type : "POST",
url : "/materMgmt/getregioncd.do",
data : params,
dataType:"json",
async: false,
success: function(data){
if(data.RESULT.length > 0){
$("#h_region_cd").val(data.RESULT[0].REGION_CD);
$("#h_customer_cd").val(data.RESULT[0].CUSTOMER_CD);
$("#region_cd").val(data.RESULT[0].REGION_CD);
$("#customer_cd").val(data.RESULT[0].CUSTOMER_CD);
}
}
});
}
</script>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="objId" id="objId" value="${objId}">
<input type="hidden" name="h_region_cd" id="h_region_cd" value="${info.REGION_CD}">
<input type="hidden" name="h_customer_cd" id="h_customer_cd" value="${info.CUSTOMER_CD}">
<section>
<div class="plm_menu_name">
<h2>
<span>매출입력</span>
</h2>
</div>
<div id="businessPopupFormWrap" >
<!-- <div class="form_popup_title">&nbsp;&nbsp;&nbsp;영업활동 등록</div> -->
<table class="pmsPopupForm">
<colgroup>
<col width="30%"/>
<col width="70%"/>
</colgroup>
<tr>
<td class="input_title">
<label for="">지역</label>
</td>
<td class="input_sub_title" >
<select name="region_cd" id="region_cd" required reqTitle="지역" type="select" readonly disabled>
<option value="">선택</option>
${code_map.region_cd}
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="project_no">Project No.</label>
</td>
<td class="input_sub_title">
<select name="project_no" id="project_no" required reqTitle="project_no" type="select">
<option value="">선택</option>
${code_map.project_no}
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">고객사</label>
</td>
<td class="input_sub_title">
<select name="customer_cd" id="customer_cd" required reqTitle="고객사" type="select" readonly disabled>
<option value="">선택</option>
${code_map.customer_cd}
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="reg_date" style="color:red">Date</label>
</td>
<td>
<input type="text" name="reg_date" id="reg_date" value="${info.REG_DATE}" class="date_icon" required reqTitle="날짜">
</td>
</tr>
<tr>
<td class="input_title">
<label for="title">제목</label>
</td>
<td class="input_sub_title">
<input type="text" name="title" id="title" value="${info.TITLE}" reqTitle="제목">
</td>
</tr>
<tr>
<td class="input_title">
<label for="qty">수량</label>
</td>
<td class="input_sub_title" align="right">
<input style="text-align:right;" type="text" name="qty" id="qty" value="${info.QTY}" reqTitle="수량" >
</td>
</tr>
<tr>
<td class="input_title">
<label for="price">단가</label>
</td>
<td class="input_sub_title">
<input style="text-align:right;" type="text" name="price" id="price" value="${info.PRICE}" reqTitle="수량">
</td>
</tr>
<tr>
<td class="input_title">
<label for="sup_price">공급금액</label>
</td>
<td class="input_sub_title">
<input style="text-align:right;" type="text" name="sup_price" id="sup_price" value="${info.SUP_PRICE}" reqTitle="수량" readonly>
</td>
</tr>
<tr>
<td class="input_title">
<label for="sur_price">세액</label>
</td>
<td align="right" class="input_sub_title">
<input style="text-align:right;" type="text" name="sur_price" id="sur_price" value="${info.SUR_PRICE}" reqTitle="수량" readonly>
</td>
</tr>
<tr>
<td class="input_title">
<label for="total_price">합계</label>
</td>
<td align="right" class="input_sub_title">
<input style="text-align:right;" type="text" name="total_price" id="total_price" value="${info.TOTAL_PRICE}" reqTitle="수량" readonly>
</td>
</tr>
</table>
</div>
<div class="btn_wrap">
<!-- <input type="button" value="Edit" class="plm_btns" onclick=""> -->
<div class="plm_btn_wrap_center">
<%-- <c:when test="${actionType eq 'regist' and (info.WRITER eq connectUserId or 'plm_admin' eq connectUserId)}"> --%>
<input type="button" value="저장" id="btnSave" class="plm_btns">
<input type="button" value="닫기" id="btnClose" class="plm_btns">
</div>
</div>
</section>
</form>
</body>
</html>