School Accounts Management

Introduction

This article is about the account management of a School. It is desktop based application developed using C#, sql server 2008 and Crystal Reports.

Overview

The System is designed according to requirements in which Students and teachers personals information recorded for collection of student fees and to made payment of monthly teacher salaries. It also record daily office expanses.

Some  key features of AMS are

  •  Only authorized access
  • Reporting at any instances
  •  Separate defaulter students(who had not paid their fees)
  •  Class wise Enrollment of Students with auto generated Roll Number and Registration number
  •  Total profit or loss show at the end of each month

Code behind

In this piece of code Connection established with sql server and crystal report runtime environment

<?xml version=”1.0″?>

<configuration>

<configSections>

</configSections>

<connectionStrings>

<add name=”MyConnectionString” connectionString=”Data Source=WAQAR-PC\SQLEXPRESS;Initial Catalog=SchoolSystem;Integrated Security=True”

providerName=”System.Data.SqlClient” />

</connectionStrings>

<startup  useLegacyV2RuntimeActivationPolicy=”true”><supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″/></startup>

</configuration>

A store procedure is called which take arguments from the input fields on the admission from and return the registration number with class roll number

public int Save(string StoreProcedureName{

SqlCommand cmd = new SqlCommand(StoreProcedureName, connection)          cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add(new SqlParameter(“@ClassName”, this.classApplied));            cmd.Parameters.Add(new SqlParameter(“@DateOfAddmission”, this.DateOfAddmission));

cmd.Parameters.Add(new SqlParameter(“@Discnt”, this.Discount));           addparameter(cmd);

SqlDataAdapter da = new SqlDataAdapter(cmd)

DataTable dt = new DataTable();

da.Fill(dt);

if (dt.Rows.Count == 1)         {

studentId = dt.Rows[0][“RegistrationNo”].ToString(); }

return -1;        }

Take values from datagridview control and save to database.

private void button1_Click(object sender, EventArgs e){

int a = dataGridView1.Rows.Count;

for (int count = 0; count < a-1; count++)

{ Expnc.itemName = dataGridView1.Rows[count].Cells[“clmItem”].Value.ToString(); Expnc.Quantity = Convert.ToDouble(dataGridView1.Rows[count].Cells[“clmQty”].Value); Expnc.unit_price=Convert.ToDouble(dataGridView1.Rows[count].Cells[“clmUnitPrice”].Value);Expnc.Total_Amount=Convert.ToDouble(dataGridView1.Rows[count].Cells[“clmAmount”].Value); Expnc.Vocherdate = dtpVocherDate.Value.ToString();

Expnc.saveExpencess();      }

MessageBox.Show(“Saved”);}}}

bind a crystal report to the report viewer form

DataTable MyDataTable = new DataTable();

ReportDocument rptdoc = new ReportDocument();

if (lp_sc.ReportName == “Admission Date Wise Student Detail Report”){

MyDataTable = lp_sc.Find(“dbo.[rptStudentReport]”);

rptdoc.Load(lp_sc.ReportPath);

rptdoc.SetDataSource(MyDataTable);

Store Proccedure for auto genrateion of Registration number and Roll number

declare @roll int
declare @cName varchar(10)
declare @year varchar(20)
declare @con varchar(50)
— SET NOCOUNT ON added to prevent extra result sets from
— interfering with SELECT statements.
SET NOCOUNT ON;
— Insert statements for procedure here
select @roll= ISNULL( MAX(StudentEnroll.RollNo)+1,1) from StudentEnroll
where StudentEnroll.ClassID =@ClassName
select @cName=Classes.ClassName from Classes where Classes.ClassId=@ClassName
select @year=YEAR(@DateOfAddmission)
select  @con=cast(@roll as varchar(20)) + ‘-‘ +@cName +’-‘+@year

Screen Shortsmain reg fee ecpn

reports

reports

Database Design

database