<%--
    Document   : CommonSearchInformationPdsLOV
    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 = "";
                    String unitVal, unit = "";
                    screenName = request.getParameter("screenName");
                    lovKey = request.getParameter("lovKey");
                    String pacsId = session.getAttribute("pacsId").toString();
                    String productId = request.getParameter("productId");

                    String headerQry = null;

                    if (screenName.equalsIgnoreCase("memberEnrollment.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {

                        searchString1 = request.getParameter("cifNumber");
                        searchString2 = request.getParameter("cifName");

                        //    if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders";
                        /*  } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders where name="+searchString2;
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders where card_no="+searchString1;
                        } else {
                        headerQry = "select id,card_no,name from pds_card_holders where name="+searchString2+"and card_no="+searchString1;
                        }*/

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

                        searchString1 = request.getParameter("cifNumber");
                        searchString2 = request.getParameter("cifName");

                        //if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst";
                        /*  } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                        headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst where name="+searchString2;
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders where card_no="+searchString1;
                        } else {
                        headerQry = "select id,card_no,name from pds_card_holders where name="+searchString2+"and card_no="+searchString1;
                        }*/

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

                        searchString1 = request.getParameter("cifNumber");
                        searchString2 = request.getParameter("cifName");

                        //if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst";
                        /*  } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                        headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst where name="+searchString2;
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders where card_no="+searchString1;
                        } else {
                        headerQry = "select id,card_no,name from pds_card_holders where name="+searchString2+"and card_no="+searchString1;
                        }*/

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

                       // searchString1 = request.getParameter("cifNumber");
                       // searchString2 = request.getParameter("cifName");

                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where trim(first_name)||trim(middle_name)||trim(last_name) like '%" + searchString2.replace(' ', '%') + "%' and dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where cif_no like '%" + searchString1.replace(' ', '%') + "%' and dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        } else {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where cif_no like '%" + searchString1.replace(' ', '%') + "%' and trim(first_name)||trim(middle_name)||trim(last_name) like '%" + searchString2.replace(' ', '%') + "%' and dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        }

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

                       // searchString1 = request.getParameter("cifNumber");
                       // searchString2 = request.getParameter("cifName");

                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where trim(first_name)||trim(middle_name)||trim(last_name) like '%" + searchString2.replace(' ', '%') + "%' and dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where cif_no like '%" + searchString1.replace(' ', '%') + "%' and dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        } else {
                            headerQry = "select t.cif_no,(t.first_name||nvl2(t.middle_name,' '||t.middle_name,'')||nvl2(t.last_name,' '||t.last_name,'')) name from kyc_details t,dep_account dp where cif_no like '%" + searchString1.replace(' ', '%') + "%' and trim(first_name)||trim(middle_name)||trim(last_name) like '%" + searchString2.replace(' ', '%') + "%' and dp.customer_no = t.cif_no and dp.pacs_id = '" + pacsId + "'";
                        }

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

                        textIndex = request.getParameter("textIndex");

                        headerQry = "select to_char(st.STOCK_ENTRY_DATE,'DD/MM/YYYY'),pd.id as product_id,st.id as stock_id,pd.product_name,pd.product_code,st.QUANTITY_AVL, round((pd.profit_factor*st.price)/100 + st.price,2) "
                                + "from pds_product_mst pd,pds_stock_register st "
                                + "where pd.id=st.product_id and st.pacs_id = '" + pacsId + "' "
                                + "order by pd.product_code, st.STOCK_ENTRY_DATE";
                    } else if (screenName.equalsIgnoreCase("pds_stock_register.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearch"))) {

                        textIndex = request.getParameter("textIndex");
                        //searchString1= request.getParameter("productType");
                        // searchString2= request.getParameter("productSubType");


                        // if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc,unit from pds_product_mst";
                        /* } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc,unit from pds_product_mst where item_type="+searchString1;
                        } else if (!searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc,unit from pds_product_mst where item_type="+searchString1+"and item_subtype="+searchString2;
                        }*/


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


                       // searchString1 = request.getParameter("productTypeSearch");
                        //searchString2 = request.getParameter("productSubTypeSearch");


                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst where item_type=" + searchString1;
                        } else if (!searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst where item_type=" + searchString1 + "and item_subtype=" + searchString2;
                        }


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


                        //searchString1 = request.getParameter("productTypeSearch");
                       // searchString2 = request.getParameter("productSubTypeSearch");


                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst where item_type=" + searchString1;
                        } else if (!searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst where item_type=" + searchString1 + "and item_subtype=" + searchString2;
                        }


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

                        searchString1 = request.getParameter("cifNumber");
                        searchString2 = request.getParameter("cifName");

                        //    if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders";
                        /*  } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders where name="+searchString2;
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select id,card_no,name from pds_card_holders where card_no="+searchString1;
                        } else {
                        headerQry = "select id,card_no,name from pds_card_holders where name="+searchString2+"and card_no="+searchString1;
                        }*/

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

                        textIndex = request.getParameter("textIndex");
                        headerQry = "select id,item_type,type_desc, item_subtype,subtype_desc,decode(p.unit,'1','K.g.','2','Lt.','3','Packets') unit from pds_product_mst p";
                    } else if (screenName.equalsIgnoreCase("pdsProductCreation.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearch"))) {


                        headerQry = "select id,item_type,type_desc, item_subtype, subtype_desc, from pds_product_mst";

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


                        //searchString1 = request.getParameter("productTypeSearch");
                        //searchString2 = request.getParameter("productSubTypeSearch");


                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst where type_desc='" + searchString1 + "'";
                        } else if (!searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select id,item_type,type_desc,item_subtype,subtype_desc from pds_product_mst where type_desc='" + searchString1 + "' and subtype_desc='" + searchString2 + "'";
                        }





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

                        //searchString1 = request.getParameter("cardTypeSearch");
                        //searchString2 = request.getParameter("cardDescriptionSearch");

                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst ";
                        } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst  where upper(card_desc) like upper('%" + searchString2.replace(' ', '%') + "%') ";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst  where upper(card_type) like upper('%" + searchString1.replace(' ', '%') + "%') ";
                        } else {
                            headerQry = "select card_type_id,card_type,card_desc from pds_card_type_mst where upper(card_type) like upper('%" + searchString1.replace(' ', '%') + "%')and upper(card_desc) like upper('%" + searchString2.replace(' ', '%') + "%') ";
                        }



                    } else if (screenName.equalsIgnoreCase("pdsRationCardTypeMaster.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearchAmend"))) {
                        textIndex = request.getParameter("textIndex");

                        headerQry = "select id,item_type,type_desc, item_subtype,subtype_desc,decode(p.unit,'1','K.g.','2','Lt.','3','Packets') unit from pds_product_mst p";

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

                       // searchString1 = request.getParameter("cardNo");
                       // searchString2 = request.getParameter("CustomerName");

                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select h.id,h.card_no,h.name,m.card_type "
                                    + "from pds_card_holders h,pds_card_type_mst m "
                                    + "where h.card_type_id=m.card_type_id and h.pacs_id = '" + pacsId + "' ";

                        } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select h.id,h.card_no,h.name,m.card_type "
                                    + "from pds_card_holders h,pds_card_type_mst m "
                                    + "where h.card_type_id=m.card_type_id and h.pacs_id = '" + pacsId + "' and upper(h.name) like upper('%" + searchString2.replace(' ', '%') + "%') ";

                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select h.id,h.card_no,h.name,m.card_type "
                                    + "from pds_card_holders h,pds_card_type_mst m "
                                    + "where h.card_type_id=m.card_type_id and h.pacs_id = '" + pacsId + "' and h.card_no like '%" + searchString1.replace(' ', '%') + "%' ";
                        } else {
                            headerQry = "select h.id,h.card_no,h.name,m.card_type "
                                    + "from pds_card_holders h,pds_card_type_mst m "
                                    + "where h.card_type_id=m.card_type_id and h.pacs_id = '" + pacsId + "' and h.card_no like '%" + searchString1.replace(' ', '%') + "%' and upper(h.name) like upper('%" + searchString2.replace(' ', '%') + "%') ";
                        }


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

                        //searchString1 = request.getParameter("memberName");
                        //searchString2 = request.getParameter("cardNo");

                        if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.id,t.card_no,t.name,t.card_type_id,m.card_type from pds_card_holders t,pds_card_type_mst m where t.pacs_id='" + pacsId + "' and t.card_type_id=m.card_type_id";
                        } else if (searchString1.equalsIgnoreCase("") && !searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.id,t.card_no,t.name,t.card_type_id ,m.card_type from pds_card_holders t,pds_card_type_mst m where t.pacs_id='" + pacsId + "' and t.card_type_id=m.card_type_id and t.card_no like '%" + searchString2.replace(' ', '%') + "%' ";
                        } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                            headerQry = "select t.id,t.card_no,t.name,t.card_type_id ,m.card_type from pds_card_holders t,pds_card_type_mst m where t.pacs_id='" + pacsId + "' and t.card_type_id=m.card_type_id and upper(t.name) like upper('%" + searchString1.replace(' ', '%') + "%') ";
                        } else {
                            headerQry = "select t.id,t.card_no,t.name,t.card_type_id ,m.card_type from pds_card_holders t,pds_card_type_mst m where t.pacs_id='" + pacsId + "' and t.card_type_id=m.card_type_id and t.card_no like '%" + searchString2.replace(' ', '%') + "%' and upper(t.name) like upper('%" + searchString1.replace(' ', '%') + "%') ";
                        }
                    } else if (screenName.equalsIgnoreCase("PdsSellItem.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearchForSell"))) {

                        textIndex = request.getParameter("textIndex");
                        //searchString1 = request.getParameter("memberId");
                       // searchString2 = request.getParameter("cardTypeId");



                        headerQry = "select m.id,m.item_type,m.type_desc ,m.item_subtype,m.subtype_desc , "
                                + " sum(o.qty_remaining),t.id,d.unit_sell_rate,t.qty_remaining,to_char(t.stock_entry_date,'DD-MON-YYYY') "
                                + " from pds_product_mst m,pds_stock_register t,pds_ration_ledger o,pds_card_type_dtl d,pds_card_holders h "
                                + " where m.id=o.prod_id and d.prod_id=o.prod_id and t.prod_id=m.id and h.card_type_id=d.hdr_id "
                                + " and h.id=o.holder_id and t.qty_remaining >0 and o.avail_status='Y' and t.pacs_id=o.pacs_id "
                                + "   and o.pacs_id=h.pacs_id and h.pacs_id= '" + pacsId + "' and h.id= '" + searchString1 + "' "
                                + "   and d.hdr_id='" + searchString2 + "' group by m.id,to_char(t.stock_entry_date,'DD-MON-YYYY'),m.item_type,m.type_desc ,m.item_subtype,m.subtype_desc, "
                                + "  d.elig_qty,t.id,d.unit_sell_rate,t.qty_remaining order by to_char(t.stock_entry_date, 'DD-MON-YYYY') ";


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

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

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

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


            <% if (screenName.equalsIgnoreCase("memberEnrollment.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Card No</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.memberEnrollForm.holderId.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardNoAmendSearch.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.custNameAmendSearch.value = document.getElementById('z<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.memberEnrollForm.holderId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.memberEnrollForm.cardNoAmendSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.memberEnrollForm.custNameAmendSearch.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.memberEnrollForm.holderId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.memberEnrollForm.cardNoAmendSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.memberEnrollForm.custNameAmendSearch.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("memberEnrollment.jsp") && (lovKey.equalsIgnoreCase("cardTypeSearch"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Card Type ID</b></th><th style="background-color: #99FF99;"><b>Card Type</b></th><th style="background-color: #99FF99;"><b>Card Description</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.memberEnrollForm.cardCategory.value = document.getElementById('y<%=i%>').innerHTML+':'+document.getElementById('z<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardTypeId.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.memberEnrollForm.cardCategory.value = document.getElementById('y<%=i%>').innerHTML+':'+document.getElementById('z<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardTypeId.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.memberEnrollForm.cardCategory.value = document.getElementById('y<%=i%>').innerHTML+':'+document.getElementById('z<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardTypeId.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("memberEnrollment.jsp") && (lovKey.equalsIgnoreCase("cardTypeSearchAmend"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Card Type ID</b></th><th style="background-color: #99FF99;"><b>Card Type</b></th><th style="background-color: #99FF99;"><b>Card Description</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.memberEnrollForm.cardCategoryAmend.value = document.getElementById('y<%=i%>').innerHTML+':'+document.getElementById('z<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardTypeIdAmend.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.memberEnrollForm.cardCategoryAmend.value = document.getElementById('y<%=i%>').innerHTML+':'+document.getElementById('z<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardTypeIdAmend.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.memberEnrollForm.cardCategoryAmend.value = document.getElementById('y<%=i%>').innerHTML+':'+document.getElementById('z<%=i%>').innerHTML;
                    opener.document.memberEnrollForm.cardTypeIdAmend.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pds_stock_register.jsp") && (lovKey.equalsIgnoreCase("PdsproductSearch"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Unit</b></th></tr>
                <%int i = 0;

                     while (resultSet.next()) {
                         i++;
                         if (flag == 1) {
                             flag = 0;
                             bgColor = "#AFC7C7";
                         } else {
                             flag = 1;
                             bgColor = "#95B9C7";
                         }
                         unitVal = resultSet.getString(6);
                         if (unitVal.equalsIgnoreCase("1")) {
                             unit = "Kg";
                         } else if (unitVal.equalsIgnoreCase("2")) {
                             unit = "Ltr";
                         } else if (unitVal.equalsIgnoreCase("3")) {
                             unit = "Packets";
                         }%>

                <tr>
                    <td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('unit<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('unit<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2) + ":" + resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('unit<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4) + ":" + resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('unit<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=unit%></td>
                </tr>
                <%}%>
            </table>

            <%} else if (screenName.equalsIgnoreCase("raiseRequisition.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {%>
            <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.validationform.custId.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.validationform.custName.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.validationform.custName.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.validationform.custId.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("purchasedetail.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {%>
            <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.purchasedetail.custId.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.purchasedetail.custName.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.purchasedetail.custName.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.purchasedetail.custId.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("raiseRequisition.jsp") && (lovKey.equalsIgnoreCase("PdsproductSearch"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Purchase Date</b></th><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Stock ID</b></th><th style="background-color: #99FF99;"><b>Product Name</b></th><th style="background-color: #99FF99;"><b>Product Code</b></th><th style="background-color: #99FF99;"><b>Product Quantity(KG)</b></th><th style="background-color: #99FF99;"><b>Product Price</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.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('product<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('stock_id<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('stock_quantity<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pds_stock_register.jsp") && (lovKey.equalsIgnoreCase("PdsproductSearch1"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Type Desc</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Product SubType Desc</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.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsSalesRegister.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Card No</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.pdsSalesRegister.cardNoPk.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.pdsSalesRegister.cardNoSearch.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.pdsSalesRegister.custNameSearch.value = document.getElementById('z<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.pdsSalesRegister.cardNoPk.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pdsSalesRegister.cardNoSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.pdsSalesRegister.custNameSearch.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.pdsSalesRegister.cardNoPk.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pdsSalesRegister.cardNoSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.pdsSalesRegister.custNameSearch.value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsSalesRegister.jsp") && (lovKey.equalsIgnoreCase("PdsproductSearch"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Type Desc</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Product SubType Desc</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.getElementById('productIdSearch').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('productIdSearch').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('productIdSearch').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('productIdSearch').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('productIdSearch').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeSearch').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeSearch').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsRationCardTypeMaster.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearch"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Type Desc</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Product SubType Desc</b></th><th style="background-color: #99FF99;"><b>Unit</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.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnit<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnit<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnit<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnit<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnit<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productType<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubType<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnit<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsProductCreation.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearch"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Type Desc</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Product SubType Desc</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.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsRationCardTypeMaster.jsp") && (lovKey.equalsIgnoreCase("cardDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Card Type</b></th><th style="background-color: #99FF99;"><b>Card Desc</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.getElementById('card_type_mst_id').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('cardTypeSearch').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('cardDescriptionSearch').value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('card_type_mst_id').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('cardTypeSearch').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('cardDescriptionSearch').value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('card_type_mst_id').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('cardTypeSearch').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('cardDescriptionSearch').value = document.getElementById('z<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>


                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsRationCardTypeMaster.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearchAmend"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Type Desc</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Product SubType Desc</b></th><th style="background-color: #99FF99;"><b>Unit</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.getElementById('product_id_Amend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnitAmend<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id_Amend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnitAmend<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id_Amend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnitAmend<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id_Amend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnitAmend<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id_Amend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnitAmend<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('product_id_Amend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('productTypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('productSubTypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('quantiyUnitAmend<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("pdsRationingLedger.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Customer ID</b></th><th style="background-color: #99FF99;"><b>Ration Card No.</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th><th style="background-color: #99FF99;"><b>Card 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.rationingLedgerForm.customerId.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.rationingLedgerForm.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.rationingLedgerForm.cardHolderName.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.rationingLedgerForm.cardType.value = document.getElementById('a<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.rationingLedgerForm.customerId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardHolderName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardType.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.rationingLedgerForm.customerId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardHolderName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardType.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.rationingLedgerForm.customerId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardHolderName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.rationingLedgerForm.cardType.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("PdsSellItem.jsp") && (lovKey.equalsIgnoreCase("memberDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Customer ID</b></th><th style="background-color: #99FF99;"><b>Ration Card No.</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th><th style="background-color: #99FF99;"><b>Customer Card Type</b></th><th style="background-color: #99FF99;"><b>Customer Card 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.pdssaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.pdssaleitem.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.pdssaleitem.memberName.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.pdssaleitem.cardTypeId.value = document.getElementById('b<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>'onclick="opener.document.pdssaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.pdssaleitem.memberName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardTypeId.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.pdssaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.pdssaleitem.memberName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardTypeId.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.pdssaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.pdssaleitem.memberName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardTypeId.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.pdssaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardNo.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.pdssaleitem.memberName.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.pdssaleitem.cardTypeId.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>

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


            <%} else if (screenName.equalsIgnoreCase("pdsProductCreation.jsp") && (lovKey.equalsIgnoreCase("PdsproductSearch1"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Product Type</b></th><th style="background-color: #99FF99;"><b>Product Type Desc</b></th><th style="background-color: #99FF99;"><b>Product Sub Type</b></th><th style="background-color: #99FF99;"><b>Product SubType Desc</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.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id_search').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchByDescription').value = document.getElementById('y<%=i%>').innerHTML +':'+ document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('inventorySearchBySubTypeDescription').value = document.getElementById('a<%=i%>').innerHTML+':'+document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

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


            <%} else if (screenName.equalsIgnoreCase("PdsSellItem.jsp") && (lovKey.equalsIgnoreCase("PdsProductSearchForSell"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Commodity Type</b></th><th style="background-color: #99FF99;"><b>Commodity Description</b></th><th style="background-color: #99FF99;"><b>Commodity Subtype</b></th><th style="background-color: #99FF99;"><b>Subtype Description</b></th><th style="background-color: #99FF99;"><b>Eligible Quantity Remaining</b></th><th style="background-color: #99FF99;"><b>Stock ID</b></th><th style="background-color: #99FF99;"><b>Price/Unit</b></th><th style="background-color: #99FF99;"><b>Stock Avaible Quantity</b></th><th style="background-color: #99FF99;"><b>Stock Entry Date</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.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td  bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td  bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td  bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td  bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                       opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                       opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                       opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                       opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                       opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                       opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                       opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                       opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                       self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td  bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td  bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td  bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td  bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(9)%></td>
                    <td  bgcolor='<%=bgColor%>' id='g<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.getElementById('eligible_qty_reamining<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(10)%></td>

                </tr>
                <%}%>
            </table>
            <%}%>
        </form>
    </body>
    <%
                } catch (Exception ex) {
                    
                    System.out.println(headerQry);

                } finally {
                    if (resultSet != null) {
                        resultSet.close();
                    }
                    if (pstmt != null) {
                        pstmt.close();
                    }
                    if (conn != null) {
                        conn.close();
                    }
                }
    %>

</html>
