Cloth Shop Management Documentation)
Cloth Shop Management Documentation)
Cloth Shop Management Documentation)
Acknowledgement
The project of Momento Ethnic Studio a womens 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 cooperation and efforts for making this project a success.
- Shiny Preman
I. (i) y y
PRELIMINARY INVESTIGATION
Organizational overview Name of the Organization : Momento Address : Shop no 4, Rohini Bldg, R.R.T.Rd Mulund(w), Mumbai, Maharashtra 400080. y Email-Id : momentoindia @ gmail.com y Contact Number : 09821076210 , 91-22-25648490 y 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 womens wear which could be catagorised as Salwar Kameez, Designer Sarees, Western Wears, Night Wears, Indian Ethnic Wears. y 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 y Motto of the Organization : Change The Style of Womenhood y Their Manufacturers are : a) In Maharashtra : i) MRJ International Manufacturer 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. y Mode of payement : Cash ,Cheques ,Credit Cards
(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.
y y y y
(iii)
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.
(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.
y y y y y
Advantages : y 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.
y y y
(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. Technical feasibility : Determine whether the technology needed for the proposed system is available or not. Economical feasibility : Economic justification include a broad range of concerns that include cost benefits associated with candidate system. Operational feasibility : Mainly related to human organization and political aspects. 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 server Front-end : VB .Net Hardware requirements : Processor : Pentium II, III, IV or higher. RAM : 64 Mb or higher. Disc : 130 Mb.
o o o o
(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.
(vii)
AUG 1 2
AUG 3 4
SEP 1 2
SEP 3 4
OCT 1 2
NOV 1 2
DEC 1 2
JAN 1 2
TASK Preliminary Investigation Defining Problems Confirming Project Feasibility System Analysis Gather Information Define System Requirements System Design Design System Interface Procedural (Algorithmic) designing System Coding Construct the software components Testing Phase Verify and test components Program Documentation
II.
SYSTEM ANALYSIS
(i)
Fact Finding Techniques (Questionnaires) a) General Questions i. 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. ii. iii. iv. v. vi. vii. viii. ix. x. xi. xii. What are the stakeholders for your organization ? What are the contribution of each stakeholder for your organization ? Have you maintained any kind of database for your organization? Have you maintained employee details ? If yes then what kind of information do you maintain related to the same ? Have you maintained supplier details ? If yes then what kind of information do you maintain related to the same ? Is your data secure in current system ? Is your system time consuming ? Is your system monthly updated ? Is the stock being taken weekly, monthly or yearly ? Is your system easy to handle ? Do you expect that the proposed system will also maintain customer details ? When you want the project to be completed ?
(ii) Event 1. Adding customer details 2. Adding Employee details 3. Adding Supplier details 4. Generate bill for garments 5. Generate bill for garments 6. Update customer details 7. Update Employee details 8. Update Supplier details 9. Adding garments details 10. Delete customer details 11. Delete Supplier details 12. Delete Employee details 13. Searching Employee details 14. Searching Supplier details
Event Table Trigger Request for adding Request for adding Request for adding Request for bill generation Request for bill generation Request for Updation Request for Updation Request for Updation Request for adding Request for deletion Request for deletion Request for deletion Request for search Request for search Admin Admin Admin Admin Admin Source Customer Activity Recording customer details in database Recording Employee details in database Recording Supplier details in database Generate bill Generate bill Updation of customer details Updation of Employee details Updation of Supplier details Recording garments details Deletion of Supplier details Deletion of Supplier details Deletion of Employee details Search Employee details Search Supplier details Response Customer details added successfully Employee details added successfully Supplier details added successfully Bill generated successfully Bill generated successfully Customer details updated successfully Employee details updated successfully Supplier details updated successfully Garments details added successfully Customer details deleted successfully Supplier details deleted successfully Employee details deleted successfully Search completed successfully Search completed successfully Destination Admin
Employee
Admin
Admin Admin Customer Admin Admin Admin Admin Admin Admin Admin Admin Admin
Employee
Supplier
Admin Admin
Admin Admin
(iii)
Use Case Diagram , Scenarios And Use Case Description i. y y ii. y y y y iii. y y y y iv. y y y y y y y Employee Give information about garments. Generate bill and give it to the customer. Customer Enquire about garments. Purchase the garments. Request for the bill. Pay the bill. Supplier Give details about the garments. Accept the order. Offer discounts on purchase. Generate bill and give it. 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.
10
Give information about garments Generate bill and give it to the customer
Employee
Equire about garments Purchase the garments
Customer
Supplier
Admin
Give order to supplier Request for bill Pay the bill Offer discounts on purchase Purchase the garments
11
12
(iv)
ERD
13
(v)
Activity Diagram
14
(vi)
Class Diagram
Customer
Admin
Employee -Emp_id :E001 -Emp_name :Ram -Address :Kalwa -Age: 32 -Date of joining : 1/3/2005 -Salary :5800 +add() +delete() +update()
-Id : C001 -Name : Ramya -Address : Thane -Contct No :233345 - payment : cash +bill()
+login()
1 1
*
Local User -UserName: Soham Password : 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()
1,*
Bill
Garments
*
-BillNo : 0812 -Quantity : 5 -BillAmount : 1590 -Tax : 550 +reports() +calculation()
-GId: G008 -Type : Western -Quantity : 5 -Price :4000 -Company : Sakhi Creations +add() +delete()
15
(vii)
Object Diagram
Customer
Admin
Employee Emp_id :E001 Emp_name :Ram Address :Kalwa Age: 32 Date of joining : 1/3/2005 Salary :5800
Id : C001 Name : Ramya Address : Thane Contct No :233345 Mode of payment : cash
*
Local User UserName: Soham Password : soham Suppliers SId: S001 SName : Sakhi Creations Address : Andheri(w) Ph. No: 27987989 Garments type : Fabric material. Purchase Details PId: P001 Price: 1500 Quantity: 5 Payment mode : Cash
1,*
Order
Garments
GId: G008 Type : Western Quantity : 5 Price :4000 Company : Sakhi Creations
16
Login :
17
Bill generation :
Maintaining Details
18
(ix)
State Diagram
name user
Product selection
payment
admin
Selected product
bill
name
employee
admin
Salary Product info
name
Supplier
Product list
Products
admin
Order
Payment
19
III.
SYSTEM DESIGN
(i)
Component Diagram
System
20
(ii)
Package Diagram
Admin
Supplier
Supplier id
Name
Supplier name
Password
Supplier address
Supplier contactno
Customer
Employee
customer id
customer name
Emp id
Emp name
customer address
customer contactno
Emp address
Emp contactno
Bill
Products
Prod type
Prod rate
21
(iii)
Deployment Diagram
User
Staff
Products
Supplier
System
22
(iv)
Employee
Customer
Supplier
Bill
Management
23
SYSTEM CODING
File
View
Bill Generations
Help
Employee Information Form Customer Information Form Supplier Information Form Product Information Form
Employee Table
Customer Bill
About Us
Customer Table
Exit
Supplier Table
Product Table
24
(ii)
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 name
emp_id emp_fname emp_lname emp_gender emp_dob emp_address emp_contact emp_email emp_joining emp_dept emp_salary
Datatype
Number Text Text Text Text Text Number Text Text Text Number
Field size
10 25 25 25 25 25 10 25 25 25 10
Desc
Maximum 10 digits can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 10 digits can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 10 digits can be stored
25
Datatype
Number Text Text Text Text Number Text
Field size
10 25 25 6 25 10 25
Desc
Maximum 10 digits can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 6 letters can be stored Maximum 25 letters can be stored Maximum 10 digits can be stored Maximum 25 letters can be stored
Datatype
Number Text Text Text Text Number Text Number Text
Field size
10 25 25 6 25 8 25 10 25
Desc
Maximum 10 digits can be stored Maximum 25 letters can be stored Maximum 25 letters can be stored Maximum 6 letters can be stored Maximum 25 letters can be stored Maximum 8digits can be stored Maximum 25 letters can be stored Maximum 10 digits can be stored Maximum 25 letters can be stored
26
Datatype
Number Text Number Number Text Text Text Text Text
Field size
10 5 2 6 25 8 25 10 25
Desc
Maximum 10 digits can be stored Maximum 5 letters can be stored Maximum 2 digits can be stored Maximum 6 digits can be stored Maximum 25 letters can be stored Maximum 8 letters can be stored Maximum 25 letters can be stored Maximum 10 letters can be stored Maximum 25 letters can be stored
Datatype
Number Text Text Text Text Number Number Number
Field size
10 5 2 6 25 10 10 10
Desc
Maximum 10 digits can be stored Maximum 5 letters can be stored Maximum 2 letters can be stored Maximum 6 letters can be stored Maximum 25 letters can be stored Maximum 10 digits can be stored Maximum 10 digits can be stored Maximum 10 digits can be stored
27
price1 price2 price2 qty1 qty2 qty2 tot_items tot_amt discount pay_mode net_amt
Number Number Number Number Number Number Number Number Number Text Number
5 5 5 2 2 2 2 6 2 10 6
Maximum 5 digits can be stored Maximum 5 digits can be stored Maximum 5 digits can be stored Maximum 2 digits can be stored Maximum 2 digits can be stored Maximum 2 digits can be stored Maximum 2 digits can be stored Maximum 6 digits can be stored Maximum 2 digits can be stored Maximum 10 letters can be stored Maximum 6 digits can be stored
28
(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.
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.
TextBox Names: Text boxes are sometimes used for coding purposes and hence are named
according to the content they are going to held.
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.
29
(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: y y 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.
30
(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.
31
Software Testing Fundamentals y y y y 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 : y The three basic testing objective can be specified as follows 1) Testing is process of executing a program with an intend of finding error 2) 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 y y y y y y y 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 y y 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 ways 1) 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
32
y y
The first approach is termed as Black-Box testing 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 once 2) Exercise all logical decision on their true and false sides 3) Execute all loops at their boundaries and within operational bound 4) Exercise internal data structure to ensure their validity Following methods are available in white box (B G D C L) Basis path testing Graph matrices Condition testing Data flow testing 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 function 2) Interface error 3) Error in Data structure or external Database access 4) Initialization and Termination error Test 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
y y
1. 2. 3. 4. 5.
y y y
y y y y y y y y
33
y y y
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 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
34
(vi)
1. Form
35
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
44
45
46
47
48
Form SplashScreen SplashScreen Home Main Login EmployeeInformation CustomerInformation SupplierInformation ProductInformation EmployeeDetails CustomerDetails SupplierDetails ProductDetails Module CrystalReportViewer Bill
Name SplashScreen1 About Form1 Main LoginForm1 EmployeeInfo CustomerInfo SupplierInfo ProductInfo EmployeeDetails CustomerDetails SupplierDetails ProductDetails Module1 Form2 BillGeneration
49
(ii)
Source Code
1. Module
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
50
2. Form1 Public Class Form1 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 Sub End Class
51
3. loginForm1 Public Class LoginForm1 Dim Attempts As Integer = 1 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()
52
Me.Close() End Sub Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancel.Click Me.Close() End Sub End Class
53
4. Main Public Class Main 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
54
Dim a As New About a.MdiParent = Me a.Show() End Sub 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()
55
End Sub Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click Dim sd As New SupplierDetails 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 Sub End Class
56
5. CustomerInformation Imports System.Data.OleDb Public Class CustomerInformation 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()
57
If gen = "male" Then rbmale.Checked = True Else rbfemale.Checked = True End If 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
58
Private Sub CustomerInformation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.WindowState = FormWindowState.Maximized EstablishConnection() MtxtCustId.Select() 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
59
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 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
60
MtxtCustId.Text = "" txtCustLastName.Text = "" txtCustFirstName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtCustAddress.Text = "" 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
61
End Sub Private Sub btnCustSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustSave.Click Call Save() End Sub 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
62
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 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
63
SetTextboxes() End If End Sub Private Sub btnCustLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustLast.Click pos = dsNavigation.Tables(0).Rows.Count - 1 SetTextboxes() End Sub End Class
64
6. EmployeeInfo Imports System.Data.OleDb Imports ClothManagement_System.LoginForm1 Public Class EmployeeInfo 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"
65
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 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
66
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() 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
67
Private Sub txtEmpContact_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEmpContact.KeyPress Call Numbers(e) End Sub
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 "."
68
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 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
69
cmd = New OleDbCommand("select max(emp_id) from EmployeeInfo", con) Dim n As Object n = cmd.ExecuteScalar MtxtEmpId.Text = n + 1 End Sub 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
70
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 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) 'error part ...datatype mismatch cmd.ExecuteNonQuery() 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
71
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 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
72
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() 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 Sub End Class
73
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
74
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() 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 = ""
75
txtProdWtype.Text = "" txtProdBrand.Text = "" txtProdShades.Text = "" Catch ex As Exception MsgBox(ex.Message) End Try
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
76
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 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
77
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub
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
78
End If End Sub Private Sub MtxtProdId_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MtxtProdId.Enter Call Display() 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
79
cmd = New OleDbCommand(str, con) cmd.ExecuteNonQuery() End If cmd.ExecuteNonQuery() End If btnProdSave.Enabled = True 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 Sub End Class
80
8. SupplierInfo Imports System.Data.OleDb Public Class SupplierInformation 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 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()
81
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() 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 = ""
82
txtSupLastName.Text = "" rbmale.Checked = False rbfemale.Checked = False RtxtSupAddress.Text = "" txtpincode.Text = "" txtCompany.Text = "" 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
83
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) 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
84
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 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
85
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() 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()
86
End Sub Private Sub btnSupClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSupClear.Click 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
87
btnSupAdd.Enabled = True 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 Sub End Class
88
9. CustomerDetails Imports System.Data.OleDb Public Class CustomerDetails 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 Sub End Class
89
10. EmployeeDetails Imports System.Data.OleDb Public Class EmployeeDetails 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()
90
11. ProductDetails Imports System.Data.OleDb Public Class ProductDetails 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 Sub End Class
91
12. SupplierDetails Imports System.Data.OleDb Public Class SupplierDetails 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 Sub End Class
92
13. Bill Imports System.Data.OleDb Public Class CustomersBill 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
93
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
94
txtQ1.Text = dr.Item(15).ToString End If Dim q2 As String = dr.Item(16).ToString 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()
95
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() 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
96
Dim p2 As String = dsNavigation.Tables(0).Rows(pos).Item(11).ToString() If p2 = "null" Then txtPE2.Text = "" 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 = ""
97
Else txtQ3.Text = dsNavigation.Tables(0).Rows(pos).Item(17).ToString() End If 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 = ""
98
txtQ2.Text = "" txtQ3.Text = "" txtQ4.Text = "" txtQ5.Text = "" 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
99
If txtD4.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtD4.Text Else cmd.Parameters.Add("?", OleDbType.Char).Value = "null" 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
100
cmd.Parameters.Add("?", OleDbType.Char).Value = "null" End If If txtQ3.Text <> "" Then cmd.Parameters.Add("?", OleDbType.Char).Value = txtQ3.Text 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
101
txtCustDiscount.Enabled = False txtCustDiscount.Text = "7.5" Dim query As String = "Select * from Bill" daNavigation = New OleDbDataAdapter(query, con) 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
102
End Sub Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click 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 = ""
103
txtQ3.Text = "" txtQ4.Text = "" txtQ5.Text = "" txtTItems.Text = "" 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
104
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) 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
105
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
106
End Sub Private Sub txtD4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtD4.SelectedIndexChanged 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
107
If txtD2.Text = "" And txtD3.Text = "" And txtD4.Text = "" Then txtD2.Text = "" txtD3.Text = "" 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
108
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.Click Dim discount As Single 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 Sub End Class
109
14. Splashscreen1
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
110
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 Sub End Class
111
15. About 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 Sub End Class
112
VI.
Future Enhancements
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:
y y y y y
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.
113
VII.
1. 2. 3. 4. 5.
Visual Basic and programming Black book Beginning.Microsoft.Visual.Basic.2008 Thearon Willis and Bryan Newsome Professional Visual Basic 2008- Bill Evjen, Billy Hollis, Bill Sheldon ,Kent Sharkey www.w3schools.com www.google.com
114