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 = ""; }
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 { } }
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 = ""; }