/// <summary> /// Function to fill the grid based on condition /// </summary> public void GridFill() { decimal decTotalAmount = 0; string strColumn = string.Empty; DataTable dtbl = new DataTable(); PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP(); try { if (rbtnInvoiceDate.Checked) { strColumn = rbtnInvoiceDate.Text; } else { strColumn = rbtnVoucherDate.Text; } dtbl = spPurchaseMaster.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 = dtbl; 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); } }