V2025101701 #3
2
.gitignore
vendored
2
.gitignore
vendored
@@ -31,3 +31,5 @@ Thumbs.db
|
||||
# Docker volumes
|
||||
.docker/
|
||||
|
||||
# Cursor files
|
||||
.cursor/
|
||||
|
||||
@@ -500,6 +500,11 @@
|
||||
,EXCHANGE_RATE
|
||||
,EST_PRICE
|
||||
,EST_SUPPLY_PRICE
|
||||
,ORDER_DATE
|
||||
,ORDER_UNIT_PRICE
|
||||
,ORDER_SUPPLY_PRICE
|
||||
,ORDER_VAT
|
||||
,ORDER_TOTAL_AMOUNT
|
||||
,(SELECT COUNT(1) FROM ESTIMATE_TEMPLATE WHERE CONTRACT_OBJID = T.OBJID) AS EST_STATUS
|
||||
,(
|
||||
SELECT IS_SEND
|
||||
@@ -718,6 +723,13 @@
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
|
||||
<if test="order_start_date != null and !''.equals(order_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
|
||||
@@ -877,9 +889,7 @@
|
||||
,CONTRACT_DEL_DATE
|
||||
,CONTRACT_COMPANY
|
||||
,CONTRACT_DATE
|
||||
,PO_NO
|
||||
,MANUFACTURE_PLANT
|
||||
,CONTRACT_RESULT
|
||||
,PROJECT_NAME
|
||||
,SPEC_USER_ID
|
||||
,SPEC_PLAN_DATE
|
||||
@@ -900,14 +910,8 @@
|
||||
,PART_NO
|
||||
,PART_NAME
|
||||
,SERIAL_NO
|
||||
,QUANTITY
|
||||
,CUSTOMER_REQUEST
|
||||
,EXCHANGE_RATE
|
||||
,ORDER_DATE
|
||||
,ORDER_UNIT_PRICE
|
||||
,ORDER_SUPPLY_PRICE
|
||||
,ORDER_VAT
|
||||
,ORDER_TOTAL_AMOUNT
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -944,9 +948,7 @@
|
||||
,#{contract_del_date}
|
||||
,#{contract_company}
|
||||
,#{contract_date}
|
||||
,#{po_no}
|
||||
,#{manufacture_plant}
|
||||
,#{contract_result}
|
||||
,#{project_name}
|
||||
,#{spec_user_id}
|
||||
,#{spec_plan_date}
|
||||
@@ -967,14 +969,8 @@
|
||||
,#{part_no}
|
||||
,#{part_name}
|
||||
,#{serial_no}
|
||||
,#{quantity}
|
||||
,#{customer_request}
|
||||
,#{exchange_rate}
|
||||
,#{order_date}
|
||||
,#{unit_price}
|
||||
,#{supply_price}
|
||||
,#{vat}
|
||||
,#{total_amount}
|
||||
)
|
||||
ON CONFLICT (OBJID) DO
|
||||
UPDATE
|
||||
@@ -1007,10 +1003,8 @@
|
||||
,REQ_DEL_DATE = #{req_del_date}
|
||||
,CONTRACT_DEL_DATE = #{contract_del_date}
|
||||
,CONTRACT_COMPANY = #{contract_company}
|
||||
,CONTRACT_DATE = #{contract_date}
|
||||
,PO_NO = #{po_no}
|
||||
,CONTRACT_DATE = #{contract_date}
|
||||
,MANUFACTURE_PLANT = #{manufacture_plant}
|
||||
,CONTRACT_RESULT = #{contract_result}
|
||||
,PROJECT_NAME = #{project_name}
|
||||
,SPEC_USER_ID = #{spec_user_id}
|
||||
,SPEC_PLAN_DATE = #{spec_plan_date}
|
||||
@@ -1031,14 +1025,8 @@
|
||||
,PART_NO = #{part_no}
|
||||
,PART_NAME = #{part_name}
|
||||
,SERIAL_NO = #{serial_no}
|
||||
,QUANTITY = #{quantity}
|
||||
,CUSTOMER_REQUEST = #{customer_request}
|
||||
,EXCHANGE_RATE = #{exchange_rate}
|
||||
,ORDER_DATE = #{order_date}
|
||||
,ORDER_UNIT_PRICE = #{unit_price}
|
||||
,ORDER_SUPPLY_PRICE = #{supply_price}
|
||||
,ORDER_VAT = #{vat}
|
||||
,ORDER_TOTAL_AMOUNT = #{total_amount}
|
||||
</update>
|
||||
|
||||
<update id="saveContractMgmtInfo_old" parameterType="map">
|
||||
|
||||
@@ -812,188 +812,332 @@
|
||||
,editEmpNo = #{cretEmpNo} /* 수정자 */
|
||||
</update>
|
||||
|
||||
<!-- 매출관리 그리드 목록 -->
|
||||
<!-- 매출관리 그리드 목록 (SW 테이블 사용 안함) -->
|
||||
<select id="getSalesMgmtGridList" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getSalesMgmtGridList */
|
||||
/* salesNcollectMgmt.getSalesMgmtGridList - VIEW 기반 조회 (원본 + 분할출하 통합) */
|
||||
SELECT
|
||||
B.OrderNo AS PROJECT_NO, /* 프로젝트번호를 계약번호로 우선 사용 */
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MajorCd = 'GE' AND MinorCd = B.SaleType) AS ORDER_TYPE,
|
||||
CASE WHEN C.c_class IS NOT NULL THEN
|
||||
CONCAT(
|
||||
(SELECT ltrim(rtrim(DTL_NM)) from SWSA999A_TBL where COMM_CD = 'S110' AND SUBSTRING(DTL_CD,1,1) = SUBSTRING(C.c_class,1,1)),
|
||||
'-',
|
||||
(SELECT ltrim(rtrim(DTL_NM)) from SWSA999A_TBL where COMM_CD = 'S120' AND SUBSTRING(DTL_CD,1,3) = SUBSTRING(C.c_class,1,3)),
|
||||
'-',
|
||||
(SELECT ltrim(rtrim(DTL_NM)) from SWSA999A_TBL where COMM_CD = 'S130' AND DTL_CD = C.c_class )
|
||||
)
|
||||
ELSE '' END AS PRODUCT_TYPE,
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MAjorCd = 'NA' AND MinorCd = B.nationGB) AS NATION,
|
||||
COALESCE(A.WrtYmd, B.OrderDate) AS RECEIPT_DATE,
|
||||
D.custNm AS CUSTOMER,
|
||||
(CASE B.freeyn WHEN 'Y' THEN '무상' ELSE '유상' END) AS PAYMENT_TYPE,
|
||||
C.GoodsCd AS PRODUCT_NO,
|
||||
C.GoodsNm AS PRODUCT_NAME,
|
||||
A.serialno AS SERIAL_NO,
|
||||
COALESCE(A.SupplyQty, B.goodsqty) AS QUANTITY,
|
||||
B.custreq AS REQUEST_DATE,
|
||||
COALESCE(A.Remark, B.bigo) AS CUSTOMER_REQUEST,
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MajorCd = 'SS' AND MinorCd = B.endsale) AS ORDER_STATUS,
|
||||
B.OrderNo AS PO_NO,
|
||||
B.OrderDate AS ORDER_DATE,
|
||||
B.orderattachpath AS ORDER_ATTACH,
|
||||
COALESCE(A.SupplyPrice, B.saleprice) AS UNIT_PRICE,
|
||||
COALESCE(A.SupplyAmt, B.saleamt) AS SUPPLY_PRICE,
|
||||
COALESCE(A.SupplyVat, B.vatamt) AS VAT,
|
||||
COALESCE((A.SupplyAmt + A.SupplyVat), (B.saleamt + B.vatamt)) AS TOTAL_AMOUNT,
|
||||
COALESCE(A.NoWonSymbol, B.nowonsymbol) AS CURRENCY,
|
||||
COALESCE(A.NoWonExChange, B.nowonexchange) AS EXCHANGE_RATE,
|
||||
B.shippingstatus AS SHIPPING_STATUS,
|
||||
B.shippingdate AS SHIPPING_DATE,
|
||||
B.shippingmethod AS SHIPPING_METHOD,
|
||||
(SELECT user_name FROM USER_INFO WHERE user_id = D.SalesMan) AS MANAGER,
|
||||
B.saleQty AS SALES_QUANTITY,
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MajorCd = 'IT' AND MinorCd = B.incoterms) AS INCOTERMS,
|
||||
B.salesstatus AS SALES_STATUS
|
||||
FROM SWSC110A_TBL B
|
||||
LEFT JOIN SWSD010A_TBL A ON A.orderNo = B.orderNo
|
||||
INNER JOIN SWSB110A_TBL C ON B.goodsCd = C.goodsCd
|
||||
INNER JOIN SWSB210A_TBL D ON B.custCd = D.custCd
|
||||
PROJECT_NO,
|
||||
ORDER_TYPE,
|
||||
PRODUCT_TYPE,
|
||||
NATION,
|
||||
RECEIPT_DATE,
|
||||
CUSTOMER,
|
||||
PAYMENT_TYPE,
|
||||
PRODUCT_NO,
|
||||
PRODUCT_NAME,
|
||||
SERIAL_NO,
|
||||
COALESCE(ORDER_QUANTITY, 0) AS ORDER_QUANTITY,
|
||||
REQUEST_DATE,
|
||||
CUSTOMER_REQUEST,
|
||||
ORDER_STATUS,
|
||||
PO_NO,
|
||||
ORDER_DATE,
|
||||
ORDER_ATTACH,
|
||||
PRODUCTION_STATUS,
|
||||
SHIPPING_ORDER_STATUS,
|
||||
COALESCE(SALES_QUANTITY, 0) AS SALES_QUANTITY,
|
||||
COALESCE(SALES_UNIT_PRICE, 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SALES_SUPPLY_PRICE, 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SALES_VAT, 0) AS SALES_VAT,
|
||||
COALESCE(SALES_TOTAL_AMOUNT, 0) AS SALES_TOTAL_AMOUNT,
|
||||
COALESCE(SALES_TOTAL_AMOUNT_KRW, 0) AS SALES_TOTAL_AMOUNT_KRW,
|
||||
SALES_CURRENCY,
|
||||
COALESCE(SALES_EXCHANGE_RATE, 0) AS SALES_EXCHANGE_RATE,
|
||||
SHIPPING_DATE,
|
||||
SHIPPING_METHOD,
|
||||
MANAGER,
|
||||
INCOTERMS,
|
||||
SALES_STATUS,
|
||||
SALE_NO,
|
||||
RECORD_TYPE,
|
||||
SPLIT_LOG_ID
|
||||
FROM v_sales_mgmt_with_splits
|
||||
WHERE 1 = 1
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND B.SaleType = #{orderType}
|
||||
AND CATEGORY_CD = #{orderType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
AND C.c_class = #{productType}
|
||||
AND PRODUCT_TYPE = #{productType}
|
||||
</if>
|
||||
<if test="nation != null and nation != ''">
|
||||
AND B.nationGB = #{nation}
|
||||
AND AREA_CD = #{nation}
|
||||
</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
AND D.custNm LIKE CONCAT('%', #{customer}, '%')
|
||||
AND CUSTOMER LIKE CONCAT('%', #{customer}, '%')
|
||||
</if>
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND B.freeyn = #{paymentType}
|
||||
AND PAID_TYPE = #{paymentType}
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND C.GoodsCd LIKE CONCAT('%', #{productNo}, '%')
|
||||
AND PRODUCT_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND C.GoodsNm LIKE CONCAT('%', #{productName}, '%')
|
||||
AND PRODUCT_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND A.serialno LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND B.endsale = #{orderStatus}
|
||||
AND STATUS_CD = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND B.OrderNo LIKE CONCAT('%', #{poNo}, '%')
|
||||
AND PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND B.custreq <![CDATA[>=]]> #{requestDateFrom}
|
||||
AND REQUEST_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND B.custreq <![CDATA[<=]]> #{requestDateTo}
|
||||
AND REQUEST_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND B.OrderDate <![CDATA[>=]]> #{orderDateFrom}
|
||||
AND ORDER_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND B.OrderDate <![CDATA[<=]]> #{orderDateTo}
|
||||
AND ORDER_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND B.shippingstatus = #{shippingStatus}
|
||||
AND SALES_STATUS = #{shippingStatus}
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND B.shippingdate <![CDATA[>=]]> #{shippingDateFrom}
|
||||
AND SHIPPING_DATE <![CDATA[>=]]> #{shippingDateFrom}
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND B.shippingdate <![CDATA[<=]]> #{shippingDateTo}
|
||||
AND SHIPPING_DATE <![CDATA[<=]]> #{shippingDateTo}
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
AND B.outGb = #{shippingMethod}
|
||||
AND SHIPPING_METHOD = #{shippingMethod}
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND B.bEmpNo = #{manager}
|
||||
AND PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
AND B.incoterms = #{incoterms}
|
||||
AND INCOTERMS = #{incoterms}
|
||||
</if>
|
||||
ORDER BY B.CRET_DATE DESC
|
||||
ORDER BY REGDATE DESC
|
||||
LIMIT #{COUNT_PER_PAGE} OFFSET #{PAGE_START}
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 그리드 목록 개수 -->
|
||||
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="int">
|
||||
/* salesNcollectMgmt.getSalesMgmtGridListCount */
|
||||
<!-- 매출관리 그리드 목록 개수 (VIEW 기반) -->
|
||||
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getSalesMgmtGridListCount - VIEW 기반 */
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM SWSC110A_TBL B
|
||||
LEFT JOIN SWSD010A_TBL A ON A.orderNo = B.orderNo
|
||||
INNER JOIN SWSB110A_TBL C ON B.goodsCd = C.goodsCd
|
||||
INNER JOIN SWSB210A_TBL D ON B.custCd = D.custCd
|
||||
CEIL(COUNT(1)::float / #{COUNT_PER_PAGE}::float)::numeric::integer AS MAX_PAGE_SIZE,
|
||||
COUNT(1)::integer AS TOTAL_CNT
|
||||
FROM v_sales_mgmt_with_splits
|
||||
WHERE 1 = 1
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND B.SaleType = #{orderType}
|
||||
AND CATEGORY_CD = #{orderType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
AND C.c_class = #{productType}
|
||||
AND PRODUCT_TYPE = #{productType}
|
||||
</if>
|
||||
<if test="nation != null and nation != ''">
|
||||
AND B.nationGB = #{nation}
|
||||
AND AREA_CD = #{nation}
|
||||
</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
AND D.custNm LIKE CONCAT('%', #{customer}, '%')
|
||||
AND CUSTOMER LIKE CONCAT('%', #{customer}, '%')
|
||||
</if>
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND B.freeyn = #{paymentType}
|
||||
AND PAID_TYPE = #{paymentType}
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND C.GoodsCd LIKE CONCAT('%', #{productNo}, '%')
|
||||
AND PRODUCT_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND C.GoodsNm LIKE CONCAT('%', #{productName}, '%')
|
||||
AND PRODUCT_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND A.serialno LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND B.endsale = #{orderStatus}
|
||||
AND STATUS_CD = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND B.OrderNo LIKE CONCAT('%', #{poNo}, '%')
|
||||
AND PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND B.custreq <![CDATA[>=]]> #{requestDateFrom}
|
||||
AND REQUEST_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND B.custreq <![CDATA[<=]]> #{requestDateTo}
|
||||
AND REQUEST_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND B.OrderDate <![CDATA[>=]]> #{orderDateFrom}
|
||||
AND ORDER_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND B.OrderDate <![CDATA[<=]]> #{orderDateTo}
|
||||
AND ORDER_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND B.shippingstatus = #{shippingStatus}
|
||||
AND SALES_STATUS = #{shippingStatus}
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND B.shippingdate <![CDATA[>=]]> #{shippingDateFrom}
|
||||
AND SHIPPING_DATE <![CDATA[>=]]> #{shippingDateFrom}
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND B.shippingdate <![CDATA[<=]]> #{shippingDateTo}
|
||||
AND SHIPPING_DATE <![CDATA[<=]]> #{shippingDateTo}
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
AND B.outGb = #{shippingMethod}
|
||||
AND SHIPPING_METHOD = #{shippingMethod}
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND B.bEmpNo = #{manager}
|
||||
AND PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
AND B.incoterms = #{incoterms}
|
||||
AND INCOTERMS = #{incoterms}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 합계 조회 (Total 공급가액, 부가세, 총액) -->
|
||||
<select id="getSalesMgmtTotals" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getSalesMgmtTotals */
|
||||
SELECT
|
||||
COALESCE(SUM(COALESCE(A.order_supply_price, '0')::numeric), 0)::numeric AS TOTAL_SUPPLY_PRICE, /* Total 공급가액 */
|
||||
COALESCE(SUM(COALESCE(A.order_vat, '0')::numeric), 0)::numeric AS TOTAL_VAT, /* Total 부가세 */
|
||||
COALESCE(SUM(COALESCE(A.order_total_amount, '0')::numeric), 0)::numeric AS TOTAL_AMOUNT /* Total 총액 */
|
||||
FROM contract_mgmt A
|
||||
LEFT JOIN supply_mng SUP ON SUP.objid::varchar = A.customer_objid
|
||||
WHERE 1 = 1
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND A.category_cd = #{orderType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
AND A.product = #{productType}
|
||||
</if>
|
||||
<if test="nation != null and nation != ''">
|
||||
AND A.area_cd = #{nation}
|
||||
</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
AND SUP.supply_name LIKE CONCAT('%', #{customer}, '%')
|
||||
</if>
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND A.paid_type = #{paymentType}
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND A.part_no LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND A.part_name LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND A.serial_no LIKE CONCAT('%', #{serialNo}, '%')
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND A.status_cd = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND A.po_no LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND A.req_del_date <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND A.req_del_date <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND A.order_date <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND A.order_date <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
/* shippingStatus 필드가 contract_mgmt에 없어서 주석 처리 */
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
/* shippingDate 조인 안됨 */
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
/* shippingDate 조인 안됨 */
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* shippingMethod 필드가 contract_mgmt에 없어서 주석 처리 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND A.pm_user_id = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* incoterms 필드가 contract_mgmt에 없어서 주석 처리 */
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 분할출하 - 원본 데이터 조회
|
||||
* @since 2025.10.20
|
||||
* @author system
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<select id="getContractByObjid" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getContractByObjid */
|
||||
SELECT
|
||||
*
|
||||
FROM contract_mgmt
|
||||
WHERE objid = #{objid}
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 분할출하 로그 저장 (로그 기반 방식)
|
||||
* @since 2025.10.20
|
||||
* @author system
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<insert id="insertSplitShipmentLog" parameterType="map">
|
||||
/* salesNcollectMgmt.insertSplitShipmentLog */
|
||||
INSERT INTO shipment_log (
|
||||
target_objid,
|
||||
log_type,
|
||||
log_message,
|
||||
split_quantity,
|
||||
original_quantity,
|
||||
shipping_status,
|
||||
sales_unit_price,
|
||||
sales_supply_price,
|
||||
sales_vat,
|
||||
sales_total_amount,
|
||||
sales_currency,
|
||||
sales_exchange_rate,
|
||||
serial_no,
|
||||
shipping_date,
|
||||
shipping_method,
|
||||
manager_user_id,
|
||||
incoterms,
|
||||
remark,
|
||||
is_split_record,
|
||||
reg_date,
|
||||
reg_user_id
|
||||
) VALUES (
|
||||
#{objid},
|
||||
#{logType},
|
||||
#{logMessage},
|
||||
#{splitQuantity}::integer,
|
||||
#{originalQuantity}::integer,
|
||||
'PENDING',
|
||||
#{salesUnitPrice}::numeric,
|
||||
#{salesSupplyPrice}::numeric,
|
||||
#{salesVat}::numeric,
|
||||
#{salesTotalAmount}::numeric,
|
||||
#{salesCurrency},
|
||||
#{salesExchangeRate}::numeric,
|
||||
#{serialNo},
|
||||
<choose>
|
||||
<when test="shippingDate != null and shippingDate != ''">
|
||||
TO_DATE(#{shippingDate}, 'YYYY-MM-DD'),
|
||||
</when>
|
||||
<otherwise>
|
||||
NULL,
|
||||
</otherwise>
|
||||
</choose>
|
||||
#{shippingMethod},
|
||||
#{managerUserId},
|
||||
#{incoterms},
|
||||
#{remark},
|
||||
true,
|
||||
NOW(),
|
||||
#{userId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
381
WebContent/WEB-INF/view/salesmgmt/salesMgmt/revenueMgmtList.jsp
Normal file
381
WebContent/WEB-INF/view/salesmgmt/salesMgmt/revenueMgmtList.jsp
Normal file
@@ -0,0 +1,381 @@
|
||||
<%@ 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 connector = person.getUserId();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title><%=Constants.SYSTEM_NAME%></title>
|
||||
|
||||
<script>
|
||||
// Excel 버튼 이벤트 등록 함수
|
||||
function fn_bindExcelButton() {
|
||||
setTimeout(function() {
|
||||
$('.excelBtn').off('click').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
fn_excel();
|
||||
return false;
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
fnc_datepick();
|
||||
//엔터키로 조회
|
||||
$("input").keyup(function(e){
|
||||
if(e.keyCode == 13){
|
||||
$("#page").val("1");
|
||||
fn_search();
|
||||
}
|
||||
});
|
||||
|
||||
$("#btnSearch").click(function(){
|
||||
$("#page").val("1");
|
||||
fn_search();
|
||||
});
|
||||
|
||||
fn_search();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문유형', field : 'ORDER_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '제품구분', field : 'PRODUCT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '국내/해외', field : 'NATION'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PRODUCT_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주수량', field : 'ORDER_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH',
|
||||
formatter: fnc_subInfoValueFormatter,
|
||||
cellClick: function(e, cell){
|
||||
var objid = cell.getData().PROJECT_NO || cell.getData().SALE_NO;
|
||||
if(objid){
|
||||
fn_FileRegist(objid, "ORDER_DOC", "주문서");
|
||||
}
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매수량', field : 'SALES_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매단가', field : 'SALES_UNIT_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매공급가액', field : 'SALES_SUPPLY_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매부가세', field : 'SALES_VAT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매총액', field : 'SALES_TOTAL_AMOUNT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매원화총액', field : 'SALES_TOTAL_AMOUNT_KRW',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '판매환종', field : 'SALES_CURRENCY'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매환율', field : 'SALES_EXCHANGE_RATE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: 2}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하방법', field : 'SHIPPING_METHOD'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '담당자', field : 'MANAGER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '매출마감현황', field : 'SALES_STATUS'}
|
||||
];
|
||||
|
||||
function fn_search(){
|
||||
// 그리드 조회 및 Total 합계 업데이트
|
||||
$.ajax({
|
||||
url: "/revenueMgmt/revenueGridList.do",
|
||||
type: "POST",
|
||||
data: $("#form1").serializeObject(),
|
||||
dataType: "json",
|
||||
beforeSend: function(){
|
||||
_startLoading("Loading...");
|
||||
},
|
||||
complete: function(){
|
||||
_endLoading();
|
||||
},
|
||||
success: function(response) {
|
||||
console.log("Response:", response); // 디버깅용
|
||||
|
||||
// 그리드 데이터 설정
|
||||
if(_tabulGrid){
|
||||
_tabulGrid.setData(response.RESULTLIST || []);
|
||||
} else {
|
||||
// 그리드 초기화
|
||||
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/revenueMgmt/revenueGridList.do", columns, true);
|
||||
// 그리드 초기화 후 Excel 버튼 이벤트 등록
|
||||
fn_bindExcelButton();
|
||||
}
|
||||
|
||||
// Total 합계 업데이트 (소문자 키 사용)
|
||||
if(response && response.TOTALS){
|
||||
var totals = response.TOTALS;
|
||||
console.log("Totals:", totals); // 디버깅용
|
||||
// PostgreSQL이 소문자로 반환하므로 소문자 키 사용
|
||||
var supplyPrice = totals.total_supply_price || totals.TOTAL_SUPPLY_PRICE || 0;
|
||||
var vat = totals.total_vat || totals.TOTAL_VAT || 0;
|
||||
var amount = totals.total_amount || totals.TOTAL_AMOUNT || 0;
|
||||
|
||||
$("#totalSupplyPrice").text(Number(supplyPrice).toLocaleString());
|
||||
$("#totalVat").text(Number(vat).toLocaleString());
|
||||
$("#totalAmount").text(Number(amount).toLocaleString());
|
||||
} else {
|
||||
console.log("No TOTALS in response"); // 디버깅용
|
||||
$("#totalSupplyPrice").text("0");
|
||||
$("#totalVat").text("0");
|
||||
$("#totalAmount").text("0");
|
||||
}
|
||||
|
||||
// 페이징 HTML 업데이트
|
||||
if(response.PAGE_HTML){
|
||||
$(".table_paging_wrap").html(response.PAGE_HTML);
|
||||
}
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
console.error("Error:", jqxhr, status, error);
|
||||
_endLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 엑셀 다운로드 실행 중 플래그
|
||||
var isExcelDownloading = false;
|
||||
|
||||
function fn_excel() {
|
||||
// 중복 실행 방지
|
||||
if(isExcelDownloading) {
|
||||
console.log("엑셀 다운로드가 이미 진행 중입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
isExcelDownloading = true;
|
||||
|
||||
try {
|
||||
// Total 값 가져오기
|
||||
var totalSupplyPrice = $("#totalSupplyPrice").text().replace(/,/g, '');
|
||||
var totalVat = $("#totalVat").text().replace(/,/g, '');
|
||||
var totalAmount = $("#totalAmount").text().replace(/,/g, '');
|
||||
|
||||
// 현재 데이터 백업
|
||||
var currentData = _tabulGrid.getData();
|
||||
|
||||
// Total 행 데이터 생성
|
||||
var totalRow = {
|
||||
PROJECT_NO: '[ Total 합계 ]',
|
||||
ORDER_TYPE: '',
|
||||
PRODUCT_TYPE: '',
|
||||
NATION: '',
|
||||
RECEIPT_DATE: '',
|
||||
CUSTOMER: '',
|
||||
PAYMENT_TYPE: '',
|
||||
PRODUCT_NO: '',
|
||||
PRODUCT_NAME: '',
|
||||
SERIAL_NO: '',
|
||||
ORDER_QUANTITY: '',
|
||||
REQUEST_DATE: '',
|
||||
CUSTOMER_REQUEST: '',
|
||||
ORDER_STATUS: '',
|
||||
PO_NO: '',
|
||||
ORDER_DATE: '',
|
||||
ORDER_ATTACH: '',
|
||||
SALES_QUANTITY: '',
|
||||
SALES_UNIT_PRICE: '',
|
||||
SALES_SUPPLY_PRICE: parseFloat(totalSupplyPrice) || 0,
|
||||
SALES_VAT: parseFloat(totalVat) || 0,
|
||||
SALES_TOTAL_AMOUNT: parseFloat(totalAmount) || 0,
|
||||
SALES_TOTAL_AMOUNT_KRW: '',
|
||||
SALES_CURRENCY: '',
|
||||
SALES_EXCHANGE_RATE: '',
|
||||
SHIPPING_DATE: '',
|
||||
SHIPPING_METHOD: '',
|
||||
MANAGER: '',
|
||||
INCOTERMS: '',
|
||||
SALES_STATUS: ''
|
||||
};
|
||||
|
||||
// 임시로 Total 행 추가
|
||||
_tabulGrid.addData([totalRow]);
|
||||
|
||||
// 엑셀 다운로드
|
||||
_tabulGrid.download("xlsx", "매출관리_" + new Date().toISOString().slice(0,10) + ".xlsx", {
|
||||
sheetName: "매출관리"
|
||||
});
|
||||
|
||||
// 다운로드 후 원래 데이터로 복원
|
||||
setTimeout(function() {
|
||||
_tabulGrid.setData(currentData);
|
||||
isExcelDownloading = false;
|
||||
}, 500);
|
||||
} catch(e) {
|
||||
console.error("엑셀 다운로드 오류:", e);
|
||||
isExcelDownloading = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function fn_FileRegist(objId, docType, docTypeName){
|
||||
var popup_width = 800;
|
||||
var popup_height = 350;
|
||||
|
||||
var params = "?targetObjId="+objId+"&docType="+docType+"&docTypeName="+docTypeName;
|
||||
var url = "/common/FileRegistPopup.do"+params;
|
||||
|
||||
fn_centerPopup(popup_width, popup_height, url);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form name="hiddenForm" id="hiddenForm">
|
||||
<input type="hidden" name="objid">
|
||||
<input type="hidden" name="actionType" id="actionType">
|
||||
</form>
|
||||
|
||||
<form name="form1" id="form1" method="post">
|
||||
<input type="hidden" name="actionType" id="actionType">
|
||||
<input type="hidden" name="page" id="page" value="1">
|
||||
<input type="hidden" name="COUNT_PER_PAGE" id="COUNT_PER_PAGE" value="10">
|
||||
<input type="hidden" name="PAGE_START" id="PAGE_START" value="0">
|
||||
<div class="min_part_enroll">
|
||||
<div class="content-box">
|
||||
<div class="content-box-s">
|
||||
<div class="plm_menu_name_gdnsi">
|
||||
<h2>
|
||||
<span>영업관리_매출관리</span>
|
||||
</h2>
|
||||
<div class="btnArea">
|
||||
<input type="button" value="조회" class="plm_btns" id="btnSearch">
|
||||
<input type="button" value="매출마감" class="plm_btns" id="btnDeadline">
|
||||
</div>
|
||||
</div>
|
||||
<div id="plmSearchZon">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col width="120px">
|
||||
<col width="20%">
|
||||
<col width="120px">
|
||||
<col width="20%">
|
||||
<col width="120px">
|
||||
<col width="20%">
|
||||
<col width="120px">
|
||||
<col width="*">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class="label"><label for="">주문유형</label></td>
|
||||
<td><select name="orderType" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.orderTypeList}</select></td>
|
||||
<td class="label"><label for="">제품구분</label></td>
|
||||
<td><select name="productType" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.productTypeList}</select></td>
|
||||
<td class="label"><label for="">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="nation" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="D">국내</option>
|
||||
<option value="E">해외</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><label for="">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paymentType" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="N">유상</option>
|
||||
<option value="Y">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">고객사</label></td>
|
||||
<td><input type="text" name="customer" /></td>
|
||||
<td class="label"><label for="">품번</label></td>
|
||||
<td><input type="text" name="productNo" /></td>
|
||||
<td class="label"><label for="">품명</label></td>
|
||||
<td><input type="text" name="productName" /></td>
|
||||
<td class="label"><label for="">S/N</label></td>
|
||||
<td><input type="text" name="serialNo" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">수주상태</label></td>
|
||||
<td><select name="orderStatus" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.orderStatusList}</select></td>
|
||||
<td class="label"><label for="">발주번호</label></td>
|
||||
<td><input type="text" name="poNo" /></td>
|
||||
<td class="label"><label for="">담당자</label></td>
|
||||
<td><select name="manager" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.managerList}</select></td>
|
||||
<td class="label"><label for="">인도조건</label></td>
|
||||
<td>
|
||||
<select name="incoterms" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="EXW">EXW</option>
|
||||
<option value="FOB">FOB</option>
|
||||
<option value="CIF">CIF</option>
|
||||
<option value="DDP">DDP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">출하대기 상태</label></td>
|
||||
<td><select name="shippingStatus" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
|
||||
<td class="label"><label for="">출고방법</label></td>
|
||||
<td>
|
||||
<select name="shippingMethod" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="DIRECT">직납</option>
|
||||
<option value="PARCEL">택배</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><label for="">요청납기</label></td>
|
||||
<td colspan="3"><input type="date" name="requestDateFrom" /> ~ <input type="date" name="requestDateTo" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="date" name="orderDateFrom" /> ~ <input type="date" name="orderDateTo" /></td>
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="3"><input type="date" name="shippingDateFrom" /> ~ <input type="date" name="shippingDateTo" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Total 합계 표시 영역 -->
|
||||
<div style="padding: 15px 0; background: #f5f5f5; border-radius: 4px; margin: 10px 0;">
|
||||
<table style="width: 100%; max-width: 800px; margin: 0 auto;">
|
||||
<tr>
|
||||
<td style="text-align: center; padding: 8px; font-weight: bold; font-size: 14px;">
|
||||
Total 공급가액: <span id="totalSupplyPrice" style="color: #2196F3;">0</span> 원
|
||||
</td>
|
||||
<td style="text-align: center; padding: 8px; font-weight: bold; font-size: 14px;">
|
||||
Total 부가세: <span id="totalVat" style="color: #FF9800;">0</span> 원
|
||||
</td>
|
||||
<td style="text-align: center; padding: 8px; font-weight: bold; font-size: 14px;">
|
||||
Total 총액: <span id="totalAmount" style="color: #4CAF50;">0</span> 원
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +1,68 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.pms.common.utils.*"%>
|
||||
<%@ 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.*" %>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@include file= "/init.jsp" %>
|
||||
<%
|
||||
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||||
String connector = person.getUserId();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title><%=Constants.SYSTEM_NAME%></title>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
fnc_datepick();
|
||||
//엔터키로 조회
|
||||
fnc_datepick(); // 날짜 선택기 초기화
|
||||
$('.select2').select2(); // select2 초기화
|
||||
|
||||
// 엔터키로 조회
|
||||
$("input").keyup(function(e){
|
||||
if(e.keyCode == 13){
|
||||
$("#page").val("1");
|
||||
fn_search();
|
||||
}
|
||||
});
|
||||
|
||||
$("#btnExcel").click(function() {
|
||||
fn_excel();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$("#btnSearch").click(function(){
|
||||
$("#page").val("1");
|
||||
fn_search();
|
||||
});
|
||||
|
||||
|
||||
// 초기 데이터 조회
|
||||
fn_search();
|
||||
|
||||
// 출하지시/판매등록 버튼
|
||||
$("#btnBulkRegister").click(function(){
|
||||
fn_bulkRegister();
|
||||
});
|
||||
|
||||
// 분할출하 버튼
|
||||
$("#btnSplitShipment").click(function(){
|
||||
fn_splitShipment();
|
||||
});
|
||||
});
|
||||
|
||||
function fn_openSaleRegPopup(orderNo, saleNo){
|
||||
var url = "/salesMgmt/salesRegForm.do?orderNo=" + orderNo + "&saleNo=" + saleNo;
|
||||
window.open(url, "", "width=600, height=400, menubars=no, scrollbars=yes, resizable=yes");
|
||||
}
|
||||
|
||||
function fn_FileRegist(objId, docType, docTypeName){
|
||||
var popup_width = 800;
|
||||
var popup_height = 350;
|
||||
|
||||
var params = "?targetObjId="+objId+"&docType="+docType+"&docTypeName="+docTypeName;
|
||||
var url = "/common/FileRegistPopup.do"+params;
|
||||
|
||||
fn_centerPopup(popup_width, popup_height, url);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
// 새로운 테이블 구조에 맞게 컬럼 정의 수정
|
||||
var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문유형', field : 'ORDER_TYPE'},
|
||||
@@ -49,58 +74,172 @@ var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PRODUCT_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '80', title : '수량', field : 'QUANTITY'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주수량', field : 'ORDER_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '단가', field : 'UNIT_PRICE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '공급가액', field : 'SUPPLY_PRICE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '부가세', field : 'VAT'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '총액', field : 'TOTAL_AMOUNT'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'CURRENCY'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '80', title : '환율', field : 'EXCHANGE_RATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '130', title : '출하대기 상태', field : 'SHIPPING_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출고일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출고방법', field : 'SHIPPING_METHOD'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH',
|
||||
formatter: fnc_subInfoValueFormatter,
|
||||
cellClick: function(e, cell){
|
||||
var objid = cell.getData().PROJECT_NO || cell.getData().SALE_NO;
|
||||
if(objid){
|
||||
fn_FileRegist(objid, "ORDER_DOC", "주문서");
|
||||
}
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '생산 상태', field : 'PRODUCTION_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하지시 상태', field : 'SHIPPING_ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매수량', field : 'SALES_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매단가', field : 'SALES_UNIT_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매공급가액', field : 'SALES_SUPPLY_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매부가세', field : 'SALES_VAT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매총액', field : 'SALES_TOTAL_AMOUNT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매원화총액', field : 'SALES_TOTAL_AMOUNT_KRW',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '판매환종', field : 'SALES_CURRENCY'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매환율', field : 'SALES_EXCHANGE_RATE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: 2}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하방법', field : 'SHIPPING_METHOD'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '담당자', field : 'MANAGER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매수량', field : 'SALES_QUANTITY'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '매출마감현황', field : 'SALES_STATUS'}
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'}
|
||||
];
|
||||
|
||||
// 데이터 조회 함수
|
||||
function fn_search(){
|
||||
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/salesMgmt/salesMgmtGridList.do", columns, true);
|
||||
}
|
||||
|
||||
function fn_excel() {
|
||||
document.form1.actionType.value = "excel";
|
||||
var form = document.form1;
|
||||
form.action="/salesMgmt/salesMgmtList.do";
|
||||
form.submit();
|
||||
// 일괄 출하지시/판매등록 함수
|
||||
function fn_bulkRegister(){
|
||||
if(!_tabulGrid){
|
||||
alert("그리드가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 선택된 행 가져오기
|
||||
var selectedRows = _tabulGrid.getSelectedData();
|
||||
|
||||
if(selectedRows.length === 0){
|
||||
alert("출하지시/판매등록할 항목을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 판매완료된 항목 필터링
|
||||
var validRows = selectedRows.filter(function(row){
|
||||
return row.SALES_STATUS != 'Y';
|
||||
});
|
||||
|
||||
if(validRows.length === 0){
|
||||
alert("선택한 항목 중 출하지시/판매등록 가능한 항목이 없습니다.\n(판매완료된 항목은 제외됩니다)");
|
||||
return;
|
||||
}
|
||||
|
||||
if(validRows.length !== selectedRows.length){
|
||||
var excludedCount = selectedRows.length - validRows.length;
|
||||
if(!confirm("선택한 " + selectedRows.length + "개 항목 중 " + validRows.length + "개 항목만 등록 가능합니다.\n(" + excludedCount + "개는 이미 판매완료 상태입니다)\n\n진행하시겠습니까?")){
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(!confirm("선택한 " + validRows.length + "개 항목을 출하지시/판매등록 하시겠습니까?")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 각 항목에 대해 판매등록 팝업 열기
|
||||
var popupCount = 0;
|
||||
var maxPopups = 5; // 최대 동시 팝업 개수 제한
|
||||
|
||||
if(validRows.length > maxPopups){
|
||||
alert("한번에 최대 " + maxPopups + "개까지만 등록 가능합니다.\n선택한 " + validRows.length + "개 중 처음 " + maxPopups + "개만 팝업이 열립니다.");
|
||||
}
|
||||
|
||||
for(var i = 0; i < Math.min(validRows.length, maxPopups); i++){
|
||||
(function(index){
|
||||
setTimeout(function(){
|
||||
fn_openSaleRegPopup(validRows[index].PROJECT_NO, validRows[index].SALE_NO);
|
||||
}, index * 300); // 0.3초 간격으로 팝업 열기
|
||||
})(i);
|
||||
}
|
||||
}
|
||||
|
||||
// 분할출하 함수
|
||||
function fn_splitShipment(){
|
||||
if(!_tabulGrid){
|
||||
alert("그리드가 초기화되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 선택된 행 가져오기
|
||||
var selectedRows = _tabulGrid.getSelectedData();
|
||||
|
||||
if(selectedRows.length === 0){
|
||||
alert("분할출하할 항목을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(selectedRows.length > 1){
|
||||
alert("분할출하는 한 번에 하나의 항목만 선택 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedRow = selectedRows[0];
|
||||
|
||||
// 분할출하 레코드는 다시 분할 불가
|
||||
if(selectedRow.RECORD_TYPE === 'SPLIT'){
|
||||
alert("이미 분할된 항목은 다시 분할할 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 수량 확인
|
||||
var originalQty = selectedRow.ORDER_QUANTITY || 0;
|
||||
|
||||
if(originalQty <= 1){
|
||||
alert("분할할 수 있는 수량이 부족합니다.\n(현재 수량: " + originalQty + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// 분할출하 팝업 열기
|
||||
var params = "?objid=" + selectedRow.SALE_NO
|
||||
+ "&projectNo=" + encodeURIComponent(selectedRow.PROJECT_NO)
|
||||
+ "&originalQuantity=" + originalQty;
|
||||
var url = "/salesMgmt/splitShipmentForm.do" + params;
|
||||
|
||||
window.open(url, "splitShipmentPopup", "width=700, height=500, scrollbars=yes, resizable=yes");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<form name="hiddenForm" id="hiddenForm">
|
||||
<input type="hidden" name="objid">
|
||||
<input type="hidden" name="actionType" id="actionType">
|
||||
</form>
|
||||
|
||||
<form name="form1" id="form1" method="post">
|
||||
<input type="hidden" name="page" id="page" value="1">
|
||||
<input type="hidden" name="actionType" id="actionType">
|
||||
<div class="min_part_enroll">
|
||||
<div class="content-box">
|
||||
<div class="content-box-s">
|
||||
<div class="plm_menu_name_gdnsi">
|
||||
<h2>
|
||||
<span>영업관리_매출관리</span>
|
||||
<span>영업관리_판매관리</span>
|
||||
</h2>
|
||||
<div class="btnArea">
|
||||
<input type="button" value="조회" class="plm_btns" id="btnSearch">
|
||||
<input type="button" value="매출마감" class="plm_btns" id="btnDeadline">
|
||||
<input type="button" value="출하지시/판매등록" class="plm_btns" id="btnBulkRegister" style="background-color: #4CAF50; color: white;">
|
||||
<input type="button" value="분할출하" class="plm_btns" id="btnSplitShipment" style="background-color: #FF9800; color: white;">
|
||||
</div>
|
||||
</div>
|
||||
<div id="plmSearchZon">
|
||||
@@ -121,18 +260,24 @@ function fn_excel() {
|
||||
<td class="label"><label for="">제품구분</label></td>
|
||||
<td><select name="productType" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.productTypeList}</select></td>
|
||||
<td class="label"><label for="">국내/해외</label></td>
|
||||
<td><select name="nation" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.nationList}</select></td>
|
||||
<td>
|
||||
<select name="nation" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="D">국내</option>
|
||||
<option value="E">해외</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><label for="">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paymentType" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="N">유상</option>
|
||||
<option value="Y">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">고객사</label></td>
|
||||
<select name="paymentType" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="N">유상</option>
|
||||
<option value="Y">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">고객사</label></td>
|
||||
<td><input type="text" name="customer" /></td>
|
||||
<td class="label"><label for="">품번</label></td>
|
||||
<td><input type="text" name="productNo" /></td>
|
||||
@@ -150,42 +295,42 @@ function fn_excel() {
|
||||
<td><select name="manager" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.managerList}</select></td>
|
||||
<td class="label"><label for="">인도조건</label></td>
|
||||
<td>
|
||||
<select name="incoterms" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="EXW">EXW</option>
|
||||
<option value="FOB">FOB</option>
|
||||
<option value="CIF">CIF</option>
|
||||
<option value="DDP">DDP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">출하대기 상태</label></td>
|
||||
<td><select name="shippingStatus" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
|
||||
<td class="label"><label for="">출고방법</label></td>
|
||||
<td>
|
||||
<select name="shippingMethod" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="DIRECT">직납</option>
|
||||
<option value="PARCEL">택배</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><label for="">요청납기</label></td>
|
||||
<td colspan="3"><input type="date" name="requestDateFrom" /> ~ <input type="date" name="requestDateTo" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="date" name="orderDateFrom" /> ~ <input type="date" name="orderDateTo" /></td>
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="3"><input type="date" name="shippingDateFrom" /> ~ <input type="date" name="shippingDateTo" /></td>
|
||||
</tr>
|
||||
<select name="incoterms" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="EXW">EXW</option>
|
||||
<option value="FOB">FOB</option>
|
||||
<option value="CIF">CIF</option>
|
||||
<option value="DDP">DDP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">출하대기 상태</label></td>
|
||||
<td><select name="shippingStatus" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
|
||||
<td class="label"><label for="">출고방법</label></td>
|
||||
<td>
|
||||
<select name="shippingMethod" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="DIRECT">직납</option>
|
||||
<option value="PARCEL">택배</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><label for="">요청납기</label></td>
|
||||
<td colspan="3"><input type="date" name="requestDateFrom" /> ~ <input type="date" name="requestDateTo" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="date" name="orderDateFrom" /> ~ <input type="date" name="orderDateTo" /></td>
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="3"><input type="date" name="shippingDateFrom" /> ~ <input type="date" name="shippingDateTo" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
|
||||
|
||||
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
137
WebContent/WEB-INF/view/salesmgmt/salesMgmt/salesRegForm.jsp
Normal file
137
WebContent/WEB-INF/view/salesmgmt/salesMgmt/salesRegForm.jsp
Normal file
@@ -0,0 +1,137 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ include file="/init.jsp" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>판매 등록</title>
|
||||
<link rel="stylesheet" href="/css/ions-basic.css">
|
||||
<script type="text/javascript" src="/js/ions-common.js" ></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// select2 초기화
|
||||
$('.select2').select2();
|
||||
|
||||
// 달력 초기화
|
||||
fnc_makeDatepick();
|
||||
|
||||
// 닫기 버튼
|
||||
$("#btnClose").click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
// 저장 버튼
|
||||
$("#btnSave").click(function() {
|
||||
fn_save();
|
||||
});
|
||||
});
|
||||
|
||||
function fn_save() {
|
||||
if(confirm("저장하시겠습니까?")) {
|
||||
$.ajax({
|
||||
url: "/salesMgmt/saveSales.do",
|
||||
type: "POST",
|
||||
data: $("#form1").serialize(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
alert(data.msg);
|
||||
if (data.result) {
|
||||
opener.fn_search(); // 부모창 그리드 새로고침
|
||||
window.close(); // 팝업 닫기
|
||||
}
|
||||
},
|
||||
error: function(jqxhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
alert("저장에 실패했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form name="form1" id="form1" action="" method="post">
|
||||
<input type="hidden" name="orderNo" value="${param.orderNo}">
|
||||
<input type="hidden" name="saleNo" value="${param.saleNo}">
|
||||
<section>
|
||||
<div class="plm_menu_name">
|
||||
<h2>
|
||||
<span>판매 등록</span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div id="businessPopupFormWrap" >
|
||||
<table class="pmsPopupForm">
|
||||
<colgroup>
|
||||
<col width="15%"/>
|
||||
<col width="35%"/>
|
||||
<col width="15%"/>
|
||||
<col width="35%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="4" style="height:15px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="serialNo">S/N</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="serialNo" id="serialNo" style="width:100%;" />
|
||||
</td>
|
||||
<td class="input_title"><label for="shippingDate">* 출고일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" id="shippingDate" name="shippingDate" required reqTitle="출고일" class="date_icon" style="width: 100px !important;background-color:#fff;" autocomplete="off" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="shippingMethod">출고방법</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="shippingMethod" id="shippingMethod" type="select" style="width:100%;" class="select2">
|
||||
<option value="">선택</option>
|
||||
<option value="D_D">내수/직납</option>
|
||||
<option value="D_P">내수/택배</option>
|
||||
<option value="D_E">내수/기타</option>
|
||||
<option value="E">수출</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="input_title"><label for="manager">담당자</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="manager" id="manager" type="select" style="width:100%;" class="select2">
|
||||
<option value="">선택</option>
|
||||
${codeMap.managerList}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="salesQuantity">판매수량</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="number" name="salesQuantity" id="salesQuantity" style="width:100%;" />
|
||||
</td>
|
||||
<td class="input_title"><label for="incoterms">인도조건</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="incoterms" id="incoterms" type="select" style="width:100%;" class="select2">
|
||||
<option value="">선택</option>
|
||||
<option value="FOB">FOB</option>
|
||||
<option value="EXW">EXW</option>
|
||||
<option value="CIF">CIF</option>
|
||||
<option value="DDP">DDP</option>
|
||||
<option value="DAP">DAP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" style="height:15px;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_wrap">
|
||||
<div class="plm_btn_wrap_center">
|
||||
<input type="button" value="저장" id="btnSave" class="plm_btns">
|
||||
<input type="button" value="닫기" id="btnClose" class="plm_btns">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,174 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ include file="/init.jsp" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>분할출하 등록</title>
|
||||
<link rel="stylesheet" href="/css/ions-basic.css">
|
||||
<script type="text/javascript" src="/js/ions-common.js" ></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// select2 초기화
|
||||
$('.select2').select2();
|
||||
|
||||
// 달력 초기화
|
||||
fnc_makeDatepick();
|
||||
|
||||
// 분할수량 자동 입력
|
||||
$("#splitQuantity").val("${param.splitQuantity}");
|
||||
|
||||
// 닫기 버튼
|
||||
$("#btnClose").click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
// 저장 버튼
|
||||
$("#btnSave").click(function() {
|
||||
fn_save();
|
||||
});
|
||||
});
|
||||
|
||||
function fn_save() {
|
||||
// 필수 입력 검증
|
||||
if(!$("#shippingDate").val()) {
|
||||
alert("출고일을 입력해주세요.");
|
||||
$("#shippingDate").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$("#splitQuantity").val() || $("#splitQuantity").val() <= 0) {
|
||||
alert("분할수량을 입력해주세요.");
|
||||
$("#splitQuantity").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if(confirm("분할출하를 등록하시겠습니까?")) {
|
||||
$.ajax({
|
||||
url: "/salesMgmt/saveSplitShipment.do",
|
||||
type: "POST",
|
||||
data: $("#form1").serialize(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
alert(data.msg);
|
||||
if (data.result) {
|
||||
if(opener && opener.fn_search) {
|
||||
opener.fn_search(); // 부모창 그리드 새로고침
|
||||
}
|
||||
window.close(); // 팝업 닫기
|
||||
}
|
||||
},
|
||||
error: function(jqxhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
alert("저장에 실패했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form name="form1" id="form1" action="" method="post">
|
||||
<input type="hidden" name="objid" value="${param.objid}">
|
||||
<input type="hidden" name="projectNo" value="${param.projectNo}">
|
||||
<input type="hidden" name="originalQuantity" value="${param.originalQuantity}">
|
||||
|
||||
<section>
|
||||
<div class="plm_menu_name">
|
||||
<h2>
|
||||
<span>분할출하 등록</span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div id="businessPopupFormWrap" >
|
||||
<table class="pmsPopupForm">
|
||||
<colgroup>
|
||||
<col width="15%"/>
|
||||
<col width="35%"/>
|
||||
<col width="15%"/>
|
||||
<col width="35%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="4" style="height:15px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="projectNo">프로젝트번호</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" value="${param.projectNo}" disabled style="width:100%; background-color:#f0f0f0;" />
|
||||
</td>
|
||||
<td class="input_title"><label for="originalQuantity">원본수량</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" value="${param.originalQuantity}" disabled style="width:100%; background-color:#f0f0f0;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="splitQuantity">* 분할수량</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="number" name="splitQuantity" id="splitQuantity" style="width:100%;" required />
|
||||
</td>
|
||||
<td class="input_title"><label for="serialNo">S/N</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="serialNo" id="serialNo" style="width:100%;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="shippingDate">* 출고일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" id="shippingDate" name="shippingDate" required class="date_icon" style="width: 100px !important;background-color:#fff;" autocomplete="off" />
|
||||
</td>
|
||||
<td class="input_title"><label for="shippingMethod">출고방법</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="shippingMethod" id="shippingMethod" type="select" style="width:100%;" class="select2">
|
||||
<option value="">선택</option>
|
||||
<option value="D_D">내수/직납</option>
|
||||
<option value="D_P">내수/택배</option>
|
||||
<option value="D_E">내수/기타</option>
|
||||
<option value="E">수출</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="manager">담당자</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="manager" id="manager" type="select" style="width:100%;" class="select2">
|
||||
<option value="">선택</option>
|
||||
${codeMap.managerList}
|
||||
</select>
|
||||
</td>
|
||||
<td class="input_title"><label for="incoterms">인도조건</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="incoterms" id="incoterms" type="select" style="width:100%;" class="select2">
|
||||
<option value="">선택</option>
|
||||
<option value="FOB">FOB</option>
|
||||
<option value="EXW">EXW</option>
|
||||
<option value="CIF">CIF</option>
|
||||
<option value="DDP">DDP</option>
|
||||
<option value="DAP">DAP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="input_title"><label for="remark">비고</label></td>
|
||||
<td class="input_sub_title" colspan="3">
|
||||
<textarea name="remark" id="remark" style="width:100%; height:60px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" style="height:15px;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="btn_wrap">
|
||||
<div class="plm_btn_wrap_center">
|
||||
<input type="button" value="저장" id="btnSave" class="plm_btns">
|
||||
<input type="button" value="닫기" id="btnClose" class="plm_btns">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
-- CONTRACT_MGMT 테이블에 수주 관련 컬럼 추가
|
||||
-- 기존 컬럼 활용:
|
||||
-- - 수주상태: contract_result (기존 컬럼 사용)
|
||||
-- - 환종: contract_currency (기존 컬럼 사용)
|
||||
-- - 환율: exchange_rate (기존 컬럼 사용)
|
||||
-- - 발주번호: po_no (기존 컬럼 사용)
|
||||
|
||||
-- 수주 관련 신규 컬럼들
|
||||
ALTER TABLE public.contract_mgmt ADD COLUMN IF NOT EXISTS order_date VARCHAR(50);
|
||||
ALTER TABLE public.contract_mgmt ADD COLUMN IF NOT EXISTS order_unit_price NUMERIC(15,2);
|
||||
ALTER TABLE public.contract_mgmt ADD COLUMN IF NOT EXISTS order_supply_price NUMERIC(15,2);
|
||||
ALTER TABLE public.contract_mgmt ADD COLUMN IF NOT EXISTS order_vat NUMERIC(15,2);
|
||||
ALTER TABLE public.contract_mgmt ADD COLUMN IF NOT EXISTS order_total_amount NUMERIC(15,2);
|
||||
|
||||
-- 컬럼 코멘트 추가
|
||||
COMMENT ON COLUMN public.contract_mgmt.contract_result IS '영업진행상태 / 수주상태';
|
||||
COMMENT ON COLUMN public.contract_mgmt.po_no IS '발주번호';
|
||||
COMMENT ON COLUMN public.contract_mgmt.order_date IS '발주일';
|
||||
COMMENT ON COLUMN public.contract_mgmt.order_unit_price IS '수주 단가';
|
||||
COMMENT ON COLUMN public.contract_mgmt.order_supply_price IS '수주 공급가액';
|
||||
COMMENT ON COLUMN public.contract_mgmt.order_vat IS '수주 부가세';
|
||||
COMMENT ON COLUMN public.contract_mgmt.order_total_amount IS '수주 총액';
|
||||
COMMENT ON COLUMN public.contract_mgmt.contract_currency IS '견적/수주 환종';
|
||||
COMMENT ON COLUMN public.contract_mgmt.exchange_rate IS '견적/수주 환율';
|
||||
|
||||
-- 인덱스 추가 (선택사항)
|
||||
CREATE INDEX IF NOT EXISTS idx_contract_result ON public.contract_mgmt(contract_result);
|
||||
CREATE INDEX IF NOT EXISTS idx_contract_order_date ON public.contract_mgmt(order_date);
|
||||
|
||||
-- 조회 예시
|
||||
-- SELECT objid, contract_no, contract_result, po_no, order_date, order_total_amount, contract_currency, exchange_rate
|
||||
-- FROM public.contract_mgmt
|
||||
-- WHERE contract_result IS NOT NULL;
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
-- 견적서 템플릿 테이블 생성 SQL
|
||||
|
||||
-- 1. 견적서 템플릿 메인 테이블
|
||||
CREATE TABLE IF NOT EXISTS ESTIMATE_TEMPLATE (
|
||||
OBJID VARCHAR(50) PRIMARY KEY,
|
||||
CONTRACT_OBJID VARCHAR(50) NOT NULL, -- CONTRACT_MGMT 테이블의 OBJID 참조
|
||||
TEMPLATE_TYPE VARCHAR(10) NOT NULL, -- '1': 일반 견적서, '2': 장비 견적서
|
||||
|
||||
-- 일반 견적서 필드 (Template 1)
|
||||
EXECUTOR VARCHAR(200), -- 시행일자
|
||||
RECIPIENT VARCHAR(200), -- 수신처
|
||||
ESTIMATE_NO VARCHAR(100), -- 견적번호
|
||||
CONTACT_PERSON VARCHAR(100), -- 수신인
|
||||
GREETING_TEXT TEXT, -- 인사말
|
||||
|
||||
-- 장비 견적서 필드 (Template 2)
|
||||
MODEL_NAME VARCHAR(200), -- 설비 Model 품명
|
||||
MODEL_CODE VARCHAR(100), -- 설비 Model 코드
|
||||
EXECUTOR_DATE VARCHAR(50), -- 시행일자
|
||||
NOTES_CONTENT TEXT, -- 비고 내용 (전체)
|
||||
VALIDITY_PERIOD VARCHAR(50), -- 견적 유효기간
|
||||
|
||||
-- 비고 필드 (공통)
|
||||
NOTE1 VARCHAR(500),
|
||||
NOTE2 VARCHAR(500),
|
||||
NOTE3 VARCHAR(500),
|
||||
NOTE4 VARCHAR(500),
|
||||
|
||||
-- 카테고리 정보 (장비 견적서용, JSON 형태로 저장)
|
||||
CATEGORIES_JSON TEXT,
|
||||
|
||||
-- 시스템 필드
|
||||
WRITER VARCHAR(50),
|
||||
REGDATE TIMESTAMP DEFAULT NOW(),
|
||||
CHG_USER_ID VARCHAR(50),
|
||||
CHGDATE TIMESTAMP DEFAULT NOW(),
|
||||
|
||||
CONSTRAINT fk_estimate_contract FOREIGN KEY (CONTRACT_OBJID)
|
||||
REFERENCES CONTRACT_MGMT(OBJID) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- 인덱스 생성
|
||||
CREATE INDEX idx_estimate_contract ON ESTIMATE_TEMPLATE(CONTRACT_OBJID);
|
||||
CREATE INDEX idx_estimate_type ON ESTIMATE_TEMPLATE(TEMPLATE_TYPE);
|
||||
|
||||
-- 코멘트 추가
|
||||
COMMENT ON TABLE ESTIMATE_TEMPLATE IS '견적서 템플릿 정보';
|
||||
COMMENT ON COLUMN ESTIMATE_TEMPLATE.CONTRACT_OBJID IS '견적요청 OBJID (CONTRACT_MGMT 참조)';
|
||||
COMMENT ON COLUMN ESTIMATE_TEMPLATE.TEMPLATE_TYPE IS '템플릿 타입 (1:일반견적서, 2:장비견적서)';
|
||||
|
||||
|
||||
-- 2. 견적서 템플릿 품목 테이블
|
||||
CREATE TABLE IF NOT EXISTS ESTIMATE_TEMPLATE_ITEM (
|
||||
OBJID SERIAL PRIMARY KEY,
|
||||
TEMPLATE_OBJID VARCHAR(50) NOT NULL, -- ESTIMATE_TEMPLATE 테이블의 OBJID 참조
|
||||
SEQ INTEGER NOT NULL, -- 순번
|
||||
CATEGORY VARCHAR(100), -- 카테고리 (장비 견적서용)
|
||||
DESCRIPTION VARCHAR(500), -- 품명
|
||||
SPECIFICATION TEXT, -- 규격/사양
|
||||
QUANTITY VARCHAR(50), -- 수량
|
||||
UNIT VARCHAR(50), -- 단위
|
||||
UNIT_PRICE NUMERIC(15,2), -- 단가
|
||||
AMOUNT NUMERIC(15,2), -- 금액
|
||||
NOTE VARCHAR(500), -- 비고
|
||||
REMARK VARCHAR(500), -- 특이사항
|
||||
|
||||
CONSTRAINT fk_item_template FOREIGN KEY (TEMPLATE_OBJID)
|
||||
REFERENCES ESTIMATE_TEMPLATE(OBJID) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- 인덱스 생성
|
||||
CREATE INDEX idx_item_template ON ESTIMATE_TEMPLATE_ITEM(TEMPLATE_OBJID);
|
||||
CREATE INDEX idx_item_seq ON ESTIMATE_TEMPLATE_ITEM(TEMPLATE_OBJID, SEQ);
|
||||
|
||||
-- 코멘트 추가
|
||||
COMMENT ON TABLE ESTIMATE_TEMPLATE_ITEM IS '견적서 템플릿 품목 정보';
|
||||
COMMENT ON COLUMN ESTIMATE_TEMPLATE_ITEM.TEMPLATE_OBJID IS '견적서 템플릿 OBJID';
|
||||
COMMENT ON COLUMN ESTIMATE_TEMPLATE_ITEM.SEQ IS '품목 순번';
|
||||
COMMENT ON COLUMN ESTIMATE_TEMPLATE_ITEM.CATEGORY IS '카테고리 (장비견적서: CNC Machine, UTILITY 등)';
|
||||
|
||||
|
||||
-- 3. CONTRACT_MGMT 테이블에 CATEGORIES_JSON 컬럼 추가 (이미 없는 경우)
|
||||
-- ALTER TABLE ESTIMATE_TEMPLATE ADD COLUMN IF NOT EXISTS CATEGORIES_JSON TEXT;
|
||||
|
||||
-- 샘플 데이터 조회 쿼리
|
||||
-- SELECT * FROM ESTIMATE_TEMPLATE WHERE CONTRACT_OBJID = 123;
|
||||
-- SELECT * FROM ESTIMATE_TEMPLATE_ITEM WHERE TEMPLATE_OBJID = 456 ORDER BY SEQ;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SalesNcollectMgmtController {
|
||||
|
||||
/** 매출수금 Service */
|
||||
@Autowired
|
||||
private SalesNcollectMgmtService salseNcollectMgmtService;
|
||||
private SalesNcollectMgmtService salesNcollectMgmtService;
|
||||
|
||||
/** 영업관리 공통 Service */
|
||||
@Autowired
|
||||
@@ -99,8 +99,8 @@ public class SalesNcollectMgmtController {
|
||||
* @param paramMap - 검색 정보
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "/contractMgmt/salesMgmtList.do", method = RequestMethod.GET)
|
||||
public String showSalesMgmtList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
@RequestMapping(value = "/revenueMgmt/revenueList.do", method = RequestMethod.GET)
|
||||
public String showRevenueMgmtList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
// 코드정보
|
||||
Map<String, Object> codeMap = new HashMap<String, Object>();
|
||||
@@ -143,6 +143,46 @@ public class SalesNcollectMgmtController {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/salesmgmt/salesMgmt/revenueMgmtList";
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 신규 매출관리 목록 페이지
|
||||
* </pre>
|
||||
* @param request
|
||||
* @param paramMap - 검색 정보
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "/contractMgmt/salesMgmtList.do", method = RequestMethod.GET)
|
||||
public String showSalesMgmtList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
// 코드정보 (기존 로직과 동일하게 설정 가능)
|
||||
Map<String, Object> codeMap = new HashMap<String, Object>();
|
||||
|
||||
// 주문유형
|
||||
codeMap.put("orderTypeList",
|
||||
salesMgmtCommonService.bizMakeOptionList("GE", "", "salesMgmtCommon.getCodeList"));
|
||||
// 제품구분
|
||||
codeMap.put("productTypeList",
|
||||
salesMgmtCommonService.bizMakeOptionList("", "", "salesMgmtCommon.getGoodsList"));
|
||||
// 국내/해외
|
||||
codeMap.put("nationList",
|
||||
salesMgmtCommonService.bizMakeOptionList("AR", "", "salesMgmtCommon.getCodeList"));
|
||||
// 수주상태
|
||||
codeMap.put("orderStatusList",
|
||||
commonService.bizMakeOptionList("0000932", "", "common.getCodeselect"));
|
||||
// 출하대기 상태
|
||||
codeMap.put("shippingStatusList",
|
||||
salesMgmtCommonService.bizMakeOptionList("SH", "", "salesMgmtCommon.getCodeList"));
|
||||
// 담당자
|
||||
codeMap.put("managerList",
|
||||
salesMgmtCommonService.bizMakeOptionList("", "", "salesMgmtCommon.getSalesmanList"));
|
||||
|
||||
request.setAttribute("codeMap", codeMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/salesmgmt/salesMgmt/salesMgmtList";
|
||||
}
|
||||
|
||||
@@ -155,13 +195,81 @@ public class SalesNcollectMgmtController {
|
||||
* @return Map
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/salesMgmt/salesMgmtGridList.do", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/revenueMgmt/revenueGridList.do", method = RequestMethod.POST)
|
||||
public Map<String, Object> salesMgmtGridList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
List<Map<String, Object>> list = salseNcollectMgmtService.getSalesMgmtGridList(request, paramMap);
|
||||
int totalCount = salseNcollectMgmtService.getSalesMgmtGridListCount(paramMap);
|
||||
System.out.println("===== revenueGridList.do 파라미터 =====");
|
||||
System.out.println("paramMap: " + paramMap);
|
||||
|
||||
List<Map<String, Object>> list = salesNcollectMgmtService.getSalesMgmtGridList(request, paramMap);
|
||||
int totalCount = salesNcollectMgmtService.getSalesMgmtGridListCount(paramMap);
|
||||
Map<String, Object> totals = salesNcollectMgmtService.getSalesMgmtTotals(paramMap);
|
||||
|
||||
System.out.println("list size: " + list.size());
|
||||
System.out.println("totalCount: " + totalCount);
|
||||
System.out.println("totals: " + totals);
|
||||
|
||||
resultMap.put("RESULTLIST", list);
|
||||
resultMap.put("last_page", (int) Math.ceil((double)totalCount / Integer.parseInt(CommonUtils.checkNull(request.getParameter("size"), "10"))));
|
||||
resultMap.put("TOTALS", totals); // Total 공급가액, 부가세, 총액
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
// Tabulator는 에러 발생 시 빈 배열을 기대합니다.
|
||||
resultMap.put("RESULTLIST", new java.util.ArrayList<>());
|
||||
resultMap.put("last_page", 0);
|
||||
|
||||
// Total 초기화
|
||||
Map<String, Object> emptyTotals = new HashMap<String, Object>();
|
||||
|
||||
emptyTotals.put("TOTAL_SUPPLY_PRICE", 0);
|
||||
emptyTotals.put("TOTAL_VAT", 0);
|
||||
emptyTotals.put("TOTAL_AMOUNT", 0);
|
||||
resultMap.put("TOTALS", emptyTotals);
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 판매등록 폼 팝업
|
||||
* </pre>
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "/salesMgmt/salesRegForm.do", method = RequestMethod.GET)
|
||||
public String showSalesRegForm(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
Map<String, Object> codeMap = new HashMap<String, Object>();
|
||||
|
||||
// 담당자
|
||||
codeMap.put("managerList",
|
||||
salesMgmtCommonService.bizMakeOptionList("", "", "salesMgmtCommon.getSalesmanList"));
|
||||
|
||||
// 기존 판매 정보 조회
|
||||
if(paramMap.get("orderNo") != null && !paramMap.get("orderNo").equals("")) {
|
||||
Map<String, Object> saleInfo = salesNcollectMgmtService.getSaleInfo(paramMap);
|
||||
request.setAttribute("saleInfo", saleInfo);
|
||||
}
|
||||
|
||||
request.setAttribute("codeMap", codeMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/salesmgmt/salesMgmt/salesRegForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/salesMgmt/salesMgmtGridList.do", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> getSalesMgmtGridList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
List<Map<String, Object>> list = salesNcollectMgmtService.getSalesMgmtGridList(request, paramMap);
|
||||
int totalCount = salesNcollectMgmtService.getSalesMgmtGridListCount(paramMap);
|
||||
|
||||
resultMap.put("RESULTLIST", list);
|
||||
resultMap.put("last_page", (int) Math.ceil((double)totalCount / Integer.parseInt(CommonUtils.checkNull(request.getParameter("size"), "10"))));
|
||||
@@ -174,6 +282,66 @@ public class SalesNcollectMgmtController {
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/salesMgmt/saveSales.do", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> saveSales(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap = salesNcollectMgmtService.saveSaleRegistration(request, paramMap);
|
||||
} catch (Exception e) {
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "저장 중 오류가 발생했습니다.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 분할출하 팝업 폼
|
||||
* </pre>
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return String
|
||||
*/
|
||||
@RequestMapping(value = "/salesMgmt/splitShipmentForm.do", method = RequestMethod.GET)
|
||||
public String showSplitShipmentForm(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
Map<String, Object> codeMap = new HashMap<String, Object>();
|
||||
|
||||
// 담당자
|
||||
codeMap.put("managerList",
|
||||
salesMgmtCommonService.bizMakeOptionList("", "", "salesMgmtCommon.getSalesmanList"));
|
||||
|
||||
request.setAttribute("codeMap", codeMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/salesmgmt/salesMgmt/splitShipmentForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 분할출하 저장 처리
|
||||
* </pre>
|
||||
* @param request
|
||||
* @param paramMap - 분할출하 정보
|
||||
* @return Map
|
||||
*/
|
||||
@RequestMapping(value = "/salesMgmt/saveSplitShipment.do", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> saveSplitShipment(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
try {
|
||||
resultMap = salesNcollectMgmtService.splitShipment(request, paramMap);
|
||||
} catch (Exception e) {
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "분할출하 처리 중 오류가 발생했습니다.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -235,7 +403,7 @@ public class SalesNcollectMgmtController {
|
||||
public String sales(HttpServletRequest request
|
||||
, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
List<Map<String,Object>> list = salseNcollectMgmtService.getSalseAllByOrderNo(request, paramMap);
|
||||
List<Map<String,Object>> list = salesNcollectMgmtService.getSalseAllByOrderNo(request, paramMap);
|
||||
|
||||
request.setAttribute("LIST", list);
|
||||
} catch(Exception e) {
|
||||
@@ -271,7 +439,7 @@ public class SalesNcollectMgmtController {
|
||||
try {
|
||||
if(StringUtils.isNotBlank(saleNo)) {
|
||||
// 매출관리 조회
|
||||
info = salseNcollectMgmtService.getSalesMgmt(paramMap);
|
||||
info = salesNcollectMgmtService.getSalesMgmt(paramMap);
|
||||
} else {
|
||||
info = new HashMap<String, Object>();
|
||||
}
|
||||
@@ -324,7 +492,7 @@ public class SalesNcollectMgmtController {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
resultMap.put("RESULT", salseNcollectMgmtService.saveSalesMgmt(request, paramMap));
|
||||
resultMap.put("RESULT", salesNcollectMgmtService.saveSalesMgmt(request, paramMap));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -345,7 +513,7 @@ public class SalesNcollectMgmtController {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
resultMap.put("RESULT", salseNcollectMgmtService.deleteSalesMgmt(request, paramMap));
|
||||
resultMap.put("RESULT", salesNcollectMgmtService.deleteSalesMgmt(request, paramMap));
|
||||
|
||||
|
||||
|
||||
@@ -386,7 +554,7 @@ public class SalesNcollectMgmtController {
|
||||
, @RequestParam Map<String, Object> paramMap) {
|
||||
|
||||
try {
|
||||
List<Map<String,Object>> list = salseNcollectMgmtService.getCollectAllByOrderNo(request, paramMap);
|
||||
List<Map<String,Object>> list = salesNcollectMgmtService.getCollectAllByOrderNo(request, paramMap);
|
||||
|
||||
request.setAttribute("LIST", list);
|
||||
} catch(Exception e) {
|
||||
@@ -427,7 +595,7 @@ public class SalesNcollectMgmtController {
|
||||
System.out.println("paramMap##################### " + paramMap);
|
||||
if(StringUtils.isNotBlank(saleNo)) {
|
||||
// 수금관리 조회
|
||||
info = salseNcollectMgmtService.getCollectMgmt(paramMap);
|
||||
info = salesNcollectMgmtService.getCollectMgmt(paramMap);
|
||||
} else {
|
||||
info = new HashMap<String, Object>();
|
||||
}
|
||||
@@ -476,7 +644,7 @@ public class SalesNcollectMgmtController {
|
||||
*/
|
||||
|
||||
//하단 그리드를 위한 수금 목록 조회
|
||||
List<Map<String,Object>> list = salseNcollectMgmtService.getCollectAllByOrderNo(request, paramMap);
|
||||
List<Map<String,Object>> list = salesNcollectMgmtService.getCollectAllByOrderNo(request, paramMap);
|
||||
request.setAttribute("LIST", list);
|
||||
|
||||
request.setAttribute("info", info);
|
||||
@@ -513,7 +681,7 @@ public class SalesNcollectMgmtController {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
System.out.println("ctr::paramMap##################### " + paramMap);
|
||||
try {
|
||||
resultMap.put("RESULT", salseNcollectMgmtService.saveCollectMgmt(request, paramMap));
|
||||
resultMap.put("RESULT", salesNcollectMgmtService.saveCollectMgmt(request, paramMap));
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -535,7 +703,7 @@ public class SalesNcollectMgmtController {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
resultMap.put("RESULT", salseNcollectMgmtService.deleteCollectMgmt(request, paramMap));
|
||||
resultMap.put("RESULT", salesNcollectMgmtService.deleteCollectMgmt(request, paramMap));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -812,188 +812,332 @@
|
||||
,editEmpNo = #{cretEmpNo} /* 수정자 */
|
||||
</update>
|
||||
|
||||
<!-- 매출관리 그리드 목록 -->
|
||||
<!-- 매출관리 그리드 목록 (SW 테이블 사용 안함) -->
|
||||
<select id="getSalesMgmtGridList" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getSalesMgmtGridList */
|
||||
/* salesNcollectMgmt.getSalesMgmtGridList - VIEW 기반 조회 (원본 + 분할출하 통합) */
|
||||
SELECT
|
||||
B.OrderNo AS PROJECT_NO, /* 프로젝트번호를 계약번호로 우선 사용 */
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MajorCd = 'GE' AND MinorCd = B.SaleType) AS ORDER_TYPE,
|
||||
CASE WHEN C.c_class IS NOT NULL THEN
|
||||
CONCAT(
|
||||
(SELECT ltrim(rtrim(DTL_NM)) from SWSA999A_TBL where COMM_CD = 'S110' AND SUBSTRING(DTL_CD,1,1) = SUBSTRING(C.c_class,1,1)),
|
||||
'-',
|
||||
(SELECT ltrim(rtrim(DTL_NM)) from SWSA999A_TBL where COMM_CD = 'S120' AND SUBSTRING(DTL_CD,1,3) = SUBSTRING(C.c_class,1,3)),
|
||||
'-',
|
||||
(SELECT ltrim(rtrim(DTL_NM)) from SWSA999A_TBL where COMM_CD = 'S130' AND DTL_CD = C.c_class )
|
||||
)
|
||||
ELSE '' END AS PRODUCT_TYPE,
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MAjorCd = 'NA' AND MinorCd = B.nationGB) AS NATION,
|
||||
COALESCE(A.WrtYmd, B.OrderDate) AS RECEIPT_DATE,
|
||||
D.custNm AS CUSTOMER,
|
||||
(CASE B.freeyn WHEN 'Y' THEN '무상' ELSE '유상' END) AS PAYMENT_TYPE,
|
||||
C.GoodsCd AS PRODUCT_NO,
|
||||
C.GoodsNm AS PRODUCT_NAME,
|
||||
A.serialno AS SERIAL_NO,
|
||||
COALESCE(A.SupplyQty, B.goodsqty) AS QUANTITY,
|
||||
B.custreq AS REQUEST_DATE,
|
||||
COALESCE(A.Remark, B.bigo) AS CUSTOMER_REQUEST,
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MajorCd = 'SS' AND MinorCd = B.endsale) AS ORDER_STATUS,
|
||||
B.OrderNo AS PO_NO,
|
||||
B.OrderDate AS ORDER_DATE,
|
||||
B.orderattachpath AS ORDER_ATTACH,
|
||||
COALESCE(A.SupplyPrice, B.saleprice) AS UNIT_PRICE,
|
||||
COALESCE(A.SupplyAmt, B.saleamt) AS SUPPLY_PRICE,
|
||||
COALESCE(A.SupplyVat, B.vatamt) AS VAT,
|
||||
COALESCE((A.SupplyAmt + A.SupplyVat), (B.saleamt + B.vatamt)) AS TOTAL_AMOUNT,
|
||||
COALESCE(A.NoWonSymbol, B.nowonsymbol) AS CURRENCY,
|
||||
COALESCE(A.NoWonExChange, B.nowonexchange) AS EXCHANGE_RATE,
|
||||
B.shippingstatus AS SHIPPING_STATUS,
|
||||
B.shippingdate AS SHIPPING_DATE,
|
||||
B.shippingmethod AS SHIPPING_METHOD,
|
||||
(SELECT user_name FROM USER_INFO WHERE user_id = D.SalesMan) AS MANAGER,
|
||||
B.saleQty AS SALES_QUANTITY,
|
||||
(SELECT CdNm FROM SWSA050A_TBL WHERE MajorCd = 'IT' AND MinorCd = B.incoterms) AS INCOTERMS,
|
||||
B.salesstatus AS SALES_STATUS
|
||||
FROM SWSC110A_TBL B
|
||||
LEFT JOIN SWSD010A_TBL A ON A.orderNo = B.orderNo
|
||||
INNER JOIN SWSB110A_TBL C ON B.goodsCd = C.goodsCd
|
||||
INNER JOIN SWSB210A_TBL D ON B.custCd = D.custCd
|
||||
PROJECT_NO,
|
||||
ORDER_TYPE,
|
||||
PRODUCT_TYPE,
|
||||
NATION,
|
||||
RECEIPT_DATE,
|
||||
CUSTOMER,
|
||||
PAYMENT_TYPE,
|
||||
PRODUCT_NO,
|
||||
PRODUCT_NAME,
|
||||
SERIAL_NO,
|
||||
COALESCE(ORDER_QUANTITY, 0) AS ORDER_QUANTITY,
|
||||
REQUEST_DATE,
|
||||
CUSTOMER_REQUEST,
|
||||
ORDER_STATUS,
|
||||
PO_NO,
|
||||
ORDER_DATE,
|
||||
ORDER_ATTACH,
|
||||
PRODUCTION_STATUS,
|
||||
SHIPPING_ORDER_STATUS,
|
||||
COALESCE(SALES_QUANTITY, 0) AS SALES_QUANTITY,
|
||||
COALESCE(SALES_UNIT_PRICE, 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SALES_SUPPLY_PRICE, 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SALES_VAT, 0) AS SALES_VAT,
|
||||
COALESCE(SALES_TOTAL_AMOUNT, 0) AS SALES_TOTAL_AMOUNT,
|
||||
COALESCE(SALES_TOTAL_AMOUNT_KRW, 0) AS SALES_TOTAL_AMOUNT_KRW,
|
||||
SALES_CURRENCY,
|
||||
COALESCE(SALES_EXCHANGE_RATE, 0) AS SALES_EXCHANGE_RATE,
|
||||
SHIPPING_DATE,
|
||||
SHIPPING_METHOD,
|
||||
MANAGER,
|
||||
INCOTERMS,
|
||||
SALES_STATUS,
|
||||
SALE_NO,
|
||||
RECORD_TYPE,
|
||||
SPLIT_LOG_ID
|
||||
FROM v_sales_mgmt_with_splits
|
||||
WHERE 1 = 1
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND B.SaleType = #{orderType}
|
||||
AND CATEGORY_CD = #{orderType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
AND C.c_class = #{productType}
|
||||
AND PRODUCT_TYPE = #{productType}
|
||||
</if>
|
||||
<if test="nation != null and nation != ''">
|
||||
AND B.nationGB = #{nation}
|
||||
AND AREA_CD = #{nation}
|
||||
</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
AND D.custNm LIKE CONCAT('%', #{customer}, '%')
|
||||
AND CUSTOMER LIKE CONCAT('%', #{customer}, '%')
|
||||
</if>
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND B.freeyn = #{paymentType}
|
||||
AND PAID_TYPE = #{paymentType}
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND C.GoodsCd LIKE CONCAT('%', #{productNo}, '%')
|
||||
AND PRODUCT_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND C.GoodsNm LIKE CONCAT('%', #{productName}, '%')
|
||||
AND PRODUCT_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND A.serialno LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND B.endsale = #{orderStatus}
|
||||
AND STATUS_CD = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND B.OrderNo LIKE CONCAT('%', #{poNo}, '%')
|
||||
AND PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND B.custreq <![CDATA[>=]]> #{requestDateFrom}
|
||||
AND REQUEST_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND B.custreq <![CDATA[<=]]> #{requestDateTo}
|
||||
AND REQUEST_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND B.OrderDate <![CDATA[>=]]> #{orderDateFrom}
|
||||
AND ORDER_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND B.OrderDate <![CDATA[<=]]> #{orderDateTo}
|
||||
AND ORDER_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND B.shippingstatus = #{shippingStatus}
|
||||
AND SALES_STATUS = #{shippingStatus}
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND B.shippingdate <![CDATA[>=]]> #{shippingDateFrom}
|
||||
AND SHIPPING_DATE <![CDATA[>=]]> #{shippingDateFrom}
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND B.shippingdate <![CDATA[<=]]> #{shippingDateTo}
|
||||
AND SHIPPING_DATE <![CDATA[<=]]> #{shippingDateTo}
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
AND B.outGb = #{shippingMethod}
|
||||
AND SHIPPING_METHOD = #{shippingMethod}
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND B.bEmpNo = #{manager}
|
||||
AND PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
AND B.incoterms = #{incoterms}
|
||||
AND INCOTERMS = #{incoterms}
|
||||
</if>
|
||||
ORDER BY B.CRET_DATE DESC
|
||||
ORDER BY REGDATE DESC
|
||||
LIMIT #{COUNT_PER_PAGE} OFFSET #{PAGE_START}
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 그리드 목록 개수 -->
|
||||
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="int">
|
||||
/* salesNcollectMgmt.getSalesMgmtGridListCount */
|
||||
<!-- 매출관리 그리드 목록 개수 (VIEW 기반) -->
|
||||
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getSalesMgmtGridListCount - VIEW 기반 */
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM SWSC110A_TBL B
|
||||
LEFT JOIN SWSD010A_TBL A ON A.orderNo = B.orderNo
|
||||
INNER JOIN SWSB110A_TBL C ON B.goodsCd = C.goodsCd
|
||||
INNER JOIN SWSB210A_TBL D ON B.custCd = D.custCd
|
||||
CEIL(COUNT(1)::float / #{COUNT_PER_PAGE}::float)::numeric::integer AS MAX_PAGE_SIZE,
|
||||
COUNT(1)::integer AS TOTAL_CNT
|
||||
FROM v_sales_mgmt_with_splits
|
||||
WHERE 1 = 1
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND B.SaleType = #{orderType}
|
||||
AND CATEGORY_CD = #{orderType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
AND C.c_class = #{productType}
|
||||
AND PRODUCT_TYPE = #{productType}
|
||||
</if>
|
||||
<if test="nation != null and nation != ''">
|
||||
AND B.nationGB = #{nation}
|
||||
AND AREA_CD = #{nation}
|
||||
</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
AND D.custNm LIKE CONCAT('%', #{customer}, '%')
|
||||
AND CUSTOMER LIKE CONCAT('%', #{customer}, '%')
|
||||
</if>
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND B.freeyn = #{paymentType}
|
||||
AND PAID_TYPE = #{paymentType}
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND C.GoodsCd LIKE CONCAT('%', #{productNo}, '%')
|
||||
AND PRODUCT_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND C.GoodsNm LIKE CONCAT('%', #{productName}, '%')
|
||||
AND PRODUCT_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND A.serialno LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND B.endsale = #{orderStatus}
|
||||
AND STATUS_CD = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND B.OrderNo LIKE CONCAT('%', #{poNo}, '%')
|
||||
AND PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND B.custreq <![CDATA[>=]]> #{requestDateFrom}
|
||||
AND REQUEST_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND B.custreq <![CDATA[<=]]> #{requestDateTo}
|
||||
AND REQUEST_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND B.OrderDate <![CDATA[>=]]> #{orderDateFrom}
|
||||
AND ORDER_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND B.OrderDate <![CDATA[<=]]> #{orderDateTo}
|
||||
AND ORDER_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND B.shippingstatus = #{shippingStatus}
|
||||
AND SALES_STATUS = #{shippingStatus}
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND B.shippingdate <![CDATA[>=]]> #{shippingDateFrom}
|
||||
AND SHIPPING_DATE <![CDATA[>=]]> #{shippingDateFrom}
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND B.shippingdate <![CDATA[<=]]> #{shippingDateTo}
|
||||
AND SHIPPING_DATE <![CDATA[<=]]> #{shippingDateTo}
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
AND B.outGb = #{shippingMethod}
|
||||
AND SHIPPING_METHOD = #{shippingMethod}
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND B.bEmpNo = #{manager}
|
||||
AND PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
AND B.incoterms = #{incoterms}
|
||||
AND INCOTERMS = #{incoterms}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 합계 조회 (Total 공급가액, 부가세, 총액) -->
|
||||
<select id="getSalesMgmtTotals" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getSalesMgmtTotals */
|
||||
SELECT
|
||||
COALESCE(SUM(COALESCE(A.order_supply_price, '0')::numeric), 0)::numeric AS TOTAL_SUPPLY_PRICE, /* Total 공급가액 */
|
||||
COALESCE(SUM(COALESCE(A.order_vat, '0')::numeric), 0)::numeric AS TOTAL_VAT, /* Total 부가세 */
|
||||
COALESCE(SUM(COALESCE(A.order_total_amount, '0')::numeric), 0)::numeric AS TOTAL_AMOUNT /* Total 총액 */
|
||||
FROM contract_mgmt A
|
||||
LEFT JOIN supply_mng SUP ON SUP.objid::varchar = A.customer_objid
|
||||
WHERE 1 = 1
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND A.category_cd = #{orderType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
AND A.product = #{productType}
|
||||
</if>
|
||||
<if test="nation != null and nation != ''">
|
||||
AND A.area_cd = #{nation}
|
||||
</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
AND SUP.supply_name LIKE CONCAT('%', #{customer}, '%')
|
||||
</if>
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND A.paid_type = #{paymentType}
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND A.part_no LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND A.part_name LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND A.serial_no LIKE CONCAT('%', #{serialNo}, '%')
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND A.status_cd = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND A.po_no LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND A.req_del_date <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND A.req_del_date <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND A.order_date <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND A.order_date <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
/* shippingStatus 필드가 contract_mgmt에 없어서 주석 처리 */
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
/* shippingDate 조인 안됨 */
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
/* shippingDate 조인 안됨 */
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* shippingMethod 필드가 contract_mgmt에 없어서 주석 처리 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND A.pm_user_id = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* incoterms 필드가 contract_mgmt에 없어서 주석 처리 */
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 분할출하 - 원본 데이터 조회
|
||||
* @since 2025.10.20
|
||||
* @author system
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<select id="getContractByObjid" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getContractByObjid */
|
||||
SELECT
|
||||
*
|
||||
FROM contract_mgmt
|
||||
WHERE objid = #{objid}
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 분할출하 로그 저장 (로그 기반 방식)
|
||||
* @since 2025.10.20
|
||||
* @author system
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<insert id="insertSplitShipmentLog" parameterType="map">
|
||||
/* salesNcollectMgmt.insertSplitShipmentLog */
|
||||
INSERT INTO shipment_log (
|
||||
target_objid,
|
||||
log_type,
|
||||
log_message,
|
||||
split_quantity,
|
||||
original_quantity,
|
||||
shipping_status,
|
||||
sales_unit_price,
|
||||
sales_supply_price,
|
||||
sales_vat,
|
||||
sales_total_amount,
|
||||
sales_currency,
|
||||
sales_exchange_rate,
|
||||
serial_no,
|
||||
shipping_date,
|
||||
shipping_method,
|
||||
manager_user_id,
|
||||
incoterms,
|
||||
remark,
|
||||
is_split_record,
|
||||
reg_date,
|
||||
reg_user_id
|
||||
) VALUES (
|
||||
#{objid},
|
||||
#{logType},
|
||||
#{logMessage},
|
||||
#{splitQuantity}::integer,
|
||||
#{originalQuantity}::integer,
|
||||
'PENDING',
|
||||
#{salesUnitPrice}::numeric,
|
||||
#{salesSupplyPrice}::numeric,
|
||||
#{salesVat}::numeric,
|
||||
#{salesTotalAmount}::numeric,
|
||||
#{salesCurrency},
|
||||
#{salesExchangeRate}::numeric,
|
||||
#{serialNo},
|
||||
<choose>
|
||||
<when test="shippingDate != null and shippingDate != ''">
|
||||
TO_DATE(#{shippingDate}, 'YYYY-MM-DD'),
|
||||
</when>
|
||||
<otherwise>
|
||||
NULL,
|
||||
</otherwise>
|
||||
</choose>
|
||||
#{shippingMethod},
|
||||
#{managerUserId},
|
||||
#{incoterms},
|
||||
#{remark},
|
||||
true,
|
||||
NOW(),
|
||||
#{userId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -147,14 +147,18 @@ public class SalesNcollectMgmtService {
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
|
||||
// Tabulator는 page, size 파라미터를 사용
|
||||
String page = CommonUtils.checkNull(request.getParameter("page"), "1");
|
||||
String size = CommonUtils.checkNull(request.getParameter("size"), Constants.ADMIN_COUNT_PER_PAGE+"");
|
||||
int pageNum = Integer.parseInt(page);
|
||||
int sizeNum = Integer.parseInt(size);
|
||||
// 페이징 HTML 생성을 위해 DB에서 총 카운트 조회
|
||||
String countPerPage = CommonUtils.checkNull(request.getParameter("size"), Constants.ADMIN_COUNT_PER_PAGE+"");
|
||||
paramMap.put("COUNT_PER_PAGE", Integer.parseInt(countPerPage));
|
||||
Map pageMap = (HashMap) sqlSession.selectOne("salesNcollectMgmt.getSalesMgmtGridListCount", paramMap);
|
||||
pageMap = (HashMap) CommonUtils.setPagingInfo(request, pageMap);
|
||||
paramMap.put("PAGE_HTML", CommonUtils.checkNull(pageMap.get("PAGE_HTML")));
|
||||
|
||||
// 실제 쿼리에 사용할 LIMIT, OFFSET 값 계산 (정수 타입으로)
|
||||
String page = CommonUtils.checkNull(request.getParameter("page"), "1");
|
||||
int pageNum = Integer.parseInt(page);
|
||||
int sizeNum = Integer.parseInt(countPerPage);
|
||||
paramMap.put("PAGE_START", (pageNum - 1) * sizeNum);
|
||||
paramMap.put("COUNT_PER_PAGE", sizeNum);
|
||||
|
||||
resultList = (ArrayList) sqlSession.selectList("salesNcollectMgmt.getSalesMgmtGridList", paramMap);
|
||||
} catch(Exception e) {
|
||||
@@ -181,7 +185,10 @@ public class SalesNcollectMgmtService {
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
totalCount = sqlSession.selectOne("salesNcollectMgmt.getSalesMgmtGridListCount", paramMap);
|
||||
Map<String, Object> resultMap = sqlSession.selectOne("salesNcollectMgmt.getSalesMgmtGridListCount", paramMap);
|
||||
if(resultMap != null && resultMap.get("TOTAL_CNT") != null) {
|
||||
totalCount = Integer.parseInt(resultMap.get("TOTAL_CNT").toString());
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -193,6 +200,190 @@ public class SalesNcollectMgmtService {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 매출관리 합계 조회 (Total 공급가액, 부가세, 총액)
|
||||
* @param paramMap - 검색 조건
|
||||
* @return Map - TOTAL_SUPPLY_PRICE, TOTAL_VAT, TOTAL_AMOUNT
|
||||
*/
|
||||
public Map<String, Object> getSalesMgmtTotals(Map<String, Object> paramMap) {
|
||||
SqlSession sqlSession = null;
|
||||
Map<String, Object> totalsMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
totalsMap = sqlSession.selectOne("salesNcollectMgmt.getSalesMgmtTotals", paramMap);
|
||||
|
||||
if(totalsMap == null) {
|
||||
totalsMap = new HashMap<String, Object>();
|
||||
totalsMap.put("TOTAL_SUPPLY_PRICE", 0);
|
||||
totalsMap.put("TOTAL_VAT", 0);
|
||||
totalsMap.put("TOTAL_AMOUNT", 0);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
totalsMap.put("TOTAL_SUPPLY_PRICE", 0);
|
||||
totalsMap.put("TOTAL_VAT", 0);
|
||||
totalsMap.put("TOTAL_AMOUNT", 0);
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return totalsMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 판매 정보 조회
|
||||
* </pre>
|
||||
* @param paramMap
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public Map<String, Object> getSaleInfo(Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultMap = sqlSession.selectOne("salesNcollectMgmt.getSaleInfo", paramMap);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||||
}
|
||||
|
||||
public Map<String, Object> saveSaleRegistration(HttpServletRequest request, Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
|
||||
PersonBean person = (PersonBean) request.getSession().getAttribute(Constants.PERSON_BEAN);
|
||||
paramMap.put("cretEmpNo", person.getUserId());
|
||||
|
||||
// SWSC110A_TBL 업데이트
|
||||
sqlSession.update("salesNcollectMgmt.updateSaleRegistration_swsc110a", paramMap);
|
||||
|
||||
// SWSD010A_TBL 업데이트 (insert or update)
|
||||
sqlSession.update("salesNcollectMgmt.upsertSaleRegistration_swsd010a", paramMap);
|
||||
|
||||
sqlSession.commit();
|
||||
resultMap.put("result", true);
|
||||
resultMap.put("msg", "저장되었습니다.");
|
||||
} catch(Exception e) {
|
||||
sqlSession.rollback();
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "저장 중 오류가 발생했습니다.");
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 분할출하 처리 (로그 기반)
|
||||
* - 원본 데이터는 그대로 유지
|
||||
* - 분할출하 로그만 shipment_log에 저장
|
||||
* - 화면에서는 VIEW를 통해 원본 + 로그를 합쳐서 표시
|
||||
* </pre>
|
||||
* @param request
|
||||
* @param paramMap - 분할출하 정보
|
||||
* @return Map
|
||||
*/
|
||||
public Map<String, Object> splitShipment(HttpServletRequest request, Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
|
||||
PersonBean person = (PersonBean) request.getSession().getAttribute(Constants.PERSON_BEAN);
|
||||
String userId = person.getUserId();
|
||||
|
||||
// 원본 데이터 조회
|
||||
Map<String, Object> originalData = sqlSession.selectOne("salesNcollectMgmt.getContractByObjid", paramMap);
|
||||
|
||||
if(originalData == null) {
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "원본 데이터를 찾을 수 없습니다.");
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
// 분할 수량
|
||||
int splitQuantity = Integer.parseInt(paramMap.get("splitQuantity").toString());
|
||||
int originalQuantity = Integer.parseInt(paramMap.get("originalQuantity").toString());
|
||||
|
||||
// 원본 데이터의 단가 정보 가져오기
|
||||
BigDecimal unitPrice = new BigDecimal(originalData.get("order_unit_price").toString());
|
||||
BigDecimal exchangeRate = new BigDecimal(originalData.get("exchange_rate").toString());
|
||||
|
||||
// 분할 금액 계산
|
||||
BigDecimal splitSupplyPrice = unitPrice.multiply(new BigDecimal(splitQuantity));
|
||||
BigDecimal splitVat = splitSupplyPrice.multiply(new BigDecimal("0.1"));
|
||||
BigDecimal splitTotalAmount = splitSupplyPrice.add(splitVat);
|
||||
|
||||
// 분할출하 로그 저장
|
||||
paramMap.put("logType", "SPLIT_SHIPMENT");
|
||||
paramMap.put("logMessage", "분할출하 - 원본수량: " + originalQuantity + ", 분할수량: " + splitQuantity);
|
||||
paramMap.put("userId", userId);
|
||||
paramMap.put("splitQuantity", splitQuantity);
|
||||
paramMap.put("originalQuantity", originalQuantity);
|
||||
paramMap.put("salesUnitPrice", unitPrice);
|
||||
paramMap.put("salesSupplyPrice", splitSupplyPrice);
|
||||
paramMap.put("salesVat", splitVat);
|
||||
paramMap.put("salesTotalAmount", splitTotalAmount);
|
||||
paramMap.put("salesCurrency", originalData.get("contract_currency"));
|
||||
paramMap.put("salesExchangeRate", exchangeRate);
|
||||
|
||||
// 팝업에서 입력한 데이터 우선, 없으면 원본 데이터 사용
|
||||
paramMap.put("shippingMethod",
|
||||
StringUtils.isNotBlank((String)paramMap.get("shippingMethod")) ?
|
||||
paramMap.get("shippingMethod") : originalData.get("shipping_method"));
|
||||
paramMap.put("incoterms",
|
||||
StringUtils.isNotBlank((String)paramMap.get("incoterms")) ?
|
||||
paramMap.get("incoterms") : originalData.get("incoterms"));
|
||||
paramMap.put("managerUserId",
|
||||
StringUtils.isNotBlank((String)paramMap.get("manager")) ?
|
||||
paramMap.get("manager") : originalData.get("pm_user_id"));
|
||||
|
||||
// 팝업에서 입력한 추가 정보
|
||||
// serialNo, shippingDate, remark는 팝업에서만 입력 가능
|
||||
|
||||
sqlSession.insert("salesNcollectMgmt.insertSplitShipmentLog", paramMap);
|
||||
|
||||
sqlSession.commit();
|
||||
|
||||
resultMap.put("result", true);
|
||||
resultMap.put("msg", "분할출하가 완료되었습니다.");
|
||||
|
||||
} catch(Exception e) {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.rollback();
|
||||
}
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "분할출하 처리 중 오류가 발생했습니다: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 매출관리 등록
|
||||
|
||||
Reference in New Issue
Block a user