<%--
    Document   : CommonSearchInformationTradingLOV
    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" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css" />

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

                    screenName = request.getParameter("screenName");
                    lovKey = request.getParameter("lovKey");
                    String pacsId = session.getAttribute("pacsId").toString();
                    String subPacsFlag = (String) session.getAttribute("subPacsFlag");
                    String headPacsId = (String) session.getAttribute("headPacsId").toString();
                    String productId = request.getParameter("productId");

                    String headerQry = null;

                    if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("prodDetails"))) {

                       // searchString1 = request.getParameter("commoditytype");
                        //searchString2 = request.getParameter("Subtype");

                        if (searchString1.equalsIgnoreCase("") && searchString1.equalsIgnoreCase("")) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst t where t.pacs_Id = '" +pacsId+ "'";
                        } else if (!searchString1.equalsIgnoreCase("")) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst t where comm_type like '%" + searchString1.replace(' ', '%') + "%' and t.pacs_Id = '" +pacsId+ "' ";
                        } else if (!searchString2.equalsIgnoreCase("")) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst t where comm_subtype like '%" + searchString2.replace(' ', '%') + "%' and t.pacs_Id = '" +pacsId+ "'";
                        } else if ((!searchString1.equalsIgnoreCase("")) && (!searchString1.equalsIgnoreCase(""))) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst t where comm_type like '%" + searchString1 + "%' and comm_subtype like '%" + searchString2.replace(' ', '%') + "%' and t.pacs_Id = '" +pacsId+ "' ";
                        }

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

                       // textIndex = request.getParameter("Godowname");
                        if (textIndex.equalsIgnoreCase("")) {
                            headerQry = "select ID,GODOWN_NAME, GODOWN_ADDRESS, GODOWN_SPOC, PHN_NO,CAPACITY from trading_godown_mst g where g.pacs_id = '"+pacsId+"'";

                        } else {
                            headerQry = "select ID,GODOWN_NAME, GODOWN_ADDRESS, GODOWN_SPOC, PHN_NO,CAPACITY from trading_godown_mst g where g.pacs_id = '"+pacsId+"' and  GODOWN_NAME like '%" + textIndex.replace(' ', '%') + "%' ";

                        }

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

                        textIndex = request.getParameter("textIndex");

                        headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where pacs_id  = '" + pacsId + "'";

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

                       // textIndex = request.getParameter("VendorName");
                        if (textIndex.equalsIgnoreCase("")) {
                            headerQry = "select ID,NAME,ADDRESS,PHN_NO,CONTACT_PRSN,EFF_DATE,NVL(gst_no,'NA')gst_no from trading_vendor_mst where pacs_id='" + pacsId +"'";
                        } else {
                            headerQry = "select ID,NAME,ADDRESS,PHN_NO,CONTACT_PRSN,EFF_DATE,NVL(gst_no,'NA')gst_no from trading_vendor_mst where pacs_id='" + pacsId +"' LOWER(NAME) like '%" + textIndex.replace(' ', '%') + "%' ";

                        }


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

                       // textIndex = request.getParameter("customername");
                        if (subPacsFlag.equalsIgnoreCase("Y")) {
                            pacsId = headPacsId;
                        }

                        if (textIndex.equalsIgnoreCase("")) {
                            headerQry = "select CUST_ID,CUST_NAME,CUST_ADDRESS,CONTACT_NO,CONTACT_PERSON,NVL(gst_no,'NA')gst_no from trading_customer where pacs_id  = '" + pacsId + "'";
                        } else {
                            headerQry = "select CUST_ID,CUST_NAME,CUST_ADDRESS,CONTACT_NO,CONTACT_PERSON,NVL(gst_no,'NA')gst_no from trading_customer where CUST_NAME like '%" + textIndex.replace(' ', '%') + "%'  and pacs_id = '" + pacsId + "' ";
                        }

                    }
                    if ((screenName.equalsIgnoreCase("customer.jsp")) && (lovKey.equalsIgnoreCase("CifDetails"))) {

                        //searchString1 = request.getParameter("cifNumber");
                        if (subPacsFlag.equalsIgnoreCase("Y")) {
                            pacsId = headPacsId;
                        }
                        // searchString1 = "%" + searchString1 + "%";

                        headerQry = "select cif_no,(first_name||nvl2(middle_name,' '||middle_name,'')||nvl2(last_name,' '||last_name,'')) name,(address_1||nvl(address_1,' ')||' '|| nvl(address_2,' ')||' ' || nvl(address_3,'')) address,nvl(mobile_no,' ') mobile_no from kyc_hdr where cif_no = '" + searchString1.replace(' ', '%') + "' and pacs_id in (select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master pk where pk.pacs_id= '" + pacsId + "'))";
                        headerQry = "select cif_no,(first_name||nvl2(middle_name,' '||middle_name,'')||nvl2(last_name,' '||last_name,'')) name,(address_1||nvl(address_1,' ')||' '|| nvl(address_2,' ')||' ' || nvl(address_3,'')) address,nvl(mobile_no,' ') mobile_no from kyc_hdr where cif_no = '" + searchString1.replace(' ', '%') + "' and pacs_id in (select p.pacs_id from pacs_master p where p.head_pacs_id = (select head_pacs_id from pacs_master pk where pk.pacs_id= '" + pacsId + "'))";




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

                        textIndex = request.getParameter("textIndex");

                        headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where pacs_id  = '" + pacsId + "'";



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

                       // textIndex = request.getParameter("customername");
                        if (textIndex.equalsIgnoreCase("")) {
                            headerQry = "select CUST_ID,CUST_NAME,CUST_ADDRESS,CONTACT_NO,CONTACT_PERSON from trading_customer";
                        } else {
                            headerQry = "select CUST_ID,CUST_NAME,CUST_ADDRESS,CONTACT_NO,CONTACT_PERSON from trading_customer where CUST_NAME like '%" + textIndex.replace(' ', '%') + "%' ";
                        }


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

                        //searchString1 = request.getParameter("commoditytype");
                        //searchString2 = request.getParameter("Subtype");

                        if (searchString1.equalsIgnoreCase("") && searchString1.equalsIgnoreCase("")) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst";
                        } else if (!searchString1.equalsIgnoreCase("")) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1.replace(' ', '%') + "%' ";
                        } else if (!searchString2.equalsIgnoreCase("")) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_subtype like '%" + searchString2.replace(' ', '%') + "%' ";
                        } else if ((!searchString1.equalsIgnoreCase("")) && (!searchString1.equalsIgnoreCase(""))) {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1.replace(' ', '%') + "%' and comm_subtype like '%" + searchString2.replace(' ', '%') + "%' ";
                        }

                    } else if (screenName.equalsIgnoreCase("raisePurchaseOrder.jsp") && (lovKey.equalsIgnoreCase("prodDetails"))) {
                       // searchString1 = request.getParameter("commoditytype");
                        if (searchString1.equalsIgnoreCase("")) {
                            headerQry = "select id,comm_type,type_desc,comm_subtype,subtype_desc from trading_product_mst where pacs_id like '%" + pacsId + "%'";
                        } else {
                            headerQry = "select ID,comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1.replace(' ', '%') + "%' and pacs_id like '%" + pacsId + "%'";
                        }


                    } else if (screenName.equalsIgnoreCase("raisePurchaseOrder.jsp") && (lovKey.equalsIgnoreCase("vendorDetails"))) {
                        //searchString1 = request.getParameter("vendorname");
                       // searchString2 = request.getParameter("product_id");
                        if (searchString1.equalsIgnoreCase("")) {
                            headerQry = "select v.id,v.name,v.address,v.phn_no,v.contact_prsn,to_char(v.eff_date,'Month DD, yyyy') from trading_vendor_mst v,trading_product_mst p,trading_vendor_dtl d where v.id = d.vnd_mst_id and p.id=d.prod_id and p.id ='" + searchString2 + "' and p.pacs_id like '%" + pacsId + "%'";
                        } else {
                            headerQry = "select v.id,v.name,v.address,v.phn_no,v.contact_prsn,to_char(v.eff_date,'Month DD, yyyy') from trading_vendor_mst v,trading_product_mst p,trading_vendor_dtl d where v.id = d.vnd_mst_id and p.id=d.prod_id and p.id ='" + searchString2 + "' and LOWER(v.name) like '%" + searchString1.replace(' ', '%') + "%' and p.pacs_id like '%" + pacsId + "%'";
                        }


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

                       // searchString1 = request.getParameter("commoditytype");
                       // searchString2 = request.getParameter("Subtype");

                        if (searchString1.equalsIgnoreCase("") && searchString1.equalsIgnoreCase("")) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where pacs_id = '" + pacsId + "' ";
                        } else if (!searchString1.equalsIgnoreCase("")) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1.replace(' ', '%') + "%' and pacs_id = '" + pacsId + "' ";
                        } else if (!searchString2.equalsIgnoreCase("")) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_subtype like '%" + searchString2.replace(' ', '%') + "%' and pacs_id = '" + pacsId + "' ";
                        } else if ((!searchString1.equalsIgnoreCase("")) && (!searchString1.equalsIgnoreCase(""))) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1 + "%' and comm_subtype like '%" + searchString2.replace(' ', '%') + "%' and pacs_id = '" + pacsId + "' ";
                        }

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

                        //searchString1 = request.getParameter("commoditytype");
                        //searchString2 = request.getParameter("Subtype");

                        if (searchString1.equalsIgnoreCase("") && searchString1.equalsIgnoreCase("")) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where pacs_id = '" + pacsId + "' ";
                        } else if (!searchString1.equalsIgnoreCase("")) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1.replace(' ', '%') + "%' and pacs_id = '" + pacsId + "' ";
                        } else if (!searchString2.equalsIgnoreCase("")) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_subtype like '%" + searchString2.replace(' ', '%') + "%' and pacs_id = '" + pacsId + "' ";
                        } else if ((!searchString1.equalsIgnoreCase("")) && (!searchString1.equalsIgnoreCase(""))) {
                            headerQry = "select comm_type, TYPE_DESC, comm_subtype, SUBTYPE_DESC from trading_product_mst where comm_type like '%" + searchString1 + "%' and comm_subtype like '%" + searchString2.replace(' ', '%') + "%' and pacs_id = '" + pacsId + "' ";
                        }

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

                        headerQry = "select ID,GODOWN_NAME, GODOWN_ADDRESS, GODOWN_SPOC, PHN_NO,CAPACITY from trading_godown_mst where pacs_id = '" + pacsId + "' ";

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

                        headerQry = "select ID,GODOWN_NAME, GODOWN_ADDRESS, GODOWN_SPOC, PHN_NO,CAPACITY from trading_godown_mst where pacs_id = '" + pacsId + "' ";

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

                        headerQry = "select p.purchase_ref_no, m.comm_type,m.type_desc,m.comm_subtype,m.subtype_desc,p.prod_id,p.purchase_id,p.qty, p.unit_price from trading_purchase_order p, trading_product_mst m where p.prod_id = m.id and p.pacs_id='" + pacsId + "' and m.pacs_id='" + pacsId + "' and p.purchase_id not in (select k.purchase_id from  trading_stock_register k where pacs_id='" + pacsId + "') ";

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

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

                             if (searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select c.cust_id,c.cust_name,c.cust_address,decode(c.member_flag,'N','No','Y','Yes') as memberStatus,c.pacs_id from trading_customer c where c.pacs_id='" + pacsId + "'";                             
                              } else if (!searchString2.equalsIgnoreCase("")) {
                        headerQry = "select c.cust_id,c.cust_name,c.cust_address,decode(c.member_flag,'N','No','Y','Yes') as memberStatus,c.pacs_id from trading_customer c where upper(c.cust_name) like upper('%" + searchString2.replace(' ', '%') + "%') and c.pacs_id='" + pacsId + "'";
                             } /*   } else if (!searchString1.equalsIgnoreCase("") && searchString2.equalsIgnoreCase("")) {
                        headerQry = "select c.cust_id,c.cust_name,c.cust_address,decode(c.member_flag,'N','No','Y','Yes') as memberStatus,c.pacs_id from trading_customer c  where cust_id like '%" + searchString1.replace(' ', '%') + "%' and c.pacs_id='" + pacsId + "'";
                        } else {
                        headerQry = "select c.cust_id,c.cust_name,c.cust_address,decode(c.member_flag,'N','No','Y','Yes') as memberStatus,c.pacs_id from trading_customer c  where c.cust_id like '%" + searchString1.replace(' ', '%') + "%' and upper(c.name) like upper('%" + searchString2.replace(' ', '%') + "%') and c.pacs_id='" + pacsId + "'";
                        }*/

                    } else if (screenName.equalsIgnoreCase("SellItem.jsp") && (lovKey.equalsIgnoreCase("TrandingProductSearchForSell")|| lovKey.equalsIgnoreCase("TrandingProductSearchBarcode"))) {

                        textIndex = request.getParameter("textIndex");
                       // String memberStatus = request.getParameter("memberStatus");
                       // comType = request.getParameter("commoditytype");

                        if(lovKey.equalsIgnoreCase("TrandingProductSearchForSell")){
                        headerQry = "select m.comm_type,m.type_desc,m.comm_subtype,m.subtype_desc,m.id as productId,t.stock_id,t.quantity_available,to_char(t.stock_entry_date,'DD-MON-YYYY'), "
                                + "(case when upper('" + memberStatus + "') in ('NO') then round(((t.profit_factor*t.unit_price)/100)+t.unit_price) else round(((t.prof_fct_member*t.unit_price)/100)+t.unit_price) end) ,nvl((select GODOWN_NAME from trading_godown_mst ki where ki.id=t.godown_id),'NA')GODOWN_NAME "
                                + " from trading_product_mst m,trading_stock_register t,trading_purchase_order o where m.id=o.prod_id "
                                + " and o.purchase_id=t.purchase_id and o.prod_id=t.prod_id and upper(m.comm_type||m.type_desc||m.comm_subtype||m.subtype_desc) like upper('%" + comType + "%') "
                                + " and t.quantity_available>0 and (m.lease_flag is null or m.lease_flag='N') and t.pacs_id= '" + pacsId + "' order by t.stock_expiry_date ";
                         }else if(lovKey.equalsIgnoreCase("TrandingProductSearchBarcode"))
                             {
                                  //  String invId = request.getParameter("invId");
                                 headerQry = "select m.comm_type,m.type_desc,m.comm_subtype,m.subtype_desc,m.id as productId,t.stock_id,t.quantity_available,to_char(t.stock_entry_date,'DD-MON-YYYY'), "
                                + "(case when upper('" + memberStatus + "') in ('NO') then round(((t.profit_factor*t.unit_price)/100)+t.unit_price) else round(((t.prof_fct_member*t.unit_price)/100)+t.unit_price) end) "
                                + " from trading_product_mst m,trading_stock_register t,trading_purchase_order o where m.id=o.prod_id "
                                + " and o.purchase_id=t.purchase_id and o.prod_id=t.prod_id "
                                + " and t.quantity_available>0 and (m.lease_flag is null or m.lease_flag='N') and t.pacs_id= '" + pacsId + "' and  t.stock_id = '"+invId+"' order by t.stock_expiry_date ";
                             }



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


                        headerQry = "select  s.id as sale_id,p.id,p.product_code,p.product_name from trading_sale_details s,trading_product_mst p where s.product_id = p.id";

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

                        //searchString1 = request.getParameter("purchaseNo");
                        if (searchString1.equalsIgnoreCase("")) {

                            headerQry = "select p.purchase_id,m.name,p.purchase_ref_no,p.purchase_desc,p.total_amt, "
                                    + "p.amt_paid,to_char(p.payment_due_date,'dd/mm/yyyy') as payment_due_date,"
                                    + "to_number(p.total_amt-p.amt_paid) due_amt,t.cgst,t.sgst,t.id "
                                    + "from  trading_purchase_order p,trading_vendor_mst m,trading_product_mst t  "
                                    + "where m.id=p.vendor_id and p.prod_id=t.id "
                                    + "and p.mode_of_purchase='2' and to_number(p.total_amt-p.amt_paid)>0"
                                    + " and p.pacs_id= '" + pacsId + "' ";
                        } else {


                            headerQry = "select p.purchase_id,m.name,p.purchase_ref_no,p.purchase_desc,p.total_amt, "
                                    + "p.amt_paid,to_char(p.payment_due_date,'dd/mm/yyyy') as payment_due_date,"
                                    + "to_number(p.total_amt-p.amt_paid) due_amt,t.cgst,t.sgst,t.id "
                                    + "from  trading_purchase_order p,trading_vendor_mst m,trading_product_mst t  "
                                    + "where m.id=p.vendor_id and p.prod_id=t.id "
                                    + "and p.mode_of_purchase='2' and to_number(p.total_amt-p.amt_paid)>0"
                                    + " and p.pacs_id= '" + pacsId + "' and (p.purchase_ref_no  like upper('%" + searchString1.replace(' ', '%') + "%') "
                                    + " or p.purchase_id like upper('%" + searchString1.replace(' ', '%') + "%')) ";

                        }

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

                       // searchString1 = request.getParameter("glAcc");
                            headerQry = "select ga.key_1,ga.ledger_name,gp.gl_code from gl_account ga,gl_product gp where ga.gl_prod_id=gp.id and "
                                    + "(ga.key_1 like '%" + searchString1 + "%' or gp.gl_code like '%" + searchString1 + "%' or upper(gp.gl_name) like upper('%"  + searchString1 + "%'))"
                                    + " and ga.pacs_id= '" + pacsId + "' ";


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

                       // searchString1 = request.getParameter("glAcc");
                        searchString2 = request.getParameter("payMode");
                       // searchString3 = request.getParameter("custId");
                        if (subPacsFlag.equalsIgnoreCase("Y")) {
                            pacsId = headPacsId;
                        }
                        if(searchString2.equalsIgnoreCase("G")) {
                            headerQry = "select ga.key_1,ga.ledger_name,gp.gl_code from gl_account ga,gl_product gp where ga.gl_prod_id=gp.id and "
                                    + "(ga.key_1 like '%" + searchString1 + "%' or gp.gl_code like '%" + searchString1 + "%' or upper(gp.gl_name) like upper('%"  + searchString1 + "%'))"
                                    + " and ga.pacs_id= '" + pacsId + "' ";
                            } else if(searchString2.equalsIgnoreCase("T")) {
                             headerQry = "select da.key_1,(k.first_name || ' ' || k.middle_name || ' ' || k.last_name) custName,dp.prod_name, da.avail_bal from dep_account da, dep_product dp, kyc_hdr k"
                                    + " where da.dep_prod_id = dp.id and da.customer_no = k.cif_no and (da.customer_no = '" + searchString3 + "' or da.cif_no2 = '" + searchString3 + "') "
                                    + " and dp.prod_code in ('1101','1102') and da.pacs_id in (select p.pacs_id from pacs_master p where p.head_pacs_id = '" + pacsId + "') ";
                            }
                    } else if (screenName.equalsIgnoreCase("PaymentAcknowledgement.jsp") && (lovKey.equalsIgnoreCase("searchSales"))) {

                       // searchString1 = request.getParameter("salesNo");
                        if (searchString1.equalsIgnoreCase("")) {

                            headerQry = " select p.sales_ref_id,m.cust_id,m.cust_name,'NA' prod, "
                                        + " to_number(p.total_amt - p.amount_paid) due_amt,nvl(to_char(p.payment_due_date, 'DD-MON-YYYY'),'NA') as payment_due_date,"
                                        + " sum (t.qty * t.unit_sp) prod_tot_amt, sum((t.qty * t.unit_sp) - t.amt_paid) prod_amt_due,"
                                        + " nvl((select max(nvl(tp.cgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) cgst ,"
                                        + " nvl((select max(nvl(tp.sgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) sgst,p.total_amt,p.amount_paid, max(t.prod_id) id "
                                        + " from trading_sales_hdr p,trading_customer m, trading_sales_dtl t "
                                        + " where m.cust_id=p.cust_id and p.sales_ref_id=t.sales_ref_id "
                                        + " and p.mode_of_sales='2' and to_number(p.total_amt-p.amount_paid)>0 and ((t.qty*t.unit_sp)-t.amt_paid)>0"
                                        + " and p.pacs_id= '" + pacsId + "' group by p.sales_ref_id,m.cust_id,m.cust_name,to_number(p.total_amt - p.amount_paid),p.total_amt, p.amount_paid,p.payment_due_date "; 
                        } else {

                            headerQry = " select p.sales_ref_id,m.cust_id,m.cust_name,'NA' prod, "
                                        + " to_number(p.total_amt - p.amount_paid) due_amt,nvl(to_char(p.payment_due_date, 'DD-MON-YYYY'),'NA') as payment_due_date,"
                                        + " sum (t.qty * t.unit_sp) prod_tot_amt, sum((t.qty * t.unit_sp) - t.amt_paid) prod_amt_due,"
                                        + " nvl((select max(nvl(tp.cgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) cgst ,"
                                        + " nvl((select max(nvl(tp.sgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) sgst,p.total_amt,p.amount_paid, max(t.prod_id) id "
                                        + " from trading_sales_hdr p,trading_customer m, trading_sales_dtl t "
                                        + " where m.cust_id=p.cust_id and p.sales_ref_id=t.sales_ref_id "
                                        + " and p.mode_of_sales='2' and to_number(p.total_amt-p.amount_paid)>0 and ((t.qty*t.unit_sp)-t.amt_paid)>0"
                                        + " and p.pacs_id= '" + pacsId + "' and p.sales_ref_id like upper('%" + searchString1.replace(' ', '%') + "%') group by p.sales_ref_id,m.cust_id,m.cust_name,to_number(p.total_amt - p.amount_paid),p.total_amt, p.amount_paid,p.payment_due_date "; 

                        }

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

                        //searchString1 = request.getParameter("purchaseNo");
                        if (searchString1.equalsIgnoreCase("")) {

                            headerQry = "select p.purchase_id,m.name,p.purchase_ref_no,p.purchase_desc,p.total_amt, "
                                    + "p.amt_paid,to_char(p.payment_due_date,'dd/mm/yyyy') as payment_due_date,"
                                    + "to_number(p.total_amt-p.amt_paid) due_amt,t.cgst,t.sgst,t.id "
                                    + "from  trading_purchase_order p,trading_vendor_mst m,trading_product_mst t  "
                                    + "where m.id=p.vendor_id and p.prod_id=t.id "
                                    + "and p.mode_of_purchase='2' and to_number(p.total_amt-p.amt_paid)>0"
                                    + " and p.pacs_id= '" + pacsId + "' ";
                        } else {


                            headerQry = "select p.purchase_id,m.name,p.purchase_ref_no,p.purchase_desc,p.total_amt, "
                                    + "p.amt_paid,to_char(p.payment_due_date,'dd/mm/yyyy') as payment_due_date,"
                                    + "to_number(p.total_amt-p.amt_paid) due_amt,t.cgst,t.sgst,t.id "
                                    + "from  trading_purchase_order p,trading_vendor_mst m,trading_product_mst t  "
                                    + "where m.id=p.vendor_id and p.prod_id=t.id "
                                    + "and p.mode_of_purchase='2' and to_number(p.total_amt-p.amt_paid)>0"
                                    + " and p.pacs_id= '" + pacsId + "' and (p.purchase_ref_no  like upper('%" + searchString1.replace(' ', '%') + "%') "
                                    + " or p.purchase_id like upper('%" + searchString1.replace(' ', '%') + "%')) ";

                        }

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

                       // searchString1 = request.getParameter("salesNo");
                        if (searchString1.equalsIgnoreCase("")) {

                            headerQry = " select p.sales_ref_id,m.cust_id,m.cust_name,'NA' prod, "
                                        + " to_number(p.total_amt - p.amount_paid) due_amt,nvl(to_char(p.payment_due_date, 'DD-MON-YYYY'),'NA') as payment_due_date,"
                                        + " sum (t.qty * t.unit_sp) prod_tot_amt, sum((t.qty * t.unit_sp) - t.amt_paid) prod_amt_due,"
                                        + " nvl((select max(nvl(tp.cgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) cgst ,"
                                        + " nvl((select max(nvl(tp.sgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) sgst,p.total_amt,p.amount_paid, max(t.prod_id) id "
                                        + " from trading_sales_hdr p,trading_customer m, trading_sales_dtl t "
                                        + " where m.cust_id=p.cust_id and p.sales_ref_id=t.sales_ref_id "
                                        + " and p.mode_of_sales='2' and to_number(p.total_amt-p.amount_paid)>0 and ((t.qty*t.unit_sp)-t.amt_paid)>0"
                                        + " and p.pacs_id= '" + pacsId + "' group by p.sales_ref_id,m.cust_id,m.cust_name,to_number(p.total_amt - p.amount_paid),p.total_amt, p.amount_paid,p.payment_due_date "; 
                        } else {

                            headerQry = " select p.sales_ref_id,m.cust_id,m.cust_name,'NA' prod, "
                                        + " to_number(p.total_amt - p.amount_paid) due_amt,nvl(to_char(p.payment_due_date, 'DD-MON-YYYY'),'NA') as payment_due_date,"
                                        + " sum (t.qty * t.unit_sp) prod_tot_amt, sum((t.qty * t.unit_sp) - t.amt_paid) prod_amt_due,"
                                        + " nvl((select max(nvl(tp.cgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) cgst ,"
                                        + " nvl((select max(nvl(tp.sgst, 0)) from trading_product_mst tp where tp.id in (select prod_id from trading_sales_dtl li where li.sales_ref_id=p.sales_ref_id)),0) sgst,p.total_amt,p.amount_paid, max(t.prod_id) id "
                                        + " from trading_sales_hdr p,trading_customer m, trading_sales_dtl t "
                                        + " where m.cust_id=p.cust_id and p.sales_ref_id=t.sales_ref_id "
                                        + " and p.mode_of_sales='2' and to_number(p.total_amt-p.amount_paid)>0 and ((t.qty*t.unit_sp)-t.amt_paid)>0"
                                        + " and p.pacs_id= '" + pacsId + "' and p.sales_ref_id like upper('%" + searchString1.replace(' ', '%') + "%') group by p.sales_ref_id,m.cust_id,m.cust_name,to_number(p.total_amt - p.amount_paid),p.total_amt, p.amount_paid,p.payment_due_date "; 

                        }

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

                       // searchString1 = request.getParameter("commoditytype");
                        searchString2 = request.getParameter("tranType");

                        if (searchString2.equalsIgnoreCase("L")) {
                            headerQry = "select t.comm_type,t.type_desc,t.comm_subtype,t.subtype_desc,t.price_per_unit,decode(t.price_freq,'D','Daily','W','Weekly','M','Monthly','Q','Quaterly','H','Half-Yearly','Y','Yearly'),t.min_trm,t.max_trm,t.id from trading_product_mst t where t.active_flag='A' and t.lease_flag='Y' and t.comm_type like '%" + searchString1 + "%' and pacs_id like '%" + pacsId + "%'";
                        } else if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {
                            if (subPacsFlag.equalsIgnoreCase("Y")) {
                                pacsId = headPacsId;
                            }
                            headerQry = "select tp.comm_type, tp.type_desc, tp.comm_subtype,  tp.subtype_desc, tp.price_per_unit, decode(tp.price_freq,'D','Daily','W','Weekly','M','Monthly','Q','Quaterly','H','Half-Yearly','Y','Yearly'),tp.min_trm,tp.max_trm,tp.id from trading_product_mst tp where tp.id in (select t.prod_id from trading_lease t where t.active_flag='Y' and t.pacs_id in (select p.pacs_id from pacs_master p where p.head_pacs_id = '" + pacsId + "')) and tp.lease_flag='Y' and tp.comm_type like '%" + searchString1 + "%'";
                        } else {
                            headerQry = "select * from trading_product_mst where 1=2";
                        }

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

                        //searchString1 = request.getParameter("custID");
                        searchString2 = request.getParameter("tranType");
                        if (subPacsFlag.equalsIgnoreCase("Y")) {
                            pacsId = headPacsId;
                        }
                        if (searchString2.equalsIgnoreCase("L")) {
                            headerQry = "select t.cust_id,t.cust_name,t.cust_address,t.contact_no,t.contact_person,decode(t.member_flag,'Y','MEMBER','NON-MEMBER') cust_type,t.cif_no,t.pacs_id from trading_customer t where t.pacs_id in (select p.pacs_id from pacs_master p where p.head_pacs_id = '" + pacsId + "') and (t.cust_id like '%" + searchString1 + "%' or t.cif_no like '%" + searchString1 + "%' or upper(t.cust_name) like upper('%" + searchString1 + "%'))";
                        } else if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {
                            headerQry = "select t.cust_id,tc.cust_name,tc.cust_address,tc.contact_no,tc.contact_person,decode(tc.member_flag, 'Y', 'MEMBER', 'NON-MEMBER') cust_type,tc.cif_no,tc.pacs_id,t.no_of_units,to_char(t.trm_from,'DD-MON-YYYY'),t.sec_amt,t.tot_amt,t.id,t.amt_paid,(t.tot_amt-t.amt_paid),t.due_flag,(t.trm_to-t.trm_from),t.price_freq from TRADING_LEASE t, trading_customer tc where t.cust_id = tc.cust_id and t.active_flag = 'Y' and (upper(tc.cust_name) like '%" + searchString1 + "%' or tc.cust_id like '%" + searchString1 + "%' or tc.cif_no like '%" + searchString1 + "%') and t.pacs_id in (select p.pacs_id from pacs_master p where p.head_pacs_id = '" + pacsId + "')";
                        } else {
                            headerQry = "select * from trading_product_mst where 1=2";
                        }

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

                        searchString1 = request.getParameter("commoditytype");
                        headerQry = "select unique t.comm_type,t.type_desc,max(t.comm_subtype)+1 from trading_product_mst t group by t.comm_type,t.type_desc";
                        

                    }  else if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("purchaseGL"))) {
                        
                       // searchString1 = request.getParameter("accNo");                         
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) ='34' and gp.comp1 = '34000' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("saleGL"))) {
                        
                        //searchString1 = request.getParameter("accNo"); 
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) ='41' and gp.comp1 = '41000' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if ((screenName.equalsIgnoreCase("tradingProductCreation.jsp")) && (lovKey.equalsIgnoreCase("closeGL"))) {

                        //searchString1 = request.getParameter("accNo");  
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('45','46','47') and gp.comp1 in ('45000', '46000', '47000') and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";

                    } else if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("tradeGL"))) {
                        
                       // searchString1 = request.getParameter("accNo"); 
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) ='26' and gp.comp1 = '26000' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("purchaseGLAmend"))) {
                        
                       // searchString1 = request.getParameter("accNo");                         
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) ='34' and gp.comp1 = '34000' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("saleGLAmend"))) {
                        
                       //searchString1 = request.getParameter("accNo"); 
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) ='41' and gp.comp1 = '41000' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    } else if ((screenName.equalsIgnoreCase("tradingProductCreation.jsp")) && (lovKey.equalsIgnoreCase("closeGLAmend"))) {

                        //searchString1 = request.getParameter("accNo");  
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) in ('45','46','47') and gp.comp1 in ('45000', '46000', '47000') and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";

                    } else if (screenName.equalsIgnoreCase("tradingProductCreation.jsp") && (lovKey.equalsIgnoreCase("tradeGLAmend"))) {
                        
                        //searchString1 = request.getParameter("accNo"); 
                        headerQry = " select ga.key_1, ga.ledger_name, gp.gl_code, gp.id, gp.gl_name from gl_account ga, gl_product gp where substr(ga.gl_class_code, 9, 2) ='26' and gp.comp1 = '26000' and ga.gl_prod_id = gp.id and ga.pacs_id= '" + pacsId + "' and (gp.gl_code like '%" + searchString1.replace(' ', '%') + "%' or gp.gl_name like upper('%" + searchString1.replace(' ', '%') + "%') or ga.key_1 like '%" + searchString1.replace(' ', '%') + "%') ";
                    
                    }

                    System.out.println(headerQry);
                    Connection conn = DbHandler.getDBConnection();
                    PreparedStatement pstmt = null;

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

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

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

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

            <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>SubType</b></th><th style="background-color: #99FF99;"><b>SubType 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.tradingProductForm.commoditytypeSearch.value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                    opener.document.tradingProductForm.commoditySubtypeSearch.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                    opener.document.tradingProductForm.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.tradingProductForm.commoditytypeSearch.value = document.getElementById('y<%=i%>').innerHTML+ ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingProductForm.commoditySubtypeSearch.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingProductForm.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.tradingProductForm.commoditytypeSearch.value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingProductForm.commoditySubtypeSearch.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingProductForm.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.tradingProductForm.commoditytypeSearch.value = document.getElementById('y<%=i%>').innerHTML+ ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingProductForm.commoditySubtypeSearch.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingProductForm.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.tradingProductForm.commoditytypeSearch.value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingProductForm.commoditySubtypeSearch.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingProductForm.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>



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

            <%}
                                    if ((screenName.equalsIgnoreCase("VendorEnrollmentEnquiry.jsp")) && (lovKey.equalsIgnoreCase("TradingProductSearch"))) {%>
               <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Product found for your pacs !</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <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>SubType</b></th><th style="background-color: #99FF99;"><b>SubType 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.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('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="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('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="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('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="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('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="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('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

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

            <%} }
                  if ((screenName.equalsIgnoreCase("VendorEnrollmentEnquiry.jsp")) && (lovKey.equalsIgnoreCase("TradingProductSearchAmend"))) {%>
               <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No product found ! Please add new product for this vendor</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <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>SubType</b></th><th style="background-color: #99FF99;"><b>SubType 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.getElementById('commoditytypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML ;
                    opener.document.getElementById('typeDescAmend<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML ;
                    opener.document.getElementById('commoditysubtypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML ;
                    opener.document.getElementById('subtypeDescAmend<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML ;
                    opener.document.getElementById('product_idAmend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('commoditytypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.getElementById('typeDescAmend<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML ;
                        opener.document.getElementById('commoditysubtypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML ;
                        opener.document.getElementById('subtypeDescAmend<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML ;
                        opener.document.getElementById('product_idAmend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('commoditytypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typeDescAmend<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML ;
                        opener.document.getElementById('subtypeDescAmend<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML ;
                        opener.document.getElementById('product_idAmend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('commoditytypeAmend<%=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('product_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('commoditytypeAmend<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('typeDescAmend<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtypeAmend<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML ;
                        opener.document.getElementById('subtypeDescAmend<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML ;
                        opener.document.getElementById('product_idAmend<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>

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

            <%} } else if ((screenName.equalsIgnoreCase("VendorEnrollmentEnquiry.jsp")) && (lovKey.equalsIgnoreCase("VendorDetails"))) {%>
                <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Vendor found ! Close this window & Create new Vendor</p>
                <input type="button" value="Close Window" onclick="self.close();">
            </center>
            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Phone No.</b></th><th style="background-color: #99FF99;"><b>Contact Person</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.VendorMasterForm.vendornameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                    opener.document.VendorMasterForm.vendorID.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.VendorMasterForm.vendornameSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.VendorMasterForm.vendorID.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.VendorMasterForm.vendornameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.VendorMasterForm.vendorID.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.VendorMasterForm.vendornameSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.VendorMasterForm.vendorID.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.VendorMasterForm.vendornameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.VendorMasterForm.vendorID.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.VendorMasterForm.vendornameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.VendorMasterForm.vendorID.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display:none"><%=resultSet.getString(6)%></td>


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

            <table border="2">
                <tr><th style="background-color: #99FF99;display: none;"><b> ID</b></th><th style="background-color: #99FF99;"><b>Commodity Type</b></th><th style="background-color: #99FF99;"><b>Type desc</b></th><th style="background-color: #99FF99;"><b>Sub Type</b></th><th style="background-color: #99FF99;"><b>Sub-Type 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.tradingPurchaseOrder.commoditytype.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.tradingPurchaseOrder.typedesc.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.tradingPurchaseOrder.commoditysubtype.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.tradingPurchaseOrder.subtypedesc.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.tradingPurchaseOrder.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;display: none;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.tradingPurchaseOrder.commoditytype.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.typedesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.commoditysubtype.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.subtypedesc.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.tradingPurchaseOrder.commoditytype.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.typedesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.commoditysubtype.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.subtypedesc.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.tradingPurchaseOrder.commoditytype.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.typedesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.commoditysubtype.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.subtypedesc.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.tradingPurchaseOrder.commoditytype.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.typedesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.commoditysubtype.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.subtypedesc.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.tradingPurchaseOrder.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>



                </tr>
                <%}%>
            </table><%} else if ((screenName.equalsIgnoreCase("raisePurchaseOrder.jsp")) && (lovKey.equalsIgnoreCase("vendorDetails"))) {%>
            <% if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Vendor found! Close this window and Please reenter Vendor Name. Then, Search.</p>
                <input type="button" value="Close" onclick="self.close();opener.document.getElementById('vendorname').value = '';">
            </center>

            <% } else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;display: none;"><b> ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Phone no.</b></th><th style="background-color: #99FF99;"><b>Contact Person</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('vendor_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('vendorname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;display: none;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('vendor_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('vendorname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('vendor_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('vendorname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('vendor_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('vendorname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('vendor_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('vendorname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>COMMODITY TYPE</b></th><th style="background-color: #99FF99;"><b>COMMODITY TYPE DESCRPITION</b></th><th style="background-color: #99FF99;"><b>SUB TYPE</b></th><th style="background-color: #99FF99;"><b>SUB TYPE 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.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if ((screenName.equalsIgnoreCase("tradingstockregisteredit.jsp")) && (lovKey.equalsIgnoreCase("editDetails"))) {%>

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>COMMODITY TYPE</b></th><th style="background-color: #99FF99;"><b>COMMODITY TYPE DESCRPITION</b></th><th style="background-color: #99FF99;"><b>SUB TYPE</b></th><th style="background-color: #99FF99;"><b>SUB TYPE 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.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('commoditytypeSearch').value= document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditySubtypeSearch').value= document.getElementById('z<%=i%>').innerHTML;self.close()
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if ((screenName.equalsIgnoreCase("customer.jsp")) && (lovKey.equalsIgnoreCase("CifDetails"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>CIF Number</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Phone</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.CustomerEnrollmentForm.cif_no.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.CustomerEnrollmentForm.name.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.CustomerEnrollmentForm.address.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.CustomerEnrollmentForm.phone.value = document.getElementById('b<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.CustomerEnrollmentForm.cif_no.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.name.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.address.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phone.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.CustomerEnrollmentForm.cif_no.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.name.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.address.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phone.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.CustomerEnrollmentForm.cif_no.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.name.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.address.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phone.value = document.getElementById('b<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>

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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Phone No.</b></th><th style="background-color: #99FF99;"><b>Contact Person</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.CustomerEnrollmentForm.namesearch.value = document.getElementById('y<%=i%>').innerHTML ;
                    opener.document.CustomerEnrollmentForm.cif_noAmend.value = document.getElementById('x<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.addressAmend.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.CustomerEnrollmentForm.phoneAmend.value = document.getElementById('a<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.contactpersonAmend.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.CustomerEnrollmentForm.gstinAmend.value = document.getElementById('c<%=i%>').innerHTML;self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.CustomerEnrollmentForm.namesearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.CustomerEnrollmentForm.cif_noAmend.value = document.getElementById('x<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.addressAmend.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phoneAmend.value = document.getElementById('a<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.contactpersonAmend.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.gstinAmend.value = document.getElementById('c<%=i%>').innerHTML;self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.CustomerEnrollmentForm.namesearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.CustomerEnrollmentForm.cif_noAmend.value = document.getElementById('x<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.addressAmend.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phoneAmend.value = document.getElementById('a<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.contactpersonAmend.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.gstinAmend.value = document.getElementById('c<%=i%>').innerHTML;self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.CustomerEnrollmentForm.namesearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.CustomerEnrollmentForm.cif_noAmend.value = document.getElementById('x<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.addressAmend.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phoneAmend.value = document.getElementById('a<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.contactpersonAmend.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.gstinAmend.value = document.getElementById('c<%=i%>').innerHTML;self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.CustomerEnrollmentForm.namesearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.CustomerEnrollmentForm.cif_noAmend.value = document.getElementById('x<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.addressAmend.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phoneAmend.value = document.getElementById('a<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.contactpersonAmend.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.gstinAmend.value = document.getElementById('c<%=i%>').innerHTML;self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.CustomerEnrollmentForm.namesearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.CustomerEnrollmentForm.cif_noAmend.value = document.getElementById('x<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.addressAmend.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.phoneAmend.value = document.getElementById('a<%=i%>').innerHTML;opener.document.CustomerEnrollmentForm.contactpersonAmend.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.CustomerEnrollmentForm.gstinAmend.value = document.getElementById('c<%=i%>').innerHTML;self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(6)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Contact Person</b></th><th style="background-color: #99FF99;"><b>Phone No.</b></th><th style="background-color: #99FF99;"><b>Capacity</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('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('godownname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('godownname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('godownname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('godownname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('godownname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('godownname<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Contact Person</b></th><th style="background-color: #99FF99;"><b>Phone No.</b></th><th style="background-color: #99FF99;"><b>Capacity</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('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('godown_id<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Purchase Reference no</b></th><th style="background-color: #99FF99;"><b>Commodity type</b></th><th style="background-color: #99FF99;"><b>Type desc</b></th><th style="background-color: #99FF99;"><b>Subtype</b></th><th style="background-color: #99FF99;"><b>SubType desc</b></th><th style="background-color: #99FF99;"><b>Product ID</b></th><th style="background-color: #99FF99;"><b>Purchase ID</b></th><th style="background-color: #99FF99;"><b>Quantity</b></th><th style="background-color: #99FF99;"><b>Price/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('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                    opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                    opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.getElementById('purchaserefno<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('purchase_id<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price_unit<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.getElementById('quantity<%=textIndex%>').value = document.getElementById('e<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(9)%></td>




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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Phone No.</b></th><th style="background-color: #99FF99;"><b>Contact Person</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.tradingsaleregister.customername.value = document.getElementById('y<%=i%>').innerHTML ;
                    opener.document.tradingsaleregister.customer_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.tradingsaleregister.customername.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.tradingsaleregister.customer_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.tradingsaleregister.customername.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.tradingsaleregister.customer_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.tradingsaleregister.customername.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.tradingsaleregister.customer_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.tradingsaleregister.customername.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.tradingsaleregister.customer_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>



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

            <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>SubType</b></th><th style="background-color: #99FF99;"><b>SubType 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.tradingsaleregister.commoditytype.value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                    opener.document.tradingsaleregister.commoditysubtype.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                    opener.document.tradingsaleregister.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.tradingsaleregister.commoditytype.value = document.getElementById('y<%=i%>').innerHTML+ ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.commoditysubtype.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.tradingsaleregister.commoditytype.value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.commoditysubtype.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.tradingsaleregister.commoditytype.value = document.getElementById('y<%=i%>').innerHTML+ ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.commoditysubtype.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.tradingsaleregister.commoditytype.value = document.getElementById('y<%=i%>').innerHTML + ':' + document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.commoditysubtype.value = document.getElementById('a<%=i%>').innerHTML + ':' + document.getElementById('b<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.product_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>



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

            <%} else if (screenName.equalsIgnoreCase("SellItem.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><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Member Status</b></th><th style="background-color: #99FF99;"><b>PACS 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.tradingsaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.tradingsaleitem.memberName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.tradingsaleitem.memberStatus.value = document.getElementById('a<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.tradingsaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberName.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberStatus.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.tradingsaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberName.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberStatus.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.tradingsaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberName.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberStatus.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.tradingsaleitem.memberId.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberName.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.tradingsaleitem.memberStatus.value = document.getElementById('a<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                </tr>
                <%}%>
            </table>
            <%} else if (screenName.equalsIgnoreCase("SellItem.jsp") && (lovKey.equalsIgnoreCase("TrandingProductSearchForSell")|| lovKey.equalsIgnoreCase("TrandingProductSearchBarcode"))) {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Godown</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>Sub Type</b></th><th style="background-color: #99FF99;"><b>Subtype Description</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>Quantity Available</b></th><th style="background-color: #99FF99;"><b>Stock Entry Date</b></th><th style="background-color: #99FF99;"><b>Price/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='xx<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(10)%></td>
                    <td  bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.getElementById('product_id<%=textIndex%>').value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=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('b<%=i%>').innerHTML;
                        opener.document.getElementById('stockId<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('commoditytype<%=textIndex%>').value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.getElementById('typedesc<%=textIndex%>').value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.getElementById('commoditysubtype<%=textIndex%>').value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.getElementById('subtypedesc<%=textIndex%>').value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.getElementById('p_order_id<%=textIndex%>').value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.getElementById('quantity_avl<%=textIndex%>').value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.getElementById('price<%=textIndex%>').value = document.getElementById('f<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(9)%></td>

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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>SALE ID</b></th><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Product Code</b></th><th style="background-color: #99FF99;"><b>Product 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.tradingsaleregister.itemCode.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.tradingsaleregister.itemName.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.tradingsaleregister.productId.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.tradingsaleregister.itemCode.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.itemName.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.productId.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.tradingsaleregister.itemCode.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.itemName.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.productId.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.tradingsaleregister.itemCode.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.itemName.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.tradingsaleregister.productId.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Purchase ID</b></th><th style="background-color: #99FF99;"><b>Vendor Name</b></th><th style="background-color: #99FF99;"><b>Purchase Ref No.</b></th><th style="background-color: #99FF99;"><b>Description</b></th><th style="background-color: #99FF99;"><b>Total Amount</b></th><th style="background-color: #99FF99;"><b>Amount Paid</b></th><th style="background-color: #99FF99;"><b>Paymenent Due Date</b></th><th style="background-color: #99FF99;"><b>Due Amount</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.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(9)%></td>
                    <td bgcolor='<%=bgColor%>' id='g<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(10)%></td>
                    <td bgcolor='<%=bgColor%>' id='h<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(11)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Purchase ID</b></th><th style="background-color: #99FF99;"><b>Vendor Name</b></th><th style="background-color: #99FF99;"><b>Purchase Ref No.</b></th><th style="background-color: #99FF99;"><b>Description</b></th><th style="background-color: #99FF99;"><b>Total Amount</b></th><th style="background-color: #99FF99;"><b>Amount Paid</b></th><th style="background-color: #99FF99;"><b>Paymenent Due Date</b></th><th style="background-color: #99FF99;"><b>Due Amount</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.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.cgstv.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.sgstv.value = document.getElementById('g<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(9)%></td>
                    <td bgcolor='<%=bgColor%>' id='g<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(10)%></td>
                    <td bgcolor='<%=bgColor%>' id='h<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.orderno.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vduedate.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vtotal.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountpaid.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.amountdue.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('h<%=i%>').innerHTML;
                        opener.document.PaymentAcknowledgementForm.vendorName.value = document.getElementById('y<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer; display: none;"><%=resultSet.getString(11)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>ID</b></th><th style="background-color: #99FF99;"><b>Name</b></th><th style="background-color: #99FF99;"><b>Address</b></th><th style="background-color: #99FF99;"><b>Contact Person</b></th><th style="background-color: #99FF99;"><b>Phone No.</b></th><th style="background-color: #99FF99;"><b>Capacity</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.GodownForm.nameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                    opener.document.GodownForm.godown_id.value = document.getElementById('x<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.GodownForm.nameSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.GodownForm.godown_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.GodownForm.nameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.GodownForm.godown_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.GodownForm.nameSearch.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.GodownForm.godown_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.GodownForm.nameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.GodownForm.godown_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.GodownForm.nameSearch.value = document.getElementById('y<%=i%>').innerHTML ;
                        opener.document.GodownForm.godown_id.value = document.getElementById('x<%=i%>').innerHTML;
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>



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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Sales ID</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th><th style="background-color: #99FF99;"><b>Total Amount Due</b></th><th style="background-color: #99FF99;"><b>Payment Due Date</b></th><th style="background-color: #99FF99;"><b>Product Total Amount</b></th><th style="background-color: #99FF99;"><b>Product Amount Due</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.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(9)%></td>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(10)%></td>
                    <td bgcolor='<%=bgColor%>' id='g<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(13)%></td>
                    <td bgcolor='<%=bgColor%>' id='h<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(2)%></td>

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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Sell ID</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th><th style="background-color: #99FF99;"><b>Total Amount Due</b></th><th style="background-color: #99FF99;"><b>Payment Due Date</b></th><th style="background-color: #99FF99;"><b>Product Total Amount</b></th><th style="background-color: #99FF99;"><b>Product Amount Due</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.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(9)%></td>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(10)%></td>
                    <td bgcolor='<%=bgColor%>' id='g<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(13)%></td>
                    <td bgcolor='<%=bgColor%>' id='h<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.salesrefno.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.customerName.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.totalDue.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.dueDt.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalAmt.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prodTotalDue.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cgstc.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.sgstc.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.prod_id.value = document.getElementById('g<%=i%>').innerHTML;
                    opener.document.PaymentAcknowledgementForm.cust_id.value = document.getElementById('h<%=i%>').innerHTML;
                    self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(2)%></td>

                </tr>
                <%}%>
            </table>
            <%} else if ((screenName.equalsIgnoreCase("leaseRentCommodity.jsp")) && (lovKey.equalsIgnoreCase("commDetails"))) {%>
            <%if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Lease product found</p>
                <input type="button" value="Close Window" onclick="self.close();"></center><%} else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Commodity Type</b></th><th style="background-color: #99FF99;"><b>Commodity Type Desc</b></th><th style="background-color: #99FF99;"><b>Commodity Sub-Type</b></th><th style="background-color: #99FF99;"><b>Sub-Type Desc</b></th><th style="background-color: #99FF99;"><b>Price Per Unit</b></th><th style="background-color: #99FF99;"><b>Price Frequency</b></th><th style="background-color: #99FF99;"><b>Minimum Term</b></th><th style="background-color: #99FF99;"><b>Maximum Term</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.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                    opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                    opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                    opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                    opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                    opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                    opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                    opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                    opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                    opener.showHidden();
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <td bgcolor='<%=bgColor%>' id='e<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.leaseCommodity.commType.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commTypeDesc.value = document.getElementById('y<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubType.value = document.getElementById('z<%=i%>').innerHTML;
                        opener.document.leaseCommodity.commSubTypeDesc.value = document.getElementById('a<%=i%>').innerHTML;
                        opener.document.leaseCommodity.pricePerUnit.value = document.getElementById('b<%=i%>').innerHTML;
                        opener.document.leaseCommodity.priceFreq.value = document.getElementById('c<%=i%>').innerHTML;
                        opener.document.leaseCommodity.minTrm.value = document.getElementById('d<%=i%>').innerHTML;
                        opener.document.leaseCommodity.maxTrm.value = document.getElementById('e<%=i%>').innerHTML;
                        opener.document.leaseCommodity.prod_id.value = document.getElementById('f<%=i%>').innerHTML;
                        opener.showHidden();
                        self.close();" style="cursor:pointer;display: none;"><%=resultSet.getString(9)%></td>

                </tr>
                <%}%>
            </table>
            <%}
                                                } else if ((screenName.equalsIgnoreCase("leaseRentCommodity.jsp")) && (lovKey.equalsIgnoreCase("custDetails"))) {%>
            <%if (!resultSet.isBeforeFirst()) {%>
            <center><p>No Customer found</p>
                <input type="button" value="Close Window" onclick="self.close();"></center><%} else {%>
            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>Pacs ID</b></th><th style="background-color: #99FF99;"><b>Customer ID</b></th><th style="background-color: #99FF99;"><b>Customer Name</b></th><th style="background-color: #99FF99;"><b>Customer Address</b></th><th style="background-color: #99FF99;"><b>Contact Number</b></th><th style="background-color: #99FF99;"><b>Contact Person</b></th><th style="background-color: #99FF99;"><b>Customer Type</b></th><th style="background-color: #99FF99;"><b>CIF Number</b></th><%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%><th style="background-color: #99FF99;"><b>Number of Units</b></th><th style="background-color: #99FF99;"><b>Lease/Rent Start Date</b></th><th style="background-color: #99FF99;"><b>Security Amount</b></th><th style="background-color: #99FF99;"><b>Total Amount</b></th><th style="background-color: #99FF99;"><b>Amount Paid</b></th><th style="background-color: #99FF99;"><b>Amount Due</b></th><th style="background-color: #99FF99;"><b>Term Length</b></th><th style="background-color: #99FF99;"><b>Price Frequency</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='e<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(8)%></td>
                    <td bgcolor='<%=bgColor%>' id='x<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>
                    <td bgcolor='<%=bgColor%>' id='a<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(4)%></td>
                    <td bgcolor='<%=bgColor%>' id='b<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(5)%></td>
                    <td bgcolor='<%=bgColor%>' id='c<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(6)%></td>
                    <td bgcolor='<%=bgColor%>' id='d<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();<%}%>
                            self.close();" style="cursor:pointer;"><%=resultSet.getString(7)%></td>
                    <%if (searchString2.equalsIgnoreCase("R") || searchString2.equalsIgnoreCase("RA")) {%>
                    <td bgcolor='<%=bgColor%>' id='f<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(9)%></td>
                    <td bgcolor='<%=bgColor%>' id='g<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(10)%></td>
                    <td bgcolor='<%=bgColor%>' id='h<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(11)%></td>
                    <td bgcolor='<%=bgColor%>' id='i<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(12)%></td>
                    <td bgcolor='<%=bgColor%>' id='k<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(14)%></td>
                    <td bgcolor='<%=bgColor%>' id='l<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(15)%></td>
                    <td bgcolor='<%=bgColor%>' id='n<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(17)%></td>
                    <td bgcolor='<%=bgColor%>' id='o<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer;"><%=resultSet.getString(18)%></td>
                    <td bgcolor='<%=bgColor%>' id='m<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(16)%></td>
                    <td bgcolor='<%=bgColor%>' id='j<%=i%>' onclick="opener.document.leaseCommodity.custID.value = document.getElementById('x<%=i%>').innerHTML;
                        opener.document.leaseCommodity.oldNoOfUnits.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.tdLeaseID.value = document.getElementById('j<%=i%>').innerHTML;opener.document.leaseCommodity.fxdNounit.value = document.getElementById('f<%=i%>').innerHTML;opener.document.leaseCommodity.fxdTrmLen.value = document.getElementById('n<%=i%>').innerHTML;opener.document.leaseCommodity.fxdSecAmt.value = document.getElementById('h<%=i%>').innerHTML;opener.document.leaseCommodity.fxdPayDue.value = document.getElementById('l<%=i%>').innerHTML;opener.showFixed();
                        self.close();" style="cursor:pointer; display: none"><%=resultSet.getString(13)%></td>

                    <% }%>

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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>GL Account Number</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>GL Code</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.PaymentAcknowledgementForm.vtrfAcc.value = document.getElementById('x<%=i%>').innerHTML ;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.vtrfAcc.value = document.getElementById('x<%=i%>').innerHTML ;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.vtrfAcc.value = document.getElementById('x<%=i%>').innerHTML ;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

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

            <table border="2">
                <tr><th style="background-color: #99FF99;"><b>GL Account Number</b></th><th style="background-color: #99FF99;"><b>Ledger Name</b></th><th style="background-color: #99FF99;"><b>GL Code</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.PaymentAcknowledgementForm.ctrfAcc.value = document.getElementById('x<%=i%>').innerHTML ;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(1)%></td>
                    <td bgcolor='<%=bgColor%>' id='y<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.ctrfAcc.value = document.getElementById('x<%=i%>').innerHTML ;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(2)%></td>
                    <td bgcolor='<%=bgColor%>' id='z<%=i%>' onclick="opener.document.PaymentAcknowledgementForm.ctrfAcc.value = document.getElementById('x<%=i%>').innerHTML ;
                    self.close();" style="cursor:pointer;"><%=resultSet.getString(3)%></td>

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

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

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

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

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

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

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

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

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

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

</html>
