/// <summary> /// Function to fill the grid /// </summary> public void GridFill() { try { CurrencyInfo InfoCurrency = new CurrencyInfo(); CurrencyBll BllCurrency = new CurrencyBll(); InfoCurrency = BllCurrency.CurrencyView(1); int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces; string calculationMethod = string.Empty; SettingsInfo InfoSettings = new SettingsInfo(); SettingsBll BllSettings = new SettingsBll(); //--------------- Selection Of Calculation Method According To Settings ------------------// if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO") { calculationMethod = "FIFO"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost") { calculationMethod = "Average Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost") { calculationMethod = "High Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost") { calculationMethod = "Low Cost"; } else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate") { calculationMethod = "Last Purchase Rate"; } // StockPostingSP spstock = new StockPostingSP(); StockPostingBll BllStockPosting = new StockPostingBll(); decimal decrackId = 0; DataSet dsstock = new DataSet(); List<DataTable> list = new List<DataTable>(); if (cmbRack.SelectedValue != null) { decrackId = Convert.ToDecimal(cmbRack.SelectedValue.ToString()); } list = BllStockPosting.StockReportGridFill1(txtproductName.Text, Convert.ToDecimal(cmbBrand.SelectedValue.ToString()), Convert.ToDecimal(cmbModel.SelectedValue.ToString()), (txtProductCode.Text), Convert.ToDecimal(cmbGodown.SelectedValue.ToString()), decrackId, Convert.ToDecimal(cmbSize.SelectedValue.ToString()), Convert.ToDecimal(cmbTax.SelectedValue.ToString()), Convert.ToDecimal(cmbProductgroup.SelectedValue.ToString()), txtBatchName.Text); if (list[0].Rows.Count > 0) { decimal decTotal = 0; for (int i = 0; i < list[0].Rows.Count; i++) { if (list[0].Rows[i]["stockvalue"].ToString() != string.Empty) { decTotal = decTotal + Convert.ToDecimal(list[0].Rows[i]["stockvalue"].ToString()); } } decTotal = Math.Round(decTotal, 2); txtTotal.Text = decTotal.ToString(); } else { txtTotal.Text = "0.00"; } dgvStockReport.DataSource = list[0]; //if (dtbl.Columns.Count > 0) //{ // dgvStockReport.Columns["stockvalue"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; //} } catch (Exception ex) { MessageBox.Show("STKR:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }