Click here to Skip to main content
Click here to Skip to main content

RFC Architecture for Finance Projects (The Invoicing Part)

, 18 Nov 2008
Rate this:
Please Sign up or sign in to vote.
RFC Architecture for Finance Projects (The Invoicing Part)
Title:       RFC Architecture for Finance Project (The Invoicing Project)
Author:      Shivprasad Koirala 
Email:       shiv_koirala@yahoo.com
Language:    Architecture Interview Questions
Level:       Beginner
Description: RFC Architecture for Finance Project (The Invoicing Project)

RFC Architecture for Finance Project (The Invoicing Project)


Introduction

The RFC Architecture

The current sections

The invoicing part

Folders in the project

The Invoicing table structure

Business class structure and code

Business class and code explanation

ASPX pages

Next version planning

Introduction
 

RFC is an open source initiative for Finance projects. It has reusable components like invoicing, accounting and purchase modules. In this section we will discuss about the invoicing section of the RFC architecture.

You can download the project details from http://www.codeplex.com/FinanceDotNET


 

The RFC Architecture


RFC stands on a three tier architecture framework. It uses enterprise blocks heavily for data access layer, security, validation etc. The core of RFC is the business logic layer which can be used in a decoupled manner in your project. Currently the data access layer only supports SQL Server.

 


 

The current sections

Currently RFC supports three major section Invoicing, purchase and journal section. Journal section is a double entry accounting system which is the heart of RFC. Any entries made in to invoicing or purchase is finally sent to the journal section.
 

The invoicing part

You can download the invoicing requirements from http://www.codeplex.com/FinanceDotNET/SourceControl/ListDownloadableCommits.aspx
I really do not want to make this article large by pasting the requirement document.

Folders in the project

 

Folder Name

What does it have

Root

In the root folder we have the user interface of the application.

App_Data

It has the database i.e. Invoicing.MDF

Invoicing

This has the business classes for the invoicing application.

InvoicingDataLayer

This has the data access layer of the project.

 

The Invoicing table structure

The invoicing part has two important tables one is the product table and the other is the Invoice table.

Mst_product table

Productid

This is unique key which identifies the product.

ProductDescription

A simple description about the product.

UnitCost

Per unit cost of the product

 

 

 

Invoice table

InvoiceReference

This is unique key which identifies a invoice uniquely.

Invoice comments

A short  text which describes the comments

UnitCost

Per unit cost of the product

Product

This is the product reference from the  product master table

Qty

How much quantity of the product was ordered?

Amount

Total Amount to be paid by the customer

PaidAmount

Many times the customer will not pay the complete amount so a paid amount field.

Customer Name and Address

This describes the customer credentials.

TaxAmount

Tax on the current amount.

 

Business class structure and code

Invoice has two business classes invoice class i.e. ‘ClsInvoice’ and product class i.e. ‘ClsProduct’. Both of these call the ‘ClsInvoiceDB’ class to database operations.

 

Business class and code explanation

Below is the ‘insert’ method of  ‘clsInvoice’  class. It actually creates the object of ‘clsInvoiceDB’ to connect to the SQL Server database.

public void Insert()
{
clsInvoiceDB objInvoiceDB = new clsInvoiceDB();
objInvoiceDB.InsertInvoice(_InvoiceReference, _InvoiceComments,
_InvoiceDate, _ProductId, _Qty, _Amount, _TaxAmount, _PaidAmount, 
_CustomerName,_CustomerAddress, _UnitCost);
}

The insert invoice class code is something as shown below.

public void InsertInvoice(string _InvoiceReference, string _InvoiceComments, DateTime _InvoiceDate, int _productId,  
int _Qty, double _Amount, double _TaxAmount, double _PaidAmount, string _CustomerName, string _CustomerAddress, double _UnitCost)  
{
SqlConnection ObjConnection = new SqlConnection();
ObjConnection.ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
ObjConnection.Open();
SqlCommand objCommand = new SqlCommand();
objCommand.Connection = ObjConnection;
objCommand.CommandText = "usp_InsertInvoice";
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.Parameters.Add(new SqlParameter("InvoiceReference",_InvoiceReference));
objCommand.Parameters.Add(new SqlParameter("@InvoiceComments", _InvoiceComments));
objCommand.Parameters.Add(new SqlParameter("@InvoiceDate", _InvoiceDate));
objCommand.Parameters.Add(new SqlParameter("@ProductId", _productId));
objCommand.Parameters.Add(new SqlParameter("@Qty", _Qty));
objCommand.Parameters.Add(new SqlParameter("@Amount", _Amount));
objCommand.Parameters.Add(new SqlParameter("@TaxAmount", _TaxAmount));
objCommand.Parameters.Add(new SqlParameter("@PaidAmount", _PaidAmount));
objCommand.Parameters.Add(new SqlParameter("@CustomerName", _CustomerName));
objCommand.Parameters.Add(new SqlParameter("@CustomerAddress", _CustomerAddress));
objCommand.Parameters.Add(new SqlParameter("@UnitCost", _UnitCost));
objCommand.ExecuteNonQuery();
ObjConnection.Close();
}

In the same way other methods of the business component and DAL interact. I am not pasting the code here as the article will become bulky. You can download the project from the codeplex to get a fell of the same.

ASPX pages

There are two ASPX pages one is the Invoice entry screen (InvoiceEntry.aspx) and the second is the product selection screen (SelectProducts.aspx). The UI consumes the business object in a very standard format. To get more understanding you can see the ‘setObjectFromUI’ method where all the values from the UI is passed to the business object.

public void setObjectFromUI(clsInvoice objInvoice)
{
try
{
objInvoice.CustomerName = txtCustomerName.Text;
objInvoice.CustomerAddress = txtCustomerAddress.Text;
objInvoice.InvoiceComments = txtComments.Text;
objInvoice.InvoiceReference = txtInvoiceNumber.Text;
}

Finally in the button events the operations of the classes like insert , update and delete is called. For instance you can see in the update invoice click event we have called the ‘Update’ operation. Any exceptions raised from the user interface is finally caught and displayed in the error message label.

protected void btnUpdateInvoice_Click(object sender, EventArgs e)
{
clsInvoice objInvoice = new clsInvoice();
try
{
setObjectFromUI(objInvoice);
objInvoice.Update();
clearText();
LoadGrid();
clearSession();
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message.ToString();
}

The whole project goes with the same style of coding business object, DAL and the consumption in the UI. So if you are able to follow the above code you should be able to understand the other part of the project also.

Next version planning

• The data access layer will now go through Enterprise data access layer.
• Business validation will go through the enterprise validation application blocks
• Integration with the accounting system
 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shivprasad koirala
Architect http://www.questpond.com
India India

I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small
E-learning company in India. We are very much active in making training videos ,
writing books and corporate trainings. Do visit my site for 
.NET, C# , design pattern , WCF , Silverlight
, LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server  training 
and Interview questions and answers


Comments and Discussions

 
GeneralMMMMM ... this is more and more looking like Spamming to me PinmemberMichael Moreno19-Nov-08 1:07 
GeneralRe: MMMMM ... this is more and more looking like Spamming to me PinmemberShivprasad koirala19-Nov-08 2:31 
GeneralRe: MMMMM ... this is more and more looking like Spamming to me Pinmemberdevnet24719-Nov-08 5:32 
GeneralRe: MMMMM ... this is more and more looking like Spamming to me PinmemberShivprasad koirala19-Nov-08 5:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 19 Nov 2008
Article Copyright 2008 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid