<%--
    Document   : CommonSearchInformationShgLOV
    Created on : Mar 10, 2016, 2:30:36 AM
    Author     : SUBHAM
--%>

<%@page import="java.sql.PreparedStatement"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="LoginDb.DbHandler"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="java.sql.Connection"%>


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Customer Information Search</title>
        <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />

        <%
                    String searchString1 = "";
                    String screenName = "";
                    String searchString2 = "";
                    String lovKey = "";
                    String textIndex = "";

                    screenName = request.getParameter("screenName");
                    lovKey = request.getParameter("lovKey");
                    String pacsId = session.getAttribute("pacsId").toString();
                    String ShgId = request.getParameter("shg_id");

                    String headerQry = null;

                    if (screenName.equalsIgnoreCase("BasicInformation.jsp") && (lovKey.equalsIgnoreCase("BasicInformation"))) {

                        searchString1 = request.getParameter("Search");
                        // if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select shg_id,shg_code,name_of_shg from basic_info j where  (j.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))) ";
                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code,name_of_shg from basic_info j where  (j.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "')))  and shg_code like '%" + searchString1.replace(' ', '%') + "%' ";

                        // }
                    } else if (screenName.equalsIgnoreCase("BasicInformation.jsp") && (lovKey.equalsIgnoreCase("cif"))) {

                       // searchString1 = request.getParameter("cif");
                        // if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select j.cif_no,(j.first_name|| ' ' ||nvl(j.middle_name,' ')|| ' ' ||nvl(j.last_name,' ')) name from kyc_hdr j where j.cif_no = '" + searchString1.replace(' ', '%') + "'  and (j.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "')))  ";

                    } else if (screenName.equalsIgnoreCase("BasicInformation.jsp") && (lovKey.equalsIgnoreCase("cifamend"))) {

                       // searchString1 = request.getParameter("cifamend");
                        // if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select j.cif_no,(j.first_name||nvl(j.middle_name,'')||nvl(j.last_name,'')) name from kyc_hdr j where  (j.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "')))   and j.cif_no = '" + searchString1.replace(' ', '%') + "'   ";

                    }else if (screenName.equalsIgnoreCase("AddressDetails.jsp") && (lovKey.equalsIgnoreCase("addressDetails"))) {

                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select A.shg_id,A.shg_code,B.name_of_shg from ADDRESS_DETAILS A,basic_info B where A.shg_id=to_number(B.shg_id) and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }

                    } else if (screenName.equalsIgnoreCase("AddressDetails.jsp") && (lovKey.equalsIgnoreCase("addressDetailscode"))) {

                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select SHG_CODE, NAME_OF_SHG, case GRP_CATEGORY when '1' then 'SGSY' when '2' then 'NABARD' when '3' then 'Co-Operative' when '4' then 'Others' end as Grp_Category, to_char(DATE_OF_FORMATION,'DD-MON-RRRR') as DATE_OF_FORMATION , DURATION from BASIC_INFO where pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }

                    } else if (screenName.equalsIgnoreCase("MemberDetails.jsp") && (lovKey.equalsIgnoreCase("MemberDetails"))) {


                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {select A.shg_code,B.name_of_shg,A.member_name from Member_Details A,basic_info B where A.shg_code=B.shg_code
                        headerQry = "select distinct A.shg_code,B.name_of_shg from Member_Information A,basic_info B where A.shg_id=B.shg_id and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        //} else if (!searchString1.equalsIgnoreCase("")) {
                        //  headerQry = "select member_id,shg_code,member_code,member_name from Member_Details where member_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        //}
                    } else if (screenName.equalsIgnoreCase("MemberDetails.jsp") && (lovKey.equalsIgnoreCase("MemberDetailscode"))) {


                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select SHG_CODE, NAME_OF_SHG, case GRP_CATEGORY when '1' then 'SGSY' when '2' then 'NABARD' when '3' then 'Co-Operative' when '4' then 'Others' end as Grp_Category, to_char(DATE_OF_FORMATION,'DD-MON-RRRR') as DATE_OF_FORMATION , DURATION from BASIC_INFO where shg_id not in (select shg_id from member_information) and pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    } else if (screenName.equalsIgnoreCase("ShgActivities.jsp") && (lovKey.equalsIgnoreCase("shgDetails"))) {


                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select A.shg_id,A.shg_code,B.name_of_shg from SHG_ACTIVITIES A,basic_info B where A.shg_id=to_number(B.shg_id) and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    } else if (screenName.equalsIgnoreCase("ShgActivities.jsp") && (lovKey.equalsIgnoreCase("shgDetailscode"))) {

                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select SHG_CODE, NAME_OF_SHG, case GRP_CATEGORY when '1' then 'SGSY' when '2' then 'NABARD' when '3' then 'Co-Operative' when '4' then 'Others' end as Grp_Category, to_char(DATE_OF_FORMATION,'DD-MON-RRRR') as DATE_OF_FORMATION , DURATION from BASIC_INFO where pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "')) ";

                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailscode"))) {

                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select SHG_CODE, NAME_OF_SHG, case GRP_CATEGORY when '1' then 'SGSY' when '2' then 'NABARD' when '3' then 'Co-Operative' when '4' then 'Others' end as Grp_Category, to_char(DATE_OF_FORMATION,'DD-MON-RRRR') as DATE_OF_FORMATION , DURATION from BASIC_INFO where pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id =(select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsLoan"))) {


                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select distinct A.shg_id,A.shg_code,B.name_of_shg from Account_Details_Loan A,basic_info B where A.shg_code=B.shg_code and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id =(select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsLoan2"))) {


                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select distinct A.shg_id,A.shg_code,B.name_of_shg from Account_Details_Loan A,basic_info B where A.shg_code=B.shg_code and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id =(select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    }else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsLoan3"))) {


                        searchString1 = request.getParameter("Search");
                        //if (searchString1.equalsIgnoreCase("")) {
                        headerQry = "select distinct b.shg_id,b.shg_code,name_of_shg from basic_info b,kyc_hdr k where b.cif=k.cif_no and k.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        // } else if (!searchString1.equalsIgnoreCase("")) {
                        //    headerQry = "select shg_id,shg_code from ADDRESS_DETAILS where shg_code like '%" + searchString1.replace(' ', '%') + "%' ";
                        // }
                    }
                    else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsDeposit"))) {


                        searchString1 = request.getParameter("Search");

                        headerQry = "select distinct A.shg_id,A.shg_code,B.name_of_shg from Account_Details_Deposit A,basic_info B where A.shg_code=B.shg_code and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id =(select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsDeposit2"))) {


                        searchString1 = request.getParameter("Search");

                        headerQry = "select distinct A.shg_id,A.shg_code,B.name_of_shg from Account_Details_Deposit A,basic_info B where A.shg_code=B.shg_code and B.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id =(select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsDeposit3"))) {


                        searchString1 = request.getParameter("Search");

                        headerQry = "select distinct b.shg_id,b.shg_code,name_of_shg from basic_info b,kyc_hdr k where b.cif=k.cif_no and k.pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                    } else if (screenName.equalsIgnoreCase("shg_reports.jsp") && (lovKey.equalsIgnoreCase("SearchShg"))) {

                       // searchString1 = request.getParameter("shg_name");
                        if (searchString1.equalsIgnoreCase("")) {
                            headerQry = "select shg_id,name_of_shg from basic_info where pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        } else if (!searchString1.equalsIgnoreCase("")) {
                            headerQry = "select shg_id,name_of_shg from basic_info where name_of_shg like '%" + searchString1.replace(' ', '%') + "%' and pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";

                       }


                    } else if (screenName.equalsIgnoreCase("shg_reports.jsp") && (lovKey.equalsIgnoreCase("SearchShg_Bank"))) {

                        searchString1 = request.getParameter("shg_name_Bank");
                       // searchString2 = request.getParameter("pacs_code");
                        
                            headerQry = "select shg_id,name_of_shg from basic_info where pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id like '%" + searchString2.replace(' ', '%') + "%'))";                       

                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("Shg_code"))) {
                            headerQry = "select shg_id,name_of_shg from basic_info where pacs_id in(select p.pacs_id from pacs_master p where p.head_pacs_id in (select head_pacs_id from pacs_master where pacs_id='" + pacsId + "'))";
                        
                    } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("searchShgMembers"))) {


                       // searchString1 = request.getParameter("searchShg");

                        headerQry = "select member_id,member_name from Member_Information where shg_id like '%" + searchString1.replace(' ', '%') + "%' ";

                    } else if (screenName.equalsIgnoreCase("EmployeeMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPSalary"))) {

                        //searchString1 = request.getParameter("accNo");
                        searchString2 = request.getParameter("textIndex");
                                                
                            headerQry = " select key_1 Acct,avail_bal balance from dep_account where customer_no='"+searchString1+"' and pacs_id='" + pacsId + "' and dep_prod_id in (select id from dep_product dp where dp.prod_code='1101' and substr(dp.int_cat,1,1)='1') and substr(gl_class_code,9,2)='14' ";
                    
                    } else if (screenName.equalsIgnoreCase("EmployeeMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPDesgCode"))) {

                        searchString1 = request.getParameter("accNo");
                        searchString2 = request.getParameter("textIndex");
                                                
                            headerQry = " select ID, DESIGNATION from designation_master k where k.pacs_id = '" + pacsId + "' and k.status = 'Y' ";
                    
                    } else if (screenName.equalsIgnoreCase("EmployeeMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPGradeCode"))) {

                        searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                                                
                            headerQry = " select ID, GRADE from grade_master k  where k.pacs_id='" + pacsId + "' and k.status = 'Y' ";
                    
                    } else if (screenName.equalsIgnoreCase("EmployeeDependentMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPCustomer"))) {                      
                        searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                        
                            headerQry = " select id, (select k.first_name || ' ' || k.middle_name || ' ' || k.last_name from kyc_hdr k where k.cif_no = w.cif_no) name, (select k.guardian_name from kyc_hdr k where k.cif_no = w.cif_no) guard_name, emp_id from employee_master w where pacs_id = '" + pacsId + "' ";
                    
                    } else if (screenName.equalsIgnoreCase("payroll_reports.jsp") && (lovKey.equalsIgnoreCase("EMPID"))) {
                                                
                            headerQry = " select id, (select k.first_name || ' ' || k.middle_name || ' ' || k.last_name from kyc_hdr k where k.cif_no = w.cif_no) name, (select k.guardian_name from kyc_hdr k where k.cif_no = w.cif_no) guard_name, emp_id from employee_master w where pacs_id = '" + pacsId + "' ";
                    
                    } else if (screenName.equalsIgnoreCase("LeaveBalance.jsp") && (lovKey.equalsIgnoreCase("PickUPLeave"))) {
                        searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                        
                            headerQry = " select id, leave_name, (case leave_type when '1' then 'Earned Leave' when '2' then 'Medical Leave' when '3' then 'Casual Leave' when '4' then 'Others Leave' end) leave_type from leave_master l where pacs_id = '" + pacsId + "' and status = 'Y' ";
                    
                    } else if ((screenName.equalsIgnoreCase("PayrollBglMaster.jsp")) && (lovKey.equalsIgnoreCase("sal"))) {

                      //  searchString1 = request.getParameter("salGL");  
                        searchString2 = request.getParameter("textIndex");
                        headerQry = "select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('60', '63') and gl_prod_id <> '310318000001905' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%')";

                    } else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("tax"))) {
                        //searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                        
                            headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('12', '10', '18') and gl_prod_id <> (select PARKING_GL_ID from year_end_map) and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("other"))) {
                       // searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                        
                            headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('12', '10', '18') and gl_prod_id <> (select PARKING_GL_ID from year_end_map) and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("StaffCr"))) {
                       // searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                        
                            headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('12', '10', '18') and gl_prod_id <> (select PARKING_GL_ID from year_end_map) and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if ((screenName.equalsIgnoreCase("PayrollBglMaster.jsp")) && (lovKey.equalsIgnoreCase("SocDr"))) {

                       // searchString1 = request.getParameter("accNo");  
                        searchString2 = request.getParameter("textIndex");
                        headerQry = "select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('60', '63') and gl_prod_id <> '310318000001905' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%')";

                    } else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("SocCr"))) {
                       // searchString1 = request.getParameter("accNo"); 
                        searchString2 = request.getParameter("textIndex");
                        
                            headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('12', '10', '18') and gl_prod_id <> (select PARKING_GL_ID from year_end_map) and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    }

                    Connection conn = DbHandler.getDBConnection();
                    PreparedStatement pstmt = null;

                    ResultSet resultSet = null;
                    String bgColor = null;
                    int flag = 1;

                    System.out.println(headerQry);

                    try {
                        pstmt = conn.prepareStatement(headerQry);
                        resultSet = pstmt.executeQuery();

        %>
    </head>
    <body style="background-image: url('/PacsApplication/img/download.jpg');">
        <form name="commonSearch" action="">

            <% if ((screenName.equalsIgnoreCase("BasicInformation.jsp")) && (lovKey.equalsIgnoreCase("BasicInformation"))) {%>

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG ID</b></th><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.BasicInformationform.shgSearch.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.BasicInformationform.shgSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.BasicInformationform.shgSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>





                </tr>
                <%}%>
            </table>
            <% } else if ((screenName.equalsIgnoreCase("BasicInformation.jsp")) && (lovKey.equalsIgnoreCase("cif"))) {%>

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>CIF</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.BasicInformationform.cif.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.BasicInformationform.nameOfShg.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.BasicInformationform.cif.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.BasicInformationform.nameOfShg.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                </tr>
                <%}%>
            </table>
            <% } else if ((screenName.equalsIgnoreCase("BasicInformation.jsp")) && (lovKey.equalsIgnoreCase("cifamend"))) {%>

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>CIF</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.BasicInformationform.cifamend.value = document.getElementById('x<%=i%>').innerHTML;
                     opener.document.BasicInformationform.nameOfShgAmend.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.BasicInformationform.cifamend.value = document.getElementById('x<%=i%>').innerHTML;
                         opener.document.BasicInformationform.nameOfShgAmend.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if ((screenName.equalsIgnoreCase("AddressDetails.jsp")) && (lovKey.equalsIgnoreCase("AddressDetails"))) {%>

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.addressdetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.addressdetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>




                </tr>
                <%}%>
            </table><%} else if (screenName.equalsIgnoreCase("AddressDetails.jsp") && (lovKey.equalsIgnoreCase("addressDetailscode"))) {%>

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG Code</b></th><th style="background-color: #99FF99;"><b>Name Of SHG</b></th><th style="background-color: #99FF99;"><b>Group Category</b></th><th style="background-color: #99FF99;"><b>Date Of Formation</b></th><th style="background-color: #99FF99;"><b>Duration</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.addressdetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.addressdetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.addressdetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='u<%=i%>' onclick="opener.document.addressdetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='v<%=i%>' onclick="opener.document.addressdetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table> <%} else if (screenName.equalsIgnoreCase("ShgActivities.jsp") && (lovKey.equalsIgnoreCase("shgDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.shgactivitiesform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.shgactivitiesform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>




                </tr>
                <%}%>
            </table><%} else if (screenName.equalsIgnoreCase("ShgActivities.jsp") && (lovKey.equalsIgnoreCase("shgDetailscode"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG Code</b></th><th style="background-color: #99FF99;"><b>Name Of SHG</b></th><th style="background-color: #99FF99;"><b>Group Category</b></th><th style="background-color: #99FF99;"><b>Date Of Formation</b></th><th style="background-color: #99FF99;"><b>Duration</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.shgactivitiesform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.shgactivitiesform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.shgactivitiesform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='u<%=i%>' onclick="opener.document.shgactivitiesform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='v<%=i%>' onclick="opener.document.shgactivitiesform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("MemberDetails.jsp") && (lovKey.equalsIgnoreCase("MemberDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.MemberDetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.MemberDetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("MemberDetails.jsp") && (lovKey.equalsIgnoreCase("MemberDetailscode"))) {%>
             <% if (!resultSet.isBeforeFirst()) {%>
            <center><p><b>No SHG found with 0 members. Please amend for an existing SHG</b></p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG Code</b></th><th style="background-color: #99FF99;"><b>Name Of SHG</b></th><th style="background-color: #99FF99;"><b>Group Category</b></th><th style="background-color: #99FF99;"><b>Date Of Formation</b></th><th style="background-color: #99FF99;"><b>Duration</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.MemberDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.MemberDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.MemberDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='u<%=i%>' onclick="opener.document.MemberDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='v<%=i%>' onclick="opener.document.MemberDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table>
            <%} } else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsDeposit"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgName.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsDeposit2"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch1.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch1.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsDeposit3"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch2.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg2.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch2.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg2.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsLoan"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgName.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsLoan2"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch1.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch1.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailsLoan3"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG CODE</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch2.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg2.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgSearch2.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.viewshg2.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <%}%></tr>
            </table>
            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("AccountDetailscode"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG Code</b></th><th style="background-color: #99FF99;"><b>Name Of SHG</b></th><th style="background-color: #99FF99;"><b>Group Category</b></th><th style="background-color: #99FF99;"><b>Date Of Formation</b></th><th style="background-color: #99FF99;"><b>Duration</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgname.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgname.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.AccountDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgname.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='u<%=i%>' onclick="opener.document.AccountDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgname.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='v<%=i%>' onclick="opener.document.AccountDetailsform.shgcode.value = document.getElementById('x<%=i%>').innerHTML;opener.document.AccountDetailsform.shgname.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("shg_reports.jsp") && (lovKey.equalsIgnoreCase("SearchShg"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG ID</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.pacsreport.shg_name.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.pacsreport.shg_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.pacsreport.shg_name.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pacsreport.shg_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td> 




                </tr>
                <%}%>
            </table>

            <%} else if (screenName.equalsIgnoreCase("shg_reports.jsp") && (lovKey.equalsIgnoreCase("SearchShg_Bank"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG ID</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.pacsreport.shg_name_Bank.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.pacsreport.shg_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.pacsreport.shg_name_Bank.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pacsreport.shg_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td> 




                </tr>
                <%}%>
            </table>

            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("Shg_code"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SHG ID</b></th><th style="background-color: #99FF99;"><b> NAME OF SHG</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.shg_code.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.AccountDetailsform.viewshg3.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.shg_code.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.AccountDetailsform.viewshg3.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>




                </tr>
                <%}%>
            </table>


            <%} else if (screenName.equalsIgnoreCase("AccountDetails.jsp") && (lovKey.equalsIgnoreCase("searchShgMembers"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Member ID</b></th><th style="background-color: #99FF99;"><b>Member NAME</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.AccountDetailsform.member_name.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.AccountDetailsform.member_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.AccountDetailsform.member_name.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.AccountDetailsform.member_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>

                </tr>
                <%}%>
            </table>

            <%} else if (screenName.equalsIgnoreCase("EmployeeMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPSalary"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No result found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account Number</b></th><th style="background-color: #99FF99;"><b>Available Balance</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.salaryAcc<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.salaryAcc<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>                   
                </tr>
                <%}%>
            </table>
            <%}%>
            
             <%} else if (screenName.equalsIgnoreCase("EmployeeMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPDesgCode"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No result found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Designation ID</b></th><th style="background-color: #99FF99;"><b>Designation Name</b></th><</tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.designationCode<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.designationCode<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>                    
                </tr>
                <%}%>
            </table>
            <%}%>
             <%} else if (screenName.equalsIgnoreCase("EmployeeMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPGradeCode"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No result found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Grade ID</b></th><th style="background-color: #99FF99;"><b>Grade Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.gradeCode<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.gradeCode<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>                    
                </tr>
                <%}%>
            </table>
            <%}%>
             <%} else if (screenName.equalsIgnoreCase("EmployeeDependentMaster.jsp") && (lovKey.equalsIgnoreCase("PickUPCustomer"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Employee Name</b></th><th style="background-color: #99FF99;"><b>Guardian Name</b></th><th style="background-color: #99FF99;"><b>Employee ID</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.employee<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.formPayroll.ename<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;opener.document.formPayroll.employee_id<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.employee<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.formPayroll.ename<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;opener.document.formPayroll.employee_id<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.employee<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.formPayroll.ename<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;opener.document.formPayroll.employee_id<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.employee<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.formPayroll.ename<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;opener.document.formPayroll.employee_id<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>                    

                </tr>
                <%}%>
            </table>

            <%}%>
             <%} else if (screenName.equalsIgnoreCase("payroll_reports.jsp") && (lovKey.equalsIgnoreCase("EMPID"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Employee Name</b></th><th style="background-color: #99FF99;"><b>Guardian Name</b></th><th style="background-color: #99FF99;"><b>Employee ID</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.empId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.empId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.empId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.empId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>                    

                </tr>
                <%}%>
            </table>

            <%}%>
             <%} else if (screenName.equalsIgnoreCase("LeaveBalance.jsp") && (lovKey.equalsIgnoreCase("PickUPLeave"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Leave ID</b></th><th style="background-color: #99FF99;"><b>Leave Name</b></th><th style="background-color: #99FF99;"><b>Leave Type</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.leaveId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.formPayroll.leave<%=searchString2%>.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.leaveId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.formPayroll.leave<%=searchString2%>.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.leaveId<%=searchString2%>.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.formPayroll.leave<%=searchString2%>.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>                                       

                </tr>
                <%}%>
            </table>

            <%}%>
             <%} else if ((screenName.equalsIgnoreCase("PayrollBglMaster.jsp")) && (lovKey.equalsIgnoreCase("sal"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No GL A/C found! Close this window & Please recheck the A/C No. selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account No.</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>Gl Code</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Gl Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.salaryGL<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.glid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.salaryGL<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.glid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.salaryGL<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.glid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>         
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.salaryGL<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.glid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.formPayroll.salaryGL<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.glid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>
            <%}%>
             <%} else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("tax"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account No.</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>Gl Code</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Gl Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.pTax<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.taxid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.pTax<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.taxid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.pTax<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.taxid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>         
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.pTax<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.taxid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.formPayroll.pTax<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.taxid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>

            <%}%>
             <%} else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("other"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account No.</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>Gl Code</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Gl Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.otherDeduct<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.otherid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.otherDeduct<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.otherid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.otherDeduct<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.otherid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>         
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.otherDeduct<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.otherid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.formPayroll.otherDeduct<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.otherid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>

            <%}%>
             <%} else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("StaffCr"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account No.</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>Gl Code</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Gl Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.epfStaffCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.staffcrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.epfStaffCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.staffcrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.epfStaffCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.staffcrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>         
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.epfStaffCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.staffcrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.formPayroll.epfStaffCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.staffcrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>

            <%}%>
             <%} else if ((screenName.equalsIgnoreCase("PayrollBglMaster.jsp")) && (lovKey.equalsIgnoreCase("SocDr"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No GL A/C found! Close this window & Please recheck the A/C No. selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account No.</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>Gl Code</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Gl Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.epfSocDr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.socdrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.epfSocDr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.socdrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.epfSocDr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.socdrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>         
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.epfSocDr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.socdrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.formPayroll.epfSocDr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.socdrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>
            <%}%>
             <%} else if (screenName.equalsIgnoreCase("PayrollBglMaster.jsp") && (lovKey.equalsIgnoreCase("SocCr"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found! Close this window & Please recheck the Customer Name selected.</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Account No.</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>Gl Code</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Gl Name</b></th></tr>
                <%int i = 0;
                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }%>
                <tr><td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.formPayroll.epfSocCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.soccrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.formPayroll.epfSocCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.soccrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.formPayroll.epfSocCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.soccrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>         
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.formPayroll.epfSocCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.soccrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.formPayroll.epfSocCr<%=searchString2%>.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.formPayroll.soccrid<%=searchString2%>.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>

            <%}%>
             <%}%>

        </form>
    </body>
    <%
                } catch (Exception ex) {
                    //System.out.println(ex);
                } finally {
                    if (resultSet != null) {
                        resultSet.close();
                    }
                    if (pstmt != null) {
                        pstmt.close();
                    }
                    if (conn != null) {
                        conn.close();
                    }
                }

    %>

</html>