ModeViewByResource.jsp 38.2 KB
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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.formmode.service.CustomResourceService"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ page import="weaver.general.*" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="departmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/>
<jsp:useBean id="checkSubCompanyRight" class="weaver.systeminfo.systemright.CheckSubCompanyRight" scope="page"/>
<jsp:useBean id="resourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" />
<jsp:useBean   id="xssUtil" class="weaver.filter.XssUtil" />

<HTML><HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET />

    <link href="/workplan/calendar/css/calendar_wev8.css" rel="stylesheet" type="text/css" /> 
    <link href="/workplan/calendar/css/dp_wev8.css" rel="stylesheet" type="text/css" />   
    <link href="/workplan/calendar/css/main_wev8.css" rel="stylesheet" type="text/css" /> 
    <%
    if(user.getLanguage()==8){
%>
    <script src="/car/calendar/src/Plugins/datepicker_lang_US_wev8.js" type="text/javascript"></script> 
<%
	}else if(user.getLanguage()==9){
%>
    <script src="/car/calendar/src/Plugins/datepicker_lang_HK_wev8.js" type="text/javascript"></script> 
<%
    }else{
%>
    <script src="/car/calendar/src/Plugins/datepicker_lang_ZH_wev8.js" type="text/javascript"></script> 
<%
    }
%>	
    <script src="/car/calendar/src/Plugins/jquery.datepickernew_wev8.js" type="text/javascript"></script>

<%
    if(user.getLanguage()==8){
%>
    <script src="/car/calendar/src/Plugins/wdCalendar_lang_US_wev8.js" type="text/javascript"></script>  
<%
	}else if(user.getLanguage()==9){
%>
    <script src="/car/calendar/src/Plugins/wdCalendar_lang_HK_wev8.js" type="text/javascript"></script>  
<%
    }else{
%>
    <script src="/car/calendar/src/Plugins/wdCalendar_lang_ZH_wev8.js" type="text/javascript"></script>  
<%
    }
%>
<META http-equiv=Content-Type content="text/html; charset=UTF-8" />

</head>
<%!
public String formatText(String str, int len){
	return str.length() > len?str.substring(0,len)+"...":str;
}
%>

<%
int userSub = user.getUserSubCompany1(); 
Calendar calendar = Calendar.getInstance();
    
String imagefilename = "/images/hdReport_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(19018,user.getLanguage());//车辆使用情况
String needfav ="1";
String needhelp ="";
char flag=2;
String userid=user.getUID()+"" ;
ArrayList newCarIds = new ArrayList() ;
boolean cancelRight = HrmUserVarify.checkUserRight("Canceledpermissions:Edit",user);
//1: year 2:month 3:week 4:today but the year haven`t been used!
int bywhat = Util.getIntValue(request.getParameter("bywhat"),4);

String resourceId =  Util.null2String(request.getParameter("resourceId"));
if(resourceId.equals("")){
	resourceId = Util.null2String(request.getParameter("id"));
}

String resourcesqlwhere = new String(Util.null2String(request.getParameter("resourcesqlwhere")).getBytes("ISO-8859-1"),"UTF-8");

String datasqlwhere = new String(Util.null2String(request.getParameter("datasqlwhere")).getBytes("ISO-8859-1"),"UTF-8");
String sqlwhere = new String(Util.null2String(request.getParameter("sqlwhere")).getBytes("ISO-8859-1"),"UTF-8");

if(!resourcesqlwhere.equals("")){
	resourcesqlwhere = resourcesqlwhere.trim().startsWith("and")?resourcesqlwhere:" and "+resourcesqlwhere;
}
if(!datasqlwhere.equals("")){
	datasqlwhere = datasqlwhere.trim().startsWith("and")?datasqlwhere:" and "+datasqlwhere;
}

if(!sqlwhere.equals("")){
	datasqlwhere += sqlwhere.trim().startsWith("and")?sqlwhere:" and "+sqlwhere;
}

String currentdate =  Util.null2String(request.getParameter("currentdate"));
String movedate = Util.null2String(request.getParameter("movedate"));//上一个时段或下一个时段,-1或1 
String relatewfid = Util.null2String(request.getParameter("relatewfid"));
String operation=Util.null2String(request.getParameter("operation"));
String content = Util.null2String(request.getParameter("content")).trim();
int subCompanyId=Util.getIntValue(request.getParameter("subCompanyId"),-1);
int carid=Util.getIntValue(request.getParameter("id"),0);
int subids = Util.getIntValue(request.getParameter("subids"), -1);
Calendar today = Calendar.getInstance();
Calendar temptoday1 = Calendar.getInstance();
Calendar temptoday2 = Calendar.getInstance();
String nowdate = Util.add0(today.get(Calendar.YEAR), 4) +"-"+
                 Util.add0(today.get(Calendar.MONTH) + 1, 2) +"-"+
                 Util.add0(today.get(Calendar.DAY_OF_MONTH), 2) ;
String nowtime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" +
                Util.add0(today.get(Calendar.MINUTE), 2) + ":" +
                Util.add0(today.get(Calendar.SECOND), 2);   
if(operation.equals("cancel")){
    //TODO 车辆使用取消状态
}

if(!currentdate.equals("")) {
	int tempyear = Util.getIntValue(currentdate.substring(0,4)) ;
	int tempmonth = Util.getIntValue(currentdate.substring(5,7))-1 ;
	int tempdate = Util.getIntValue(currentdate.substring(8,10)) ;
	today.set(tempyear,tempmonth,tempdate);
} 

int currentyear=today.get(Calendar.YEAR);
int thisyear=currentyear;
int currentmonth=today.get(Calendar.MONTH);  
int currentday=today.get(Calendar.DATE);

switch(bywhat) {
	case 1:
		today.set(currentyear,0,1) ;
		if(movedate.equals("1")) today.add(Calendar.YEAR,1) ;
		if(movedate.equals("-1")) today.add(Calendar.YEAR,-1) ;
		break ;
	case 2:
		today.set(currentyear,currentmonth,1) ;
		if(movedate.equals("1")) today.add(Calendar.MONTH,1) ;
		if(movedate.equals("-1")) today.add(Calendar.MONTH,-1) ;
		break ;
	case 3:
		Date thedate = today.getTime() ;
		int diffdate = (-1)*thedate.getDay() ;
		today.add(Calendar.DATE,diffdate) ;
		if(movedate.equals("1")) today.add(Calendar.WEEK_OF_YEAR,1) ;
		if(movedate.equals("-1")) today.add(Calendar.WEEK_OF_YEAR,-1) ;
		today.add(Calendar.DATE,1);
		break;
	case 4:
		if(movedate.equals("1")) today.add(Calendar.DATE,1) ;
		if(movedate.equals("-1")) today.add(Calendar.DATE,-1) ;
		break;
}

currentyear=today.get(Calendar.YEAR);
currentmonth=today.get(Calendar.MONTH)+1;  
currentday=today.get(Calendar.DATE); 

currentdate = Util.add0(currentyear,4)+"-"+Util.add0(currentmonth,2)+"-"+Util.add0(currentday,2) ;
temptoday1.set(currentyear,currentmonth-1,currentday) ;
temptoday2.set(currentyear,currentmonth-1,currentday) ;

calendar.set(currentyear, currentmonth - 1, currentday);
calendar.add(Calendar.MONTH, 1);
calendar.set(Calendar.DATE, 1);
calendar.add(Calendar.DATE, -1);
int daysOfThisMonth = calendar.get(Calendar.DATE);


switch (bywhat) {
	case 1 :
		today.add(Calendar.YEAR,1) ;
		break ;
	case 2:
		today.add(Calendar.MONTH,1) ;
		break ;
	case 3:
		today.add(Calendar.WEEK_OF_YEAR,1) ;
		break;
	case 4:
		today.add(Calendar.DATE,1) ;
		break;
}

currentyear=today.get(Calendar.YEAR);
currentmonth=today.get(Calendar.MONTH)+1;  
currentday=today.get(Calendar.DATE);  


String currenttodate = Util.add0(currentyear,4)+"-"+Util.add0(currentmonth,2)+"-"+Util.add0(currentday,2) ;
String 	currentWeekEnd = "";
String datefrom = "" ;
String dateto = "" ;
String datenow = "" ;
String cBeginDate="";
String cEndDate="";

switch (bywhat) {
	case 1 :
		datenow = Util.add0(temptoday1.get(Calendar.YEAR),4) ;
		temptoday1.add(Calendar.YEAR,-1) ;
		datefrom = Util.add0(temptoday1.get(Calendar.YEAR),4) ;

		temptoday2.add(Calendar.YEAR,1) ;
		dateto = Util.add0(temptoday2.get(Calendar.YEAR),4) ;
		break ;
	case 2 :
		datenow = Util.add0(temptoday1.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday1.get(Calendar.MONTH)+1,2) ;
		temptoday1.add(Calendar.MONTH,-1) ;
		datefrom = Util.add0(temptoday1.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday1.get(Calendar.MONTH)+1,2)+"-31" ;

		temptoday2.add(Calendar.MONTH,1) ;
		dateto = Util.add0(temptoday2.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday2.get(Calendar.MONTH)+1,2)+"-01" ;
		cBeginDate = TimeUtil.getMonthBeginDay(currentdate);
		cEndDate = TimeUtil.getMonthEndDay(currentdate);
		break ;
 	case 3 :
 		datenow = Util.add0(temptoday1.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday1.get(Calendar.MONTH)+1,2)+"-"+Util.add0(temptoday1.get(Calendar.DATE),2) ;
		temptoday1.add(Calendar.DATE,-2) ;
		datefrom = Util.add0(temptoday1.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday1.get(Calendar.MONTH)+1,2)+"-"+Util.add0(temptoday1.get(Calendar.DATE),2) ;

		temptoday2.add(Calendar.WEEK_OF_YEAR,1) ;
		temptoday2.add(Calendar.DATE,-1) ;
		dateto = Util.add0(temptoday2.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday2.get(Calendar.MONTH)+1,2)+"-"+Util.add0(temptoday2.get(Calendar.DATE),2) ;
		cBeginDate = TimeUtil.getWeekBeginDay(currentdate);
		cEndDate = TimeUtil.getWeekEndDay(currentdate);
		break ;
	case 4 :
		datenow = Util.add0(temptoday1.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday1.get(Calendar.MONTH)+1,2)+"-"+Util.add0(temptoday1.get(Calendar.DATE),2) ;
		temptoday1.add(Calendar.DATE,-1) ;
		datefrom = Util.add0(temptoday1.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday1.get(Calendar.MONTH)+1,2)+"-"+Util.add0(temptoday1.get(Calendar.DATE),2) ;
		
		Calendar datetos = Calendar.getInstance();
		temptoday2.add(Calendar.DATE,1) ;
		dateto = Util.add0(temptoday2.get(Calendar.YEAR),4)+"-"+Util.add0(temptoday2.get(Calendar.MONTH)+1,2)+"-"+Util.add0(temptoday2.get(Calendar.DATE),2) ;
		cBeginDate = currentdate;
		cEndDate = currentdate;
}


CustomResourceService customResourceService = new CustomResourceService();
Map<String, String> fields = customResourceService.convertResourceFieldsById(resourceId);

String modename = fields.get("modename");
String modeid = fields.get("modeid");
String formid = fields.get("formid");
String customSearchId = fields.get("customSearchId");

//String startDateFieldName = fields.get("startDateFieldName");
//String endDateFieldName = fields.get("endDateFieldName");
String resourceFieldName = fields.get("resourceFieldName");
String createUrl = Util.null2String(fields.get("createUrl"));

//datasqlwhere = " and (t1."+startDateFieldName+">'"+datefrom+"' and t1."+startDateFieldName+"<'"+dateto+"' or t1."+endDateFieldName+">'"+datefrom+"' and t1."+endDateFieldName+"<'"+dateto+"')"+datasqlwhere;
%>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
////月使用情况
RCMenu += "{"+SystemEnv.getHtmlLabelName(6076,user.getLanguage())+SystemEnv.getHtmlLabelName(160,user.getLanguage())+SystemEnv.getHtmlLabelName(622,user.getLanguage())+",javascript:ShowMONTH(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
////周使用情况
RCMenu += "{"+SystemEnv.getHtmlLabelName(1926,user.getLanguage())+SystemEnv.getHtmlLabelName(160,user.getLanguage())+SystemEnv.getHtmlLabelName(622,user.getLanguage())+",javascript:ShowWeek(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
////日使用情况
RCMenu += "{"+SystemEnv.getHtmlLabelName(390,user.getLanguage())+SystemEnv.getHtmlLabelName(160,user.getLanguage())+SystemEnv.getHtmlLabelName(622,user.getLanguage())+",javascript:ShowDay(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
if(!createUrl.trim().equals("")){
	RCMenu += "{"+SystemEnv.getHtmlLabelName(83981,user.getLanguage())+modename+",javascript:onAdd(),_self} " ;
	RCMenuHeight += RCMenuHeightStep ;
}
%>	
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<style type=text/css>
td.car-selecting .tdfcs{
	BACKGROUND-COLOR: #59b0f2;
}
.tdfcs{
	width:4px;
	height:100%;
	float:left;
}
.thbgc{
	background:#f7f7f7;
}

.selectable .ui-selecting { background: #E1ECFF;}
.selectable .ui-selected { background: #F39814; color: white; }
.selectable { list-style-type: none; margin: 0; padding: 0;cursor :pointer; }

.TH {
	CURSOR: auto; BACKGROUND-COLOR: beige
}
.PARENT {
	CURSOR: auto
}
.TH1 {
	CURSOR: auto; HEIGHT: 25px; BACKGROUND-COLOR: beige
}
.TODAY {
	CURSOR: auto; BACKGROUND-COLOR: lightgrey
}
.T_HOUR {
	BORDER-LEFT: white 1px solid; CURSOR: auto; BACKGROUND-COLOR: lightgrey
}
.TI TD {
	BORDER-TOP: 0px; FONT-SIZE: 1px; LEFT: -1px; BORDER-LEFT: 0px; CURSOR: auto; POSITION: relative; TOP: -1px
}
.CU {
	
}
.SD {
	CURSOR: auto; COLOR: white; BACKGROUND-COLOR: mediumblue
}
.L {
	BORDER-TOP: white 1px solid; CURSOR: auto; BACKGROUND-COLOR: lightgrey
}
.LI {
	BORDER-TOP: white 1px solid; CURSOR: auto; BACKGROUND-COLOR: lightgrey
}
.L1 {
	BORDER-TOP: white 1px solid; BORDER-LEFT: white 1px solid; CURSOR: auto; BACKGROUND-COLOR: lightgrey
}
.M1 TD {
	 BORDER-bottom: 1px solid #d0d0d0;BORDER-LEFT: 1px solid #d0d0d0;color:#606060;
}

.M1 {
	BORDER-RIGHT: 1px solid #d0d0d0; TABLE-LAYOUT: fixed; FONT-SIZE: 8pt; WIDTH: 100%; CURSOR: hand; min-width:900px !important;
}
.MI {
	TABLE-LAYOUT: fixed; FONT-SIZE: 8pt; WIDTH: 100%; CURSOR: hand; min-width:900px !important;
}

.M1 {
	BORDER-top: 1px solid #d0d0d0;
}
.WE {
	BORDER-LEFT-WIDTH: 0px
}
.PI TD {
	BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: lightgrey 1px solid; BORDER-BOTTOM: 1px solid
}

.searchBox .searchInput{
	height:19px;
	border-right:none;
	width:170px;
	background:#fff;
}
.searchBox{
    margin-left:0px;
    margin-bottom:2px;
	background:#f7f7f7;
	line-height:23px;
	font-weight:bold;
	text-align:center;
	width:200px;
	height:23px;
	_height:25px;
	cursor:pointer;
	display:inline-block;
	opacity: 1;
}
.carnames {
		height:25px;
		cursor :pointer;
		background:#f7f7f7;
}
.carnames .tdtxt {
		word-break: keep-all;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
		height:25px;
		line-height:25px;
		width:214px;
		float:left
}

.searchBox .Browser:hover{
	background:#f1eeee;
}

.subidsSpan{
	width:100px;
	word-break: keep-all;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}


</style>
<BODY style="overflow: hidden;">
<FORM id=frmmain name=frmmain method=post action="/formmode/view/ModeViewByResource.jsp?id=<%=resourceId %>&sqlwhere=<%=sqlwhere %>" style="height: 100%;">
<input type=hidden name=currentdate value="<%=currentdate%>"/>
<input type=hidden name=bywhat value="<%=bywhat%>"/>
<input type=hidden name=movedate value="" />
<div> 
<%
      String addBtnUrl="/car/calendar/css/images/icons/addBtn_wev8.png";
	  if(user.getLanguage()==8){
		  addBtnUrl="/car/calendar/css/images/icons/addBtn_EN_wev8.png";
	  }
%>
  </div>
    <div id="calhead" class="calHd" style="height:36px;padding-left:20px;min-width:900px !important;background-color: #f7f7f7;z-index: 999;position: absolute;width: 100%">
      		<div style="float:left;margin-left:10px;border:none;height:24px;display: none;"><!-- 显示/隐藏分部树 -->
      			<div id="showLayoutbtn" unselectable="on" title="<%=SystemEnv.getHtmlLabelName(33402,user.getLanguage()) %>" val="0" unselectable="on" class="calHdBtn showLayoutbtnT" style="margin-left:10px;border:none;height:24px;">
				<INPUT type=hidden name="subids" id="subids" value="<%if(subids > 0){%><%=subids %><%} %>" />
				</div>
				<!-- 选择分部 -->
	      		<div  id="showsubcompanybtn" unselectable="on" title="<%=SystemEnv.getHtmlLabelName(33256,user.getLanguage())%>" class="calHdBtn" style="margin-left:0px;width:auto !important;padding-left:0px;padding-right:10px;text-align:left;color:#59b0f2" >
						
						<% String subidsSpan = SystemEnv.getHtmlLabelName(141,user.getLanguage());//分部
							if(subids > 0){
								subidsSpan += " : "+SubCompanyComInfo.getSubCompanyname(""+subids);
							} else {
								RecordSet.executeSql("SELECT companyname FROM HrmCompany WHERE id = 1");
								if(RecordSet.next()){//总部
									subidsSpan =  SystemEnv.getHtmlLabelName(140,user.getLanguage())+" : "+Util.null2String(RecordSet.getString("companyname"));
								}
							} 
						%>
						<%=subidsSpan%>
	      		</div>
	      		<div class="rightBorder" style="margin-left:10px;margin-right:13px">|</div>
      		</div>
      		<div  id="firstButtons" style="float:left;min-width:40px !important;display: <%=createUrl.trim().equals("")?"none":"block" %>">
      			<div id="faddbtn" class="calHdBtn faddbtn" title="<%=SystemEnv.getHtmlLabelName(83981,user.getLanguage())+modename %>" style="border:none;height:25px;">
      			</div>
				<div class="rightBorder" style="margin-left:10px;margin-right:10px">|</div>
      		</div>
			<div id="editButtons2" style="float:left;min-width:60px !important;">
		      		  <%if(user.getLanguage()==9) {%><!-- 日 -->
      		    <div id="showdaybtn" unselectable="on" title="<%=SystemEnv.getHtmlLabelName( 27296 ,user.getLanguage())%>" class="calHdBtn     <% if(bywhat==4) {%>txtbtncls<%} else {%>txtbtnnoselcls<%}%>" style="margin-left:0px;width:30px;font-size: 15px;">
	      			D
	      		</div><!-- 周 -->
	      		<div id="showweekbtn" unselectable="on" title="<%=SystemEnv.getHtmlLabelName( 1926 ,user.getLanguage())%> " class="calHdBtn   <% if(bywhat==3) {%>txtbtncls<%} else {%>txtbtnnoselcls<%}%>" style="border-left:none;width:30px;font-size: 15px;">
	      			W
	      		</div><!-- 月 -->
	      		<div id="showmonthbtn" unselectable="on" title="<%=SystemEnv.getHtmlLabelName( 6076 ,user.getLanguage())%>" class="calHdBtn   <% if(bywhat==2) {%>txtbtncls<%} else {%>txtbtnnoselcls<%}%>" style="border-left:none;width:30px;font-size: 15px;">
	      			M
	      		</div>
      		    <%} else { %>
            	<div id="showdaybtn" unselectable="on" class="calHdBtn <% if(bywhat==4)  {%>txtbtncls<%} else {%>txtbtnnoselcls<%}%>" style="margin-left:0px;width:30px;font-size: 15px;">
	      			<%=SystemEnv.getHtmlLabelName( 27296 ,user.getLanguage())%> <!-- 日 -->
	      		</div>
	      		<div id="showweekbtn" unselectable="on" class="calHdBtn <% if(bywhat==3)  {%>txtbtncls<%} else {%>txtbtnnoselcls<%}%>" style="border-left:none;width:30px;font-size: 15px;">
	      			<%=SystemEnv.getHtmlLabelName( 1926 ,user.getLanguage())%> <!-- 周 -->
	      		</div>
	      		<div id="showmonthbtn" unselectable="on" class="calHdBtn <% if(bywhat==2)  {%>txtbtncls<%} else {%>txtbtnnoselcls<%}%>" style="border-left:none;width:30px;font-size: 15px;">
	      			<%=SystemEnv.getHtmlLabelName( 6076 ,user.getLanguage())%> <!-- 月 -->
	      		</div>
	      		<%} %><!-- 刷新 -->
					<div id="showreflashbtn" unselectable="on" class="calHdBtn showreflashbtn" title="<%=SystemEnv.getHtmlLabelName( 354 ,user.getLanguage())%>" style="height:24px;border:none;margin-left:10px;border:none;">
					</div>
				<div class="rightBorder" style="margin-left:10px;margin-right:15px">|</div>
               </div>
			   
			<div id="editButtons1" style="float:left;min-width:122px !important;">
					<% String titlestrnow=""; 
					if(bywhat==2) {
		      			titlestrnow =SystemEnv.getHtmlLabelName( 15541 ,user.getLanguage());//本月
					}else if(bywhat==3){
						titlestrnow=SystemEnv.getHtmlLabelName( 15539 ,user.getLanguage());//本周
					}else if(bywhat==4){
						titlestrnow=SystemEnv.getHtmlLabelName( 15537 ,user.getLanguage()); //今天
					}%>
					<div id="showtodaybtn" unselectable="on" class="calHdBtn showtodaybtn" title="<%=titlestrnow%>" style="height:24px;margin-left:0px;border:none;">
		      			 
		      		</div><!-- 上一个时段 -->
		      		<div id="sfprevbtn" unselectable="on" class="calHdBtn sfprevbtn" title="<%=SystemEnv.getHtmlLabelName(33960,user.getLanguage())%>"  style="height:24px;border:none;margin-left:10px;width:23px;_width:25px;">
		      		</div>
					<input type="hidden" name="txtshow" id="hdtxtshow" />
					<div id="txtdatetimeshow" unselectable="on" class="calHdBtn txtbtncls" style="border:none;width:auto;padding-left:1px;padding-right:10px;">
						
					</div><!-- 下一个时段 -->
		      		<div id="sfnextbtn" unselectable="on" class="calHdBtn sfnextbtn" title="<%=SystemEnv.getHtmlLabelName(33961,user.getLanguage())%>"  style="height:24px;border:none;border-left:none;width:23px;_width:25px;">
		      		</div>
					
				</div>
      </div>
  <table class=MI id=AbsenceCard cellSpacing=0 cellPadding=0 style="height: 100%;position: absolute;z-index: 998;">
  		<tr style="height: 37px;"></tr>
		<tr>
			<td id="treetd" style="display:none; BORDER-top: 1px solid #d0d0d0; BORDER-LEFT: 0px;width:247px;vertical-align: top;" rowspan="2">
				
				<div id="subCompanytDiv" style="position:absolute;width:245px;min-height:300px;background:#f7f7f7;BORDER-right: 1px solid #d0d0d0;">
					<IFRAME  id="subCompanytifm"  width="100%"  frameborder=no scrolling=no src="">
				</IFRAME>
				</div>
			</td>
			<td style="BORDER-TOP: 0px; BORDER-LEFT: 0px;vertical-align: top;">
			<div id="tablediv" style="overflow-y: hidden;position: relative;width:100%">
			<div id="tableChlddiv">
				<input type="hidden" name="datenow" id="datenow" value="<%=datenow%>" />
				<table  class=M1 width="100%" border=0 cellspacing=0 cellpadding=0 Style="width:100%; font-size:8pt;table-layout:fixed">
				    <COLGROUP>
						<col width="221">
						<col width="">
				    <tr  class="thbgc">
						 	<td class="schtd" align=center style="width:220px;background:#f7f7f7;BORDER-left: 1px solid #d0d0d0;height:25px; ">
								<table height="100%" width="100%" border=0 cellspacing=0 cellpadding=0>
									<tr>
										<td width="20px" style="BORDER-bottom:0px;BORDER-LEFT: 0px">
										<button class="Browser" id=namebtn name=namebtn type="button" onclick="submit();" style="margin-top: 3px !important;"  ></button>
										</td>
										<td  width="200px" style="BORDER-bottom:0px;BORDER-LEFT: 0px">
										<INPUT id=content name=content class="searchInput" onmouseover="this.select()" onfocus="clearVal(this);" onblur="recoverVal(this);"   value="<%=content %>" style="width:180px;height:23px;border:0px;background:#f7f7f7;color:#606060" /> 
										</td>
									</tr>
								</table>
							</td>
						<%for(int i=0;i<=23;i++){%>
							<%if(i == 0) { %>
								<td class="thcls" style="BORDER-left: 1px solid #d0d0d0;" align=center><%=i%></td>
							<%}else{%>
								<td class="thcls" style="BORDER-LEFT: 0px" align=center><%=i%></td>
							<%}%>
						<%}%>
				    </tr>
				</table>
			</div>
			</div>
		</td>
	</tr>
	<tr>
		<td id="searchTd">
			<div style="height: 100%;overflow: hidden;border: 0;">
				<IFRAME name="listframe" id="listframe" style="width: 100%;height: 100%;border: 0" src="">
				</IFRAME>
			</div>
		</td>
	</tr>
</table>



	
</FORM>

<script language=javascript>
var showCnt = 0;
var diag_vote;
jQuery(document).ready(function(){
	submit();
	var cBeginDate="<%=cBeginDate%>";
	var cEndDate="<%=cEndDate%>";
	var showtime = "";
	var titletime=""; 
	
	<% if(bywhat==2) {%>
		titletime = CalDateShowMonth(new Date(Date.parse(cBeginDate.replace(/-/g,   "/"))));
		showtime = titletime;
	<% }else if(bywhat==3){%>
	    titletime = CalDateShow(new Date(Date.parse(cBeginDate.replace(/-/g,   "/"))), new Date(Date.parse(cEndDate.replace(/-/g,   "/"))), null, true);
	    showtime = CalDateShow(new Date(Date.parse(cBeginDate.replace(/-/g,   "/"))), new Date(Date.parse(cEndDate.replace(/-/g,   "/"))));
		$(".weekclass").each(function(){
			var dateStr = new Date(Date.parse($(this).attr("val").replace(/-/g,   "/")));
			$(this).html(dateFormat.call(dateStr, getymformat(dateStr, null, null, true,null, false)));
		});
	<% }else if(bywhat==4){%>
		titletime = CalDateShow(new Date(Date.parse(cBeginDate.replace(/-/g,   "/"))), null, null, true)+"&nbsp;&nbsp;<%=SystemEnv.getHtmlLabelName(1329,user.getLanguage())%>:<%=SystemEnv.getHtmlLabelName(391,user.getLanguage())%>";//单位:小时
		showtime = CalDateShow(new Date(Date.parse(cBeginDate.replace(/-/g,   "/"))));
	<%}%>

	//车辆管理不做拖拽
	//jQuery("body").bind("mousemove", function(event){createCarinfoAction.moving(event)});
	//jQuery("body").bind("mouseup", function(event){createCarinfoAction.stopDrag(event)});
	
	jQuery("#tablediv").perfectScrollbar();
	//to show day view
  $("#showdaybtn").click(function(e) {
		changeShowType(this);
		$("#txtdatetimeshow").attr("selectMode", '0');
		ShowDay();
   });
   //to show week view
   $("#showweekbtn").click(function(e) {
		changeShowType(this);
		$("#txtdatetimeshow").attr("selectMode", '0');
		ShowWeek();
   });
   //to show month view
   $("#showmonthbtn").click(function(e) {
		changeShowType(this);
		$("#txtdatetimeshow").attr("selectMode", '1');
		ShowMONTH();

   });
   //refresh current View
   $("#showreflashbtn").click(function(e){
		submit();
   });
   
  
   //go to today
   $("#showtodaybtn").click(function(e) {
   		document.frmmain.currentdate.value = "" ;
     	submit();
   });
   //previous date range
   $("#sfprevbtn").click(function(e) {
      getSubdate();

   });
   //next date range
   $("#sfnextbtn").click(function(e) {
      getSupdate();
   });
   
   $("#namebtn").live("click", function() {
      submit();
   });
   
   $("#showLayoutbtn").click(function(e) {
		showCompanyTree();
   });
    
   //Add a new car
   $("#faddbtn").click(function(e) {
   	 	onAdd();
   });
   
   	$(window).resize(function(){
   		setCalHeight(dataCount);
	});
   
    jQuery('#tablediv').perfectScrollbar();
   
   //显示时间控件 
   $("#hdtxtshow").datepickernew({ 
   	   picker: "#txtdatetimeshow", 
   	   showtarget: $("#txtdatetimeshow"),
	   onReturn:function(r){
	   		var d = CalDateShow(r);
	   		if(d && r){
	   			jQuery("#frmmain")[0].currentdate.value = dateFormat.call(r, i18n.xgcalendar.dateformat.fulldayvalue);
				submit();
				$("#hdtxtshow").val(dateFormat.call(r, i18n.datepicker.dateformat.fulldayvalue));
	    	}
	     } 
		<% if(bywhat==2) {%>
        ,selectMode:"1"
		<%}%>
   });
   
   recoverVal($GetEle("content"));
   
	var bodyheight = document.body.offsetHeight;
	$("#subCompanytDiv").height(bodyheight - 44);
	$("#subCompanytifm").height(bodyheight - 44);
   $(".thcls").css("border-bottom","1px solid #59b0f2");
   $(".schtd").css("border-bottom","1px solid #59b0f2");
   $(".schtd").css("border-left","0px");
   $(".carnames").css("border-left","0px");
   $("#txtdatetimeshow").text(showtime);
})
var enable = true;

//计算两块高度
var topHeight = 37;
var tdHeight = 26;
var dataCount = 1;
function setCalHeight(_dataCount){
	dataCount = _dataCount;
	var docHeight = $(document.body).height();
	var maxHeight = docHeight-topHeight-docHeight*40/100;
	var currHeight = tdHeight*(dataCount+1)+1;
	if(currHeight>maxHeight){
		$("#tablediv").css("height",maxHeight);
		$("#searchTd").css("height",docHeight-maxHeight-topHeight);
	}else{
		$("#tablediv").css("height",currHeight);
		$("#searchTd").css("height",docHeight-currHeight-topHeight);
	}
}

function closeDialog(){
	diag_vote.close();
}

function closeDlgARfsh(){
	diag_vote.close();
	submit();
}

function dataRfsh(){
	submit();
}

function showCompanyTree(){
	if($("#treetd").css("display")=="none"){
		$("#treetd").css("display","");
		$("#showLayoutbtn").removeClass("showLayoutbtnT");
		$("#showLayoutbtn").addClass("showLayoutbtnO");
	}else{
		$("#treetd").css("display","none");
		$("#showLayoutbtn").removeClass("showLayoutbtnO");
		$("#showLayoutbtn").addClass("showLayoutbtnT");
	}
	if($("#subCompanytifm").attr("src") == ""){
		$("#subCompanytifm").attr("src","/car/CarSubCompanyTree.jsp");
	}
	setWindowSize(document);
}

function changeShowType(obj){
	if($("#showdaybtn").hasClass("txtbtncls")){
		$("#showdaybtn").removeClass("txtbtncls");
	}
	if(!$("#showdaybtn").hasClass("txtbtnnoselcls")){
		$("#showdaybtn").addClass("txtbtnnoselcls");
	}
	
	if($("#showweekbtn").hasClass("txtbtncls")){
		$("#showweekbtn").removeClass("txtbtncls");
	}
	if(!$("#showweekbtn").hasClass("txtbtnnoselcls")){
		$("#showweekbtn").addClass("txtbtnnoselcls");
	}
	
	if($("#showmonthbtn").hasClass("txtbtncls")){
		$("#showmonthbtn").removeClass("txtbtncls");
	}
	if(!$("#showmonthbtn").hasClass("txtbtnnoselcls")){
		$("#showmonthbtn").addClass("txtbtnnoselcls");
	}
	
	if(!$(obj).hasClass("txtbtncls")){
		$(obj).addClass("txtbtncls");
	}
	if($(obj).hasClass("txtbtnnoselcls")){
		$(obj).removeClass("txtbtnnoselcls");
	}
}


function setTDWidth(cnt){

}

function showCarinfoList(resourceid,datasqlwhere,event){
	event = jQuery.event.fix(event);
	var startElement = event.target;
	clearVal($GetEle("content"));
	if(jQuery(startElement).parent("td.carnames").hasClass("car-selecting")){
		jQuery(startElement).parent("td.carnames").removeClass("car-selecting");
		$("#listframe").attr("src","/formmode/search/CustomSearchBySimple.jsp?customid=<%=customSearchId %>&datasqlwhere="+datasqlwhere);
	} else{
		$(".car-selecting").each(function(){
			$(this).removeClass("car-selecting");
		});
		jQuery(startElement).parent("td.carnames").addClass("car-selecting");
		$("#listframe").attr("src","/formmode/search/CustomSearchBySimple.jsp?customid=<%=customSearchId %>&datasqlwhere="+datasqlwhere);
	}
	
	recoverVal($GetEle("content"));
		
}

function CalDateShow(startday, endday, isshowtime, isshowweek) {
  if (!endday) {
      return dateFormat.call(startday, getymformat(startday,null,isshowtime,isshowweek));
  } else {
      var strstart= dateFormat.call(startday, getymformat(startday, null, isshowtime, isshowweek));
			var strend=dateFormat.call(endday, getymformat(endday, startday, isshowtime, isshowweek));
			var join = (strend!=""? " - ":"");
			return [strstart,strend].join(join);
  }
}

function CalDateShowMonth(startday) {
    return dateFormat.call(startday, getymformatMonth(startday));
}

function getymformatMonth(date) {
	var a = [];
	a.push(i18n.xgcalendar.dateformat.yM);
	return a.join("");
}

function getymformat(date, comparedate, isshowtime, isshowweek, showcompare, ishowyear) {
            var showyear = isshowtime != undefined ? (date.getFullYear() != new Date().getFullYear()) : true;
            if(ishowyear != undefined && ishowyear == false){
            	showyear = false;
            }
            var showmonth = true;
            var showday = true;
            var showtime = isshowtime || false;
            var showweek = isshowweek || false;
            if (comparedate) {
                showyear = comparedate.getFullYear() != date.getFullYear();
                if (comparedate.getFullYear() == date.getFullYear() &&
					date.getMonth() == comparedate.getMonth() &&
					date.getDate() == comparedate.getDate()
					) {
                    showyear = showmonth = showday = showweek = false;
                }
            }

            var a = [];
            if (showyear) {
                a.push(i18n.xgcalendar.dateformat.fulldayshow)
            } else if (showmonth) {
                a.push(i18n.xgcalendar.dateformat.Md3)
            } else if (showday) {
                a.push(i18n.xgcalendar.dateformat.day);
            }
            a.push(showweek ? " (W)" : "", showtime ? " HH:mm" : "");
            return a.join("");
        }


dateFormat = function(format) {
			var __WDAY = new Array(i18n.xgcalendar.dateformat.sun, i18n.xgcalendar.dateformat.mon, i18n.xgcalendar.dateformat.tue, i18n.xgcalendar.dateformat.wed, i18n.xgcalendar.dateformat.thu, i18n.xgcalendar.dateformat.fri, i18n.xgcalendar.dateformat.sat);                                                                                                                                                                      
			var __MonthName = new Array(i18n.xgcalendar.dateformat.jan, i18n.xgcalendar.dateformat.feb, i18n.xgcalendar.dateformat.mar, i18n.xgcalendar.dateformat.apr, i18n.xgcalendar.dateformat.may, i18n.xgcalendar.dateformat.jun, i18n.xgcalendar.dateformat.jul, i18n.xgcalendar.dateformat.aug, i18n.xgcalendar.dateformat.sep, i18n.xgcalendar.dateformat.oct, i18n.xgcalendar.dateformat.nov, i18n.xgcalendar.dateformat.dec); 
			
            var o = {
                "M+": this.getMonth() + 1,
                "d+": this.getDate(),
                "h+": this.getHours(),
                "H+": this.getHours(),
                "m+": this.getMinutes(),
                "s+": this.getSeconds(),
                "q+": Math.floor((this.getMonth() + 3) / 3),
                "w": "0123456".indexOf(this.getDay()),
                "W": __WDAY[this.getDay()],
                "L": __MonthName[this.getMonth()] //non-standard
            };
            if (/(y+)/.test(format)) {
                format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(format))
                    format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
            }
            return format;
};

function CreateCarinfoAction()
{
	this.carid;
	this.active;
	this.startTime;
	this.endTime;
}
CreateCarinfoAction.prototype.startDrag = function(event)
{
	this.carid = "";
	this.startTime = "";
	this.endTime = "";
	this.active = false;
	event = jQuery.event.fix(event);
	if(enable && (0 == event.button || 1 == event.button))
	{
		var startElement = event.target;
		this.carid = startElement.id;
		this.startTime =jQuery(startElement).attr("target");
		this.endTime = jQuery(startElement).attr("target");
		startElement.className = "ui-selecting";
		jQuery(startElement).css("background-color","#E1ECFF");
		this.active = true;
	}
}
CreateCarinfoAction.prototype.moving = function(event)
{
	if(enable && this.active)
	{
		event = jQuery.event.fix(event);
		var movingElement = event.target;
		var pElement = movingElement.parentNode;
		if(pElement.tagName=="TR"&&pElement.className=="selectable")
		{
			var carid = movingElement.id;
			if(carid==this.carid)
			{
				this.carid = movingElement.id;
				this.endTime = jQuery(movingElement).attr("target");
				movingElement.className = "ui-selecting";
				jQuery(movingElement).css("background-color","#E1ECFF");
			}
		}
	}
}
CreateCarinfoAction.prototype.stopDrag = function(event)
{
	event = jQuery.event.fix(event);
	if(enable && this.active)
	{
		this.createCarinfo();
		this.active = false;
		resetCarinfo();
	}
}
CreateCarinfoAction.prototype.createCarinfo = function()
{
    //TODO 创建车辆使用
    var url = "/car/NewCaruseTab.jsp";
	url +="?carid="+this.carid;
	var currentdate = document.frmmain.currentdate.value;
	url +="&startdate="+currentdate;
	url +="&enddate="+currentdate;
	var tempStartTime = this.startTime;
	var tempEndTime = this.endTime;
	if(parseInt(tempStartTime)>parseInt(tempEndTime))
	{
		var temp = this.startTime;
		this.startTime = this.endTime;
		this.endTime = temp;
	}
	if(this.startTime.length==1)
	{
		this.startTime = "0"+this.startTime;
	}
	this.startTime += ":00";
	if(this.endTime.length==1)
	{
		this.endTime = "0"+this.endTime;
	}
	this.endTime += ":59";
	url +="&starttime="+this.startTime;
	url +="&endtime="+this.endTime;
	newCarinfo(url);
}

function onAdd() {
	var url = "<%=createUrl %>";
   	newResourceinfo(url);
}

function newResourceinfo(url){
    if(window.top.Dialog){
		diag_vote = new window.top.Dialog();
	} else {
		diag_vote = new Dialog();
	}
	diag_vote.currentWindow = window;
	diag_vote.Width = 800;
	diag_vote.Height = 550;
	diag_vote.Modal = true;
	diag_vote.maxiumnable = true;
	diag_vote.Title = "<%=SystemEnv.getHtmlLabelName(83981,user.getLanguage())+modename %>";//新增用车申请
	diag_vote.URL = url;
	diag_vote.show();
}

var createCarinfoAction = new CreateCarinfoAction();
function checkCarinfo()
{
	var tds = document.getElementsByTagName("TD");
	for(var i=0;i<tds.length;i++)
	{
		var cname = tds[i].className;
		if(cname=="ui-selecting")
		{
			var bc = tds[i].bgColor;
			if(bc !=""&&bc != "#f5f5f5")
			{
				return "1";
			}
		}
	}
}
function resetCarinfo()
{
	var tds = document.getElementsByTagName("TD");
	for(var i=0;i<tds.length;i++)
	{
		var cname = tds[i].className;
		if(cname=="ui-selecting")
		{
			tds[i].className = "";
			jQuery(tds[i]).css("background-color","");
		}
	}
}
function getSubdate() {
	document.frmmain.movedate.value = "-1" ;
	submit() ;
}
function getSupdate() {
	document.frmmain.movedate.value = "1" ;
	submit();
}
function ShowYear() {
	document.frmmain.bywhat.value = "1" ;
	document.frmmain.currentdate.value = "" ;
	submit();
}
function ShowMONTH() {
	document.frmmain.bywhat.value = "2" ;
	document.frmmain.currentdate.value = "" ;
	submit();
}
function ShowWeek() {
	document.frmmain.bywhat.value = "3" ;
	document.frmmain.currentdate.value = "" ;
	submit();
}
function ShowDay() {
	document.frmmain.bywhat.value = "4" ;
	document.frmmain.currentdate.value = "" ;
	submit();
}
function doCancel(id){
	document.frmmain.action="CarUseInfo.jsp?operation=cancel&id="+id;
	submit();
}

function setSubcompany(subid){
	$("#subids").val(subid);
	onSubChange();
}

function onSubChange(){
	submit();
}

function selectRoot(){
	$("#subids").val("");
	onSubChange();
}

function submit(){
	clearVal($GetEle("content"));
	getResourceInfo("");
}

function onSearch(){
	var content = $("#content").val();
	if(content!=""){
		clearVal($GetEle("content"));
		getResourceInfo(content);
	}
}
//zwbo 添加了sqlwhere参数
function getResourceInfo(content){
    $.post("/formmode/view/ModeViewByResourceAjax.jsp",{resourceId:"<%=resourceId %>",bywhat:$GetEle("bywhat").value,currentdate:$GetEle("currentdate").value,movedate:$GetEle("movedate").value,content:content,subids:$GetEle("subids").value,resourcesqlwhere:"<%=xssUtil.put(resourcesqlwhere) %>",datasqlwhere:"<%=xssUtil.put(datasqlwhere) %>",sqlwhere:"<%=xssUtil.put(sqlwhere) %>",content:"<%=content %>"},function(datas){
		jQuery("#tableChlddiv").html("");
		jQuery("#tableChlddiv").append(datas);
		afterLoadDate();
	});
}


function setWindowSize(_document){
	if(!!_document)_document = document;
	var bodyheight = _document.body.offsetHeight;
	var listframeh = jQuery("#listdiv",window.frames["listframe"].document).height() + 10;
	jQuery("#listframe").height(listframeh);
	var bottomheight = listframeh+2;
	jQuery("#CaruseListDiv").height(listframeh+2);
	
	if(bottomheight>0){
		bottomheight = 51 + bottomheight;
	}
	var tdhm1 = jQuery(".M1").height();
	if(jQuery(".M1").width() > jQuery("#tablediv").width()){
		tdhm1 = tdhm1 + 16;
	}
	
	var cah = bodyheight-bottomheight;
	jQuery("#tablediv").css("height",tdhm1 > cah ? cah:tdhm1+2);
	jQuery("#tablediv").perfectScrollbar('update');
	jQuery(".ps-scrollbar-y").position.top=jQuery("#tablediv").position.top;
}

<!--

function clearVal(obj){
	if(obj.value=='<%=SystemEnv.getHtmlLabelName(82529,user.getLanguage()) %>'){ //搜索
		obj.value="";
		obj.style.color="#606060";
	}
}

function recoverVal(obj){
    
	if(obj.value==''||obj.value==null){
	    //alert(obj.value);
		obj.value="<%=SystemEnv.getHtmlLabelName(82529,user.getLanguage()) %>";//搜索
		obj.style.color="#d0d0d0";
	}
}

//-->

</script>


</body>
<SCRIPT language="javascript" defer="defer" src="/js/datetime_wev8.js"></script>
<SCRIPT language="javascript" defer="defer" src="/js/JSDateTime/WdatePicker_wev8.js"></script>
<SCRIPT language="javascript" src="/js/selectDateTime_wev8.js"></script>
<script language="javascript" src="/car/carbase_wev8.js"></script>
</html>