Ejemplo n.º 1
0
		private void LoadOptions()
		{
            ProductGroup clsProductGroup = new ProductGroup();
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;

            Contacts clsContact = new Contacts(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSupplier.DataTextField = "ContactName";
            cboSupplier.DataValueField = "ContactID";
            cboSupplier.DataSource = clsContact.SuppliersAsDataTable(string.Empty, 0, "ContactName", SortOption.Ascending);
            cboSupplier.DataBind();
            cboSupplier.Items.Add(new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboSupplier.SelectedIndex = cboSupplier.Items.Count - 1;

            clsProductGroup.CommitAndDispose();

            txtStartTransactionDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            txtEndTransactionDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
		}
		private void LoadOptions()
		{
            ProductGroup clsProductGroup = new ProductGroup();
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;
            clsProductGroup.CommitAndDispose();
		}
        protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
				if (Visible)
				{
                    Branch clsBranch = new Branch();
                    cboBranch.DataTextField = "BranchCode";
                    cboBranch.DataValueField = "BranchID";
                    cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
                    cboBranch.DataBind();
                    
                    cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));

                    mlngItemNo = 0;

                    ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

                    ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductSubGroupName = txtProductSubGroup.Text };

                    ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsBranch.Connection, clsBranch.Transaction);
                    cboProductSubGroup.DataTextField = "ProductSubGroupName";
                    cboProductSubGroup.DataValueField = "ProductSubGroupID";
                    cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView;
                    cboProductSubGroup.DataBind();
                    cboProductSubGroup.SelectedIndex = 0;

                    clsBranch.CommitAndDispose();

                    txtClosingDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
					ManageSecurity();
					LoadList();
                    cmdZeroOutActualQuantity.Attributes.Add("onClick", "return confirm_zeroout_inventory();");
                    imgZeroOutActualQuantity.Attributes.Add("onClick", "return confirm_zeroout_inventory();");
                    cmdCopyPOSToActual.Attributes.Add("onClick", "return confirm_copypostoactual_inventory();");
                    imgCopyPOSToActual.Attributes.Add("onClick", "return confirm_copypostoactual_inventory();");
                    //cmdCloseInventory.Attributes.Add("onClick", "return confirm_close_inventory();");
                    //imgCloseInventory.Attributes.Add("onClick", "return confirm_close_inventory();");
				}
        }
Ejemplo n.º 4
0
		protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns();
            clsProductSubGroupColumns.ProductSubGroupCode = true;
            clsProductSubGroupColumns.ProductSubGroupName = true;

            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value);
            clsSearchKeys.ProductSubGroupCode = txtSubGroupCode.Text;

            ProductSubGroup clsSubGroup = new ProductSubGroup();
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, 0);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            if (cboSubGroup.Items.Count > 1 && txtSubGroupCode.Text.Trim() != string.Empty) cboSubGroup.SelectedIndex = 1; else cboSubGroup.SelectedIndex = 0;
            clsSubGroup.CommitAndDispose();

			cboProductSubGroup_SelectedIndexChanged(null, System.EventArgs.Empty);
		}
Ejemplo n.º 5
0
		private void LoadList()
		{	
			string SortField = "SequenceNo ASC, ProductSubGroupCode";
            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 SearchKey = string.Empty;
            if (Request.QueryString["Search"] != null)
            { SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); }
            else if (Session["Search"] != null)
            { SearchKey = Common.Decrypt(Session["Search"].ToString(), Session.SessionID); }

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

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsAll = true };
            
            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductGroupDetails = new ProductGroupDetails() { ProductGroupCode = SearchKey, ProductGroupName = SearchKey };
            clsSearchKeys.ProductSubGroupCode = SearchKey;
            clsSearchKeys.ProductSubGroupName = SearchKey;

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            System.Data.DataTable dt = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: SortField, SortOrder: (sortoption == SortOption.Ascending ? System.Data.SqlClient.SortOrder.Ascending : System.Data.SqlClient.SortOrder.Descending));
            clsProductSubGroup.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;
		}
Ejemplo n.º 6
0
        public System.Data.DataTable ListAsDataTable(ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns(), ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails(), long SequenceNoStart = 0, System.Data.SqlClient.SortOrder SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending, string SortField = "SequenceNo", System.Data.SqlClient.SortOrder SortOrder = System.Data.SqlClient.SortOrder.Ascending, Int32 limit = 0)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;

                string SQL = SQLSelect(clsProductSubGroupColumns) + "WHERE 1=1 ";

                if (SequenceNoStart != 0)
                {
                    if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
                        SQL += "AND SequenceNo < " + SequenceNoStart.ToString() + " ";
                    else
                        SQL += "AND SequenceNo > " + SequenceNoStart.ToString() + " ";
                }

                if (clsSearchKey.ProductGroupID != 0)
                {
                    SQL += "AND tblProductSubGroup.ProductGroupID = @ProductGroupID ";
                    cmd.Parameters.AddWithValue("@ProductGroupID", clsSearchKey.ProductGroupID);
                }
                else if (clsSearchKey.ProductGroupDetails.ProductGroupID != 0)
                {
                    SQL += "AND tblProductSubGroup.ProductGroupID = @ProductGroupID ";
                    cmd.Parameters.AddWithValue("@ProductGroupID", clsSearchKey.ProductGroupDetails.ProductGroupID);
                }

                if (clsSearchKey.ProductSubGroupID != 0)
                {
                    SQL += "AND tblProductSubGroup.ProductSubGroupID = @ProductSubGroupID ";
                    cmd.Parameters.AddWithValue("@ProductSubGroupID", clsSearchKey.ProductSubGroupID);
                }

                if (!string.IsNullOrEmpty(clsSearchKey.ProductGroupDetails.ProductGroupCode) 
                    && !string.IsNullOrEmpty(clsSearchKey.ProductGroupDetails.ProductGroupName)
                    && !string.IsNullOrEmpty(clsSearchKey.ProductSubGroupCode) 
                    && !string.IsNullOrEmpty(clsSearchKey.ProductSubGroupName))
                {
                    SQL += "AND (tblProductGroup.ProductGroupCode LIKE @ProductGroupCode OR tblProductGroup.ProductGroupName LIKE @ProductGroupName OR tblProductSubGroup.ProductSubGroupCode LIKE @ProductSubGroupCode OR tblProductSubGroup.ProductSubGroupName LIKE @ProductSubGroupName) ";
                    cmd.Parameters.AddWithValue("@ProductGroupCode", clsSearchKey.ProductGroupDetails.ProductGroupCode + "%");
                    cmd.Parameters.AddWithValue("@ProductGroupName", clsSearchKey.ProductGroupDetails.ProductGroupName + "%");
                    cmd.Parameters.AddWithValue("@ProductSubGroupCode", clsSearchKey.ProductSubGroupCode + "%");
                    cmd.Parameters.AddWithValue("@ProductSubGroupName", clsSearchKey.ProductSubGroupName + "%");
                }
                else if (!string.IsNullOrEmpty(clsSearchKey.ProductSubGroupCode) && !string.IsNullOrEmpty(clsSearchKey.ProductSubGroupName))
                {
                    SQL += "AND (tblProductSubGroup.ProductSubGroupCode LIKE @ProductSubGroupCode OR tblProductSubGroup.ProductSubGroupName LIKE @SearchKey) ";
                    cmd.Parameters.AddWithValue("@ProductSubGroupCode", clsSearchKey.ProductSubGroupCode + "%");
                    cmd.Parameters.AddWithValue("@ProductSubGroupName", clsSearchKey.ProductSubGroupName + "%");
                }
                else if (!string.IsNullOrEmpty(clsSearchKey.ProductSubGroupCode))
                {
                    SQL += "AND tblProductSubGroup.ProductSubGroupCode LIKE @ProductSubGroupCode ";
                    cmd.Parameters.AddWithValue("@ProductSubGroupCode", clsSearchKey.ProductSubGroupCode + "%");
                }
                else if (!string.IsNullOrEmpty(clsSearchKey.ProductSubGroupCode))
                {
                    SQL += "AND tblProductSubGroup.ProductSubGroupName LIKE @ProductSubGroupName ";
                    cmd.Parameters.AddWithValue("@ProductSubGroupName", clsSearchKey.ProductSubGroupName + "%");
                }

                SQL += string.IsNullOrEmpty(SortField) ? "ORDER BY SequenceNo, ProductSubGroupName " : "ORDER BY " + SortField + " ";
                SQL += SortOrder == System.Data.SqlClient.SortOrder.Ascending ? "ASC " : "DESC ";
                SQL += limit == 0 ? "" : " LIMIT " + limit.ToString();

                cmd.CommandText = SQL;
                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                return dt;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Ejemplo n.º 7
0
        private string SQLSelect(ProductSubGroupColumns clsColumns)
        {
            if (clsColumns.ColumnsAll)
            {
                object boxed = clsColumns;                  // needs to unboxed so that the value will be assigned, otherwise it won't work
                System.Reflection.FieldInfo[] fi = clsColumns.GetType().GetFields();
                foreach (System.Reflection.FieldInfo info1 in fi)
                {
                    info1.SetValue(boxed, true);
                }
                clsColumns = (ProductSubGroupColumns) boxed; // boxed so that the value will be assigned, otherwise it won't work
            }
            else if (clsColumns.ColumnsNameID)
            {
                clsColumns.ProductSubGroupID = true;
                clsColumns.ProductSubGroupName = true;
            }
            else if (clsColumns.ColumnsCodeNameID)
            {
                clsColumns.ProductSubGroupID = true;
                clsColumns.ProductSubGroupCode = true;
                clsColumns.ProductSubGroupName = true;
            }

            string stSQL = "SELECT ";

            if (clsColumns.ProductGroupID) stSQL += "tblProductGroup.ProductGroupID, ";
            if (clsColumns.ProductGroupCode) stSQL += "tblProductGroup.ProductGroupCode, ";
            if (clsColumns.ProductGroupName) stSQL += "tblProductGroup.ProductGroupName, ";
            if (clsColumns.ProductSubGroupCode) stSQL += "tblProductSubGroup.ProductSubGroupCode, ";
            if (clsColumns.ProductSubGroupName) stSQL += "tblProductSubGroup.ProductSubGroupName, ";
            if (clsColumns.BaseUnitID) stSQL += "tblProductSubGroup.BaseUnitID, ";
            if (clsColumns.BaseUnitName) stSQL += "tblUnit.UnitName 'BaseUnitName', ";
            if (clsColumns.Price) stSQL += "tblProductSubGroup.Price, ";
            if (clsColumns.PurchasePrice) stSQL += "tblProductSubGroup.PurchasePrice, ";
            if (clsColumns.IncludeInSubtotalDiscount) stSQL += "tblProductSubGroup.IncludeInSubtotalDiscount, ";
            if (clsColumns.VAT) stSQL += "tblProductSubGroup.VAT, ";
            if (clsColumns.EVAT) stSQL += "tblProductSubGroup.EVAT, ";
            if (clsColumns.LocalTax) stSQL += "tblProductSubGroup.LocalTax, ";
            if (clsColumns.ChartOfAccountIDPurchase) stSQL += "tblProductSubGroup.ChartOfAccountIDPurchase, ";
            if (clsColumns.ChartOfAccountIDSold) stSQL += "tblProductSubGroup.ChartOfAccountIDSold, ";
            if (clsColumns.ChartOfAccountIDInventory) stSQL += "tblProductSubGroup.ChartOfAccountIDInventory, ";
            if (clsColumns.ChartOfAccountIDTaxPurchase) stSQL += "tblProductSubGroup.ChartOfAccountIDTaxPurchase, ";
            if (clsColumns.ChartOfAccountIDTaxSold) stSQL += "tblProductSubGroup.ChartOfAccountIDTaxSold, ";
            if (clsColumns.SequenceNo) stSQL += "tblProductSubGroup.SequenceNo, ";
            if (clsColumns.SequenceNo) stSQL += "tblProductSubGroup.ImagePath, ";

            stSQL += "tblProductSubGroup.ProductSubGroupID ";
            stSQL += "FROM tblProductSubGroup ";

            if (clsColumns.ProductGroupCode || clsColumns.ProductGroupName)
                stSQL += "INNER JOIN tblProductGroup ON tblProductSubGroup.ProductGroupID = tblProductGroup.ProductGroupID ";

            if (clsColumns.BaseUnitName)
                stSQL += "INNER JOIN tblUnit ON tblProductSubGroup.BaseUnitID = tblUnit.UnitID ";

            return stSQL;
        }
        private void LoadSubGroup()
        {
            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductSubGroupCode = txtProductSubGroup.Text;
            clsSearchKeys.ProductGroupID = long.Parse(cboProductGroup.SelectedItem.Value);

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboProductSubGroup.DataBind();
            clsProductSubGroup.CommitAndDispose();

            if (cboProductSubGroup.Items.Count == 0) cboProductSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            cboProductSubGroup.SelectedIndex = 0;
        }
        protected void imgProductSubGroupSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductSubGroupName = txtProductSubGroup.Text };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView;
            cboProductSubGroup.DataBind();
            cboProductSubGroup.SelectedIndex = 0;
            cboProductSubGroup.Items.Insert(0, new ListItem(Constants.ALL, Constants.ZERO_STRING));
            if (cboProductSubGroup.Items.Count > 1 && txtProductSubGroup.Text.Trim() != string.Empty) cboProductSubGroup.SelectedIndex = 1; else cboProductSubGroup.SelectedIndex = 0;
            clsProductSubGroup.CommitAndDispose();
        }
Ejemplo n.º 10
0
		private void LoadOptions()
		{
            txtStartTransactionDate.Text = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");
            txtEndTransactionDate.Text = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");

            Contacts clsContact = new Contacts();
            cboContact.DataTextField = "ContactName";
            cboContact.DataValueField = "ContactID";
            cboContact.DataSource = clsContact.SuppliersAsDataTable(Limit: 100).DefaultView;
            cboContact.DataBind();
            cboContact.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.ZERO_STRING));
            cboContact.SelectedIndex = 0;

            ProductGroup clsProductGroup = new ProductGroup(clsContact.Connection, clsContact.Transaction);
            cboGroup.DataTextField = "ProductGroupName";
            cboGroup.DataValueField = "ProductGroupID";
            cboGroup.DataSource = clsProductGroup.ListAsDataTable();
            cboGroup.DataBind();
            cboGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT,Constants.ZERO_STRING));
            cboGroup.SelectedIndex = 0;

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsContact.Connection, clsContact.Transaction);
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns);
            cboSubGroup.DataBind();
            cboSubGroup.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;

            Data.Inventory clsInventory = new Data.Inventory(clsContact.Connection, clsContact.Transaction);
            cboInventoryNo.DataTextField = "ReferenceNo";
            cboInventoryNo.DataValueField = "PostingReference";
            cboInventoryNo.DataSource = clsInventory.ClosingInventoryReferenceNos(Convert.ToDateTime(txtStartTransactionDate.Text), Convert.ToDateTime(txtEndTransactionDate.Text));
            cboInventoryNo.DataBind();
            cboInventoryNo.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, Constants.PLEASE_SELECT + DateTime.MinValue.ToString("yyyy-MM-dd")));
            cboInventoryNo.SelectedIndex = 0;

            clsContact.CommitAndDispose();

            lblType.Text = ""; lblType.ToolTip = "";
            if (Request.QueryString["type"] != null)
            {
                lblType.Text = Common.Decrypt(Request.QueryString["type"].ToString(), Session.SessionID);
            }
            if (Request.QueryString["typedet"] != null)
            {
                lblType.ToolTip = Common.Decrypt(Request.QueryString["typedet"].ToString(), Session.SessionID);
            }
            lblBranchID.Text = "0";
            if (Request.QueryString["branchid"] != null)
            {
                lblBranchID.Text = Common.Decrypt(Request.QueryString["branchid"].ToString(), Session.SessionID);
            }

            if (Request.QueryString["refno"] != null)
            {
                string strRefNo = "refno";
                strRefNo = Common.Decrypt(Request.QueryString["refno"].ToString(), Session.SessionID);
                cboInventoryNo.SelectedIndex = cboInventoryNo.Items.IndexOf(cboInventoryNo.Items.FindByText(strRefNo));
            }

            if (Request.QueryString["prdgrpid"] != null)
            {
                string strPrdGrpID = "prdgrpid";
                strPrdGrpID = Common.Decrypt(Request.QueryString["prdgrpid"].ToString(), Session.SessionID);
                cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(strPrdGrpID));
            }

            if (Request.QueryString["contactid"] != null)
            {
                string strContactID = "contactid";
                strContactID = Common.Decrypt(Request.QueryString["contactid"].ToString(), Session.SessionID);
                cboContact.SelectedIndex = cboContact.Items.IndexOf(cboContact.Items.FindByValue(strContactID));
            }
		}
Ejemplo n.º 11
0
        protected void cboGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails();
            clsSearchKeys.ProductGroupID = long.Parse(cboGroup.SelectedItem.Value);

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboSubGroup.DataTextField = "ProductSubGroupName";
            cboSubGroup.DataValueField = "ProductSubGroupID";
            cboSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboSubGroup.DataBind();
            if (cboGroup.SelectedItem.Value != Constants.ZERO_STRING)
                cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL + " " + cboGroup.SelectedItem.Text, Constants.ZERO_STRING));
            else
                cboSubGroup.Items.Insert(0, new ListItem(Constants.ALL,Constants.ZERO_STRING));
            cboSubGroup.SelectedIndex = 0;
            clsProductSubGroup.CommitAndDispose();
        }
        protected void cboProductGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            Int64 intProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            clsProductSubGroup.GetConnection();
            ProductGroup clsProductGroup = new ProductGroup(clsProductSubGroup.Connection, clsProductSubGroup.Transaction);
            ProductGroupDetails clsDetails;
            //System.Data.DataTable dtProductSubGroup;

            if (intProductGroupID == 0)
            {
                clsDetails = clsProductGroup.Details(DataConstants.DEFAULT_PRODUCT_GROUP);
            }
            else
            {
                clsDetails = clsProductGroup.Details(intProductGroupID);
            }

            ProductSubGroupDetails clsSearchKeys = new ProductSubGroupDetails() { ProductGroupID = intProductGroupID };
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroup clsSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKeys, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
            cboProductSubGroup.DataBind();
            cboProductSubGroup.Items.Insert(0, new ListItem("Do not Apply to Product Sub Groups", "-1"));
            cboProductSubGroup.Items.Insert(1, new ListItem("Apply to all Product Sub Groups", "0"));
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;
            
            clsProductSubGroup.CommitAndDispose();

            cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.IndexOf(cboChartOfAccountPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDPurchase.ToString()));
            cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.IndexOf(cboChartOfAccountSold.Items.FindByValue(clsDetails.ChartOfAccountIDSold.ToString()));
            cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.IndexOf(cboChartOfAccountInventory.Items.FindByValue(clsDetails.ChartOfAccountIDInventory.ToString()));
            cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.IndexOf(cboChartOfAccountIDTaxPurchase.Items.FindByValue(clsDetails.ChartOfAccountIDTaxPurchase.ToString()));
            cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.IndexOf(cboChartOfAccountIDTaxSold.Items.FindByValue(clsDetails.ChartOfAccountIDTaxSold.ToString()));

        }
		private void LoadOptions()
		{
            
            DataClass clsDataClass = new DataClass();
            ChartOfAccounts clsChartOfAccount = new ChartOfAccounts();
            System.Data.DataTable dtList = clsDataClass.DataReaderToDataTable(clsChartOfAccount.List("ChartOfAccountName", SortOption.Ascending));

            ProductGroup clsProductGroup = new ProductGroup(clsChartOfAccount.Connection, clsChartOfAccount.Transaction);
            System.Data.DataTable dtProductGroup = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName");

            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };
            
            ProductSubGroup clsSubGroup = new ProductSubGroup(clsChartOfAccount.Connection, clsChartOfAccount.Transaction);
            System.Data.DataTable dtProductSubGroup = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);

            Products clsProduct = new Products(clsChartOfAccount.Connection, clsChartOfAccount.Transaction);
            System.Data.DataTable dtProduct = clsProduct.ListAsDataTable("ProductID", SortOption.Ascending);

            clsChartOfAccount.CommitAndDispose();

            cboProductGroup.DataTextField = "ProductGroupName";
            cboProductGroup.DataValueField = "ProductGroupID";
            cboProductGroup.DataSource = dtProductGroup.DefaultView;
            cboProductGroup.DataBind();
            cboProductGroup.Items.Add(new ListItem("Apply to all Product Groups", "0"));
            cboProductGroup.SelectedIndex = cboProductGroup.Items.Count - 1;

            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = dtProductSubGroup.DefaultView;
            cboProductSubGroup.DataBind();
            cboProductSubGroup.Items.Add(new ListItem("Do not Apply to Product Sub Groups", "-1"));
            cboProductSubGroup.Items.Add(new ListItem("Apply to all Product Sub Groups", "0"));
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;

            cboProduct.DataTextField = "ProductCode";
            cboProduct.DataValueField = "ProductID";
            cboProduct.DataSource = dtProduct.DefaultView;
            cboProduct.DataBind();
            cboProduct.Items.Add(new ListItem("Do not Apply to Products", "-1"));
            cboProduct.Items.Add(new ListItem("Apply to all Products", "0"));
            cboProduct.SelectedIndex = cboProduct.Items.Count - 1;

            cboChartOfAccountPurchase.DataTextField = "ChartOfAccountNameComplete";
            cboChartOfAccountPurchase.DataValueField = "ChartOfAccountID";
            cboChartOfAccountPurchase.DataSource = dtList.DefaultView;
            cboChartOfAccountPurchase.DataBind();
            cboChartOfAccountPurchase.Items.Add(new ListItem("Not Applicable", "0"));
            cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.Count - 1;

            cboChartOfAccountSold.DataTextField = "ChartOfAccountNameComplete";
            cboChartOfAccountSold.DataValueField = "ChartOfAccountID";
            cboChartOfAccountSold.DataSource = dtList.DefaultView;
            cboChartOfAccountSold.DataBind();
            cboChartOfAccountSold.Items.Add(new ListItem("Not Applicable", "0"));
            cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.Count - 1;

            cboChartOfAccountInventory.DataTextField = "ChartOfAccountNameComplete";
            cboChartOfAccountInventory.DataValueField = "ChartOfAccountID";
            cboChartOfAccountInventory.DataSource = dtList.DefaultView;
            cboChartOfAccountInventory.DataBind();
            cboChartOfAccountInventory.Items.Add(new ListItem("Not Applicable", "0"));
            cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.Count - 1;

            cboChartOfAccountIDTaxPurchase.DataTextField = "ChartOfAccountNameComplete";
            cboChartOfAccountIDTaxPurchase.DataValueField = "ChartOfAccountID";
            cboChartOfAccountIDTaxPurchase.DataSource = dtList.DefaultView;
            cboChartOfAccountIDTaxPurchase.DataBind();
            cboChartOfAccountIDTaxPurchase.Items.Add(new ListItem("Not Applicable", "0"));
            cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.Count - 1;

            cboChartOfAccountIDTaxSold.DataTextField = "ChartOfAccountNameComplete";
            cboChartOfAccountIDTaxSold.DataValueField = "ChartOfAccountID";
            cboChartOfAccountIDTaxSold.DataSource = dtList.DefaultView;
            cboChartOfAccountIDTaxSold.DataBind();
            cboChartOfAccountIDTaxSold.Items.Add(new ListItem("Not Applicable", "0"));
            cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.Count - 1;
		}
Ejemplo n.º 14
0
		private void LoadProductSubGroups(System.Data.SqlClient.SortOrder SequenceSortOrder)
		{
			try
			{
				tblLayoutGroup.Controls.Clear();
				if (mboLocked) return;

				Int64 intSequenceNoStart = 0;

				if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
					try { intSequenceNoStart = long.Parse(cmdSubGroupLeft.Tag.ToString()); }
					catch { }
				else
					try { intSequenceNoStart = long.Parse(cmdSubGroupRight.Tag.ToString()); }
					catch { }

                // Sep 24, 2014 put an override if cmdSubGroupLeft.Tag = 0
                // always do an asceding coz its already the end.
                if (intSequenceNoStart < Constants.C_RESTOPLUS_MAX_SUB_GROUP) intSequenceNoStart = 0; //reset to 0 if it's 1
                if (intSequenceNoStart == 0) SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending;

				ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns();
				clsProductSubGroupColumns.ProductSubGroupCode = true;
				clsProductSubGroupColumns.SequenceNo = true;

				ProductSubGroup clsProductSubGroup = new ProductSubGroup(mConnection, mTransaction);
                System.Data.DataTable dtProductSubGroup = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, new ProductSubGroupDetails(), intSequenceNoStart, SequenceSortOrder, "SequenceNo", SequenceSortOrder, SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending ? Constants.C_RESTOPLUS_MAX_SUB_GROUP : Constants.C_RESTOPLUS_MAX_SUB_GROUP + 1);
				clsProductSubGroup.CommitAndDispose();

                // re-order the products by sequence no
                if (dtProductSubGroup.Rows.Count > 0)
                {
                    System.Data.DataView dv = dtProductSubGroup.DefaultView;
                    dv.Sort = "SequenceNo";
                    dtProductSubGroup = dv.ToTable();
                }

				int iRow = 0;
				int iCol = 0;
				int iCtr = 1;

				if (dtProductSubGroup.Rows.Count == 0)
				{
					cmdSubGroupLeft.Tag = "0".ToString(); // reset the sequenceno to 0 if no record
					cmdSubGroupRight.Tag = "0".ToString(); // reset the sequenceno to 0 if no record
				}
				foreach (System.Data.DataRow dr in dtProductSubGroup.Rows)
				{
					if (iCtr > Constants.C_RESTOPLUS_MAX_SUB_GROUP) break;

                    if (iCtr == 1) cmdSubGroupLeft.Tag = dr[Data.ProductSubGroupColumnNames.SequenceNo].ToString();
                    if (iCtr >= 1 && dtProductSubGroup.Rows.Count > Constants.C_RESTOPLUS_MAX_SUB_GROUP) cmdSubGroupRight.Tag = dr[Data.ProductSubGroupColumnNames.SequenceNo].ToString();

					SubGroupButton cmdSubGroup = new SubGroupButton();

					cmdSubGroup.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
					cmdSubGroup.BackColor = System.Drawing.Color.Red;
					cmdSubGroup.Dock = System.Windows.Forms.DockStyle.Fill;
					cmdSubGroup.FlatAppearance.BorderColor = System.Drawing.Color.Gold;
					cmdSubGroup.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
					cmdSubGroup.ForeColor = System.Drawing.SystemColors.ControlText;
					cmdSubGroup.GradientBottom = System.Drawing.Color.Red;
					cmdSubGroup.GradientTop = System.Drawing.Color.Gold;
					cmdSubGroup.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
					cmdSubGroup.Location = new System.Drawing.Point(3, 3);
					cmdSubGroup.Size = new System.Drawing.Size(110, 82);
					cmdSubGroup.TabIndex = iCtr-1;
					cmdSubGroup.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
					cmdSubGroup.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
					cmdSubGroup.UseVisualStyleBackColor = false;

					cmdSubGroup.Name = "cmdSubGroup" + iCtr.ToString();
					cmdSubGroup.Text = dr[Data.ProductSubGroupColumnNames.ProductSubGroupCode].ToString();
					cmdSubGroup.Tag = dr[Data.ProductSubGroupColumnNames.ProductSubGroupID].ToString();
					cmdSubGroup.Click += new System.EventHandler(cmdSubGroup_Click);

                    if (!string.IsNullOrEmpty(dr[Data.ProductSubGroupColumnNames.ImagePath].ToString()))
                    {
                        try { cmdSubGroup.Image = new Bitmap(Application.StartupPath + "/images/subgroups/" + dr[Data.ProductSubGroupColumnNames.ImagePath].ToString()); }
					    catch { }
                    }
                    
					tblLayoutGroup.Controls.Add(cmdSubGroup, iCol, iRow);

					iCol++; iCtr++;
				}
			}
			catch { }
		}
Ejemplo n.º 15
0
		protected void cboProductGroup_SelectedIndexChanged(object sender, System.EventArgs e)
		{
            ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };

            ProductSubGroupDetails clsSearchKey = new ProductSubGroupDetails() { ProductGroupID = Int64.Parse(cboProductGroup.SelectedItem.Value) } ;

            ProductSubGroup clsProductSubGroup = new ProductSubGroup();
            cboProductSubGroup.DataTextField = "ProductSubGroupName";
            cboProductSubGroup.DataValueField = "ProductSubGroupID";
            cboProductSubGroup.DataSource = clsProductSubGroup.ListAsDataTable(clsProductSubGroupColumns, clsSearchKey, SortField: "ProductSubGroupName").DefaultView;
            cboProductSubGroup.DataBind();
            cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;
            clsProductSubGroup.CommitAndDispose();

            cboProductSubGroup_SelectedIndexChanged(null, null);
		}