PRU124.jsp 7.53 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.csc.library.entry.*" %>
<%@ page import="com.csc.library.session.*,com.csc.library.utilities.CscCalendar" %>
<jsp:useBean id="PRU124" scope="page" class="com.csc.library.system.Task" />
<%
PRU124.setChannel(request ,response);
ProcessEntry screen=(ProcessEntry)PRU124.process("ProcessEntry","PEndMonth");
screen.process();

String haveDataInPytran="false";
DbInquiry  pytran0 =new InitialInquiry(screen.getUProfile()).getDbInquiry("Tpytran0",true);
if(pytran0.next()){
  haveDataInPytran = "true";
}

DbInquiry  period0 =new InitialInquiry(screen.getUProfile()).getDbInquiry("Mperiod","period_close=0","end_date",true);
DbInquiry  period1 =new InitialInquiry(screen.getUProfile()).getDbInquiry("Mperiod","period_close=1","end_date desc",true);

String end_date_cur = "",end_date_prv="";
String period_close_cur = "",period_close_prv="";
String orderOfMonth = "0";
String endOfSpecDate ="";

CscCalendar carlendar_prv = null;
CscCalendar carlendar_cur = null;

period1.next();
period_close_prv = period1.getString("period_close");
end_date_prv = period1.getString("end_date");

if(period0.next()){
  period_close_cur = period0.getString("period_close");
  end_date_cur = period0.getString("end_date");

  if(period_close_prv.equals("0")){
    period_close_prv = period_close_prv;
    end_date_prv = end_date_cur;
  }
  carlendar_cur= new CscCalendar(end_date_cur);

  if(period_close_prv.equals("1")&&period_close_cur.equals("0")){
    CscCalendar tmp = new CscCalendar(end_date_prv);
    tmp.incDate();
    endOfSpecDate = tmp.getDDMMYYYY();
    orderOfMonth = String.valueOf((carlendar_cur==null)?0:carlendar_cur.getMonth()+1);
  }else{
    CscCalendar tmp = new CscCalendar(end_date_cur);
    tmp.decMonth();
    tmp.incDate();
    endOfSpecDate = tmp.getDDMMYYYY();
    orderOfMonth = "1";
  }
}
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link href="../CSS/TISCO.css" rel="stylesheet" type="text/css"/>
    <link href="CSS/MENU.css" rel="stylesheet" type="text/css"/>
    <script type='text/javascript' src='../JS/SCREEN.js'></script>
    <script src="../JS/VIEWCALENDAR.js"></script>
    <script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
    <script language="javascript">getTitleName();</script>
    <script language="javascript">
    function process(month,datainpytran) {
      var con = eval(month);
      var pytran0 = eval(datainpytran);
      if(con == '0' || con == null){
        alert('Can not process cause: Order of Month  is 0');
      }else if(pytran0=='true'){
        alert('Can not process cause: Have data in tpytran Please Confirm process before processing End Month Process');
      }else{
        with(document.cscform){
          if(__condition$month$order.value !=""){
            bCon=confirm("Confirm Process");
            if (bCon==true)	{
              __cmd .value = "save";
              submit();
            }
          }else{
            alert("All Period is Close!!!!");
          }
        }
      }
    }
    </script>
  </head>
  <body leftmargin="0" topmargin="0"  onLoad="MM_preloadImages('../IMAGES/BUTTON/SWAP/SEARCH_SWAP20.gif')">
    <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
    <script language="javascript">initToolTips();</script>
    <form name="cscform" method="post" action="">

      <!----------BEGIN CSC INITIAL ZONE ------------------------>

      <%=screen.InitialVariable()%>

      <!----------END CSC INITIAL ZONE -------------------------->

      <input type="hidden" name="__screen"  value="PRU124"/>
      <input type="hidden" name="__fixCon"  value="companyid='<%=screen.getUProfile().get("companyid")%>'"/>
      <input type="hidden" name="__tname" value="ระบบเงินเดือน"/>
      <input type="hidden" name="__ename" value="Payroll"/>
      <input type="hidden" name="__cmd"  value=""/>
      <input type="hidden" name="__help"  value=""/>
      <input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>"/>
      <input type="hidden" name="__user" value="<%=screen.getUProfile().getUserId()%>"/>
      <input type="hidden" name="__companyid"value='<%=screen.getUProfile().get("companyid")%>'/>
      <input type="hidden" name="__name" value="Process End Month"/>
      <input type="hidden" name="__ptype" value="PR3"/>
      <input type="hidden" name="__prclass" value="PEndMonth"/>
      <input type="hidden" name="__calendar"/>
      <script language="javascript">getInputFormatDate();</script>

      <br/>
      <div align="center">
        <table>
          <tr>
            <td class="header" colspan="2" >PRU124,&nbsp;<script language="javascript">swapLang('Month End Process');</script>&nbsp;</td>
          </tr>
          <tr>
            <td>
              <table cellpadding="0"  cellspacing="0" class="inner" border="1" bordercolor="#FF0000">
                <tr>
                  <td colspan="3"  class="blankspace"></td>
                </tr>
                <tr>
                  <td  class="row4" width="150"><div align="right"><script language="javascript">swapLang('Order of Month');</script>&nbsp;</div></td>
                  <td width="313" height="20" align="left"><div align="left"><input name="__condition$month$order" type="text" readonly="true" size="10" maxlength="10" value="<%=orderOfMonth%>"></div></td>
                  <td width="169" rowspan="2" align="left"> </td>
                </tr>
                <tr>
                  <td valign="top" class="row4"><div align="right"><script language="javascript">swapLang('Specify Date');</script>&nbsp;</div></td>
                  <td align="left" valign="top" class="row4"> <div align="left">
                    <input name="__condition$date$1" type="text" size="10" maxlength="10" readonly="true" value="<%=endOfSpecDate%>">
                    <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calendar1','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" name="calendar1" width="20" height="20" border="0" align="absmiddle" onClick="viewCal('__condition$date$1')" alt="Calendar"></a>
                    &nbsp;&nbsp;-&nbsp;&nbsp;
                    <input name="__condition$date$2" type="text" size="10" maxlength="10" readonly="true" value="<%=carlendar_cur.getDDMMYYYY()%>">
                    <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('calendar2','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" name="calendar2" width="20" height="20" border="0" align="absmiddle" onClick="viewCal('__condition$date$2')" alt="Calendar"></a>
                  </div></td>
                </tr>
                <tr>
                  <td colspan="3" class="blankspace"></td>
                </tr>
                <tr>
                  <td colspan="3" class="buttonline"><div align="center"><a href="javascript:process('<%=orderOfMonth%>','<%=haveDataInPytran%>');"><img src="../IMAGES/BUTTON/PROCESS.gif" border="0"></a></div></td>
                </tr>
                <tr>
                  <td colspan="3" class="blankspace"></td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td class="bottom" ></td>
          </tr>
        </table>
      </div>

      <!----------BEGIN CSC ENDING ZONE ------------------------>

      <%=screen.endJSP()%>

      <!----------END CSC ENDING ZONE -------------------------->

    </form>
  </body>
</html>