행이랑 검색필터 바꾸기 엑셀도 출하일 형식 맞추게 일단 로직 해놨음

This commit is contained in:
leeheejin
2025-11-10 17:28:42 +09:00
parent 8ba51a83b6
commit eef9324a43
11 changed files with 1370 additions and 921 deletions

View File

@@ -755,35 +755,39 @@
AND PAID_TYPE = #{paid_type}
</if>
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
<if test="search_partObjId != null and search_partObjId != ''">
AND EXISTS (
SELECT 1
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = T.OBJID
AND CI.STATUS = 'ACTIVE'
AND CI.PART_OBJID = #{search_partObjId}
)
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
</if>
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
</if>
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
<if test="search_partObjId != null and search_partObjId != ''">
AND EXISTS (
SELECT 1
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = T.OBJID
AND CI.STATUS = 'ACTIVE'
AND CI.PART_OBJID = #{search_partObjId}
)
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="search_poNo != null and search_poNo != ''">
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
</if>
<if test="order_start_date != null and !''.equals(order_start_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
</if>
<if test="order_end_date != null and !''.equals(order_end_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
</if>
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
</select>
<select id="contractList_bak" parameterType="map" resultType="map">
@@ -2316,6 +2320,9 @@ SELECT
<if test="supply_name != null and supply_name != ''">
AND UPPER(SUPPLY_NAME) LIKE UPPER('%${supply_name}%')
</if>
<if test="manager_name != null and manager_name != ''">
AND UPPER(MANAGER1_NAME) LIKE UPPER('%${manager_name}%')
</if>
<if test="searchStatus != null and searchStatus != ''">
AND UPPER(STATUS) LIKE UPPER('%${searchStatus}%')
</if>
@@ -4308,33 +4315,40 @@ WHERE
AND PAID_TYPE = #{paid_type}
</if>
<if test="search_partNo != null and search_partNo != ''">
AND UPPER(PART_NO) LIKE UPPER('%${search_partNo}%')
</if>
<if test="search_partName != null and search_partName != ''">
AND UPPER(PART_NAME) LIKE UPPER('%${search_partName}%')
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
</if>
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
</if>
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
<if test="search_partObjId != null and search_partObjId != ''">
AND EXISTS (
SELECT 1
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = T.OBJID
AND CI.STATUS = 'ACTIVE'
AND CI.PART_OBJID = #{search_partObjId}
)
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="search_poNo != null and search_poNo != ''">
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
</if>
<if test="order_start_date != null and !''.equals(order_start_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
</if>
<if test="order_end_date != null and !''.equals(order_end_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
</if>
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
</select>
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
</select>
<!-- 영업정보 조회 (수주등록용) -->
<select id="getContractInfo" parameterType="map" resultType="map">
@@ -4487,10 +4501,20 @@ WHERE
AND OBJID = #{partObjId}
</if>
<if test="searchTerm != null and searchTerm != ''">
AND (
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
)
<choose>
<when test="searchType == 'partNo'">
AND UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
</when>
<when test="searchType == 'partName'">
AND UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
</when>
<otherwise>
AND (
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
)
</otherwise>
</choose>
</if>
ORDER BY
PART_NO

View File

@@ -863,28 +863,46 @@
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CI.PART_OBJID = T.PART_OBJID
AND CI.STATUS = 'ACTIVE') AS CUSTOMER_REQUEST,
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
T.PO_NO,
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
CASE WHEN EXISTS(
SELECT 1 FROM ATTACH_FILE_INFO
WHERE TARGET_OBJID = T.CONTRACT_OBJID
AND DOC_TYPE='ORDER_DOC'
AND UPPER(STATUS) = 'ACTIVE'
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
(SELECT CM.PO_NO FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PO_NO,
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
CASE WHEN EXISTS(
SELECT 1 FROM ATTACH_FILE_INFO
WHERE TARGET_OBJID = T.CONTRACT_OBJID
AND DOC_TYPE='ORDER_DOC'
AND UPPER(STATUS) = 'ACTIVE'
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
-- 잔량 계산: 수주수량 - 판매수량
COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0) AS REMAINING_QUANTITY,
-- 잔량원화총액 계산: (수주수량 - 판매수량) * 판매단가
(COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0)) * COALESCE(SR.sales_unit_price, 0) AS REMAINING_AMOUNT_KRW,
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
-- 출하일 (분할출하 포함): 엑셀 다운로드용
COALESCE(
(SELECT
CASE
WHEN COUNT(DISTINCT shipping_date) = 0 THEN ''
WHEN COUNT(DISTINCT shipping_date) = 1 THEN TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD')
ELSE TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD') || '외' || (COUNT(DISTINCT shipping_date) - 1)::TEXT
END
FROM shipment_log
WHERE target_objid = T.OBJID::VARCHAR
AND shipping_date IS NOT NULL
AND UPPER(COALESCE(shipping_status, '')) != 'CANCELLED'),
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '')
) AS SHIPPING_DATE_WITH_COUNT,
COALESCE(SR.shipping_method, '') AS SHIPPING_METHOD,
COALESCE(
(SELECT USER_NAME FROM USER_INFO WHERE USER_ID = SR.manager_user_id),
@@ -929,70 +947,103 @@
)
)
</if>
<if test="productNo != null and productNo != ''">
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
</if>
<if test="productName != null and productName != ''">
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
</if>
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
<if test="poNo != null and poNo != ''">
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
</if>
<if test="shippingStatus != null and shippingStatus != ''">
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
AND (
<if test="search_partNo != null and search_partNo != ''">
T.PART_NO = #{search_partNo}
</if>
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
OR
</if>
<if test="search_partName != null and search_partName != ''">
T.PART_NAME = #{search_partName}
</if>
)
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CI.PART_OBJID = T.PART_OBJID
AND CI.STATUS = 'ACTIVE'
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
</select>
<if test="poNo != null and poNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
)
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
)
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
)
</if>
<if test="shippingStatus != null and shippingStatus != ''">
AND SR.shipping_order_status = #{shippingStatus}
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
</if>
<!-- 매출마감 기간 검색 -->
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
</if>
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
</if>
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
</select>
<!-- 매출관리 그리드 목록 개수 - project_mgmt 테이블 기반 -->
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="map">
@@ -1033,67 +1084,112 @@
)
)
</if>
<if test="productNo != null and productNo != ''">
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
</if>
<if test="productName != null and productName != ''">
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
</if>
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
<if test="poNo != null and poNo != ''">
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
</if>
<if test="shippingStatus != null and shippingStatus != ''">
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
AND (
<if test="search_partNo != null and search_partNo != ''">
T.PART_NO = #{search_partNo}
</if>
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
OR
</if>
<if test="search_partName != null and search_partName != ''">
T.PART_NAME = #{search_partName}
</if>
)
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CI.PART_OBJID = T.PART_OBJID
AND CI.STATUS = 'ACTIVE'
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
<if test="poNo != null and poNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
)
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
)
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
)
</if>
<if test="shippingStatus != null and shippingStatus != ''">
AND EXISTS (
SELECT 1 FROM sales_registration SR
WHERE T.PROJECT_NO = SR.project_no
AND SR.shipping_order_status = #{shippingStatus}
)
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
AND EXISTS (
SELECT 1 FROM sales_registration SR
WHERE T.PROJECT_NO = SR.project_no
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
)
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
AND EXISTS (
SELECT 1 FROM sales_registration SR
WHERE T.PROJECT_NO = SR.project_no
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
)
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
</if>
<!-- 매출마감 기간 검색 -->
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
</if>
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
</if>
</select>
<!-- 매출관리 합계 조회 (Total 공급가액, 부가세, 총액) -->

View File

@@ -217,22 +217,37 @@ function addComma(num) {
}
var columns = [
{title:'EST_OBJID' ,field:'EST_OBJID' ,visible:false, frozen:true},
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_projectConceptDetail(objid);
{title:'EST_OBJID' ,field:'EST_OBJID' ,visible:false, frozen:true},
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_projectConceptDetail(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
formatter: function(cell, formatterParams, onRendered){
var dueDate = fnc_checkNull(cell.getValue());
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
if(dueDate === '') return '';
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
if(otherCount && parseInt(otherCount) > 0){
return dueDate + ' 외 ' + otherCount + '건';
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '88', title : '국내/해외', field : 'AREA_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
return dueDate;
}
},
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '88', title : '국내/해외', field : 'AREA_NAME' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
// formatter: function(cell, formatterParams, onRendered){
// var value = fnc_checkNull(cell.getValue());
@@ -241,11 +256,11 @@ var columns = [
// // 쉼표로 구분된 S/N 개수 계산
// var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
// var count = serialNumbers.length;
// if(count === 0) return '';
// if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
// 2개 이상이면 "첫번째 외 N개" 형식
// 2개 이상이면 "첫번째 외 N개" 형식
// var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
// return '<a href="javascript:void(0);">' + displayText + '</a>';
// },
@@ -255,38 +270,41 @@ var columns = [
// }
// },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '수량', field : 'QUANTITY' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
formatter: function(cell, formatterParams, onRendered){
var dueDate = fnc_checkNull(cell.getValue());
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
if(dueDate === '') return '';
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
if(otherCount && parseInt(otherCount) > 0){
return dueDate + ' 외 ' + otherCount + '건';
}
return dueDate;
}
},
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '반납사유', field : 'RETURN_REASON_SUMMARY' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객요청사항', field : 'CUSTOMER_REQUEST' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '반납사유', field : 'RETURN_REASON_SUMMARY' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객요청사항', field : 'CUSTOMER_REQUEST' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적현황', field : 'EST_STATUS',
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_showEstimateList(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'right', width : '130', title : '공급가액', field : 'EST_TOTAL_AMOUNT',
formatter: function(cell, formatterParams, onRendered){
var value = fnc_checkNull(cell.getValue());
if(value === '' || value === '0') return '';
// 통화 기호 제거 후 콤마 추가
var numericValue = String(value).replace(/[^0-9.]/g, '');
return addComma(numericValue);
}
},
{headerHozAlign : 'center', hozAlign : 'right', width : '150', title : '원화환산공급가액', field : 'EST_TOTAL_AMOUNT_KRW',
formatter: function(cell, formatterParams, onRendered){
var value = fnc_checkNull(cell.getValue());
if(value === '' || value === '0') return '';
// 통화 기호 제거 후 콤마 추가
var numericValue = String(value).replace(/[^0-9.]/g, '');
return addComma(numericValue);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적현황', field : 'EST_STATUS',
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_showEstimateList(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '결재상태', field : 'APPR_STATUS',
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var APPROVAL_OBJID = fnc_checkNull(cell.getData().APPROVAL_OBJID);
var ROUTE_OBJID = fnc_checkNull(cell.getData().ROUTE_OBJID);
approval_form(APPROVAL_OBJID,ROUTE_OBJID);
}
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var APPROVAL_OBJID = fnc_checkNull(cell.getData().APPROVAL_OBJID);
var ROUTE_OBJID = fnc_checkNull(cell.getData().ROUTE_OBJID);
approval_form(APPROVAL_OBJID,ROUTE_OBJID);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '메일발송', field : 'MAIL_SEND_STATUS',
formatter: function(cell, formatterParams, onRendered){
@@ -309,27 +327,31 @@ var columns = [
// }
}
},
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '견적단가', field : 'EST_PRICE' },
{headerHozAlign : 'center', hozAlign : 'right', width : '130', title : '견적공급가액', field : 'EST_TOTAL_AMOUNT',
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'CONTRACT_CURRENCY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환율', field : 'EXCHANGE_RATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
formatter: function(cell, formatterParams, onRendered){
var value = fnc_checkNull(cell.getValue());
if(value === '' || value === '0') return '';
// 통화 기호 제거 후 콤마 추가
var numericValue = String(value).replace(/[^0-9.]/g, '');
return addComma(numericValue);
}
},
{headerHozAlign : 'center', hozAlign : 'right', width : '150', title : '견적원화환산공급가액', field : 'EST_TOTAL_AMOUNT_KRW',
formatter: function(cell, formatterParams, onRendered){
var value = fnc_checkNull(cell.getValue());
if(value === '' || value === '0') return '';
// 통화 기호 제거 후 콤마 추가
var numericValue = String(value).replace(/[^0-9.]/g, '');
return addComma(numericValue);
if(value === '') return '';
// 쉼표로 구분된 S/N 개수 계산
var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
var count = serialNumbers.length;
if(count === 0) return '';
if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
// 2개 이상이면 "첫번째 외 N개" 형식
var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
return '<a href="javascript:void(0);">' + displayText + '</a>';
},
cellClick:function(e, cell){
var serialNo = fnc_checkNull(cell.getData().SERIAL_NO);
fn_showSerialNoPopup(serialNo);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환종', field : 'CONTRACT_CURRENCY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환율', field : 'EXCHANGE_RATE' },
{headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '견적단가', field : 'EST_PRICE' },
// {title:"영업정보(상세)", headerHozAlign:'center', //고객정보
// columns:[
@@ -1111,106 +1133,112 @@ function openProjectFormPopUp(objId){
</div>
</div>
<div id="plmSearchZon">
<table>
<tr>
<td><label for="category_cd">주문유형</label></td>
<td>
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.category_cd}
</select>
</td>
<td><label for="product">제품구분</label></td>
<td>
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.product_cd}
</select>
</td>
<table>
<tr>
<td><label for="category_cd">주문유형</label></td>
<td>
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.category_cd}
</select>
</td>
<%--
<td><label for="product">제품구분</label></td>
<td>
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.product_cd}
</select>
</td>
<td><label for="area_cd">국내/해외</label></td>
<td>
<select name="area_cd" id="area_cd" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="0001220">국내</option>
<option value="0001221">해외</option>
</select>
</td>
<td><label for="customer_objid">고객사</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.customer_cd}
</select>
</td>
<td><label for="paid_type">유/무상</label></td>
<td>
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="paid">유상</option>
<option value="free">무상</option>
</select>
</td>
<td><label for="area_cd">국내/해외</label></td>
<td>
<select name="area_cd" id="area_cd" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="0001220">국내</option>
<option value="0001221">해외</option>
</select>
</td>
--%>
<td><label for="customer_objid">고객사</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.customer_cd}
</select>
</td>
<%--
<td><label for="paid_type">유/무상</label></td>
<td>
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="paid">유상</option>
<option value="free">무상</option>
</select>
</td>
--%>
<td class="align_r">
<label for="" class="">품번</label>
<td class="align_r">
<label for="" class="">품번</label>
</td>
<td>
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
<option value="">품번 선택</option>
</select>
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
</td>
<td class="align_r">
<label for="" class="">품명</label>
</td>
<td>
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
<option value="">품명 선택</option>
</select>
</td>
</tr>
<tr>
<td class="">
<label for="" class="">S/N</label>
</td>
<td>
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
<option value="">품번 선택</option>
</select>
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
</td>
<td class="align_r">
<label for="" class="">품명</label>
<td><label for="">결재상태</label></td>
<td>
<select name="appr_status" id="appr_status" class="select2" autocomplete="off" style="width:130px">
<option value="">선택</option>
<%-- ${code_map.appr_status} --%>
<option value="작성중">작성중</option>
<option value="결재중">결재중</option>
<option value="반려">반려</option>
<option value="결재완료">결재완료</option>
<option value="취소">취소</option>
</select>
</td>
<td class="">
<label>접수일</label>
</td>
<td colspan="3">
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
<option value="">품명 선택</option>
</select>
<input type="text" name="receipt_start_date" id="receipt_start_date" style="width:90px;" autocomplete="off" value="${param.receipt_start_date}" class="date_icon">~
<input type="text" name="receipt_end_date" id="receipt_end_date" style="width:90px;" autocomplete="off" value="${param.receipt_end_date}" class="date_icon">
</td>
</tr>
<tr>
<td class="">
<label for="" class="">S/N</label>
</td>
<td colspan="">
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
</td>
<td><label for="">결재상태</label></td>
<td>
<select name="appr_status" id="appr_status" class="select2" autocomplete="off" style="width:130px">
<option value="">선택</option>
<%-- ${code_map.appr_status} --%>
<option value="작성중">작성중</option>
<option value="결재중">결재중</option>
<option value="반려">반려</option>
<option value="결재완료">결재완료</option>
<option value="취소">취소</option>
</select>
</td>
<td class="">
<label>접수일</label>
</td>
<td>
<input type="text" name="receipt_start_date" id="receipt_start_date" style="width:90px;" autocomplete="off" value="${param.receipt_start_date}" class="date_icon">~
<input type="text" name="receipt_end_date" id="receipt_end_date" style="width:90px;" autocomplete="off" value="${param.receipt_end_date}" class="date_icon">
</td>
<td class="">
<label>요청납기</label>
</td>
<td>
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
</td>
</tr>
<%--
<td class="">
<label>요청납기</label>
</td>
<td>
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
</td>
--%>
</tr>
</table>
</div>

View File

@@ -96,94 +96,88 @@ $(document).ready(function(){
});
var columns = [
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, width:40, frozen:true},
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_projectConceptDetail(objid);
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, width:40, frozen:true},
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
formatter:fnc_createGridAnchorTag,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_projectConceptDetail(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주번호', field : 'PO_NO' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
formatter: function(cell, formatterParams, onRendered){
var dueDate = fnc_checkNull(cell.getValue());
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
if(dueDate === '') return '';
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
if(otherCount && parseInt(otherCount) > 0){
return dueDate + ' 외 ' + otherCount + '건';
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '85', title : '국내/해외', field : 'AREA_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
//품번, 품명 추가 시 사용
// {headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품명', field : 'PART_NAME' },
//S/N 추가 시 사용
// {headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
// formatter: function(cell, formatterParams, onRendered){
// var value = fnc_checkNull(cell.getValue());
// if(value === '') return '';
//
// // 쉼표로 구분된 S/N 개수 계산
// var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
// var count = serialNumbers.length;
//
// if(count === 0) return '';
// if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
//
// // 2개 이상이면 "첫번째 외 N개" 형식
// var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
// return '<a href="javascript:void(0);">' + displayText + '</a>';
// },
// cellClick:function(e, cell){
// var serialNo = fnc_checkNull(cell.getData().SERIAL_NO);
// fn_showSerialNoPopup(serialNo);
// }
// },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
formatter: function(cell, formatterParams, onRendered){
var dueDate = fnc_checkNull(cell.getValue());
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
if(dueDate === '') return '';
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
if(otherCount && parseInt(otherCount) > 0){
return dueDate + ' 외 ' + otherCount + '건';
}
return dueDate;
}
},
return dueDate;
}
},
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '수주상태', field : 'CONTRACT_RESULT_NAME' },
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '공급가액', field : 'ORDER_SUPPLY_PRICE_SUM',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '부가세', field : 'ORDER_VAT_SUM',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '총액', field : 'ORDER_TOTAL_AMOUNT_SUM',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '원화총액', field : 'ORDER_TOTAL_AMOUNT_KRW',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'CU01_CNT' ,
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_FileRegist(objid,"ORDER_DOC","ORDER_DOC");
}
},
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '결재상태', field : 'APPR_STATUS' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'CONTRACT_CURRENCY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환율', field : 'EXCHANGE_RATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
formatter: function(cell, formatterParams, onRendered){
var value = fnc_checkNull(cell.getValue());
if(value === '') return '';
// 쉼표로 구분된 S/N 개수 계산
var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
var count = serialNumbers.length;
if(count === 0) return '';
if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
// 2개 이상이면 "첫번째 외 N개" 형식
var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
return '<a href="javascript:void(0);">' + displayText + '</a>';
},
cellClick:function(e, cell){
var serialNo = fnc_checkNull(cell.getData().SERIAL_NO);
fn_showSerialNoPopup(serialNo);
}
},
{headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '85', title : '국내/해외', field : 'AREA_NAME' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '수량', field : 'QUANTITY' },
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'DUE_DATE' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객요청사항', field : 'CUSTOMER_REQUEST' },
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '수주상태', field : 'CONTRACT_RESULT_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주번호', field : 'PO_NO' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'CU01_CNT' ,
formatter:fnc_subInfoValueFormatter,
cellClick:function(e, cell){
var objid = fnc_checkNull(cell.getData().OBJID);
fn_FileRegist(objid,"ORDER_DOC","ORDER_DOC");
}
},
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '단가', field : 'ORDER_UNIT_PRICE',
// formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
// },
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '수주공급가액', field : 'ORDER_SUPPLY_PRICE_SUM',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주부가세', field : 'ORDER_VAT_SUM',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주총액', field : 'ORDER_TOTAL_AMOUNT_SUM',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '수주원화총액', field : 'ORDER_TOTAL_AMOUNT_KRW',
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환종', field : 'CONTRACT_CURRENCY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환율', field : 'EXCHANGE_RATE' },
];
//var grid;
@@ -618,106 +612,108 @@ function openProjectFormPopUp(objId){
</div>
</div>
<div id="plmSearchZon">
<table>
<tr>
<td><label for="category_cd">주문유형</label></td>
<td>
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.category_cd}
</select>
</td>
<td><label for="product">제품구분</label></td>
<td>
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.product_cd}
</select>
</td>
<td><label for="area_cd">국내/해외</label></td>
<td>
<select name="area_cd" id="area_cd" style="" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="0001220">국내</option>
<option value="0001221">해외</option>
</select>
</td>
<td><label for="customer_objid">고객사</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.customer_cd}
</select>
</td>
<td><label for="paid_type">유/무상</label></td>
<td>
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="paid">유상</option>
<option value="free">무상</option>
</select>
</td>
<td class="align_r">
<label for="" class="">품번</label>
<table>
<tr>
<td><label for="category_cd">주문유형</label></td>
<td>
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.category_cd}
</select>
</td>
<td class="">
<label for="" class="">발주번호</label>
</td>
<td>
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
<option value="">품번 선택</option>
</select>
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
<input type="text" name="search_poNo" id="search_poNo" value="${param.search_poNo}"/>
</td>
<td class="align_r">
<label for="" class="">품명</label>
<td><label for="customer_objid">고객사</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.customer_cd}
</select>
</td>
<%--
<td><label for="product">제품구분</label></td>
<td>
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.product_cd}
</select>
</td>
<td><label for="area_cd">국내/해외</label></td>
<td>
<select name="area_cd" id="area_cd" style="" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="0001220">국내</option>
<option value="0001221">해외</option>
</select>
</td>
<td><label for="paid_type">유/무상</label></td>
<td>
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
<option value="paid">유상</option>
<option value="free">무상</option>
</select>
</td>
--%>
<td class="align_r">
<label for="" class="">품번</label>
</td>
<td>
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
<option value="">품번 선택</option>
</select>
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
</td>
<td class="align_r">
<label for="" class="">품명</label>
</td>
<td>
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
<option value="">품명 선택</option>
</select>
</td>
</tr>
<tr>
<td class="">
<label for="" class="">S/N</label>
</td>
<td>
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
</td>
<td><label for="contract_result">수주상태</label></td>
<td>
<select name="contract_result" id="contract_result" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.result_cd}
</select>
</td>
<td class="">
<label>발주일</label>
</td>
<td colspan="3">
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
<option value="">품명 선택</option>
</select>
<input type="text" name="order_start_date" id="order_start_date" style="width:90px;" autocomplete="off" value="${param.order_start_date}" class="date_icon">~
<input type="text" name="order_end_date" id="order_end_date" style="width:90px;" autocomplete="off" value="${param.order_end_date}" class="date_icon">
</td>
</tr>
<tr>
<td class="">
<label for="" class="">S/N</label>
</td>
<td colspan="">
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
</td>
<td><label for="contract_result">수주상태</label></td>
<td>
<select name="contract_result" id="contract_result" style="width:130px" class="select2" autocomplete="off">
<option value="">선택</option>
${code_map.result_cd}
</select>
</td>
<td class="">
<label for="" class="">발주번호</label>
</td>
<td colspan="">
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
</td>
<td class="">
<label>요청납기</label>
</td>
<td>
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
</td>
<td class="">
<label>발주일</label>
</td>
<td>
<input type="text" name="order_start_date" id="order_start_date" style="width:90px;" autocomplete="off" value="${param.order_start_date}" class="date_icon">~
<input type="text" name="order_end_date" id="order_end_date" style="width:90px;" autocomplete="off" value="${param.order_end_date}" class="date_icon">
<td class="">
<label>요청납기</label>
</td>
<td colspan="3">
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
</td>
</tr>
</table>

View File

@@ -55,35 +55,35 @@
<script type="text/javascript">
var columns = [
{title:'OBJID', field:'OBJID' ,visible:false },
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '고객번호', field : 'CUS_NO',
formatter : fnc_createGridAnchorTag,
cellClick : function(e, cell) {
var objid = fnc_checkNull(cell.getData().OBJID);
openOEMPopUp(objid);
}
},
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '고객구분', field : 'SUPPLY_CODE_NAME' },
//{headerHozAlign : 'center', hozAlign : 'left', width : '110', title : '지역', field : 'AREA_CD_NAME' },
{headerHozAlign : 'center', hozAlign : 'left ', width : '200', title : '고객사', field : 'SUPPLY_NAME' },
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '대표자명', field : 'CHARGE_USER_NAME' },
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '담당자', field : 'MANAGER1_NAME' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '담당자 이메일', field : 'MANAGER1_EMAIL' },
{headerHozAlign : 'center', hozAlign : 'center', width : '130', title : '사업자등록번호', field : 'BUS_REG_NO' },
{headerHozAlign : 'center', hozAlign : 'left', /* width : '300', */ title : '주소', field : 'SUPPLY_ADDRESS' },
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '연락처', field : 'SUPPLY_TEL_NO' },
{headerHozAlign : 'center', hozAlign : 'left', width : '240', title : 'E-MAIL', field : 'EMAIL' },
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '등록일', field : 'REGDATE' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '사업자등록증', field : 'BUS_REG_FILE_CNT',
formatter: function(cell, formatterParams){
var objid = cell.getData().OBJID;
var fileCnt = cell.getData().BUS_REG_FILE_CNT || 0;
var imgSrc = fileCnt > 0 ? '/images/folder_blue.png' : '/images/file_empty.png';
var title = fileCnt > 0 ? '사업자등록증 보기 ('+fileCnt+'개)' : '등록된 파일 없음';
return "<a href='javascript:viewBusRegCert(\""+objid+"\")'><img src='"+imgSrc+"' height='25px' width='25px' style='cursor:pointer;' title='"+title+"'></a>";
}
{title:'OBJID', field:'OBJID' ,visible:false },
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '고객번호', field : 'CUS_NO',
formatter : fnc_createGridAnchorTag,
cellClick : function(e, cell) {
var objid = fnc_checkNull(cell.getData().OBJID);
openOEMPopUp(objid);
}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '등록일', field : 'REGDATE' },
{headerHozAlign : 'center', hozAlign : 'left ', width : '200', title : '고객사', field : 'SUPPLY_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '130', title : '사업자등록번호', field : 'BUS_REG_NO' },
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '담당자명', field : 'MANAGER1_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '연락처', field : 'SUPPLY_TEL_NO' },
{headerHozAlign : 'center', hozAlign : 'left', width : '240', title : '이메일', field : 'EMAIL' },
{headerHozAlign : 'center', hozAlign : 'left', /* width : '300', */ title : '주소', field : 'SUPPLY_ADDRESS' },
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '대표자명', field : 'CHARGE_USER_NAME' },
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '사업자등록증', field : 'BUS_REG_FILE_CNT',
formatter: function(cell, formatterParams){
var objid = cell.getData().OBJID;
var fileCnt = cell.getData().BUS_REG_FILE_CNT || 0;
var imgSrc = fileCnt > 0 ? '/images/folder_blue.png' : '/images/file_empty.png';
var title = fileCnt > 0 ? '사업자등록증 보기 ('+fileCnt+'개)' : '등록된 파일 없음';
return "<a href='javascript:viewBusRegCert(\""+objid+"\")'><img src='"+imgSrc+"' height='25px' width='25px' style='cursor:pointer;' title='"+title+"'></a>";
}
}
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '고객구분', field : 'SUPPLY_CODE_NAME' },
//{headerHozAlign : 'center', hozAlign : 'left', width : '110', title : '지역', field : 'AREA_CD_NAME' },
// {headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '담당자 이메일', field : 'MANAGER1_EMAIL' },
];
//var grid;
@@ -278,7 +278,10 @@ function fn_excel() {
<td class="label"><label for="">고객사명</label></td>
<td><input type="text" name="supply_name" id="supply_name" value="<%=supply_name%>"></td>
<td class="label"><label for="">담당자명</label></td>
<td><input type="text" name="manager_name" id="manager_name" value=""></td>
<%--
<td class="label"><label for="">고객구분</label></td>
<td>
<select name="supply_code" id="supply_code" type="select" class="select2" autocomplete="off">
@@ -294,6 +297,7 @@ function fn_excel() {
${code_map.area_cd}
</select>
</td>
--%>
</tr>
</table>
</div>

View File

@@ -184,69 +184,52 @@
var columns = [
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, width:40, frozen:true},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true
// formatter: fnc_createGridAnchorTag,
// cellClick: function(e, cell){
// var rowData = cell.getData();
// var popup_width = 600;
// var popup_height = 400;
// var url = "/salesMgmt/salesRegForm.do?orderNo=" + rowData.PROJECT_NO + "&saleNo=" + (rowData.SALE_NO || '');
// fn_centerPopup(popup_width, popup_height, url);
// }
},
// 요청된 열 순서: 프로젝트번호, 주문유형, 매출 마감, 발주일, 발주번호, 고객사, 제품구분, 품명, 수량, 단가, 공급가액, 부가세, 총액, 원화총액, 출고일, 국내/해외, 환종, 환율, S/N, 품번
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true},
{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 : '120', title : '매출마감', field : 'SALES_STATUS'},
{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',
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER'},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '제품구분', field : 'PRODUCT_TYPE'},
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PRODUCT_NAME'},
{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',
{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',
{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',
{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',
{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',
{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_NAME'},
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매환율', field : 'SALES_EXCHANGE_RATE',
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출고일', field : 'SHIPPING_DATE'},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '국내/해외', field : 'NATION'},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'SALES_CURRENCY_NAME'},
{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'}
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'}
// 주석처리된 컬럼들 (필요없는 항목)
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE'},
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
// {headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주수량', field : 'ORDER_QUANTITY'},
// {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 : '100', title : '주문서첨부', field : 'ORDER_ATTACH'},
// {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'}
];
function fn_search(){
@@ -446,30 +429,13 @@ function fn_FileRegist(objId, docType, docTypeName){
</div>
<div id="plmSearchZon">
<table>
<!-- 요청된 검색필터: 주문유형, 발주번호, 고객사, 제품구분, 품번, 품명, 국내/해외, S/N, 매출마감(기간), 발주일(기간), 출고일(기간) -->
<tr>
<td class="label"><label for="">주문유형</label></td>
<td><select name="orderType" class="select2" style="width:150px;"><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:150px;">
<option value="">선택</option>
${codeMap.nationList}
</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>
<td class="label"><label for="">발주번호</label></td>
<td><input type="text" name="poNo" /></td>
<td><label for="customer_objid">고객사</label></td>
<td>
@@ -479,6 +445,9 @@ function fn_FileRegist(objId, docType, docTypeName){
</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="align_r">
<label for="" class="">품번</label>
</td>
@@ -498,15 +467,44 @@ function fn_FileRegist(objId, docType, docTypeName){
</td>
</tr>
<tr>
<tr>
<td class="label"><label for="">국내/해외</label></td>
<td>
<select name="nation" class="select2" style="width:150px;">
<option value="">전체</option>
${codeMap.nationList}
</select>
</td>
<td class="label"><label for="">S/N</label></td>
<td><input type="text" name="serialNo" /></td>
<td class="label"><label for="">매출마감</label></td>
<td colspan="3"><input type="text" name="salesDeadlineFrom" class="date_icon" placeholder="시작일"/> ~ <input type="text" name="salesDeadlineTo" class="date_icon" placeholder="종료일"/></td>
<td class="label"><label for="">발주일</label></td>
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
</tr>
<tr>
<td class="label"><label for="">출고일</label></td>
<td colspan="11"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
</tr>
<!-- 주석처리된 필터들 (필요없는 항목) -->
<!--
<tr>
<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>
<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>
@@ -522,36 +520,22 @@ function fn_FileRegist(objId, docType, docTypeName){
</select>
</td>
<td class="label"><label for="">출하대기 상태</label></td>
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
<td class="label"><label for="">출고방법</label></td>
<td>
<select name="shippingMethod" class="select2" style="width:150px;">
<option value="">전체</option>
<option value="DIRECT">직납</option>
<option value="PARCEL">택배</option>
</select>
</td>
<td class="label"><label for="">매출마감</label></td>
<td>
<select name="salesStatus" class="select2" style="width:120px;">
<option value="">전체</option>
<option value="완료">매출마감</option>
<option value="NOT_CLOSED">매출마감 전</option>
</select>
</td>
</tr>
<td class="label"><label for="">출하대기 상태</label></td>
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
<td class="label"><label for="">출고방법</label></td>
<td>
<select name="shippingMethod" class="select2" style="width:150px;">
<option value="">전체</option>
<option value="DIRECT">직납</option>
<option value="PARCEL">택배</option>
</select>
</td>
<tr>
<td class="label"><label for="">요청납기</label></td>
<td colspan="3"><input type="text" name="requestDateFrom" class="date_icon"/> ~ <input type="text" name="requestDateTo" class="date_icon"/></td>
<td class="label"><label for="">발주일</label></td>
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
<td class="label"><label for="">출고일</label></td>
<td colspan="3"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
</tr>
-->
</table>
</div>

View File

@@ -14,10 +14,27 @@
<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(); // 날짜 선택기 초기화
$('.select2').select2(); // select2 초기화
// 품번/품명 Select2 AJAX 초기화
initPartSelect2Ajax("#search_partNo", "#search_partName", "#search_partObjId", {
debug: true
});
// 엔터키로 조회
$("input").keyup(function(e){
if(e.keyCode == 13){
@@ -49,6 +66,56 @@
});
}
}
// 엑셀 다운로드 실행 중 플래그
var isExcelDownloading = false;
function fn_excel() {
// 중복 실행 방지
if(isExcelDownloading) {
console.log("엑셀 다운로드가 이미 진행 중입니다.");
return false;
}
isExcelDownloading = true;
try {
// 현재 그리드 데이터 백업
var currentData = _tabulGrid.getData();
// 엑셀용 데이터 가공: 출하일을 분할출하 정보 포함하여 표시
var excelData = currentData.map(function(row) {
var excelRow = Object.assign({}, row);
// 출하일 가공: SHIPPING_DATE_WITH_COUNT 값을 SHIPPING_DATE에 덮어쓰기
// 예: "2025-10-20외1" 형식
if(excelRow.SHIPPING_DATE_WITH_COUNT) {
excelRow.SHIPPING_DATE = excelRow.SHIPPING_DATE_WITH_COUNT;
}
return excelRow;
});
// 엑셀용 데이터로 임시 설정
_tabulGrid.setData(excelData);
// 엑셀 다운로드
_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_openSaleRegPopup(orderNo, saleNo){
var popup_width = 850;
@@ -72,45 +139,37 @@
<script type="text/javascript">
// 새로운 테이블 구조에 맞게 컬럼 정의 수정
var columns = [
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true,
formatter: fnc_createGridAnchorTag,
cellClick: function(e, cell){
var orderNo = cell.getData().PROJECT_NO;
var saleNo = cell.getData().SALE_NO;
fn_openSaleRegPopup(orderNo, saleNo);
}
},
{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 : 'center', width : '100', title : '발주일', field : 'ORDER_DATE'},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하일', field : 'SHIPPING_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().CONTRACT_OBJID || 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 : '100', title : '잔량', field : 'REMAINING_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',
{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',
@@ -119,19 +178,108 @@ var columns = [
{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_NAME'},
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매환율', field : 'SALES_EXCHANGE_RATE',
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '잔량원화총액', field : 'REMAINING_AMOUNT_KRW',
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '생산상태', field : 'PRODUCTION_STATUS'},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '출하지시상태', field : 'SHIPPING_ORDER_STATUS'},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'SALES_CURRENCY_NAME'},
{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 : 'S/N', field : 'SERIAL_NO'},
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'}
// {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_REQUEST'},
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH',
// formatter: fnc_subInfoValueFormatter,
// cellClick: function(e, cell){
// var objid = cell.getData().CONTRACT_OBJID || cell.getData().SALE_NO;
// if(objid){
// fn_FileRegist(objid, "ORDER_DOC", "주문서");
// }
// }
// },
// {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'}
];
// 데이터 조회 함수
function fn_search(){
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/salesMgmt/salesMgmtGridList.do", columns, true);
// 디버깅: 검색 파라미터 확인
var formData = $("#form1").serializeObject();
console.log("=== 판매관리 조회 파라미터 ===");
console.log("search_partObjId:", formData.search_partObjId);
console.log("search_partNo:", formData.search_partNo);
console.log("search_partName:", formData.search_partName);
console.log("전체 파라미터:", formData);
// 그리드 조회 및 Total 합계 업데이트를 위한 커스텀 AJAX
$.ajax({
url: "/salesMgmt/salesMgmtGridList.do",
type: "POST",
data: formData,
dataType: "json",
beforeSend: function(){
_startLoading("Loading...");
},
complete: function(){
_endLoading();
},
success: function(response) {
// 그리드 데이터 설정
if(_tabulGrid){
_tabulGrid.setData(response.RESULTLIST || []);
} else {
// 그리드 초기화
_tabulGrid = new Tabulator("#mainGrid", {
layout: _tabul_layout_fitColumns,
columns: columns,
data: response.RESULTLIST || [],
selectable: true
});
}
// 조회된 전체 데이터의 판매원화총액 합계 계산
var totalSalesAmountKRW = 0;
var shippedAmountKRW = 0; // 출고된 금액
var notShippedAmountKRW = 0; // 미출고 금액
if(response.RESULTLIST && response.RESULTLIST.length > 0) {
response.RESULTLIST.forEach(function(row) {
var amountKRW = parseFloat(row.SALES_TOTAL_AMOUNT_KRW || 0);
totalSalesAmountKRW += amountKRW;
// 출하일이 있으면 출고, 없으면 미출고
if(row.SHIPPING_DATE && row.SHIPPING_DATE.trim() !== '') {
shippedAmountKRW += amountKRW;
} else {
notShippedAmountKRW += amountKRW;
}
});
}
// 합계 표시
$("#totalSalesAmountKRW").text(Number(totalSalesAmountKRW).toLocaleString());
$("#shippedAmountKRW").text(Number(shippedAmountKRW).toLocaleString());
$("#notShippedAmountKRW").text(Number(notShippedAmountKRW).toLocaleString());
// 페이징 HTML 업데이트
if(response.PAGE_HTML){
$("#pagingArea").html(response.PAGE_HTML);
}
},
error: function(xhr, status, error) {
_endLoading();
alert("데이터 조회 중 오류가 발생했습니다.");
console.error("Error:", error);
}
});
}
// 출하지시/판매등록 함수 (1건만 선택 가능)
@@ -185,6 +333,18 @@ function fn_bulkRegister(){
<td class="label"><label for="">주문유형</label></td>
<td><select name="orderType" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.orderTypeList}</select></td>
<td class="label"><label for="">발주번호</label></td>
<td><input type="text" name="poNo" /></td>
<td><label for="customer_objid">고객사</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="width:150px" class="select2" autocomplete="off">
<option value="">선택</option>
${codeMap.customer_cd}
</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>
@@ -204,14 +364,7 @@ function fn_bulkRegister(){
<option value="Y">무상</option>
</select>
</td>
<td><label for="customer_objid">고객사</label></td>
<td>
<select name="customer_objid" id="customer_objid" style="width:150px" class="select2" autocomplete="off">
<option value="">선택</option>
${codeMap.customer_cd}
</select>
</td>
--%>
<td class="align_r">
<label for="" class="">품번</label>
@@ -225,7 +378,7 @@ function fn_bulkRegister(){
<td class="align_r">
<label for="" class="">품명</label>
</td>
<td colspan="3">
<td>
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
<option value="">품명 선택</option>
</select>
@@ -236,11 +389,18 @@ function fn_bulkRegister(){
<td class="label"><label for="">S/N</label></td>
<td><input type="text" name="serialNo" /></td>
<td class="label"><label for="">출하지시상태</label></td>
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
<td class="label"><label for="">발주일</label></td>
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
<td class="label"><label for="">출고일</label></td>
<td colspan="3"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
<%--
<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>
@@ -256,8 +416,6 @@ function fn_bulkRegister(){
</select>
</td>
<td class="label"><label for="">출하대기 상태</label></td>
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
<td class="label"><label for="">출하방법</label></td>
<td>
<select name="shippingMethod" class="select2" style="width:150px;">
@@ -266,21 +424,25 @@ function fn_bulkRegister(){
<option value="PARCEL">택배</option>
</select>
</td>
</tr>
<tr>
<td class="label"><label for="">요청납기</label></td>
<td colspan="3"><input type="text" name="requestDateFrom" class="date_icon"/> ~ <input type="text" name="requestDateTo" class="date_icon"/></td>
<td class="label"><label for="">발주일</label></td>
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
<td class="label"><label for="">출고일</label></td>
<td colspan="3"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
--%>
</tr>
</table>
</div>
<!-- Total 합계 표시 영역 (판매원화총액 기준) -->
<div style="padding: 5px 10px; background: #f5f5f5; border-radius: 3px; margin: 10px 0;">
<span style="font-weight: bold; font-size: 13px;">
발주 금액 : <span id="totalSalesAmountKRW" style="color: #4CAF50;">0</span> 원
<span style="margin-left: 10px; font-size: 12px;">
(출고 : <span id="shippedAmountKRW" style="color: #2196F3;">0</span> 원,
미출고 : <span id="notShippedAmountKRW" style="color: #FF9800;">0</span> 원)
</span>
</span>
</div>
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
</div>
</div>

View File

@@ -3302,7 +3302,8 @@ function initPartSelect2Ajax(partNoSelectId, partNameSelectId, partObjIdInputId,
delay: 250,
data: function(params) {
return {
searchTerm: params.term
searchTerm: params.term,
searchType: 'partNo' // 품번만 검색
};
},
processResults: function(data) {
@@ -3353,7 +3354,8 @@ function initPartSelect2Ajax(partNoSelectId, partNameSelectId, partObjIdInputId,
delay: 250,
data: function(params) {
return {
searchTerm: params.term
searchTerm: params.term,
searchType: 'partName' // 품명만 검색
};
},
processResults: function(data) {

View File

@@ -163,25 +163,38 @@ public class SalesNcollectMgmtController {
// 코드정보 (기존 로직과 동일하게 설정 가능)
Map<String, Object> codeMap = new HashMap<String, Object>();
// 주문유형
// 주문유형 - 0000167 코드 사용 (판매, 개발, 수리, 개조)
codeMap.put("orderTypeList",
salesMgmtCommonService.bizMakeOptionList("GE", "", "salesMgmtCommon.getCodeList"));
commonService.bizMakeOptionList("0000167", "", "common.getCodeselect"));
// 제품구분
codeMap.put("productTypeList",
salesMgmtCommonService.bizMakeOptionList("", "", "salesMgmtCommon.getGoodsList"));
commonService.bizMakeOptionList("0000001", "", "common.getCodeselect"));
// 국내/해외
codeMap.put("nationList",
salesMgmtCommonService.bizMakeOptionList("AR", "", "salesMgmtCommon.getCodeList"));
commonService.bizMakeOptionList("0001219", "", "common.getCodeselect"));
// 고객사
codeMap.put("customer_cd", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")), "common.getsupplyselect"));
// 수주상태
codeMap.put("orderStatusList",
commonService.bizMakeOptionList("0000932", "", "common.getCodeselect"));
// 출하대기 상태
codeMap.put("shippingStatusList",
salesMgmtCommonService.bizMakeOptionList("SH", "", "salesMgmtCommon.getCodeList"));
// 담당자
codeMap.put("managerList", commonService.bizMakeOptionList("", "", "common.getUserselect"));
// 수주상태
codeMap.put("orderStatusList",
commonService.bizMakeOptionList("0000963", "", "common.getCodeselect"));
// 출하지시상태 - COMM_CODE 테이블에서 조회 (PARENT_CODE_ID를 찾아서 사용)
// 임시로 여러 코드를 시도해보거나, 직접 쿼리로 조회
String shippingStatusList = commonService.bizMakeOptionList("SHIPPING_STATUS", "", "common.getCodeselect");
if (shippingStatusList == null || shippingStatusList.trim().isEmpty()) {
// SHIPPING_STATUS 코드가 없으면 다른 코드 시도
shippingStatusList = commonService.bizMakeOptionList("0001300", "", "common.getCodeselect");
}
if (shippingStatusList == null || shippingStatusList.trim().isEmpty()) {
// 그래도 없으면 하드코딩
StringBuilder shippingStatusOptions = new StringBuilder();
shippingStatusOptions.append("<option value='출하지시'>출하지시</option>");
shippingStatusOptions.append("<option value='출하완료'>출하완료</option>");
shippingStatusOptions.append("<option value='출하대기'>출하대기</option>");
shippingStatusList = shippingStatusOptions.toString();
}
codeMap.put("shippingStatusList", shippingStatusList);
// 담당자
codeMap.put("managerList", commonService.bizMakeOptionList("", "", "common.getUserselect"));
request.setAttribute("codeMap", codeMap);
} catch (Exception e) {
@@ -320,8 +333,28 @@ public class SalesNcollectMgmtController {
@RequestMapping(value = "/salesMgmt/salesMgmtGridList.do", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> getSalesMgmtGridList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
// 디버깅: 검색 파라미터 로그 출력
System.out.println("=== 판매관리 조회 파라미터 (백엔드) ===");
System.out.println("search_partObjId: [" + paramMap.get("search_partObjId") + "]");
System.out.println("search_partNo: [" + paramMap.get("search_partNo") + "]");
System.out.println("search_partName: [" + paramMap.get("search_partName") + "]");
System.out.println("orderType: [" + paramMap.get("orderType") + "]");
System.out.println("poNo: [" + paramMap.get("poNo") + "]");
System.out.println("serialNo: [" + paramMap.get("serialNo") + "]");
// 품명/품번 파라미터가 비어있으면 경고
if((paramMap.get("search_partNo") == null || paramMap.get("search_partNo").toString().isEmpty()) &&
(paramMap.get("search_partName") == null || paramMap.get("search_partName").toString().isEmpty())) {
System.out.println("⚠️ 품번/품명 파라미터가 비어있습니다!");
}
// commonService.selectListPagingNew를 사용하여 페이지네이션 HTML 생성
commonService.selectListPagingNew("salesNcollectMgmt.getSalesMgmtGridList", request, paramMap);
// 디버깅: 조회 결과 개수 출력
List<?> resultList = (List<?>) paramMap.get("RESULTLIST");
System.out.println("✅ 조회 결과 개수: " + (resultList != null ? resultList.size() : 0));
return paramMap;
}

View File

@@ -755,35 +755,39 @@
AND PAID_TYPE = #{paid_type}
</if>
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
<if test="search_partObjId != null and search_partObjId != ''">
AND EXISTS (
SELECT 1
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = T.OBJID
AND CI.STATUS = 'ACTIVE'
AND CI.PART_OBJID = #{search_partObjId}
)
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
</if>
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
</if>
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
<if test="search_partObjId != null and search_partObjId != ''">
AND EXISTS (
SELECT 1
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = T.OBJID
AND CI.STATUS = 'ACTIVE'
AND CI.PART_OBJID = #{search_partObjId}
)
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="search_poNo != null and search_poNo != ''">
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
</if>
<if test="order_start_date != null and !''.equals(order_start_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
</if>
<if test="order_end_date != null and !''.equals(order_end_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
</if>
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
</select>
<select id="contractList_bak" parameterType="map" resultType="map">
@@ -2316,6 +2320,9 @@ SELECT
<if test="supply_name != null and supply_name != ''">
AND UPPER(SUPPLY_NAME) LIKE UPPER('%${supply_name}%')
</if>
<if test="manager_name != null and manager_name != ''">
AND UPPER(MANAGER1_NAME) LIKE UPPER('%${manager_name}%')
</if>
<if test="searchStatus != null and searchStatus != ''">
AND UPPER(STATUS) LIKE UPPER('%${searchStatus}%')
</if>
@@ -4308,33 +4315,40 @@ WHERE
AND PAID_TYPE = #{paid_type}
</if>
<if test="search_partNo != null and search_partNo != ''">
AND UPPER(PART_NO) LIKE UPPER('%${search_partNo}%')
</if>
<if test="search_partName != null and search_partName != ''">
AND UPPER(PART_NAME) LIKE UPPER('%${search_partName}%')
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
</if>
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
</if>
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
<if test="search_partObjId != null and search_partObjId != ''">
AND EXISTS (
SELECT 1
FROM CONTRACT_ITEM CI
WHERE CI.CONTRACT_OBJID = T.OBJID
AND CI.STATUS = 'ACTIVE'
AND CI.PART_OBJID = #{search_partObjId}
)
</if>
<if test="search_serialNo != null and search_serialNo != ''">
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
</if>
<if test="search_poNo != null and search_poNo != ''">
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
</if>
<if test="order_start_date != null and !''.equals(order_start_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
</if>
<if test="order_end_date != null and !''.equals(order_end_date)">
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
</if>
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
</select>
<if test="due_start_date != null and !''.equals(due_start_date)">
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
</if>
<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>
ORDER BY REGDATE DESC
</select>
<!-- 영업정보 조회 (수주등록용) -->
<select id="getContractInfo" parameterType="map" resultType="map">
@@ -4487,10 +4501,20 @@ WHERE
AND OBJID = #{partObjId}
</if>
<if test="searchTerm != null and searchTerm != ''">
AND (
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
)
<choose>
<when test="searchType == 'partNo'">
AND UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
</when>
<when test="searchType == 'partName'">
AND UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
</when>
<otherwise>
AND (
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
)
</otherwise>
</choose>
</if>
ORDER BY
PART_NO

View File

@@ -863,28 +863,46 @@
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CI.PART_OBJID = T.PART_OBJID
AND CI.STATUS = 'ACTIVE') AS CUSTOMER_REQUEST,
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
T.PO_NO,
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
CASE WHEN EXISTS(
SELECT 1 FROM ATTACH_FILE_INFO
WHERE TARGET_OBJID = T.CONTRACT_OBJID
AND DOC_TYPE='ORDER_DOC'
AND UPPER(STATUS) = 'ACTIVE'
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
(SELECT CM.PO_NO FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PO_NO,
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
CASE WHEN EXISTS(
SELECT 1 FROM ATTACH_FILE_INFO
WHERE TARGET_OBJID = T.CONTRACT_OBJID
AND DOC_TYPE='ORDER_DOC'
AND UPPER(STATUS) = 'ACTIVE'
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
-- 잔량 계산: 수주수량 - 판매수량
COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0) AS REMAINING_QUANTITY,
-- 잔량원화총액 계산: (수주수량 - 판매수량) * 판매단가
(COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0)) * COALESCE(SR.sales_unit_price, 0) AS REMAINING_AMOUNT_KRW,
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
-- 출하일 (분할출하 포함): 엑셀 다운로드용
COALESCE(
(SELECT
CASE
WHEN COUNT(DISTINCT shipping_date) = 0 THEN ''
WHEN COUNT(DISTINCT shipping_date) = 1 THEN TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD')
ELSE TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD') || '외' || (COUNT(DISTINCT shipping_date) - 1)::TEXT
END
FROM shipment_log
WHERE target_objid = T.OBJID::VARCHAR
AND shipping_date IS NOT NULL
AND UPPER(COALESCE(shipping_status, '')) != 'CANCELLED'),
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '')
) AS SHIPPING_DATE_WITH_COUNT,
COALESCE(SR.shipping_method, '') AS SHIPPING_METHOD,
COALESCE(
(SELECT USER_NAME FROM USER_INFO WHERE USER_ID = SR.manager_user_id),
@@ -929,70 +947,103 @@
)
)
</if>
<if test="productNo != null and productNo != ''">
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
</if>
<if test="productName != null and productName != ''">
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
</if>
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
<if test="poNo != null and poNo != ''">
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
</if>
<if test="shippingStatus != null and shippingStatus != ''">
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
AND (
<if test="search_partNo != null and search_partNo != ''">
T.PART_NO = #{search_partNo}
</if>
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
OR
</if>
<if test="search_partName != null and search_partName != ''">
T.PART_NAME = #{search_partName}
</if>
)
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CI.PART_OBJID = T.PART_OBJID
AND CI.STATUS = 'ACTIVE'
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
</select>
<if test="poNo != null and poNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
)
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
)
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
)
</if>
<if test="shippingStatus != null and shippingStatus != ''">
AND SR.shipping_order_status = #{shippingStatus}
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
</if>
<!-- 매출마감 기간 검색 -->
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
</if>
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
</if>
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
</select>
<!-- 매출관리 그리드 목록 개수 - project_mgmt 테이블 기반 -->
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="map">
@@ -1033,67 +1084,112 @@
)
)
</if>
<if test="productNo != null and productNo != ''">
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
</if>
<if test="productName != null and productName != ''">
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
</if>
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
<if test="poNo != null and poNo != ''">
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
</if>
<if test="shippingStatus != null and shippingStatus != ''">
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
AND (
<if test="search_partNo != null and search_partNo != ''">
T.PART_NO = #{search_partNo}
</if>
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
OR
</if>
<if test="search_partName != null and search_partName != ''">
T.PART_NAME = #{search_partName}
</if>
)
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
<if test="serialNo != null and serialNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_ITEM CI
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
AND CI.PART_OBJID = T.PART_OBJID
AND CI.STATUS = 'ACTIVE'
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
AND UPPER(CIS.STATUS) = 'ACTIVE'
)
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
<if test="orderStatus != null and orderStatus != ''">
AND T.CONTRACT_RESULT = #{orderStatus}
</if>
<if test="poNo != null and poNo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
)
</if>
<if test="requestDateFrom != null and requestDateFrom != ''">
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
</if>
<if test="requestDateTo != null and requestDateTo != ''">
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
</if>
<if test="orderDateFrom != null and orderDateFrom != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
)
</if>
<if test="orderDateTo != null and orderDateTo != ''">
AND EXISTS (
SELECT 1 FROM CONTRACT_MGMT CM
WHERE CM.OBJID = T.CONTRACT_OBJID
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
)
</if>
<if test="shippingStatus != null and shippingStatus != ''">
AND EXISTS (
SELECT 1 FROM sales_registration SR
WHERE T.PROJECT_NO = SR.project_no
AND SR.shipping_order_status = #{shippingStatus}
)
</if>
<if test="shippingDateFrom != null and shippingDateFrom != ''">
AND EXISTS (
SELECT 1 FROM sales_registration SR
WHERE T.PROJECT_NO = SR.project_no
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
)
</if>
<if test="shippingDateTo != null and shippingDateTo != ''">
AND EXISTS (
SELECT 1 FROM sales_registration SR
WHERE T.PROJECT_NO = SR.project_no
AND SR.shipping_date IS NOT NULL
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
)
</if>
<if test="shippingMethod != null and shippingMethod != ''">
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
</if>
<if test="manager != null and manager != ''">
AND T.PM_USER_ID = #{manager}
</if>
<if test="incoterms != null and incoterms != ''">
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
</if>
<if test="salesStatus != null and salesStatus != ''">
<choose>
<when test="salesStatus == 'NOT_CLOSED'">
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
</when>
<otherwise>
AND T.SALES_STATUS = #{salesStatus}
</otherwise>
</choose>
</if>
<!-- 매출마감 기간 검색 -->
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
</if>
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
AND T.SALES_DEADLINE_DATE IS NOT NULL
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
</if>
</select>
<!-- 매출관리 합계 조회 (Total 공급가액, 부가세, 총액) -->