private void GetStudentDetailsByClassReport()
        {
            btnViewReport.Enabled = false;
            lblPleaseWait.Visible = true;
            try
            {
                int year  = datePickerReport.Value.Year;
                int month = datePickerReport.Value.Month;

                _feeMonthlyReportModel = new FeeMonthlyReportModel
                {
                    ClassID   = Convert.ToInt16(ddlClass.SelectedValue),
                    SectionID = Convert.ToInt16(ddlSection.SelectedValue) == 0 ? null : (short?)Convert.ToInt16(ddlSection.SelectedValue),
                    Month     = (short)month,
                    Year      = (short)year,
                };

                _feeReport = new FeeReport();


                DataSet dsDuesReport = _feeReport.GetStudentDuesDetailsByClass(_feeMonthlyReportModel);

                if (dsDuesReport != null && dsDuesReport.Tables[1].Rows.Count > 0)
                {
                    dsDuesReport.Tables[0].TableName = "School";
                    dsDuesReport.Tables[1].TableName = "StudentDues";

                    ReportDocument rdoc = new ReportDocument();
                    rdoc.Load(_appPath + "Reports\\StudentDuesReport.rpt");
                    rdoc.SetDataSource(dsDuesReport);
                    crystalReportViewer.ReportSource = rdoc;
                    rdoc.Refresh();
                    crystalReportViewer.Refresh();
                    crystalReportViewer.Show();
                    crystalReportViewer.Visible = true;

                    btnViewReport.Enabled = true;
                    lblPleaseWait.Visible = false;
                }
                else
                {
                    crystalReportViewer.Visible = false;
                    MessageBox.Show("No Result Found.", "No Record Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    btnViewReport.Enabled = true;
                    lblPleaseWait.Visible = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error! Please contact to admin.", "Applicatin Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public DataSet GetFeeReportByMonth(FeeMonthlyReportModel feeMonthlyReportModel)
        {
            DataSet result;

            using (SqlService sqlService = new SqlService(ConnectionString.ConnectionStrings))
            {
                sqlService.AddParameter("@ClassID", feeMonthlyReportModel.ClassID);
                sqlService.AddParameter("@Year", feeMonthlyReportModel.Year);
                sqlService.AddParameter("@Month", feeMonthlyReportModel.Month);
                using (DataSet dataSet = sqlService.ExecuteSPDataSet("dbo.USP_Report_Monthly_Fee_By_Class_Multiple_Months"))
                {
                    result = dataSet;
                }
            }
            return(result);
        }
        public DataSet GetStudentDuesDetailsByClass(FeeMonthlyReportModel model)
        {
            DataSet result;

            using (SqlService sqlService = new SqlService(ConnectionString.ConnectionStrings))
            {
                sqlService.AddParameter("@ClassID", model.ClassID);
                sqlService.AddParameter("@SectionID", model.SectionID);
                sqlService.AddParameter("@Month", model.Month);
                sqlService.AddParameter("@Year", model.Year);
                using (DataSet dataSet = sqlService.ExecuteSPDataSet("dbo.USP_StudentDuesDetailsByClass"))
                {
                    result = dataSet;
                }
            }
            return(result);
        }
Exemple #4
0
        private void GetMonthlyFeeReport()
        {
            try
            {
                int year  = datePickerReport.Value.Year;
                int month = datePickerReport.Value.Month;

                _feeMonthlyReportModel = new FeeMonthlyReportModel
                {
                    ClassID = Convert.ToInt16(ddlClass.SelectedValue),
                    Month   = (short)month,
                    Year    = (short)year,
                };

                _feeReport = new FeeReport();

                DataSet dsMonthlyReport = _feeReport.GetFeeReportByMonth(_feeMonthlyReportModel);

                if (dsMonthlyReport != null && dsMonthlyReport.Tables[0].Rows.Count > 0)
                {
                    dsMonthlyReport.Tables[0].TableName = "FeeDetails";
                    dsMonthlyReport.Tables[1].TableName = "FeeApplicable";
                    dsMonthlyReport.Tables[2].TableName = "PreviousBill";
                    dsMonthlyReport.Tables[3].TableName = "School";

                    ReportDocument rdoc = new ReportDocument();
                    rdoc.Load(_appPath + "Reports\\MonthlyFeeReceipt.rpt");
                    rdoc.SetDataSource(dsMonthlyReport);
                    crystalReportViewer.ReportSource = rdoc;
                    rdoc.Refresh();
                    crystalReportViewer.Refresh();
                    crystalReportViewer.Show();
                    crystalReportViewer.Visible = true;
                }
                else
                {
                    crystalReportViewer.Visible = true;
                    MessageBox.Show("No Result Found.", "Monthly Fee Receipt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
            }
        }