<%--
    Document   : PACS_REPORT
    Created on : Sep 17, 2015, 12:59:59 PM
    Author     : 454222
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList" %>

<html>
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <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="${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/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
        <script src="js/Chart.bundle.js"></script>
        <script src="js/json3.js"></script>
        <script src="js/GenerateDashboard.js"></script>
        <script  type="text/javascript">
            function doClick(evt){
                var activePoints = myBar.getElementAtEvent(evt);
                var datasetIndex = activePoints[0]._datasetIndex;
                var index = activePoints[0]._index;
                var bucket = window.saket.labels[index];
                var entity = window.saket.datasets[datasetIndex].label;
                alert(bucket + "-" + entity);
            }
        </script>

        <script>

            function downloadFiles() {

                if (document.forms[0].fromDate.value == "")
                {
                    alert("!! Date Cannot Be Empty !!");
                    document.forms[0].fromDate.focus();
                    return false;
                }

                if (document.forms[0].toDate.value == "")
                {
                    alert("!! Date Cannot Be Empty !!");
                    document.forms[0].toDate.focus();
                    return false;
                }

                var e = document.getElementById("reportSelection");

                if (e.options[e.selectedIndex].value == "")
                {
                    alert("!! Report Name Cannot Be Empty !!");
                    document.forms[0].reportSelection.focus();
                    return false;
                }

                switch (e.options[e.selectedIndex].value) {

                    case "1" :

                        document.forms[0].reportPath.value = "/Reports/Bucket-Wise Loan Outstanding";
                        document.forms[0].reportName.value = "Bucket-Wise Loan Outstanding";
                        //document.forms[0].DOWNLOAD.value = "P";
                        break;

                    case "2" :

                        document.forms[0].reportPath.value = "/Reports/Crop-Wise Snapshot of Loans_New";
                        document.forms[0].reportName.value = "Crop-Wise snapshot of Loans";
                        // document.forms[0].DOWNLOAD.value = "P";
                        break;

                    case "3" :

                        document.forms[0].reportPath.value = "/Reports/Loan-Disbursed Vs Loan-Recovered";
                        document.forms[0].reportName.value = "Loan-Disbursed Vs Loan-Recovered";
                        // document.forms[0].DOWNLOAD.value = "P";
                        break;

                    case "4" :

                        document.forms[0].reportPath.value = "/Reports/Crop-Wise Loan Demand";
                        document.forms[0].reportName.value = "Crop-Wise Loan Demand";
                        // document.forms[0].DOWNLOAD.value = "P";
                        break;

                    case "5" :

                        document.forms[0].reportPath.value = "/Reports/Crop-Wise Loan Recovery";
                        document.forms[0].reportName.value = "Crop-Wise Loan Recovery";
                        //document.forms[0].DOWNLOAD.value = "P";
                        break;

                    case "6" :

                        document.forms[0].reportPath.value = "/Reports/DCCB-Wise Loan Disbursed";
                        document.forms[0].reportName.value = "DCCB-Wise Loan Disbursed";
                        //document.forms[0].DOWNLOAD.value = "P";
                        break;

                    default :

                        null;

                }

                var win_option="width=900,height=620,left=50,top=50,modal=yes,"+"toolbar=yes,location=no,directories=no,status=no,menubar=yes,"+"scrollbars=yes,resizable=yes";
                window.open("/PacsApplication/ExcelReportServlet?reportName="+document.forms[0].reportName.value+"&reportPath="+document.forms[0].reportPath.value+"&fromDate="+document.forms[0].fromDate.value+"&distCode="+document.forms[0].distCode.value+"&toDate="+document.forms[0].toDate.value+"&DOWNLOAD="+document.forms[0].DOWNLOAD.value,'',win_option);

                //document.forms[0].action = '/PacsApplication/ExcelReportServlet';
               // document.forms[0].submit();

            }


            function GenerateChart() {

                if (document.forms[0].fromDate.value == "")
                {
                    alert("!! Date Cannot Be Empty !!");
                    document.forms[0].fromDate.focus();
                    return false;
                }

                if (document.forms[0].toDate.value == "")
                {
                    alert("!! Date Cannot Be Empty !!");
                    document.forms[0].toDate.focus();
                    return false;
                }

                var e = document.getElementById("reportSelection");

                if (e.options[e.selectedIndex].value == "")
                {
                    alert("!! Report Name Cannot Be Empty !!");
                    document.forms[0].reportSelection.focus();
                    return false;
                }

               var reportSelection= e.options[e.selectedIndex].value;

                var win_option="width=900,height=620,left=50,top=50,modal=yes,"+"toolbar=yes,location=no,directories=no,status=no,menubar=yes,"+"scrollbars=yes,resizable=yes";
                window.open("/PacsApplication/displayChart.jsp?fromDate="+document.forms[0].fromDate.value+"&distCode="+document.forms[0].distCode.value+"&toDate="+document.forms[0].toDate.value+"&reportSelection="+reportSelection,'',win_option);

            }



        </script>

        <title>MIS & Dashboards</title>
        <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
    </head>
    <body  onload="noBack();">
        <script type="text/javascript">
            function noBack()
            {
                window.history.forward();
            }
        </script>
        <jsp:include page="MenuHead_DASHBOARD.jsp" flush="true" />
        <br>
        <div style="top:500px">
            <fieldset style="border-color: black; background-image: url('/PacsApplication/img/download.jpg'); border-width: 3px">
                <legend style="padding: 8px; border-radius: 20px; background-color: #006600; color: white">MIS & Dashboards</legend>

                <form name="pacsreport" method="post" action="">
                    <br>

                    <table>
                        <%if (request.getAttribute("error") != null) {%>
                        <tr><td colspan="2" align="center"><%=request.getAttribute("error").toString()%></td></tr>
                        <%}%>

                        <tr></tr>
                        <tr></tr>
                        <tr></tr>
                        <tr></tr>
                        <tr></tr>
                        <tr></tr>
                        <tr></tr>
                        <tr></tr>

                        <tr>
                            <td style=" font-family: Berlin Sans FB; font-weight:  normal;">From Date: <input type="text" style="text-align:center;" name="fromDate" maxlength="11" resize="yes" readonly="true"><a href="#" onclick="return getCalendar(document.forms[0].fromDate);"><img src="img/calendar.gif" name="imgr" border="0" width="15" height="20" /></a></td>
                            <td style=" font-family: Berlin Sans FB; font-weight:  normal;">To Date: <input type="text" style="text-align:center;" name="toDate" maxlength="11" resize="yes" readonly="true"><a href="#" onclick="return getCalendar(document.forms[0].toDate);"><img src="img/calendar.gif" name="imgr" border="0" width="15" height="20" /></a></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>

                        <tr>
                            <td style=" font-family: Berlin Sans FB; font-weight:normal; ">DCCB Name: </td>
                            <td> <select id="distCode" name="distCode" >
                                    <option value="" >All DCCBs</option>
                                    <option value="1">1:Birbhum District Central Co-operative Bank</option>
                                    <option value="2">2:Bankura District Central Co-operative Bank</option>
                                    <option value="3">3:Balageria Central Co-operative Bank</option>
                                    <option value="4">4:Dhakshin Dinajpur District Central Co-operative Bank</option>
                                    <option value="5">5:Darjeeling District Central Co-operative Bank</option>
                                    <option value="6">6:Hooghly District Central Co-operative Bank</option>
                                    <option value="7">7:Howrah District Central Co-operative Bank</option>
                                    <option value="8">8:Jalpaiguri District Central Co-operative Bank</option>
                                    <option value="9">9:Murshidabad District Central Co-operative Bank</option>
                                    <option value="10">10:Malda District Central Co-operative Bank</option>
                                    <option value="11">11:Mugberia District Central Co-operative Bank</option>
                                    <option value="12">12:Nadia District Central Co-operative Bank</option>
                                    <option value="13">13:Purulia Central Co-operative Bank</option>
                                    <option value="14">14:Raiganj District Central Co-operative Bank</option>
                                    <option value="15">15:Tamluk-Ghatal Central Co-operative Bank</option>
                                    <option value="16">16:The West Bengal State Co-operative Bank</option>
                                    <option value="17">17:Vidyasagar Central Co-operative Bank</option>
                                </select></td>

                        </tr>
                        <tr>
                            <td style=" font-family: Berlin Sans FB; font-weight:normal; ">Report Name: </td>
                            <td> <select id="reportSelection" name="reportSelection" >
                                    <option value="" disabled selected style="display:none;" >--Select--</option>
                                    <option value="1">Bucket-Wise Loan Outstanding</option>
                                    <option value="2">Crop-Wise snapshot of Loans</option>
                                    <option value="3">Loan-Disbursed Vs Loan-Recovered</option>
                                    <option value="4">Crop-Wise Loan Demand</option>
                                    <option value="5">Crop-Wise Loan Recovery</option>
                                    <option value="6">DCCB-Wise Loan Disbursed vs Loan Recovered</option>
                                </select></td>

                        </tr>
                    </table><br><br><br><br>
                    <center>



                        <input type="button" value="FETCH REPORT" onclick="javascript:downloadFiles();">
                        <input type="button" onclick="GenerateChart()" value="Generate Chart">

                    </center>


                    <input type="hidden" name="reportPath" value=""/>
                    <input type="hidden" name="reportName" value=""/>
                    <input type="hidden" name="DOWNLOAD" value=""/>


                </form>
            </fieldset>
         <!--   <div id="canvas-div">
                <canvas id="canvas" onclick="javascript:return doClick(event);"></canvas>
            </div>
            <style>
                canvas {
                    -moz-user-select: none;
                    -webkit-user-select: none;
                    -ms-user-select: none;
                }
            </style>-->
        </div>
    </body>
</html>
