123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <%--
- - FileName : StockDeliveryWillPrice.jsp
- - Author : gyeongmo an
- - Date : 2014.07.15
- - 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="com.udapsoft.waf.common.util.*" %>
- <%@ page import="kr.co.hsnc.common.util.*"%>
- <%@ page import="kr.co.hsnc.common.sql.*" %>
- <%@ page import="com.udapsoft.waf.common.util.DateUtil" %>
- <%@ 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();
-
- if( params.get("dateFrom").equals("") ) {
- params.set("dateFrom", DateUtil.formatDateTime(DateUtil.getToday(), "yyyyMMdd", "yyyyMM"));
- }else {
- params.set("dateFrom", StringUtil.replace(DateUtil.formatDateTime(params.get("dateFrom"), "yyyyMMdd", "yyyyMM"), "-", ""));
- }
- %>
- <SCRIPT language="JavaScript">
- /*예약함수*/
- var sheet1;
- var sheet1Row;
- var sheet1PageNo = 1;
- var pageLastRowIndex = 1;
- var validationResult = false;
- var filterShow = false;
- var clickRow;
- function _onReady(){
- gridInit(sheet1);
- var f = document.form1;
-
- jQuery("#btnSearch").click(function() {
- /*
- if(f.dept_cd.value == null || f.dept_cd.value == ""){
- alert('현장을 선택해 주세요.');
- return;
- }else{
- */
- jQuery("#fevent").val("GET_STOCKDELIVERYWILLPRICE");
- var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/StockDeliveryWillPrice_sheet.screen";
- Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
- //}
- });
-
- jQuery("#btnSave").click(function() {
- getPmmWarehouseClose();
- });
-
- jQuery("#btnExcel").click(function() {
-
- if(sheet1.RowCount() == 0) {
- alert("내역이 없습니다.");
- return;
- }
-
- var params = { FileName : "StockDeliveryWillPrice.xls", SheetName : "StockDeliveryWillPrice", SheetDesign:0, Merge:1, DownCols:"dept_cd|dept_nm|vendor_nm|cst_doc_name|material_cd"+
- "|material_name|material_spec|unit_kind_name|stock_qty|stock_pri|stock_amt", TitleText:"가입고 단가 등록", UserMerge:"0,0,1,11", AutoSizeColumn:1 } ;
- sheet1.Down2Excel(params);
- });
-
-
- $("#dataClear2").click(function(){$("#dateFrom").val("");});
-
- sheet1.SetActionMenu("ExcelDown");
-
- autoResize();
-
- jQuery("#btnSearch").click();
-
- }
-
- function gridInit(sheetName){
- var init_sheet = {};
- init_sheet.Cfg = {SearchMode:2, Page:10};
- init_sheet.Cols = [
- {Header:'상태', Type:"Status", SaveName:"status", Width:0, Align:"Center", Hidden:"True"},
- {Header:'현장코드', Type:"Text", SaveName:"dept_cd", Width:50, Align:"Center", Edit:"false"},
- {Header:'현장명', Type:"Text", SaveName:"dept_nm", Width:150, Align:"Left", Edit:"false"},
- {Header:'거래처코드', Type:"Text", SaveName:"vendor_cd", Width:0, Align:"Left", Hidden:"True"},
- {Header:'거래처', Type:"Text", SaveName:"vendor_nm", Width:150, Align:"Left", Edit:"false"},
- {Header:'계약번호', Type:"Text", SaveName:"pur_cont_id", Width:0, Align:"Left", Hidden:"True"},
- {Header:'계약명', Type:"Text", SaveName:"cst_doc_name", Width:150, Align:"Left", Edit:"false"},
- {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:70, Align:"Center", Edit:"false"},
- {Header:'자재명', Type:"Text", SaveName:"material_name", Width:150, Align:"Left", Edit:"false"},
- {Header:'규격', Type:"Text", SaveName:"material_spec", Width:150, Align:"Left", Edit:"false"},
- {Header:'단위', Type:"Text", SaveName:"unit_kind_name", Width:50, Align:"Center", Edit:"false"},
- {Header:'입고수량', Type:"Float", SaveName:"stock_qty", Width:80, Align:"Right", Edit:"false", EditLen:14, PointCount:2},
- {Header:'단가', Type:"Int", SaveName:"stock_pri", Width:80, Align:"Right", EditLen:14},
- {Header:'금액', Type:"Int", SaveName:"stock_amt", Width:80, Align:"Right", EditLen:14}
- ];
-
- init_sheet.HeaderMode = {Sort:1};
- IBS_InitSheet(sheetName, init_sheet);
- sheetName.SetDataAutoTrim(0);
- sheetName.SetMergeSheet(msPrevColumnMerge);
-
- setGridSize();
- }
-
- function sheet1_OnSearchEnd(code, message) {
- if(code == 0) {
- setGridSize();
- } else {
- //조회 에러 수행
- alert("조회 실패");
- //alert(message);
- }
- }
- function setGridSize() {
- sheet1.FitColWidth();
- }
-
- function sheet1_OnSaveEnd(code, msg) {
- if(code >= 0) {
- alert("저장 성공");
- } else {
- alert("저장 실패");
- //alert(msg);
- }
-
- jQuery("#btnSearch").click();
- }
-
- function doResult(resultObj) {
- var f = document.form1;
- document.form1.isSubmit = false;
- try {
- if(resultObj.getRequestEvent() == "GET_PMM_WAREHOUSE_CLOSE") {
- f.dept_cd2.value = "";
- if (resultObj.getSuccess() == true) {
- var listRowSet = resultObj.getRowSet();
- if(listRowSet.getRowSize() > 0) {
- if( listRowSet.getColValue( 0, 0 ) == "9") {
- alert("해당월은 마감되었습니다.");
- return;
- } else {
- doSave();
- }
- } else {
- doSave();
- }
- } else {
- dlgErrorMsg(resultObj);
- }
- }
- } catch (errorObject) {
- dlgErrorDetailAlert("doResult()", errorObject);
- }
- }
-
- function prcKeyPress(){
- if( fevent.keyCode == 13 )
- {
- jQuery("#btnSearch").click();
- }
- }
-
- function doSave() {
- if( sheet1.RowCount() == 0 ) {
- alert("등록할 데이터가 없습니다.");
- return;
- } else if ( !sheet1.IsDataModified() ) {
- alert("수정된 데이터가 없습니다. ");
- return;
- }
-
- jQuery("#fevent").val("SAVE_STOCKDELIVERYWILLPRICE");
- var url = Modular.model.PageContext.CONTEXT_ROOT + "/warehouse/purchase/StockDeliveryWillPrice_sheet.screen";
- var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
- }
-
- // 마감유무 확인
- function getPmmWarehouseClose() {
- var f = document.form1;
-
- if(f.dateFrom.value == "") {
- alert("입고년월을 선택하세요.");
- return;
- }
-
- if(!sheet1.IsDataModified()) {
- alert("수정된 데이터가 없습니다. ");
- return;
- }
-
- f.dept_cd2.value = sheet1.GetCellValue(clickRow, "dept_cd");
-
- submitXmlRequest("/warehouse/purchase/StockDeliveryWillPrice_form.screen", "GET_PMM_WAREHOUSE_CLOSE", f, "ROWSET");
- }
- function sheet1_OnChange(Row, Col, Value, OldValue, RaiseFlag) {
- var columnName = sheet1.ColSaveName(0, Col);
- if ( columnName == "stock_pri" ) {
- sheet1.SetCellValue(Row, "stock_amt", sheet1.GetCellValue(Row, "stock_qty") * sheet1.GetCellValue(Row, "stock_pri"));
- }
- }
-
- 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_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
- clickRow = Row;
- }
-
- 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" id="vendor_cd" name="vendor_cd"> <!-- 거래처 코드 -->
- <input type="hidden" id="dcerti_no" name="dcerti_no"> <!-- 사업자코드 -->
- <input type="hidden" id="dept_cd2" name="dept_cd2"> <!-- 사업자코드 -->
- <INPUT type="hidden" name="fevent" id="fevent" value="">
-
-
- <div align="left" id="title">
- <ul>
- <li>가입고 단가등록</li>
- </ul>
- </div>
- <!-- 검색조건 시작 -->
- <table id="search-table" class="search-form-table">
- <colgroup>
- <col width="100" />
- <col width="350" />
- <col width="100" />
- <col width="*" />
- <col width="250" />
- </colgroup>
- <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("dateFrom", DateUtil.formatDateTime(params.get("dateFrom"), "yyyyMM", "yyyy-MM"), 10, 50, "hangule,center, desc=입고년월,ReadOnly") %>
- <IMG name="dateFrom_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:dlgMCalendar('dateFrom');">
- <IMG name="dataClear2" id="dataClear2" src="/img/buyer/button/bt_eraser1.gif" border="0" align="absmiddle" style="cursor:pointer;">
- </td>
- <td class="button">
- <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
- <span class="btnSearch center"><a href="javascript:void(0);" id="btnSave">저장</a></span>
- <span class="btnSearch center"><a href="javascript:void(0);" id="btnExcel">엑셀</a></span>
- </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>
|