protected void btnSearch_Click(object sender, EventArgs e) { if (ddlMember.SelectedValue != "0" && ddlMember.Text != string.Empty) { Message.Show = false; SumTotBill = 0; SumTotRecd = 0; BusinessLayer.Accounts.StudentFeesCollection ObjFees = new BusinessLayer.Accounts.StudentFeesCollection(); int MemberId = int.Parse(ddlMember.SelectedValue.Trim()); string FromDate = txtFromDate.Text.Trim(); string Todate = txtToDate.Text.Trim(); DataSet ds = ObjFees.GetStudentOutstandingReport(MemberId, FromDate, Todate); LoadMemberInfo(ds.Tables[0]); if (ds.Tables[1] != null) { dgvBill.DataSource = ds.Tables[1]; dgvBill.DataBind(); } if (ds.Tables[1].Rows.Count > 0) { btnDownload.Visible = true; btnPrint.Visible = true; btnPayment.Visible = true; ((Label)dgvBill.FooterRow.FindControl("lblSumTotBill")).Text = SumTotBill.ToString("n"); ((Label)dgvBill.FooterRow.FindControl("lblSumTotRecd")).Text = SumTotRecd.ToString("n"); ((Label)dgvBill.FooterRow.FindControl("lblSumBalance")).Text = (SumTotBill - SumTotRecd).ToString("n"); } else { btnDownload.Visible = false; btnPrint.Visible = false; btnPayment.Visible = false; } } else { Message.IsSuccess = false; Message.Text = "Please Select Member"; Message.Show = true; } }
protected void btnSearch_Click(object sender, EventArgs e) { if (ddlMember.SelectedValue != "0" && ddlMember.Text != string.Empty) { Message.Show = false; SumTotBill = 0; SumTotRecd = 0; BusinessLayer.Accounts.StudentFeesCollection ObjFees = new BusinessLayer.Accounts.StudentFeesCollection(); int MemberId = int.Parse(ddlMember.SelectedValue.Trim()); string FromDate = txtFromDate.Text.Trim(); string Todate = txtToDate.Text.Trim(); DataSet ds = ObjFees.GetStudentOutstandingReport(MemberId, FromDate, Todate); LoadMemberInfo(ds.Tables[0]); if (ds.Tables[1] != null) { dgvBill.DataSource = ds.Tables[1]; dgvBill.DataBind(); } dgvBill.FooterRow.Cells[4].Text = ((from row in ds.Tables[1].AsEnumerable() select row.Field <decimal?>("MainAmt")).Sum() ?? 0).ToString(); dgvBill.FooterRow.Cells[5].Text = ((from row in ds.Tables[1].AsEnumerable() select row.Field <decimal?>("TaxAmt")).Sum() ?? 0).ToString(); dgvBill.FooterRow.Cells[6].Text = ((from row in ds.Tables[1].AsEnumerable() select row.Field <decimal?>("TotBill")).Sum() ?? 0).ToString(); dgvBill.FooterRow.Cells[7].Text = ((from row in ds.Tables[1].AsEnumerable() select row.Field <decimal?>("MainRcvd")).Sum() ?? 0).ToString(); dgvBill.FooterRow.Cells[8].Text = ((from row in ds.Tables[1].AsEnumerable() select row.Field <decimal?>("TaxRcvd")).Sum() ?? 0).ToString(); dgvBill.FooterRow.Cells[9].Text = ((from row in ds.Tables[1].AsEnumerable() select row.Field <decimal?>("TotRecd")).Sum() ?? 0).ToString(); dgvBill.FooterRow.Cells[10].Text = (Convert.ToDecimal(dgvBill.FooterRow.Cells[6].Text) - Convert.ToDecimal(dgvBill.FooterRow.Cells[9].Text)).ToString(); if (ds.Tables[1].Rows.Count > 0) { btnDownload.Visible = true; btnPrint.Visible = true; } else { btnDownload.Visible = false; btnPrint.Visible = false; //btnPayment.Visible = false; } } else { Message.IsSuccess = false; Message.Text = "Please Select Member"; Message.Show = true; } }