cloth shop management documentation)
TRANSCRIPT
1
CLOTHSHOP MANAGEMENT SYSTEM
Acknowledgement
The project of Momento Ethnic Studio – a women’s wear shop has been a unique
experience for me. New ventures of enhancing the knowledge in areas where I had
theoretical information.
My sincere regards and gratitude to the head of the Department Prof. Mr.Manoj
Singh having given me support throughout the course and then made me capable of being
worthy of recognition.
I am thankful to my project guide and my professors Mrs.Maya Murlidhar and
Mr. Mihir Kale to whom I owe this piece of knowledge for their valuable guidence,
co-operation and encouragement and time spent for this project work.
I am thankful to the Computer Science Department for providing the facilities ,
guidance , co-operation and encouragement throughout the project.
I would also like to thank my family members and friends who really helped me and
co-ordinated with me to complete this project. I express my deepest gratitude for their co-
operation and efforts for making this project a success.
- Shiny Preman
2
I. PRELIMINARY INVESTIGATION
(i) Organizational overview
Name of the Organization : Momento Address : Shop no 4, Rohini Bldg,
R.R.T.Rd Mulund(w), Mumbai, Maharashtra 400080.
Email-Id : momentoindia @ gmail.com Contact Number : 09821076210 , 91-22-25648490 Year of Establishment : 1988
Previously Known as Momento Gift Galore was opened in1988, and was a Landmark in Mulund & Central Suburbs, Now refreshed opened for Salwar Khameez Shop on 21-5-06. Owned by Mr Rakesh P.Shah.It is renowened for women’s wear which could be catagorised as Salwar Kameez, Designer Sarees, Western Wears, Night Wears, Indian Ethnic Wears.
Working hours : 10:30 am to 9:30 pm.2 to 3 workers are allocated to each individual garment department.One worker maintain the accounts for the organization
Motto of the Organization : ‘Change The Style of Womenhood’ Their Manufacturers are :a) In Maharashtra :
i) MRJ InternationalManufacturer and exporters for ladies readymade garments like Salwar Kameez, Designer Sarees, Western Wears, Night Wears. Address: 30/252 unnat nagar second goregaon (w), Mumbai
ii) Sakhi Creations Manufacturer and exporters for fabric materials Address: C-122 , Vishnu baug, 137, sv road, Andheri (w).
b) Outside Maharashtra :i) Samaya fashions :
Ladies like Salwar Kameez, Designer Kurtis , Western Outfits Address: A-94, Defence Colony, Delhi . ii) Touchin fashion : Manufacturer and Exporters of all kinds of garments.
Address: X3509,Ghandhi Nagar , Delhi.iii) Alliance overseas :Manufacturer and Exporters of night wears .Address :s.c.o 79 phase -2, lalu nagar, surat.
Mode of payement : Cash ,Cheques ,Credit Cards
3
(ii) Description of the system
This system is for the automation of the cloth shop centre.It maintains two levels of user :
- Administrator Level- User Level
The software includes : Maintaining Garment Details. Maintaining Customer Details. Maintaining Supplier Details. Billing and Report Generation.
(iii) Limitations of present system
1) Lack of immediate retrievals : the information is very difficult to retrieve and to find a particular information. Eg: To find out garment history user has to go through various registers. This results in inconvenience and wasteage of time.
2) Lack of immediate information storage : The information generated by various transction takes time and effort to be stored at right place.
3) Lack of prompt updation : Various changes to the information like cost of garments and other information is difficult to make as paperwork is involved.
4) Error prone manual calculation : Manual calculations are error prone and take a lot of time. This may result in incorrect information.
5) Preparation of accurate and prompt reports :This becomes a difficult job to collect information from various registers.
4
(iv) Proposed system and its advantages
Project is related to cloth shop system. The project maintains two levels of user :
- Administrator Level- User Level
Main facilities available in this project are: Maintaining records of different garments of women like Salwar Kameez, Designer Sarees,
Western Wears, Night Wears, Indian Ethnic Wears. Providing billing details . Maintaining backups of data as per user requirements. If the user fogets the password then it can be retrieved by hint question. Administrator can offer the discounts on garments as per season. Eg: Diwali Offer, Monsoon
Damaka ,etc.These offer should be implemented by user and provide appropriate bill for the customer after their purchase.
Advantages :
Planned approach towads working : the working in the organization will be planned well and organized. The data will stored properly in the database which will help in retrieval of information as well as storage.
Accuracy : The level of accuracy in the proposed system will be higher. All operation would be correctly done and it ensures that whatever information is coming from the centre is correct.
Immediate retrieval of information : The data retrieval is just a click away rather than goin through lot of registers the whole day. Italso saves a lot of time.
Immediate storage of information : Data is easy to store and can be saved with no difficulty. Easy to handle : The system is not physically bulky so it is easy to handle and use.
5
(v)Feasibility study :
Feasibility study is the test of system proposal according to its workability, impact of organization, ability to meet needs and effective use of resource.
o Technical feasibility : Determine whether the technology needed for the proposed system is available or not.
o Economical feasibility : Economic justification include a broad range of concerns that include cost benefits associated with candidate system.
o Operational feasibility : Mainly related to human organization and political aspects.o Schedule feasibility : Time evalution is the most important consideration in development
process.
Requirements :
Software Requirements :Operating system : win-98 ; win-xp or any other higher version.Database (back-end) : MS SQL serverFront-end : VB .Net
Hardware requirements :Processor : Pentium II, III, IV or higher.RAM : 64 Mb or higher.Disc : 130 Mb.
(vi) Identifying Stakeholders
Person group or organization that has direct or indirect stake in an organization because it can affect or be affected by the organizations actions, objectives and policies.Key stakeholders in a business organization include creditors, customers, employees, owners, suppliers and the community from which the business draws its resources.Although stakeholders are usually self-legitimizing (those who judge themselves as stakeholders),all stakeholders are not equal and different stakeholders are entitled to different considerations.In my organization key stakeholders are employees, user, admin, customers, manufacturer and exporters.
6
(vii) GRANTT CHART
TIME PERIOD IN WEEKS
TASK
AUG
1 2
AUG
3 4
SEP
1 2
SEP
3 4
OCT
1 2
NOV
1 2
DEC
1 2
JAN
1 2Preliminary InvestigationDefining ProblemsConfirming Project FeasibilitySystem Analysis
Gather InformationDefine System RequirementsSystem Design
Design System Interface
Procedural (Algorithmic) designingSystem Coding
Construct the software componentsTesting PhaseVerify and test componentsProgram Documentation
Planned Time
Actual Time
7
II. SYSTEM ANALYSIS
(i) Fact Finding Techniques (Questionnaires)
a) General Questionsi. What is the name of your organization ?
ii. Who is the administrator of your organization ?iii. What kind of system you require for your organization ?iv. Is the system single user or multiuser ?v. What are the limitations of the current system ?
vi. What is the budget of your system ?vii. Can you increase the budget as per the requirements ?
viii. Are you able to keep all details related to your organization with help of current system ?
ix. Is your system computerized or you maintain all records in registers ?x. Do the system satisfy your requirements ?
xi. What is the motto you have decided for your organization ?xii. Do your organization have any website for advertisement ?
b) Specific Questions
i. What are the stakeholders for your organization ?ii. What are the contribution of each stakeholder for your organization ?iii. Have you maintained any kind of database for your organization?iv. Have you maintained employee details ? If yes then what kind of information do
you maintain related to the same ?v. Have you maintained supplier details ? If yes then what kind of information do
you maintain related to the same ?vi. Is your data secure in current system ?vii. Is your system time consuming ?viii. Is your system monthly updated ?ix. Is the stock being taken weekly, monthly or yearly ?x. Is your system easy to handle ?xi. Do you expect that the proposed system will also maintain customer details ?xii. When you want the project to be completed ?
8
(ii) Event Table
Event Trigger Source Activity Response Destination
1. Adding customer details
Request for adding
CustomerRecording customer details in database
Customer details added successfully
Admin
2. Adding Employee details
Request for adding
Employee
Recording Employee details in database
Employee details added successfully
Admin
3. Adding Supplier details
Request for adding
SupplierRecording Supplier details in database
Supplier details added successfully
Admin
4. Generate bill for garments
Request for bill generation
Supplier Generate billBill generated successfully
Admin
5. Generate bill for garments
Request for bill generation
Employee Generate billBill generated successfully
Customer
6. Update customer details
Request for Updation
CustomerUpdation of customer details
Customer details updated successfully
Admin
7. Update Employee details
Request for Updation
EmployeeUpdation of Employee details
Employee details updated successfully
Admin
8. Update Supplier details
Request for Updation
SupplierUpdation of Supplier details
Supplier details updated successfully
Admin
9. Adding garments details
Request for adding
Recording garments details
Garments details added successfully
Admin
10. Delete customer details
Request for deletion
AdminDeletion of Supplier details
Customer details deleted successfully
Admin
11. Delete Supplier details
Request for deletion
AdminDeletion of Supplier details
Supplier details deleted successfully
Admin
12. Delete Employee details
Request for deletion
AdminDeletion of Employee details
Employee details deleted successfully
Admin
13. Searching Employee details
Request for search
AdminSearch Employee details
Search completed successfully
Admin
14. Searching Supplier details
Request for search
AdminSearch Supplier details
Search completed
Admin
9
successfully15. Searching Customer details
Request for search
AdminSearch Customer details
Search completed successfully
Admin
16. Searching Garments details
Request for search
AdminSearch Garments details
Search completed successfully
Admin
10
(iii) Use Case Diagram , Scenarios And Use Case Description
i. Employee Give information about garments. Generate bill and give it to the customer.
ii. Customer Enquire about garments. Purchase the garments. Request for the bill. Pay the bill.
iii. Supplier Give details about the garments. Accept the order. Offer discounts on purchase. Generate bill and give it.
iv. Admin Maintaing employee details. Maintaing Garments details. Give order to the supplier. Request for the bill. Pay the bill. Offer discounts on purchase. Purchase the garments.
11
Employee
Customer
Supplier
Admin
Give information about garments
Generate bill and give it to the customer
Equire about garments
Purchase the garments
Request for the bill
Payment of Bill
Give details about garments
Accept the order
Offer discounts on purchase
Generate bill and give it
Maintain garment details
Give order to supplier
Maintain employee details
Request for bill
Pay the bill
Offer discounts on purchase
Purchase the garments
12
Cloth Shop Management System
13
(iv) ERD
14
(v)Activity Diagram
15
(vi) Class Diagram
1 1 *
1 1
* * *
1,*
* *
*
*
*
Customer
-Id : C001-Name : Ramya-Address : Thane-Contct No :233345- payment : cash
+bill()
Garments
-GId: G008-Type : Western-Quantity : 5-Price :4000-Company : Sakhi Creations
+add()+delete()
Order
-OrderNo :101-Details :Exports of -Fabric Material-Quantity : 5
+order()
Bill
-BillNo : 0812-Quantity : 5-BillAmount : 1590-Tax : 550
+reports()+calculation()
Local User
-UserName: -SohamPassword : soham
+login()
Suppliers
-SId: S001-SName : Sakhi Creations-Address : Andheri(w)Ph. No: 27987989-Garments type : Fabric material.+supply()
Purchase Details
-PId: P001-Price: 1500-Quantity: 5-Payment mode : -Cash
+add()+delete()+update()
Admin
-User_name: Amit-Password : amitp
+login()
Employee
-Emp_id :E001-Emp_name :Ram-Address :Kalwa-Age: 32-Date of joining : -1/3/2005-Salary :5800
+add()+delete()+update()
16
(vii) Object Diagram
1 1 *
*
1,*
*
* *
*
Customer
Id : C001Name : RamyaAddress : ThaneContct No :233345Mode of payment : cash
Garments
GId: G008Type : WesternQuantity : 5Price :4000Company : Sakhi Creations
Order
OrderNo :101Details :Exports of Fabric MaterialQuantity : 5
Bill
BillNo : 0812Quantity : 5BillAmount : 1590Tax : 550
Local User
UserName: SohamPassword : soham
Suppliers
SId: S001SName : Sakhi CreationsAddress : Andheri(w)Ph. No: 27987989Garments type : Fabric material.
Purchase Details
PId: P001Price: 1500Quantity: 5Payment mode : Cash
Admin
User_name: AmitPassword : amitp
Employee
Emp_id :E001Emp_name :RamAddress :KalwaAge: 32Date of joining : 1/3/2005Salary :5800
17
(viii) Sequence Diagram / Collaboration Diagram
Login :
Check availability of stock :
18
Bill generation :
Maintaining Details
19
(ix) State Diagram
name paymentProduct selection
billSelected product
adminuser
name Shows product to customer
Product info Salary
adminemployee
name Products Product list
Payment Order
admin Supplier
20
III. SYSTEM DESIGN
(i) Component Diagram
System
21
(ii) Package Diagram
Cloth Shop management
Admin Supplier
CustomerEmployee
BillProducts
Name
Password
Supplier id Supplier name
Supplier contactno
Supplier address
customer id customer name
customer contactno
customer address
Emp id Emp name
Emp contactno
Emp address
Bill no Cust id
Prod rateProd desc
prod id Prod type
Prod rateProd desc
22
(iii) Deployment Diagram
User
Products
Staff
Supplier
System
23
(iv) Prg Flow charts & System flow chart
Bill Report
Employee details analysis program
Supplier details analysis program
Customer details analysis program
Maintain Employee Details Program
Order details analysis program
Maintain Supplier Details Program
Maintain Customer Details Program
Maintain Order Details Program
Employee
Order
Supplier
Customer
Bill details analysis program
Maintain Bill Details Program
Bill
Management
24
IV. SYSTEM CODING
(i) Menu Tree/Site Map
Project Menu Tree
File
Employee Information Form
Customer Information Form
Supplier Information Form
Product Information Form
View
Employee Table
Customer Table
Supplier Table
Product Table
Bill Generations
Customer Bill
Help
About Us
Exit
25
(ii) List of tables with attributes and constraints
The project uses five tables to store the details of customer, product, employee ,supplier and bill. All the tables are stored under a single database with different table names. These tables are used to retrieve the data from and also to update data whenever required during the system modification. The following are names of tables used within our system.
List of tables is as follows:
1) CustomerInfo
2) EmployeeInfo
3) SupplierInfo
4) ProductInfo
5) Bill
The details of each table are as follows:
1. Employee Table
Field nameDatatyp
eField size
Desc
emp_id Number 10Maximum 10 digits can be stored
emp_fname Text 25Maximum 25 letters can be stored
emp_lname Text 25Maximum 25 letters can be stored
emp_gender Text 25Maximum 25 letters can be stored
emp_dob Text 25Maximum 25 letters can be stored
emp_address Text 25Maximum 25 letters can be stored
emp_contact Number 10Maximum 10 digits can be stored
emp_email Text 25Maximum 25 letters can be stored
emp_joining Text 25Maximum 25 letters can be stored
emp_dept Text 25Maximum 25 letters can be stored
emp_salary Number 10Maximum 10 digits can be stored
26
2. Customer Table
Field nameDatatyp
e
Field
sizeDesc
cust_id Number 10Maximum 10 digits can be stored
cust_fname Text 25Maximum 25 letters can be stored
cust_lname Text 25Maximum 25 letters can be stored
cust_gender Text 6Maximum 6 letters can be stored
cust_address Text 25Maximum 25 letters can be stored
cust_contact Number 10Maximum 10 digits can be stored
cust_email Text 25Maximum 25 letters can be stored
3. Supplier Table
Field nameDatatyp
e
Field
sizeDesc
sup_id Number 10Maximum 10 digits can be stored
sup _fname Text 25Maximum 25 letters can be stored
sup _lname Text 25Maximum 25 letters can be stored
sup _gender Text 6Maximum 6 letters can be stored
sup _address Text 25Maximum 25 letters can be stored
sup_pincode Number 8Maximum 8digits can be stored
sup_company Text 25Maximum 25 letters can be stored
sup_contact Number 10Maximum 10 digits can be stored
sup_email Text 25Maximum 25 letters can be stored
27
4. Products Table
Field name DatatypeField
sizeDesc
prod_id Number 10Maximum 10 digits can be stored
prod_size Text 5Maximum 5 letters can be stored
prod_quantity Number 2Maximum 2 digits can be stored
prod_rate Number 6Maximum 6 digits can be stored
prod_avail Text 25Maximum 25 letters can be stored
prod_type Text 8Maximum 8 letters can be stored
prod_description
Text 25Maximum 25 letters can be stored
prod_brand Text 10Maximum 10 letters can be stored
prod_shades Text 25Maximum 25 letters can be stored
5. Bill Table
Field nameDatatyp
e
Field
sizeDesc
bill_no Number 10Maximum 10 digits can be stored
bill_date Text 5Maximum 5 letters can be stored
cname Text 2Maximum 2 letters can be stored
ccontact Text 6Maximum 6 letters can be stored
cemail Text 25Maximum 25 letters can be stored
desc1 Number 10Maximum 10 digits can be stored
desc2 Number 10Maximum 10 digits can be stored
desc2 Number 10Maximum 10 digits can be stored
28
price1 Number 5Maximum 5 digits can be stored
price2 Number 5Maximum 5 digits can be stored
price2 Number 5Maximum 5 digits can be stored
qty1 Number 2Maximum 2 digits can be stored
qty2 Number 2Maximum 2 digits can be stored
qty2 Number 2Maximum 2 digits can be stored
tot_items Number 2Maximum 2 digits can be stored
tot_amt Number 6Maximum 6 digits can be stored
discount Number 2Maximum 2 digits can be stored
pay_mode Text 10Maximum 10 letters can be stored
net_amt Number 6Maximum 6 digits can be stored
29
(iii) Program Descr[ Programs /Classes and their responsibilities in brief ] with Naming Conventions
Some naming conventions are used to make it easy to remember the names of the components used in the system. These naming conventions are very useful to maintain the consistency of the names, which is helpful to the programmer.
The naming conventions mainly used in the system are as follows:
Form Names: The different forms used in the system are named as per the contents in them and their use in the system.
Syntax followed: <FormName>.vb Eg: CustomerInformation.vb, EmployeeInformation.vb, SupplierInformation.vb
Label Names: Since the labels are just to display text information and it does not involve much of coding, they are simply named number-wise.
Syntax followed: Label<Number> Eg.: Label1,Label12.
TextBox Names: Text boxes are sometimes used for coding purposes and hence are named according to the content they are going to held.
Syntax followed: txt<TextBoxName> Eg.: txtName,txtEmail,txtContact.
Button Names: Buttons are the most active and interactive type of components. Most of the events are triggered by clicking onto the button. Hence, they are named according to the purpose they serve. Syntax followed: btn<Button Name> Eg.: btnSave, btnUpdate,btnClear,btnLogin.
30
(iv) Validations
Validations are needed to make the application error free and help to decrease the typing errors. Validations included in this application helps the users to enter accurate data. Users enter data, validations makes sure that the data entered is more accurate that can avoid errors ahead.Validations basically consists of comparing one thing to another. Various data that can be validated are characters, numbers, date, email that is entered by the user.
The following are the validations implemented this system:
Character Validation: This is achieved by not allowing user to enter numbers or even blank spaces. It also makes sure that no special characters such as !, &, % etc.
Number Validation: Number validation includes allowance of only number and no characters, blank spaces or special characters. It also provides range for entering age text fields and sometimes maximum value that it can hold. Amount should not be exceeding then what the bill amount is. Such things are taken into consideration.
Date Validation: The DateTimePicker component of vb.net allows the users to select the date at the runtime. Its format should also match to the backend that is Microsoft Access’ date Data type. The date selected by the user should be current date or any date after the current date. Validation ensures this.
Email Validation: The email text field is ensured that it contains atleast one “.” and only one “@” symbols. Also “.” and “@” should not be together. This is done by using the keypress event of the text field component.
31
(v)Test Cases, Test Data and Test Results [Write test cases for all imp. programs]
Testing:
Software testing has a dual function; it is used to establish the presence of defects in program and it is used to help judge whether or not the program is usable in practice. The software testing is used for validation and verification, which ensures that software, conforms to its specification and meets the need of the customer. Software is a critical element of software quality assurance and represents the ultimate review of specification, designs and code generation. Once the source code has been generated, software must be tested to uncover as many errors as possible before delivery to the customer.
Testing Methods
Unit testing: Unit testing focuses verification effort on the smallest unit of software design the software component or module. In this type of testing the individual modules are tested and verify whether the accurate output is available or not. It can be done in two ways bottom-up or top- down. In bottom-up approach the last module is tested first and then moving upwards towards the first module. Top-down integration testing is an incremental approach to construction of program structure. Modules are integrated by moving down ward through the control hierarchy, beginning with the main control module.
Integration Testing: When the unit testing is over, all the modules are integrated and tested as a whole. It might be possible that all modules may work individually, but they may not work when we put them together. Data can be lost across the interface, one module can have adverse affect on other or sub functions of another, when combined may not produce desired major function, individually acceptable imprecision may be magnified to unacceptable level; global data structure can present problem. So any system has to be tested this way so that the final output is the desired one.
Validation Testing: After the integration testing software is completely assembled as a package, interfacing error have been uncovered and corrected, and then validation testing may begin. Validation can be defined in many ways but a simple definition is what a validation succeeds when software functions in a manner that can be reasonably accepted by the company.
System testing: Any software is only one element of a larger computer based system. Ultimately software is incorporated with other system elements like hardware, people, information and a series of system integration and validation tests are conducted. System testing is actually a series of different test whose primary purpose is to fully exercise the computer based system. Although each test has a different purpose, all work to verify that system elements have been properly integrated and perform allocated functions.
Storage Testing: The database of the system has to be stored on the database server. So the storage capacity of the database server should be enough to store all the data required for the efficient running of the system.
32
Software Testing Fundamentals
Testing present an interesting anomaly for Software engineer In software engineering activities, the engineer attempts to build software from abstract
concept to tangible product In case of testing the tester creates a series of test case that are intended to demolish the
software that has been built . Considering all above aspect testing can be termed as destructive step rather than
constructive
Testing Objective :
The three basic testing objective can be specified as follows1) Testing is process of executing a program with an intend of finding error2) A good test case is one which has high probability of finding an as yet undiscovered error.3) A successful test case is one that uncovers an as-yet-undiscovered error.
Software Testing principle
All test should be traceable to customer requirements: it follows that the most severe defects are those that cause the program to fail to meet it requirements
Test should be planned long before testing begins Test planning should start as soon as design model has been created Testing should begin in “small” and progress toward testing in the “large” The first test planned and executed generally focus on individual components. As testing
progress focus is shifted to integrated cluster Exhaustive testing is not possible To be most effective testing should be done by an independent third party.
Test Case Design
A rich variety of test case design method has evolved for software. These method provide the developer with systematic approach to testing
Any engineered product can be tested in two ways1) Knowing the specified function that a product has been designed to perform, test can be conducted that demonstrate each function is fully operational while at same time searching for error in each function 2) Knowing internal workings of the product test can be conducted to ensure that internal operation are performed accurately according to specification and all internal components have been adequately exercised
The first approach is termed as “Black-Box testing”
33
The second approach is termed as “ White-Box testing”
White Box Testing It is sometime termed as glass box testing, is a test case design method that uses the control
structure of procedural design to derive test cases Using this approach the software engineer can derive test case that
1) Guarantee that all independent path within a module have been exercised at least once2) Exercise all logical decision on their true and false sides3) Execute all loops at their boundaries and within operational bound 4) Exercise internal data structure to ensure their validityFollowing methods are available in white box (B G D C L)
1. Basis path testing2. Graph matrices 3. Condition testing4. Data flow testing 5. Loop testing
Black Box Testing Black box testing is also termed as behavioral testing focuses on functional requirement of
software It enables software engineer to derive set of inputs condition that will fully exercise all
functional requirement for a program It attempts to find error in following categories
1) Incorrect or missing function2) Interface error3) Error in Data structure or external Database access4) Initialization and Termination errorTest are designed to answer following question
How is functional validity tested? How is system behavior and performance tested? What class of input will make good test case? Is the system sensitive to particular data? What data rate and volume system can tolerate? How are boundaries of data class isolated? The first step in black box testing is to understand the objects that are modeled in software
and relationship that connect these objects Once this has been accomplished the next step is to define a series of test that verifies “all
objects have the expected relationship one another” Software testing begins by creating a graph of important objects and their relationship and
then devising a series of tests that will cover the graph so that each object and relationship is exercised and errors are uncovered
34
A graph is designed which is collection of nodes that represent object Link that represent the relationship between objects node weight describe the properties of
node and link weight describe some characteristic of link Following example depicts same aspect
(vi) Screen Layouts & Report Layouts
35
1. Form
2. Splash screen(version)
36
3. Main Form
37
4. Login Form
38
5. Employee form
39
6. Supplier form
40
7. Product form
41
8. Customer form
42
9. Employee Details
43
10. Customer Details
44
11. Supplier Details
45
12. Product Details
46
13. Bill form
47
48
14. Splash screen (About)
V. System Implementation / Uploading
(i) List of forms
49
Form Name
SplashScreen SplashScreen1
SplashScreen About
Home Form1
Main Main
Login LoginForm1
EmployeeInformation EmployeeInfo
CustomerInformation CustomerInfo
SupplierInformation SupplierInfo
ProductInformation ProductInfo
EmployeeDetails EmployeeDetails
CustomerDetails CustomerDetails
SupplierDetails SupplierDetails
ProductDetails ProductDetails
Module Module1
CrystalReportViewer Form2
Bill BillGeneration
(ii) Source Code
1. Module
50
Imports System.Data.OleDb
Module Module1
Public con As OleDbConnection Public daNavigation As OleDbDataAdapter Public dr As OleDbDataReader Public cmd As New OleDbCommand Public dsNavigation As New DataSet Public pos As Integer Public Sub EstablishConnection() Try
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\ClothManagement System\ClothManagementSystem.accdb")
con.Open() If con.State = ConnectionState.Closed Then MsgBox("Connection Failed !", MsgBoxStyle.Information) End If Catch ex As Exception MsgBox("Error :" & ex.Message) End Try End Sub
End Module
2. Form1
Public Class Form1
51
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click Dim l As New LoginForm1 l.Show()
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click Dim sc As New SplashScreen1 sc.Show()
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized End SubEnd Class
3. loginForm1
Public Class LoginForm1 Dim Attempts As Integer = 1
52
Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click Dim name As String Dim pass As String Dim name1 As String Dim pass1 As String name = "local" pass = "local" name1 = "admin" pass1 = "admin" If UsernameTextBox.Text = "" Then MsgBox("Please Enter username.", MsgBoxStyle.Information) UsernameTextBox.Select() Exit Sub End If If PasswordTextBox.Text = "" Then MsgBox("Please Enter Password .", MsgBoxStyle.Information) PasswordTextBox.Select() Exit Sub End If
If UsernameTextBox.Text = name And PasswordTextBox.Text = pass Then MessageBox.Show("Welcome") Dim mdi As New Main mdi.Show() ElseIf UsernameTextBox.Text = name1 And PasswordTextBox.Text = pass1 Then MessageBox.Show("Welcome") Dim mdi As New Main mdi.Show() Else MessageBox.Show("Invalid login ........Plz try Again !") UsernameTextBox.Clear() PasswordTextBox.Clear() UsernameTextBox.Select() Attempts += 1 If Attempts > 3 Then MessageBox.Show("Closing Apllication ........") End End If End If Dim mdi As New Main mdi.Show() Me.Close() End Sub Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancel.Click
53
Me.Close() End Sub
End Class
4. Main
Public Class Main
54
Private Sub FILEToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FILEToolStripMenuItem.Click End Sub
Private Sub EmployeeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmployeeToolStripMenuItem.Click Dim ei As New EmployeeInfo ei.MdiParent = Me ei.Show() End Sub
Private Sub SupplierToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SupplierToolStripMenuItem1.Click Dim si As New SupplierInformation si.MdiParent = Me si.Show() End Sub
Private Sub ProductToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductToolStripMenuItem.Click Dim pi As New ProductInformation pi.MdiParent = Me pi.Show() End Sub
Private Sub CustomerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerToolStripMenuItem.Click Dim ci As New CustomerInformation ci.MdiParent = Me ci.Show() End Sub Private Sub CustomerBillToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerBillToolStripMenuItem.Click ' Dim cb As New CustomersBill Dim cb As New BillGeneration cb.MdiParent = Me cb.Show() End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click Dim a As New About a.MdiParent = Me a.Show() End Sub
55
Private Sub BillToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BillToolStripMenuItem1.Click Me.Close() Dim form As New Form1 form.Show() End Sub
Private Sub AllDetailsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AllDetailsToolStripMenuItem.Click If AllDetailsToolStripMenuItem.Pressed = True Then ToolStrip1.Visible = True FileToolStripMenuItem1.Enabled = False BillToolStripMenuItem.Enabled = False HelpToolStripMenuItem.Enabled = False Else FileToolStripMenuItem1.Enabled = True BillToolStripMenuItem.Enabled = True HelpToolStripMenuItem.Enabled = True ToolStrip1.Visible = False End If End Sub
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Dim cd As New CustomerDetails cd.MdiParent = Me cd.Show() End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click Dim ed As New EmployeeDetails ed.MdiParent = Me ed.Show() End Sub
Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click Dim sd As New SupplierDetails
56
sd.MdiParent = Me sd.Show() End Sub
Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click Dim pd As New ProductDetails pd.MdiParent = Me pd.Show() End Sub
Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click Dim main As New Main main.Show()
End SubEnd Class
5. CustomerInformation
Imports System.Data.OleDbPublic Class CustomerInformation
57
Private Sub Numbers(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 48 To 57, 8 Case Else e.Handled = True End Select End Sub
Private Sub Alphabets(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 65 To 90, 97 To 122 Case Else e.Handled = True End Select End Sub Private Sub DisplayData() Dim q As String = "select * from CustomerInfo where cust_id=" & Val(MtxtCustId.Text) Dim cmd As New OleDbCommand(q, con) dr = cmd.ExecuteReader If (dr.Read) Then MtxtCustId.Text = dr.Item(0).ToString txtCustFirstName.Text = dr.Item(1).ToString txtCustLastName.Text = dr.Item(2).ToString Dim gen As String = dr.Item(3).ToString If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If RtxtCustAddress.Text = dr.Item(4).ToString txtCustContact.Text = dr.Item(5).ToString txtEmail.Text = dr.Item(6).ToString
End If End Sub Sub SetTextboxes() MtxtCustId.Text = dsNavigation.Tables(0).Rows(pos).Item(0).ToString() txtCustFirstName.Text = dsNavigation.Tables(0).Rows(pos).Item(1).ToString() txtCustLastName.Text = dsNavigation.Tables(0).Rows(pos).Item(2).ToString() 'cbogender.Text = dr.Item(3).ToString Dim gen As String = dsNavigation.Tables(0).Rows(pos).Item(3).ToString() If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If
58
RtxtCustAddress.Text = dsNavigation.Tables(0).Rows(pos).Item(4).ToString() txtCustContact.Text = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() txtEmail.Text = dsNavigation.Tables(0).Rows(pos).Item(6).ToString() End Sub Private Sub save() btnCustAdd.Enabled = True btnCustSave.Enabled = True btnCustDelete.Enabled = True btnCustUpdate.Enabled = True btnExit.Enabled = True
Dim q As String q = "Insert into CustomerInfo values(?,?,?,?,?,?,?)" Dim cmd As New OleDbCommand(q, con) cmd.Parameters.Add("?", OleDbType.Char).Value = MtxtCustId.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCustFirstName.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCustLastName.Text If rbmale.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "male" ElseIf rbfemale.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "female"
End If cmd.Parameters.Add("?", OleDbType.Char).Value = RtxtCustAddress.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCustContact.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtEmail.Text cmd.ExecuteNonQuery() MsgBox("Record saved Successfully !")
MtxtCustId.Enabled = True MtxtCustId.Text = "" txtCustLastName.Text = "" txtCustFirstName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtCustAddress.Text = "" txtCustContact.Text = "" txtEmail.Text = "" End Sub
Private Sub CustomerInformation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() MtxtCustId.Select()
59
Dim query As String = "Select * from CustomerInfo" daNavigation = New OleDbDataAdapter(query, con) daNavigation.Fill(dsNavigation) pos = 0
End Sub
Private Sub txtEmail_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmail.KeyPress Select Case Asc(e.KeyChar)
Case 64 'If @ is the first character If Len(txtEmail.Text) <= 0 Then e.Handled = True End If
'If @ already exists once If InStr(txtEmail.Text, "@") > 0 Then e.Handled = True End If
'If '.' is present before @ If txtEmail.Text.Length > 0 Then If Mid(txtEmail.Text, txtEmail.Text.Length, txtEmail.Text.Length) = "." Then e.Handled = True End If End If
Case 48 To 57, 8 Case 46
If Len(txtEmail.Text) <= 0 Then e.Handled = True End If
'If '.' is present before "." If txtEmail.Text.Length > 0 Then If Mid(txtEmail.Text, txtEmail.Text.Length, txtEmail.Text.Length) = "." Then e.Handled = True End If End If 'If '.' is present before "." If txtEmail.Text.Length > 0 Then
60
If Mid(txtEmail.Text, txtEmail.Text.Length, txtEmail.Text.Length) = "@" Then e.Handled = True End If End If
Case 65 To 90, 97 To 122 ' A-Z , a-z Case Else e.Handled = True
End Select End Sub
Private Sub txtCustFirstName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCustLastName.KeyPress Call Alphabets(e)
End Sub
Private Sub txtCustLastName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCustFirstName.KeyPress Call Alphabets(e) End Sub
Private Sub txtCustContact_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCustContact.KeyPress Call Numbers(e) End Sub
Private Sub btnCustAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustAdd.Click MtxtCustId.Enabled = False txtCustFirstName.Select() btnCustAdd.Enabled = False btnCustSave.Enabled = True btnCustDelete.Enabled = False btnCustUpdate.Enabled = False btnExit.Enabled = False
MtxtCustId.Text = "" txtCustLastName.Text = "" txtCustFirstName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtCustAddress.Text = ""
61
txtCustContact.Text = "" txtEmail.Text = ""
Dim cmd As OleDbCommand cmd = New OleDbCommand("select max(cust_id) from CustomerInfo", con) Dim n As Object n = cmd.ExecuteScalar MtxtCustId.Text = n + 1 End Sub
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click btnCustAdd.Enabled = True btnCustSave.Enabled = True btnCustDelete.Enabled = True btnCustUpdate.Enabled = True btnExit.Enabled = True
MtxtCustId.Select()
MtxtCustId.Text = "" MtxtCustId.Enabled = True End Sub
Private Sub btnCustClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustClear.Click MtxtCustId.Text = "" txtCustLastName.Text = "" txtCustFirstName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtCustAddress.Text = "" txtCustContact.Text = "" txtEmail.Text = "" End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub
Private Sub btnCustSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustSave.Click Call Save() End Sub
62
Private Sub MtxtCustId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MtxtCustId.Enter DisplayData() btnCustSave.Enabled = False btnCustClear.Enabled = False
End Sub
Private Sub MtxtCustId_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MtxtCustId.KeyDown DisplayData() btnCustSave.Enabled = False btnCustClear.Enabled = False End Sub
Private Sub btnCustDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustDelete.Click Dim str As String str = "delete * from CustomerInfo where cust_id=" & Val(MtxtCustId.Text) If MtxtCustId.Text = "" Then MsgBox("Enter Customer id !") Else MessageBox.Show("Are you sure you want to remove this Customer's details? ", "Delete Customer's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() 'error part ...datatype mismatch MsgBox("Record deleted Successfully !")
MtxtCustId.Text = "" txtCustLastName.Text = "" txtCustFirstName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtCustAddress.Text = "" txtCustContact.Text = "" txtEmail.Text = "" End If End If End Sub
Private Sub btnCustPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustPrevious.Click If pos = dsNavigation.Tables(0).Rows.Count - 1 Then
63
MsgBox("This is the last data") Else pos += 1 SetTextboxes() End If
End Sub
Private Sub btnCustUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustUpdate.Click Dim str As String str = "delete * from CustomerInfo where cust_id=" & Val(MtxtCustId.Text) If MtxtCustId.Text = "" Then MsgBox("Enter Customer id !") Else MessageBox.Show("Are you sure you want to Update this Customer's details? ", "Update Customer's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() End If cmd.ExecuteNonQuery() End If btnCustSave.Enabled = True Call save() End Sub
Private Sub btnCustFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustFirst.Click pos = 0 SetTextboxes() End Sub
Private Sub btnCustNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustNext.Click If pos = 0 Then MsgBox("This is the first data") Else pos -= 1 SetTextboxes() End If End Sub
Private Sub btnCustLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustLast.Click
64
pos = dsNavigation.Tables(0).Rows.Count - 1 SetTextboxes() End SubEnd Class
6. EmployeeInfo
Imports System.Data.OleDbImports ClothManagement_System.LoginForm1
Public Class EmployeeInfo
65
Private Sub Numbers(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 48 To 57, 8 Case Else e.Handled = True End Select End Sub
Private Sub Alphabets(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 65 To 90, 97 To 122, 8 Case Else e.Handled = True End Select End Sub Private Sub AlphaNum(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 65 To 90, 97 To 122 Case 48 To 57, 8 Case Else e.Handled = True End Select End Sub Private Sub save() btnEmpAdd.Enabled = True btnEmpSave.Enabled = False btnEmpDelete.Enabled = True btnEmpUpdate.Enabled = True btnExit.Enabled = True
Dim q As String q = "Insert into EmployeeInfo values(?,?,?,?,?,?,?,?,?,?,?)" Dim cmd As New OleDbCommand(q, con) cmd.Parameters.Add("?", OleDbType.Char).Value = MtxtEmpId.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtEmpFirstName.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtEmpLastName.Text 'cmd.Parameters.Add("?", OleDbType.Char).Value = cbogender.Text If rbmale.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "male" ElseIf rbfemale.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "female" End If cmd.Parameters.Add("?", OleDbType.Char).Value = mtDOB.Text cmd.Parameters.Add("?", OleDbType.Char).Value = RtxtEmpAddress.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtEmpContact.Text
66
cmd.Parameters.Add("?", OleDbType.Char).Value = txtEmpEmail.Text cmd.Parameters.Add("?", OleDbType.Char).Value = mtJoiningDate.Text cmd.Parameters.Add("?", OleDbType.Char).Value = cboDept.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtEmpSalary.Text cmd.ExecuteNonQuery() MsgBox("Record saved Successfully !")
MtxtEmpId.Text = "" txtEmpFirstName.Text = "" txtEmpLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False mtDOB.Text = "" RtxtEmpAddress.Text = "" txtEmpContact.Text = "" txtEmpEmail.Text = "" mtJoiningDate.Text = "" cboDept.Text = "" txtEmpSalary.Text = "" End Sub Private Sub Display() Dim q As String = "select * from EmployeeInfo where emp_id=" & Val(MtxtEmpId.Text) Dim cmd As New OleDbCommand(q, con) dr = cmd.ExecuteReader If (dr.Read) Then MtxtEmpId.Text = dr.Item(0).ToString txtEmpFirstName.Text = dr.Item(1).ToString txtEmpLastName.Text = dr.Item(2).ToString Dim gen As String = dr.Item(3).ToString If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If mtDOB.Text = dr.Item(4).ToString RtxtEmpAddress.Text = dr.Item(5).ToString txtEmpContact.Text = dr.Item(6).ToString txtEmpEmail.Text = dr.Item(7).ToString mtJoiningDate.Text = dr.Item(8).ToString cboDept.Text = dr.Item(9).ToString txtEmpSalary.Text = dr.Item(10).ToString End If End Sub Sub SetTextboxes() MtxtEmpId.Text = dsNavigation.Tables(0).Rows(pos).Item(0).ToString() txtEmpFirstName.Text = dsNavigation.Tables(0).Rows(pos).Item(1).ToString()
67
txtEmpLastName.Text = dsNavigation.Tables(0).Rows(pos).Item(2).ToString() 'cbogender.Text = dr.Item(3).ToString Dim gen As String = dsNavigation.Tables(0).Rows(pos).Item(3).ToString() If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If mtDOB.Text = dsNavigation.Tables(0).Rows(pos).Item(4).ToString() Dim nul As String = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() RtxtEmpAddress.Text = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() txtEmpContact.Text = dsNavigation.Tables(0).Rows(pos).Item(6).ToString() txtEmpEmail.Text = dsNavigation.Tables(0).Rows(pos).Item(7).ToString() mtJoiningDate.Text = dsNavigation.Tables(0).Rows(pos).Item(8).ToString() cboDept.Text = dsNavigation.Tables(0).Rows(pos).Item(9).ToString() txtEmpSalary.Text = dsNavigation.Tables(0).Rows(pos).Item(10).ToString() End Sub Private Sub EmployeeInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() MtxtEmpId.Select()
Dim query As String = "Select * from EmployeeInfo" daNavigation = New OleDbDataAdapter(query, con) daNavigation.Fill(dsNavigation) pos = 0
End Sub
Private Sub txtEmpFirstName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmpFirstName.KeyPress Call Alphabets(e) End Sub
Private Sub txtEmpLastName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmpLastName.KeyPress Call Alphabets(e) End Sub
Private Sub txtEmpContact_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmpContact.KeyPress Call Numbers(e) End Sub
68
Private Sub txtEmpEmail_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmpEmail.KeyPress Select Case Asc(e.KeyChar)
Case 64 'If @ is the first character If Len(txtEmpEmail.Text) <= 0 Then e.Handled = True End If
'If @ already exists once If InStr(txtEmpEmail.Text, "@") > 0 Then e.Handled = True End If
'If '.' is present before @ If txtEmpEmail.Text.Length > 0 Then If Mid(txtEmpEmail.Text, txtEmpEmail.Text.Length, txtEmpEmail.Text.Length) = "." Then e.Handled = True End If End If
Case 48 To 57, 8 Case 46
If Len(txtEmpEmail.Text) <= 0 Then e.Handled = True End If
'If '.' is present before "." If txtEmpEmail.Text.Length > 0 Then If Mid(txtEmpEmail.Text, txtEmpEmail.Text.Length, txtEmpEmail.Text.Length) = "." Then e.Handled = True End If End If 'If '.' is present before "." If txtEmpEmail.Text.Length > 0 Then If Mid(txtEmpEmail.Text, txtEmpEmail.Text.Length, txtEmpEmail.Text.Length) = "@" Then e.Handled = True End If End If
69
Case 65 To 90, 97 To 122 ' A-Z , a-z Case Else e.Handled = True
End Select End Sub
Private Sub txtEmpSalary_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmpSalary.KeyPress Call Numbers(e) End Sub
Private Sub btnEmpAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpAdd.Click MtxtEmpId.Enabled = False txtEmpFirstName.Select() btnEmpAdd.Enabled = False btnEmpSave.Enabled = True btnEmpDelete.Enabled = False btnEmpUpdate.Enabled = False btnExit.Enabled = False
MtxtEmpId.Text = "" txtEmpFirstName.Text = "" txtEmpLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False mtDOB.Text = "" RtxtEmpAddress.Text = "" txtEmpContact.Text = "" txtEmpEmail.Text = "" mtJoiningDate.Text = "" cboDept.Text = "" txtEmpSalary.Text = ""
Dim cmd As OleDbCommand cmd = New OleDbCommand("select max(emp_id) from EmployeeInfo", con) Dim n As Object n = cmd.ExecuteScalar MtxtEmpId.Text = n + 1
End Sub
70
Private Sub btnEmpSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpSave.Click Call save() End Sub
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click btnEmpAdd.Enabled = True btnEmpSave.Enabled = True btnEmpDelete.Enabled = True btnEmpUpdate.Enabled = True btnExit.Enabled = True MtxtEmpId.Text = "" txtEmpFirstName.Text = "" txtEmpLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False mtDOB.Text = "" RtxtEmpAddress.Text = "" txtEmpContact.Text = "" txtEmpEmail.Text = "" mtJoiningDate.Text = "" cboDept.Text = "" txtEmpSalary.Text = ""
MtxtEmpId.Enabled = True
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub
Private Sub btnEmpClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpClear.Click
MtxtEmpId.Text = "" txtEmpFirstName.Text = "" txtEmpLastName.Text = "" 'cbogender.Text = "" rbmale.Checked = False rbfemale.Checked = False mtDOB.Text = ""
71
RtxtEmpAddress.Text = "" txtEmpContact.Text = "" txtEmpEmail.Text = "" mtJoiningDate.Text = "" cboDept.Text = "" txtEmpSalary.Text = "" End Sub
Private Sub btnEmpDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpDelete.Click Dim str As String str = "delete * from EmployeeInfo where emp_id=" & Val(MtxtEmpId.Text) If MtxtEmpId.Text = "" Then MsgBox("Enter Employee id !") Else MessageBox.Show("Are you sure you want to remove this Employee's details? ", "Delete Employee's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() 'error part ...datatype mismatch MsgBox("Record deleted Successfully !")
MtxtEmpId.Text = "" txtEmpFirstName.Text = "" txtEmpLastName.Text = "" ' cbogender.Text = "" rbmale.Checked = False rbfemale.Checked = False mtDOB.Text = "" RtxtEmpAddress.Text = "" txtEmpContact.Text = "" txtEmpEmail.Text = "" mtJoiningDate.Text = "" cboDept.Text = "" txtEmpSalary.Text = "" End If End If End Sub
Private Sub MtxtEmpId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MtxtEmpId.Enter Call Display() btnEmpSave.Enabled = False btnEmpClear.Enabled = False
72
End Sub
Private Sub MtxtEmpId_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MtxtEmpId.KeyDown Call Display() btnEmpSave.Enabled = False btnEmpClear.Enabled = False End Sub
Private Sub btnEmpNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpNext.Click If pos = dsNavigation.Tables(0).Rows.Count - 1 Then MsgBox("This is the last data") Else pos += 1 SetTextboxes() End If End Sub
Private Sub btnEmpUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpUpdate.Click Dim str As String str = "delete * from EmployeeInfo where emp_id=" & Val(MtxtEmpId.Text) If MtxtEmpId.Text = "" Then MsgBox("Enter Employee id !") Else MessageBox.Show("Are you sure you want to Update this Employee's details? ", "Update Employee's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() End If cmd.ExecuteNonQuery() End If btnEmpSave.Enabled = True Call save() End Sub
Private Sub btnEmpPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpPrevious.Click If pos = 0 Then MsgBox("This is the first data") Else pos -= 1 SetTextboxes()
73
End If
End Sub
Private Sub btnEmpLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpLast.Click pos = dsNavigation.Tables(0).Rows.Count - 1 SetTextboxes()
End Sub
Private Sub btnEmpFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmpFirst.Click pos = 0 SetTextboxes()
End SubEnd Class
7. ProductInfo
Imports System.Data.OleDb
Public Class ProductInformation
74
Private Sub Numbers(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 48 To 57, 8 Case Else e.Handled = True End Select End Sub
Private Sub Alphabets(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Asc(e.KeyChar) Case 65 To 90, 97 To 122 Case Else e.Handled = True End Select End Sub Private Sub AlphaNum(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 65 To 90, 97 To 122 Case 48 To 57, 8 Case Else e.Handled = True End Select End Sub Private Sub Display() EstablishConnection() Dim q As String = "select * from ProductInfo where prod_id=" & MtxtProdId.Text.ToString Dim cmd As New OleDbCommand(q, con)
dr = cmd.ExecuteReader If (dr.Read) Then MtxtProdId.Text = dr.Item(0).ToString txtProdSize.Text = dr.Item(1).ToString txtProdQnty.Text = dr.Item(2).ToString txtProdRate.Text = dr.Item(3).ToString txtAvail.Text = dr.Item(4).ToString txtProdWtype.Text = dr.Item(5).ToString cboDescription.Text = dr.Item(6).ToString txtProdBrand.Text = dr.Item(7).ToString txtProdShades.Text = dr.Item(8).ToString End If End Sub
Sub SetTextboxes() MtxtProdId.Text = dsNavigation.Tables(0).Rows(pos).Item(0).ToString()
75
txtProdSize.Text = dsNavigation.Tables(0).Rows(pos).Item(1).ToString() txtProdQnty.Text = dsNavigation.Tables(0).Rows(pos).Item(2).ToString() txtProdRate.Text = dsNavigation.Tables(0).Rows(pos).Item(3).ToString() txtAvail.Text = dsNavigation.Tables(0).Rows(pos).Item(4).ToString() txtProdWtype.Text = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() cboDescription.Text = dsNavigation.Tables(0).Rows(pos).Item(6).ToString() txtProdBrand.Text = dsNavigation.Tables(0).Rows(pos).Item(7).ToString() txtProdShades.Text = dsNavigation.Tables(0).Rows(pos).Item(8).ToString() End Sub
Private Sub save() EstablishConnection() btnProdAdd.Enabled = True btnProdSave.Enabled = False btnProdDelete.Enabled = True btnProdUpdate.Enabled = True btnExit.Enabled = True Try Dim q As String q = "Insert into ProductInfo values(?,?,?,?,?,?,?,?,?)" Dim cmd As New OleDbCommand(q, con) cmd.Parameters.Add("?", OleDbType.Char).Value = MtxtProdId.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtProdSize.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtProdQnty.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtProdRate.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtAvail.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtProdWtype.Text cmd.Parameters.Add("?", OleDbType.Char).Value = cboDescription.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtProdBrand.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtProdShades.Text cmd.ExecuteNonQuery() MsgBox("Record saved Successfully !")
MtxtProdId.Text = "" txtProdSize.Text = "" txtProdQnty.Text = "" txtProdRate.Text = "" txtAvail.Text = "" cboDescription.Text = "" txtProdWtype.Text = "" txtProdBrand.Text = "" txtProdShades.Text = ""
Catch ex As Exception MsgBox(ex.Message) End Try
76
End Sub Private Sub ProductInformation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() MtxtProdId.Select()
Dim query As String = "Select * from ProductInfo" daNavigation = New OleDbDataAdapter(query, con) daNavigation.Fill(dsNavigation) pos = 0 End Sub
Private Sub txtProdSize_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtProdSize.KeyPress Call AlphaNum(e) End Sub
Private Sub txtProdQnty_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtProdQnty.KeyPress Call Numbers(e) End Sub
Private Sub txtProdRate_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtProdRate.KeyPress Call Numbers(e) End Sub Private Sub txtAvail_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAvail.KeyPress Call Alphabets(e) End Sub Private Sub txtProdWtype_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Call Alphabets(e) End Sub Private Sub txtDescription_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtProdWtype.KeyPress Call Alphabets(e) End Sub
Private Sub txtProdBrand_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtProdBrand.KeyPress Call Alphabets(e) End Sub
77
Private Sub txtProdShades_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtProdShades.KeyPress Call Alphabets(e) End Sub
Private Sub btnProdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdAdd.Click txtProdSize.Select() MtxtProdId.Enabled = False btnProdAdd.Enabled = False btnProdSave.Enabled = True btnProdDelete.Enabled = False btnProdUpdate.Enabled = False btnExit.Enabled = False
MtxtProdId.Text = "" txtProdSize.Text = "" txtProdQnty.Text = "" txtProdRate.Text = "" txtAvail.Text = "" cboDescription.Text = "" txtProdWtype.Text = "" txtProdBrand.Text = "" txtProdShades.Text = ""
Dim cmd As OleDbCommand cmd = New OleDbCommand("select max(prod_id) from ProductInfo", con) Dim n As Object n = cmd.ExecuteScalar MtxtProdId.Text = n + 1 End Sub
Private Sub btnProdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdSave.Click Call save()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub
78
Private Sub btnProdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdClear.Click
MtxtProdId.Text = "" txtProdSize.Text = "" txtProdQnty.Text = "" txtProdRate.Text = "" txtAvail.Text = "" cboDescription.Text = "" txtProdWtype.Text = "" txtProdBrand.Text = "" txtProdShades.Text = "" End Sub
Private Sub btnProdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdDelete.Click Dim str As String
str = "delete * from ProductInfo where prod_id=" & Val(MtxtProdId.Text.ToString) If MtxtProdId.Text = "" Then MsgBox("Enter Product id !") Else MessageBox.Show("Are you sure you want to remove this Product's details? ", "Delete Product's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() MsgBox("Record deleted Successfully !")
MtxtProdId.Text = "" txtProdSize.Text = "" txtProdQnty.Text = "" txtProdRate.Text = "" txtAvail.Text = "" cboDescription.Text = "" txtProdWtype.Text = "" txtProdBrand.Text = "" txtProdShades.Text = "" End If End If End Sub
Private Sub MtxtProdId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MtxtProdId.Enter Call Display()
79
btnProdSave.Enabled = False btnProdClear.Enabled = False End Sub
Private Sub txtProdSearchId_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Call Display() btnProdSave.Enabled = False btnProdClear.Enabled = False End Sub
Private Sub MtxtProdId_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MtxtProdId.KeyDown Call Display() btnProdSave.Enabled = False btnProdClear.Enabled = False End Sub
Private Sub btnNext_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If pos = dsNavigation.Tables(0).Rows.Count - 1 Then MsgBox("This is the last data") Else pos += 1 SetTextboxes() End If
End Sub
Private Sub btnProdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdUpdate.Click Dim str As String str = "delete * from ProductInfo where prod_id=" & Val(MtxtProdId.Text) If MtxtProdId.Text = "" Then MsgBox("Enter Product id !") Else MessageBox.Show("Are you sure you want to Update this Product's details? ", "Update Product's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() End If cmd.ExecuteNonQuery() End If btnProdSave.Enabled = True
80
Call save() End Sub
Private Sub btnProdFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdFirst.Click pos = 0 SetTextboxes() End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click If pos = 0 Then MsgBox("This is the first data") Else pos -= 1 SetTextboxes() End If End Sub
Private Sub btnProdLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdLast.Click pos = dsNavigation.Tables(0).Rows.Count - 1 SetTextboxes() End SubEnd Class
8. SupplierInfo
Imports System.Data.OleDbPublic Class SupplierInformation
Private Sub Numbers(ByVal e As System.Windows.Forms.KeyPressEventArgs)
81
Select Case Asc(e.KeyChar) Case 48 To 57, 8 Case Else e.Handled = True End Select End Sub
Private Sub Alphabets(ByVal e As System.Windows.Forms.KeyPressEventArgs) Select Case Asc(e.KeyChar) Case 65 To 90, 97 To 122, 8 Case Else e.Handled = True End Select End Sub
Private Sub Display() EstablishConnection() Dim q As String = "select * from SupplierInfo where sup_id=" & Val(MtxtSupId.Text) Dim cmd As New OleDbCommand(q, con) dr = cmd.ExecuteReader If (dr.Read) Then MtxtSupId.Text = dr.Item(0).ToString txtSupFirstName.Text = dr.Item(1).ToString txtSupLastName.Text = dr.Item(2).ToString Dim gen As String = dr.Item(3).ToString If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If RtxtSupAddress.Text = dr.Item(4).ToString txtpincode.Text = dr.Item(5).ToString txtCompany.Text = dr.Item(6).ToString txtSupContact.Text = dr.Item(7).ToString txtSupEmail.Text = dr.Item(8).ToString
End If End Sub
Sub SetTextboxes() EstablishConnection() MtxtSupId.Text = dsNavigation.Tables(0).Rows(pos).Item(0).ToString() txtSupFirstName.Text = dsNavigation.Tables(0).Rows(pos).Item(1).ToString() txtSupLastName.Text = dsNavigation.Tables(0).Rows(pos).Item(2).ToString() 'cbogender.Text = dr.Item(3).ToString Dim gen As String = dsNavigation.Tables(0).Rows(pos).Item(3).ToString()
82
If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If RtxtSupAddress.Text = dsNavigation.Tables(0).Rows(pos).Item(4).ToString() txtpincode.Text = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() txtCompany.Text = dsNavigation.Tables(0).Rows(pos).Item(6).ToString() txtSupContact.Text = dsNavigation.Tables(0).Rows(pos).Item(7).ToString() txtSupEmail.Text = dsNavigation.Tables(0).Rows(pos).Item(8).ToString() End Sub Private Sub save() EstablishConnection() btnSupAdd.Enabled = True btnSupSave.Enabled = False btnSupDelete.Enabled = True btnSupUpdate.Enabled = True btnExit.Enabled = True
Dim q As String q = "Insert into SupplierInfo values(?,?,?,?,?,?,?,?,?)" Dim cmd As New OleDbCommand(q, con) cmd.Parameters.Add("?", OleDbType.Char).Value = MtxtSupId.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtSupFirstName.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtSupLastName.Text If rbmale.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "male" ElseIf rbfemale.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "female" End If cmd.Parameters.Add("?", OleDbType.Char).Value = RtxtSupAddress.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtpincode.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCompany.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtSupContact.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtSupEmail.Text cmd.ExecuteNonQuery() MsgBox("Record saved Successfully !")
MtxtSupId.Text = "" txtSupFirstName.Text = "" txtSupLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtSupAddress.Text = "" txtpincode.Text = "" txtCompany.Text = ""
83
txtSupContact.Text = "" txtSupEmail.Text = "" End Sub
Private Sub SupplierInformation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() MtxtSupId.Select()
Dim query As String = "Select * from SupplierInfo" daNavigation = New OleDbDataAdapter(query, con) daNavigation.Fill(dsNavigation) pos = 0
End Sub
Private Sub txtSupFirstName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSupFirstName.KeyPress Call Alphabets(e) End Sub
Private Sub txtSupLastName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSupLastName.KeyPress Call Alphabets(e) End Sub
Private Sub txtCompany_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCompany.KeyPress Call Alphabets(e) End Sub
Private Sub txtpincode_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpincode.KeyPress Call Numbers(e) End Sub
Private Sub txtSupContact_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSupContact.KeyPress Call Numbers(e) End Sub
Private Sub txtSupEmail_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpincode.KeyPress Select Case Asc(e.KeyChar)
84
Case 64 'If @ is the first character If Len(txtSupEmail.Text) <= 0 Then e.Handled = True End If
'If @ already exists once If InStr(txtSupEmail.Text, "@") > 0 Then e.Handled = True End If
'If '.' is present before @ If txtSupEmail.Text.Length > 0 Then If Mid(txtSupEmail.Text, txtSupEmail.Text.Length, txtSupEmail.Text.Length) = "." Then e.Handled = True End If End If
Case 48 To 57, 8 Case 46
If Len(txtSupEmail.Text) <= 0 Then e.Handled = True End If
'If '.' is present before "." If txtSupEmail.Text.Length > 0 Then If Mid(txtSupEmail.Text, txtSupEmail.Text.Length, txtSupEmail.Text.Length) = "." Then e.Handled = True End If End If 'If '.' is present before "." If txtSupEmail.Text.Length > 0 Then If Mid(txtSupEmail.Text, txtSupEmail.Text.Length, txtSupEmail.Text.Length) = "@" Then e.Handled = True End If End If
Case 65 To 90, 97 To 122 ' A-Z , a-z Case Else e.Handled = True
85
End Select End Sub
Private Sub btnSupAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupAdd.Click MtxtSupId.Enabled = False txtSupFirstName.Select() btnSupAdd.Enabled = False btnSupSave.Enabled = True btnSupDelete.Enabled = False btnSupUpdate.Enabled = False btnExit.Enabled = False
MtxtSupId.Text = "" txtSupFirstName.Text = "" txtSupLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtSupAddress.Text = "" txtpincode.Text = "" txtCompany.Text = "" txtSupContact.Text = "" txtSupEmail.Text = ""
Dim cmd As OleDbCommand cmd = New OleDbCommand("select max(sup_id) from SupplierInfo", con) Dim n As Object n = cmd.ExecuteScalar MtxtSupId.Text = n + 1 End Sub
Private Sub btnSupSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupSave.Click Call Save() End Sub
Private Sub btnSupDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupDelete.Click Dim str As String str = "delete * from SupplierInfo where sup_id=" & Val(MtxtSupId.Text) If MtxtSupId.Text = "" Then MsgBox("Enter Supplier id !") Else
86
MessageBox.Show("Are you sure you want to remove this Supplier's details? ", "Delete Supplier's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() MsgBox("Record deleted Successfully !")
MtxtSupId.Text = "" txtSupFirstName.Text = "" txtSupLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtSupAddress.Text = "" txtpincode.Text = "" txtCompany.Text = "" txtSupContact.Text = "" txtSupEmail.Text = ""
End If End If End Sub
Private Sub btnSupUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupUpdate.Click Dim str As String str = "delete * from SupplierInfo where sup_id=" & Val(MtxtSupId.Text) If MtxtSupId.Text = "" Then MsgBox("Enter Supplier id !") Else MessageBox.Show("Are you sure you want to remove this Supplier's details? ", "Delete Supplier's Details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() End If cmd.ExecuteNonQuery() End If btnSupSave.Enabled = True Call Save() End Sub
Private Sub btnSupClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupClear.Click
87
MtxtSupId.Text = "" txtSupFirstName.Text = "" txtSupLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtSupAddress.Text = "" txtpincode.Text = "" txtCompany.Text = "" txtSupContact.Text = "" txtSupEmail.Text = "" End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub
Private Sub MtxtSupId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MtxtSupId.Enter Call Display() btnSupSave.Enabled = False btnSupClear.Enabled = False End Sub
Private Sub MtxtSupId_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MtxtSupId.KeyDown Call Display() btnSupSave.Enabled = False btnSupClear.Enabled = False End Sub
Private Sub btnSupPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupPrevious.Click If pos = dsNavigation.Tables(0).Rows.Count - 1 Then MsgBox("This is the last data") Else pos += 1 SetTextboxes() End If End Sub
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
btnSupAdd.Enabled = True
88
btnSupSave.Enabled = True btnSupDelete.Enabled = True btnSupUpdate.Enabled = True btnExit.Enabled = True MtxtSupId.Enabled = True MtxtSupId.Text = "" txtSupFirstName.Text = "" txtSupLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtSupAddress.Text = "" txtpincode.Text = "" txtCompany.Text = "" txtSupContact.Text = "" txtSupEmail.Text = "" End Sub
Private Sub btnSupFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupFirst.Click pos = 0 SetTextboxes() End Sub
Private Sub btnSupNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupNext.Click If pos = 0 Then MsgBox("This is the first data") Else pos -= 1 SetTextboxes() End If
End Sub
Private Sub btnSupLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupLast.Click pos = dsNavigation.Tables(0).Rows.Count - 1 SetTextboxes()
End SubEnd Class
9. CustomerDetails
Imports System.Data.OleDbPublic Class CustomerDetails
89
Private Sub CustomerDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() Dim query As String query = "select * from CustomerInfo" Dim daEmp As New OleDbDataAdapter(query, con) Dim dsEmp As New DataSet daEmp.Fill(dsEmp) DGCustDetails.DataSource = dsEmp.Tables(0) daEmp.Dispose() dsEmp.Dispose() con.Close() End SubEnd Class
10. EmployeeDetails
Imports System.Data.OleDb
Public Class EmployeeDetails
90
Private Sub EmployeeDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() Dim query As String query = "select * from EmployeeInfo" Dim daEmp As New OleDbDataAdapter(query, con) Dim dsEmp As New DataSet daEmp.Fill(dsEmp) DGEmployees.DataSource = dsEmp.Tables(0) daEmp.Dispose() dsEmp.Dispose() con.Close()
End SubEnd Class
11. ProductDetails
Imports System.Data.OleDbPublic Class ProductDetails
91
Private Sub ProductDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() Dim query As String query = "select * from ProductInfo" Dim daEmp As New OleDbDataAdapter(query, con) Dim dsEmp As New DataSet daEmp.Fill(dsEmp) DGProductDetails.DataSource = dsEmp.Tables(0) daEmp.Dispose() dsEmp.Dispose() con.Close() End SubEnd Class
12. SupplierDetails
Imports System.Data.OleDbPublic Class SupplierDetails
92
Private Sub SupplierDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() Dim query As String query = "select * from SupplierInfo" Dim daEmp As New OleDbDataAdapter(query, con) Dim dsEmp As New DataSet daEmp.Fill(dsEmp) DGSupplierDetails.DataSource = dsEmp.Tables(0) daEmp.Dispose() dsEmp.Dispose() con.Close()
End SubEnd Class
13. Bill
Imports System.Data.OleDb
Public Class CustomersBill
93
Dim total As Integer Private Sub Display() Dim q As String = "select * from Bill where bill_no=" & Val(MtxtBillNo1.Text) Dim cmd As New OleDbCommand(q, con) dr = cmd.ExecuteReader If (dr.Read) Then MtxtBillNo1.Text = dr.Item(0).ToString mtDate.Text = dr.Item(1).ToString txtCid.Text = dr.Item(2).ToString txtCname.Text = dr.Item(3).ToString txtcontact.Text = dr.Item(4).ToString
Dim d1 As String = dr.Item(5).ToString If d1 = "null" Then txtD1.Text = "" Else txtD1.Text = dr.Item(5).ToString End If
Dim d2 As String = dr.Item(6).ToString If d2 = "null" Then txtD2.Text = "" Else txtD2.Text = dr.Item(6).ToString End If
Dim d3 As String = dr.Item(7).ToString If d3 = "null" Then txtD3.Text = "" Else txtD3.Text = dr.Item(7).ToString End If
Dim d4 As String = dr.Item(8).ToString If d4 = "null" Then txtD4.Text = "" Else txtD4.Text = dr.Item(8).ToString End If
Dim d5 As String = dr.Item(9).ToString If d5 = "null" Then txtD5.Text = "" Else txtD5.Text = dr.Item(9).ToString End If
94
Dim p1 As String = dr.Item(10).ToString If p1 = "null" Then txtPE1.Text = "" Else txtPE1.Text = dr.Item(10).ToString End If
Dim p2 As String = dr.Item(11).ToString If p2 = "null" Then txtPE2.Text = "" Else txtPE2.Text = dr.Item(11).ToString End If
Dim p3 As String = dr.Item(12).ToString If p3 = "null" Then txtPE3.Text = "" Else txtPE3.Text = dr.Item(12).ToString End If
Dim p4 As String = dr.Item(13).ToString If p4 = "null" Then txtPE4.Text = "" Else txtPE4.Text = dr.Item(13).ToString End If
Dim p5 As String = dr.Item(14).ToString If p5 = "null" Then txtPE5.Text = "" Else txtPE5.Text = dr.Item(14).ToString End If
Dim q1 As String = dr.Item(15).ToString If q1 = "null" Then txtQ1.Text = "" Else txtQ1.Text = dr.Item(15).ToString End If
Dim q2 As String = dr.Item(16).ToString
95
If q2 = "null" Then txtQ2.Text = "" Else txtQ2.Text = dr.Item(16).ToString End If
Dim q3 As String = dr.Item(17).ToString If q3 = "null" Then txtQ3.Text = "" Else txtQ3.Text = dr.Item(17).ToString End If
Dim q4 As String = dr.Item(18).ToString If q4 = "null" Then txtQ4.Text = "" Else txtQ4.Text = dr.Item(18).ToString End If
Dim q5 As String = dr.Item(19).ToString If q5 = "null" Then txtQ5.Text = "" Else txtQ5.Text = dr.Item(19).ToString End If txtTItems.Text = dr.Item(20).ToString Dim mode As String = dr.Item(21).ToString If mode = "credit card" Then rbCredit.Checked = True Else rbCash.Checked = True End If txtCustTotAmt.Text = dr.Item(22).ToString txtCustDiscount.Text = dr.Item(23).ToString txtCustNetAmt.Text = dr.Item(24).ToString End If End Sub
Sub SetTextboxes() MtxtBillNo1.Text = dsNavigation.Tables(0).Rows(pos).Item(0).ToString() mtDate.Text = dsNavigation.Tables(0).Rows(pos).Item(1).ToString() txtCid.Text = dsNavigation.Tables(0).Rows(pos).Item(2).ToString() txtCname.Text = dsNavigation.Tables(0).Rows(pos).Item(3).ToString() txtcontact.Text = dsNavigation.Tables(0).Rows(pos).Item(4).ToString()
96
Dim d1 As String = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() If d1 = "null" Then txtD1.Text = "" Else txtD1.Text = dsNavigation.Tables(0).Rows(pos).Item(5).ToString() End If
Dim d2 As String = dsNavigation.Tables(0).Rows(pos).Item(6).ToString() If d2 = "null" Then txtD2.Text = "" Else txtD2.Text = dsNavigation.Tables(0).Rows(pos).Item(6).ToString() End If
Dim d3 As String = dsNavigation.Tables(0).Rows(pos).Item(7).ToString() If d3 = "null" Then txtD3.Text = "" Else txtD3.Text = dsNavigation.Tables(0).Rows(pos).Item(7).ToString() End If
Dim d4 As String = dsNavigation.Tables(0).Rows(pos).Item(8).ToString() If d4 = "null" Then txtD4.Text = "" Else txtD4.Text = dsNavigation.Tables(0).Rows(pos).Item(8).ToString() End If
Dim d5 As String = dsNavigation.Tables(0).Rows(pos).Item(9).ToString() If d5 = "null" Then txtD5.Text = "" Else txtD5.Text = dsNavigation.Tables(0).Rows(pos).Item(9).ToString() End If
Dim p1 As String = dsNavigation.Tables(0).Rows(pos).Item(10).ToString() If p1 = "null" Then txtPE1.Text = "" Else txtPE1.Text = dsNavigation.Tables(0).Rows(pos).Item(10).ToString() End If
Dim p2 As String = dsNavigation.Tables(0).Rows(pos).Item(11).ToString() If p2 = "null" Then txtPE2.Text = ""
97
Else txtPE2.Text = dsNavigation.Tables(0).Rows(pos).Item(11).ToString() End If
Dim p3 As String = dsNavigation.Tables(0).Rows(pos).Item(12).ToString() If p3 = "null" Then txtPE3.Text = "" Else txtPE3.Text = dsNavigation.Tables(0).Rows(pos).Item(12).ToString() End If
Dim p4 As String = dsNavigation.Tables(0).Rows(pos).Item(13).ToString() If p4 = "null" Then txtPE4.Text = "" Else txtPE4.Text = dsNavigation.Tables(0).Rows(pos).Item(13).ToString() End If
Dim p5 As String = dsNavigation.Tables(0).Rows(pos).Item(14).ToString() If p5 = "null" Then txtPE5.Text = "" Else txtPE5.Text = dsNavigation.Tables(0).Rows(pos).Item(14).ToString() End If
Dim q1 As String = dsNavigation.Tables(0).Rows(pos).Item(15).ToString() If q1 = "null" Then txtQ1.Text = "" Else txtQ1.Text = dsNavigation.Tables(0).Rows(pos).Item(15).ToString() End If
Dim q2 As String = dsNavigation.Tables(0).Rows(pos).Item(16).ToString() If q2 = "null" Then txtQ2.Text = "" Else txtQ2.Text = dsNavigation.Tables(0).Rows(pos).Item(16).ToString() End If
Dim q3 As String = dsNavigation.Tables(0).Rows(pos).Item(17).ToString() If q3 = "null" Then txtQ3.Text = "" Else txtQ3.Text = dsNavigation.Tables(0).Rows(pos).Item(17).ToString() End If
98
Dim q4 As String = dsNavigation.Tables(0).Rows(pos).Item(18).ToString() If q4 = "null" Then txtQ4.Text = "" Else txtQ4.Text = dsNavigation.Tables(0).Rows(pos).Item(18).ToString() End If
Dim q5 As String = dsNavigation.Tables(0).Rows(pos).Item(19).ToString() If q5 = "null" Then txtQ5.Text = "" Else txtQ5.Text = dsNavigation.Tables(0).Rows(pos).Item(19).ToString() End If
txtTItems.Text = dsNavigation.Tables(0).Rows(pos).Item(20).ToString() Dim mode As String = dsNavigation.Tables(0).Rows(pos).Item(21).ToString() If mode = "credit card" Then rbCredit.Checked = True Else rbCash.Checked = True End If txtCustTotAmt.Text = dsNavigation.Tables(0).Rows(pos).Item(22).ToString() txtCustDiscount.Text = dsNavigation.Tables(0).Rows(pos).Item(23).ToString() txtCustNetAmt.Text = dsNavigation.Tables(0).Rows(pos).Item(24).ToString() End Sub Private Sub clear() MtxtBillNo1.Text = "" mtDate.Text = "" txtCid.Text = "" txtCname.Text = "" txtcontact.Text = "" txtD1.Text = "" txtD2.Text = "" txtD3.Text = "" txtD4.Text = "" txtD5.Text = "" txtPE1.Text = "" txtPE2.Text = "" txtPE3.Text = "" txtPE4.Text = "" txtPE5.Text = "" txtQ1.Text = "" txtQ2.Text = "" txtQ3.Text = "" txtQ4.Text = "" txtQ5.Text = ""
99
txtTItems.Text = "" rbCredit.Checked = False rbCash.Checked = False txtCustTotAmt.Text = "" txtCustDiscount.Text = "" txtCustNetAmt.Text = "" End Sub
Private Sub save() btnAdd.Enabled = True btnSave.Enabled = False btnDelete.Enabled = True btnUpdate.Enabled = True btnExit.Enabled = True
Try Dim q As String = "Insert into Bill values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" Dim cmd As New OleDbCommand(q, con) cmd.Parameters.Add("?", OleDbType.Char).Value = MtxtBillNo1.Text cmd.Parameters.Add("?", OleDbType.Char).Value = mtDate.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCid.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCname.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtcontact.Text
If txtD1.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtD1.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If
If txtD2.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtD2.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If
If txtD3.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtD3.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If
If txtD4.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtD4.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null"
100
End If
If txtD5.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtD5.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If
If txtPE1.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtPE1.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtPE2.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtPE2.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtPE3.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtPE3.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtPE4.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtPE4.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtPE5.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtPE5.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If
If txtQ1.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtQ1.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtQ2.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtQ2.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtQ3.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtQ3.Text
101
Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtQ4.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtQ4.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtQ5.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtQ5.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If
cmd.Parameters.Add("?", OleDbType.Char).Value = txtTItems.Text
If rbCredit.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "credit card" ElseIf rbCash.Checked = True Then cmd.Parameters.Add("?", OleDbType.Char).Value = "cash" End If
cmd.Parameters.Add("?", OleDbType.Char).Value = txtCustTotAmt.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCustDiscount.Text cmd.Parameters.Add("?", OleDbType.Char).Value = txtCustNetAmt.Text
cmd.ExecuteNonQuery() MsgBox("Record saved Successfully !") Call clear()
Catch ex As Exception MsgBox(Err.Description) End Try End Sub
Private Sub CustomersBill_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() MtxtBillNo1.Select()
txtcreditno.Visible = False txtCustDiscount.Enabled = False txtCustDiscount.Text = "7.5" Dim query As String = "Select * from Bill" daNavigation = New OleDbDataAdapter(query, con)
102
daNavigation.Fill(dsNavigation) pos = 0 End Sub
Private Sub MtxtBillNo1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MtxtBillNo1.Enter Call Display() btnSave.Enabled = False btnClear.Enabled = False End Sub
Private Sub MtxtBillNo1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MtxtBillNo1.KeyDown Call Display() btnSave.Enabled = False btnClear.Enabled = False End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click pos = 0 SetTextboxes() End Sub
Private Sub btnprev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprev.Click If pos = 0 Then MsgBox("This is the first data") Else pos -= 1 SetTextboxes() End If End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If pos = dsNavigation.Tables(0).Rows.Count - 1 Then MsgBox("This is the last data") Else pos += 1 SetTextboxes() End If End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
103
pos = dsNavigation.Tables(0).Rows.Count - 1 SetTextboxes() End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click Call clear()
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click MtxtBillNo1.Enabled = False mtDate.Select()
btnAdd.Enabled = False btnSave.Enabled = True btnDelete.Enabled = False btnUpdate.Enabled = False btnExit.Enabled = False
mtDate.Text = "" txtCid.Text = "" txtCname.Text = "" txtcontact.Text = "" txtD1.Text = "" txtD2.Text = "" txtD3.Text = "" txtD4.Text = "" txtD5.Text = "" txtPE1.Text = "" txtPE2.Text = "" txtPE3.Text = "" txtPE4.Text = "" txtPE5.Text = "" txtQ1.Text = "" txtQ2.Text = "" txtQ3.Text = "" txtQ4.Text = "" txtQ5.Text = "" txtTItems.Text = ""
104
rbCredit.Checked = False rbCash.Checked = False txtCustTotAmt.Text = "" txtCustDiscount.Text = "" txtCustNetAmt.Text = ""
Dim cmd As OleDbCommand cmd = New OleDbCommand("select max(bill_no) from Bill", con) Dim n As Object n = cmd.ExecuteScalar MtxtBillNo1.Text = n + 1 End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim str As String str = "delete * from Bill where bill_no=" & Val(MtxtBillNo1.Text) If MtxtBillNo1.Text = "" Then MsgBox("Enter Bill No !") Else MessageBox.Show("Are you sure you want to remove this Bill No.'s details? ", "Delete Bill No.'s details?", MessageBoxButtons.YesNo) If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() MsgBox("Record deleted Successfully !") Call clear() End If End If End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Call save() End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click Dim str As String str = "delete * from Bill where bill_no=" & Val(MtxtBillNo1.Text) If MtxtBillNo1.Text = "" Then MsgBox("Enter Bill No !") Else MessageBox.Show("Are you sure you want to Update this Bill No.'s details? ", "Update Bill No.'s details?", MessageBoxButtons.YesNo)
105
If MsgBoxResult.Yes = True Then Else cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() End If cmd.ExecuteNonQuery() End If btnSave.Enabled = True Call save() End Sub
Private Sub btnback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnback.Click btnAdd.Enabled = True btnSave.Enabled = True btnDelete.Enabled = True btnUpdate.Enabled = True btnExit.Enabled = True MtxtBillNo1.Enabled = True rbCash.Enabled = True rbCredit.Enabled = True Call clear()
End Sub
Private Sub txtD1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtD1.SelectedIndexChanged If txtD1.SelectedItem = "Skirts" Then txtPE1.Text = "1500" ElseIf txtD1.SelectedItem = "Jeans" Then txtPE1.Text = "1850" ElseIf txtD1.SelectedItem = "Salwar" Then txtPE1.Text = "2890" ElseIf txtD1.SelectedItem = "Saree" Then txtPE1.Text = "3897" ElseIf txtD1.SelectedItem = "Kurtis" Then txtPE1.Text = "680" ElseIf txtD1.SelectedItem = "T-shirts" Then txtPE1.Text = "550" ElseIf txtD1.SelectedItem = "legins" Then txtPE1.Text = "390" ElseIf txtD1.SelectedItem = "Formals" Then txtPE1.Text = "1567" End If
106
End Sub
Private Sub txtD2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtD2.SelectedIndexChanged If txtD2.SelectedItem = "Skirts" Then txtPE2.Text = "1500" ElseIf txtD2.SelectedItem = "Jeans" Then txtPE2.Text = "1850" ElseIf txtD2.SelectedItem = "Salwar" Then txtPE2.Text = "2890" ElseIf txtD2.SelectedItem = "Saree" Then txtPE2.Text = "3897" ElseIf txtD2.SelectedItem = "Kurtis" Then txtPE2.Text = "680" ElseIf txtD2.SelectedItem = "T-shirts" Then txtPE2.Text = "550" ElseIf txtD2.SelectedItem = "legins" Then txtPE2.Text = "390" ElseIf txtD2.SelectedItem = "Formals" Then txtPE2.Text = "1567" End If End Sub
Private Sub txtD3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtD3.SelectedIndexChanged If txtD3.SelectedItem = "Skirts" Then txtPE3.Text = "1500" ElseIf txtD3.SelectedItem = "Jeans" Then txtPE3.Text = "1850" ElseIf txtD3.SelectedItem = "Salwar" Then txtPE3.Text = "2890" ElseIf txtD3.SelectedItem = "Saree" Then txtPE3.Text = "3897" ElseIf txtD3.SelectedItem = "Kurtis" Then txtPE3.Text = "680" ElseIf txtD3.SelectedItem = "T-shirts" Then txtPE3.Text = "550" ElseIf txtD3.SelectedItem = "legins" Then txtPE3.Text = "390" ElseIf txtD3.SelectedItem = "Formals" Then txtPE3.Text = "1567" End If End Sub
Private Sub txtD4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtD4.SelectedIndexChanged
107
If txtD4.SelectedItem = "Skirts" Then txtPE4.Text = "1500" ElseIf txtD4.SelectedItem = "Jeans" Then txtPE4.Text = "1850" ElseIf txtD4.SelectedItem = "Salwar" Then txtPE4.Text = "2890" ElseIf txtD4.SelectedItem = "Saree" Then txtPE4.Text = "3897" ElseIf txtD4.SelectedItem = "Kurtis" Then txtPE4.Text = "680" ElseIf txtD4.SelectedItem = "T-shirts" Then txtPE4.Text = "550" ElseIf txtD4.SelectedItem = "legins" Then txtPE4.Text = "390" ElseIf txtD4.SelectedItem = "Formals" Then txtPE4.Text = "1567" End If End Sub
Private Sub txtD5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtD5.SelectedIndexChanged If txtD5.SelectedItem = "Skirts" Then txtPE5.Text = "1500" ElseIf txtD5.SelectedItem = "Jeans" Then txtPE5.Text = "1850" ElseIf txtD5.SelectedItem = "Salwar" Then txtPE5.Text = "2890" ElseIf txtD5.SelectedItem = "Saree" Then txtPE5.Text = "3897" ElseIf txtD5.SelectedItem = "Kurtis" Then txtPE5.Text = "680" ElseIf txtD5.SelectedItem = "T-shirts" Then txtPE5.Text = "550" ElseIf txtD5.SelectedItem = "legins" Then txtPE5.Text = "390" ElseIf txtD5.SelectedItem = "Formals" Then txtPE5.Text = "1567" End If End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If txtD2.Text = "" And txtD3.Text = "" And txtD4.Text = "" Then txtD2.Text = "" txtD3.Text = ""
108
txtD4.Text = "" txtPE2.Text = "" txtPE3.Text = "" txtPE4.Text = "" txtQ2.Text = "" txtQ3.Text = "" txtQ4.Text = ""
total = Val(txtPE1.Text) * Val(txtQ1.Text) txtCustTotAmt.Text = total txtTItems.Text = Val(txtQ1.Text)
ElseIf txtD3.Text = "" And txtD4.Text = "" Then txtD3.Text = "" txtD4.Text = "" txtPE3.Text = "" txtPE4.Text = "" txtQ3.Text = "" txtQ4.Text = ""
total = (Val(txtPE1.Text) * Val(txtQ1.Text)) + (Val(txtPE2.Text) * Val(txtQ2.Text)) txtCustTotAmt.Text = total txtTItems.Text = Val(txtQ1.Text) + Val(txtQ2.Text)
ElseIf txtD4.Text = "" Then txtD4.Text = "" txtPE4.Text = "" txtQ4.Text = ""
total = (Val(txtPE1.Text) * Val(txtQ1.Text)) + (Val(txtPE2.Text) * Val(txtQ2.Text)) + (Val(txtPE3.Text) * Val(txtQ3.Text)) txtCustTotAmt.Text = total txtTItems.Text = Val(txtQ1.Text) + Val(txtQ2.Text) + Val(txtQ3.Text) Else total = (Val(txtPE1.Text) * Val(txtQ1.Text)) + (Val(txtPE2.Text) * Val(txtQ2.Text)) + (Val(txtPE3.Text) * Val(txtQ3.Text)) + (Val(txtPE4.Text) * Val(txtQ4.Text)) txtCustTotAmt.Text = total txtTItems.Text = Val(txtQ1.Text) + Val(txtQ2.Text) + Val(txtQ3.Text) + Val(txtQ4.Text) End If
End Sub
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.Click Dim discount As Single
109
Dim FinalAmt As Single discount = (total * Val(txtCustDiscount.Text)) / 100 FinalAmt = total - discount txtCustNetAmt.Text = FinalAmt
End Sub
Private Sub rbCash_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbCash.Click If rbCash.Checked = True Then rbCredit.Enabled = False txtcreditno.Visible = False End If End Sub
Private Sub rbCredit_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbCredit.CheckedChanged If rbCredit.Checked = True Then rbCash.Enabled = False txtcreditno.Visible = True End If End SubEnd Class
14. Splashscreen1
110
Public NotInheritable Class SplashScreen1
'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab ' of the Project Designer ("Properties" under the "Project" menu).
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Set up the dialog text at runtime according to the application's assembly information.
'TODO: Customize the application's assembly information in the "Application" pane of the project ' properties dialog (under the "Project" menu).
'Application title If My.Application.Info.Title <> "" Then ApplicationTitle.Text = My.Application.Info.Title Else 'If the application title is missing, use the application name, without the extension ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) End If
'Format the version information using the text set into the Version control at design time as the ' formatting string. This allows for effective localization if desired. ' Build and revision information could be included by using the following code and changing the ' Version control's designtime text to "Version {0}.{1:00}.{2}.{3}" or something similar. See ' String.Format() in Help for more information. ' ' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)
'Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) Version.Text = " Version 5.5.2" 'Copyright info Copyright.Text = My.Application.Info.Copyright End Sub
111
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click Me.Close()
End Sub
Private Sub ApplicationTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApplicationTitle.Click
End SubEnd Class
15. About
112
Public Class About
Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click Me.Close() End Sub
Private Sub About_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized End SubEnd Class
VI. Future Enhancements
113
The current system is designed for a single cloth shop further can be expanded to more than one cloth shop by centralization thereby making records of various branches available at central path .The system developed may have the chance for adding some more features in the future. The following can be some of the features that can be introduced in the system later on:
More information can be added to the database by making use of new tables and the information for those tables.
The system developed has the possibility of making online purchasing of goods and also payment of bill through online by mentioning the credit card details.
The system can be made to auto-collect the information through the specified websites, once it is converted to an online system.
Generation of reports can be made on monthly basis without the updating made manually every time at the end of each month.
More menus can be added to the main menu tree of the system such as the one to generate salary reports, monthly profit & loss reports, etc.
VII. References and Bibliography
114
1. Visual Basic and programming – Black book2. Beginning.Microsoft.Visual.Basic.2008 – Thearon Willis and Bryan Newsome3. Professional Visual Basic 2008- Bill Evjen, Billy Hollis, Bill Sheldon ,Kent Sharkey4. www.w3schools.com 5. www.google.com