Index: arms/js/analysisCost.js =================================================================== diff -u -r173bbdc612c43ba745525ce79cca3419bfde48a7 -r440e848bf5c4d02debbf33910ea7775bb3efeec5 --- arms/js/analysisCost.js (.../analysisCost.js) (revision 173bbdc612c43ba745525ce79cca3419bfde48a7) +++ arms/js/analysisCost.js (.../analysisCost.js) (revision 440e848bf5c4d02debbf33910ea7775bb3efeec5) @@ -96,7 +96,7 @@ //버전 멀티 셀렉트 박스 이니시에이터 makeVersionMultiSelectBox(); - 비용분석계산(); + 비용분석계산버튼(); dashboardColor = dashboardPalette.dashboardPalette01; @@ -551,31 +551,35 @@ let fileName = "인력별_연봉정보_템플릿.xlsx"; $("#excel-annual-income-template-download").click(function () { - $.ajax({ - url: "/auth-user/api/arms/analysis/cost/excel-download.do?excelFileName=" + fileName, - type: "POST", - data: JSON.stringify(인력별_연봉정보), - contentType: "application/json", - xhrFields: { - responseType: 'blob' // 응답 데이터 타입을 blob으로 설정 - }, - statusCode: { - 200: function (data) { - var url = window.URL.createObjectURL(data); // blob 데이터로 URL 생성 - var a = document.createElement('a'); // 다운로드 링크를 위한 태그 생성 - a.href = url; // url 설정 - a.download = fileName; // 파일명 설정 - a.style.display = 'none'; // 태그를 브라우저에 보이지 않게 설정 - document.body.appendChild(a); // 태그를 body에 추가 - a.click(); // 다운로드 링크 클릭 - document.body.removeChild(a); // 태그 제거 + if (Object.keys(인력별_연봉정보).length === 0) { + alert("다운로드할 인력 정보가 없습니다."); + } else { + $.ajax({ + url: "/auth-user/api/arms/analysis/cost/excel-download.do?excelFileName=" + fileName, + type: "POST", + data: JSON.stringify(인력별_연봉정보), + contentType: "application/json", + xhrFields: { + responseType: 'blob' // 응답 데이터 타입을 blob으로 설정 + }, + statusCode: { + 200: function (data) { + var url = window.URL.createObjectURL(data); // blob 데이터로 URL 생성 + var a = document.createElement('a'); // 다운로드 링크를 위한 태그 생성 + a.href = url; // url 설정 + a.download = fileName; // 파일명 설정 + a.style.display = 'none'; // 태그를 브라우저에 보이지 않게 설정 + document.body.appendChild(a); // 태그를 body에 추가 + a.click(); // 다운로드 링크 클릭 + document.body.removeChild(a); // 태그 제거 + } } - } - }) + }) + } }); } -function 비용분석계산() { +function 비용분석계산버튼() { $("#cost-analysis-calculation").click(function() { if(!selectedPdServiceId || !selectedVersionId) { @@ -784,50 +788,44 @@ const 완료_요구사항_키워드SET = new Set(완료_요구사항_키워드); - let startDate, endDate; + let startDate = 요구사항.c_req_start_date + ? new Date(formatDate(요구사항.c_req_start_date)) + : null; + let endDate = 요구사항.c_req_end_date + ? new Date(formatDate(요구사항.c_req_end_date)) + : new Date(formatDate(new Date())); + if (요구사항.reqStateEntity != null) { if (완료_요구사항_키워드SET.has(요구사항.reqStateEntity.c_title)) { - startDate = new Date(formatDate(요구사항.c_req_start_date)); - endDate = new Date(formatDate(요구사항.c_req_end_date)); - // 완료된 요구사항만 계산하여 완료성과 측정 if (startDate && endDate && (startDate <= endDate)) { let cost = 담당자별_비용계산(startDate, endDate, 전체담당자목록[key].연봉); 전체담당자목록[key].완료성과 += cost; } - } else { - if (요구사항.c_req_start_date && 요구사항.c_req_end_date) { - startDate = new Date(formatDate(요구사항.c_req_start_date)); - endDate = new Date(formatDate(요구사항.c_req_end_date)); - } - else { - startDate = new Date(formatDate(요구사항.c_req_start_date)); - endDate = new Date(formatDate(new Date())); - } } + } - if (startDate && endDate && (startDate <= endDate)) { - let cost = 담당자별_비용계산(startDate, endDate, 전체담당자목록[key].연봉); + if (startDate && endDate && (startDate <= endDate)) { + let cost = 담당자별_비용계산(startDate, endDate, 전체담당자목록[key].연봉); - // 요구사항별 금액 측정 차트 데이터 - 요구사항.요구사항금액 += cost; + // 요구사항별 금액 측정 차트 데이터 + 요구사항.요구사항금액 += cost; - // 인력별 성과 차트 데이터 - 전체담당자목록[key].인력별소모비용 += cost; + // 인력별 성과 차트 데이터 + 전체담당자목록[key].인력별소모비용 += cost; - // 버전별 소모비용 차트 데이터 - versionListData[버전].버전비용 += cost; + // 버전별 소모비용 차트 데이터 + versionListData[버전].버전비용 += cost; - // 요구사항 금액별 버블 차트 데이터 - 요구사항키.cost += cost; + // 요구사항 금액별 버블 차트 데이터 + 요구사항키.cost += cost; - // 버전별 소모비용 -> 버전별 인력비용 스택차트로 변경 데이터 - if (버전_요구사항_담당자[버전][요구사항키.c_issue_key][key].버전별담당자소모비용 == null) { - 버전_요구사항_담당자[버전][요구사항키.c_issue_key][key].버전별담당자소모비용 = cost; - } else { - 버전_요구사항_담당자[버전][요구사항키.c_issue_key][key].버전별담당자소모비용 += cost; - } + // 버전별 소모비용 -> 버전별 인력비용 스택차트로 변경 데이터 + if (버전_요구사항_담당자[버전][요구사항키.c_issue_key][key].버전별담당자소모비용 == null) { + 버전_요구사항_담당자[버전][요구사항키.c_issue_key][key].버전별담당자소모비용 = cost; + } else { + 버전_요구사항_담당자[버전][요구사항키.c_issue_key][key].버전별담당자소모비용 += cost; } } }