<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SeaExportInfoBusinessSur.aspx.cs" Inherits="DSWeb.Shipping.SeaExportInfoBusinessSur" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>业务函电——电放保函</title>
    <link rel="STYLESHEET" type="text/css" href="../theme/page.css"/>
    <link href="../theme/tab.css" type="text/css" rel="stylesheet" />
    <link rel="STYLESHEET" type="text/css" href="../theme/button/default/Fee.css"/>
    <!--自定义下拉框-->
    <link href="../theme/style.css" type="text/css" rel="Stylesheet" media="screen"/>
    <link href="../theme/dhtmlxcombo.css" type="text/css" rel="Stylesheet" media="screen"/>
    <script type="text/javascript" src="../js/dhtmlxcommon.js"></script>
    <script type="text/javascript" src="../js/dhtmlxcombo.js"></script>
    <script type="text/javascript" src="../js/dhtmlxcombo_whp.js"></script>
    <script src="../js/json2.js" type="text/javascript"></script>
    <script type="text/javascript">
       window.dhx_globalImgPath="../images/";
    </script>	
    <style type="text/css">
        .style1
        {
            width: 100px;
            font-size:12px;
        }
    </style>
    <!--按钮条-->
    <style type="text/css">
        .btn-content0{
	        width:100%;
	        height:30px;
            background:url("../images/content-header.gif");
            cursor:default;
            }
	</style>
    <script type="text/javascript" language=javascript> 
        var isChangeds;
        
        function $(id)
        {
            return document.getElementById(id);
        }        
        function QueryString()
        {            
           var name,value,i;//构造参数对象并初始化
           var str=location.href;//获得浏览器地址栏URL串
           var num=str.indexOf("?")
           str=str.substr(num+1);//截取“?”后面的参数串
           var arrtmp=str.split("&");//将各参数分离形成参数数组
           for(i=0;i < arrtmp.length;i++)
           {
                num=arrtmp[i].indexOf("=");
                if(num>0)
                {
                   name=arrtmp[i].substring(0,num);//取得参数名称
                   value=arrtmp[i].substr(num+1);//取得参数值
                   this[name]=value;//定义对象属性并初始化
                }
            }
        }   
        function isChanged()
        {
            /*
            var qs = new QueryString();//调用:
            var handle = qs.handle;
            */
            isChangeds = 1;
	    }
        window.onbeforeunload = function unloadConfirm()
        {            
            if((event.clientX>document.body.clientWidth&&event.clientY<0)||event.altKey)  
            {         
                 //alert("关闭触发");

                //if(isChangeds == 1)
                //{
                    if(confirm('是否需要保存数据?'))
                    {                    
                        document.getElementById("ibEnter").click();
                        window.close();                    
                    }
                    else
                    {
                        window.close();
                    }
                //}
            }
        }
        function printAction()
        {
            var strBSNO = "";
            strBSNO = $("hdGid").value;
//            var openSet = "height=680, width=1050, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
//            var openType = "_blank";
//            var openUrl = "../Reports/SeaExportReport.aspx?bsno="+strBsno;
//            window.open (openUrl,openType,openSet);
            var printUrl = "";
            var companyID = "";
            var typeName = "SEAEBUSINESSSUR";
            var dbSourceID = "";
            var userID = "";
            
            var url = "../Reports/ReportService.aspx?handle=printseaebusinesssur&bsno="+strBSNO+"&val="+newGuid();
			
			var loader = dhtmlxAjax.getSync(url);
			var reportVal = loader.xmlDoc.responseText;
			var reportObj = null;
			
			if(reportVal != ""){
			    reportObj = eval('(' + reportVal + ')');
			    if(reportObj.reports.length > 0){
			        if(reportObj.reports[0].compid != ""){
			            companyID = reportObj.reports[0].compid;
			        }
			        if(reportObj.reports[0].sourceid != ""){
			            dbSourceID = reportObj.reports[0].sourceid;
			        }
			        if(reportObj.reports[0].compid != ""){
			            userID = reportObj.reports[0].userid;
			        }
			        printUrl = "print://?comp="+companyID+"&type="+typeName+"&dbid="+dbSourceID+"&uid="+userID;//alert(printUrl);

                    window.location.href = window.location.href;
                    location.href = printUrl;
			    }
			    
			}else{
			    alert("没有要打印的报表");
			    return;
			}
        } 
        function newGuid(){
	        var guid = "";
            for (var i = 1; i <= 32; i++){
              var n = Math.floor(Math.random()*16.0).toString(16);
               guid +=    n;
              if((i==8)||(i==12)||(i==16)||(i==20))
                 guid += "-";
             }
            return guid.toUpperCase();
	    }        
    </script>
    <script type="text/javascript">
         function reloadParent(strBSNO,strLEID)
         {     
            /*
            alert("成功提交!");
            window.opener.location.reload();
            history.back();
            $("hdGid").value = strLEID;
            $("hdEnter").value = "0";
            postEnterTopCtn();
            */
            
             //alert("strBSNO="+strBSNO);
             var parentObj = window.parent.location;
             var oldUrl = parentObj.href;             
             var idIndex = oldUrl.indexOf("&leid=&");//alert("1."+oldUrl+","+idIndex);
             //
             var newUrl = "";
             if(idIndex <= 0)
             {
                 newUrl = oldUrl.substring(0,idIndex+4);//alert("2."+oldUrl.substring(0,idIndex));
                 window.parent.opener.location.href = window.parent.opener.location.href;
                 parentObj.href = newUrl+strBSNO;
             }
             else
             {
                 var handleIndex = oldUrl.indexOf("handle=");
                 newUrl = oldUrl.substring(0,handleIndex);//alert("3."+handleIndex+","+newUrl);
                 window.parent.opener.location.href = window.parent.opener.location.href;
                 parentObj.href = newUrl+"handle=edit&leid="+strLEID+"&id="+strBSNO;
             }        
             //            
             alert("成功提交!");
             
         }
    </script>
</head>
<body style="background-color: #ECF2FF;">
    <form id="form1" runat="server">    
    <div style="width:100%;vertical-align:text-bottom;" class="btn-content0">  
        <div class="btn-blank"></div>
        <div  class="xbtn-img">
            <asp:ImageButton ID="ibEnter" runat="server" onclick="btnEnter_Click" ToolTip="保存" ImageUrl="~/images/icons/save.gif" CssClass="btnimg"/>
        </div>
        <div  class="xbtn-img">
            <div class="btnimg"><img id=imgPrint runat=server src="../images/icons/print.gif" style="width:16px;" title="报表打印" onclick="printAction()"/></div>
        </div>
    </div>
    <div style="float:left;">
<!-- 选项卡开始 -->
  <div class="nTab">
    <!-- 内容开始 -->
    <div class="TabContent">
      <div>
            <table width="100%">
                <tr>
                    <td class="style1">TO</td>
                    <td colspan=3>
                        <asp:TextBox ID="tbTO" runat="server" CssClass="txtTab" MaxLength="60"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">ATTN</td>
                    <td colspan=3>
                        <asp:TextBox ID="tbATTN" runat="server" CssClass="txtTab" MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">FM</td>
                    <td colspan=3>
                        <asp:TextBox ID="tbFM" runat="server" CssClass="txtTab" MaxLength="20"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan=4 align="center" height="10"><hr color="#96B3DD" /></td>
                </tr>
                <tr>
                    <td class="style1">致:</td>
                </tr>
                <tr>
                    <td class="style1">对下述货物</td>
                </tr>
                <tr>
                    <td class="style1">船名/航次</td>
                    <td width=40%>
                        <asp:TextBox ID="tbVESSELVOYNO" runat="server" CssClass="txtTab" MaxLength="100"></asp:TextBox>
                    </td>
                    <td class="style1" align=right>主提单号</td>
                    <td width=40%>
                        <asp:TextBox ID="tbMBLNO" runat="server" CssClass="txtTab" MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">装货港</td>
                    <td width=40%>
                        <asp:TextBox ID="tbPORTLOAD" runat="server" CssClass="txtTab" MaxLength="30"></asp:TextBox>
                    </td>
                    <td class="style1" align=right>卸货港</td>
                    <td width=40%>
                        <asp:TextBox ID="tbPORTDISCHARGE" runat="server" CssClass="txtTab" MaxLength="30"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <table width="100%">
                <tr>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text="我司申请贵司给予办理电报放货事项,收货人如下:" CssClass="cssfont"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="tbCONSIGNEE" runat="server" CssClass="txtTab" TextMode="MultiLine" Height=100px style="overflow-y:auto;height:100px;" MaxLength="600" Width=100%></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        <asp:Label ID="Label2" runat="server" Text="担保条款(详见报表)" CssClass="cssfont"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="style1">备注</td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="tbREMARK" runat="server" CssClass="txtTab" TextMode="MultiLine" Height=100px style="overflow-y:auto;height:100px;" MaxLength="600"></asp:TextBox>
                    </td>
                </tr>
            </table>
      </div>
      </div>
    </div>
  </div>   
<div>  
    <input type="hidden" id="hdGid" runat="server"/> 
</div> 
<div style="height:200px"></div>
    </form>
</body>
</html>