示例#1
0
        private void LoadList()
        {
            string SortField = "ProductCode";

            if (Request.QueryString["sortfield"] != null)
            {
                SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);
            }

            SortOption sortoption = SortOption.Ascending;

            if (Request.QueryString["sortoption"] != null)
            {
                sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);
            }

            Int64 intProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);

            ProductInventories clsProductInventories = new ProductInventories();

            System.Data.DataTable dt = clsProductInventories.ListAsDataTable(BranchID: int.Parse(cboBranch.SelectedItem.Value), ProductGroupID: intProductGroupID, clsProductListFilterType: ProductListFilterType.ShowActiveOnly, SortField: "ProductCode ASC, MatrixDescription ", SortOrder: SortOption.Desscending);

            clsProductInventories.CommitAndDispose();

            PageData.DataSource = dt.DefaultView;

            int iPageSize = Convert.ToInt16(Session["PageSize"]);

            PageData.AllowPaging = true;
            PageData.PageSize    = 5000;
            try
            {
                PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }
            catch
            {
                PageData.CurrentPageIndex = 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }

            cboCurrentPage.Items.Clear();
            for (int iRow = 0; iRow < PageData.PageCount; iRow++)
            {
                int iValue = iRow + 1;
                cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                if (PageData.CurrentPageIndex == iRow)
                {
                    cboCurrentPage.Items[iRow].Selected = true;
                }
                else
                {
                    cboCurrentPage.Items[iRow].Selected = false;
                }
            }
            lblDataCount.Text = " of " + " " + PageData.PageCount;
        }
示例#2
0
        protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr[ProductColumnNames.ProductID].ToString();

                HyperLink lnkBarcode = (HyperLink)e.Item.FindControl("lnkBarcode");
                lnkBarcode.Text        = dr[ProductColumnNames.BarCode].ToString();
                lnkBarcode.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&id=" + Common.Encrypt(dr[ProductColumnNames.ProductID].ToString(), Session.SessionID);

                HyperLink lnkProductCode = (HyperLink)e.Item.FindControl("lnkProductCode");
                lnkProductCode.Text = dr[ProductColumnNames.ProductCode].ToString();
                if (!string.IsNullOrEmpty(dr["MatrixDescription"].ToString()))
                {
                    lnkProductCode.Text += " - " + dr["MatrixDescription"].ToString();
                }
                lnkProductCode.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/Default.aspx?task=" + Common.Encrypt("det", Session.SessionID) + "&id=" + Common.Encrypt(dr[ProductColumnNames.ProductID].ToString(), Session.SessionID);

                Label lblGroup = (Label)e.Item.FindControl("lblGroup");
                lblGroup.Text = dr[ProductColumnNames.ProductGroupCode].ToString() + " / " + dr[ProductColumnNames.ProductSubGroupCode].ToString();

                Label lblQuantity = (Label)e.Item.FindControl("lblQuantity");
                // lblQuantity.Text = Convert.ToDecimal(dr[ProductColumnNames.MainQuantity].ToString()).ToString("#,##0.#0") + " " + dr[ProductColumnNames.BaseUnitCode];
                lblQuantity.Text = dr[ProductColumnNames.ConvertedQuantity].ToString();

                Label lblMinThreshold = (Label)e.Item.FindControl("lblMinThreshold");
                lblMinThreshold.Text = Convert.ToDecimal(dr[ProductColumnNames.MinThreshold].ToString()).ToString("#,##0.#0");

                Label lblMaxThreshold = (Label)e.Item.FindControl("lblMaxThreshold");
                lblMaxThreshold.Text = Convert.ToDecimal(dr[ProductColumnNames.MaxThreshold].ToString()).ToString("#,##0.#0");

                if (cboBranch.SelectedItem.Value == Constants.ZERO_STRING &&
                    (cboContact.SelectedItem.Value != Constants.ZERO_STRING || cboProductGroup.SelectedItem.Value != Constants.ZERO_STRING || cboSubGroup.SelectedItem.Value != Constants.ZERO_STRING))
                {
                    ProductInventories    clsProduct = new ProductInventories();
                    System.Data.DataTable dt         = clsProduct.ListAsDataTable(ProductID: long.Parse(dr[ProductColumnNames.ProductID].ToString()), MatrixID: long.Parse(dr["MatrixID"].ToString()), isSummary: 0);
                    clsProduct.CommitAndDispose();

                    DataList lstBranchInventory = (DataList)e.Item.FindControl("lstBranchInventory");
                    lstBranchInventory.Visible    = true;
                    lstBranchInventory.DataSource = dt.DefaultView;
                    lstBranchInventory.DataBind();
                }
            }
        }
示例#3
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.SelectedItem.Text == "No product" || cboProductCode.SelectedItem.Text == "No Product; Enter product to search.")
            {
                lblVariationMatrix.Visible     = false;
                lnkVariationMatrixAdd.Visible  = false;
                lstVariationMatrix.Visible     = false;
                lblUnitName.Visible            = false;
                txtQuantityBefore.Visible      = false;
                txtDifference.Visible          = false;
                txtQuantityNow.Visible         = false;
                txtMinThreshold.Visible        = false;
                txtMaxThreshold.Visible        = false;
                imgProductHistory.Visible      = false;
                imgProductPriceHistory.Visible = false;
                imgChangePrice.Visible         = false;
                imgEditNow.Visible             = false;
            }
            else
            {
                lblVariationMatrix.Visible        = true;
                lnkVariationMatrixAdd.Visible     = true;
                lnkVariationMatrixAdd.ToolTip     = "Add new variation matrix for " + cboProductCode.SelectedItem.Text;
                lnkVariationMatrixAdd.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx?task=" + Common.Encrypt("add", Session.SessionID) + "&prodid=" + Common.Encrypt(cboProductCode.SelectedValue, Session.SessionID);
                lblUnitName.Visible            = true;
                txtQuantityBefore.Visible      = true;
                txtDifference.Visible          = true;
                txtQuantityNow.Visible         = true;
                txtMinThreshold.Visible        = true;
                txtMaxThreshold.Visible        = true;
                imgProductHistory.Visible      = true;
                imgProductPriceHistory.Visible = true;
                imgChangePrice.Visible         = true;
                imgEditNow.Visible             = true;

                Products       clsProduct        = new Products();
                ProductDetails clsProductDetails = clsProduct.Details1(int.Parse(cboBranch.SelectedItem.Value), Convert.ToInt64(cboProductCode.SelectedValue));

                txtProductCode.Text     = cboProductCode.SelectedItem.Text;
                lblProductDesc.Text     = clsProductDetails.ProductDesc;
                lblUnitName.ToolTip     = clsProductDetails.BaseUnitID.ToString();
                lblUnitName.Text        = clsProductDetails.BaseUnitCode;
                txtQuantityBefore.Text  = clsProductDetails.Quantity.ToString("#,##0.#0");
                txtDifference.Text      = "0";
                txtQuantityNow.Text     = txtQuantityBefore.Text;
                txtMinThreshold.ToolTip = clsProductDetails.MinThreshold.ToString("#,##0.#0");
                txtMinThreshold.Text    = clsProductDetails.MinThreshold.ToString("#,##0.#0");
                txtMaxThreshold.ToolTip = clsProductDetails.MaxThreshold.ToString("#,##0.#0");
                txtMaxThreshold.Text    = clsProductDetails.MaxThreshold.ToString("#,##0.#0");

                ProductInventories clsProductInventory = new ProductInventories(clsProduct.Connection, clsProduct.Transaction);
                lstVariationMatrix.DataSource = clsProductInventory.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), Convert.ToInt64(cboProductCode.SelectedValue)).DefaultView;
                lstVariationMatrix.DataBind();

                clsProduct.CommitAndDispose();

                lstVariationMatrix.Visible = true;
                txtDifference.Enabled      = false;
                txtQuantityNow.Enabled     = false;
                txtMinThreshold.Enabled    = false;
                txtMaxThreshold.Enabled    = false;
            }
        }
示例#4
0
        private void SetDataSource(ReportDocument Report)
        {
            string strReportType = cboReportType.SelectedValue;

            Int32 ForReorder = 0;
            Int32 OverStock  = 0;

            if (strReportType == ReportTypes.ItemsForReOrder)
            {
                ForReorder = 1;
            }
            else if (strReportType == ReportTypes.OverStockItems)
            {
                OverStock = 1;
            }

            ReportDataset rptds = new ReportDataset();

            #region Search Key
            Int32  intBranchID          = Convert.ToInt32(cboBranch.SelectedItem.Value);
            Int64  lngSupplierID        = Convert.ToInt32(cboContact.SelectedItem.Value);
            Int64  lngProductGroupID    = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            Int64  lngProductSubGroupID = Convert.ToInt64(cboSubGroup.SelectedItem.Value);
            string stProductCode        = txtProductCode.Text;
            #endregion

            string ExpirationDate = Constants.C_DATE_MIN_VALUE_STRING;
            if (strReportType == ReportTypes.ExpiredInventory)
            {
                ExpirationDate = txtExpiryDate.Text;
            }

            int isSummary = intBranchID == 0 ? 1 : 0;
            ProductInventories    clsProductInventories;
            System.Data.DataTable dt;

            switch (strReportType)
            {
            case ReportTypes.SummarizedInventoryByBranch:
                clsProductInventories = new ProductInventories();
                dt = clsProductInventories.SummarizedInventory(SummarizedInventoryTypes.byBranch, intBranchID, lngSupplierID, lngProductGroupID, true);
                clsProductInventories.CommitAndDispose();

                foreach (DataRow dr in dt.Rows)
                {
                    DataRow drNew = rptds.SummarizedInventory.NewRow();

                    foreach (DataColumn dc in rptds.SummarizedInventory.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }
                    rptds.SummarizedInventory.Rows.Add(drNew);
                }

                break;

            case ReportTypes.SummarizedInventoryBySupplier:
                clsProductInventories = new ProductInventories();
                dt = clsProductInventories.SummarizedInventory(SummarizedInventoryTypes.bySupplier, intBranchID, lngSupplierID, lngProductGroupID, true);
                clsProductInventories.CommitAndDispose();

                foreach (DataRow dr in dt.Rows)
                {
                    DataRow drNew = rptds.SummarizedInventory.NewRow();

                    foreach (DataColumn dc in rptds.SummarizedInventory.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }
                    rptds.SummarizedInventory.Rows.Add(drNew);
                }

                break;

            case ReportTypes.SummarizedInventoryByGroup:
                clsProductInventories = new ProductInventories();
                dt = clsProductInventories.SummarizedInventory(SummarizedInventoryTypes.byGroup, intBranchID, lngSupplierID, lngProductGroupID, true);
                clsProductInventories.CommitAndDispose();

                foreach (DataRow dr in dt.Rows)
                {
                    DataRow drNew = rptds.SummarizedInventory.NewRow();

                    foreach (DataColumn dc in rptds.SummarizedInventory.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }
                    rptds.SummarizedInventory.Rows.Add(drNew);
                }

                break;

            default:
                clsProductInventories = new ProductInventories();

                if (cboMonth.SelectedItem.Value == DateTime.Now.Month.ToString("0#") && cboYear.SelectedItem.Value == DateTime.Now.Year.ToString())
                {
                    dt = clsProductInventories.ListAsDataTable(BranchID: intBranchID, ProductCode: stProductCode, ProductGroupID: lngProductGroupID, ProductSubGroupID: lngProductSubGroupID, SupplierID: lngSupplierID, isSummary: isSummary, ExpirationDate: ExpirationDate, ForReorder: ForReorder, OverStock: OverStock);
                }
                else
                {
                    dt = clsProductInventories.ListAsDataTable(Month: int.Parse(cboMonth.SelectedItem.Value), Year: int.Parse(cboYear.SelectedItem.Value.ToString()), BranchID: intBranchID, ProductCode: stProductCode, ProductGroupID: lngProductGroupID, ProductSubGroupID: lngProductSubGroupID, SupplierID: lngSupplierID, isSummary: isSummary, ExpirationDate: ExpirationDate, ForReorder: ForReorder, OverStock: OverStock);
                }
                clsProductInventories.CommitAndDispose();

                foreach (DataRow dr in dt.Rows)
                {
                    //if (dr[ProductColumnNames.BarCode].ToString() != null && dr[ProductColumnNames.BarCode].ToString() != string.Empty)
                    //{
                    DataRow drNew = rptds.Products.NewRow();

                    foreach (DataColumn dc in rptds.Products.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }
                    rptds.Products.Rows.Add(drNew);
                    //}
                }
                break;
            }


            Report.SetDataSource(rptds);

            SetParameters(Report);
        }
示例#5
0
        private void SetDataSource(ReportDocument Report)
        {
            ReportDataset rptds = new ReportDataset();

            string ContactCode = string.Empty;

            if (cboContact.SelectedItem.Value != Constants.ZERO_STRING)
            {
                ContactCode = cboContact.SelectedItem.Text;
            }

            string ProductGroupName = string.Empty;

            if (cboGroup.SelectedItem.Value != Constants.ZERO_STRING)
            {
                ProductGroupName = cboGroup.SelectedItem.Text;
            }

            string ProductSubGroupName = string.Empty;

            if (cboSubGroup.SelectedItem.Value != Constants.ZERO_STRING)
            {
                ProductSubGroupName = cboSubGroup.SelectedItem.Text;
            }

            System.Data.DataTable dt = null;
            if (lblType.Text == "invcount")
            {
                Int64 lngSupplierID = Convert.ToInt64(cboContact.SelectedItem.Value);

                Int64 lngProductgroupID = Convert.ToInt64(cboGroup.SelectedItem.Value);

                Int64 lngProductSubGroupID = Convert.ToInt64(cboSubGroup.SelectedItem.Value);

                ProductInventories clsProductInventories = new ProductInventories();

                dt = clsProductInventories.ListAsDataTable(BranchID: int.Parse(lblBranchID.Text), SupplierID: lngSupplierID, ProductGroupID: lngProductgroupID, ProductSubGroupID: lngProductSubGroupID, clsProductListFilterType: ProductListFilterType.ShowActiveOnly, SortField: "ProductCode ASC, MatrixDescription ASC, BarCode1", SortOrder: SortOption.Desscending);

                //Contacts clsContacts = new Contacts(clsProductInventories.Connection, clsProductInventories.Transaction);
                //ContactDetails clsContactDetails = clsContacts.Details(lngSupplierID);

                clsProductInventories.CommitAndDispose();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    DataRow drInventory = rptds.ProductInventory.NewRow();

                    foreach (DataColumn dc in rptds.ProductInventory.Columns)
                    {
                        drInventory[dc] = dr[dc.ColumnName];
                    }

                    rptds.ProductInventory.Rows.Add(drInventory);
                }
            }
            else
            {
                Data.Inventory clsInventory = new Data.Inventory();
                dt = clsInventory.DataList(cboInventoryNo.SelectedItem.Text, chkIncludeShortOverProducts.Checked, long.Parse(cboContact.SelectedItem.Value), long.Parse(cboGroup.SelectedItem.Value), SortField: "InventoryID", SortOrder: SortOption.Ascending);
                clsInventory.CommitAndDispose();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    DataRow drInventory = rptds.Inventory.NewRow();

                    foreach (DataColumn dc in rptds.Inventory.Columns)
                    {
                        drInventory[dc] = dr[dc.ColumnName];
                    }

                    rptds.Inventory.Rows.Add(drInventory);
                }
            }


            Report.SetDataSource(rptds);

            SetParameters(Report);
        }
示例#6
0
        private void LoadList()
        {
            string SortField = "ProductCode";

            if (Request.QueryString["sortfield"] != null)
            {
                SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);
            }

            SortOption sortoption = SortOption.Ascending;

            if (Request.QueryString["sortoption"] != null)
            {
                sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);
            }

            Int64 lngSupplierID = Convert.ToInt64(cboContact.SelectedItem.Value);

            ProductInventories clsProductInventories = new ProductInventories();

            System.Data.DataTable dt = clsProductInventories.ListAsDataTable(BranchID: int.Parse(cboBranch.SelectedItem.Value), SupplierID: lngSupplierID, clsProductListFilterType: ProductListFilterType.ShowActiveOnly, SortField: "ProductCode ASC, MatrixDescription ASC, BarCode1", SortOrder: SortOption.Desscending);

            Contacts       clsContacts       = new Contacts(clsProductInventories.Connection, clsProductInventories.Transaction);
            ContactDetails clsContactDetails = clsContacts.Details(lngSupplierID);

            clsProductInventories.CommitAndDispose();

            PageData.DataSource = dt.DefaultView;

            if (!clsContactDetails.isLock)
            {
                cmdLockUnlockProduct.Text    = "Lock Supplier [<label class='ms-error'>Note:</label>Products under this supplier are <u>CURRENTLY ALLOWED</u> for Selling]";
                cmdLockUnlockProduct.ToolTip = "unlock";
            }
            else
            {
                cmdLockUnlockProduct.Text    = "UnLock Supplier [<label class='ms-error'>Note:</label>Products under this supplier are <u>CURRENTLY NOT ALLOWED</u> for Selling]";
                cmdLockUnlockProduct.ToolTip = "lock";
            }

            int iPageSize = Convert.ToInt16(Session["PageSize"]);

            PageData.AllowPaging = true;
            PageData.PageSize    = 5000;
            try
            {
                PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }
            catch
            {
                PageData.CurrentPageIndex = 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }

            cboCurrentPage.Items.Clear();
            for (int iRow = 0; iRow < PageData.PageCount; iRow++)
            {
                int iValue = iRow + 1;
                cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                if (PageData.CurrentPageIndex == iRow)
                {
                    cboCurrentPage.Items[iRow].Selected = true;
                }
                else
                {
                    cboCurrentPage.Items[iRow].Selected = false;
                }
            }
            lblDataCount.Text = " of " + " " + PageData.PageCount;
        }
示例#7
0
        private void LoadList()
        {
            string SortField = "ProductDesc";

            if (Request.QueryString["sortfield"] != null)
            {
                SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);
            }

            SortOption sortoption = SortOption.Ascending;

            if (Request.QueryString["sortoption"] != null)
            {
                sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);
            }

            string stSearchKey = string.Empty;

            if (Request.QueryString["Search"] != null)
            {
                stSearchKey = Server.UrlDecode(Common.Decrypt((string)Request.QueryString["search"], Session.SessionID));
            }
            else if (Session["Search"] != null)
            {
                stSearchKey = Server.UrlDecode(Common.Decrypt(Session["Search"].ToString(), Session.SessionID));
            }

            try { Session.Remove("Search"); }
            catch { }
            if (stSearchKey == null)
            {
                stSearchKey = string.Empty;
            }
            else if (stSearchKey != string.Empty)
            {
                Session.Add("Search", Common.Encrypt(stSearchKey, Session.SessionID));
            }

            string strProductCode       = txtProductCode.Text;
            int    intBranchID          = int.Parse(cboBranch.SelectedItem.Value);
            long   lngSupplierID        = long.Parse(cboContact.SelectedItem.Value);
            long   lngProductGroupID    = long.Parse(cboProductGroup.SelectedItem.Value);
            long   lngProductSubGroupID = long.Parse(cboSubGroup.SelectedItem.Value);


            ProductInventories clsProduct = new ProductInventories();

            System.Data.DataTable dt = clsProduct.ListAsDataTable(BranchID: intBranchID, BarCode: stSearchKey, ProductCode: strProductCode, ProductGroupID: lngProductGroupID, ProductSubGroupID: lngProductSubGroupID, SupplierID: lngSupplierID, Limit: 100, SortField: SortField, SortOrder: SortOption.Ascending);
            clsProduct.CommitAndDispose();

            PageData.DataSource = dt.DefaultView;

            int iPageSize = Convert.ToInt16(Session["PageSize"]);

            PageData.AllowPaging = true;
            PageData.PageSize    = iPageSize;
            try
            {
                PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }
            catch
            {
                PageData.CurrentPageIndex = 1;
                lstItem.DataSource        = PageData;
                lstItem.DataBind();
            }

            cboCurrentPage.Items.Clear();
            for (int i = 0; i < PageData.PageCount; i++)
            {
                int iValue = i + 1;
                cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString()));
                if (PageData.CurrentPageIndex == i)
                {
                    cboCurrentPage.Items[i].Selected = true;
                }
                else
                {
                    cboCurrentPage.Items[i].Selected = false;
                }
            }
            lblDataCount.Text = " of " + " " + PageData.PageCount;
        }
示例#8
0
        private void SetDataSource(ReportDocument Report)
        {
            ReportDataset rptds = new ReportDataset();

            //long lngProductGroupName = long.Parse(cboProductGroup.SelectedItem.Value);
            //long lngSubGroupName = long.Parse(cboSubGroup.SelectedItem.Value);

            string ProductGroupName = string.Empty;

            if (cboProductGroup.SelectedItem.Value != Constants.ZERO_STRING)
            {
                ProductGroupName = cboProductGroup.SelectedItem.Value;
            }
            string SubGroupName = string.Empty;

            if (cboSubGroup.SelectedItem.Value != Constants.ZERO_STRING)
            {
                SubGroupName = cboSubGroup.SelectedItem.Value;
            }

            string ReportType = cboReportType.SelectedItem.Text;

            ProductColumns clsProductColumns = new ProductColumns();

            #region clsProductColumns
            clsProductColumns.ProductCode         = true;
            clsProductColumns.BarCode             = true;
            clsProductColumns.BarCode2            = true;
            clsProductColumns.BarCode3            = true;
            clsProductColumns.ProductDesc         = true;
            clsProductColumns.ProductSubGroupName = true;
            clsProductColumns.BaseUnitName        = true;
            clsProductColumns.UnitName            = true;
            clsProductColumns.ProductGroupName    = true;
            clsProductColumns.DateCreated         = true;
            clsProductColumns.Price           = true;
            clsProductColumns.Quantity        = true;
            clsProductColumns.MinThreshold    = true;
            clsProductColumns.MaxThreshold    = true;
            clsProductColumns.PurchasePrice   = true;
            clsProductColumns.SupplierName    = true;
            clsProductColumns.QuantityIN      = true;
            clsProductColumns.QuantityOUT     = true;
            clsProductColumns.RIDMinThreshold = true;
            clsProductColumns.RIDMaxThreshold = true;
            clsProductColumns.RID             = true;
            //clsProductColumns.BranchActualQuantity = true;
            //clsProductColumns.BranchQuantity = true;
            //clsProductColumns.BranchQuantityIN = true;
            //clsProductColumns.BranchQuantityOUT = true;
            #endregion

            ProductDetails clsSearchKey = new ProductDetails();
            #region Search Key
            clsSearchKey.BranchID          = Convert.ToInt32(cboBranch.SelectedItem.Value);
            clsSearchKey.SupplierID        = Convert.ToInt32(cboContact.SelectedItem.Value);
            clsSearchKey.ProductGroupID    = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            clsSearchKey.ProductSubGroupID = Convert.ToInt64(cboSubGroup.SelectedItem.Value);
            clsSearchKey.ProductCode       = txtProductCode.Text;
            #endregion

            Products clsProduct = new Products();
            clsProduct.GetConnection();
            ProductInventories clsProductInventories = new ProductInventories(clsProduct.Connection, clsProduct.Transaction);


            DataTable dt;
            string    ProductIDs = null;

            switch (cboReportType.SelectedValue)
            {
            case ReportTypes.ProductList:
                #region Products List
                dt = clsProductInventories.ListAsDataTable(Int32.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text);
                clsProduct.CommitAndDispose();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    DataRow drNew = rptds.Products.NewRow();

                    foreach (DataColumn dc in rptds.Products.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }

                    rptds.Products.Rows.Add(drNew);
                }
                break;
                #endregion

            case ReportTypes.ProductPriceList:
                #region Products Price List
                dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text);
                clsProduct.CommitAndDispose();
                foreach (DataRow dr in dt.Rows)
                {
                    DataRow drNew = rptds.Products.NewRow();

                    foreach (DataColumn dc in rptds.Products.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }

                    rptds.Products.Rows.Add(drNew);
                    ProductIDs += dr["ProductID"].ToString() + ",";
                }
                break;
                #endregion

            case ReportTypes.ProductListWithInvalidMatrix:
                #region Products List With Invalid Unit Matrix
                dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text, ShowOnlyWithInvalidUnitMatrix: true);
                clsProduct.CommitAndDispose();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    DataRow drNew = rptds.Products.NewRow();

                    foreach (DataColumn dc in rptds.Products.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }

                    rptds.Products.Rows.Add(drNew);
                }
                break;

                #endregion
            case ReportTypes.WeightedProductsForWeighingScale:
            case ReportTypes.CountedProductsForWeighingScale:
                #region Weighted and Counted Products For Weighing Scale
                dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text);
                clsProduct.CommitAndDispose();
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr[ProductColumnNames.BarCode].ToString() != null && dr[ProductColumnNames.BarCode].ToString() != string.Empty)
                    {
                        DataRow drNew = rptds.Products.NewRow();

                        foreach (DataColumn dc in rptds.Products.Columns)
                        {
                            drNew[dc] = dr[dc.ColumnName];
                        }

                        rptds.Products.Rows.Add(drNew);
                        ProductIDs += dr["ProductID"].ToString() + ",";
                    }
                }
                break;
                #endregion

            case ReportTypes.ProductsInDemoReport:
                #region Products In Demo
                DateTime StartTransactionDate = DateTime.TryParse(txtStartDate.Text + " " + txtStartTime.Text, out StartTransactionDate) ? StartTransactionDate : DateTime.MinValue;
                DateTime EndTransactionDate   = DateTime.TryParse(txtEndDate.Text + " " + txtEndTime.Text, out EndTransactionDate) ? EndTransactionDate : DateTime.MinValue;

                SalesTransactionItems clsSalesTransactionItemsDemo = new SalesTransactionItems();
                System.Data.DataTable dtDemo = clsSalesTransactionItemsDemo.ProductsInDemoReport(Int32.Parse(cboBranch.SelectedItem.Value), Int64.Parse(cboContact.SelectedItem.Value), cboProductGroup.SelectedItem.Text, cboSubGroup.SelectedItem.Text, txtProductCode.Text, "", StartTransactionDate, EndTransactionDate);
                clsSalesTransactionItemsDemo.CommitAndDispose();
                foreach (DataRow dr in dtDemo.Rows)
                {
                    DataRow drNew = rptds.ProductsInDemo.NewRow();

                    foreach (DataColumn dc in rptds.ProductsInDemo.Columns)
                    {
                        drNew[dc] = dr[dc.ColumnName];
                    }

                    rptds.ProductsInDemo.Rows.Add(drNew);
                }
                break;

                #endregion
            default:
                return;
            }

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }