<%--
        Document   : InsuranceAddition
        Created on : Mar 15, 2016, 3:46:48 PM
        Author     : Kaushik
    --%>

    <%@page import="DataEntryBean.customerEnquiryBean"%>
    <%@page import="java.sql.ResultSet"%>

    <html>
        <head>
        <title>Insurance Addition</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <%-- <link rel="shortcut icon" href="img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />--%>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
        <script type="text/javascript" src="/PacsApplication/bootstrap/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="/PacsApplication/bootstrap/js/bootstrap.js"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/bootstrap/css/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/bootstrap/css/bootstrap.css" />
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
               <style>

        legend.scheduler-border {

            text-align: left !important;
            width:inherit; /* Or auto */

            border-bottom:none;
            padding: 8px;
            border-radius: 20px;
            background-color: #006600;
            color: white
        }
        fieldset.scheduler-border {
            border: 5px groove #ddd !important;
            padding: 0 1.4em 1.4em 1.4em !important;
            margin: 0 0 1.5em 0 !important;
            -webkit-box-shadow:  0px 0px 0px 0px #000;
            box-shadow:  0px 0px 0px 0px #000;
            border-color: black;
            background-image: url('/PacsApplication/img/download.jpg');
            border-width: 3px
        }

    </style>
        </head>
        <body  onload="noBack()">

            <script type="text/javascript">
                function noBack()
                {
                    window.history.forward();
                }

                function popup_CIF(width, height ,cifNumber) {
                    if (window.innerWidth) {
                        LeftPosition = (window.innerWidth - width) / 2;
                        TopPosition = ((window.innerHeight - height) / 2) - 20;
                    }
                    else {
                        LeftPosition = (parseInt(window.screen.width) - width) / 2;
                        TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                    }
                    attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                    var screenName = "InsuranceAddition.jsp";
                    var lovKey = "CifIns";
                    popWin = open('CommonSearchInfoLOVNew.jsp?cifNumber=' + cifNumber +
                        '&screenName=' + screenName + '&lovKey=' + lovKey, 'CifIns', attr);
                    popWin.focus();
                }
              
                function submitform(insuranceForm)
                {
                     if (insuranceForm.tranType.value == "" )
                    {
                        alert("Please select the Type of Operation.");
                        insuranceForm.tranType.focus();
                        return false;
                    }
                    if (insuranceForm.custId.value == "" || insuranceForm.custName.value == "" )
                    {
                        alert("Search Customer Number/Name first.");
                        $('#custId').focus();
                        return false;
                    }
                    if($('#insNoEx').val() == "")
                    {
                        alert("Please search the customer number before proceeding");
                        $('#custId').focus();
                        return false;
                    }
                    if (insuranceForm.insNo.value == "" )
                    {
                        alert("Please enter Insurance Number.");
                        insuranceForm.insNo.focus();
                        return false;
                    }
                    if (insuranceForm.expDate.value == ""  )
                    {
                        alert("Please enter Insuracne Issue Date.");
                        insuranceForm.expDate.focus();
                        return false;
                    }
                    if ( insuranceForm.com.value == "")
                    {
                        alert("Please enter Insurance Company.");
                        insuranceForm.com.focus();
                        return false;
                    }
                    
                    document.insuranceForm.action = '/PacsApplication/InsuranceAdditionServlet';
                    document.insuranceForm.submit();
                }

                function ShowParent()
            {
                document.forms[0].action="${pageContext.request.contextPath}/InsuranceAddition.jsp";
                document.forms[0].submit();
            }
            
            // to restrict back button
            history.pushState(null, null, location.href);
            window.addEventListener('popstate', function(event) {
                history.pushState(null, null, location.href);
            });
              
            </script>
            <jsp:include page="MenuHead.jsp" flush="true" />
            <br>

            <%
                        String error_msg = "";
                        Object error = request.getAttribute("message");
                        if (error != null) {
                            error_msg = error.toString();
                        }
            %>


        <body onload="noBack();">
        <fieldset class="scheduler-border">
            <legend class="scheduler-border" id="pageName" name="pageName">Insurance Addtion</legend>
            <div class="container-fluid" id="agentMapping">
                <form name="insuranceForm" method="post" action="">

                    <%if (!error_msg.equalsIgnoreCase("")) {%>
                    <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                    <% }%>

                    <%--<center>--%>
                        <table>
                         <tr><td>Select Type of Operation<font color="red" >*</font>:</td>
                               <td> <select class="selectpicker" id="tranType" name ="tranType">
                                   <option value=""> --Select-- </option>
                                   <option value="CREATE" >Add Insurance</option>
                                    <option value="UPDATE" >Update Insurance </option>
                                   </select></td></tr>

                                <tr><td> Customer CIF Number<font color="red" >*</font>:</td>
                                <td><input type="text" class="form-control" id="custId" name="custId" placeholder="Customer Name/CIF No" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' >
                                <input type="button"  value="Search" onclick="javascript:popup_CIF(750, 250,document.insuranceForm.custId.value)"/></td>
                                </tr>

                                <tr><td> Customer Name:</td>
                                <td><input type="text" class="form-control" id="custName" name="custName" readonly ></td>
                                </tr>
                                <tr>
                                <td> Existing Insurance Number:</td>
                                <td><input type="text" class="form-control" id="insNoEx" name="insNoEx"  disabled style="text-align:right;" ></td>
                                </tr>

                                <tr>
                                <td>Existing Insuracne Issue Date:</td>
                                <td><input type="text" class="form-control" id="expDateEx" name="expDateEx"  disabled style="text-align:center;" ></td>
                                </tr>

                                <tr>
                                <td>Existing Insurance Company:</td>
                                <td><input type="text" class="form-control" id="comEx" name="comEx" disabled></td>
                                </tr>

                                <tr>  <td> Existing Insurance Status:</td>
                                <td><input type="text" class="form-control" id="statusEx" name="status" disabled></td>
                                </tr>
                                
                                <tr>
                                <td> Insurance Number<font color="red" >*</font>:</td>
                                <td><input type="text" class="form-control" id="insNo" name="insNo" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' ></td>
                                </tr>

                                <tr><td> Insurance Issue Date<font color="red" >*</font>:</td>
                                    <td><input type="text" class="form-control" id="expDate" name="expDate" style="text-align:center;" >&nbsp;<a href="#" onclick="return getCalendar(document.insuranceForm.expDate);"><img src="img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td>
                              
                                </tr>

                                <tr><td> Insurance Company<font color="red" >*</font>:</td>
                                <td><input type="text" class="form-control" id="com" name="com" ></td>
                                </tr>
                        </table>
<!--                        <br>
                        <br>
                        <table>
                              <%--<tr><td>Select type of Operation:</td>
                               <td> <select class="selectpicker" id="tranTypeOrg">
                                    <option value="CREATE" >Add Insurance</option>
                                    <option value="UPDATE" >Update Insurance </option>
                                   </select></td></tr>

                                <tr><td> Customer No.</td>
                                <td><input type="text" class="form-control" id="custId" name="custId" placeholder="Customer Name/CIF No" >
                                <input type="button"  value="Search" onclick="javascript:popup_CIF(750, 250,document.insuranceForm.custId.value)"/></td>
                                </tr>

                                <tr><td> Customer Name:</td>
                                <td><input type="text" class="form-control" id="custName" name="custName" placeholder="Customer Name" disabled></td>
                                </tr>--%>
                                
                                <tr>
                                <td> Insurance Number<font color="red" >*</font>:</td>
                                <td><input type="text" class="form-control" id="insNo" name="insNo" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' ></td>
                                </tr>

                                <tr><td> Insurance Issue Date<font color="red" >*</font>:</td>
                                    <td><input type="text" class="form-control" id="expDate" name="expDate" style="text-align:center;" >&nbsp;<a href="#" onclick="return getCalendar(document.insuranceForm.expDate);"><img src="img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td>
                              
                                </tr>

                                <tr><td> Insurance Company<font color="red" >*</font>:</td>
                                <td><input type="text" class="form-control" id="com" name="com" ></td>
                                </tr>
                        </table>-->
                        <br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <center>
                        <input type="button" value="Submit" id="Submit" onclick="javascript:submitform(insuranceForm)"/>
                        <input type="Reset" value="Reset" id="Reset" onclick="ShowParent();"/>
                    </center>
                </form>
            </div>
        </fieldset>
    </body>
    <html>