/// <summary> /// Function to fill the grid based on condition /// </summary> public void GridFill() { decimal decTotalAmount = 0; string strColumn = string.Empty; List<DataTable> ListObj = new List<DataTable>(); PurchaseInvoiceBll BllPurchaseInvoice = new PurchaseInvoiceBll(); try { if (rbtnInvoiceDate.Checked) { strColumn = rbtnInvoiceDate.Text; } else { strColumn = rbtnVoucherDate.Text; } ListObj = BllPurchaseInvoice.PurchaseInvoiceReportFill(1, strColumn, dtpFromDate.Value, dtpToDate.Value, Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), cmbStatus.Text, cmbPurchaseMode.Text, Convert.ToDecimal(cmbAgainstVoucherType.SelectedValue.ToString()), txtOrderNo.Text, Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, txtProductCode.Text, txtProductName.Text); dgvPurchaseReport.DataSource = ListObj[0]; foreach (DataGridViewRow dgvrow in dgvPurchaseReport.Rows) { if (dgvrow.Cells["dgvtxtBillAmount"].Value != null) { if (dgvrow.Cells["dgvtxtBillAmount"].Value.ToString() != string.Empty) { decTotalAmount = decTotalAmount + Convert.ToDecimal(dgvrow.Cells["dgvtxtBillAmount"].Value.ToString()); } } } txtTotalAmount.Text = Math.Round(decTotalAmount, PublicVariables._inNoOfDecimalPlaces).ToString(); } catch (Exception ex) { MessageBox.Show("PIREP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }