PRU029_TAX.jsp 7.56 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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"  %>
<jsp:useBean id="PRU029_TAX" class="com.csc.library.system.Task" scope="page"/><%
	PRU029_TAX.setChannel(request,response);
	UIManager screen = (UIManager) PRU029_TAX.process("SingleEntry","PRU029_TAX");	
	String empid = request.getParameter("__employeeid");
	String comid = request.getParameter("__companyid");
	out.println(empid+"<BR>");
	out.println(comid+"<BR>");
	String formulaid="";
	String idgen="";
	String old_amt = "0";
	DbInquiry inq = new InitialInquiry(screen.getUProfile()).getDbInquiry();
	String filter="employeeid = '"+empid+"'"+" and companyid ='"+comid+"'"+" and formulaid like '%TAX'";
	out.println(filter);
	inq.initMyTable("tpytran1",filter,"formulaid");
	inq.setColumn("*");
	inq.refresh();
	if (!inq.next()){
		filter="employeeid = '"+empid+"'"+" and companyid ='"+comid+"'";
		inq.setFilter(filter);
		inq.setOrderBy("formulaid");
		inq.refresh();
		while(inq.next()){
			if (inq.isLast()) {
				 idgen = inq.getString("formulaid");
				 out.println(":::  idgen "+idgen);
			}
		}
	}else{
		out.print(inq.getString("employeeid"));
		out.print(inq.getString("formulaid"));
		formulaid = inq.getString("formulaid");
		old_amt = inq.getString("cur_amount");
	}
	out.print("<BR>::::::::  formulaid = "+formulaid);
	screen.getRecord().set("formulaid",formulaid);
	screen.getRecord().set("employeeid",inq.getString("employeeid"));
	screen.getRecord().set("companyid",inq.getString("companyid"));
	screen.getRecord().search();
	
	DbRecord tran0 =new InitialRecord(screen.getUProfile()).getDbRecord("Simtpytran0_adjtax");
	tran0.set("employeeid",empid);
	tran0.set("companyid",comid);
	tran0.search();
	double netincome = tran0.getDouble("netincome");
	out.print("<br>::::::::  netincome = "+netincome);
	out.print("<BR>::::::::  cmd = "+request.getParameter("__cmd"));
	out.print("<BR>::::::::  cur_amount = "+request.getParameter("__cur_amount"));
	out.print("<BR>::::::::  old_amount = "+request.getParameter("__old_amt"));
	String cmd = request.getParameter("__cmd");
	if (cmd!=null &&  cmd.equals("save")){
		netincome += Double.parseDouble(request.getParameter("__old_amt"));
		netincome  -=  Double.parseDouble(request.getParameter("__cur_amount"));
		out.print("<BR>::::::::::::::    Result   netincome = "+netincome);
	}
%>
<html>
<head>
<title>Human Resource System</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<script src="../JS/SCREEN.js"></script>
<script src="../JS/VIEWCALENDAR.js"></script>
<script language="JavaScript" type="text/JavaScript">
setLang('<%=screen.getUProfile().get("lang")%>');
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


function  setcmd1(acktion){
	with(document.cscform){		
    	bCon=confirm(MyCode[1]);
      	if (bCon==true)	{
			if(acktion=="save"){
				if (__notax.value!=""){
					__formulaid.value = __notax.value+"TAX";
				}
				__cmd.value="save";
				__confirm.value = "s";					
				submit();
				
				for(i=0;i<elements.length;i++){
	                if(elements[i].type=="text"){					      
						  elements[i].value="";
					}		
				}
				
			}	
       	}             	 			
	}		
}

function backhead(){
	with(window.opener.cscform){
		__cmd.value="";
	    submit();
	    window.close();		
	}
}

</script>
</head>
<body leftmargin="0" topmargin="0" onLoad=""> 
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div> 
<script language="javascript">initToolTips();</script> 
<form name="cscform" method="post" action="PRU029_TAX.jsp"> 
 

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

<%=screen.InitialVariable()%>

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

<input type="hidden" name="__cmd" value=""> 
  <input type="hidden" name="__calendar"> 
  <input type="hidden" name="__dateformat" value="DD-MM-YYYY"> 
  <input type="hidden" name="__language" value="tha"> 
  <input type="hidden" name="__headMulti" value="PRU029"> 
  <input type="hidden" name="__ack" value="<%=request.getParameter("__ack")%>"> 
  <input type="hidden" name="__screen" value="PRU029_TAX"> 
  <input type="hidden" name="__help" value=""> 
  <input type="hidden" name="__gorec" value="<%=request.getParameter("__gorec")%>">
  <input type="hidden" name="__user" value="<%=screen.getUProfile().getUserId()%>"> 
  <input type="hidden" name="__referPage" value="">
  <input type="hidden" name="__fixCon" value="companyid='<%=screen.getUProfile().get("companyid")%>'"> 
  <input type="hidden" name="__lockPage" value="<%=request.getParameter("__lockPage")%>">
  <input type="hidden" name="__companyid" value="<%=comid%>">
  <input type="hidden" name="__employeeid" value="<%=empid%>">
  <input type="hidden" name="__formulaid" value="<%=formulaid%>">
  <input type="hidden" name="__notax" value="<%=idgen%>">
  <input type="hidden" name="__old_amt" value="<%=old_amt%>">
  <div align="center"> 
  <br>
    <table width="640" cellpadding="0" cellspacing="0"> 
      <tr> 
        <td class="header" colspan="2"><div align="right">
			<strong>PRU029_TAX, &nbsp;</strong>
		</div></td> 
      </tr> 
      <tr> 
        <td width="640" colspan="2"><div align="center"> 
            <center> 
              <table width="100%" cellspacing="0" cellpadding="0"> 
                <tr> 
                  <td  colspan="2"  class="blankspace"> </td> 
                </tr> 
                <tr> 
                  <td class="columnlabel">&nbsp;&nbsp;</td> 
                  <td class="columnobject1"><%=screen.getInput("cur_amount")%></td> 
                </tr> 
				
                <tr> 
                  <td colspan="2"  class="blankspace"></td> 
                </tr> 
                <tr> 
                  <td class="buttonline" colspan="2"><div align="center">
				  	<a href="javascript:setcmd1('save')"><img src="../IMAGES/BUTTON/OK.gif" border="0"></a>&nbsp;&nbsp;
					<a href="javascript:backhead();"><img src="../IMAGES/BUTTON/BACK.gif" border="0"></a>
				  </div></td> 
                </tr> 
                <tr> 
                  <td  colspan="2"  class="blankspace"></td> 
                </tr> 
              </table> 
            </center> 
          </div></td> 
      </tr> 
      <tr bordercolor="0069B3"> 
        <td colspan="3" class="bottom"></td> 
      </tr> 
    </table> 
    </center> 
  </div> 


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

<%=screen.endJSP()%>

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

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