Professional Documents
Culture Documents
PROJECT REPORT
On
Submitted to
1
Acknowledgement
My thanks go to esteemed organisation Sood Medicine Traders Limited,
Hoshiarpur immense gratitude to Mr. Anuj Sood, Director, staff and other members of
the organisation for their continued guidance and support in the development of this
Project and also their requisite skills which gave us self-confidence for completing this
Project.
We also gratefully acknowledge our most affectionate teacher and project super
visor Prof. Mohan Bhardwaj by helping us through his expert guidance, strong criticisms
and valuable suggestions at project work.
With immense pleasure, we thank Prof. Mohan Bhardwaj project supervisor, for
his valuable guidance, which he provided so generously during the Project Preparation. We
feel, without this consistency, it would never have been possible to complete this task.
2
SOMETHING ABOUT
COMPUTERS
Computer can no longer be termed as a mere invention. It’s a revolution. We
cannot imagine our world without Computers. There is no area, in world, which is
untouched by Computers.
Computers are fast, accurate and reliable device. A fast modern computer can
execute millions of instructions per seconds. If properly maintained, it can work
continuously for days and weeks together, without interruption and it rarely fail.
Computers, however, lack in intelligence and are no match for human beings in
this respect. That is why human beings still remain supreme and cannot be replaced by
computers. In other words, computers cannot work without human beings and each
computer can keep a number of professionals busy, day and night. That is why there is
greater demand for computer professionals throughout the world.
3
About the Project
Introduction
Gives full detail about the available stock of medicine and other surgical items.
DATA Management.
Daily Reports.
4
HARDWARE
AND
SOFTWARE REQUIREMENTS
4 GB Hard Disk.
32 MB RAM.
Key Board.
SOFTWARE REQUIREMENT
Windows ME/2000/XP
MS-Access 97/2000/XP
5
Introduction for VISUAL BASIC
(Used as Front End)
The “Visual” part refers to method used to create the graphical user interface
(GUI). Rather than writing numerous lines of code to describe the appearance and
location of Interface elements, you simply drag and drop pre-built objects into place on
screen.
6
The Visual Basic programming language is not unique to Visual Basic. The
Visual Basic programming system, Application Edition included in Microsoft Excel,
Microsoft Access, and many other Windows applications uses the same language. It is
becoming very popular among the users due to its user friendliness and advanced
features.
7
Features of Visual Basic
• Visual basic is visual and uses a simple BASIC-like programming language, yet
Visual Basic enables you to create powerful Windows programs.
• A bug is any kind of error in a programme, and refers to the process of removing
program bugs.
• A program written in a complied language runs much faster than one written in an
interpreted language.
• A program written in an interpreted language is easier to debug than one written
in a complied language.
• There are three editions of visual basic: Learning, Professional and Enterprise.
• There are various types of wizards in Visual Basic. They are: Standard Exe,
Active Exe, ActiveX DLL and many others. Mostly Standard Exe type is used for
typical applications.
• The integrated development is that where Visual basic puts applications together.
It is made of various components like toolbar, toolbox, form designer, etc.
• Visual basic applications are event-driven – events are triggered by the user
section and executes different sections of codes in response to events.
• Properties comprised the objects data, setting and attributes which can be design
time or run time.
• Methods are procedures that operate on the objects.
• Events are action recognizes by form or control – pressing a key or clicking a
mouse is an event for which an appropriate code is written.
8
ABOUT M.S.-ACCESS
Used as Back End
Authentication
Privileges
There are two types of privileges available to be granted to users. They are system and
object privileges. System privileges allow a user to create or manipulate objects, but do
not give access to actual database objects. System privileges allow a user to execute
commands such as ALTER TABLE, CREATE TABLE and DELETE TABLE, etc.
Object privileges are used to allow access to a specific database object, such as a
particular table or view. Object privileges that are given at the view level are especially
impressive.
Roles
Roles are used to ease the management task of assigning a multitude of privilege to users.
Roles are first created and then given sets of privileges that can be assigned to users and
other roles. Users can be given multiple roles.
Database Encryption
9
Auditing
There are three standard types of auditing available in Ms Access, including SQL
statement-level, privilege-level, and object-level auditing. Audit records can be written
Ms Access provides several features to ensure data integrity whether in the case of
system failure, human error, or malicious attacks. These features include redo log files,
rollback segments, and Log Miner.
The Ms Access’s Advanced Security Option includes features which ensure secure
communications when accessing a database even over the internet. RSA, RC4, Triple
DES can be used for data encryption over a network.
10
Introduction to Problem
Today in, 21st century, we can’t ignore the presences of computers and its importance.
It is their in every part of life, society, business, education. Computer provides a good
management and accurate estimation of the material. Every business and management
concern having computer system with them but software to handle them is again a big
problem. User should be able to understand the software and most important software
should serve all the corner of concern.
In this project we are dealing with CSMTL (Computerization of Sood Medicine Traders
Limited). A big or small Medicine Traders requires proper utilization of recourses and
management of Consignment of Sale Purchase, Stock Transaction Record which is of
most importance.
Sood Medicine Trader Limited is concerned more with serving lots of customers
(wholesalers & retailers). Number of customers visits SMTL (Sood Medicine Traders
Ltd). daily for purchasing medicine. Record of each and every customers, their payment
discount, and dead material recovered are major concern to store. What type of material,
a particular customers has received in the SMTL, what was the date, types of material,
modes of payment all these should be available as and when demanded. Information of
SMTL’s property and utilities available to customers, list of medicine and surgical items,
detail of Staff members, information of all the Departments, Room details was work
assigned to administration department and now handled through one person with the use
of this software. Security of the database is available in this software by providing
centralized database system. Data can be stored on system or can be kept on auxiliary
devices.
Stocks and Accounts records maintenance of medicine trade a big problem. A different
authority needed to handle stock and accounts. Again getting information of stock and
accounts at the moment was a difficult job which also includes the possibilities of wrong
information, so decision goes in wrong direction. Stock and account statement is again a
big time consuming task. So to reduce all these problems computer software will again
help human.
11
Quarries of normal person (outsiders) regarding information of medicine like rate, date of
mfg., discount etc is solved without much effort.
This software will help management in easy decision making and this will save time and
efforts.
This software can be used by every medicine trade. This also includes facility of adding
extra features to enhance the scope of software, suppose presently medicine trade don’t
have medical representative, own transportation etc. but these field can be add on in this
software later without much difficulties. This shows flexibility of software. But initially it
will cover most essential aspects of the medicine trade which can’t be left untouched.
12
Previous Systems
Fact finding means to trace the following factors in the field of SYSTEM ANALYSIS
AND DESIGN. The fact finding passes through the following stages.
Fact-finding is also called feasibility study. SYSTEM ANALYSIS AND DESIGN is just as
a manufacturing unit in which raw material is entered as input, machine and plant work
as process and products/finished goods as output. In the SAD the raw data is the input,
programs are the processes and information is output. Some time if the information is not
up to the standards then the output can be fed to the system as input - It means it work as
a cycle. So that why SAD is also called SDLC i.e. System Development Life Cycle.
During the system analysis, it is found that the old system is the manual system. The old
system has following disadvantages
1. It was very difficult to maintain the Records, Reports, list, Register etc. relating to
Students, Faculties and items stocks information.
2. No automated tool like COMPUTER is used for the processing.
3. More staff was required.
4. Due to manual work, lot of hard work done by staff to accomplish the certain task.
13
Need of the New System
Need of new system is required because old system has following limitations.
14
Proposed System
The new recommended system is also a computerized system, which has many
advantages over the old one.
15
FEASIBILITY STUDY
The project is basically designed to give a friendly approach to the fast working
environment of medicine trade were one of the main function in the sale purchase and
stock is manage in their respective organizations
So this project has tried to work on each process of the system to give a
friendly approach to the user where by the employ’s of any particular organization can
work with the software without making less mistakes.
Also the software used is user friendly and the most advanced technology is
used to give the best layout to the system. Also the database storage and its security are
consistent while in day to day approach. Ever aspect of this project is well studied.
16
System Flowchart
Transactions
Display Reports
Query
Printed Reports
17
Project Flow Chart
Start
Do the data
matches
Close the system and Load Software Menu
print an error message
Transaction System
18
About the Project
Introduction
Gives full detail about the available stock of medicine and other surgical items.
DATA Management.
Daily Reports.
19
DATABASE
DESIGN
20
Database Details
Table AcDet
Field Name Type Description
Aname varchar2(50) Account Name
Address varchar2(100)
Root varchar2(50) City Area Divided in Roots
Phno varchar2(20)
FaxNo varchar2(20)
VatNo varchar2(20)
StCst varchar2(20)
ope number(10) Opening Balance
oSide varchar2(20) Dr. / Cr.
Grp varchar2(40) Group
Remark varchar2(120)
21
Table itemMaster
22
Table Name Transaction
Column Name Data Type Remarks
vn number(10) Voucher No.
edate varchar2(15) Entry Date
acr varchar2(50) A/c Cr.
cg varchar2(50) Cr. Group
cn varchar2(150) Narration
camt number(10) Cr amount
adr varchar2(50) A/c Dr.
dg varchar2(50) Dr. Group
dn varchar2(150) Narration
damt number(10) Dr. Amount
kk varchar2(50) Key Field
vtype varchar2(50) Voucher Type
23
Table Name PurchaseMaster
24
Table PDet
Field Name Type Remarks
bno varchar2(20)
item varchar2(50)
grp varchar2(25) Tax Group
mrp varchar2(25)
srate number(10,2) Sale Rate
qty number(10,2)
sch number(10,2) Scheme
cname varchar2(100)
sno varchar2(50) Sales Tax No.
amt number(10,2) Amount
edate varchar2(50)
cost number(10,2) Cost Per Pcs.
25
Table SaleMaster
26
Table Name Sale Details
Field Name Types Remarks
bno number(10) Bill No.
BType varchar2(20) VAT / TOT
item varchar2(50)
grp varchar2(25) Tax Group
mrp varchar2(25)
qty number(10,2)
srate number(10,2)
sch number(10,2)
schp number(10,2) Scheme in Pieces
Discount number(10,2)
replace number(10,2) Replace Qty
amt number(10,2)
tax number(10,2) Tax Amount
27
DESCRIPTION
&
SCREEN SHOTS
28
NEW ACCOUNT CREATION
• Purpose of this window is to create a new account of the parties who’s Purchased
the material from SMTL, and material purchase by the SMTL to the other parties.
• In this window firstly we feed the name of the parties and chose the group like
Sundry debtor or sundry creditor, Vat no., Sale tax no., Address, Root of the customer,
Phone no. , Fax no., Opening balance of the party, Dr. or Cr. (chose any one), remarks
enter if any and last save it. The msgbox ‘saved’ is appeared for the confirmation purpose
of the task.
• If you want to change the record click on the name text box and choose any name
from the window and make changes in it and pressed the command button modified. The
record is modified and saved. The msgbox ‘saved’ is appeared for the confirmation
purpose of the task.
• If you want to delete any record first you select the record and pressed the delete
command button.
• If you want exit from this option click on exit button.
29
1.1 NEW ITEM GROUP
• Purpose of this window is to enter the tax category of newly item received by the
SMTL and click on save button. The msgbox ‘Record Saved’ is appeared for the
confirmation purpose of the task.
• If you want to change the category choose any one from the ‘Select Tax Category
to Modify’ window and make changes in it and click the command button modified. The
record is modified and saved. The msgbox ‘Modified’ is appeared for the confirmation
purpose of the task.
• If you want exit from this option click on exit button.
30
1.2 NEW ITEM
31
2. TRANSACTION MENU
2.1 SALE ENTRY
32
2.2 PURCHASE ENTRY
33
2.3 EXPIRY RETURN
• Purpose of this window to enter the details of any expiry return of material.
• In this window we select the party name, root of the party, item name and then
feed the quantity and rate of the material.
• If another item is return then click on next button and feed the detail then click
on the save button. The msgbox ‘Record Saved’ is appeared for the confirmation purpose
of the task and also show the Net amount.
• If you want exit from this option click on exit button.
34
2.4 VOUCHER
• Purpose of this window to enter the details of any receipt and payments.
• In this window feed the dr. name, amount, narration cr. name amount selected
account for created and narration, select the one radio button and click the save button.
• If you want to any changes in the bill click on modified button and feed the date,
voucher no., dr. name, amount, narration cr. name amount selected account for created and
narration, select the one radio button and click the modified button. The msgbox
‘Modified’ is appeared for the confirmation purpose of the task.
• If you want to clear any record first you select the record and pressed the clear
button.
• If you want to display any voucher select the field and criteria and value then
click on display button.
• If you want exit from this option click on exit button.
35
3. DISPLAY MENU
3.1 LEDGER
36
3.2 PURCHASE BILL
37
3.3 STOCK ITEM WISE
38
3.4 STOCK DATE WISE
• Purpose of this window to see the summary of any item date wise.
• Feed the date FROM and then feed the TO date who’s you want to see. The
summary of selected the item name and click on display button show in below.
• If you want exit from this option click on exit button.
39
• Purpose of this window to see the summary of expiry stock.
• To see the summary of expiry stock click on the option expiry stock from the
display menu.
• If you want exit from this window click on close button form the menu bar.
4. SYSTEM MENU
40
4.1 ADD USER
41
• Purpose of this window to exit from the window.
• If you want exit from the window click on yes button.
SOURCE CODE
Login Form
42
Dim SQLQuerry As String
Private Sub butCancel_Click()
End
End Sub
43
End If
If Len(Trim(txtPassword.Text)) = 0 Then
IsValidField = False
MsgBox "Password Should be Valid.", vbCritical, "Medicine Store"
Exit Function
Else
IsValidField = True
End If
End Function
Main Form
Dim rr As String
Private Sub MDIForm_Load()
'MakeConnection "Temp.mdb"
MakeConnection
VarVchForMix = GenVchNo
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error GoTo rr
44
If Button.Caption = "Close" Then
Unload frmMain.ActiveForm
Toolbar1.Buttons.Item(6).Visible = False
ElseIf Button.Caption = "Help" Then
frmHelp.Show
End If
rr:
If Err.Number = 91 Then
Err.Clear
End If
End Sub
45
frmStockSummary.Label2.Visible = False
frmStockSummary.Label3.Visible = False
frmStockSummary.Label4.Visible = False
frmStockSummary.lblSale.Visible = False
frmStockSummary.lblPurchase.Visible = False
frmStockSummary.Show
ElseIf ButtonMenu.Text = "Stock Date Wise" Then
Unload frmMain.ActiveForm
Module1.isu = "dw"
frmStockSummary.txtStDate.Visible = True
frmStockSummary.txtEdDate.Visible = True
frmStockSummary.Combo1.Visible = True
frmStockSummary.butDisplay.Visible = True
frmStockSummary.txtChar.Visible = False
frmStockSummary.Label1.Visible = False
frmStockSummary.ListView2.Visible = True
frmStockSummary.Label2.Visible = True
frmStockSummary.Label3.Visible = True
frmStockSummary.butPrint.Visible = False
frmStockSummary.lblDate1.Visible = True
frmStockSummary.lblDate2.Visible = True
frmStockSummary.butPrint.Visible = False
frmStockSummary.ProgressBar1.Visible = False
frmStockSummary.lblSale.Visible = True
frmStockSummary.lblPurchase.Visible = True
frmStockSummary.Show
ElseIf ButtonMenu.Text = "Expiry Stock" Then
Unload frmMain.ActiveForm
With DataEnvironment1
If .rsExpiry.State = adStateClosed Then
.rsExpiry.Open
End If
.rsExpiry.Requery
.rsExpiry.Requery
.rsExpiry.Requery
.rsExpiry.Requery
.rsExpiry.Requery
End With
frmMain.Toolbar1.Buttons.Item(6).Visible = True
RptExpiry.Show
ElseIf ButtonMenu.Text = "Add User" Then
Unload frmMain.ActiveForm
frmAddUser.Show
ElseIf ButtonMenu.Text = "Create Tables" Then
CreateTables
46
ElseIf ButtonMenu.Text = "Exit" Then
If MsgBox("Sure to Quit !", vbYesNo, "Medicine Store") = vbYes
Then
End
End If
End If
rr:
If Err.Number = 91 Then
Resume Next
End If
End Sub
47
Open New Account
Dim VarStoreNameToModify As String, VarStoreIndexOfCmbName As
Double
Dim SQLQuerry As String
Private Sub butCancel_Click()
Unload Me
End Sub
48
End With
End Function
49
.Close
End If
.Open SQLQuerry, cn, adOpenKeyset
If .RecordCount > 0 Then
txtName.Text = .Fields("Aname").Value
txtAdd.Text = .Fields("address").Value
txtRoot.Text = .Fields("root").Value
txtPh.Text = .Fields("phno").Value
txtFax.Text = .Fields("faxno").Value
txtVat.Text = .Fields("vatno").Value
txtST.Text = .Fields("stcst").Value
txtOp.Text = .Fields("ope").Value
If .Fields("OSide").Value = "Dr" Then
optDebit.Value = True
Else
optCredit.Value = True
End If
txtGrp.Text = .Fields("grp").Value
If .Fields("grp").Value <> "Indirect Income" And
.Fields("grp").Value <> "Indirect Expense" Then
Frame1.Visible = True
Frame2.Visible = True
Else
Frame1.Visible = False
Frame2.Visible = False
End If
txtremak.Text = .Fields("remark").Value
End If
End With
Set TempRstFindName = Nothing
End Sub
50
Frame1.Visible = False
Frame2.Visible = False
Else
Frame1.Visible = True
Frame2.Visible = True
End If
End Sub
51
Private Sub txtOp_KeyPress(KeyAscii As Integer)
NumAllowOnly txtOp, KeyAscii
End Sub
52
Loop
End If
.Close
Set TempRstRoot = Nothing
End With
End Sub
If Len(Trim(txtGrp.Text)) = 0 Then
MsgBox "Select Groip From List", , "Medicine Store"
txtGrp.SetFocus
Exit Function
IsFieldValid = False
End If
53
Exit Function
IsFieldValid = False
End If
If Len(Trim(txtVat.Text)) = 0 Then
txtVat.Text = " "
End If
If Len(Trim(txtPh.Text)) = 0 Then
txtPh.Text = " "
End If
If Len(Trim(txtST.Text)) = 0 Then
txtST.Text = " "
End If
If Len(Trim(txtFax.Text)) = 0 Then
txtFax.Text = " "
End If
If Len(Trim(txtAdd.Text)) = 0 Then
txtAdd.Text = " "
End If
If Len(Trim(txtremak.Text)) = 0 Then
txtremak.Text = " "
End If
54
"," & "'" & VarSideOP & "'" & "," & "'" & txtGrp.Text & "'" & "," & "'" &
txtremak.Text & "'" & ")"
MsgBox "Saved", , "Medicine Store"
End Sub
55
Add New User
Dim SQLQuerry As String
Dim varRecModify As Boolean
Private Sub butCancel_Click()
Unload Me
End Sub
56
Private Sub butModify_Click()
If Len(Trim(txtMUserName.Text)) = 0 Or
Len(Trim(txtMPassWord.Text)) = 0 Then
MsgBox "User Name / Password must be entered for
Modification", vbCritical, "Medicine Store"
Exit Sub
End If
Dim RstUserD As New ADODB.Recordset
If IsValidField Then
If CheckUserForModify Then
With RstUserD
.Open "Select * from UserD", cn, adOpenKeyset,
adLockOptimistic
Do While Not .EOF
If .Fields(0).Value = txtMUserName.Text And
.Fields(1).Value = txtMPassWord.Text Then
.Fields(0).Value = txtUser.Text
.Fields(1).Value = txtPassword.Text
.Update
Exit Do
End If
.MoveNext
Loop
End With
'cn.Execute " Update USerd set psswd = " & "'" &
txtMPassWord.Text & "'" & " where uName = " & "'" & txtUser.Text &
"'"
'cn.Execute " Update Userd set UNAme = " & "'" &
txtMUserName.Text & "'" & " where uName = " & "'" & txtUser.Text &
"'"
MsgBox "Record Update!", , "Medicine Store"
ClearFields
End If
End If
End Sub
57
frmAddUser.Top = (Screen.Height - frmAddUser.Height) / 2
End Sub
58
SQLQuerry = "Select * from syst where UNAme = " & "'" &
txtMUserName.Text & "'" & " and Psswd =" & "'" & txtMPassWord.Text
& "'"
With rsCmdLogin1
If .State = adStateOpen Then
.Close
End If
.Open SQLQuerry, cn, adOpenKeyset, adLockReadOnly
If .RecordCount > 0 Then
If Not IsNull(.Fields(0).Value) Then
CheckUserForModify = True
Exit Function
Else
CheckUserForModify = False
Exit Function
End If
Else
CheckUserForModify = False
End If
End With
End Function
59
txtUser.Text = ""
txtPassword.Text = ""
txtRPassword.Text = ""
txtMPassWord.Text = ""
txtMUserName.Text = ""
txtUser.SetFocus
End Sub
60
Display Purchase Bill
Dim pm As New Recordset
Dim pd As New Recordset
Dim cd As New Recordset ' for creditor
Dim name1 As String, bn As String, da As String
Dim tam As String, dis As String
Dim fr As String, lo As String
Dim SQLQuerry As String
If cmbName.ListIndex = -1 Then
MsgBox "Select Company Name", , "Medicine Store"
Exit Sub
End If
txtBillNo.Text = UCase(txtBillNo.Text)
If Len(Trim(txtBillNo.Text)) = 0 Then
MsgBox "Enter BiLL No", , "Medicine Store"
Exit Sub
End If
pm.Open " select * from pmain where cname=" & "'" &
cmbName.Text & "'" & " and bno =" & "'" & txtBillNo.Text & "'", cn,
adOpenKeyset, adLockPessimistic
If pm.RecordCount = 0 Then
MsgBox "Bill Not Exist", vbCritical, "Invalid Data"
pm.Close
Exit Sub
End If
name1 = pm!cname
bn = pm!bno
da = pm!eDate
61
tam = Str(pm!amt)
dis = Str(pm.Fields(4).Value)
fr = Str(pm.Fields(7).Value)
lo = Str(pm.Fields(6).Value)
pd.Open " select * from pdet where cname=" & "'" & cmbName.Text
& "'" & " and bno =" & "'" & txtBillNo.Text & "'", cn, adOpenDynamic,
adLockPessimistic
Dim f As Integer
f=0
Do While Not pd.EOF = True
If UCase(Trim(pd!bno)) = Trim(UCase(txtBillNo.Text)) And
Trim(UCase(pd!cname)) = Trim(UCase(cmbName.Text)) Then
f=1
End If
pd.MoveNext
Loop
If f = 0 Then
MsgBox "Bill Not Exist", , "Medicine Store"
Exit Sub
End If
62
& "'" & sp & "'" & ")"
sp1 = "--------------------------------------------------------------------"
sp1 = "PARTICULARS"
sp2 = "MRP"
sp3 = "RATE"
sp4 = "QTY"
sp5 = "SCH"
sp6 = "TYPE"
sp7 = "AMOUNT"
sp8 = " "
sp = " "
63
& "'" & sp4 & "'" & "," _
& "'" & sp5 & "'" & "," _
& "'" & sp6 & "'" & "," _
& "'" & sp7 & "'" & "," _
& "'" & sp & "'" & ")"
sp1 = "--------------------------------------------------------------------"
sno = 1
pd.MoveFirst
Do While Not pd.EOF = True
sp1 = pd!Item
sp2 = pd!mrp
sp3 = Str(pd!srate)
sp4 = Str(pd!qty)
sp5 = Str(pd!sch)
sp6 = pd!grp
sp7 = Str(pd!amt)
sno = sno + 1
64
pd.MoveNext
Loop
sp1 = "--------------------------------------------------------------------"
sp2 = "DISCOUNT"
sp3 = dis
sp1 = " "
cn.Execute "insert into bil values(" _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp2 & "'" & "," _
& "'" & sp3 & "'" & "," _
& "'" & sp & "'" & ")"
sp2 = "LABOUR"
sp3 = lo
sp1 = " "
cn.Execute "insert into bil values(" _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp2 & "'" & "," _
& "'" & sp3 & "'" & "," _
& "'" & sp & "'" & ")"
65
sp2 = "FR & OCT."
sp3 = fr
sp1 = " "
cn.Execute "insert into bil values(" _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp1 & "'" & "," _
& "'" & sp2 & "'" & "," _
& "'" & sp3 & "'" & "," _
& "'" & sp & "'" & ")"
ProgressBar1.Visible = True
sp1 = "--------------------------------------------------------------------"
66
Dim yy As Double
With DataEnvironment1
If .rsBill.State = adStateOpen Then
DataEnvironment1.rsBill.Close
End If
.rsBill.Source = "select * from bil"
.rsBill.Open
End With
Set pm = Nothing
Set pd = Nothing
Set cd = Nothing
Set cn = Nothing
frmMain.Toolbar1.Buttons.Item(6).Visible = True
Unload Me
RptPurBill.Show
'ss:
' If Err.Number = 3021 Then
' Resume Next
' End If
End Sub
67
Private Sub Form_Unload(Cancel As Integer)
Set pm = Nothing
Set pd = Nothing
Set cd = Nothing
Set cn = Nothing
End Sub
68
Help Form
Private Sub cmbHelp_Click()
Dim ss As String
On Error GoTo ss
If cmbHelp.ListIndex = 0 Then
txtHelpBox.LoadFile App.Path + "\AbtPrj.rtf"
ElseIf cmbHelp.ListIndex = 1 Then
txtHelpBox.LoadFile App.Path + "\NACCCre.rtf"
ElseIf cmbHelp.ListIndex = 2 Then
txtHelpBox.LoadFile App.Path + "\NItemG.rtf"
ElseIf cmbHelp.ListIndex = 3 Then
txtHelpBox.LoadFile App.Path + "\NItem.rtf"
ElseIf cmbHelp.ListIndex = 4 Then
txtHelpBox.LoadFile App.Path + "\SEntry.rtf"
ElseIf cmbHelp.ListIndex = 5 Then
txtHelpBox.LoadFile App.Path + "\PEntry.rtf"
ElseIf cmbHelp.ListIndex = 6 Then
txtHelpBox.LoadFile App.Path + "\EXPRETURN.rtf"
ElseIf cmbHelp.ListIndex = 7 Then
txtHelpBox.LoadFile App.Path + "\VOUCHER.rtf"
ElseIf cmbHelp.ListIndex = 8 Then
txtHelpBox.LoadFile App.Path + "\Ledger.rtf"
ElseIf cmbHelp.ListIndex = 9 Then
txtHelpBox.LoadFile App.Path + "\Display PURCHASE BILL.rtf"
ElseIf cmbHelp.ListIndex = 10 Then
txtHelpBox.LoadFile App.Path + "\STOCK ITEM WISE.rtf"
ElseIf cmbHelp.ListIndex = 11 Then
txtHelpBox.LoadFile App.Path + "\STOCK Date WISE.rtf"
ElseIf cmbHelp.ListIndex = 12 Then
txtHelpBox.LoadFile App.Path + "\EXPIRY STOCK.rtf"
ElseIf cmbHelp.ListIndex = 13 Then
txtHelpBox.LoadFile App.Path + "\ADD USER.rtf"
End If
ss:
If Err.Number = 75 Then
MsgBox "Help File Missing", vbCritical, "Sood Medicine Store"
Err.Clear
Resume Next
End If
End Sub
69
End Sub
70
Item Group
Dim StoreItemGrpToModify As String
Dim SQLQuerry As String
Private Sub PopulateCmbItemGrp()
cmbItemGrp.Clear
Dim TempRstCmbgrp As New ADODB.Recordset
SQLQuerry = "Select * from ItemGrpDet order by ItemGrp"
With TempRstCmbgrp
.Open SQLQuerry, cn, adOpenKeyset
If .RecordCount > 0 Then
Do While Not .EOF
cmbItemGrp.AddItem .Fields("ItemGrp").Value
.MoveNext
Loop
End If
End With
Set TempRstCmbgrp = Nothing
End Sub
71
If IsFieldValid = False Then
Exit Sub
End If
If IsRecordAlreadyExist(txtItemGrp.Text) = True Then
Exit Sub
End If
Call SaveDataInItemGrpDet
MsgBox "Record Saved", , "Medicine Store"
txtItemGrp.Text = ""
Call PopulateCmbItemGrp
End Sub
72
MsgBox "Record Already Exist", , "Medicine Store"
Exit Function
Else
IsRecordAlreadyExist = False
End If
End With
Set TempRstExistGrp = Nothing
End Function
73
Item Transaction
Dim StoreItemNameToModify As String
Dim SQLQuerry As String
Private Sub butCancel_Click()
Unload Me
End Sub
74
PopulateCmbItem
End Sub
75
Call PopulateCmbItem
End Sub
76
If Len(Trim(txtItem.Text)) = 0 Then
MsgBox "Enter A Valid Item Name", , "Medicine Store"
IsFieldsValid = False
Exit Function
End If
If Len(Trim(txtItemGrp.Text)) = 0 Then
MsgBox "Select A Valid Group", , "Medicine Store"
IsFieldsValid = False
txtItemGrp.SetFocus
Exit Function
End If
77
Private Function IsItemAlreadyExist(varItemName As String) As
Boolean
SQLQuerry = "Select * from ItemDet where iname = " & "'" &
varItemName & "'"
Dim RstChekItemExist As New ADODB.Recordset
With RstChekItemExist
.Open SQLQuerry, cn, adOpenKeyset
If .RecordCount > 0 Then
MsgBox "Item Already Exist", , "Medicine Store"
IsItemAlreadyExist = True
Exit Function
Else
IsItemAlreadyExist = False
End If
End With
End Function
78
End Sub
79
Voucher Entry
Dim RstFindRec As New ADODB.Recordset
Dim varDrIndex As Integer, varCrIndex As Integer
Dim varStoreVchType As String, VarClickedDisplay As Boolean,
SQuerry As String
Dim varSelFieldIndex As Integer
Private Sub PopulateCmbs()
Dim TempRstAcco As New ADODB.Recordset
Dim SQLQuerry As String
SQLQuerry = "Select aname,grp from Acdet"
With TempRstAcco
If .State = adStateOpen Then
.Close
End If
.Open SQLQuerry, cn, adOpenKeyset, adLockPessimistic
Do While Not .EOF
cmbDr.AddItem .Fields("Aname").Value
cmbDrG.AddItem .Fields("grp").Value
cmbCr.AddItem .Fields("Aname").Value
cmbCrG.AddItem .Fields("grp").Value
.MoveNext
Loop
End With
End Sub
80
Exit Sub
Else
'ClearFields
'EnableDisable frmLabMaster, False
butFirst_Click
End If
End Sub
81
.Fields("Acr").Value = txtAcr.Text
.Fields("Cg").Value = cmbCrG.List(varCrIndex)
.Fields("Cn").Value = txtCn.Text
.Fields("Camt").Value = Val(txtCamt.Text)
.Fields("Adr").Value = txtAdr.Text
.Fields("Dg").Value = cmbDrG.List(varDrIndex)
.Fields("dn").Value = txtDn.Text
.Fields("Damt").Value = Val(txtDamt.Text)
If optReceipt.Value = True Then
.Fields("vType").Value = optReceipt.Caption
ElseIf optPayment.Value = True Then
.Fields("vType").Value = optPayment.Caption
Else
.Fields("vType").Value = optJournal.Caption
End If
.Update
End With
MsgBox "Saved", , "Medicine Store"
Call ClearFields
cmbDr.SetFocus
End Sub
Private Function GenVchNo()
Dim SQLQuerry As String
Dim RstMixVch As New ADODB.Recordset
With RstMixVch
SQLQuerry = "Select count(*),max(vn) from mix"
If .State = adStateOpen Then
.Close
End If
.Open SQLQuerry, cn, adOpenKeyset, adLockPessimistic
If .State = adStateOpen Then
If Not IsNull(.Fields(0).Value) Then
If .Fields(0).Value > 0 Then
GenVchNo = .Fields(1).Value + 1
Else
GenVchNo = 1
End If
Else
GenVchNo = 1
End If
End If
End With
End Function
82
MsgBox "Invalid Not Possible", , "Medicine Store"
IsFieldEmpty = True
Exit Function
End If
If Len(Trim(txtAdr.Text)) = 0 Then
MsgBox "A/c Debit", , "Medicine Store"
IsFieldEmpty = True
Exit Function
End If
If Len(Trim(txtAcr.Text)) = 0 Then
MsgBox "A/c Credit", , "Medicine Store"
IsFieldEmpty = True
Exit Function
End If
83
' txtDn.Text = ""
' txtCn.Text = ""
'End Sub
Private Sub cmbCr_Click()
varCrIndex = cmbCr.ListIndex
txtAcr.Text = cmbDr.List(cmbCr.ListIndex)
End Sub
84
Private Sub Form_Activate()
Me.Top = 250
Me.Left = 500
End Sub
85
txtDamt.Text = txtDamt.Text + vbkeyascii
Else
If KeyAscii = 13 Then
txtDn.SetFocus
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
86
DisplayFindValue
End If
End With
VarClickedDisplay = True
End Sub
87
If txtAcr.Text = cmbCr.List(h) Then
varCrIndex = h
End If
Next
cmbCrG.List(varCrIndex) = .Fields("Cg").Value
txtCn.Text = .Fields("Cn").Value
txtCamt.Text = .Fields("Camt").Value
txtAdr.Text = .Fields("Adr").Value
For h = 0 To cmbDr.ListCount - 1
If txtAdr.Text = cmbDr.List(h) Then
varDrIndex = h
End If
Next
cmbDrG.List(varDrIndex) = .Fields("Cg").Value
txtDn.Text = .Fields("Cn").Value
txtDamt.Text = .Fields("Damt").Value
If .Fields("vType").Value = optReceipt.Caption Then
optReceipt.Value = True
ElseIf .Fields("vType").Value = optPayment.Caption Then
optPayment.Value = True
Else
optJournal.Value = True
End If
End With
End Sub
88
SQLQuerry = "Select * from mix where " & varFName & " = " & "'"
& varValue & "'"
End If
With RstFindRec
If .State = adStateOpen Then
.Close
End If
.Open SQLQuerry, cn, adOpenKeyset, adLockReadOnly
If .RecordCount > 0 Then
FindOpenRecordSet = True
VarClickedDisplay = True
Else
FindOpenRecordSet = False
End If
End With
End Function
89
.Fields("Cg").Value = cmbCrG.List(varCrIndex)
.Fields("Cn").Value = txtCn.Text
.Fields("Camt").Value = Val(txtCamt.Text)
.Fields("Adr").Value = txtAdr.Text
.Fields("Dg").Value = cmbDrG.List(varDrIndex)
.Fields("dn").Value = txtDn.Text
.Fields("Damt").Value = Val(txtDamt.Text)
If optReceipt.Value = True Then
.Fields("VType").Value = optReceipt.Caption
ElseIf optPayment.Value = True Then
.Fields("VType").Value = optPayment.Caption
Else
.Fields("VType").Value = optJournal.Caption
End If
.Update
End If
End With
End Sub
90
Ledger
Dim TempRst As New ADODB.Recordset
Dim i As Integer, j As Integer
Private Sub butClose_Click()
Unload Me
End Sub
If cmbAcco.ListIndex = -1 Then
MsgBox "Select A/c To List", , "Medicine Store"
cmbAcco.SetFocus
Exit Sub
End If
cmbAcco.SetFocus
cn.Execute "delete from led"
Me.MousePointer = vbHourglass
tmix.Open "select * from mix where Adr =" & "'" &
cmbAcco.List(cmbAcco.ListIndex) & "'" & " or Acr = " & "'" &
cmbAcco.List(cmbAcco.ListIndex) & "'" _
91
& " order by vn ", cn, adOpenKeyset, adLockPessimistic
j=1
i=1
Dim d As Double, c As Double
Dim fg As Integer
Dim td As Double, tc As Double
td = 0
tc = 0
ListView1.ListItems.Clear
tot1 = 0
tot2 = 0
92
Else
.SubItems(i) = " "
End If
i=i+1
If tc > td Then
.SubItems(i) = Str(tc - td) + " Cr"
ElseIf td > tc Then
.SubItems(i) = Str(td - tc) + " Dr"
Else
.SubItems(i) = "NiLL"
End If
j=j+1
End With
i=1
End If
93
If fg = 1 Or fg = 2 Then
Set a = ListView1.ListItems.Add(j, , tmix!eDate)
With a
If IsNull(pa) Then
.SubItems(i) = " "
Else
.SubItems(i) = pa
End If
i=i+1
If Val(da) > 0 Then
.SubItems(i) = Val(da)
Else
.SubItems(i) = " "
End If
i=i+1
If Val(ca) > 0 Then
.SubItems(i) = Val(ca)
Else
.SubItems(i) = " "
End If
i=i+1
If Val(td) > Val(tc) Then
.SubItems(i) = Str(Round(td - tc, 2)) + " Dr"
ElseIf Val(tc) > Val(td) Then
.SubItems(i) = Str(Round(tc - td, 2)) + " Cr"
Else
.SubItems(i) = "NiLL"
End If
j=j+1
End With
i=1
End If
tmix.MoveNext
pa = ""
ca = ""
da = ""
Loop
d=0
c=0
d=0
c=0
i=0
Dim jd As Double
For i = 1 To ListView1.ListItems.Count
d = d + Val(ListView1.ListItems(i).SubItems(2))
94
c = c + Val(ListView1.ListItems(i).SubItems(3))
jd = 0
If d > c Then
bb = Str(Round(d - c, 2)) + " Dr"
hh1 = d - c
Else
If c > d Then
bb = Str(Round(c - d, 2)) + " Cr"
hh1 = c - d
Else
bb = "NiLL"
End If
End If
ListView1.ListItems(i).SubItems(4) = bb
Next
t1 = d
t2 = c
t3 = bb
tmix.Close
Set tmix = Nothing
Me.MousePointer = vbNormal
'ss:
' If Err.Number = 3021 Then
' Resume Next
' End If
End Sub
95
End Sub
End Sub
96
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
d1 = UCase(Label1.Caption)
d2 = "Account Of "
d3 = " "
cn.Execute "insert into led values(" & "'" & d2 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d3 & "'" _
& "," & "'" & d3 & "'" _
& "," & "'" & d3 & "'" & ")"
d1 =
"--------------------------------------------------------------------------------------------------
--"
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" & ")"
d1 = "DATE"
d2 = "PARTICULARS"
d3 = "DEBIT"
d4 = "CREDIT"
d5 = "BALANCE"
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d2 & "'" _
& "," & "'" & d3 & "'" _
& "," & "'" & d4 & "'" _
97
& "," & "'" & d5 & "'" & ")"
d1 =
"--------------------------------------------------------------------------------------------------
--"
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" & ")"
For i = 1 To ListView1.ListItems.Count
Next
d1 =
"-------------------------------------------------------------------------------------------"
98
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" & ")"
d1 = " "
d2 = "TOTAL "
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d2 & "'" _
& "," & "'" & FormatNumber(tot1, , vbUseDefault) & "'" _
& "," & "'" & FormatNumber(tot2, , vbUseDefault) & "'" _
& "," & "'" & t3 & "'" & ")"
d1 =
"-------------------------------------------------------------------------------------------"
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" & ")"
cn.Execute "insert into led values(" & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" _
& "," & "'" & d1 & "'" & ")"
ss:
If Err.Number = 8542 Then
MsgBox "Please Increase Paper Size into Printer settings",
vbCritical, "Invalid Paper Size"
Err.Clear
Exit Sub
End If
End Sub
99
txtSt.Text = txtSt.Text + vbkeyascii
Else
If KeyAscii = 13 Then
txtEd.SetFocus
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
100
Purchase Entry
'Option Explicit
Dim ty As String
Dim it As New Recordset ' for item list
Dim clist As New Recordset ' for list of creditor
Dim tmix As New Recordset ' for getting max voucher number
Dim itype As String, imrp As String ' for cmbItem store mrp or group
Dim b As ColumnHeader
Dim a As ListItem
Dim sno As String
Dim i As Integer, j As Integer, c As Integer 'for listview
Dim q As Double ' for modify purchase store limit of qty
Dim q1 As Double ' for total sale modify purchase
Dim bnum As String ' for bill number for modify purchase
Dim ky As String
Dim sq As Double
'Dim t As Double 'for total sale sch or replace pcs
'Dim t1 As Double ' for total purchase pcs
Dim tpp As Double ' for total purchase
Dim tem As Double ' for purchase modify store pcs in case of p modi
101
Private Sub cmbName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmbItem.SetFocus
End If
End Sub
102
MsgBox "Enter Bill Date", vbOKOnly, "DD-MM-YY"
Exit Sub
End If
txtBillNo.Text = UCase(txtBillNo.Text)
If Len(txtBillNo.Text) = 0 Then
MsgBox "Enter Bill No", , "Medicine Store"
Exit Sub
End If
If Len(txtName.Text) = 0 Then
MsgBox "Select company Name", , "Medicine Store"
Exit Sub
End If
If checkBillAlreadyExist Then
MsgBox "Bill Already Exist", , "Medicine Store"
Exit Sub
End If
103
End If
clist.MoveNext
Loop
End If
Dim ch As String
If Len(txtDiscTotal.Text) = 0 Then
ch = MsgBox("Do You Want Enter Disocunt", vbYesNo, "Medicine
Store")
If ch = vbYes Then
Exit Sub
Else
txtDiscTotal.Text = 0
End If
End If
If Len(txtFr.Text) = 0 Then
ch = MsgBox("Do You Want Enter Freight & Octroi", vbYesNo,
"Medicine Store")
If ch = vbYes Then
Exit Sub
Else
txtFr.Text = 0
End If
End If
If Len(txtLabour.Text) = 0 Then
ch = MsgBox("Do You Want Enter Labour", vbYesNo, "Medicine
Store")
If ch = vbYes Then
Exit Sub
Else
txtLabour.Text = 0
End If
End If
If ListView1.ListItems.Count = 0 Then
104
MsgBox "Click On Next Button", , "Medicine Store"
Exit Sub
End If
For i = 1 To ListView1.ListItems.Count
'cn.Execute "insert into [pdet] values(" & "'" & txtBillNo.Text & "'"
& "," & "'" & ListView1.ListItems.Item(i).SubItems(1) & "'" & "," & "'" &
ListView1.ListItems.Item(i).SubItems(2) & "'" & "," & "'" &
ListView1.ListItems.Item(i).SubItems(3)& "'" & "," &
val(ListView1.ListItems.Item(i).SubItems(4)) & "," &
val(ListView1.ListItems.Item(i).SubItems(5) & "," &
val(ListView1.ListItems.Item(i).SubItems(6))& "," & "'"& txtName.Text &
"'" & "," & "'" & sno & "'" & "," &
val(ListView1.ListItems.Item(i).SubItems(7)) & ")"
cn.Execute "insert into pdet values(" & "'" & txtBillNo.Text & "'" &
"," & "'" & ListView1.ListItems.Item(i).SubItems(1) & "'" & "," & "'" &
ListView1.ListItems.Item(i).SubItems(2) & "'" & "," & "'" &
ListView1.ListItems.Item(i).SubItems(3) & "'" & "," &
Val(ListView1.ListItems.Item(i).SubItems(4)) & "," &
Val(ListView1.ListItems.Item(i).SubItems(5)) & "," &
Val(ListView1.ListItems.Item(i).SubItems(6)) & "," & "'" & txtName.Text
& "'" & "," & "'" & sno & "'" & "," &
Val(ListView1.ListItems.Item(i).SubItems(7)) & "," & "'" &
CDate(txtDate.Text) & "'" & "," &
Val(ListView1.ListItems.Item(i).SubItems(8)) & ")"
tot = tot + Val(ListView1.ListItems.Item(i).SubItems(7))
Next
tot = tot - Val(txtDiscTotal.Text)
txtTotal.Text = Str(tot)
cn.Execute "insert into pmain values(" & "'" & CDate(txtDate.Text) &
"'" & "," & "'" & txtBillNo.Text & "'" & "," & "'" & txtName.Text & "'" &
"," & "'" & ty & "'" & "," & Val(txtDiscTotal.Text) & "," &
Val(txtTotal.Text) & "," & Val(txtLabour.Text) & "," & Val(txtFr.Text) &
")"
' block start for saving dis freight labour entry in mix
105
Dim k As String, b1 As String
Dim nar As String, an1 As String, nar1 As String
Dim tg As String, an2 As String, typ As String
Dim k1 As Double
k1 = 0
Dim t1 As String
typ = "Purchase"
Module1.vch = Module1.vch + 1
106
& ")"
End If
End If
107
typ = "Expense"
Module1.vch = Module1.vch + 1
cn.Execute "insert into mix values(" & Module1.vch & "," & "'" &
txtDate.Text & "'" & "," _
& "'" & an2 & "'" & "," & "'" & tg & "'" & "," & "'" & nar1 & "'" & ","
_
& Val(txtLabour.Text) & "," & "'" & an1 & "'" & "," & "'" & t1 & "'" &
"," _
& "'" & nar & "'" & "," & Val(txtLabour.Text) & "," & "'" & k & "'" &
"," & "'" & typ & "'" _
& ")"
End If
' block close for saving dis freight labour entry in mix
i=1
j=1
c=1
108
cmbItem.SetFocus
If Len(txtItem.Text) = 0 Then
MsgBox "Select Item", , "Medicine Store"
cmbItem.SetFocus
Exit Sub
End If
If Len(txtSRate.Text) = 0 Then
MsgBox "Enter Sale Rate", , "Medicine Store"
txtSRate.SetFocus
Exit Sub
End If
If Len(txtQty.Text) = 0 Then
txtQty.Text = 0
txtQty.SetFocus
Exit Sub
End If
If Len(txtMrp.Text) = 0 Then
txtMrp.Text = " "
End If
If Len(txtSchPcs.Text) = 0 Then
txtSchPcs.Text = 0
End If
109
If Len(txtQty.Text) = 0 Then 'Or Val(txtAmtGroup.Text) <= 0
Then
MsgBox "Enter Amount GroupWise !", , "Medicine Store"
txtQty.SetFocus
Exit Sub
End If
End If
110
txtQty.Text = ""
txtSchPcs.Text = ""
txtAmtGroup.Text = ""
TxtCostPerUnit.Text = ""
End Sub
pm.Open "select * from pmain where bno=" & "'" & bnum & "'", cn,
adOpenStatic, adLockPessimistic
txtDate.Text = pm!eDate
txtBillNo.Text = pm!bno
txtName.Text = pm!cname
txtDiscTotal.Text = pm.Fields(4).Value
txtTotal.Text = pm.Fields(5).Value
111
txtFr.Text = pm.Fields(7).Value ' freight
Set a = ListView1.ListItems.Add(j, , c)
With a
.SubItems(i) = Str(c)
.SubItems(i) = pd!Item
i=i+1
.SubItems(i) = pd!grp
i=i+1
.SubItems(i) = pd!mrp
i=i+1
.SubItems(i) = Str(pd.Fields(4).Value)
i=i+1
.SubItems(i) = Str(pd.Fields(5).Value)
i=i+1
.SubItems(i) = Str(pd.Fields(6).Value)
i=i+1
.SubItems(i) = Str(pd.Fields(9).Value)
i=i+1
.SubItems(i) = Str(pd.Fields(11).Value)
End With
j=j+1
c=c+1
i=1
pd.MoveNext
Loop
ky = "B" + txtBillNo.Text + "D" + txtDate.Text + "P" +
txtName.Text
'ss:
' If Err.Number = 3021 Then
' Resume Next
' End If
End Sub
112
Exit Function
End If
pu.MoveNext
Loop
checkBillAlreadyExist = False
Set pu = Nothing
End Function
If IsNull(tmix.Fields(0).Value) Then
Module1.vch = 0
Else
Module1.vch = tmix.Fields(0).Value
End If
it.MoveFirst
Do While Not it.EOF = True
cmbItem.AddItem it!iname
it.MoveNext
Loop
clist.MoveFirst
Do While Not clist.EOF = True
If clist!grp = "Sundry Creditor" Then
cmbName.AddItem clist!aName
113
End If
clist.MoveNext
Loop
ListView1.ColumnHeaders.Add 1, , "Sr.", 500
ListView1.ColumnHeaders.Add 2, , "Item", 2800
ListView1.ColumnHeaders.Add 3, , "Group", 1100
ListView1.ColumnHeaders.Add 4, , "Mrp", 1100
ListView1.ColumnHeaders.Add 5, , "S_Rate", 1100
ListView1.ColumnHeaders.Add 6, , "Qty", 1200
ListView1.ColumnHeaders.Add 7, , "Sch", 1000
ListView1.ColumnHeaders.Add 8, , "Amt", 1200
ListView1.ColumnHeaders.Add 9, , "Cost 1 Pcs.", 1300
ss:
If Err.Number = 3021 Then
Resume Next
Else
If Err.Number = 94 Then
Module1.vch = 0
Resume Next
End If
End If
End Sub
ina =
ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(1)
114
' for sale
st.Open "select item,sum(qty+sch+replace) from sdet group by
item", cn, adOpenDynamic, adLockPessimistic
st.MoveFirst
Do While Not st.EOF = True
If st!Item = ina Then
t = st.Fields(1).Value
sq = st.Fields(1).Value
q1 = t
Exit Do
End If
st.MoveNext
Loop
If t > t1 Then
MsgBox "Item Qty Cannot Change", vbOKOnly, "Sale With Sch Or
Repl Qty is ", t
Set st = Nothing
Set pt = Nothing
Exit Sub
Else
q = t1 - t
If KeyCode = 46 Then
ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
If j > 1 Then
j=j-1
Else
j=1
End If
115
End If
End If
Else
If KeyCode = 46 Then
ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
If j > 1 Then
j=j-1
Else
j=1
End If
End If
End If
Set st = Nothing
Set pt = Nothing
ss:
If Err.Number = 3021 Then
Resume Next
End If
End Sub
116
If KeyAscii = 13 Then
txtFr.SetFocus
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
End Sub
End Sub
117
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 46 Or KeyAscii
= 8 Then
txtTotal.Text = txtTotal.Text + vbkeyascii
Else
If KeyAscii = 13 Then
Command1.SetFocus
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
118
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
119
Private Sub CalAmtGrp()
txtAmtGroup.Text = Val(txtSRate.Text) * Val(txtQty.Text)
End Sub
120
Sale Entry
Option Explicit
Dim ctr As Double
Dim VarStoreBillNoToModify As Double
Dim varGrpForMix As String, VarKey As String
Dim VarTotalTax As Double, VarTotalDiscount As Double
Dim VarSrNo As Integer, VarIndex As Integer
Dim VarBillType As String, varVatNo As String, VarAddress As String
Dim VarSaleType As String
Dim i As Integer, j As Integer, c As Integer
Dim SQLQuerry As String
Dim VarModifySale As Boolean
Dim VarStoreSaleTypeToModify As String
Private Sub PopulateCmbItem()
cmbItem.Clear
cmbGrp.Clear
cmbMrp.Clear
Dim TempRstItemPop As New ADODB.Recordset
SQLQuerry = "Select iname,itype,mrp from itemDet"
With TempRstItemPop
If .State = adStateOpen Then
.Close
End If
.Open SQLQuerry, cn, adOpenKeyset
If .RecordCount > 0 Then
.MoveFirst
Do While Not .EOF
cmbItem.AddItem .Fields("Iname").Value
cmbGrp.AddItem .Fields("itype").Value
cmbMrp.AddItem .Fields("mrp").Value
.MoveNext
Loop
End If
End With
Set TempRstItemPop = Nothing
End Sub
121
If .RecordCount > 0 Then
.MoveFirst
End If
Do While Not .EOF
cmbCustomer.AddItem .Fields("Aname").Value
.MoveNext
Loop
End With
End Sub
122
If Err.Number = 482 Then
MsgBox "Printer/Page Error", , "Medicine Store"
Err.Clear
Resume Next
End If
End Sub
123
If .RecordCount > 0 Then
txtRoot.Text = .Fields("Root").Value
VarAddress = .Fields("Address").Value
varVatNo = .Fields("VatNo").Value
End If
End With
Set TempRstSearchCust = Nothing
End Sub
End Sub
124
ListView1.ColumnHeaders.Add 10, , "REPL", 700
ListView1.ColumnHeaders.Add 11, , "AMOUNT", 1230
ListView1.ColumnHeaders.Add 12, , "Tax", 550
End Sub
125
If Len(Trim(txtItem.Text)) = 0 Then
MsgBox "Select Item From List", , "Medicine Store"
IsFieldValidForItemEntry = False
Exit Function
End If
IsFieldValidForItemEntry = True
End Function
126
For ctr = 1 To ListView1.ListItems.Count
ListView1.ListItems.Item(ctr).Text = ctr
Next
VarSrNo = ListView1.ListItems.Count
End Sub
127
Private Sub txtRate_Change()
Call CalculateAmountForSingleItem
Call TaxesForSingleItemOnly
End Sub
If Len(Trim(txtName.Text)) = 0 Then
MsgBox "Select Customer Name From List", , "Medicine Store"
IsFieldValid = False
Exit Function
End If
If ListView1.ListItems.Count = 0 Then
MsgBox "Click on Next Button", , "Medicine Store"
IsFieldValid = False
Exit Function
End If
IsFieldValid = True
End Function
128
VarTotalTax = VarTotalTax +
Val(ListView1.ListItems(varC).SubItems(11))
varSch = Round(Val(ListView1.ListItems(varC).SubItems(10)) *
Val(ListView1.ListItems(varC).SubItems(7)) / 100, 2)
varTotalSchPerc = varTotalSchPerc + varSch
VarTotalDiscount = VarTotalDiscount + Val(txtDiscItem.Text)
varAmount = varAmount +
Val(ListView1.ListItems(varC).SubItems(10))
Next
txtSaleAmount.Text = varAmount
txtSchTotal.Text = varTotalSchPerc + VarTotalDiscount
txtTaxTotal = VarTotalTax
txtTotalDisc.Text = Round(txtSaleAmount.Text *
Val(txtDiscountPerc.Text) / 100, 2)
txtNetAmount.Text = Val(txtSaleAmount.Text) -
Val(txtTotalDisc.Text) + Val(txtTaxTotal.Text) - Val(txtSchTotal.Text)
End Sub
129
& "," & "'" & "To Bill No " + txtBillNo.Text & "'" & "," &
Val(txtTotalDisc.Text) + Val(txtSchTotal.Text) & "," & "'" & VarKey & "'"
& "," & "'" & "DiscountS" & "'" & ")"
End If
Dim VarStoreValue As Double
VarStoreValue = Round(txtNetAmount.Text, 0)
If VarStoreValue > Val(txtNetAmount.Text) Then
VarStoreValue = Round(VarStoreValue - Val(txtNetAmount.Text),
2)
Else
VarStoreValue = Round(Val(txtNetAmount.Text) - VarStoreValue,
2)
End If
130
SQLQuerry = "Select * from Sale where bno = " & varBillNo & " and
btype = " & "'" & VarSaleType & "'"
Dim RstSaleMain As New ADODB.Recordset
With RstSaleMain
.Open SQLQuerry, cn, adOpenKeyset
If .RecordCount <= 0 Then
MsgBox "Enter A Valid Bill No Or Sale Type", , "Medicine Store"
DisplayWholeRecord = False
Exit Function
Else
DisplayWholeRecord = True
End If
If UCase(Trim(.Fields("btype").Value)) = "VAT" Then
optVat.Value = True
Else
optTot.Value = True
End If
txtEDate.Text = .Fields("Edate").Value
txtBillNo.Text = .Fields("bno").Value & ""
txtName.Text = .Fields("cname").Value & ""
txtRoot.Text = .Fields("root").Value & ""
txtTaxTotal.Text = .Fields("tax").Value & ""
txtSaleAmount.Text = .Fields("samt").Value & ""
txtNetAmount.Text = .Fields("amt").Value & ""
txtDeliver.Text = .Fields("deli").Value & ""
txtDiscountPerc.Text = .Fields("discp").Value & ""
txtTotalDisc.Text = .Fields("dis").Value & ""
txtSchTotal.Text = .Fields("itemsch").Value & ""
varVatNo = .Fields("vatno").Value & ""
End With
131
DisplayWholeRecord = False
MsgBox "No Detailed Record " + vbCrLf + "Please Contact
Programer", , "Medicine Store"
Exit Function
End If
ListView1.ListItems.Clear
VarSrNo = 0
VarIndex = 0
Do While Not .EOF
VarSrNo = VarSrNo + 1
VarIndex = VarIndex + 1
ListView1.ListItems.Add VarIndex, , VarSrNo
ListView1.ListItems(VarIndex).SubItems(1) =
.Fields("item").Value & ""
ListView1.ListItems(VarIndex).SubItems(2) =
.Fields("grp").Value & ""
ListView1.ListItems(VarIndex).SubItems(3) =
.Fields("mrp").Value & ""
ListView1.ListItems(VarIndex).SubItems(4) =
.Fields("qty").Value & ""
ListView1.ListItems(VarIndex).SubItems(5) =
.Fields("srate").Value & ""
ListView1.ListItems(VarIndex).SubItems(6) =
.Fields("sch").Value & ""
ListView1.ListItems(VarIndex).SubItems(7) =
.Fields("schp").Value & ""
ListView1.ListItems(VarIndex).SubItems(8) =
.Fields("discount").Value & ""
ListView1.ListItems(VarIndex).SubItems(9) =
.Fields("replace").Value & ""
ListView1.ListItems(VarIndex).SubItems(10) =
.Fields("amt").Value & ""
ListView1.ListItems(VarIndex).SubItems(11) =
.Fields("Tax").Value & ""
.MoveNext
Loop
End With
End Function
132
' .Open SQLQuerry, cn, adOpenKeyset
' If .RecordCount > 0 Then
' If Not IsNull(.Fields(0).Value) Then
' VarMaxBillNo = .Fields(0).Value
' Else
' MsgBox "Record Not Exist", , "Medicine Store"
' DeleteRecordSaleCompletely = False
' End If
' Else
' MsgBox "Record Not Exist", , "Medicine Store"
' DeleteRecordSaleCompletely = False
' End If
' End With
' If VarMaxBillNo = Val(txtBillNo.Text) Then
' If MsgBox("Are You Sure For Deleteion", vbYesNo, "Medicine
Store") = vbYes Then
' cn.Execute "delete from [Sale] where [bno] = " & varBillNo & "
and [btype] = " & "'" & Trim(varSType) & "'"
' cn.Execute "delete from [Sdet] where [bno] = " & varBillNo &
" and [btype] = " & "'" & varSType & "'"
' Dim varKeyy As String
' varKeyy = Trim(Str(varBillNo)) + Trim(varSType)
' cn.Execute "delete from [mix] where [kk] = " & "'" & varKeyy &
"'"
' End If
' Else
' MsgBox "Only Last Bill No Cancelation is Valid ", , "Medicine
Store"
' DeleteRecordSaleCompletely = False
' End If
'End Function
133
For Each cc In frmSale
If TypeOf cc Is TextBox Then
cc.Text = ""
End If
Next
ListView1.ListItems.Clear
GenBillNo
VarIndex = 0
End Sub
134
NumAllowOnly txtSchPcs, KeyAscii
End Sub
135
Return Entry
Dim ctr As Double
Dim VarStoreBillNoToModify As Double
Dim varGrpForMix As String, VarKey As String
Dim VarTotalTax As Double, VarTotalDiscount As Double
Dim VarSrNo As Integer, VarIndex As Integer
Dim VarBillType As String, varVatNo As String, VarAddress As String
Dim VarSaleType As String
Dim i As Integer, j As Integer, c As Integer
Dim SQLQuerry As String
Private Sub PopulateCmbItem()
cmbItem.Clear
cmbGrp.Clear
cmbMrp.Clear
Dim TempRstItemPop As New ADODB.Recordset
SQLQuerry = "Select iname,itype,mrp from itemDet"
With TempRstItemPop
.Open SQLQuerry, cn, adOpenKeyset
If .RecordCount > 0 Then
.MoveFirst
Do While Not .EOF
cmbItem.AddItem .Fields("Iname").Value
cmbGrp.AddItem .Fields("itype").Value
cmbMrp.AddItem .Fields("mrp").Value
.MoveNext
Loop
End If
End With
Set TempRstItemPop = Nothing
End Sub
136
Loop
End With
End Sub
137
txtItemGrp.Text = ""
txtRate.Text = ""
txtItemAmount.Text = ""
End Sub
138
' CalCulateTotalTax
' cn.Execute "insert into SaleRet values ( " & "'" & txtEDate.Text & "'"
& "," & Val(txtBillNo.Text) & "," & "'" & txtName.Text & "'" & "," & "'" &
txtRoot.Text & "'" & "," & "'" & VarAddress & "'" & "," &
Val(txtTaxTotal.Text) & "," & Val(txtNetAmount.Text) & "," &
Val(txtTotalDisc.Text) & ")"
SaveDataInSaleDetRet
End Sub
139
ListView1.ListItems(VarIndex).SubItems(7) = txtTax.Text
End Sub
IsFieldValidForItemEntry = True
End Function
140
If ListView1.ListItems.Count >= 1 Then
ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
If ListView1.ListItems.Count >= 1 Then
VarIndex = ListView1.ListItems.Count
Else
VarIndex = 0
End If
End If
End If
141
MsgBox "Enter A Valid Date", , "Medicine Store"
IsFieldValid = False
Exit Function
End If
If Len(Trim(txtName.Text)) = 0 Then
MsgBox "Select Customer Name From List", , "Medicine Store"
IsFieldValid = False
Exit Function
End If
If ListView1.ListItems.Count = 0 Then
MsgBox "Click on Next Button", , "Medicine Store"
IsFieldValid = False
Exit Function
End If
IsFieldValid = True
End Function
142
varNumericValue & "," & "'" & VarKey & "'" & "," & "'" & "DiscountS" &
"'" & ")"
End If
If Val(txtTaxTotal.Text) > 0 Then
cn.Execute "insert into mix values (" & VarVchNo & "," & "'" &
txtEDate.Text & "'" & "," & "'" & varValue & "'" & "," & "'" & varValue &
"'" & "," & "'" & varValue & "'" & "," & Val(varValue) & "," & "'" & "VAT
A/c" & "'" & "," & "'" & "Current Liabilites" & "'" & "," & "'" & "To Sale
Ret Bill No " + txtBillNo.Text & "'" & "," & varNumericValue & "," & "'" &
VarKey & "'" & "," & "'" & "DiscountS" & "'" & ")"
End If
End Sub
143
End With
End Function
144
STOCK SUMMARY
Dim sdt As New Recordset, it As New Recordset
Dim i As Integer
Dim j As Integer, t As Double
Dim sp As String, sp1 As String
145
If Len(txtStDate.Text) < 6 Then
MsgBox "Enter Exact Date", vbInformation, "DD-MM-YY"
txtStDate.SetFocus
Exit Sub
End If
i=1
j=1
Do While Not sdt.EOF = True
If sdt!eDate >= CDate(txtStDate.Text) And sdt!eDate <=
CDate(txtEdDate.Text) Then
Set a = ListView1.ListItems.Add(j, , sdt!eDate)
With a
.SubItems(i) = sdt.Fields(1).Value
i=i+1
.SubItems(i) = Str(sdt.Fields(6).Value)
i=i+1
.SubItems(i) = sdt.Fields("Qty").Value
i=i+1
.SubItems(i) = sdt.Fields("SchP").Value
i=i+1
.SubItems(i) = sdt.Fields("Sch").Value
i=i+1
.SubItems(i) = sdt.Fields("Replace").Value
i=i+1
.SubItems(i) = sdt.Fields("Qty").Value +
sdt.Fields("Sch").Value + sdt.Fields("Replace").Value
j=j+1
146
End With
i=1
End If
Dim tt As Double
For i = 1 To ListView1.ListItems.Count
tt = tt + Val(ListView1.ListItems(i).ListSubItems(7))
Next
Label4.Caption = tt
Label2.Caption = "ToTal Sale Pcs. " & Str(t) & " Pcs."
Set sdt = Nothing
i1 = 1
j1 = 1
147
End If
If pse!eDate >= CDate(txtStDate.Text) And pse!eDate <=
CDate(txtEdDate.Text) Then
If pse!bno <> " opening" Then
Set a = ListView2.ListItems.Add(j1, , pse!eDate)
With a
.SubItems(i1) = pse!bno
i1 = i1 + 1
.SubItems(i1) = pse!qty
i1 = i1 + 1
.SubItems(i1) = pse!sch
i1 = i1 + 1
.SubItems(i1) = pse!qty + pse!sch
j1 = j1 + 1
End With
i1 = 1
End If
End If
If pse!eDate <= CDate(txtEdDate.Text) Then
yh = yh + pse!qty + pse!sch
End If
pse.MoveNext
Loop
Label3.Caption = "ToTal Purchase " + Str(yh) + " Pcs."
Label4.Caption = "Balance " + Str(yh - t) + " Pcs."
End Sub
Private Sub Form_Load()
Dim ss As String
On Error GoTo ss
ListView2.ColumnHeaders.Add 1, , "Date"
ListView2.ColumnHeaders.Add 2, , "Bill No."
ListView2.ColumnHeaders.Add 3, , "Qty"
ListView2.ColumnHeaders.Add 4, , "Sch"
ListView2.ColumnHeaders.Add 5, , "ToTal"
' block for stock summary
If Module1.isu = "stock" Then
ListView1.Width = 7600
ListView1.ColumnHeaders.Add 1, , "ITEM.", 3800
ListView1.ColumnHeaders.Add 2, , "INWARD", 1100
ListView1.ColumnHeaders.Add 3, , "OUTWARD", 1100
ListView1.ColumnHeaders.Add 4, , "BALANCE", 1100
' it for pdet
it.Open "select item,sum(qty+sch) from pdet group by item order
by item", cn, adOpenDynamic, adLockPessimistic
148
' sdt for sdet
sdt.Open "select item ,sum(qty+replace+sch) from sdet group by
item order by item", cn, adOpenDynamic, adLockPessimistic
149
End If
it.MoveNext
Loop
End If
150
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Or KeyAscii
= 45 Then
txtEdDate.Text = txtEdDate.Text + vbkeyascii
Else
If KeyAscii = 13 Then
butDisplay.SetFocus
Else
KeyAscii = Val(vbkeyascii)
End If
End If
End Sub
151
Function Module
Public VarStoreSaleTypeToModify As String
Public VarModifySale As Boolean
Public VarVchForMix As Double
Public cn As New ADODB.Connection
152
txtBox.Text = txtBox.Text + vbkeyascii
Else
KeyAscii = 0
End If
End Sub
153
cn.Execute "insert into Grp values('Indirect Expense')"
cn.Execute "insert into Grp values('Indirect Expense')"
cn.Execute "insert into Grp values('Indirect Income')"
cn.Execute "insert into Grp values('Loan')"
cn.Execute "insert into Grp values('Purchase')"
cn.Execute "insert into Grp values('Sale')"
cn.Execute "insert into Grp values('Sundry Debitor')"
cn.Execute "insert into Grp values('Sundry Creditor')"
cn.Execute "insert into Grp values('Unsecured Loan')"
cn.Execute "drop table itemDet"
cn.Execute "create table itemDet(iname varchar2(50),itype
varchar2(25),mrp varchar2(15),srate varchar2(10),op
varchar2(10),opvalue varchar2(10))"
cn.Execute "drop table itemGrpDet"
cn.Execute "Create table itemGrpDet(itemGrp varchar2(30))"
cn.Execute "drop table led"
cn.Execute "Create table led(d1 varchar2(180),d2 varchar2(180),d3
varchar2(180),d4 varchar2(180),d5 varchar2(180))"
cn.Execute "drop table mix"
cn.Execute "create table mix(vn number(10),edate varchar2(15),acr
varchar2(50),cg varchar2(50),cn varchar2(150),camt number(10),adr
varchar2(50),dg varchar2(50),dn varchar2(150),damt number(10),kk
varchar2(50),vtype varchar2(50))"
cn.Execute "drop table PDet"
cn.Execute "create table PDet(bno varchar2(20),item
varchar2(50),grp varchar2(25),mrp varchar2(25),srate
number(10,2),qty number(10,2),sch number(10,2),cname
varchar2(100),sno varchar2(50),amt number(10,2),edate
varchar2(50),cost number(10,2))"
cn.Execute "drop table Pmain"
cn.Execute "create table Pmain(EDate varchar2(15),Bno
varchar2(20),cname varchar2(100),BType varchar2(20),disc
number(10,2),amt number(10,2),labo number(10,2),frh number(10,2))"
cn.Execute "drop table RootDet"
cn.Execute "create table RootDet(Rootlist varchar2(100))"
cn.Execute "insert into RootDet values('Railway Road Hsp')"
cn.Execute "insert into RootDet values('Red Road Hsp')"
cn.Execute "insert into RootDet values('Kashmiri Bazar Hsp')"
cn.Execute "insert into RootDet values('Partap Bazar Hsp')"
cn.Execute "insert into RootDet values('Jal Road Hsp')"
cn.Execute "insert into RootDet values('MahiL Pur')"
cn.Execute "insert into RootDet values('Phgwara Road Hsp')"
cn.Execute "drop table Sale"
cn.Execute "create table Sale(EDate varchar2(15),Bno
number(10),BType varchar2(20),cname varchar2(100),vatno
varchar2(20),root varchar2(100),addr varchar2(100),stype
154
varchar2(100),tax number(10,2),samt number(10,2),amt
number(10,2),deli varchar2(50),dis number(10,2),discp
number(10,2),itemSch number(10,2))"
cn.Execute "Drop table SaleRet"
cn.Execute "create table SaleRet(EDate varchar2(15),Bno
number(10),cname varchar2(100),root varchar2(50),addr
varchar2(150),tax number(10,2),amt number(10,2),dis Number(10,
2))"
cn.Execute "Drop table SDet"
cn.Execute "create table SDet(bno number(10),BType
varchar2(20),item varchar2(50),grp varchar2(25),mrp varchar2(25),qty
number(10,2),srate number(10,2),sch number(10,2),schp
number(10,2),Discount number(10,2),replace number(10,2),amt
number(10,2),tax number(10,2))"
cn.Execute "Drop table SDetRet"
cn.Execute "create table SDetRet(Bno number(20),item
varchar2(20),grp varchar2(20),mrp varchar2(10),qty
number(10,2),srate number(10,2),amt number(10,2),tax Number(10,
2))"
cn.Execute "Drop table UserD"
cn.Execute "create table UserD(UName varchar2(50),Psswd
varchar2(50))"
cn.Execute "Insert into UserD values('Admin','Admin')"
cn.Execute "Insert into UserD values('Upasna','Upasna')"
MsgBox "Tables Created "
End Sub
155
CONCLUSION
FINDINGS
The system will definitely be fruitful to both the organization and the members.
The members will benefit from the increased efficiency of the organization. On the other
hand organization with the little manpower will be in a position to save lot of money and
time.
LIMITATIOINS
In this software the provision for accounts management of the company is not
done, which if present can lead to best system.
Integrated system may be put on the web to make available all the information
online to the public.
156
BIBLIOGRAPHY
Visual Basic Manual, NIC Training Division, NIC, New Delhi
157