Creating Accounting Application With C# - Part Three

This article is the third part from the series Creating Accounting Applications with C#. If you haven’t read the first and second parts, please have a look before continuing with this.

In the previous article, we started our application development by creating the main window in MDI format. In this article, we will add some additional features to the form.

Flow of the article

  • Open another window from Main Form as MDI child
  • Forms used in this project and their use
  • Storing data in Properties.Settings
  • List of Properties.Settings.Default variables we used in this projects

Open another window from Main Form as Mdichild

First of all, let us add a form to the project. To add a new form to the project, put the cursor on the project name shown on the Solution Explorer. Right-click the mouse >> Add-New Item.

 

Or from the menubar, you can add the same by clicking Project >> Add Window Form.

 

Then, press on Windows Forms >> Window Form. After giving a suitable name, press OK button.

 

We have added a new form to our project. Now, we have to write the code to open the newly created form from the Main Window.

 

We can create an event. By creating an event, we are applying an action to the control. Firstly, select Firm and then double-click on Company Details. The system will automatically create an event for us.

Then, declare the form as given below.

  1. CompanyDetails companyDetails; 

Next, we can write full code as given below.

  1. CompanyDetails companyDetails;  
  2. privatevoid companyDetailsToolStripMenuItem_Click(object sender, EventArgs e) {  
  3.     if (companyDetails == null) {  
  4.         companyDetails = newCompanyDetails();  
  5.         companyDetails.MdiParent = this;  
  6.         companyDetails.FormClosed += newFormClosedEventHandler(companyDetails_FormClosed);  
  7.         companyDetails.Show();  
  8.     } else {  
  9.         companyDetails.Activate();  
  10.     }  
  11. }  
  12. void companyDetails_FormClosed(object sender, FormClosedEventArgs e) {  
  13.     companyDetails = null;  
 

Here, with the ‘If statement’, we check whether the form is opened or not. If the result is null, we have to declare the class and if the result is not null, we just activate the CompanyDetails window. To get this type of result, we programmatically put an event as of Form Closed event.

  1. companyDetails.FormClosed += newFormClosedEventHandler(companyDetails_FormClosed);  

And in the event, we assign the value to null.

  1. void companyDetails_FormClosed(object sender, FormClosedEventArgs e)  
  2. {  
  3.    companyDetails=null;  
  4. }  

Sometimes, we have to open the same window as multiple. For this, we remove the inline event as the code given below.

  1. saleEstimate = newSalesEstimate();  
  2. saleEstimate.MdiParent = this;  
  3. saleEstimate.Show();  

Then, we need to mention the MDI parent. Here, the MDI parent is the Main window. So, we put the code like below.

  1. companyDetails.MdiParent = this;  

As mentioned above, let us create forms wanted in this project. The various types of form and their uses have been mentioned below.

Forms used in this project and their use

SL NoForm NameRemarks
1Account CreationTo add New Account and edit and delete existing ledger account.
2Account GroupTo Add New Account Group and edit and delete existing account group
3ActivationFor Activation Purposes. By this window, we can manage our customers' subscription
4Admin SettingsTo set the admin property settings of the application
5Application SettingsTo customize the settings of the application
6Backup DatabaseThe Window to make the backup file of the database
7Balance SheetTo show the balance sheet report of the firm
8Bank PaymentThe window to enter the payment we made through the bank
9Bank ReceiptThe window to enter the receipt we got through a bank account
10Bank ReconciliationTo reconcile the bank entry by changing date to right date
11Barcode DesigningThis window is used to design and to print the Barcode.
12Bulk Bill PrintThis window is to print the Invoice from serial number to serial number bulky.
13Brand CreationThe window to create, update and delete different brands of products
14Calendar PlanningTo record the events and plans as per date
15Cash PaymentThe window to enter the cash payment we made.
16Cash ReceiptThe window to enter the cash receipt.
17Change DateTo change the date of the application
18Change PasswordTo change the password of the current user
19Change DatabaseTo change the application database
20Company DetailsIn this window, we can enter the name and other details of the company.
21Cheque ReportTo view the post-dated cheque receipt and payment report.
22Contact UsIf the customer wants to contact the developer, he can use this window
23Credit NoteThis is to enter the credit note transaction
24Custom Transaction ReportIf you want to generate a report other than the given report, you can use this window.
25Daily Account StatementThis is to view the daily account statement. As in this window, you can see all the transaction you made in the current date
26Database Auto BackupThe window to Backup the database when the application is closing
27Day CloseThis window to close the day. After closing a day, we can’t enter any transactions on that day.
28Database ConnectionThis is used to change a database connection, create a new database, backup database, restore the database and configure the database. In this, we create all database related work
29Debit NoteTo record debit note transaction. 
30Discount Sales ReportTo view the report of discount sales from fixed date to a fixed date.
31Email SettingsThis is to save SMTP details and user id and password of email provider.
32Employee RegistrationThis is to record the data about employees such as Name, designation, qualification and experience.
33Expiry Stock ReportThis is to view the report of products that are expired.
34Export DataThis is to export data to another database
35Financial Period SettingsThis is used to set the financial period
36First PurchaseWhen we purchase some product from a supplier, we have to create supplier, product group, brand and product details. By this window, we can avoid all these steps.
37Godown CreationThis is to used  create a new godown
38Godown Stock ReportThis is to view product stock in a certain godown
39Group wise Sales ReportThis is to view the group wise sales of a product for some period
40Inventory wise Sales ReportThis is to view product wise sales of certain period
41Invoice Header and FooterThis is to set the header and footer of Invoice printing page
42Inventory Print DesigningThis is to design the print of ivoices
43Invoice SettingsThis is to set the properties of invoice
44Journal EntryBy this window, we are recording journal entries
45Journal Entry ReportTo view journal entry transactions
46Ledger ReportThis is to know transactions made in a certain period of an account
47Lock ApplicationThis to lock the application. After locking, we can’t enter any data as before unlocking by giving the password of the logged user.
48Login ApplicationThis is the login window
49Main FormMain navigation window. As from this page, we are open widows as we want. This is mdi parent.
50My Message BoxThis is to show custom messages
51Opening BalanceThis is used to enter or to change opening balance entry
52Outstanding ReportThis is  to view debtor and creditor balance of customers and of suppliers.
53Party ListThis is to view detailed report of customers and suppliers.
54Cash Payment ReportReport to view cash payment details for a certain period
55Bank Payment ReportReport to view bank payment details for a certain period
56Cash Receipt ReportReport to view cash receipt details of a  certain period
57Bank Receipt ReportReport to view bank receipt details of a  certain period
58Pending Order ReportTo view the report about pending orders to sale or to purchase
59Post Dated Cheque ReceiptTo record the receipt of post dated cheques from customers
60Post Date Cheque PaymentTo record the payment of post dated cheques to suppliers
61Price CategoryThis is to record the price category. 
62Price Comparison ReportThis is to view price comparison report of products sold in certain period
63Price ListThis is to view the price of products in different categories
64Product CreationBy this window we are entering new products and editing existing products and deleting a product
65Product Group CreationTo create, edit and delete groups of product group
66Product CombinationBy this window we can create a new combination with two or more products.
67Product DetailsTo know details about product. 
68Product EditingThis is to edit group, brand, price category and tax category of certain product
69Product Flow ReportThis to know number of purchases, sales, sales return, purchase return and current stock
70Product Transaction ReportTo know the transaction of products as numbers we purchased from different parties and numbers sold to customers
71Product TracingTo know stock fluctuations of products
72Profit And Loss AccountTo know profit and lose reports of the firm
73Profit ReportTo know the profit from sales of product
74Purchase InvoiceThe purchase invoice window
75Purchase ReportThis is to view the detailed report about purchase for certain period
76Purchase ReturnThe purchase return invoice window
77Purchase Return ReportThis is to view the detailed report about purchase return for certain period
78ReminderThis is to set reminder
79Report BugsTo report bugs found about the application to the developer
80Reset DatabaseTo reset records we enter in the database of the application
81RouteTo create a new route of sales and to edit and delete existing routes
82Salary ProcessTo calculate salary of employees
83Sales And Sales Return ReportTo know the sales and sales return for certain period
84Sales EstimateThis is the page to enter Sales Estimate Entry as without tax sales
85Sales Estimate ReportTo view the sales we made without showing tax.
86Sales InvoiceThe Sales Invoice window
87Salesman Wise ReportTo view salesman-wise sales for certain period.
88Sales OrderTo record orders for new sales
89Sales Order ReportTo view report about orders for sales and purchase
90Sales ReturnThe sales return window. By this we can enter new sales return entry.
91Sales Return ReportTo know about details about products that have been returned from customers for some period.
92Sales Summary ReportThis is the summary
93Sales ViewTo view cash sales or credit sales of certain date.
94Selected Financial YearTo select a financial year
95Send MailTo send  mail to customers from the application
96ShelfTo create new self and delete and edit existing self
97Show ProductTo show the product details sold to customers, such as price variation.
98Splash ScreenThe splash screen window
99Staff AttendanceThe window to record the attendance of staff
100Stock AdjusterTo reconcile the product stock
101Stock ReportTo view stock of the firm for certain dates.
102Stock TransferTo transfer products from a certain godown to another.
103Stock Transfer ReportTo view reports about stock transfers.
104Tax CategoryTo create a new tax category
105Tax Sales ReportTo get the tax sales report to submit in front of the concerned person.
106Tax Purchase ReportTo get the tax purchase report to submit in front of the concerned tax person.
107Transaction Without InventoryWe use this window to record all transactions without inventory.
108UnitTo create a new unit of products and to delete and edit existing units
109Unsold Product ReportTo view the report of the products not sold for a certain period.
110User ManagementThe window to manage users and their privileges.
111User PrivilegeTo create new privileges
112VehicleCreate new vehicle and delete and edit existing vehicle
113Video TutorialTo play a tutorial about the application.

Storing data in Properties.Settings.Default

Storing single data in Properties.Settings.Default is a very good idea as we can store data permanently and we can call with a simple code like a variable, we can open the Properties window as below.

Project -> Application Properties.

 

First, give an appropriate name and variable type (like string, intiger and bool). Then, you can give the initial value.

 

In our accounting project, we want to create some property item. In the table given below, I have mentioned the name of items with variable type and usage of items.

List of Properties.Settings.Default variables we used in this project

SLVariableTypeUse
1boolActBoolTo know whether athe trial edition is activated or not
2strDateStringActivated date
3AppExitBoolWhether the app closed normally or logged off. If logged off, you have to log in.
4strSQLConStringDatabase
5strCompanyStringThe name of the Firm
6intSpalshIntTo decide the visibility of the splash screen
7intLogOffIntNumber of the login attempts
8intProductCodeIntTo set activation code
9strServerStringServer of Database
10opColorSystem.Drawing.ColorTo store the selected color of the application
11appDateDateTo store application Date
12blShortKeyBoolShortkey panel visible or not
13strSignStringPath of signature
14strDBScriptStringDatabase script to create new company database
15strBaseDBScriptStringThe script to create a base database
16isServerStringTo know if  the system is server or node
17isTrialBoolTo know if this is a trial or not
18strActCodeStringTo store activation code for product registration
19isActivatedBoolTo know whether activated or not
20AppExpairyDateDateApplication Expiry Date
21strBackupFileStringThe path of the backup file. As in this path, the application stores back files during auto backup
22strSecondDBStringSecond database path
23strBackImageNameStringPath of the background image
24intLogOnIdIntThe user id of logged user.

Conclusion

Thank you for reading my article. If you find any mistake or have any suggestions, please feel free to share the same in the comment box.


Similar Articles