diff --git a/src/com/pms/mapper/approval.xml b/src/com/pms/mapper/approval.xml index b1d5838..4ce7e81 100644 --- a/src/com/pms/mapper/approval.xml +++ b/src/com/pms/mapper/approval.xml @@ -717,6 +717,7 @@ ET.NOTE3, ET.NOTE4, ET.NOTE_REMARKS, + ET.NOTES_CONTENT, ET.VALIDITY_PERIOD, TO_CHAR(ET.REGDATE, 'YYYY-MM-DD') AS REGDATE, CM.CONTRACT_NO, diff --git a/src/com/pms/service/ApprovalService.java b/src/com/pms/service/ApprovalService.java index 9ced724..8999540 100644 --- a/src/com/pms/service/ApprovalService.java +++ b/src/com/pms/service/ApprovalService.java @@ -2146,6 +2146,7 @@ public class ApprovalService { * 견적서 데이터를 HTML 파일로 구성 (결재 첨부파일용) */ private String buildEstimateFormFileHtml(Map estimateInfo, List itemList){ + String templateType = CommonUtils.checkNull(estimateInfo.get("TEMPLATE_TYPE")); String estimateNo = CommonUtils.checkNull(estimateInfo.get("ESTIMATE_NO")); String contractNo = CommonUtils.checkNull(estimateInfo.get("CONTRACT_NO")); String customerName = CommonUtils.checkNull(estimateInfo.get("CUSTOMER_NAME")); @@ -2160,51 +2161,53 @@ public class ApprovalService { String modelName = CommonUtils.checkNull(estimateInfo.get("MODEL_NAME")); String validityPeriod = CommonUtils.checkNull(estimateInfo.get("VALIDITY_PERIOD")); String noteRemarks = CommonUtils.checkNull(estimateInfo.get("NOTE_REMARKS")); + String note1 = CommonUtils.checkNull(estimateInfo.get("NOTE1")); + String note2 = CommonUtils.checkNull(estimateInfo.get("NOTE2")); + String note3 = CommonUtils.checkNull(estimateInfo.get("NOTE3")); + String note4 = CommonUtils.checkNull(estimateInfo.get("NOTE4")); + String notesContent = CommonUtils.checkNull(estimateInfo.get("NOTES_CONTENT")); + String managerName = CommonUtils.checkNull(estimateInfo.get("MANAGER_NAME")); + String managerContact = CommonUtils.checkNull(estimateInfo.get("MANAGER_CONTACT")); StringBuilder html = new StringBuilder(); html.append(""); - html.append("견적서 - " + estimateNo + ""); + html.append("견적서 - ").append(estimateNo).append(""); html.append(""); html.append("
견 적 서
"); - // 기본 정보 테이블 html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); if(!currencyName.isEmpty()){ - html.append(""); - html.append(""); + html.append(""); + html.append(""); } html.append(""); - - if(!validityPeriod.isEmpty()){ - html.append(""); - } html.append("
견적번호" + estimateNo + "영업번호" + contractNo + "
고객사" + customerName + "작성일" + regdate + "
수신" + recipient + "담당자" + contactPerson + "
작성자" + writerName + "모델명" + modelName + "
견적번호").append(estimateNo).append("영업번호").append(contractNo).append("
고객사").append(customerName).append("작성일").append(regdate).append("
수신").append(recipient).append("담당자").append(contactPerson).append("
작성자").append(writerName).append("모델명").append(modelName).append("
통화" + currencyName + "환율" + exchangeRate + "
통화").append(currencyName).append("환율").append(exchangeRate).append("
합계금액"); if(!totalAmountKrw.isEmpty() && !"0".equals(totalAmountKrw)){ - html.append(totalAmountKrw + " (KRW)"); - if(!totalAmount.isEmpty()) html.append(" / " + totalAmount + " (" + currencyName + ")"); + html.append(totalAmountKrw).append(" (KRW)"); + if(!totalAmount.isEmpty()) html.append(" / ").append(totalAmount).append(" (").append(currencyName).append(")"); } else { html.append(totalAmount); } html.append("
유효기간" + validityPeriod + "
"); - // 품목 리스트 if(itemList != null && !itemList.isEmpty()){ html.append(""); html.append(""); @@ -2215,22 +2218,44 @@ public class ApprovalService { for(Map item : itemList){ item = CommonUtils.toUpperCaseMapKey(item); html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); html.append(""); } html.append("
" + no++ + "" + CommonUtils.checkNull(item.get("DESCRIPTION")) + "" + CommonUtils.checkNull(item.get("SPECIFICATION")) + "" + CommonUtils.checkNull(item.get("QUANTITY")) + "" + CommonUtils.checkNull(item.get("UNIT")) + "" + CommonUtils.checkNull(item.get("UNIT_PRICE")) + "" + CommonUtils.checkNull(item.get("AMOUNT")) + "" + CommonUtils.checkNull(item.get("REMARK")) + "").append(no++).append("").append(CommonUtils.checkNull(item.get("DESCRIPTION"))).append("").append(CommonUtils.checkNull(item.get("SPECIFICATION"))).append("").append(CommonUtils.checkNull(item.get("QUANTITY"))).append("").append(CommonUtils.checkNull(item.get("UNIT"))).append("").append(CommonUtils.checkNull(item.get("UNIT_PRICE"))).append("").append(CommonUtils.checkNull(item.get("AMOUNT"))).append("").append(CommonUtils.checkNull(item.get("REMARK"))).append("
"); } - // 비고 if(!noteRemarks.isEmpty()){ - html.append("
비고:
" + noteRemarks.replace("\n", "
") + "
"); + html.append("
<비고>
").append(noteRemarks.replace("\n", "
")).append("
"); + } + + if("2".equals(templateType)){ + if(!notesContent.isEmpty()){ + html.append("
").append(notesContent).append("
"); + } + } else { + boolean hasNotes = !note1.isEmpty() || !note2.isEmpty() || !note3.isEmpty() || !note4.isEmpty(); + if(hasNotes){ + html.append("
<참조사항>
"); + if(!note1.isEmpty()) html.append(note1).append("
"); + if(!note2.isEmpty()) html.append(note2).append("
"); + if(!note3.isEmpty()) html.append(note3).append("
"); + if(!note4.isEmpty()) html.append(note4); + html.append("
"); + } + } + + if(!managerName.isEmpty() || !managerContact.isEmpty()){ + html.append("
"); + if(!managerName.isEmpty()) html.append("담당자 : ").append(managerName); + if(!managerContact.isEmpty()) html.append("
연락처 : ").append(managerContact); + html.append("
"); } html.append(""); @@ -2243,6 +2268,7 @@ public class ApprovalService { private String buildEstimateContentsHtml(Map estimateInfo, List itemList){ StringBuilder html = new StringBuilder(); + String templateType = CommonUtils.checkNull(estimateInfo.get("TEMPLATE_TYPE")); String estimateNo = CommonUtils.checkNull(estimateInfo.get("ESTIMATE_NO")); String contractNo = CommonUtils.checkNull(estimateInfo.get("CONTRACT_NO")); String customerName = CommonUtils.checkNull(estimateInfo.get("CUSTOMER_NAME")); @@ -2257,87 +2283,128 @@ public class ApprovalService { String modelName = CommonUtils.checkNull(estimateInfo.get("MODEL_NAME")); String validityPeriod = CommonUtils.checkNull(estimateInfo.get("VALIDITY_PERIOD")); String noteRemarks = CommonUtils.checkNull(estimateInfo.get("NOTE_REMARKS")); + String note1 = CommonUtils.checkNull(estimateInfo.get("NOTE1")); + String note2 = CommonUtils.checkNull(estimateInfo.get("NOTE2")); + String note3 = CommonUtils.checkNull(estimateInfo.get("NOTE3")); + String note4 = CommonUtils.checkNull(estimateInfo.get("NOTE4")); + String notesContent = CommonUtils.checkNull(estimateInfo.get("NOTES_CONTENT")); + String managerName = CommonUtils.checkNull(estimateInfo.get("MANAGER_NAME")); + String managerContact = CommonUtils.checkNull(estimateInfo.get("MANAGER_CONTACT")); - html.append("
"); + String TD_HEADER = "style='border:1px solid #333;background-color:#D9E2F3;font-weight:bold;font-size:9pt;padding:4px 8px;'"; + String TD_VALUE = "style='border:1px solid #333;font-size:9pt;padding:4px 8px;'"; + String TH_ITEM = "style='border:1px solid #333;background-color:#4472C4;color:#fff;text-align:center;font-size:9pt;padding:4px;'"; + String TD_ITEM = "style='border:1px solid #333;font-size:9pt;padding:4px;'"; + + html.append("
"); html.append("

견 적 서

"); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + // 기본 정보 테이블 + html.append("
견적번호" + estimateNo + "영업번호" + contractNo + "
"); + html.append(""); + html.append(""); + html.append(""); + html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); if(!currencyName.isEmpty()){ - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); } - html.append(""); - html.append(""); + html.append(""); - - if(!validityPeriod.isEmpty()){ - html.append(""); - html.append(""); - } html.append("
견적번호").append(escapeHtml(estimateNo)).append("영업번호").append(escapeHtml(contractNo)).append("
고객사" + customerName + "작성일" + regdate + "
고객사").append(escapeHtml(customerName)).append("작성일").append(escapeHtml(regdate)).append("
수신" + recipient + "담당자" + contactPerson + "
수신").append(escapeHtml(recipient)).append("담당자").append(escapeHtml(contactPerson)).append("
작성자" + writerName + "모델명" + modelName + "
작성자").append(escapeHtml(writerName)).append("모델명").append(escapeHtml(modelName)).append("
통화" + currencyName + "환율" + exchangeRate + "
통화").append(escapeHtml(currencyName)).append("환율").append(escapeHtml(exchangeRate)).append("
합계금액"); + html.append("
합계금액"); if(!totalAmountKrw.isEmpty() && !"0".equals(totalAmountKrw)){ - html.append(totalAmountKrw + " (KRW)"); - if(!totalAmount.isEmpty()) html.append(" / " + totalAmount + " (" + currencyName + ")"); + html.append(escapeHtml(totalAmountKrw)).append(" (KRW)"); + if(!totalAmount.isEmpty()) html.append(" / ").append(escapeHtml(totalAmount)).append(" (").append(escapeHtml(currencyName)).append(")"); } else { - html.append(totalAmount); + html.append(escapeHtml(totalAmount)); } html.append("
유효기간" + validityPeriod + "
"); // 품목 리스트 if(itemList != null && !itemList.isEmpty()){ - html.append(""); + html.append("
"); html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); html.append(""); int no = 1; for(Map item : itemList){ item = CommonUtils.toUpperCaseMapKey(item); html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); - html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); + html.append(""); html.append(""); } html.append("
No품명규격수량단위단가금액비고No품명규격수량단위단가금액비고
" + no++ + "" + CommonUtils.checkNull(item.get("DESCRIPTION")) + "" + CommonUtils.checkNull(item.get("SPECIFICATION")) + "" + CommonUtils.checkNull(item.get("QUANTITY")) + "" + CommonUtils.checkNull(item.get("UNIT")) + "" + CommonUtils.checkNull(item.get("UNIT_PRICE")) + "" + CommonUtils.checkNull(item.get("AMOUNT")) + "" + CommonUtils.checkNull(item.get("REMARK")) + "").append(no++).append("").append(escapeHtml(CommonUtils.checkNull(item.get("DESCRIPTION")))).append("").append(escapeHtml(CommonUtils.checkNull(item.get("SPECIFICATION")))).append("").append(escapeHtml(CommonUtils.checkNull(item.get("QUANTITY")))).append("").append(escapeHtml(CommonUtils.checkNull(item.get("UNIT")))).append("").append(escapeHtml(CommonUtils.checkNull(item.get("UNIT_PRICE")))).append("").append(escapeHtml(CommonUtils.checkNull(item.get("AMOUNT")))).append("").append(escapeHtml(CommonUtils.checkNull(item.get("REMARK")))).append("
"); } + // 비고 (테이블 내 비고) if(!noteRemarks.isEmpty()){ - html.append("
비고:
" + noteRemarks.replace("\n", "
") + "
"); + html.append("
"); + html.append("<비고>
").append(noteRemarks.replace("\n", "
")); + html.append("
"); + } + + // 양식별 하단 섹션 + if("2".equals(templateType)){ + // 장비견적서: NOTES_CONTENT (HTML 형식) + if(!notesContent.isEmpty()){ + html.append("
"); + html.append(notesContent); + html.append("
"); + } + } else { + // 일반견적서: NOTE1~NOTE4 (참조사항) + boolean hasNotes = !note1.isEmpty() || !note2.isEmpty() || !note3.isEmpty() || !note4.isEmpty(); + if(hasNotes){ + html.append("
"); + html.append("<참조사항>
"); + if(!note1.isEmpty()) html.append(escapeHtml(note1)).append("
"); + if(!note2.isEmpty()) html.append(escapeHtml(note2)).append("
"); + if(!note3.isEmpty()) html.append(escapeHtml(note3)).append("
"); + if(!note4.isEmpty()) html.append(escapeHtml(note4)); + html.append("
"); + } + } + + // 담당자 정보 + if(!managerName.isEmpty() || !managerContact.isEmpty()){ + html.append("
"); + if(!managerName.isEmpty()) html.append("담당자 : ").append(escapeHtml(managerName)); + if(!managerContact.isEmpty()) html.append("
연락처 : ").append(escapeHtml(managerContact)); + html.append("
"); } html.append("
");