TRA0125_PHATRA_JETASIA.jsp 13.7 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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
<%@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.*"  %>
<%@page import="com.csc.library.databean.Simttraining"  %>
<%@page import="com.csc.library.formula.FormulaString"  %>
<jsp:useBean id="TRA0125_PHATRA" class="com.csc.library.system.Task" scope="page"/>
<%
TRA0125_PHATRA.setChannel(request,response);
UIManager screen = (UIManager) TRA0125_PHATRA.process("MultiEntry","TRA012_PHATRA",true);
screen.referLangOn();

CheckNull chk = new CheckNull();
  //************** Start Export Report *************************
  ThaiUtilities th = new ThaiUtilities();
  UProfile uf = screen.getUProfile();
  String reportPath = new InitialEnvironment("GLOBAL").getValue("report-path");
  String dbName = uf.getDbName();
  String comTname = th.ASCII2Unicode(uf.get("com_tname"));
  String comEname = uf.get("com_ename");
  String companyid = uf.get("companyid");
  String userId = uf.getUserId();
  String app_name = uf.get("appname");
  String schemaName = uf.getSchemaName();
  String password = uf.getPassword();
  String userlevel = uf.getLevel();
  String format_date = uf.get("formatdate");
  String lang = uf.get("lang").toUpperCase();
  DbRecord rec_emp = new InitialRecord(uf).getDbRecord("MEMPLOYEE");
  //************** End Export Report *************************
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html ng-app="myHR">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<link href="../CSS/bootstrap.css" rel="stylesheet"  type="text/css">
<link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet"  type="text/css">
<link href="../CSS/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../JS/jquery-2.1.3.min.js"></script>
<script type='text/javascript' src="../JS/bootstrap.js"></script>
<script type='text/javascript' src='../JS/SCREEN.js'></script>
<script src="../JS/angular-1.3.15/angular.js" type="text/javascript"></script>
<script src="../JS/ANGULAR/SCREEN_ANGULAR.js" type="text/javascript"></script>
<script language="javascript">setLang('<%=screen.getUProfile().get("lang")%>');
function goSave() {
	confirmSave();
	goSearch();
}
function goSearch() {search();}
function goDelete() {edelete();}
function goUpdate() {
	update();
	goSearch();
}
function chkEditPage(){
    var check = true;
    if(((typeof document.cscform.__sysisedit)!="undefined")&&(document.cscform.__sysisedit.value=='true')){
        var msg = (getLang() === "tha")?"มีการแก้ไข คุณจะบันทึกหรือไม่?":"Do you want to save the change?";
        aCon=confirm(msg);// จะบันทึกหรือไม
        if (aCon==true)	{
            check =false;
            //document.cscform.__sysisedit.value="";
        }
    }
    return check;
}

function childMulti(record){
	with(document.cscform){
	 window.open(__childMulti.value+".jsp?__cmd=&__gorec="+record+"&__ack=edit"+
			 "&__trainingid="+__trainingid.value+
			 "&__headMulti="+__screen.value,"trainTime","left=150,top=150,width=700,height=280,toolbar=no,status=no,scrollbars=yes,resizable=yes");
	 	}
}


function addMulti(){
	if(notBlankOnParentPage()){
		with(document.cscform){
			 window.open(__childMulti.value+".jsp?__cmd=&__gorec=&__ack=add"+
			 "&__RecNo="+__maxrec.value+
			 "&__trainingid="+__trainingid.value+
			  "&__headMulti="+__screen.value,"trainTime","left=150,top=150,width=700,height=280,toolbar=no,status=no,scrollbars=yes,resizable=yes");
		}
	}
}

function deleteMulti(){
	with(document.cscform){
      bCon=confirm("ต้องการลบข้อมูลหรือไม่ ?");
		  if (bCon==true)	{
			__cmd.value="DelChild";
			submit();
		}
	}
}
function genTime(){
	if(window.parent.document.cscform.__trainingid.value!=""){
		window.document.cscform.__trainingid.value = window.parent.document.cscform.__trainingid.value;
		window.document.cscform.__classdatefrm.value = window.parent.document.cscform.__classdatefrm.value;
		window.document.cscform.__classdateto.value =  window.parent.document.cscform.__classdateto.value;
		window.document.cscform.__timestart.value=  window.parent.document.cscform.__timestart.value;
		window.document.cscform.__timestop.value =  window.parent.document.cscform.__timestop.value;
		window.document.cscform.__timebreak.value =  window.parent.document.cscform.__timebreak.value;
		with(document.cscform){
			__cmd.value = "ack";
			__isgen.value = "1";
			//window.parent.restTabPages();
			submit();
		}
	}else{
		alert(MyCode[0]);
		window.parent.document.cscform.__trainingid.selected();
	}
}
function GoPrint(trainingdate,trainingtime){
    with(document.cscform){
        if(chkEditPage()){
            var reportName = getLang()==="tha"?"รายงานรายชื่อผู้เข้าอบรม":"Participant Report";
            var path = "<%=reportPath%>";
            var a = path.substring(0,path.length)+
                "?uprofile$dbname=<%=dbName%>"+
                "&com_tname=<%=comTname%>"+
                "&com_ename=<%=comEname%>"+
                "&uprofile$companyid=<%=companyid%>"+
                "&uprofile$userid=<%=userId%>"+
                "&uprofile$lang=<%=lang%>"+
                "&uprofile$appname=<%=app_name%>"+
                "&uprofile$schemaname=<%=schemaName%>"+
                "&uprofile$emp_level=<%=userlevel%>"+
                "&uprofile$formatdate=<%=format_date%>"+
                "&__screen=TRA0125_PDF"+
                "&__REPORT_XML=TRA0125_PDF"+
                "&__reportname="+reportName+
                "&thaiHeader=รายงานรายชื่อผู้เข้าอบรม"+
                "&engHeader=Participant Report"+
                "&__startPage=1"+
                "&__fixfilterttraintrnee=trainingid='"+__trainingid.value+"'"+
                "&__conditionid="+
                "&__classname=ReportResultSet"+
                "&__mmxml="+
                "&__expxml="+
                "&__export_type=EXPORT"+
                "&__file_type=.pdf"+
                "&__template=TRA0125_PDF_JETASIA.jasper$"+
                "&__cmd="+
                "&__orderText="+
                "&__language=<%=lang%>"+
                "&__groupText="+
                "&__trainingdate="+trainingdate+
                "&__trainingtime="+trainingtime+
                "&__reportHeader="+reportName+
                "&__bu1=<%=rec_emp.getField("bu1").getDescription()%>"+
                "&__bu2=<%=rec_emp.getField("bu2").getDescription()%>"+
                "&__bu3=<%=rec_emp.getField("bu3").getDescription()%>"+
                "&__bu4=<%=rec_emp.getField("bu4").getDescription()%>"+
                "&__bu5=<%=rec_emp.getField("bu5").getDescription()%>";
            window.open(a);
            console.log(reportName);
        }
    }
}
function GoPrintEXCEL(trainingdate,trainingtime){
    with(document.cscform){
        if(chkEditPage()){
          var dbname = '<%=screen.getUProfile().getDbName()%>';
          var linkfilename = "TRA0125_EXCEL.jsp";
          if(dbname === "APF") {
            linkfilename = "TRA0125_EXCEL_APF.jsp";
          }
            var a = linkfilename+
            "?__trainingid="+__trainingid.value+
            "&__trainingdate="+trainingdate+
            "&__trainingtime="+trainingtime;
            window.open(a);
        }
    }
}
</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="TRA0125_PHATRA_JETASIA.jsp">

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

<%=screen.InitialVariable()%>

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

  <input type="hidden" name="__confirm" value="">
  <input type="hidden" name="__cmd" value="">
  <input type="hidden" name="__screen" value="TRA012_PHATRA">
  <input type="hidden" name="__help" value="">
  <input type="hidden" name="__childMulti" value="TRA0125E_PHATRA">
  <input type="hidden" name="__gorec" value="">
  <input type="hidden" name="__ack" value="">
  <input type="hidden" name="__trainingid" value="<%=chk.chkNullString(request.getParameter("__trainingid"),screen.getDataLabel("TRAININGID"))%>">
  <input type="hidden" name="__multiTable" value="TTRAININGTIME">
  <input type="hidden" name="__companyid" value="<%=screen.getUProfile().get("companyid")%>">
  <input type="hidden" name="__maxrec" value="<%=screen.getTable("TTRAININGTIME").recCount()%>">
  <input type="hidden" name="__notNull" value="<%=screen.getRequire()%>">

  <input type="hidden" name="__isgen" value="0">
  <input type="hidden" name="__classdatefrm" value="<%=screen.getDataLabel("classdatefrm")%>">
  <input type="hidden" name="__classdateto" value="<%=screen.getDataLabel("classdateto")%>">
  <input type="hidden" name="__timestart" value="<%=screen.getDataLabel("timestart")%>">
  <input type="hidden" name="__timestop" value="<%=screen.getDataLabel("timestop")%>">
  <input type="hidden" name="__timebreak" value="<%=screen.getDataLabel("timebreak")%>">
  <input type="hidden" name="__clean" value="1">

  <table cellpadding="0" cellspacing="0" class="maxsize">
    <tr >
        <td class="header"> TRA0125_PHATRA_JETASIA,
          <script language="javascript">swapLang('Date');</script>&nbsp;-&nbsp;<script language="javascript">swapLang('Training Time');</script>&nbsp;&nbsp;</td>
	</tr>
    <tr>
      <td>
	  <table border="0" cellpadding="0" cellspacing="1" id="rsTable" name="rsTable" bgcolor="#333333" class="maxsize tablewithborder" cols="5">
        <tr >
          <td width="7%"  class="row3"><div align="center"><strong>
              <script language='javascript'>swapLang('Del');</script>
          </strong></div></td>
          <td width="30%"  class="row3"><div align="center"><script language='javascript'>swapLang('Date');</script></a></div></td>
          <td width="10%"  class="row3"><div align="center"><script language="JavaScript">swapLang("Time")</script></a></div></td>
          <td width="20%"  class="row3"><div align="center"><script language="JavaScript">swapLang("Break Hour")</script></a></div></td>
          <td width="23%"  class="row3"><div align="center"><script language="javascript">swapLang('Total Hour');</script></div></td>
          <td width="23%"  class="row3"><div align="center"><script language="javascript">swapLang('Status');</script></div></td>
          <td width="30%"  class="row3"><div align="center" swlang code="SW005455">Attendee Logbook</div></td>
        </tr>
		<%
				String isgen = chk.chkNullString(request.getParameter("__isgen"));
				if(isgen.equals("1")){
					Simttraining ttraining = (Simttraining)screen.getRecord("Ttraining");
					ttraining.genTrainingTime();
				}
				MultiLine multi = screen.getMultiLine("TTRAININGTIME");
				multi.setLabelBox("check box");
				multi.goFirst();
				FormulaString f = new FormulaString();
				int hourM = 0;
				for(int i=1;!multi.eof();multi.next(),i++){
					hourM += f.Tm_To_Min(Double.parseDouble(multi.getData("TTRAININGTIME","T_HOUR")));
		%>
				<tr>
				  <td class="inframe"><div align="center"> <%=multi.getInputCheckBox()%> </div></td>
				  <td class="inframe">
						<div align="center">
							<%=multi.getScript("childMulti", multi.getTable().getCurrentRecordManager().getCscCalendar("START_DATE").getDDMMYYYY())%>
						</div>
					</td>
				  <td class="inframe"><div align="center"><%=multi.getData("TTRAININGTIME","START_TIME")%> - <%=multi.getData("TTRAININGTIME","END_TIME")%></div></td>
				  <td class="inframe"><div align="center"><%=multi.getData("TTRAININGTIME","TIMEBREAK")%></div></td>
				  <td class="inframe"><div align="center"><%=multi.getData("TTRAININGTIME","T_HOUR")%></div></td>
				  <td class="inframe"><div align="center"><%=multi.getSystemCode("STATUS")%></div></td>
          <td class="inframe" nowrap><div align="center">
            <button type="button" class="btn btn-primary width100" onClick="GoPrint('<%=multi.getData("TTRAININGTIME","START_DATE")%>','<%=multi.getData("TTRAININGTIME","START_TIME")+" - "+multi.getData("TTRAININGTIME","END_TIME")%>');"><i class="fa fa-file-pdf-o fa-lg" aria-hidden="true"></i> PDF</button>
            <button type="button" class="btn btn-primary width100"  onClick="GoPrintEXCEL('<%=multi.getData("TTRAININGTIME","START_DATE")%>','<%=multi.getData("TTRAININGTIME","START_TIME")+" - "+multi.getData("TTRAININGTIME","END_TIME")%>');"><i class="fa fa-file-excel-o fa-lg" aria-hidden="true"></i> Excel</button>
          </div></td>

        <%
				}
		%>
				<script language='javascript'>
					window.parent.document.getElementById("classhour").innerHTML = '<%=f.Min_to_tm(hourM)%>';
				</script>
      </table></td>
    </tr>
    <tr>
      <td  class="blankspace"></td>
    </tr>

    <tr>
      <td  class="buttonline" colspan="7"><div align="center">
        <button type="button" class="btn btn-primary width100" swlang code="SW013163" onClick="checkAll();">Select All</button>&nbsp;
        <button type="button" class="btn btn-primary width100" swlang code="SW013164" onClick="decheckAll();">Deselect All</button>&nbsp;
        <button type="button" class="btn btn-primary width100" swlang code="SW013176" onClick="genTime();">GENDATA</button>&nbsp;
        <button type="button" class="btn btn-primary width100" swlang code="SW013165" onClick="addMulti();">Add</button>&nbsp;
        <button type="button" class="btn btn-primary width100" swlang code="SW013166" onClick="deleteMulti();">Delete</button>
      </div>
      </td>
    </tr>
    <tr>
      <td  class="blankspace"></td>
    </tr>
  </table>
  <script language="javascript">window.parent.setTabPages();</script>
</form>
</body>
</html>