123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <%--
- - FileName : PurExcutionList.jsp
- - Author : gyeongmo an
- - Date : 2014.07.25
- - Copyright : Copyright (c) 2014 www.udapsoft.co.kr, Inc.
- - All rights reserved.
- - Description: 구매실적 조회
- --%>
- <%@ page contentType="text/html; charset=utf-8" %>
- <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
- <%@ page import="com.udapsoft.waf.common.ui.*" %>
- <%@ page import="kr.co.udapsoft.common.code.*" %>
- <%@ page import="kr.co.hsnc.common.util.*"%>
- <%@ page import="kr.co.hsnc.common.sql.*" %>
- <%@ page import="kr.co.udapsoft.common.code.CommCodeManager" %>
- <%@ include file="/jsp/work/taglib.jsp" %>
- <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
- <%
- ctx.init(request, response);
- HandlerStorage storage = ctx.getHandlerStorage();
- ValueObject params = storage.getParams();
- ValueObject user = storage.getUser();
- String fevent = storage.getEvent();
- %>
- <SCRIPT language="JavaScript">
- /*예약함수*/
- var sheet1;
- var sheet1Row;
- var sheet1PageNo = 1;
- var pageLastRowIndex = 1;
- var validationResult = false;
- var filterShow = false;
- function _onReady(){
- gridInit(sheet1);
-
- jQuery("#btnSearch").click(function() {
- jQuery("#fevent").val("GET_DATA_LIST");
- var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/PurExcutionList_sheet.screen";
- Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
- });
-
- jQuery("#btnExcel").click(function() {
- if(sheet1.RowCount() == 0) {
- alert("내역이 없습니다.");
- return;
- }
- var params = { FileName : "PurExcutionList.xls", SheetName : "구매실적조회", SheetDesign:0, Merge:1, DownCols:"ac_unit_nm|dept_nm|material_cd|material_name|material_spec|unit|stock_qty|"+
- "stock_amt|total_contract_amt|total_budget_amt|contrast_contract|contrast_budget", TitleText:"구매실적조회", UserMerge:"0,0,1,12", AutoSizeColumn:1 } ;
- sheet1.Down2Excel(params);
- });
-
- $("#dataClear2").click(function(){$("#sYmdSt").val("");$("#sYmdEd").val("");});
-
- sheet1.SetActionMenu("ExcelDown");
-
- jQuery("#btnSearch").click();
-
- autoResize();
- }
- function gridInit(sheetName){
- var init_sheet = {};
- init_sheet.Cfg = {SearchMode:2, Page:10, PrevColumnMergeMode:0};
- init_sheet.Cols = [
- {Header:'본부', Type:"Text", SaveName:"ac_unit_nm", Width:70, Align:"Left"},
- {Header:'현장', Type:"Text", SaveName:"dept_nm", Width:140, Align:"Left"},
- {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:50, Align:"Center"},
- {Header:'자재명', Type:"Text", SaveName:"material_name", Width:150, Align:"Left"},
- {Header:'규격', Type:"Text", SaveName:"material_spec", Width:110, Align:"Left"},
- {Header:'단위', Type:"Text", SaveName:"unit", Width:30, Align:"Center"},
- {Header:'입고수량', Type:"AutoSum", SaveName:"stock_qty", Width:50, Align:"Right", PointCount:2},
- {Header:'입고금액', Type:"AutoSum", SaveName:"stock_amt", Width:50, Align:"Right"},
- {Header:'도급금액', Type:"AutoSum", SaveName:"total_contract_amt", Width:50, Align:"Right"},
- {Header:'실행금액', Type:"AutoSum", SaveName:"total_budget_amt", Width:50, Align:"Right"},
- {Header:'도급대비(%)', Type:"Float", SaveName:"contrast_contract", Width:50, Align:"Right", PointCount:2},
- {Header:'실행대비(%)', Type:"Float", SaveName:"contrast_budget", Width:50, Align:"Right", PointCount:2},
- //{Header:'도급대비(%)', Type:"AutoAvg", SaveName:"contrast_contract", Width:50, Align:"Right"},
- //{Header:'실행대비(%)', Type:"AutoAvg", SaveName:"contrast_budget", Width:50, Align:"Right"},
- {Header:'H_본부코드', Type:"Text", SaveName:"ac_unit_cd", Width:0, Align:"Left", Hidden:"True"},
- {Header:'H_현장코드', Type:"Text", SaveName:"dept_cd", Width:0, Align:"Center", Hidden:"True"}
- ];
-
- init_sheet.HeaderMode = {Sort:1};
- IBS_InitSheet(sheetName, init_sheet);
- sheetName.SetDataAutoTrim(0);
- sheetName.SetEditable(false);
-
- //var info = [{StdCol:"dept_nm", SumCols:"stock_qty|stock_amt|total_contract_amt|total_budget_amt", CaptionText:"소 계"}];
- var info = [{StdCol:"dept_nm", SumCols:"stock_qty|stock_amt|total_contract_amt|total_budget_amt", CaptionCol:"ac_unit_nm"}];
- sheet1.ShowSubSum(info);
- sheetName.SetMergeSheet(msPrevColumnMerge);
- setGridSize();
- }
- function sheet1_OnSearchEnd(code, message) {
- if(code == 0) {
-
- //소계 머지
- var str = "";
- for(var i=1; i<sheet1.LastRow(); i++) {
- str = sheet1.GetCellText(i, "ac_unit_nm");
- if(str.indexOf("소계:") > -1) {
- sheet1.SetCellAlign(i,0,"Center");
- sheet1.SetCellText(i, "ac_unit_nm", "소 계 : ");
- sheet1.SetMergeCell(i,0,1,6);
- }
- }
-
- var sRow = sheet1.FindSubSumRow();
- var arrRow = sRow.split("|");
-
- var info2 = [{Type:"AutoAvg", PointCount:2}];
-
- for (idx=0; idx<arrRow.length; idx++){
- if( sheet1.GetCellValue(arrRow[idx] , "stock_amt") != "0" && sheet1.GetCellValue(arrRow[idx] , "total_contract_amt") != "0" ) {
- sheet1.SetCellValue(arrRow[idx] , "contrast_contract", Math.floor(sheet1.GetCellValue(arrRow[idx] , "stock_amt") / sheet1.GetCellValue(arrRow[idx] , "total_contract_amt") * 100 * 100) / 100); // 입고금액 / 도급금액
- } else {
- sheet1.SetCellValue(arrRow[idx] , "contrast_contract", "0"); // 입고금액 / 도급금액
- }
- if( sheet1.GetCellValue(arrRow[idx] , "stock_amt") != "0" && sheet1.GetCellValue(arrRow[idx] , "total_budget_amt") != "0" ) {
- sheet1.SetCellValue(arrRow[idx] , "contrast_budget", Math.floor(sheet1.GetCellValue(arrRow[idx] , "stock_amt") / sheet1.GetCellValue(arrRow[idx] , "total_budget_amt") * 100 * 100) / 100); //입고금액 / 실행금액
- }else {
- sheet1.SetCellValue(arrRow[idx] , "contrast_budget", "0"); //입고금액 / 실행금액
- }
- }
-
- //합계 머지
- sheet1.SetCellText(sheet1.LastRow(), "ac_unit_nm", "합 계");
- sheet1.SetMergeCell(sheet1.LastRow(), 0, 1, 5);
- sheet1.SetCellAlign(sheet1.LastRow(), 0, "Center");
-
- if( sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") != "0" && sheet1.GetCellValue(sheet1.LastRow() , "total_contract_amt") != "0" ) {
- sheet1.SetCellValue(sheet1.LastRow(), "contrast_contract", Math.floor(sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") / sheet1.GetCellValue(sheet1.LastRow() , "total_contract_amt") * 100 * 100) / 100); // 입고금액 / 도급금액
- } else {
- sheet1.SetCellValue(sheet1.LastRow(), "contrast_contract", "0"); // 입고금액 / 도급금액
- }
-
- if( sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") != "0" && sheet1.GetCellValue(sheet1.LastRow() , "total_budget_amt") != "0" ) {
- sheet1.SetCellValue(sheet1.LastRow(), "contrast_budget", Math.floor(sheet1.GetCellValue(sheet1.LastRow() , "stock_amt") / sheet1.GetCellValue(sheet1.LastRow() , "total_budget_amt") * 100 * 100) / 100); //입고금액 / 실행금액
- } else {
- sheet1.SetCellValue(sheet1.LastRow(), "contrast_budget", "0"); //입고금액 / 실행금액
- }
-
- setGridSize();
-
- } else {
- alert(message);
- }
- }
- function setGridSize() {
- sheet1.FitColWidth();
- }
- function doResult(resultObj) {
- document.form1.isSubmit = false;
- try {
- if ( resultObj.getRequestEvent() == "GET_DATA_LIST" ) {
- if ( resultObj.getSuccess() == true ) {
- } else {
- dlgErrorMsg(resultObj);
- }
- document.form1.isSubmit = false;
- }
- } catch (errorObject) {
- dlgErrorDetailAlert("doResult()", errorObject);
- }
- }
-
- function doSearchMaterialCode() {
- var win_id = "_search_material_cd";
- var link = "/lib/dlgSearchMaterialCd.screen";
- link += "?pop_win_id="+win_id;
- fLayerPop(win_id, link, 800,400, '', '', 'NO');
- }
-
- function doSearchMaterialCodeClose(resultValue) {
- var f=document.form1;
- if(resultValue == null) {
- f.material_cd.value = "";
- f.material_nm.value = "";
- } else {
- f.material_cd.value = resultValue[0];
- f.material_nm.value = resultValue[1];
- }
-
- fLayerPopClose('_search_material_cd');
- }
-
- function doKeyPress() {
-
- if( event.keyCode == 13 ) {
- jQuery("#btnSearch").click();
- }
- }
-
- function sheet1_OnSmartResize(Width, Height) {
- sheet1.FitColWidth();
- autoResize();
- }
- function autoResize(){
- var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
- var iframeHeight= document.body.scrollHeight - t1_height;
- var iframeWidth= document.body.scrollWidth;
-
- sheet1.SetSheetHeight(iframeHeight);
- }
-
- function sheet1_OnSelectMenu(Text, Code) {
- switch(Text) {
- case "ExcelDown":
- jQuery("#btnExcel").click();
- break;
- }
- }
-
- document.body.onresize = addEvent( document.body.onresize, "autoResize()");
- </SCRIPT>
- <modular:search id="form1">
- <modular:key id="fevent" />
- </modular:search>
- <form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
- <INPUT type="hidden" name="fevent">
- <div align="left" id="title">
- <ul>
- <li>구매실적조회</li>
- </ul>
- </div>
- <!-- 검색조건 시작 -->
- <table id="search-table" class="search-form-table">
- <colgroup>
- <col width="100" />
- <col width="400" />
- <col width="100" />
- <col width="*" />
- <col width="200" />
- </colgroup>
- <tr>
- <th>본부</th>
- <td>
- <%= CommCodeManager.getSelectCodeList("101", "ac_unit_cd", "width:79%;height=18;", "<OPTION value=''>-- 전체 --</OPTION>", params.get("ac_unit_cd"), "") %>
- </td>
- <th>입고일자</th>
- <td>
- <%= InputText.get("sYmdSt", params.get("sYmdSt"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
- <IMG name="sYmdSt_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdSt');">
- ~
- <%= InputText.get("sYmdEd", params.get("sYmdEd"), 10, 50, "hangule,center, desc=기간,ReadOnly") %>
- <IMG name="sYmdEd_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgCalendar('sYmdEd');">
- <IMG name="dataClear2" id="dataClear2" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
- </td>
- <td class="button" rowspan="2">
- <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
- <span class="btnSearch center"><a href="javascript:void(0);" id="btnExcel">엑셀</a></span>
- </td>
- </tr>
- <tr>
- <th>현장</th>
- <td>
- <%=InputText.getSiteCodeNew("dept_cd", "dept_name", "", user, params.get("dept_cd"), params.get("dept_name"))%>
- </td>
- <th>자재명</th>
- <td>
- <%= InputText.get("material_cd", "","", 15, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
- <%= InputText.get("material_nm", "","", 45, 255, "class=input byteChk, perSize", "onkeypress=\"doKeyPress();\" onClick=\"\"") %>
- <IMG id='search_spot_button' onClick="doSearchMaterialCode();" src='/img/buyer/button/bt_search_right.gif' border='0' align='absmiddle' alt='[자재코드]' style='cursor:pointer;'>
- </td>
- </tr>
- </table>
- <!-- 검색조건 종료 -->
- <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 400px; overflow: auto;">
- <script>createIBSheet('sheet1','100%', '400px');</script>
- </div>
- </FORM>
|