private void ShowItemSearch(int fromRow, int numberOfItems)
        {
            string    itemid     = string.Empty;
            DataTable dtSKUItems = new DataTable();

            string commandText = " SELECT ITEMID, ITEMNAME, I.UNITOFMEASURE FROM (   " +
                                 " SELECT IT.ITEMID, COALESCE(TR.NAME, IT.ITEMNAME, IT.ITEMID) AS ITEMNAME, IT.DATAAREAID,  " +
                                 "  ISNULL(IM.UNITID, '') AS UNITOFMEASURE, ROW_NUMBER()     OVER (ORDER BY IT.ITEMNAME  ASC) AS ROW  " +
                                 " FROM ASSORTEDINVENTITEMS IT     JOIN INVENTTABLEMODULE IM ON IT.ITEMID = IM.ITEMID AND IM.MODULETYPE = 2   " +
                                 " JOIN ECORESPRODUCT AS PR ON PR.RECID = IT.PRODUCT   " +
                                                                                                        //    "  INNER JOIN SKUTable_Posted ON IT.ITEMID = SKUTable_Posted.SkuNumber " +
                                 "  INNER JOIN SKUTableTrans ON IT.ITEMID = SKUTableTrans.SkuNumber " + //SKU Table
                                 " LEFT JOIN ECORESPRODUCTTRANSLATION AS TR  " +
                                 " ON PR.RECID = TR.PRODUCT AND TR.LANGUAGEID = @CULTUREID     WHERE IT.STORERECID = @STORERECID  " +
                                 //   " AND SKUTable_Posted.isAvailable='True' AND SKUTable_Posted.isLocked='False' " +
                                 " AND SKUTableTrans.isAvailable='True' AND SKUTableTrans.isLocked='False' " + //SKU Table
                                 "  ) I WHERE I.DATAAREAID='" + ApplicationSettings.Database.DATAAREAID + "' AND I.ROW > @FROMROW AND I.ROW <= @TOROW ";


            SqlConnection connection = new SqlConnection();

            if (application != null)
            {
                connection = application.Settings.Database.Connection;
            }
            else
            {
                connection = ApplicationSettings.Database.LocalConnection;
            }


            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }


            SqlCommand command = new SqlCommand(commandText, connection);

            SqlParameter languageIdParm = command.Parameters.Add("@CULTUREID", SqlDbType.NVarChar, 7);

            languageIdParm.Value = ApplicationSettings.Terminal.CultureName;
            SqlParameter dataAreaIdParm = command.Parameters.Add("@DATAAREAID", SqlDbType.NVarChar, 4);

            dataAreaIdParm.Value = ApplicationSettings.Database.DATAAREAID;
            command.Parameters.AddWithValue("@FROMROW", fromRow);
            command.Parameters.AddWithValue("@TOROW", (fromRow + numberOfItems));
            command.Parameters.AddWithValue("@STORERECID", ApplicationSettings.Terminal.StorePrimaryId);


            command.CommandTimeout = 0;
            SqlDataReader reader = command.ExecuteReader();

            dtSKUItems.Load(reader);
            if (dtSKUItems != null && dtSKUItems.Rows.Count > 0)
            {
                DataRow       drSelected = null;
                Dialog.Dialog oDialog    = new Dialog.Dialog();
                oDialog.GenericSearch(dtSKUItems, ref drSelected, "Select SKU");
                if (dtSkuGridItems != null && dtSkuGridItems.Rows.Count > 0)
                {
                    if (drSelected != null)
                    {
                        itemid = Convert.ToString(drSelected["ITEMID"]);
                        dtSkuGridItems.ImportRow(drSelected);
                    }
                }
                else
                {
                    if (dtSkuGridItems != null && dtSkuGridItems.Columns.Count > 0)
                    {
                        if (drSelected != null)
                        {
                            itemid = Convert.ToString(drSelected["ITEMID"]);
                            dtSkuGridItems.ImportRow(drSelected);
                        }
                    }
                    else
                    {
                        dtSkuGridItems = dtSKUItems.Clone();
                        dtSkuGridItems.Columns.Add("SKUBOOKINGDATE", typeof(DateTime));

                        if (drSelected != null)
                        {
                            itemid = Convert.ToString(drSelected["ITEMID"]);
                            dtSkuGridItems.ImportRow(drSelected);

                            dtSkuGridItems.AcceptChanges();
                        }
                    }
                }


                UpdateSKUTable(itemid);
                foreach (DataRow dr in dtSkuGridItems.Rows)
                {
                    dr["SKUBOOKINGDATE"] = DateTime.Now.ToShortDateString();
                }
                grItems.DataSource = dtSkuGridItems;
            }
            else
            {
                using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("No Item Present.", MessageBoxButtons.OK, MessageBoxIcon.Information))
                {
                    LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog);
                }
            }
        }