Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
E-Billing
Submitted by, Enrollment No.
0802017 0802022 0802023 0802024
Guided by,
Mr. V. D. Maske
GOVERNMENT POLYTECHNIC, MUMBAI (AN AUTONOMOUS INSTITUTE) 49, Khearwadi, Ali Yawar Jung Marg, Bandra(E.) Mumbai-400 051 (2010-2011)
CERTIFICATE
This is to certify that the following students have successfully and satisfactorily completed the project E-Billing and presented their project report in the partial fulfillment of requirement for Diploma in Computer Engineering from Government Polytechnic, Mumbai. Under the guidance of respective project guide, in the year 2010-2011.
Enrollment No.
0802017 0802022 0802023 0802024 Date: / /2011
INTRODUCTION
E-billing is the electronic delivery of financial documents to the customer that represents and replaces the conventional paper based document. E-billing is the delivery of electronic bills to end consumers and providing a payment option for them. In previous systems different worksheets were used to maintain product list, customer list and billing information they are not able to share data between each other. This E-billing system is used to overcome the entire problem which they are facing in older billing system, and making complete atomization of manual billing system.
ACKNOWLEDGEMENT
The work is an accomplishment for the project works under the invaluable guidance of Mr.V.D.MHASKE of department of Computer Engineering. Behind every success there is a source of inspiration. In our case, that source was our HOD MR.NIKHADE sir whose inspiration and encouragement led us to complete this assignment to our satisfaction. In spite of the busy schedule of department work they spend their valuable time for us and acted as a friend and guide. We also like to thank of staff member of our department and classmates for the help they provide us. Hence we drive a sense of satisfaction and pleasure in submitting this project. We would like sincerely thank our guide for their guidance and encouragement in completing this project. We are equally thankful to assistance who are directly or indirectly for developing the project. We are also thankful to the non teaching staff of our Computer Department for helping us in our project.
TABLE OF CONTENTS
Sr No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Contents Description of the Current System Limitation of the Current System Proposed System (Our System) Advantages of Proposed System Hardware and Software Requirements Entity-Relationship Diagram Data Flow Diagram Program List Table List Screenshot of Forms System Coding Screenshots of Report Conclusion and Future Enhancement Bibliography
PROPOSED SYSTEM
Customer comes in store and order for some products.Computer operator takes customers details such as customer name and customers contact number. Then computer operator creates bill of customer by adding product name and quantity. The amount will generate automatically by multiplication of quantity and rate of the product.Total amount will generate automatically by addition of amount of each product. Computer operator do not need of calculator to calculate the amount of the product. The person who is having the basic knowledge about the computer can operate computer easily.By simple clicking and editing text transactions can complete easily and faster.The computer operator can easily see the report and print it whenever he/she wants. The Security is further enhanced by giving separate privileges to Administrator & local user. The Administrator will be having all the rights whereas local user has limited functions. So if there are major changes to make only the administrator can perform it. Such as Backing up & Restoring database. The product details can be easily managed by local user to add new stock or updating existing stock details. We have provided some utilities to secure the data and application such as Restore, Backup, Change password. The Add/Modify store info Utility expand the capability of the Project And provides flexibility to the user by adding new store in the application this is the main advantage of our project which is not provided by traditional softwares. Here we can add more than one store and maintain the transactions of each store separately. Only one store will perform its operation at a time and the user can rapidly switch to another store and perform the operations associated with it.
OBJECTIVES OF E-BILLING
Add and maintain records of available products. Add and maintain customer details. Add and maintain description of new products. Add and maintain new entered category of products. Add and maintain transactions of more than one store. Provides economic/financial reports to the owner when he requested. Provides a convenient solution of billing pattern. Make an easy to use environment for users and customers.
Smart and simple. Large capacity of storage. Work is done at faster rate and speedy output is obtained. Quick response to any action performed. Searching of bill becomes easy. Calculation can be done faster and efficiently.
Security is enhanced using advanced development tools SQL and utilities like Backup and Restore.
10 GB Hard disk. P2, P3, P4 and other advance version processor. 128 MB of RAM.
SYSTEM REQUIREMENTS
Windows 98, or Windows 2000, or Windows NT, or Windows XP, or Windows VISTA
Rapid application development tool. Simplified packaging and deployment. Powerful & easy data access. Improved coding. Easy to design form.
Easy to use and deployment. Supported by windows OS. Centralized management. Reliability. Automating Tasks. Scalability. Provide more security.
10
ENTITY-RELATIONSHIP DIAGRAM
11
12
PROGRAM LIST
1. Frmsplash: - It is used as simple startup form which contains name of our Project. 2. frmlogin: - Provide access to Project only to authenticate user. The user login into application using password. 3. MDIForm1: - The main transactions start from this form. It is the main from that provide access to other forms. 4. Product_list: - It is used to add, modify or delete a product details from particular Retail Store or Shop. 5. Bill_frm: - Used to generate bills corresponding to that store and print it. 6. Bill_product: - It shows the stock of available products and enable user to enter the quantity that he wanted. The details then added to Bill form. 7. frmfind_bill: - Used to find the previous Bills stored in Database. It can also be act as Reports. The user can search Bills by Bill no., Customers name or Date that he specifies. 8. frmutility: - Provides utility tools such as backup database, restore database, change password that help to secure the data. 9. Backup: - User can take backup of database using this form. So you can store multiple copies of data.
13
10. Restore: - In case the database is corrupted or deleted then using this utility you can restore backup file. 11. Change_passwd: - This form enable user to change his password for security purpose. 12. Store_info: - Shows the number of stores present in application and its details. Users can also add/modify/delete store information. 13. frmchange_store: - If there are more than one store in application user can rapidly switch among the stores without logging out. 14. frmAbout_us: - Shows name of the Project Developer and Project Guide.
14
TABLE LIST
Database Name: - EBilling.sql
1.
Bill_Details:Column Name Bill_No Prod_nm Rate Qty Amount Data Type Primary Key Foreign Key int No No varchar No No float No No int No No float No No Size 70 -
2.
Bill_Info:Column Name Bill_No Bill_Date Cust_Name Cont_No Total_Amnt store_id Data Type Primary Key Foreign Key int Yes No varchar No No varchar No No varchar No No float No No int No No Size 15 30 13 -
3.
Log_in:Column Name user_nm passwd Data Type Primary Key Foreign Key varchar No No varchar No No Size 25 25
15
4.
Product_List:Column Name Prod_ID Prod_Type Prod_Name Rate Qty Store_ID Data Type Primary Key Foreign Key int Yes No varchar No No varchar No No float No No int No No int No No Size 30 70 -
5.
Store_Info:Column Name store_id Store_nm Addr City Pin Phno Data Type Primary Key Foreign Key int Yes No varchar No No varchar No No varchar No No int No No varchar No No Size 25 75 20 13
6.
Temp_Bill_Details:Column Name Product_Name Rate Quantity Amount Data Type Primary Key Foreign Key Size varchar No No 70 float No No int No No float No No -
16
7.
Temp_Bill_Info:Column Name Bill_No Bill_Date Cust_Name Cont_No Total_Amnt Data Type Primary Key Foreign Key int No No varchar No No varchar No No varchar No No float No No Size 15 30 13 -
17
SCREENSHOT OF FORMS
Frmsplash: -
Frmlogin: -
18
MDIForm1: -
Product_List: -
19
Bill_frm: -
20
Bill_product: -
21
FrmFind_bill: -
22
Frmutility: -
Backup: -
23
Restore: -
Change_passwd: -
24
Store_info: -
25
FrmChange_store: -
Frmabout_us: -
26
SYSTEM COADING
frmsplash
Private Sub Timer1_Timer() ProgressBar1.Value = ProgressBar1 + 1 Label5.Caption = ProgressBar1.Value & "%" If ProgressBar1.Value = 100 Then Unload Me frmLogin.Show End If End Sub Private Sub Timer2_Timer() If Label7.Visible = True Then Label7.Visible = False Else Label7.Visible = True End If End Sub
frmlogin
Option Explicit Public LoginSucceeded As Boolean Private Sub cmdcancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False End End Sub Private Sub cmdlogin_Click() 'check for correct password which is in database If Combo1.Text = "" Then MsgBox "Please select a Store Name from list..!", vbExclamation, "E-Billing" ElseIf Combo2.Text = "" Then MsgBox "Please select User Type from list..!", vbExclamation, "E-Billing"
27
ElseIf txtPassword.Text = "" Then MsgBox "Please Enter your Password..!", vbExclamation, "E-Billing" Else Dim pqr As String pqr = "select passwd from log_in where user_nm='" & Combo2.Text & "'" If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open pqr, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If txtPassword = Adodc2.Recordset("passwd") Then Me.Hide MDIForm1.Show Else MsgBox "Invalid Password, try again!", vbCritical, "Login Error" txtPassword.SetFocus End If End If End Sub Private Sub Combo1_Change() Combo3.Text = Combo1.Text Dim sql As String sql = "select store_id from store_info where store_nm='" & Combo3.Text & "'" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open sql, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If Adodc1.Recordset.RecordCount > 0 Then txtstore_id.Text = Adodc1.Recordset("store_id") Else txtstore_id.Text = "" End If End Sub Private Sub Combo1_Click() Combo1_Change End Sub Private Sub Combo2_Change() txtPassword.Text = ""
28
txtPassword.SetFocus End Sub Private Sub Combo2_Click() Combo2_Change End Sub Private Sub Form_Load() 'Enter store names in store name combo box to see the available stores txtstore_id.Text = "" Combo1.Clear Combo2.Clear txtPassword.Text = "" Dim abc As String abc = "select Store_nm from Store_info order by store_id" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc1.Recordset.EOF = False Combo1.AddItem Adodc1.Recordset("store_nm") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh Combo2.AddItem "Admin" Combo2.AddItem "User" End Sub
MDIForm1
Private Sub MDIForm_Activate() Label2.Caption = frmLogin.Combo1.Text End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button) If Button.Key = "exit" Then End ElseIf Button.Key = "product_list" Then product_list.Show
29
ElseIf Button.Key = "bill" Then bill_frm.Show ElseIf Button.Key = "utilities" Then frmutility.Show ElseIf Button.Key = "change_store" Then frmchange_store.Show ElseIf Button.Key = "logout" Then If MsgBox("Are You Sure You want to Logout?", vbYesNo + vbQuestion, "Logout") = vbYes Then Unload Me frmLogin.Show frmLogin.txtstore_id.Text = "" frmLogin.Combo1.Clear frmLogin.Combo2.Clear frmLogin.txtPassword.Text = "" Dim abc As String abc = "select Store_nm from Store_info order by store_id" If frmLogin.Adodc1.Recordset.State = adStateOpen Then frmLogin.Adodc1.Recordset.Close frmLogin.Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While frmLogin.Adodc1.Recordset.EOF = False frmLogin.Combo1.AddItem frmLogin.Adodc1.Recordset("store_nm") frmLogin.Adodc1.Recordset.MoveNext Wend frmLogin.Adodc1.Refresh frmLogin.Combo2.AddItem "Admin" frmLogin.Combo2.AddItem "User" Else: MDIForm1.Enabled = True End If Exit Sub ElseIf Button.Key = "about_us" Then frmabout_us.Show End If MDIForm1.Enabled = False End Sub
30
Product_List
Option Explicit Dim addedit As String Dim newPID As Integer Private Sub cancel_Click() save.Visible = False cancel.Visible = False cmdnew.Visible = True edit.Visible = True delete.Visible = True cmdclose.Visible = True Combo1.Enabled = True List1.Enabled = True Text1.Enabled = False Combo2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False DisplayRecord End Sub Private Sub Combo1_Change() Dim sql As String If frmLogin.txtstore_id.Text = "0" Then If Combo1.Text = "ALL" Then sql = "select Prod_Name from Product_List order by prod_ID" Else sql = "select Prod_Name from Product_List where Prod_Type='" & Combo1.Text & "' order by Prod_ID" End If Else If Combo1.Text = "ALL" Then sql = "select Prod_Name from Product_List where store_id='" & frmLogin.txtstore_id.Text & "' order by prod_ID" Else sql = "select Prod_Name from Product_List where Prod_Type='" & Combo1.Text & "' and store_id='" & frmLogin.txtstore_id.Text & "' order by Prod_ID" End If End If List1.Clear
31
If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open sql, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc1.Recordset.EOF = False List1.AddItem Adodc1.Recordset("prod_Name") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh If List1.ListCount > 0 Then List1.ListIndex = 0 DisplayRecord End If End Sub Private Sub Combo1_Click() Combo1_Change End Sub Private Sub cmdnew_Click() save.Visible = True cancel.Visible = True cmdnew.Visible = False edit.Visible = False delete.Visible = False cmdclose.Visible = False Combo1.Enabled = False List1.Enabled = False Text1.Enabled = False Combo2.Enabled = True Text3.Enabled = True Text4.Enabled = True Text5.Enabled = True Text1.Text = "" Combo2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" addedit = "ADD"
32
Dim abc As String If frmLogin.txtstore_id.Text = "0" Then abc = "select distinct Prod_Type from Product_List order by Prod_Type" Else abc = "select distinct Prod_Type from Product_List where store_id='" & frmLogin.txtstore_id.Text & "' order by Prod_Type" End If Combo2.Clear If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc1.Recordset.EOF = False Combo2.AddItem Adodc1.Recordset("Prod_Type") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh 'generate id automatically for new product If Adodc1.Recordset.RecordCount <= 0 Then Text1.Text = 1 Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select max(prod_id) +1 from Product_list", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic newPID = Adodc1.Recordset(0) Text1.Text = newPID End If End Sub Private Sub save_Click() 'check all the conditions in text box for new product If addedit = "ADD" Then If Combo2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Then MsgBox "Please Enter the values in all the Fields...!", vbExclamation ElseIf IsNumeric(Text4.Text) = False Then MsgBox "Enter Rate Numeric only...!", vbExclamation, "E-Billing"
33
ElseIf IsNumeric(Text5.Text) = False Then MsgBox "Enter Quantity Numeric only...!", vbExclamation, "E-Billing" 'all conditions are true now save the record Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from Product_list", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset.AddNew Adodc1.Recordset("Prod_ID") = Text1.Text Adodc1.Recordset("Prod_Type") = Combo2.Text Adodc1.Recordset("Prod_Name") = Text3.Text Adodc1.Recordset("Rate") = Val(Text4.Text) Adodc1.Recordset("Qty") = Val(Text5.Text) Adodc1.Recordset("store_id") = Val(frmLogin.txtstore_id.Text) Adodc1.Recordset.Update Adodc1.Refresh DisplayRecord MsgBox "Record saved successfully", vbInformation, "Success!" Unload Me product_list.Show save.Visible = False cancel.Visible = False cmdnew.Visible = True edit.Visible = True delete.Visible = True cmdclose.Visible = True Combo1.Enabled = True List1.Enabled = True Text1.Enabled = False Combo2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False End If 'check the condition for edit Else If Combo2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Then MsgBox "Please Enter the values in all the Fields...!", vbExclamation ElseIf IsNumeric(Text4.Text) = False Then MsgBox "Enter Rate Numeric only", vbExclamation, "E-Billing"
34
ElseIf IsNumeric(Text5.Text) = False Then MsgBox "Enter Quantity Numeric only", vbExclamation, "E-Billing" 'all conditions are true now save the updated record Else: If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select * from Product_List where Prod_ID=" & Val(Text1.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset("Prod_Type") = Combo2.Text Adodc1.Recordset("Prod_Name") = Text3.Text Adodc1.Recordset("Rate") = Val(Text4.Text) Adodc1.Recordset("Qty") = Val(Text5.Text) Adodc1.Recordset.Update MsgBox "Record updated successfully", vbInformation, "Success!" Unload Me product_list.Show save.Visible = False cancel.Visible = False cmdnew.Visible = True edit.Visible = True delete.Visible = True cmdclose.Visible = True Combo1.Enabled = True List1.Enabled = True Text1.Enabled = False Combo2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False End If End If End Sub Private Sub delete_Click() If Text1.Text = "" Then MsgBox "Please select a product that you want to remove...!", vbInformation, "Operation Not Allowed" Else: If MsgBox("Are you sure, you want to delete the product ?", vbQuestion + vbYesNo, "E-Billing") = vbYes Then If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close
35
Adodc1.Recordset.Open "select * from Product_List where Prod_ID=" & Val(Text1.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset.delete Adodc1.Refresh Unload Me product_list.Show MsgBox "Record Deleted Successfully...!", vbInformation, "Success!" DisplayRecord End If End If End Sub Private Sub edit_Click() If Text1.Text = "" Then MsgBox "Please select a product that you want to edit...!", vbInformation, "Operation Not Allowed" Else: If edit.Value = True Then save.Visible = True cancel.Visible = True cmdnew.Visible = False edit.Visible = False delete.Visible = False cmdclose.Visible = False Combo1.Enabled = False List1.Enabled = False Combo2.Enabled = True Text3.Enabled = True Text4.Enabled = True Text5.Enabled = True addedit = "EDIT" Dim abc As String If frmLogin.txtstore_id.Text = "0" Then abc = "select distinct Prod_Type from Product_List order by Prod_Type" Else abc = "select distinct Prod_Type from Product_List where store_id='" & frmLogin.txtstore_id.Text & "' order by Prod_Type" End If If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close
36
Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc1.Recordset.EOF = False Combo2.AddItem Adodc1.Recordset("Prod_Type") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh End If End If End Sub Private Sub cmdclose_Click() MDIForm1.Enabled = True Unload Me MDIForm1.Show End Sub Private Sub DisplayRecord() Dim sql As String sql = "select * from Product_List where Prod_Name='" & List1.Text & "' " If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open sql, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If Adodc1.Recordset.RecordCount > 0 Then Text1.Text = Adodc1.Recordset("Prod_ID") Combo2.Text = Adodc1.Recordset("Prod_Type") Text3.Text = Adodc1.Recordset("Prod_Name") Text4.Text = Adodc1.Recordset("Rate") Text5.Text = Adodc1.Recordset("Qty") Else Text1.Text = "" Combo2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" End If End Sub Private Sub Form_Load() Dim abc As String If frmLogin.txtstore_id.Text = "0" Then
37
abc = "select distinct Prod_Type from Product_List order by Prod_Type" Else abc = "select distinct Prod_Type from Product_List where store_id='" & frmLogin.txtstore_id.Text & "' order by Prod_Type" End If Combo1.Clear Combo1.AddItem "ALL" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc1.Recordset.EOF = False Combo1.AddItem Adodc1.Recordset("Prod_Type") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh End Sub Private Sub List1_Click() DisplayRecord End Sub
Bill_frm
Private Sub addproduct_Click() bill_product.Show bill_frm.Enabled = False End Sub Private Sub cancel_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" new_bill.Visible = True cmdclose.Visible = True cmdfind.Visible = True addproduct.Visible = False
38
remove_prd.Visible = False save.Visible = False cancel.Visible = False print_bill.Visible = False cmddel.Visible = False Label6.Caption = "0" If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open "truncate table temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly Text3.Locked = True Text4.Locked = True End Sub Private Sub cmdclose_Click() If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open "truncate table temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly MDIForm1.Enabled = True Unload Me End Sub Private Sub cmddel_Click() If Text1.Text = "" Then MsgBox "Please select or find the bill to be deleted..!", vbInformation, "E-Billing" Exit Sub End If If MsgBox("Are you sure, you want to delete all the Bill details..?", vbQuestion + vbYesNo, "E-Billing") = vbYes Then If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select * from bill_info where bill_no=" & Val(Text1.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset.delete Adodc1.Refresh If Adodc3.Recordset.State = adStateOpen Then Adodc3.Recordset.Close Adodc3.Recordset.Open "delete from bill_details where bill_no=" & Val(Text1.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security
39
Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc3.Refresh If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open "truncate table temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly Text3.Locked = True Text4.Locked = True Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Label6.Caption = "0" MsgBox "Bill Deleted Successfully...!", vbInformation, "Success!" End If End Sub Private Sub cmdfind_Click() If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open "truncate table temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly Frmfind_bill.Show bill_frm.Enabled = False End Sub Private Sub Form_Load() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Label7.Caption = frmLogin.Combo3.Text cmddel.Visible = False End Sub Private Sub new_bill_Click() Text3.Locked = False Text4.Locked = False Text1.Text = ""
40
Text2.Text = Date Text3.Text = "" Text4.Text = "" Label6.Caption = "0" print_bill.Visible = False new_bill.Visible = False addproduct.Visible = True remove_prd.Visible = True save.Visible = True cancel.Visible = True cmdclose.Visible = False cmdfind.Visible = False cmddel.Visible = False If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open "truncate table temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly Dim sql As String sql = "select *from temp_Bill_Details" Adodc2.CommandType = adCmdText Adodc2.RecordSource = sql Adodc2.Refresh Set DataGrid1.DataSource = Adodc2 If Adodc1.Recordset.RecordCount <= 0 Then Text1.Text = 1 Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select max(bill_no) +1 from bill_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Text1.Text = Adodc1.Recordset(0) End If Dim abc As String abc = "select *from bill_details" Adodc3.CommandType = adCmdText Adodc3.RecordSource = abc Adodc3.Refresh End Sub
41
Private Sub print_bill_Click() Dim strselect As String Me.CrystalReport1.Reset Me.CrystalReport1.DiscardSavedData = True Me.CrystalReport1.WindowState = crptMaximized Me.CrystalReport1.WindowShowRefreshBtn = True Me.CrystalReport1.ReportFileName = App.Path & "\Report1.rpt" Me.CrystalReport1.Connect = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS" strselect = "{bill_info.Bill_No} = " & Text1.Text & "" Me.CrystalReport1.ReplaceSelectionFormula (strselect) Me.CrystalReport1.Action = 1 End Sub Private Sub remove_prd_Click() If Adodc2.Recordset.RecordCount = 1 Then Label6.Caption = "0" Adodc2.Recordset.delete remove_prd.Enabled = False Else Adodc2.Recordset.delete If bill_frm.Adodc2.Recordset.State = adStateOpen Then bill_frm.Adodc2.Recordset.Close bill_frm.Adodc2.Recordset.Open "select sum(amount) from temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic bill_frm.Label6.Caption = bill_frm.Adodc2.Recordset(0) Dim sql As String sql = "select *from temp_Bill_Details" bill_frm.Adodc2.CommandType = adCmdText bill_frm.Adodc2.RecordSource = sql bill_frm.Adodc2.Refresh Set bill_frm.DataGrid1.DataSource = bill_frm.Adodc2 End If End Sub Private Sub save_Click() If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
42
MsgBox "Please enter values in all the fields..!", vbInformation, "ERROR" ElseIf IsNumeric(Text4.Text) = False Then MsgBox "Enter contact number numeric only..!", vbExclamation, "E-Billing" ElseIf Label6.Caption = "0" Then MsgBox "There are no products in the bill..!", vbInformation, "E-Billing" Else: If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from bill_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset.AddNew Adodc1.Recordset("bill_no") = Text1.Text Adodc1.Recordset("bill_date") = Text2.Text Adodc1.Recordset("cust_name") = Text3.Text Adodc1.Recordset("cont_no") = Text4.Text Adodc1.Recordset("total_amnt") = Label6.Caption Adodc1.Recordset("store_id") = frmLogin.txtstore_id.Text Adodc1.Recordset.Update If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close Adodc2.Recordset.Open "select *from temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc2.Recordset.EOF = False Adodc3.Recordset.AddNew Adodc3.Recordset("bill_no") = Val(Text1.Text) Adodc3.Recordset("prod_nm") = Adodc2.Recordset("product_name") Adodc3.Recordset("rate") = Adodc2.Recordset("rate") Adodc3.Recordset("qty") = Adodc2.Recordset("quantity") Adodc3.Recordset("amount") = Adodc2.Recordset("amount") Adodc3.Recordset.Update Adodc2.Recordset.MoveNext Wend Dim prd As String Adodc2.Recordset.MoveFirst While Adodc2.Recordset.EOF = False
43
prd = "select *from product_list where prod_name='" & Adodc2.Recordset("product_name") & "'" If bill_product.Adodc1.Recordset.State = adStateOpen Then bill_product.Adodc1.Recordset.Close bill_product.Adodc1.Recordset.Open prd, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic bill_product.Adodc1.Recordset("qty") = Val(bill_product.Adodc1.Recordset("qty") - Adodc2.Recordset("quantity")) bill_product.Adodc1.Recordset.Update Adodc2.Recordset.MoveNext Wend Set DataGrid1.DataSource = Adodc2 MsgBox "Bill saved successfully!", vbInformation, "Success" new_bill.Visible = True addproduct.Visible = False save.Visible = False print_bill.Visible = True remove_prd.Visible = False cancel.Visible = False cmdclose.Visible = True cmdfind.Visible = True Text3.Locked = True Text4.Locked = True End If End Sub
Bill_product
Private Sub Combo1_Change() Dim sql As String If frmLogin.txtstore_id.Text = "0" Then If Combo1.Text = "ALL" Then sql = "select Prod_Name from Product_List order by prod_ID" Else sql = "select Prod_Name from Product_List where Prod_Type='" & Combo1.Text & "' order by Prod_ID" End If Else If Combo1.Text = "ALL" Then
44
sql = "select Prod_Name from Product_List where store_id='" & frmLogin.txtstore_id.Text & "' order by prod_ID" Else sql = "select Prod_Name from Product_List where Prod_Type='" & Combo1.Text & "' order by Prod_ID" End If End If List1.Clear If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open sql, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly While Adodc1.Recordset.EOF = False List1.AddItem Adodc1.Recordset("prod_Name") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh If List1.ListCount > 0 Then List1.ListIndex = 0 DisplayRecord End If Text4.SetFocus End Sub Private Sub Combo1_Click() Combo1_Change End Sub Private Sub Command1_Click() Dim flag As Integer flag = 0 If Text1.Text = "" Then MsgBox "Please Select the Product That you want", vbInformation, "EBilling" ElseIf Text4.Text = "" Then MsgBox "Please Enter the quantity of product that you want!", vbOKOnly + vbInformation, "EBilling" Text4.SetFocus
45
ElseIf IsNumeric(Text4.Text) = False Then MsgBox "Enter Quantity, numeric only!", vbExclamation, "EBilling" Text4.SetFocus ElseIf Val(Text4.Text) > Val(Text3.Text) Then MsgBox "The Quantity you have selected is not available!", vbExclamation, "EBilling" Text4.SetFocus Else If bill_frm.Adodc2.Recordset.State = adStateOpen Then bill_frm.Adodc2.Recordset.Close bill_frm.Adodc2.Recordset.Open "select *from temp_Bill_Details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic bill_frm.Enabled = True If bill_frm.Adodc2.Recordset.RecordCount = 0 Then GoTo abc: bill_frm.Adodc2.Recordset.MoveFirst While bill_frm.Adodc2.Recordset.EOF = False If bill_frm.Adodc2.Recordset("Product_Name") = Text1.Text Then If MsgBox("The Product that you want is already in the list.Do you want to change it's Quantity..?", vbQuestion + vbYesNo, "E-Billing") = vbYes Then bill_frm.Adodc2.Recordset("Quantity") = Val(Text4.Text) bill_frm.Adodc2.Recordset("Amount") = Val(Text2.Text * Text4.Text) bill_frm.Adodc2.Recordset.Update flag = 1 Else Unload Me flag = 1 End If End If bill_frm.Adodc2.Recordset.MoveNext Wend abc: If flag = 0 Then bill_frm.Adodc2.Recordset.AddNew bill_frm.Adodc2.Recordset("Product_Name") = Text1.Text bill_frm.Adodc2.Recordset("Rate") = Val(Text2.Text) bill_frm.Adodc2.Recordset("Quantity") = Val(Text4.Text) bill_frm.Adodc2.Recordset("Amount") = Val(Text2.Text * Text4.Text)
46
bill_frm.Adodc2.Recordset.Update End If bill_frm.remove_prd.Enabled = True If bill_frm.Adodc2.Recordset.State = adStateOpen Then bill_frm.Adodc2.Recordset.Close bill_frm.Adodc2.Recordset.Open "select sum(amount) from temp_bill_details", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic bill_frm.Label6.Caption = bill_frm.Adodc2.Recordset(0) Dim sql As String sql = "select *from temp_Bill_Details" bill_frm.Adodc2.CommandType = adCmdText bill_frm.Adodc2.RecordSource = sql bill_frm.Adodc2.Refresh Set bill_frm.DataGrid1.DataSource = bill_frm.Adodc2 Unload Me End If End Sub Private Sub Command2_Click() bill_frm.Enabled = True Unload Me End Sub Private Sub Form_Load() Dim abc As String If frmLogin.txtstore_id.Text = "0" Then abc = "select distinct Prod_Type from Product_List order by Prod_Type" Else abc = "select distinct Prod_Type from Product_List where store_id='" & frmLogin.txtstore_id.Text & "' order by Prod_Type" End If Combo1.Clear Combo1.AddItem "ALL" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly
47
While Adodc1.Recordset.EOF = False Combo1.AddItem Adodc1.Recordset("Prod_Type") Adodc1.Recordset.MoveNext Wend Adodc1.Refresh End Sub Private Sub DisplayRecord() Dim sql As String sql = "select Prod_Name,Rate,Qty from Product_List where Prod_Name='" & List1.Text & "' " If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open sql, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly If Adodc1.Recordset.RecordCount > 0 Then Text1.Text = Adodc1.Recordset("Prod_Name") Text2.Text = Adodc1.Recordset("Rate") Text3.Text = Adodc1.Recordset("Qty") Else Text1.Text = "" Text2.Text = "" Text3.Text = "" End If End Sub Private Sub List1_Click() DisplayRecord Text4.SetFocus End Sub
FrmFind_bill
Private Sub Calendar1_Click() Text3.Text = Calendar1.Value End Sub Private Sub Check1_Click() If Check1.Value = 1 Then Label3.Visible = True
48
Text2.Visible = True Text2.Text = "" Text2.SetFocus Else Label3.Visible = False Text2.Visible = False Text2.Text = "" End If CallCheck End Sub Private Sub CallCheck() If Check1.Value = 1 And Check2.Value = 1 And Text2.Text <> "" And Text3.Text <> "" Then find_bill.Enabled = True ElseIf Check1.Value = 1 And Text2.Text <> "" And Check2.Value = 0 Then find_bill.Enabled = True ElseIf Check2.Value = 1 And Text3.Text <> "" And Check1.Value = 0 Then find_bill.Enabled = True Else find_bill.Enabled = False End If End Sub Private Sub Check2_Click() If Check2.Value = 1 Then Label4.Visible = True Label5.Visible = True Text3.Visible = True Text3.Text = "" Calendar1.Visible = True Else Label4.Visible = False Label5.Visible = False Text3.Visible = False Text3.Text = "" Calendar1.Visible = False End If CallCheck End Sub Private Sub get_bill1_Click()
49
If IsNumeric(Text1.Text) = False Then MsgBox "Enter the bill number numeric only..!" Text1.SetFocus Exit Sub End If If bill_frm.Adodc1.Recordset.State = adStateOpen Then bill_frm.Adodc1.Recordset.Close bill_frm.Adodc1.Recordset.Open "select *from bill_info where bill_no=" & Text1.Text, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If bill_frm.Adodc1.Recordset.RecordCount = 0 Then MsgBox "No bill found..!", vbExclamation, "E-Billing" Text1.SetFocus Else bill_frm.Text1.Text = bill_frm.Adodc1.Recordset("bill_no") bill_frm.Text2.Text = bill_frm.Adodc1.Recordset("bill_date") bill_frm.Text3.Text = bill_frm.Adodc1.Recordset("cust_name") bill_frm.Text4.Text = bill_frm.Adodc1.Recordset("cont_no") bill_frm.Label6.Caption = bill_frm.Adodc1.Recordset("total_amnt") Dim sql As String sql = "select *from temp_Bill_Details" bill_frm.Adodc2.CommandType = adCmdText bill_frm.Adodc2.RecordSource = sql bill_frm.Adodc2.Refresh Set bill_frm.DataGrid1.DataSource = bill_frm.Adodc2 If bill_frm.Adodc3.Recordset.State = adStateOpen Then bill_frm.Adodc3.Recordset.Close bill_frm.Adodc3.Recordset.Open "select *from bill_details where bill_no=" & Text1.Text, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While bill_frm.Adodc3.Recordset.EOF = False bill_frm.Adodc2.Recordset.AddNew bill_frm.Adodc2.Recordset("Product_name") = bill_frm.Adodc3.Recordset("Prod_nm") bill_frm.Adodc2.Recordset("Rate") = bill_frm.Adodc3.Recordset("Rate") bill_frm.Adodc2.Recordset("Quantity") = bill_frm.Adodc3.Recordset("qty") bill_frm.Adodc2.Recordset("Amount") = bill_frm.Adodc3.Recordset("amount") bill_frm.Adodc2.Recordset.Update
50
bill_frm.Adodc3.Recordset.MoveNext Wend bill_frm.Enabled = True Unload Me bill_frm.cmddel.Visible = True bill_frm.new_bill.Visible = True bill_frm.print_bill.Visible = True bill_frm.cmdclose.Visible = True End If End Sub Private Sub find_bill_Click() Dim abc As String If frmLogin.txtstore_id.Text = "0" Then If Text2.Text <> "" And Text3.Text <> "" Then abc = "select *from bill_info where cust_name='" & Text2.Text & "' and bill_date='" & Text3.Text & "'" ElseIf Text2.Text = "" Then abc = "select *from bill_info where bill_date='" & Text3.Text & "'" Else abc = "select *from bill_info where cust_name='" & Text2.Text & "'" End If Else If Text2.Text <> "" And Text3.Text <> "" Then abc = "select *from bill_info where cust_name='" & Text2.Text & "' and bill_date='" & Text3.Text & "' and store_id ='" & frmLogin.txtstore_id.Text & "'" ElseIf Text2.Text = "" Then abc = "select *from bill_info where bill_date='" & Text3.Text & "' and store_id ='" & frmLogin.txtstore_id.Text & "'" Else abc = "select *from bill_info where cust_name='" & Text2.Text & "' and store_id ='" & frmLogin.txtstore_id.Text & "'" End If End If If bill_frm.Adodc1.Recordset.State = adStateOpen Then bill_frm.Adodc1.Recordset.Close bill_frm.Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If bill_frm.Adodc1.Recordset.RecordCount = 0 Then Label6.Visible = False
51
Label7.Visible = False Label8.Visible = False Label9.Visible = False close1.Visible = True get_bill2.Visible = False close2.Visible = False Me.Height = 5640 Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 MsgBox "No bill found..!", vbExclamation, "E-Billing" ElseIf bill_frm.Adodc1.Recordset.RecordCount = 1 Then bill_frm.Text1.Text = bill_frm.Adodc1.Recordset("bill_no") bill_frm.Text2.Text = bill_frm.Adodc1.Recordset("bill_date") bill_frm.Text3.Text = bill_frm.Adodc1.Recordset("cust_name") bill_frm.Text4.Text = bill_frm.Adodc1.Recordset("cont_no") bill_frm.Label6.Caption = bill_frm.Adodc1.Recordset("total_amnt") Dim sql As String sql = "select *from temp_Bill_Details" bill_frm.Adodc2.CommandType = adCmdText bill_frm.Adodc2.RecordSource = sql bill_frm.Adodc2.Refresh Set bill_frm.DataGrid1.DataSource = bill_frm.Adodc2 If bill_frm.Adodc3.Recordset.State = adStateOpen Then bill_frm.Adodc3.Recordset.Close bill_frm.Adodc3.Recordset.Open "select *from bill_details where bill_no=" & bill_frm.Text1.Text, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While bill_frm.Adodc3.Recordset.EOF = False bill_frm.Adodc2.Recordset.AddNew bill_frm.Adodc2.Recordset("Product_name") = bill_frm.Adodc3.Recordset("Prod_nm") bill_frm.Adodc2.Recordset("Rate") = bill_frm.Adodc3.Recordset("Rate") bill_frm.Adodc2.Recordset("Quantity") = bill_frm.Adodc3.Recordset("qty") bill_frm.Adodc2.Recordset("Amount") = bill_frm.Adodc3.Recordset("amount") bill_frm.Adodc2.Recordset.Update bill_frm.Adodc3.Recordset.MoveNext Wend bill_frm.Enabled = True Unload Me
52
bill_frm.cmddel.Visible = True bill_frm.new_bill.Visible = True bill_frm.print_bill.Visible = True bill_frm.cmdclose.Visible = True Else If Adodc1_findbill.Recordset.State = adStateOpen Then Adodc1_findbill.Recordset.Close Adodc1_findbill.Recordset.Open "truncate table temp_bill_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly Dim pqr As String pqr = "select *from temp_Bill_info" Adodc1_findbill.CommandType = adCmdText Adodc1_findbill.RecordSource = pqr Adodc1_findbill.Refresh Set DataGrid1.DataSource = Adodc1_findbill DataGrid1.Visible = True While bill_frm.Adodc1.Recordset.EOF = False Adodc1_findbill.Recordset.AddNew Adodc1_findbill.Recordset("bill_no") = bill_frm.Adodc1.Recordset("bill_no") Adodc1_findbill.Recordset("bill_date") = bill_frm.Adodc1.Recordset("bill_date") Adodc1_findbill.Recordset("cust_name") = bill_frm.Adodc1.Recordset("cust_name") Adodc1_findbill.Recordset("cont_no") = bill_frm.Adodc1.Recordset("cont_no") Adodc1_findbill.Recordset("total_amnt") = bill_frm.Adodc1.Recordset("total_amnt") Adodc1_findbill.Recordset.Update bill_frm.Adodc1.Recordset.MoveNext Wend Adodc1_findbill.Recordset.MoveFirst Label6.Visible = True Label7.Visible = True Label7.Caption = Adodc1_findbill.Recordset.RecordCount Label8.Visible = True Label9.Visible = True close1.Visible = False get_bill2.Visible = True close2.Visible = True Me.Height = 9030
53
Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 End If End Sub Private Sub close1_Click() If Adodc1_findbill.Recordset.State = adStateOpen Then Adodc1_findbill.Recordset.Close Adodc1_findbill.Recordset.Open "truncate table temp_bill_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly bill_frm.Enabled = True bill_frm.Text1.Text = "" bill_frm.Text2.Text = "" bill_frm.Text3.Text = "" bill_frm.Text4.Text = "" bill_frm.Label6.Caption = "0" Unload Me End Sub Private Sub get_bill2_Click() Text1.Text = Adodc1_findbill.Recordset("bill_no") If Text1.Text = "" Then MsgBox "Please Select one Record from list..!To Select Record click on the row..!", vbExclamation, "E - Billing" Else If Adodc1_findbill.Recordset.State = adStateOpen Then Adodc1_findbill.Recordset.Close Adodc1_findbill.Recordset.Open "truncate table temp_bill_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly get_bill1_Click End If End Sub Private Sub close2_Click() If Adodc1_findbill.Recordset.State = adStateOpen Then Adodc1_findbill.Recordset.Close Adodc1_findbill.Recordset.Open "truncate table temp_bill_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenStatic, adLockReadOnly
54
bill_frm.Enabled = True bill_frm.Text1.Text = "" bill_frm.Text2.Text = "" bill_frm.Text3.Text = "" bill_frm.Text4.Text = "" bill_frm.Label6.Caption = "0" Unload Me End Sub Private Sub DataGrid1_Click() Text1.Text = Adodc1_findbill.Recordset("bill_no") End Sub Private Sub Form_Load() Me.Height = 5640 Dim abc As String abc = "select *from bill_details" bill_frm.Adodc3.CommandType = adCmdText bill_frm.Adodc3.RecordSource = abc bill_frm.Adodc3.Refresh Option1.Value = "0" Option2.Value = "0" End Sub Private Sub Option1_Click() Frame1.Visible = True Frame2.Visible = False Check1.Value = 0 Check2.Value = 0 Text1.SetFocus Text1.Text = "" If Text1.Text = "" Then get_bill1.Enabled = False Else get_bill1.Enabled = True End If Label6.Visible = False Label7.Visible = False Label8.Visible = False Label9.Visible = False close1.Visible = True get_bill2.Visible = False
55
close2.Visible = False Me.Height = 5640 Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 End Sub Private Sub Option2_Click() Frame2.Visible = True Frame1.Visible = False End Sub Private Sub Text1_Change() If Text1.Text = "" Then get_bill1.Enabled = False Else get_bill1.Enabled = True End If End Sub Private Sub Text2_Change() CallCheck End Sub Private Sub Text3_Change() CallCheck End Sub
frmutility
Private Sub Command1_Click() backup.Show frmutility.Enabled = False End Sub Private Sub Command2_Click() restore.Show frmutility.Enabled = False End Sub Private Sub Command3_Click()
56
change_passwd.Show frmutility.Enabled = False End Sub Private Sub Command4_Click() store_info.Show frmutility.Enabled = False End Sub Private Sub Command5_Click() MDIForm1.Enabled = True MDIForm1.Show Unload Me End Sub Private Sub Form_Load() If frmLogin.Combo2.Text = "User" Then Command1.Enabled = False Command2.Enabled = False Else Command1.Enabled = True Command2.Enabled = True End If If frmLogin.txtstore_id = 0 And frmLogin.Combo2.Text = "Admin" Then Command4.Enabled = True Else Command4.Enabled = False End If End Sub
Backup
Option Explicit Dim fs As New FileSystemObject Private Sub Command2_Click() On Error GoTo myer1 Label3.Visible = True Label4.Visible = True ProgressBar1.Visible = True
57
fs.CopyFile App.Path & "\EBilling.sql", "C:\EBilling.bak", False Timer1.Enabled = True Timer1_Timer Exit Sub myer1: '>> check the folder if the file alreday exist for overwrite If Err.Number = 58 Then If MsgBox("File Allready exist in same name , do you want to overwrite the existing file ..", vbExclamation + vbYesNo + vbDefaultButton1) = vbYes Then fs.CopyFile App.Path & "\EBilling.sql", "C:\EBilling.bak", True Label3.Visible = True Label4.Visible = True ProgressBar1.Visible = True Timer1.Enabled = True Timer1_Timer End If Else MsgBox "Can not complete backup following error occured : " & Err.Description, vbCritical End If End Sub Private Sub Command3_Click() frmutility.Enabled = True Unload Me End Sub Private Sub Form_Load() Timer1.Enabled = False '>>> center the form Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2 End Sub Private Sub Timer1_Timer() ProgressBar1.Value = ProgressBar1 + 1 Label4.Caption = ProgressBar1.Value & "%" If ProgressBar1.Value = 100 Then Unload Me frmutility.Enabled = True frmutility.Show MsgBox "Backup Process Completed successfully...!", vbInformation End If
58
End Sub
Restore
Option Explicit Dim fs As New FileSystemObject Private Sub cancel_Click() frmutility.Enabled = True Unload Me End Sub Private Sub Form_Load() Timer1.Enabled = False End Sub Private Sub restore_Click() On Error GoTo myer1 If fs.FileExists("C:\EBilling.bak") = False Then MsgBox "Could not find any Backup file to Restore..!", vbCritical, "E-Billing" Exit Sub End If Label1.Visible = True Label2.Visible = True ProgressBar1.Visible = True fs.CopyFile "C:\EBilling.bak", App.Path & "\EBilling.sql", False Timer1.Enabled = True Timer1_Timer Exit Sub myer1: '>> check the folder if the file alreday exist warn for overwrite If Err.Number = 58 Then If MsgBox("File Allready exist in same name , do you want to overwrite the existing file ..", vbExclamation + vbYesNo + vbDefaultButton1) = vbYes Then fs.CopyFile "C:\EBilling.bak", App.Path & "\EBilling.sql", True Label1.Visible = True Label2.Visible = True ProgressBar1.Visible = True Timer1.Enabled = True Timer1_Timer End If Else
59
MsgBox "Can not complete backup following error occured : " & Err.Description, vbCritical End If End Sub Private Sub Timer1_Timer() ProgressBar1.Value = ProgressBar1 + 1 Label2.Caption = ProgressBar1.Value & "%" If ProgressBar1.Value = 100 Then Unload Me frmutility.Enabled = True frmutility.Show MsgBox "Database Restored successfully...!", vbInformation End If End Sub
Change_passwd
Private Sub cmdok_Click() If Text1.Text = "" Then MsgBox "Please enter your old Password..!", vbExclamation, "E-Billing" Text1.SetFocus Else Dim pqr As String pqr = "select passwd from log_in where user_nm='" & frmLogin.Combo2.Text & "'" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open pqr, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If Text1.Text <> Adodc1.Recordset("passwd") Then MsgBox "Your old password is incorrect..!", vbExclamation, "E-billing" Text1.SetFocus ElseIf Text2.Text = "" Then MsgBox "Please enter your new Password..!", vbExclamation, "E-Billing" Text2.SetFocus
60
ElseIf Text2.Text <> Text3.Text Then MsgBox "Confirm Password doesn't match.Please re-type your new password..!", vbExclamation, "E-Billing" Text3.SetFocus Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open pqr, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset("passwd") = Text2.Text Adodc1.Recordset.Update MsgBox "Password Changed Successfully..!", vbInformation, "Success" frmutility.Enabled = True Unload Me End If End If End Sub Private Sub cancel_Click() frmutility.Enabled = True Unload Me End Sub
Store_info
Option Explicit Dim newSID As String Dim addedit As String Private Sub Command2_Click() If Adodc1.Recordset.AbsolutePosition > 1 Then Adodc1.Recordset.MovePrevious Else MsgBox "First Record ..", vbInformation Adodc1.Recordset.MoveFirst End If End Sub Private Sub cmdcancel_Click() first.Visible = True movpre.Visible = True
61
movnext.Visible = True last.Visible = True cmdnew.Visible = True cmdedit.Visible = True cmddel.Visible = True cmdcls.Visible = True cmdsave.Visible = False cmdcancel.Visible = False If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from store_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic display_store Text2.Locked = True Text3.Locked = True Text4.Locked = True Text5.Locked = True Text6.Locked = True Frame1.Caption = "" End Sub Private Sub cmdcls_Click() frmutility.Enabled = True Unload Me End Sub Private Sub cmddel_Click() If MsgBox("Are you sure, you want to delete all the Store details..? The Products that the store contains will also be deleted...", vbQuestion + vbYesNo, "E-Billing") = vbYes Then If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select * from store_info where store_ID=" & Val(Text1.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset.delete Adodc1.Refresh Text7.Text = Text1.Text Frame1.Caption = "" If Adodc2.Recordset.State = adStateOpen Then Adodc2.Recordset.Close
62
Adodc2.Recordset.Open "delete from Product_list where store_ID=" & Val(Text7.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc2.Refresh MsgBox "Operation Completed Successfully...!", vbInformation, "Success!" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from store_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic display_store End If End Sub Private Sub cmdedit_Click() Text2.Locked = False Text3.Locked = False Text4.Locked = False Text5.Locked = False Text6.Locked = False first.Visible = False movpre.Visible = False movnext.Visible = False last.Visible = False cmdnew.Visible = False cmdedit.Visible = False cmddel.Visible = False cmdcls.Visible = False cmdsave.Visible = True cmdcancel.Visible = True Frame1.Caption = "Please Enter The Information Below" addedit = "EDIT" End Sub Private Sub cmdnew_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = ""
63
Text2.Locked = False Text3.Locked = False Text4.Locked = False Text5.Locked = False Text6.Locked = False first.Visible = False movpre.Visible = False movnext.Visible = False last.Visible = False cmdnew.Visible = False cmdedit.Visible = False cmddel.Visible = False cmdcls.Visible = False cmdsave.Visible = True cmdcancel.Visible = True addedit = "ADD" Frame1.Caption = "Please Enter The Information Below" 'generate id automatically for new store If Adodc1.Recordset.RecordCount <= 0 Then Text1.Text = 1 Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select max(store_id) +1 from store_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Text1.Text = Adodc1.Recordset(0) End If End Sub Private Sub cmdsave_Click() 'save the new store If addedit = "ADD" Then If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Then MsgBox "Please enter the information in all the Fields..!", vbExclamation, "EBilling" ElseIf IsNumeric(Text5.Text) = False Then MsgBox "Enter Pin code Numeric only...!", vbExclamation, "E-Billing" ElseIf IsNumeric(Text6.Text) = False Then
64
MsgBox "Enter Contact No. Numeric only...!", vbExclamation, "E-Billing" Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from store_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset.AddNew Adodc1.Recordset("store_id") = Text1.Text Adodc1.Recordset("store_nm") = Text2.Text Adodc1.Recordset("addr") = Text3.Text Adodc1.Recordset("city") = Text4.Text Adodc1.Recordset("pin") = Text5.Text Adodc1.Recordset("phno") = Text6.Text Adodc1.Recordset.Update MsgBox "Record saved Successfully..!", vbInformation, "Operation Successful" first.Visible = True movpre.Visible = True movnext.Visible = True last.Visible = True cmdnew.Visible = True cmdedit.Visible = True cmddel.Visible = True cmdcls.Visible = True cmdsave.Visible = False cmdcancel.Visible = False Text2.Locked = True Text3.Locked = True Text4.Locked = True Text5.Locked = True Text6.Locked = True Frame1.Caption = "" display_store End If Else 'save the updated store information
65
If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Then MsgBox "Please enter the information in all the Fields..!", vbExclamation, "EBilling" ElseIf IsNumeric(Text5.Text) = False Then MsgBox "Enter Pin code Numeric only...!", vbExclamation, "E-Billing" ElseIf IsNumeric(Text6.Text) = False Then MsgBox "Enter Contact No. Numeric only...!", vbExclamation, "E-Billing" Else If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from store_info where store_id=" & Val(Text1.Text), "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic Adodc1.Recordset("store_nm") = Text2.Text Adodc1.Recordset("addr") = Text3.Text Adodc1.Recordset("city") = Text4.Text Adodc1.Recordset("pin") = Text5.Text Adodc1.Recordset("phno") = Text6.Text Adodc1.Recordset.Update Adodc1.Refresh MsgBox "Record Updated Successfully..!", vbInformation, "Operation Successful" first.Visible = True movpre.Visible = True movnext.Visible = True last.Visible = True cmdnew.Visible = True cmdedit.Visible = True cmddel.Visible = True cmdcls.Visible = True cmdsave.Visible = False cmdcancel.Visible = False Text2.Locked = True Text3.Locked = True Text4.Locked = True Text5.Locked = True Text6.Locked = True
66
display_store End If End If End Sub Private Sub first_Click() If Adodc1.Recordset.RecordCount <= 0 Then Exit Sub Adodc1.Recordset.MoveFirst display_store End Sub Private Sub Form_Load() cmdsave.Visible = False cmdcancel.Visible = False If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open "select *from store_info", "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL-176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic display_store End Sub Private Sub display_store() If Adodc1.Recordset.RecordCount > 0 Then Text1.Text = Adodc1.Recordset("store_id") Text2.Text = Adodc1.Recordset("store_nm") Text3.Text = Adodc1.Recordset("addr") Text4.Text = Adodc1.Recordset("city") Text5.Text = Adodc1.Recordset("pin") Text6.Text = Adodc1.Recordset("phno") Else Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" End If If Text1.Text = "0" Then cmddel.Visible = False Else: cmddel.Visible = True
67
End If End Sub Private Sub last_Click() If Adodc1.Recordset.RecordCount <= 0 Then Exit Sub Adodc1.Recordset.MoveLast display_store End Sub Private Sub movnext_Click() If Adodc1.Recordset.AbsolutePosition < Adodc1.Recordset.RecordCount Then Adodc1.Recordset.MoveNext display_store Else MsgBox "Last Record ..", vbInformation Adodc1.Recordset.MoveLast display_store End If End Sub Private Sub movpre_Click() If Adodc1.Recordset.AbsolutePosition > 1 Then Adodc1.Recordset.MovePrevious display_store Else MsgBox "First Record ..", vbInformation Adodc1.Recordset.MoveFirst display_store End If End Sub
FrmChange_store
Private Sub cmdchange_Click() If Combo1.Text = "" Then MsgBox "Please select the store from list..!", vbExclamation, "E-Billing" ElseIf Label3.Caption = Combo1.Text Then MsgBox "You have been already login to this store..!", vbCritical, "EBilling" Else Combo1_Change MDIForm1.Enabled = True MDIForm1.Label2 = Combo1.Text
68
Unload Me MsgBox "Operation completed Successfully..!", vbInformation, "Success" End If End Sub Private Sub cmdclose_Click() MDIForm1.Enabled = True Unload Me End Sub Private Sub Combo1_Change() frmLogin.Combo3.Text = Combo1.Text Dim sql As String sql = "select store_id from store_info where store_nm='" & frmLogin.Combo3.Text & "'" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open sql, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic If Adodc1.Recordset.RecordCount > 0 Then frmLogin.txtstore_id.Text = Adodc1.Recordset("store_id") Else frmLogin.txtstore_id.Text = "" End If End Sub Private Sub Combo1_Click() Combo1_Change End Sub Private Sub Form_Load() 'Enter store names in store name combo box to see the available stores Combo1.Clear Dim abc As String abc = "select Store_nm from Store_info order by store_id" If Adodc1.Recordset.State = adStateOpen Then Adodc1.Recordset.Close Adodc1.Recordset.Open abc, "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=E_Billing;Data Source=NIKHIL176A7816\SQLEXPRESS", adOpenDynamic, adLockOptimistic While Adodc1.Recordset.EOF = False Combo1.AddItem Adodc1.Recordset("store_nm")
69
Frmabout_us
Private Sub close_Click() MDIForm1.Enabled = True Unload Me End Sub
70
71
Electronic Data Interchange (EDI) system between banks, other credit verification agency and their vendors
In the area of data security and system security. Provide more online tips and help. To optimize the query which is embedded in the system. We can provide more ways for payment of bill.
72
BIBLIOGRAPHY
WEBSITES:
BOOKS: MASTERING VISUAL BASIC 6 (PAPERBACK) MASTERING VISUAL BASIC .NET (PAPERBACK) VISUAL BASIC BLACK BOOK (PAPERBACK) SQL BIBLE, 2ND EDITION (PAPERBACK) DATABASE DEVELOPMENT IN VISUAL BASIC
73