protected void txtQty_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (CategoriesDropDownList.SelectedIndex > 0)
                {
                    if (ItemsDropDownList.SelectedIndex > 0)
                    {
                        AddSaleItems();
                        txtQty.Text      = "";
                        txtSubTotal.Text = total.ToString();
                        CategoriesDropDownList.Focus();
                        DiscountCalculation();
                    }
                    else
                    {
                        ItemsDropDownList.Focus();

                        lblItems.ForeColor = Color.Red;
                    }
                }
                else
                {
                    CategoriesDropDownList.Focus();
                    lblCategories.ForeColor = Color.Red;
                }
            }
            catch
            { }
        }
Beispiel #2
0
 public void Refresh()
 {
     txtCode.Text = "";
     txtQty.Text  = "";
     txtCost.Text = "";
     txtMrp.Text  = "";
     CategoriesDropDownList.ClearSelection();
     SizeDropDownList.ClearSelection();
     ItemsDropDownList.ClearSelection();
 }
 public void Refresh()
 {
     GetALLCategories();
     AutoCodeGenerate();
     CategoriesDropDownList.ClearSelection();
     ItemsDropDownList.ClearSelection();
     txtCustomerName.Text = "";
     txtCustomerName.Focus();
     txtSubTotal.Text   = "";
     txtDiscount.Text   = "";
     txtDiscount.Text   = "0";
     txtTotalCost.Text  = "";
     txtPaidAmount.Text = "";
     lblChanges.Text    = "";
 }
Beispiel #4
0
        protected void CategoriesDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int id = Convert.ToInt32(CategoriesDropDownList.SelectedValue);

                ItemsDropDownList.DataSource     = _PurchaseRepository.GetAllItemsByCategories(id);
                ItemsDropDownList.DataTextField  = "Name";
                ItemsDropDownList.DataValueField = "Code";
                ItemsDropDownList.DataBind();

                ItemsDropDownList.Items.Insert(0, new ListItem("Chose Items", "0"));
            }
            catch
            {
            }
        }
 protected void CategoriesDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int Id = Convert.ToInt32(CategoriesDropDownList.SelectedValue);
         ItemsDropDownList.DataSource     = _ItemSalesRepository.GetAllItemsByCategories(Id);
         ItemsDropDownList.DataTextField  = "Name";
         ItemsDropDownList.DataValueField = "Id";
         ItemsDropDownList.DataBind();
         ItemsDropDownList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Items", "0"));
         txtItemPrice.Text       = "";
         lblCategories.ForeColor = Color.Black;
     }
     catch
     {
     }
 }
Beispiel #6
0
        protected void SizeDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int    Id   = Convert.ToInt32(CategoriesDropDownList.SelectedValue);
                string Size = SizeDropDownList.SelectedItem.ToString();
                ItemsDropDownList.DataSource     = _StocksInRepository.GetItemsByCtgndSze(Id, Size);
                ItemsDropDownList.DataTextField  = "Name";
                ItemsDropDownList.DataValueField = "Id";
                ItemsDropDownList.DataBind();

                ItemsDropDownList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Items", "0"));

                txtCode.Text = "";
            }
            catch
            {
            }
        }
Beispiel #7
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCustomerContact.Text != null && CategoriesDropDownList.SelectedIndex > 0 && ItemsDropDownList.SelectedIndex > 0 && txtQty.Text != null)
                {
                    if (Convert.ToDecimal(lblStock.Text) >= Convert.ToDecimal(txtQty.Text))
                    {
                        SaleDetails _SaleDetails = new SaleDetails();
                        _SaleDetails.CustomerContact = txtCustomerContact.Text;
                        _SaleDetails.Item            = ItemsDropDownList.SelectedItem.ToString();
                        _SaleDetails.Unit            = Convert.ToDecimal(lblSellingPrice.Text);
                        _SaleDetails.Qty             = Convert.ToDecimal(txtQty.Text);
                        _SaleDetails.Total           = Convert.ToDecimal(lblSellingPrice.Text) * Convert.ToDecimal(txtQty.Text);
                        _SaleDetails.SalesId         = txtSalesId.Text;

                        int success = _SalesRepository.Add(_SaleDetails);
                        if (success > 0)
                        {
                            LoadSalesOrder();
                            GridviewRowSum();
                            ItemsDropDownList.ClearSelection();
                            lblSellingPrice.Text = "";
                            lblStock.Text        = "";
                            txtQty.Text          = "";
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failed Added');", true);
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please Check Your Stock');", true);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please Check All formality');", true);
                }
            }
            catch { }
        }
Beispiel #8
0
        public void AddPurchaseItems()
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Item", typeof(string));
            dataTable.Columns.Add("Batch", typeof(int));
            dataTable.Columns.Add("Qty", typeof(decimal));
            dataTable.Columns.Add("CostPrice", typeof(decimal));
            dataTable.Columns.Add("TotalPrice", typeof(decimal));
            dataTable.Columns.Add("SellingPrice", typeof(decimal));
            dataTable.Columns.Add("Expire", typeof(string));
            DataRow dr   = null;
            var     data = (DataTable)ViewState["Details"];

            if (data != null)
            {
                for (int i = 0; i < 1; i++)
                {
                    dataTable = (DataTable)ViewState["Details"];
                    if (dataTable.Rows.Count > 0)
                    {
                        dr                 = dataTable.NewRow();
                        dr["Item"]         = ItemsDropDownList.SelectedItem.ToString();
                        dr["Batch"]        = txtBatch.Text;
                        dr["Qty"]          = txtQty.Text;
                        dr["CostPrice"]    = txtCostPrice.Text;
                        dr["TotalPrice"]   = Convert.ToDecimal(dr["Qty"]) * Convert.ToDecimal(dr["CostPrice"]);
                        dr["SellingPrice"] = txtSellingPrice.Text;
                        dr["Expire"]       = txtExpire.Text;

                        dataTable.Rows.Add(dr);

                        PurchaseGridView.DataSource = dataTable;
                        PurchaseGridView.DataBind();
                    }
                    else
                    {
                        dr                 = dataTable.NewRow();
                        dr["Item"]         = ItemsDropDownList.SelectedItem.ToString();
                        dr["Batch"]        = txtBatch.Text;
                        dr["Qty"]          = txtQty.Text;
                        dr["CostPrice"]    = txtCostPrice.Text;
                        dr["TotalPrice"]   = Convert.ToDecimal(dr["Qty"]) * Convert.ToDecimal(dr["CostPrice"]);
                        dr["SellingPrice"] = txtSellingPrice.Text;
                        dr["Expire"]       = txtExpire.Text;

                        dataTable.Rows.Add(dr);

                        PurchaseGridView.DataSource = dataTable;
                        PurchaseGridView.DataBind();
                    }
                }
            }
            else
            {
                dr                 = dataTable.NewRow();
                dr["Item"]         = ItemsDropDownList.SelectedItem.ToString();
                dr["Batch"]        = txtBatch.Text;
                dr["Qty"]          = txtQty.Text;
                dr["CostPrice"]    = txtCostPrice.Text;
                dr["TotalPrice"]   = Convert.ToDecimal(dr["Qty"]) * Convert.ToDecimal(dr["CostPrice"]);
                dr["SellingPrice"] = txtSellingPrice.Text;
                dr["Expire"]       = txtExpire.Text;

                dataTable.Rows.Add(dr);

                PurchaseGridView.DataSource = dataTable;
                PurchaseGridView.DataBind();
            }
            ViewState["Details"] = dataTable;
            ItemsDropDownList.ClearSelection();
            txtBatch.Text        = "";
            txtQty.Text          = "";
            txtCostPrice.Text    = "";
            txtSellingPrice.Text = "";
            txtExpire.Text       = "";
        }