2018-06-03 22:26:41 +08:00

302 lines
12 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBeginMD.jsp"%><%
/*
Describe: --增加模板对应业务类型
Input Param:
sEDocNo--当前电子模板编号
*/
String PG_TITLE = "业务类型选择"; // 浏览器窗口标题 <title> PG_TITLE </title>
//定义变量
String sEDocType = "";//--电子合同类型
//获得页面参数,电子合同模板编号
String sEDocNo = CurPage.getParameter("EDocNo");
sEDocType = CurPage.getParameter("EDocType");
String sSql = "select EDocType from O where EDocNo=:EDocNo";
BizObject boDef = JBOFactory.createBizObjectQuery("jbo.edoc.EDOC_DEFINE", sSql).setParameter("EDocNo", sEDocNo).getSingleResult(false);
//获得业务类型编号、业务类型名称
if(boDef != null){
sEDocType = DataConvert.toString(boDef.getAttribute("EDocType").getString());
}
%>
<script type="text/javascript">
var availableReportCaptionList = new Array;
var availableReportNameList = new Array;
var selectedReportCaptionList = new Array;
var selectedReportNameList = new Array;
<%
int num = 0;
BizObjectQuery bq = null;
//借款类合同
if (sEDocType.equals("010")) {
sSql = " select TypeNo as V.ItemNo,TypeName as V.ItemName from O "+
" where TypeSortNo <> '' and TypeNo not in (select ER.TypeNo from jbo.edoc.EDOC_RELATIVE ER where ER.EDocNo<>'' ) order by TypeNo";
bq = JBOFactory.createBizObjectQuery("jbo.prd.BUSINESS_TYPE", sSql);
}
//担保类合同
if (sEDocType.equals("020")) {
sSql = " select ItemNo,ItemName from O "+
" where CodeNo='GuarantyType' and ItemNo not in (select ER.TypeNo from jbo.edoc.EDOC_RELATIVE ER where ER.EDocNo<>'' ) order by ItemNo";
bq = JBOFactory.createBizObjectQuery("jbo.sys.CODE_LIBRARY", sSql);
}
num = 0;
List<BizObject> list1 = bq.getResultList(false);
for(BizObject bo : list1){
out.println("availableReportCaptionList[" + num + "] = '" + bo.getAttribute("ItemName").getString() + "';\r");
out.println("availableReportNameList[" + num + "] = '" + bo.getAttribute("ItemNo").getString() + "';\r");
num++;
}
sSql = " select TypeNo,TypeName from O where EDocNo=:EDocNo order by TypeNo";
List<BizObject> list2 = JBOFactory.createBizObjectQuery("jbo.edoc.EDOC_RELATIVE", sSql).setParameter("EDocNo", sEDocNo).getResultList(false);
num = 0;
for(BizObject bo : list2){
out.println("selectedReportCaptionList[" + num + "] = '" + bo.getAttribute("TypeName").getString() + "';\r");
out.println("selectedReportNameList[" + num + "] = '" + bo.getAttribute("TypeNo").getString() + "';\r");
num++;
}
num = 0;
%>
</script>
<html>
<head>
<title>选取业务类型</title>
</head>
<body bgcolor="#E4E4E4">
<form name="analyseterm" >
<table align="center" width="100%">
<tr>
<td>
<table width='100%' border='1' cellpadding='0' cellspacing='5' bgcolor='#DDDDDD'>
<tr>
<td colspan="4">
<span>选取要增加的业务类型</span>
</td>
</tr>
<tr>
<td bgcolor='#DDDDDD'>
<span class='dialog-label'>可选取的业务类型列表</span>
</td>
<td bordercolor='#DDDDDD'></td>
<td bgcolor='#DDDDDD'>
<span class='dialog-label'>已选取的业务类型列表</span>
</td>
<td></td>
</tr>
<tr>
<td align='center'>
<select name='report_available' onchange='selectionChanged(document.forms["analyseterm"].elements["report_available"],document.forms["analyseterm"].elements["report_chosen"]);' size='12' style='width:100%;' multiple='true'>
</select>
</td>
<td width='1' align='center' valign='middle' bordercolor='#DDDDDD'>
<img name='movefrom_report_available' onmousedown='pushButton("movefrom_report_available",true);' onmouseup='pushButton("movefrom_report_available",false);' onmouseout='pushButton("movefrom_report_available",false);' onclick='moveSelected(document.forms["analyseterm"].elements["report_available"],document.forms["analyseterm"].elements["report_chosen"]);updateHiddenChooserField(document.forms["analyseterm"].elements["report_chosen"],document.forms["analyseterm"].elements["report"]);' border='0' src='<%=CurConfig.getImagePath()%>/chooser_orange/arrowRight_disabled.gif' alt='Add selected items' />
<br><br>
<img name='movefrom_report_chosen' onmousedown='pushButton("movefrom_report_chosen",true);' onmouseup='pushButton("movefrom_report_chosen",false);' onmouseout='pushButton("movefrom_report_chosen",false);' onclick='moveSelected(document.forms["analyseterm"].elements["report_chosen"],document.forms["analyseterm"].elements["report_available"]);updateHiddenChooserField(document.forms["analyseterm"].elements["report_chosen"],document.forms["analyseterm"].elements["report"]);' border='0' src='<%=CurConfig.getImagePath()%>/chooser_orange/arrowLeft_disabled.gif' alt='Remove selected items' />
</td>
<td align='center'>
<select name='report_chosen' onchange='selectionChanged(document.forms["analyseterm"].elements["report_chosen"],document.forms["analyseterm"].elements["report_available"]);' size='12' style='width:100%;' multiple='true'>
</select>
<input type='hidden' name='report' value=''>
</td>
<td width='1' align='center' valign='middle' bordercolor='#DDDDDD'>
<img name='shiftup_report_chosen' onmousedown='pushButton("shiftup_report_chosen",true);' onmouseup='pushButton("shiftup_report_chosen",false);' onmouseout='pushButton("shiftup_report_chosen",false);' onclick='shiftSelected(document.forms["analyseterm"].elements["report_chosen"],-1);updateHiddenChooserField(document.forms["analyseterm"].elements["report_chosen"],document.forms["analyseterm"].elements["report"]);' border='0' src='<%=CurConfig.getImagePath()%>/chooser_orange/arrowUp_disabled.gif' alt='Shift selected items down' />
<br><br>
<img name='shiftdown_report_chosen' onmousedown='pushButton("shiftdown_report_chosen",true);' onmouseup='pushButton("shiftdown_report_chosen",false);' onmouseout='pushButton("shiftdown_report_chosen",false);' onclick='shiftSelected(document.forms["analyseterm"].elements["report_chosen"],1);updateHiddenChooserField(document.forms["analyseterm"].elements["report_chosen"],document.forms["analyseterm"].elements["report"]);' border='0' src='<%=CurConfig.getImagePath()%>/chooser_orange/arrowDown_disabled.gif' alt='Shift selected items up' />
</td>
</tr>
<tr style='display:none' height=1>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan=4>
<table width="100%">
<tr>
<td width="30%" align="right">
<%=new Button("&nbsp;恢&nbsp;复&nbsp;","恢复","javascript:doDefault();","","").getHtmlText()%>
</td>
<td width="40%" align="center">
<%=new Button("&nbsp;确&nbsp;定&nbsp;","确定","javascript:doQuery();","","").getHtmlText()%>
</td>
<td width="30%" align="left">
<%=new Button("&nbsp;取&nbsp;消&nbsp;","取消","parent.AsDialog.ClosePage('_none_');","","").getHtmlText()%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
<script type="text/javascript">
function cloneOption(option){
var out = new Option(option.text,option.value);
out.selected = option.selected;
out.defaultSelected = option.defaultSelected;
return out;
alert(out);
}
function shiftSelected(chosen,howFar){
var opts = chosen.options;
var newopts = new Array(opts.length);
var start, end, incr;
if(howFar > 0){
start = 0;
end = newopts.length;
incr = 1;
}else{
start = newopts.length - 1;
end = -1;
incr = -1;
}
for(var sel = start; sel != end; sel += incr){
if (opts[sel].selected) {
setAtFirstAvailable(newopts, cloneOption(opts[sel]), sel + howFar, -incr);
}
}
for(var uns = start; uns != end; uns += incr){
if (!opts[uns].selected) {
setAtFirstAvailable(newopts, cloneOption(opts[uns]), start, incr);
}
}
opts.length = 0;
for(var i=0; i<newopts.length; i++){
opts[opts.length] = newopts[i];
}
}
function setAtFirstAvailable(array,obj,startIndex,incr) {
if (startIndex < 0) startIndex = 0;
if (startIndex >= array.length) startIndex = array.length -1;
for(var xxx=startIndex; xxx>= 0 && xxx<array.length; xxx += incr){
if (array[xxx] == null) {
array[xxx] = obj;
return;
}
}
}
function moveSelected(from,to) {
newTo = new Array();
for(var i=0; i<to.options.length; i++){
newTo[newTo.length] = cloneOption(to.options[i]);
newTo[newTo.length-1].selected = false;
}
for(i=0; i<from.options.length; i++){
if (from.options[i].selected) {
newTo[newTo.length] = cloneOption(from.options[i]);
from.options[i] = null;
i--;
}
}
to.options.length = 0;
for(i=0; i<newTo.length; i++){
to.options[to.options.length] = newTo[i];
}
selectionChanged(to,from);
}
function updateHiddenChooserField(chosen,hidden){
hidden.value='';
var opts = chosen.options;
for(var i=0; i<opts.length; i++){
hidden.value = hidden.value + opts[i].value+'\n';
}
}
function selectionChanged(selectedElement,unselectedElement){
for(var i=0; i<unselectedElement.options.length; i++){
unselectedElement.options[i].selected=false;
}
form = selectedElement.form;
enableButton("movefrom_"+selectedElement.name,(selectedElement.selectedIndex != -1));
enableButton("movefrom_"+unselectedElement.name,(unselectedElement.selectedIndex != -1));
enableButton("shiftdown_"+selectedElement.name,(selectedElement.selectedIndex != -1));
enableButton("shiftup_"+selectedElement.name,(selectedElement.selectedIndex != -1));
enableButton("shiftdown_"+unselectedElement.name,(unselectedElement.selectedIndex != -1));
enableButton("shiftup_"+unselectedElement.name,(unselectedElement.selectedIndex != -1));
}
function enableButton(buttonName,enable){
var img = document.images[buttonName];
if (img == null) return;
var src = img.src;
var und = src.lastIndexOf("_disabled.gif");
if (und != -1){
if(enable) img.src = src.substring(0,und)+".gif";
}else{
if(!enable){
var gif = src.lastIndexOf("_clicked.gif");
if (gif == -1) gif = src.lastIndexOf(".gif");
img.src = src.substring(0,gif)+"_disabled.gif";
}
}
}
function pushButton(buttonName,push){
var img = document.images[buttonName];
if (img == null) return;
var src = img.src;
var und = src.lastIndexOf("_disabled.gif");
if (und != -1) return false;
und = src.lastIndexOf("_clicked.gif");
if (und == -1) {
var gif = src.lastIndexOf(".gif");
if (push) img.src = src.substring(0,gif)+"_clicked.gif";
}else{
if (!push) img.src = src.substring(0,und)+".gif";
}
}
//---------------------定义按钮事件--------------------//
/*~[Describe=确定;InputParam=无;OutPutParam=无;]~*/
function doQuery(){
var vReturn = "";
var vReportCount = analyseterm.report_chosen.length;
var vTypeNo = new Array;
for(var i=0; i<vReportCount;i++ ){
vTypeNo[i] = analyseterm.report_chosen.options[i].value;
}
//排序
for(var i=0; i<vReportCount -1;i++){
for(var j=i+1;j<vReportCount;j++){
if(vTypeNo[i]> vTypeNo[j]){
vTempTypeNo = vTypeNo[i];
vTypeNo[i] = vTypeNo[j];
vTypeNo[j] = vTempTypeNo;
}
}
}
for(var i=1; i<=vReportCount; i++){
vReturn += "@" + vTypeNo[i - 1];
}
parent.AsDialog.ClosePage(vReturn);
}
/*~[Describe=恢复;InputParam=无;OutPutParam=无;]~*/
function doDefault(){
analyseterm.report_available.options.length = 0;
analyseterm.report_chosen.length = 0;
var j = 0;
for(var i = 0; i < availableReportNameList.length; i++){
eval("analyseterm.report_available.options[" + j + "] = new Option(availableReportCaptionList[" + i + "], availableReportNameList[" + i + "])");
j++;
}
j = 0;
for(var i = 0; i < selectedReportNameList.length; i++){
eval("analyseterm.report_chosen.options[" + j + "] = new Option(selectedReportCaptionList[" + i + "], selectedReportNameList[" + i + "])");
j++;
}
}
doDefault();
</script>
<%@ include file="/IncludeEnd.jsp"%>