Petrol Pump: Department of Computer Science
Petrol Pump: Department of Computer Science
Petrol Pump: Department of Computer Science
A Project Report Submitted in Partial Fulfillment Of the Requirements for the Award of BCA Of the
CERTIFICATE -1
CERTIFICATE OF APPROVAL This is to certify that the project work entitled Petrol Pump submitted by Harish Nag in partial fulfillment of the requirements for the award of BCA, session 2012 at BIIT College, to Panjab Technical University, Jagdalpuris a record of the students own work. This work has not been submitted to any other University or institute for the award of any degree or diploma to the best of my knowledge.
CERTIFICATE 2
CERTIFICATE OF EVALUATION This is to certify that the project report entitled Petrol Pump being submitted by Harish Nag in partial fulfillment of the requirements for the award of BCA, session 2012 at BIIT College, to Panjab Technical University, Jagdalpur, is a record of the students own work. This work has not been submitted to any other University or institute for the award of any degree or diploma to the best of my knowledge.
CERTIFICATE 3
CERTIFICATE OF ORIGINALITY This is to certify that the project report entitled Petrol Pump in partial fulfillment of the requirements for the award of BCA, session 2012 to Panjab Technical University, Jagdalpur, is carried out by Harish Nag, under my supervision & guidance. The matter embodied in this project is genuine work done by the student and has not been submitted to this or any other University or institute for the award of any degree or diploma to the best of my knowledge.
CERTIFICATE 4
SELF CERTIFICATE This to certify that the project report entitled Petrol Pump is done by me is an authentic work carried out for the partial fulfillment of the requirements for the award of the BCA, under the guidance of Mr. Hulesh Chandra
Roll No.
ACKNOWLEDGEMENT
The austerity and satisfaction that one gets on completing a project cannot be fulfilled without mentioning the people who made it possible, with gratitude, we are very much thankful to the Almighty God who helped us all the way throughout the project and who has molded us into what we are today. I am privileged to express my sincere gratitude to honorable Rev. Mr. L.Patel, Principal, BIIT College, Jagdalpur for all encouragement he gave us. I express my sincere thanks to extreme gratitude to Mr. Hulesh Chandra(H.O.D.) of Computer Science for all his valuable suggestions and guidance throughout our project. I wish to express my hearty gratitude to our internal project guide, Mr. Hulesh Chandra for his valuable suggestions and guidance throughout the tenure of our project .I extend my sincere thanks to all the college staff members who helped me to complete this project successfully. Finally, I express my sincere thanks to our entire friends and all the other people who had imparted their knowledge and expertise upon me.
SYNOPSIS
CONTENTS:CHAPTER 1
1.1
INTRODUCTION
1.1.1 The Organization Profile 1.1.2 Study of existing System
Background Study
1.2
Project Overview
CHAPTER 2
2.1
PROBLEM ANALYSIS
2.1.1 2.1.2 Problem Definition Solution Strategies
2.2
2.3 2.4
3.3
Design Process
3.3.1 3.3.2 3.3.3 Database Design Input design Output design
4.3
System Maintenance
CHAPTER - 5 CONCLUSION
5.1 Scope for further Enhancement 5.2 Bibliography 5.3 Annexure
5.3.1 Input design 5.3.2 Output design 5.3.3 Source code
5.4 Abbreviations
CHAPTER 1 INTRODUCTION
1.1 BACKGROUND STUDY
1.1.1 The Organizational profile
This project is developed for Office Of The Chief Executive Officer Janpad Panchayat, Makri in which there are 3 Sections Establishment, Finance, N.R.E.G.A. Maintanance and staffs are
C.E.O. Sub Engineer A.DEO Accountant Ast. Grade 2 Ast Grade 3 Computer Operator Driver
Peon
2.3
Operating System
Software Justification
As the company is presently has its showroom in One place, STANDALONE system is proposed with WINDOWS XP operating system.
these events determines the sequence in which the code executes, thus the path through the applications code differs each time the program runs. Because we cant predict the sequence of events, our code must make certain assumptions about the state of the world when it executes. When we make assumptions (for example, that an entry field must contain a value before running a procedure to process that value), we should structure our application in such a way as to make sure that the assumption will always be valid (for example, disabling the command button that starts the procedure until the entry field contains a value). Our code can also trigger events during execution. For example, programmatically changing the text in a text box cause the text boxs Change event to execute. Thats why it is very important to understand the event-driven model and keep it in mind when we design the application.
ACTIVE X CONTROLS
An ActiveX control is an execution to the Visual Basic Toolbox. We can use Active X controls just like any of the standard built-in controls, such as the Check Box control. When we add is Active X control to a program, it becomes part of the development and run-time environment and provides new functionality for the application.
2.4
Project estimation and scheduling were carried out together by the project leader as Per the norms of the company. Some cost estimation was done at the early stage before the schedules were drawn up. Once the project was underway, estimates were updated. The factors involved in computing the total cost of a software project were:
Hardware & software cost, Maintenance cost, Travel and training cost and
Effort cost.
Scheduling as well as estimating the effort required to develop the software system were done by the project leader in discussion with the Company officials. The project was sub moduled and each module was given a dead line of completion. Tests were scheduled on completion of each module.
3.1
MODULE DESIGN
Module design means breaking your programming task in to small parts. The advantage of modularity is in easy accessing of coding and debugging, also more number of programmers can engage in a companys software development and
the work can be finished quickly. Even very big developments can be finished within a targeted minimum time by splitting the program in to small parts. This project has mainly classified into two Modules, they are: 1). User module
User can perform following function:User Can add
Item record Customer record Dealer record Meter reading information Company information Purchase record
2). Administrator
Administrator can perform all the function which user cannot such as
Meter reading rates Changing Administrative Password User Password too Setting Pay Scale
Real time projects, that too customers based projects always will be with more reports, as the customer needs better visual of their stored details. This module area of Reporting has one reports which will give a clear identification of the project needs.
3.2
DESIGN NOTATIONS
MDI FORM
VOUCHER ENTRY
RECORD
METER
SECURITY
EXIT
COMPANY
METER READINGG
CHANGE PASSWORD
YES
CUSTOMER
NO
DEALER
ITEM
MENU
A menu is a selection list that simplifies the data entry the user can choose from a list of option, by typing the option letter associated with option in position where the cursor is located. This project has one Graphical Menu. Selected from the toolbar. Graphical Menu is designed in such a way that, if the user moves the mouse cursor above the main option sub options displayed automatically.
FORMATTED SCREEN
Data entry screens have been designed which are similar in formatting source documents. Help screens have been designed the user to enter data without confusion.
DATA VALIDATION
The input data are validated to minimize errors validation is done. In certain cases validation is made to check whether the given data is numeric or not.
USER FRIENDLINESS
Appropriate messages are provided to the user to inform of what is happening. Errors are used to indicate the error code and specific error message.
CONSISTENT FORMAT
A fixed format is adopted for displaying the title and the messages. Each screen has a status line, which displays the operation that can be performed after data entry.
INTERACTIVE DIALOGUE
The system participates in interactive dialogue and is able to cope with missing or omitted information. It covers the dialogue by retaining adequate information between each dialogue.
Unit Testing
Unit testing focuses on the verification of smallest unit of software design of the module. To check whether each module in the software works properly so that it gives desired outputs to the given inputs. All validations and conditions are tested in the module level in unit test. Control paths are tested to ensure the information properly flows into and out of the program unit under test. Boundary condition are tested to ensure that the modules operates at boundary establishes to restrict processing. All independent paths through control structure are exercised to ensure that all statements in a module have been executed at least once. And finally all error handling paths are tested. In our system, Unit testing has been successfully handled. The test data was given to each module in all respects and have got desired output. Each module has been found working properly.
Integration Testing
Integration Testing is a systematic technique for constructing the program structure, while conducting test to recover errors associated with interfacing. The problem is interfacing data can be lost across an interface, one module can have an inadvertent, adverse effect on another subfunctions, when combined may not produce the expected major function. Global data structure can present problems in the testing when all modules are
combined and entire program is tested as a whole. In our case all the modules were combined and given the test data. The combined modules work successfully without any side effect on other programs and everything was found working fine.
4.2
SYSTEM IMPLEMENTATION
Implementation is the phase where the system goes for actual functioning. Hence in this phase one has to be cautious because all the efforts undertaken during the project will be fruitful only if the software is properly implemented according to the plans made. The implementation phase is less creative than system design. It is primarily concerned with user training, site preparation and file conversion. Depending on the nature of the system, extensive user training may be required. The initial parameters of the MIS should be modified as the result of
programming efforts; programming provides a reality test for the assumptions made by the analyst. The system testing checks the readiness and accuracy of the system to access, update and retrieve data from new files. Once the programs become available, the test data are read into the computer and process.
4.3
program is released for use.
SYSTEM MAINTENANCE
We may define Software Maintenance by describing four activities that are undertaken after a
Corrective Maintenance
The first maintenance activity occurs since it is unreasonable to assume that software testing will uncover all errors in a large software system. The process of including the diagnosis and correction of one or more errors is called corrective maintenance.
Adaptive Maintenance
This activity that contributes to the definition of maintenance occurs since rapid change is encountered in every aspect of computing. Therefore, adaptive maintenance modifies software to properly interface with the changing environment.
Perfective Maintenance
This activity involves recommendations for new capabilities, modifications to the existing functions and
general enhancements when the software is used. To satisfy these requests, perfective maintenance is performed.
Preventive Maintenance
This activity occurs when software is changed to improve further maintainability or reliability. If the only available element of a Software Configuration is the source code, maintenance activity begins with the evaluation of the code, often complicated by poor internal documentation. The subtle characteristics such as program structure, global data structure, system interfaces and performance & design constraints are difficult to handle and are often misinterpreted. The amounts of changes that are made to the code are difficult to access.
CHAPTER - 5 CONCLUSION
Search details can be enhanced by detailed identification of searching problems and rectification steps by company.This system is entirely designed for STAND ALONE usage, according to the need of the office, if needed the same system can be designed with Network facility to handle the branch activities also.
3 Source code
Main Form
Private Sub MDIForm_Load()
End Sub
Private Sub txtBillNo_LostFocus() PurRs.FindFirst "billno = '" & txtBillNo.Text & "'" If PurRs.NoMatch Then txtBillDate.Text = Date cmdsave.Enabled = True Else Set PurEditRs = myDB.OpenRecordset("select * from purchase where billno='" & txtBillNo.Text & "'") PurEditRs.MoveLast nr = PurEditRs.RecordCount PurEditRs.MoveFirst ItemRs.FindFirst "itemname ='" & PurEditRs!itemname & " ' "
If PurEditRs!Status = "CREDIT" Then optCredit.Value = True Call optCredit_Click DealerRs.MoveFirst Do While Not DealerRs.EOF comDealerName.AddItem DealerRs!dealername DealerRs.MoveNext Loop comDealerName.Text = PurEditRs!dealername End If txtBillDate.Text = PurEditRs!Date PurEditRs.MoveFirst For i = 0 To nr - 1 loaddata (i) PurEditRs.MoveNext Next i lblgqtotal = 0 lblamttotal = 0 PurEditRs.MoveFirst For i = 0 To nr - 1 lblgqtotal = Val(lblgqtotal) + Val(txtQtyTotal(i)) lblamttotal = Val(lblamttotal) + Val(txtAmt(i)) Next t=1 End If End Sub
Private Sub loaddata(index As Integer) If index > 0 Then Load comItemName(index) Load txtQtyG(index) Load txtQtyS(index) Load txtQtyTotal(index) Load txtUnit(index) Load txtRate(index) Load txtAmt(index) Load comMore(index)
comItemName(index).Top = comItemName(index - 1).Top + 435 txtQtyG(index).Top = txtQtyG(index - 1).Top + 435 txtQtyS(index).Top = txtQtyS(index - 1).Top + 435 txtQtyTotal(index).Top = txtQtyTotal(index - 1).Top + 435 txtUnit(index).Top = txtUnit(index - 1).Top + 435 txtRate(index).Top = txtRate(index - 1).Top + 435 txtAmt(index).Top = txtAmt(index - 1).Top + 435 comMore(index).Top = comMore(index - 1).Top + 435
comItemName(index).Visible = True txtQtyG(index).Visible = True txtQtyS(index).Visible = True txtQtyTotal(index).Visible = True txtUnit(index).Visible = True txtRate(index).Visible = True txtAmt(index).Visible = True comMore(index).Visible = True ItemRs.MoveFirst Do While Not ItemRs.EOF comItemName(index).AddItem ItemRs!itemname ItemRs.MoveNext Loop End If txtQtyS(index).Text = PurEditRs!sqty comItemName(index).Text = PurEditRs!itemname txtQtyG(index).Text = PurEditRs!gqty txtQtyTotal(index).Text = Val(txtQtyS(index)) + Val(txtQtyG(index)) ItemRs.FindFirst "itemname" = PurEditRs!itemname txtUnit(index).Text = ItemRs!unit ItemRs.FindFirst "itemname ='" & PurEditRs!itemname & "'" txtRate(index).Text = ItemRs!Rate txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) comMore(index).AddItem "N" comMore(index).AddItem "Y" End Sub
Private Sub comMore_LostFocus(index As Integer) If comMore(index).Text = "Y" Then comMore(index).Enabled = False tRec = index + 1 CreatRow (tRec) End If End Sub
Private Sub txtQtyG_LostFocus(index As Integer) txtQtyTotal(index).Text = Val(txtQtyG(index)) + Val(txtQtyS(index)) txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) lblgqtotal = 0 lblamttotal = 0 If t = 1 Then rec = nr - 1 Else rec = tRec End If For i = 0 To rec lblgqtotal = Val(lblgqtotal) + Val(txtQtyTotal(i)) lblamttotal = Val(lblamttotal) + Val(txtAmt(i)) Next End Sub Private Sub CreatRow(index As Integer) If index > 5 Then For i = 0 To index - 1 comItemName(i).Top = comItemName(i).Top - 435 txtQtyG(i).Top = txtQtyG(i).Top - 435 txtQtyS(i).Top = txtQtyS(i).Top - 435 txtQtyTotal(i).Top = txtQtyTotal(i).Top - 435 txtUnit(i).Top = txtUnit(i).Top - 435 txtRate(i).Top = txtRate(i).Top - 435 txtAmt(i).Top = txtAmt(i).Top - 435 comMore(i).Top = comMore(i).Top - 435 Next vscItem.Min = vscItem.Min - 1 End If
Load comItemName(index) comItemName(index).Top = comItemName(index - 1).Top + 435 ItemRs.MoveFirst Do While Not ItemRs.EOF comItemName(index).AddItem ItemRs!itemname ItemRs.MoveNext Loop comItemName(index).Visible = True Load txtQtyG(index) txtQtyG(index).Top = txtQtyG(index - 1).Top + 435 txtQtyG(index).Visible = True txtQtyG(index).Text = 0 Load txtQtyS(index) txtQtyS(index).Top = txtQtyS(index - 1).Top + 435 txtQtyS(index).Visible = True txtQtyS(index).Text = 0 Load txtQtyTotal(index) txtQtyTotal(index).Top = txtQtyTotal(index - 1).Top + 435 txtQtyTotal(index).Visible = True txtQtyTotal(index).Text = 0 Load txtUnit(index) txtUnit(index).Top = txtUnit(index - 1).Top + 435 txtUnit(index).Visible = True txtUnit(index).Text = "" Load txtRate(index) txtRate(index).Top = txtRate(index - 1).Top + 435 txtRate(index).Visible = True txtRate(index).Text = 0 Load txtAmt(index) txtAmt(index).Top = txtAmt(index - 1).Top + 435 txtAmt(index).Visible = True txtAmt(index).Text = 0 Load comMore(index) comMore(index).Top = comMore(index - 1).Top + 435 comMore(index).Visible = True comMore(index).Text = "N" comMore(index).Enabled = True
Private Sub txtQtyS_LostFocus(index As Integer) txtQtyTotal(index).Text = Val(txtQtyG(index)) + Val(txtQtyS(index)) txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) lblgqtotal = 0 lblamttotal = 0 If t = 1 Then rec = nr - 1 Else rec = tRec End If For i = 0 To rec lblgqtotal = Val(lblgqtotal) + Val(txtQtyTotal(i)) lblamttotal = Val(lblamttotal) + Val(txtAmt(i)) Next End Sub
Private Sub vscItem_Change() If tvsc > vscItem.Value Then togle = -1 Else togle = 1 End If For i = 0 To tRec comItemName(i).Top = comItemName(i).Top - 435 * togle txtQtyG(i).Top = txtQtyG(i).Top - 435 * togle txtQtyS(i).Top = txtQtyS(i).Top - 435 * togle txtQtyTotal(i).Top = txtQtyTotal(i).Top - 435 * togle txtUnit(i).Top = txtUnit(i).Top - 435 * togle txtRate(i).Top = txtRate(i).Top - 435 * togle txtAmt(i).Top = txtAmt(i).Top - 435 * togle comMore(i).Top = comMore(i).Top - 435 * togle Next
Product Sale
Option Explicit Dim agqt() Dim asqt() Dim aname() Dim t As Integer Dim rec As Integer Dim nr As Integer Dim msg As String Dim style As String Dim title As String Dim i As Integer Dim temp As Integer Dim stay As String Dim tRec As Integer ' total Records -> for total no of row created in add mode Dim tvsc As Integer ' temp vertical scroll for check the scroll value Dim togle As Integer 'for up down of scroll value between +1 or -1 Private Sub cmdedit_Click() temp = 1 Set saleeditrs = myDB.OpenRecordset("select * from sale where vno='" & txtVNo.Text & "' ", dbOpenDynaset) saleeditrs.MoveLast nr = saleeditrs.RecordCount ReDim agqt(nr) ReDim asqt(nr) ReDim aname(nr) For i = 0 To nr - 1 agqt(i) = Val(txtQtyG(i)) asqt(i) = Val(txtQtyS(i)) aname(i) = comItemName(i).Text Next cmdsave.Enabled = True cmdedit.Enabled = False End Sub
Private Sub cmdsave_Click() If temp = 1 Then For i = 0 To nr - 1 ItemRs.FindFirst "itemname='" & aname(i) & "'" ItemRs.Edit ItemRs!gqty = ItemRs!gqty + agqt(i) ItemRs!sqty = ItemRs!sqty + asqt(i) ItemRs.Update Next i saleeditrs.MoveLast nr = tRec myDB.Execute ("delete * from sale where vno='" & txtVNo.Text & " '") For i = 0 To nr SaleRs.AddNew SaleRs!vechno = txtvechNo.Text SaleRs!vno = txtVNo.Text SaleRs!Date = txtdate.Text SaleRs!custName = comcustname.Text SaleRs!Status = stay SaleRs!itemname = comItemName(i).Text SaleRs!gqty = txtQtyG(i).Text SaleRs!sqty = txtQtyS(i).Text SaleRs!Rate = txtRate(i).Text SaleRs.Update Next i For i = 0 To nr - 1 ItemRs.FindFirst "itemname='" & comItemName(i).Text & "'" ItemRs.Edit ItemRs!gqty = ItemRs!gqty - Val(txtQtyG(i)) ItemRs!sqty = ItemRs!sqty - Val(txtQtyS(i)) ItemRs.Update Next i Else
For i = 0 To tRec SaleRs.AddNew SaleRs!vno = txtVNo.Text SaleRs!vechno = txtvechNo.Text SaleRs!Date = txtdate.Text SaleRs!custName = comcustname.Text SaleRs!Status = stay SaleRs!itemname = comItemName(i).Text SaleRs!gqty = txtQtyG(i).Text SaleRs!sqty = txtQtyS(i).Text SaleRs!Rate = txtRate(i).Text SaleRs.Update Next i For i = 0 To tRec ItemRs.FindFirst "itemname='" & comItemName(i).Text & "'" ItemRs.Edit ItemRs!gqty = ItemRs!gqty - Val(txtQtyG(i)) ItemRs!sqty = ItemRs!sqty - Val(txtQtyS(i)) ItemRs.Update Next i End If cmdsave.Enabled = False cmdedit.Enabled = True End Sub
Private Sub comItemName_Click(index As Integer) ItemRs.FindFirst "itemname = '" & comItemName(index).Text & "'" txtUnit(index).Text = ItemRs!unit txtRate(index).Text = ItemRs!Rate txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) txtQtyS(index).SetFocus End Sub
Private Sub Form_Load() Set SaleRs = myDB.OpenRecordset("sale", dbOpenDynaset) Set CustRs = myDB.OpenRecordset("select custname from customer", dbOpenSnapshot) Set ItemRs = myDB.OpenRecordset("item", dbOpenDynaset)
Do While Not CustRs.EOF comcustname.AddItem CustRs!custName CustRs.MoveNext Loop ItemRs.MoveFirst Do While Not ItemRs.EOF comItemName(0).AddItem ItemRs!itemname ItemRs.MoveNext Loop txtQtyTotal(0).Enabled = False txtUnit(0).Enabled = False txtAmt(0).Enabled = False temp = 0 cmdsave.Enabled = False frmsale.Height = 6125 frmsale.Width = 7200 frmsale.Top = 0 End Sub
Private Sub optCash_Click() lblcustname.Visible = optCredit.Value comcustname.Visible = optCredit.Value txtName.Visible = optCash.Value stay = "CASH" txtName.Text = "CASH" End Sub
Private Sub optCredit_Click() lblcustname.Visible = optCredit.Value comcustname.Visible = optCredit.Value stay = "CREDIT" txtName.Text = "CREDIT" End Sub
End Sub
Private Sub txtVNo_LostFocus() SaleRs.FindFirst "VNo = '" & txtVNo.Text & "'" If SaleRs.NoMatch Then txtdate.Text = Date cmdsave.Enabled = True Else Set saleeditrs = myDB.OpenRecordset("select * from sale where vno='" & txtVNo.Text & "'") saleeditrs.MoveLast nr = saleeditrs.RecordCount saleeditrs.MoveFirst ItemRs.FindFirst "itemname ='" & saleeditrs!itemname & " ' " If saleeditrs!Status = "CREDIT" Then optCredit.Value = True Call optCredit_Click CustRs.MoveFirst Do While Not CustRs.EOF comcustname.AddItem CustRs!custName CustRs.MoveNext Loop comcustname.Text = saleeditrs!custName End If txtdate.Text = saleeditrs!Date txtvechNo.Text = saleeditrs!vechno saleeditrs.MoveFirst For i = 0 To nr - 1 loaddata (i) saleeditrs.MoveNext Next i lblgqtotal = 0 lblamttotal = 0 saleeditrs.MoveFirst For i = 0 To nr - 1
lblgqtotal = Val(lblgqtotal) + Val(txtQtyTotal(i)) lblamttotal = Val(lblamttotal) + Val(txtAmt(i)) Next t=1 End If End Sub
Private Sub loaddata(index As Integer) If index > 0 Then Load comItemName(index) Load txtQtyG(index) Load txtQtyS(index) Load txtQtyTotal(index) Load txtUnit(index) Load txtRate(index) Load txtAmt(index) Load comMore(index)
comItemName(index).Top = comItemName(index - 1).Top + 435 txtQtyG(index).Top = txtQtyG(index - 1).Top + 435 txtQtyS(index).Top = txtQtyS(index - 1).Top + 435 txtQtyTotal(index).Top = txtQtyTotal(index - 1).Top + 435 txtUnit(index).Top = txtUnit(index - 1).Top + 435 txtRate(index).Top = txtRate(index - 1).Top + 435 txtAmt(index).Top = txtAmt(index - 1).Top + 435 comMore(index).Top = comMore(index - 1).Top + 435
comItemName(index).Visible = True txtQtyG(index).Visible = True txtQtyS(index).Visible = True txtQtyTotal(index).Visible = True txtUnit(index).Visible = True txtRate(index).Visible = True txtAmt(index).Visible = True comMore(index).Visible = True ItemRs.MoveFirst Do While Not ItemRs.EOF
comItemName(index).AddItem ItemRs!itemname ItemRs.MoveNext Loop End If txtQtyS(index).Text = saleeditrs!sqty comItemName(index).Text = saleeditrs!itemname txtQtyG(index).Text = saleeditrs!gqty txtQtyTotal(index).Text = Val(txtQtyS(index)) + Val(txtQtyG(index)) ItemRs.FindFirst "itemname" = saleeditrs!itemname txtUnit(index).Text = ItemRs!unit ItemRs.FindFirst "itemname ='" & saleeditrs!itemname & "'" txtRate(index).Text = ItemRs!Rate txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) comMore(index).AddItem "N" comMore(index).AddItem "Y" End Sub
Private Sub comMore_LostFocus(index As Integer) If comMore(index).Text = "Y" Then comMore(index).Enabled = False tRec = index + 1 CreatRow (tRec) End If End Sub
Private Sub txtQtyG_LostFocus(index As Integer) txtQtyTotal(index).Text = Val(txtQtyG(index)) + Val(txtQtyS(index)) txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) lblgqtotal = 0 lblamttotal = 0 If t = 1 Then rec = nr - 1 Else rec = tRec End If For i = 0 To rec lblgqtotal = Val(lblgqtotal) + Val(txtQtyTotal(i))
Private Sub CreatRow(index As Integer) If index > 5 Then For i = 0 To index - 1 comItemName(i).Top = comItemName(i).Top - 435 txtQtyG(i).Top = txtQtyG(i).Top - 435 txtQtyS(i).Top = txtQtyS(i).Top - 435 txtQtyTotal(i).Top = txtQtyTotal(i).Top - 435 txtUnit(i).Top = txtUnit(i).Top - 435 txtRate(i).Top = txtRate(i).Top - 435 txtAmt(i).Top = txtAmt(i).Top - 435 comMore(i).Top = comMore(i).Top - 435 Next vscItem.Min = vscItem.Min - 1 End If Load comItemName(index) comItemName(index).Top = comItemName(index - 1).Top + 435 ItemRs.MoveFirst Do While Not ItemRs.EOF comItemName(index).AddItem ItemRs!itemname ItemRs.MoveNext Loop comItemName(index).Visible = True Load txtQtyG(index) txtQtyG(index).Top = txtQtyG(index - 1).Top + 435 txtQtyG(index).Visible = True txtQtyG(index).Text = 0 Load txtQtyS(index) txtQtyS(index).Top = txtQtyS(index - 1).Top + 435 txtQtyS(index).Visible = True txtQtyS(index).Text = 0 Load txtQtyTotal(index) txtQtyTotal(index).Top = txtQtyTotal(index - 1).Top + 435 txtQtyTotal(index).Visible = True
txtQtyTotal(index).Text = 0 Load txtUnit(index) txtUnit(index).Top = txtUnit(index - 1).Top + 435 txtUnit(index).Visible = True txtUnit(index).Text = "" Load txtRate(index) txtRate(index).Top = txtRate(index - 1).Top + 435 txtRate(index).Visible = True txtRate(index).Text = 0 Load txtAmt(index) txtAmt(index).Top = txtAmt(index - 1).Top + 435 txtAmt(index).Visible = True txtAmt(index).Text = 0 Load comMore(index) comMore(index).Top = comMore(index - 1).Top + 435 comMore(index).Visible = True comMore(index).Text = "N" comMore(index).Enabled = True comMore(index).AddItem "N" comMore(index).AddItem "Y" comItemName(index).SetFocus End Sub
Private Sub txtQtyS_LostFocus(index As Integer) txtQtyTotal(index).Text = Val(txtQtyG(index)) + Val(txtQtyS(index)) txtAmt(index).Text = Val(txtQtyTotal(index)) * Val(txtRate(index)) lblgqtotal = 0 lblamttotal = 0 If t = 1 Then rec = nr - 1 Else rec = tRec End If For i = 0 To rec lblgqtotal = Val(lblgqtotal) + Val(txtQtyTotal(i)) lblamttotal = Val(lblamttotal) + Val(txtAmt(i)) Next
End Sub
Private Sub vscItem_Change() If tvsc > vscItem.Value Then togle = -1 Else togle = 1 End If For i = 0 To tRec comItemName(i).Top = comItemName(i).Top - 435 * togle txtQtyG(i).Top = txtQtyG(i).Top - 435 * togle txtQtyS(i).Top = txtQtyS(i).Top - 435 * togle txtQtyTotal(i).Top = txtQtyTotal(i).Top - 435 * togle txtUnit(i).Top = txtUnit(i).Top - 435 * togle txtRate(i).Top = txtRate(i).Top - 435 * togle txtAmt(i).Top = txtAmt(i).Top - 435 * togle comMore(i).Top = comMore(i).Top - 435 * togle Next 'vscItem.Max = vscItem.Max + 1 tvsc = vscItem.Value End Sub
Private Sub cmdsave_Click() CompRs.Edit CompRs!CompName = txtCompName.Text CompRs!dealer = txtDealer.Text CompRs!address = txtaddress.Text CompRs!mpstno = txtMPSTNo.Text CompRs!cstno = txtCSTNo.Text CompRs.Update End Sub
Private Sub Form_Load() Set CompRs = myDB.OpenRecordset("company", dbOpenDynaset) txtCompName.Text = CompRs!CompName txtDealer.Text = CompRs!dealer txtaddress.Text = CompRs!address txtMPSTNo.Text = CompRs!mpstno txtCSTNo.Text = CompRs!cstno frmCompany.Top = 0 End Sub Option Explicit Dim n As Integer
Private Sub cmdAdd_Click() For Each x In frmcustomer.Controls If TypeOf x Is TextBox Then x.Text = "" End If Next cmdedit.Enabled = False cmdsave.Enabled = False tmp = 1 txtCustCode.SetFocus End Sub
Private Sub cmdedit_Click() tmp = 0 cmdsave.Enabled = True cmdAdd.Enabled = True End Sub
Private Sub cmdNext_Click() CustRs.MoveNext If CustRs.EOF() Then CustRs.MovePrevious Beep MsgBox "You Are Allready On The Last Record" Else loaddata End If cmdedit.Enabled = True cmdsave.Enabled = False End Sub
Private Sub cmdPrevious_Click() CustRs.MovePrevious If CustRs.BOF() Then CustRs.MoveNext Beep MsgBox "You Are Already On The first record" Else loaddata End If cmdedit.Enabled = True cmdsave.Enabled = False End Sub
CustRs.Edit End If CustRs!custcode = txtCustCode.Text CustRs!custName = txtCustName.Text CustRs!address = txtaddress.Text CustRs!tel = txttel.Text CustRs.Update cmdsave.Enabled = False tmp = 0 End Sub
Private Sub Form_Load() Set CustRs = myDB.OpenRecordset("customer", dbOpenDynaset) n = CustRs.RecordCount If n > 0 Then cmdsave.Enabled = False loaddata Else cmdsave.Enabled = True cmdAdd.Enabled = True cmdedit.Enabled = True cmdFirst.Enabled = False cmdLast.Enabled = False cmdPrevious.Enabled = False cmdNext.Enabled = False End If frmcustomer.Height = 3510 frmcustomer.Width = 6330 frmcustomer.Top = 0 End Sub
Private Sub txtCustCode_LostFocus() CustRs.FindFirst "custcode" = txtCustCode.Text If CustRs.NoMatch Then cmdsave.Enabled = True Else loaddata cmdsave.Enabled = False cmdAdd.Enabled = True cmdedit.Enabled = True End If End Sub Option Explicit Dim x As Object Dim tmp As Integer Dim n As Integer
Private Sub cmdAdd_Click() For Each x In frmDealer.Controls If TypeOf x Is TextBox Then x.Text = "" End If Next cmdedit.Enabled = False cmdsave.Enabled = False tmp = 1 txtDealerCode.SetFocus End Sub
End Sub
Private Sub cmdLast_Click() DealerRs.MoveLast loaddata cmdedit.Enabled = True cmdsave.Enabled = False End Sub
Private Sub cmdNext_Click() DealerRs.MoveNext If DealerRs.EOF() Then DealerRs.MovePrevious Beep MsgBox ("You all rsady on Last Record") Else loaddata End If cmdedit.Enabled = True
Private Sub cmdPrevious_Click() DealerRs.MovePrevious If DealerRs.BOF() Then DealerRs.MoveNext Beep MsgBox ("You are allready on First Record") Else loaddata End If cmdedit.Enabled = True cmdsave.Enabled = False End Sub
Private Sub cmdsave_Click() If tmp = 0 Then DealerRs.Edit Else DealerRs.AddNew DealerRs!dealercode = txtDealerCode.Text End If DealerRs!dealername = txtDealerName.Text DealerRs!address = txtaddress.Text DealerRs!tel = txttel.Text DealerRs!fax = txtFax.Text DealerRs!e_mail = txtE_Mail.Text DealerRs!contperson = txtcontPerson.Text DealerRs.Update cmdsave.Enabled = False End Sub
Set DealerRs = myDB.OpenRecordset("dealer", dbOpenDynaset) n = DealerRs.RecordCount If n > 0 Then cmdsave.Enabled = False loaddata Else cmdsave.Enabled = False cmdedit.Enabled = False cmdAdd.Enabled = True cmdFirst.Enabled = False cmdLast.Enabled = False cmdNext.Enabled = False cmdPrevious.Enabled = False End If frmDealer.Height = 5300 frmDealer.Width = 6000 frmDealer.Top = 0 End Sub
Private Sub loaddata() txtDealerCode.Text = DealerRs!dealercode txtDealerName.Text = DealerRs!dealername txtaddress.Text = DealerRs!address txttel.Text = DealerRs!tel txtE_Mail.Text = DealerRs!e_mail txtFax.Text = DealerRs!fax txtcontPerson.Text = DealerRs!contperson End Sub
Private Sub txtDealerCode_LostFocus() DealerRs.FindFirst "dealercode = '" & txtDealerCode.Text & "' " If DealerRs.NoMatch Then cmdsave.Enabled = True Else
loaddata cmdsave.Enabled = False cmdAdd.Enabled = True cmdedit.Enabled = True End If End Sub Option Explicit Dim x As Object Dim tmp As Integer Dim n As Integer
Private Sub cmdAdd_Click() For Each x In frmitem.Controls If TypeOf x Is TextBox Then x.Text = "" End If Next cmdEdit.Enabled = False cmdSave.Enabled = False tmp = 1 txtitemcode.SetFocus End Sub
Private Sub cmdedit_Click() tmp = 0 cmdSave.Enabled = True cmdAdd.Enabled = True End Sub
End Sub
Private Sub cmdLast_Click() ItemRs.MoveLast loaddata cmdEdit.Enabled = True cmdSave.Enabled = False End Sub
Private Sub cmdNext_Click() ItemRs.MoveNext If ItemRs.EOF() Then ItemRs.MovePrevious Beep MsgBox ("You all rsady on Last Record") Else loaddata End If cmdEdit.Enabled = True cmdSave.Enabled = False End Sub
Private Sub cmdPrevious_Click() ItemRs.MovePrevious If ItemRs.BOF() Then ItemRs.MoveNext Beep MsgBox ("You are allready on First Record")
Private Sub cmdsave_Click() If tmp = 0 Then ItemRs.Edit Else ItemRs.AddNew ItemRs!itemcode = txtitemcode.Text End If ItemRs!itemname = txtitemname.Text ItemRs!sqty = txtsqty.Text ItemRs!gqty = txtgqty.Text ItemRs!Rate = txtrate.Text ItemRs!unit = txtunit.Text ItemRs.Update cmdSave.Enabled = False End Sub
Private Sub Form_Load() Set ItemRs = myDB.OpenRecordset("item", dbOpenDynaset) n = ItemRs.RecordCount If n > 0 Then cmdSave.Enabled = False loaddata Else cmdSave.Enabled = False cmdEdit.Enabled = False cmdAdd.Enabled = True cmdFirst.Enabled = False
cmdLast.Enabled = False cmdNext.Enabled = False cmdPrevious.Enabled = False End If frmitem.Height = 4200 frmitem.Width = 4035 frmitem.Top = 0 End Sub
Private Sub loaddata() txtitemcode.Text = ItemRs!itemcode txtitemname.Text = ItemRs!itemname txtsqty.Text = ItemRs!sqty txtgqty.Text = ItemRs!gqty txtrate.Text = ItemRs!Rate txtunit.Text = ItemRs!unit End Sub
Private Sub txtitemCode_LostFocus() ItemRs.FindFirst "itemcode = '" & txtitemcode.Text & "' " If ItemRs.NoMatch Then cmdSave.Enabled = True Else loaddata cmdSave.Enabled = False cmdAdd.Enabled = True cmdEdit.Enabled = True End If Option Explicit Dim x As Object Dim tmp As Integer Dim n As Integer Dim check As Integer Private Sub cmdAdd_Click()
txtdate.Text = Date MeterRs.FindFirst "Date = #" & Format(txtdate.Text, "mm-dd-yy") & "#" If MeterRs.NoMatch Then MeterRs.MoveLast txtOpBal1.Text = MeterRs!clbal1 txtOpBal2.Text = MeterRs!clbal2 txtOpbal3.Text = MeterRs!clbal3 txtClBal1.Text = "" txtClBal2.Text = "" txtClBal3.Text = "" cmdEdit.Enabled = False cmdSave.Enabled = True tmp = 1 txtClBal1.SetFocus Else Beep MsgBox ("You Are Allready Enter closing balance ") Beep MsgBox ("You can only edit this entry by edit button") End If End Sub
Private Sub cmdedit_Click() tmp = 0 cmdSave.Enabled = True cmdAdd.Enabled = True End Sub
MeterRs.MoveFirst txtOpBal1.Enabled = False txtOpBal2.Enabled = False txtOpbal3.Enabled = False txtOpBal1.Text = MeterRs!clbal1 txtOpBal2.Text = MeterRs!clbal2 txtOpbal3.Text = MeterRs!clbal3 txtClBal1.Text = MeterRs!clbal1 txtClBal2.Text = MeterRs!clbal2 txtClBal3.Text = MeterRs!clbal3 txtdate.Text = MeterRs!Date cmdEdit.Enabled = True cmdSave.Enabled = False End Sub
Private Sub cmdLast_Click() MeterRs.MoveLast txtOpBal1.Enabled = False txtOpBal2.Enabled = False txtOpbal3.Enabled = False MeterRs.MovePrevious txtOpBal1.Text = MeterRs!clbal1 txtOpBal2.Text = MeterRs!clbal2 txtOpbal3.Text = MeterRs!clbal3 MeterRs.MoveNext txtClBal1.Text = MeterRs!clbal1 txtClBal2.Text = MeterRs!clbal2 txtClBal3.Text = MeterRs!clbal3 txtdate.Text = MeterRs!Date cmdEdit.Enabled = True cmdSave.Enabled = False End Sub Private Sub cmdNext_Click() MeterRs.MoveNext
txtOpBal1.Enabled = False txtOpBal2.Enabled = False txtOpbal3.Enabled = False If MeterRs.EOF() Then MeterRs.MovePrevious Beep MsgBox ("You are allready on Last Record") Else MeterRs.MovePrevious txtOpBal1.Text = MeterRs!clbal1 txtOpBal2.Text = MeterRs!clbal2 txtOpbal3.Text = MeterRs!clbal3 MeterRs.MoveNext txtClBal1.Text = MeterRs!clbal1 txtClBal2.Text = MeterRs!clbal2 txtClBal3.Text = MeterRs!clbal3 txtdate.Text = MeterRs!Date End If cmdEdit.Enabled = True cmdSave.Enabled = False End Sub
Private Sub cmdPrevious_Click() MeterRs.MovePrevious txtOpBal1.Enabled = False txtOpBal2.Enabled = False txtOpbal3.Enabled = False If MeterRs.BOF() Then MeterRs.MoveNext Beep MsgBox ("You are allready on First Record") txtOpBal1.Text = MeterRs!opBal1 txtOpBal2.Text = MeterRs!opBal2 txtOpbal3.Text = MeterRs!opbal3
txtClBal1.Text = MeterRs!clbal1 txtClBal2.Text = MeterRs!clbal2 txtClBal3.Text = MeterRs!clbal3 txtdate.Text = MeterRs!Date Else MeterRs.MovePrevious If MeterRs.BOF Then MeterRs.MoveNext End If txtOpBal1.Text = MeterRs!clbal1 txtOpBal2.Text = MeterRs!clbal2 txtOpbal3.Text = MeterRs!clbal3 MeterRs.MoveNext txtClBal1.Text = MeterRs!clbal1 txtClBal2.Text = MeterRs!clbal2 txtClBal3.Text = MeterRs!clbal3 txtdate.Text = MeterRs!Date End If cmdEdit.Enabled = True cmdSave.Enabled = False End Sub
Private Sub cmdsave_Click() If tmp = 0 Then MeterRs.Edit Else MeterRs.AddNew MeterRs!Date = txtdate.Text End If MeterRs!opBal1 = txtOpBal1.Text MeterRs!opBal2 = txtOpBal2.Text MeterRs!opbal3 = txtOpbal3.Text MeterRs!clbal1 = txtClBal1.Text MeterRs!clbal2 = txtClBal2.Text
Private Sub Form_Load() Set MeterRs = myDB.OpenRecordset("meter", dbOpenDynaset) n = MeterRs.RecordCount If n > 0 Then cmdSave.Enabled = False txtOpBal1.Text = MeterRs!opBal1 txtOpBal2.Text = MeterRs!opBal2 txtOpbal3.Text = MeterRs!opbal3 txtClBal1.Text = MeterRs!clbal1 txtClBal2.Text = MeterRs!clbal2 txtClBal3.Text = MeterRs!clbal3 txtdate.Text = MeterRs!Date Else cmdSave.Enabled = False cmdEdit.Enabled = False cmdAdd.Enabled = True cmdFirst.Enabled = False cmdLast.Enabled = False cmdNext.Enabled = False cmdPrevious.Enabled = False End If txtdate.Enabled = False frmmeter.Height = 4900 frmmeter.Width = 4900 frmmeter.Top = o End Sub Private Sub Form_Load() Set passRs = myDB.OpenRecordset("password", dbOpenDynaset) passRs.MoveFirst
p1.Visible = True p2.Visible = False p3.Visible = False txtnpass = "" txtnpass.Enabled = False txtcpass = "" txtcpass.Enabled = False txtpass = "" cmdok.Enabled = False frmpasschange.Height = 4700 frmpasschange.Width = 4100 frmpasschange.Top = 0 End Sub
Private Sub txtcpass_LostFocus() If txtnpass.Text = txtcpass.Text Then cmdok.Enabled = True End If If txtnpass.Text <> txtcpass.Text Then Beep MsgBox ("Do Not Confirm Password") p1.Visible = True p2.Visible = False p3.Visible = False txtnpass = "" txtnpass.Enabled = False txtcpass = "" txtcpass.Enabled = False txtpass = "" cmdok.Enabled = False End If End Sub
If txtnpass.Text <> "" Then txtcpass.Enabled = True Else txtcpass.Enabled = False End If End Sub
Private Sub txtpass_Change() If txtpass.Text = passRs!Password Then txtnpass.Enabled = True txtnpass.SetFocus p1.Visible = False p2.Visible = False p3.Visible = True Else p1.Visible = False p2.Visible = True p3.Visible = False End If End Sub
Private Sub txtpass_GotFocus() p1.Visible = True p2.Visible = False p3.Visible = False End Sub
2. Then following blank screen appeared we can use any option. This is main MDI form.
3. This is Sale Bill form. We can select any item from it.
4. This is Purchase Bill form. We can select any item from it.
9. This is Meter Reading form. We can check opening and closing reading daily in it.
BIBLIOGRAPHY
Sumita Arora
VB Black Book
Steven Holzner
Page 2