You are on page 1of 74

Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.

368

LI NI U
Nhng nm gn y cc cuc cch mng khoa hc cng ngh ang din ra mt
cch si ng cha tng thy trn ton th gii ,n thc y loi ngi nhanh
chng bc sang mt k nguyn mi . l mt k nguyn cu nn vn minh da
trn c s cng nghip tr tu nhn to .M u cho cuc cch mng khoa hc v
cng ngh thng tin hin nay v ang xm nhp vo mi lnh vc hot ng ca
x hi loi ngi n mang li nhiu li ch cao cng nh nhng li nhun khng l
v cng vi n l s gii quyt v cng vic ngy cng nhanh chng , mang li hiu
qu kinh t cao.
Trong , qun l l mt lnh vc khng th thiu trong hu ht cc hot ng
kinh t x hi .V n ng mt vai tr to ln , mang li hiu qu kinh t cao, gim
thiu chi ph v thi gian , nhn lc .Chnh v vy , khoa hc cng ngh l mt trong
nhng gii php khng th b qua t c nhng nhu cu .Cng ngh thng
tin l mt trong nhng ngnh khoa hc . i i vi s pht trin cng ngh ch
to cc thit b my tnh th vic sn phm phn mm ng dng ra i c ngha rt
quan trng v c tnh cht quyt nh trong cng tc qun l.
Trn th gii cng nh Vit Nam, cng ngh thng tin tr thnh mt
ngnh cng nghip mi nhn. N l mt ngnh khoa hc k thut khng th thiu
trong vic p dng vo cc hot ng x hi nh: Qun l, kinh t, thng tin. Vic
tin hc ho trong cng tc qun l ti cc c quan, x nghip ang rt ph bin v tr
nn cp thit.
Nh ng dng ca cng ngh thng tin lm gim c s qun l y kh
khn, phc tp trn giy t trong cng tc qun l. N c yu t quan trng, quyt
nh khng nh n s thnh cng ca mi ngnh ngh, mi x nghip, mi quc gia
ngy nay.
Xut pht t thc tin trong vic ng dng cng ngh thng tin vo cc bi
ton qun l, ng thi da trn nhng kin thc thu c trng, s gip
ca Cng ty gii php phn mm VNLink cng vi s hng dn nhit tnh ca
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368

thy gio ng minh t trong sut thi gian thc tp, em chn chuyn Xy
dng chong trnh qun l ca hng thuc Kim Anh c s thc tp ca em
Cng ty gii php phn mm VNLink. Trong ti ny em s dng ngn ng lp
trnh Visual Basic v h qun tr c s d liu Microsoft Access 2003.
Ni dung ca Chuyn thc tp bao gm gm:
Chng 1. Kho st ca hng bn thuc Ty
Chng 2. Phn tch Thit k h thng
Chng 3. Phn tch thit k c s d liu
Chng 4. Cc cng c s dng v thit k giao din
Cho d c c gng nhng do thi gian v kinh nghim c hn nn chng
trnh chc chn cn nhiu thiu xt. Em rt mong nhn c s gp chn thnh
ca thy, c gio v cc bn chng trnh ngy cng hon thin hn.
Em xin chn thnh cm n thy giao PGS.TS ng minh t v n v ni em
thc tp nhit tnh gip chng trnh ca em t kt qu tt hn cng nh
gip em c c nhng kinh nghim qu bu trong cng vic.
H Ni, thng 3 nm 2008
Sinh vin thc hin:
ng nh Quang
CHNG 1 .KHO ST SO B V XC LP D N
1.1. Kho st s b ca hng thuc Kim Anh
1.1.1. Qu trnh hnh thnh v pht trn ca ca hng thuc Kim Anh
Ca hng thuc Kim Anh l ca hng bn thuc t nhn , chuyn bn bun ,
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368

bn l cc loi thuc Ty , l mt ca hng bn thuc uy tn hng u c thnh
lp vo nm 1994 cho ti nay hot ng c 15 nm .Hin nay nay theo thng
k ca cc nh cung cp thuc th ca hng thuc Kim Anh l mt trong nhng ca
hng bn thuc hng u Thnh ph H Ni .Hin nay ca hng c hai a im
bn thuc .C s bn thuc chnh ca ca hng nm ti s nh 29 phng thanh
lng qun Hai B Trung , Thnh ph H ni ,c s th hai mi m nm 6 ngach
6 phng Qunh Mai -Hai B Trng-Thnh ph H Ni.
1.1.2. Hng pht trin ca ca hng
e thc hin m rng hot ng kinh doanh , p ng s lung khch hng
n mua thuc ngy cng ng , ca hng c nhu cu xy dng mt h thng phn
mm qun l bn hng thuc ,nhm tin hc ho qu trnh qun l kinh doanh ca
ca hng
1.2. Qu trnh hot ng ca ca hng thuc Kim Anh(kho st
chi tit)
Hot ng bn hng
- Hin nay b phn bn hng ca mt ca hng gm c 8 ngi chia lm hai
ca , mi ca lm vic gm 4 ngi ca hng m ca vo lc 6h v kt thc vo lc
11 h
- Khi khch hng c yu cu mua thuc :
+ Neu khch hng n mua thuc l th nhn vin bn hng sau khi nm bt
c tnh hnh bnh l ca khch hng vi s hiu bit ca mnh nhn vin bn
thuc s chun on bnh v t vn cho khch hng nn dng loi thuc g (cng
dng , thnh phn ,nc sn xut, gi thnh ) nu khch hng ng th nhn vin
bn hng s vit ho n bn hng v hng dn cch s dng thuc cho khch
hng .
+ Neu khch khch hng mua thuc theo n th nhn vin bn hng s kim
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368

tra trong k thuc nu p ng c loi thuc no th nhn vin bn thuc s vit
ho n bn hng chuyn cho khch hng ,cn cc loi thuc m khng p ng
c th nhn vin bn hng s hn khch hng n mua thuc trong thi gian sm
nht c th hoc gii thiu cho khch hng n mua nhng ca hng c uy tn
khc .
Cc thng tin trn ho n bn hng bao gm :s ho n , tn khch , a ch
khch,ngay lp, tng s tin , s tin thanh ton , cn n , hn tr n .cc thng
tin chi tit v thuc bn bao gm :Tn thuc, n v tnh,s lung , n gi ,thnh
tin khi thanh ton ca hng s lp mt phiu thu tng ng vi ho n mua thuc
trn phiu thu c ghi r :s phiu thu , s ho n , ngy lp , ngi lp , s tin ,
ghi ch . Mt bn sao ca Ho n bn hng (phiu xut) s c lu li tin cho
qu trnh qun l ,cn mt bn giao cho khch hng tin cho vic bo hnh tr n
nu c ca khch hng sau ny ca hng qun l khch hng bng cch cp nht
thng tin v khch hng .Cc thng tin v khch hng bao gm :m khch , h tn
khch , a ch, s in thoi, email
Sau khi kt thc ca lm vic th nhn vin bn hng s tng hp s tin bn
hng v bn giao cho ngi qun l .
- i vi nhn vin bn hng trong qu trnh bn thuc nhn vin bn hng c
trch nhim ghi li nhng mt hng thuc bn ht, hoc sp ht trong k , kho
thuc sau s bo cho nhn vin qun l ca hng
- Nhn vin qun l ca hng thuc c trch nhim kim tra s lng thuc
tn trong t thuc ,nu mt hng thuc no ht hoc sp ht nhn vin qun l s gi
in cho nh cung cp km theo l Tn thuc v s lung thuc t.
- Nh cung cp s mang thuc n km theo bng bo ga.Trc khi nhp
thuc nhn vin qun l kim tra cht lng thuc v thi gian s dng ca thuc
.Neu cht lng m bo th nhn vin qun l s lp mt phiu nhp, trn phiu
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368

nhp c ghi : s phiu nhp , tn nh cung cp, ngi lp phiu , ngy lp phiu ,s
tin thanh ton , s tin cn n.
-Ca hng qun l nh cung cp bng cch cp nht thng tin nh cung cp sau
khi nhp hng .Cc thng tin v nh cung cp bao gm :M nh cung cp,tn nh
cung cp, a ch, in thoi, email, fax.
Ca hng qun l Thuc bng cch cp nht thng tin v cc loi thuc .Cc
thng tin ny bao gm:M thuc,tn thuc , n v tnh , cng dng , hn s dng,
nc sn xut, n gi nhp , n gi bn .Qun l nhm thuc bao gm :m nhm
tn nhm.
- Hng thng ca hng s kim tra kho hng nhng mt hng tn trong t
thuc bn chm v sp ht hn s dng , t tr li hoc trao i vi nh cung
cp .
1.2.3. Qun l cng n
Hin nay ca hng ch cho khch hng n l nhng phng khm , khach hng
quen v cng ty
- i vi khch hng :khi khch hng n thanh ton tin cn n ca ca hng
th nhn vin qun l lp mt phiu thu tng ng vi ho n m khch hng thiu
n
Cui mi thng ca hng tin hnh kim tra khch n n hn v lp mt phiu
nhc nh tr n gi khch hng .
- i vi nh cung cp :Khi thanh ton tin n hng cho nh cung cp , th
nhn vin qun l s lp mt phiu chi v chuyn tin cho nh cung cp .trn phiu
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368

chi co ghi cc thng tin :S phiu chi , s phiu nhp , ngy lp phiu, ngy lp, s
tin ghi ch .
1.2.4. Thng k
Hng ngy , hng thng th ca hng cng thng k mt cch tng qut nht
doanh thu v s tin bn c , Doanh s nhn vin , s tin chi,s tin khch n ,s
tin n nh cung cp.
1.3. nh gi hin trng ca ca hng thuc Kim Anh
Qua vic kho st ti ca hng thuc tn dc Kim Anh em rt ra c nhng
u im v nhc im nh sau:
1.3.1. u im
H thng qun l bn hng ca hng thuc Kim Anh tuy l mt ca hng vi
s lng nhn vin t chng loi thuc th phong ph , a dng nhng c c s
t chc cht ch ,c khoa hc .Khi lng cng vic
c hoch nh mt cch r rng v vic qun l nhanh chng .nh hng
pht trin cao, em li hiu qu kinh t cao.
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


i ng nhn vin lm vic lu nm , giu kinh nghim bn hng
1.3.2. Nhc im
Bn cnh nhng un im k trn , h thng qun l ca hng thuc Kim Anh
cn vn cn tn ti nhng nhc im sau:
- Cng tc qun l vn ang cn th cng, th s , phn tn , trn giy t l ch
yu.
- Kh khn cho nhn vin bn hng trong vic thng k , lu tr , tra cu , tm
kim v sa i d liu , mi khi cn thit
- Kh nng cp nht thng tin chm ch
- Tn rt nhiu thi gian v nhn lc
- D gy ra thiu st , khng chnh xc trong qu trnh thc hin cng vic .
- Khng c kh nng lun tr thng tin trong mt thi gian di
- Kh kim sot thng tin v khch hng , nh cung cp v thng tin v hng
ho ca ca hng
- Kh nm bt c tnh hnh bn hng ca ca hng kp thi a ra nhng
gii php , phng hng pht trin mi khng ngng nng cao hiu qu kinh
doanh
- Hin nay ca hng vn ng da vo i ng nhn vin lu nm, thng l
ngi nh, nu m rng hot ng kinh doanh vic tuyn thm nhn vin khc vo th
s ngay kh khn cho vic qun l
Trong nhng nm gn y, do nhu cu tiu dng ca ngi dn tng cao, vi s
pht trin mnh m ca cng nghip ha, hin i ha v tc pht trin ngy cng
nhanh v kinh t, x hi, vn ha, lm cho cch thc qun l bn hng cng c nhiu
thay i theo, i hi cao hn trong cng tc qun l kinh doanh v trong nghip v
bn hng. Do vy, ph hp vi hon cnh mi, vic hin i ha cng vi tin hc
ha trong cng tc qun l bn hng l iu rt quan trng v cn thit.
Trong lnh vc cng ngh thng tin vic t chc v lu tr mt khi lng thng
1.4 S cp thit xy dng bi ton qun l:
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


tin l vn rt kh khn v phi gii quyt c vic cp nht thng tin mt cch
nhanh v chnh xc, truy xut d liu nhanh. Do chng ta cn phi t chc thng
tin li thnh mt c s d liu, p ng nhiu ngi s dng, nhiu chng trnh ng
dng khai thc, m bo d liu qun l tp trung v tng hiu qu khai thc.
Vic tin hc ha vo hot ng qun l kinh doanh bn hng s m bo cho h
thng lu tr v t chc thng tin vi mt khi lng ln mt cch khoa hc, gip
cho nhn vin qun l c tt hn, truy cp, tm kim, tra cu thng tin, qun l
khch hng v thng k d liu nhanh chng, chnh xc, gip cho ch ca hng nm
bt c tnh hnh hot ng kinh doanh ca ca hng nhanh chng a ra cc nh
hng lp k hoch kinh doanh mang li hiu qu kinh doanh cao hn. Sm hi
nhp vi th trng trong nc v th gii.
Tm li vic qun l theo phng thc th cng rt tn km v thi gian, nhn
lc, hn na chnh xc li khng cao, tc x l chm do vy khng p ng kp
thi cc yu cu ca lnh o. V vy cn phi c mt h
thng qun l bng my tnh l rt cn thit p ng tt nht cc yu cu
ni trn.
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


Yu cu cho mt h thng mi ng dng tin hc trong cng tc qun l bn
hng ca hng bn thuc l :
- T ng ha cc thao tc, cc php tnh m t trc n nay phi lm bng
tay.
- Thc hin cc nghip v mt cch nhanh chng, chnh xc.
- C kh nng kim sot, tng hp y chnh xc, kp thi phn nh cc
thng tin v khch hng, thng tin v nh cung cp thng tin v mt hng hin c ca
ca hng
- a ra nhanh chng danh sch thng tin khch hng, danh sch nh cung cp,
danh sch chng loi thuc, danh sch nhn vin nhp hng v bn hng khi cn tm
kim theo yu cu.
- C kh nng lu tr d liu trong thi gian di.
- C kh nng b sung thm, xa b, sa cha kp thi thng tin v mt khch
hng, mt nh cung cp, mt nhn vin, mt mt hng
- Gii quyt vn nhp thuc vo kho (trnh nhm ln).
- Gii quyt ti chnh v ngun hng vi cc nh cung cp.
- Gii quyt s thuc qu hn hoc khng cht lng.
- Gii quyt vic bn hng.
- Gip ngi bn hng khng b nhm ln trong vic chun on mt s bnh
thng thng vi n thuc c sn.
- Gip gii quyt vic lp bo co ti chnh theo ngy, thng, qu, nm.
CHNG 2 PHN TCH V THIT K H THNG
2.1. Phn tch v chc nng
2.1.1. Phuong php phn tch
Phn tch h thng theo ngha chung nht l kho st nhn din, phn nh cc
thnh phn ca mt phc hp v ch ra cc mi lin quan gia chng. Theo ngha hp
phn tch h thng l giai on hai, i sau kho st s b, l giai on bn l gia
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


kho st s b v giai on i su vo cc thnh phn h thng.
T kt qu ca giai on ny ta xy dng c cc biu m t logic chc
nng x l ca h thng. Giai on ny gi l giai on thit k logic chun b cho
giai on thit k vt l. Yu cu i hi thit k logic mt cch hon chnh trc khi
thit k vt l.
ng li thc hin:
Phn tch trn xung (top-down): Phn tch t i th n chi tit, th
hin phn r cc chc nng biu phn cp chc nng v cch
phn mc biu lung d liu (BLD).
i t h thng c sang h thng mi.
Chuyn t m t vt l sang m t logic.
Phn tch thit k h thng l s nhn thc v m t mt h thng, bi vy
ngi ta thng dng cc m hnh, cc biu tru tng ha v l cng c gip
con ngi trao i vi nhau trong qu trnh pht trin h thng. Mi m hnh l mt
khun dng nhn thc v h thng v n mang thc ch quan.
Mc tiu ca phn tch m hnh x l l a ra mt cch xc nh cc yu cu
ca ngi dng trong qu trnh pht trin h thng, nhng yu cu ny c bm st
t mt lot cc s kin m ngi phn tch thu c qua phng vn, t cu hi, c
ti liu v qua cc php o th nghim.
2.1.2. Biu phn cp chc nng(BPC)
Biu phn r chc nng BPC (Ting Anh l Business Functional Diagram-
BFD) l mt loi cng c cho php phn r dn dn cc chc nng t mc cao nht,
tng th nht thnh cc chc nng chi tit hn, c th hn v cui cng ta thu c
mt cy chc nng. Cy chc nng xc nh mt cch r rng, d hiu ci g xy ra
trong h thng.
Sau khi tm hiu v phn tch H thng qun l ca hng Thuc Kim Anh
em a ra c biu phn cp chc nng nh sau:
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



Trong s ny ta thy chc nng Qun l ca hng Thuc Kim Anh
c phn thnh nm cp nh hn . l chc nng Cp nht thng tin , chc
nng Qun l kho hng, chc nng Qun l bn Thuc , chc nng Qun l thu
chi , chc nng qun l bo co.en lt mnh , mt trong nm chc nng trn li
c phn cp thnh cc chc nng chi tit hn .
C th , chc nng Cp nht thng tin c phn chia thnh 5 chc nng
l Thng tin Thuc, Thng tin Nh cung cp,Thng tin Khch hng ,Thng tin
Nhm thuc /Thng tin Nc sn xut .Chc nng Qun l kho hng c phn
thnh 4 chc nng con l :Kim tra kho Thuc ,lp Phiu nhp thuc Danh sch
thuc ht hn ,Tm kim Qun l thuc qu hn s dng .Chc nng bn hng
c phn thnh 4 chc nng con l :qun l Khch hng , qun l bn thuc

Hnh I: S chc nng
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


, t vn khch hng,Tm kim .Chc nng Qun l thu chi c phn thnh 4
chc nng con Lp phiu thu, Danh sch khch n ,Lp phiu chi ,xem cng
n .Chc nng Bo co c phn thnh 4 chc nng con :Bo co doanh thu,
Bo co nhp xut,Bo co doanh s bn hng nhn vin bo co hng tn
2.1.3.M t cc chc nng
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



STT Tn chc nng Y ngha
1.1
Cp nht thng tin
v Thuc
Cp nht thng tin v danh mc thuc c trong ca
hng : thm mi, sa, xo thng tin nh Thuc khi cn
thit
1.2
Cp nht thng tin
Nh cung cp
Cp nht thng tin Nh cung cp nh : thm mi nh
cung cp , sa, xo thng tin Nh cung cp hng khi
cn thit
1.3
Cp nht thng tin
Khch Hng
Cp nht thng tin khch hng nh: thm mi khch
hng, sa, xo thng tin khch hng khi cn thit
1.4
Cp nht nhm
hng
Cp nht thng tin v nhm Thuc nh: thm mi, sa,
xo thng tin nhm Thuc
1.5
Cp nht Nuc sn
xut
Cp nht thng tin v Nc sn xut Thuc nh:Thm
mi, sa , xo thng tin nc sn xut
1.6 Tm kim Tm kim theo yu cu thng tin ngi s dng
2.1
Kim tra kho
Thuc
Nhn vin s kim tra danh mc Thuc tn hin c
trong kho trc khi mua, bn hay hu hng.
2.2
Lp phiu nhp
Thuc
Khi nhn c hng t nh cung cp th nhn vin s
lp mt phiu nhp hng.
2.3
Danh sch thuc
ht hn
Chng trnh s t ng cp nht danh sch thuc ht
hn .T danh sch ny ngi s dng lp mt phiu
hu
2.4 Tm kim Tm kim theo yu cu thng tin ngi s dng
3.1
Kim tra kho
Thuc
Khi khch hng co nhu cu mua thuc th nhn vin s
vo kim tra kho thuc ca ca hng nu cn cung
cp th s lp ho n bn
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



3.2 Lp ho n ban
Nhn vin s lp ho n bn bn thuc v thanh
ton tin vi khch hng
3.3 T vn khch hng
Khi khch hng yu cu c t vn th ta s vo chc
nng ny
3.4 Tm kim Tm kim thng tin v ho on bn hng
4.1 Lp phiu thu
Nhn vin s lp phiu thu khi khch hng thanh ton
tin hng hoc mun tr n.
4.2
Xem danh sch
khch hng cn n
Hng thng nhn vin kim tra danh sch khch hng
cn n.nu khch hng n qu hn th nhn vin s
lp mt phiu nhc tr n gi cho khch hng
4.3 Lp phiu chi
Nhn vin s lp phiu chi khi thanh ton tin hng
cho nh cung cp hoc khi tr n cho nh cung cp.
4.4 Xem cng n Hng thng Ca hng s xem cng n.
4.5 Tm kim Tm kim theo yu cu thng tin ngi s dng
5.1 Bo co doanh thu
Bo co doanh thu theo doanh thu theo ngy, thng,
nm
5.2 Bo co nhp xut
Bo co v tnh hnh bn hng v nhp hng ca ca
hng
5.3
Bo co doanh s
bn hng ca nhn
vin
Bo co doanh s bn hng ca tng nhn vin trong
thng .
5.4
Bo co hng tn
kho
Thng k lng hng tn trong kho
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


2.2. Biu lung d liu- BLD (Data Flow Diagram=DFD)
BLD l mt loi biu nhm mc ch din t mt qu trnh XLTT vi cc yu cu
sau:
+ S din t l mc logic, ngha l nhm tr li cu hi: Lm g? m b qua cu
hi Lm nh th no?.
+ Ch r cc chc nng (con) phi thc hin hon tt qu trnh x l cn m t.
+ Ch r cc thng tin c chuyn giao gia cc chc nng , v qua phn no
thy c trnh t thc hin ca chng.
Biu lung d liu (BLD hay DFD) l mt cng c dng tr gip cho bn hot
ng chnh sau y ca cc phn tch vin h thng trong qu trnh phn tch thng tin.
+ Phn tch BLD c dng xc nh yu cu ca ngi s dng.
+ Thit k BLD dng vch k hoch v minh ha cc phng n cho phn tch
vin h thng v ngi dng khi thit k h thng mi.
+ Biu BLD l cng c n gin, d hiu i vi phn tch vin h thng v ngi
dng.
+ Ti liu BLD cho php biu din ti liu phn tch h thng mt cch y , sc
tch v ngn gn. BLD cung cp cho ngi s dng mt ci nhn tng th v h thong v c
ch lu chuyn thng tin trong h thng .
Cc thnh phn ca biu lung d liu:
- Qu trnh (chc nng -Processes) c k hiu bi vng trn tng trng cho cc
chc nng khc nhau m h thng phi thc hin. Chc nng
thay i thng tin u vo theo mt cch no nh t chc li thng tin, b
sung hoc to ra thng tin mi.
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


- Lung d liu (Flow) c k hiu bng ng k c mi tn. Mi tn ch hng
ra ca lung thng tin. Lung d liu lin kt cc Processes vi nhau, tng trng cho
thng tin m processes yu cu cho u vo hoc thng tin m chng bin i thnh u ra.
- Kho d liu (Data Store) c k hiu bi 2 ng thng song song, biu din hay
cha ng thng tin m h thng cn phi lu gi trong mt khong thi gian di mt
hay nhiu qu trnh hoc tc nhn truy nhp vo. Mt khi cng vic xy dng HTTT kt
thc th nhng thng tin ny c tn ti di dng cc File hay CSDL.
- Tc nhn ngoi l mt ngi, mt nhm ngi hoc mt t chc bn ngoi lnh vc
nghin cu ca h thng, nhng c mt s hnh thc tip xc vi h thng. Nhn t bn
ngoi l ngun cung cp thng tin cho h thng v l phn sng cn ca h thng.
- Tc nhn trong l mt chc nng hay mt qu trnh bn trong h thng.
DFD cung cp mt bc tranh tng th, d hiu v cc chc nng v cc d liu chnh
ca h thng. Tuy nhin, nu xt v kha cnh chi tit th DFD li cha c y c t'
gc chc nng v d liu. Hai cng c c s dng b khuyt cho DFD l: T in
d liu (Data Dictionary) v c t chc nng (Process specification)
Thng qua tm hiu h thng qun l Ca hng thuc Kim Anh em xy dng biu
lung d liu ca h thng vi cc thnh phn ca biu nh sau:
- Cc chc nng: Cp nht thng tin , Qun l kho hng , Qun l bn Thuc Qun l
Thu chi , Qun l bo co cng cc chc nng con trnh by trn.
- Cc lung d liu: thng tin mua thuc, thng tin Nhp thuc, Thanh ton....
- Cc kho d liu:Thuc nhp ,ho n bn ,Khch hng , Nh cung cp,
- Cc tc nhn trong v cc tc nhn ngoi: Ty theo tng chc nng qun l c th
m biu lung d liu cc mc c s dng thm cc tc nhn trong v ngoi cho ph
hp.
2.2.1. BLD mc ng cnh (mc 0)
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


L m hnh h thng mc tng qut nht, ta xem c h thng nh mt chc nng.
Ti mc ny h thng ch c duy nht mt chc nng. Cc tc nhn ngoi v ng thi cc
lung d liu vo ra t tc nhn ngoi n h thng c xc nh.
T nh ngha trn, ta c s lung d liu mc ng cnh nh sau:

2.2. BLD mc nh (mc 1)
Gm nhiu chc nng c phn r t BLD mc ng cnh vi cc chc
nng phn r tng ng mc 1 ca biu phn r chc nng BPC (hoc
BFD). Cc nguyn tc phn r:
- Cc lung d liu c bo ton.
- Cc tc nhn ngoi bo ton.
- C th xut hin cc kho d liu.
- B sung thm cc lung d liu ni ti nu cn thit.

Hnh 2: S d ng cnh
Phiu giao hn
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



2.2.3. BLD mc di nh (mc 2)
Phn r t' BLD mc nh, cc chc nng c nh ngha ring tng biu hoc
ghp li thnh mt biu trong trng hp biu n gin. Cc thnh phn ca biu
c pht biu nh sau:
+ Lung d liu: vo/ra mc trn th lp li (bo ton), mc di th phn r,
b sung thm cc lung d liu ni b do phn r cc chc nng v thm vo kho d
liu.

Hnh 3: S chc nng mc 1 ca h thng qun l hiu thuc
2.2.3. Biu lung d liu chc nng cp nht thng tin
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


+ Kho d liu: dn dn xut hin theo nhu cu ni b.
+ Tc nhn ngoi: xut hin y mc khung cnh, mc di khng
thm g c.
Cc biu lung d liu mc di nh ca h thong qun l:

Hnh 4: S chc nng mc 2 cho Qun l Danh Mc

2.2.3.2. Biu lung d liu chc nng qun l kho hng
Website: http://www. docs, vn Email: Henhe@docs. vn Tel 0918.775.368


Nh cung cp
> Thuc ht hn
Thuc Nhp
Danh Mc Phiu nhp
Thuc Nhp
Thuc hct hn
Hnh 2.2.3.2: S chc nng Qun l kho hng
2.2.3.3.S chc nng qun l Bn Thuc
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



Hnh 2.2.3.3: S d chc nng mc 2 ca x l qun l bn Thuc

2.2.3.4.S chc nng qun l Thu chi
Website: http://www.docs. vn Ema! : Henhe@docs. vn Te! : 0918.775.368



Hnh 2.2.3.4.S mc 2 chc nng qun l thu chi

2.2.3.5.S chc nng qun l bo co
Website: http://www.docs. vn Ema! : Henhe@docs. vn Te! : 0918.775.368



Hnh 2.2,3.5: S chc nng mc 2 cho x l cc bo co

Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


CHNG 3 PHN TCH THIT K c S D LIU
Mt h thng trong trng thi vn ng bao gm hai yu t l cc chc nng x l
v d liu. Gia x l v d liu c mi quan h mt thit cht ch v bn thn d liu
c mi lin kt ni b khng lin quan n x l l tnh c lp d liu. M t d
liu c xem nh vic xc nh tn, kiu (dng) d liu v tnh cht ca d liu. D
liu khng ph thuc vo ngi s dng ng thi khng ph thuc vo yu cu tm
kim v thay i thng tin.
Trong XLTT c nhiu cng c m t d liu. Cc cng c ny l cc cch tru
tng ha d liu, c bit l mi quan h ca d liu nhm ph bin nhng ci chung
nht m con ngi c th trao i ln nhau. Trong phn ny chng ta cp ti 4 cng
c ch yu:
1. M ha d liu (Coding).
2. T in d liu (Data Dictionary).
3. M hnh thc th lin kt ER (Entity Relationship).
4. M hnh quan h (Relational Data Base Modeling).
Nh ta bit phn tch h thng bao gm hai cng vic: Phn tch v chc nng
x l v phn tch v d liu. Trong phn ny chng ta xem xt phn phn tch d liu.
D liu c tnh c lp tng i v l i tng ca x l.
Mc ch ca giai on phn tch h thng v d liu l: Lp lc d liu hay
gi l biu cu trc d liu (BCD). H thng d liu c lu tr lu di:
- Thng tin g, bao gm d liu g?
- Mi lin quan: xc nh lin quan gia cc d liu.
Ket qu ca giai on phn tch h thng v mt d liu l cho chng ta mt
khun dng h tr cc phn tch vin h thng trong qu trnh nhn thc v biu din
cc d liu s dng trong HTTT, ng thi ch r c cu trc ca d liu.
Phng php thc hin: Th hin theo hai cch tip cn:
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


+ M hnh thc th lin kt: phng php ny trc quan i t trn xung di,
bng cch xc nh cc thc th, mi lin kt gia chng ri n cc thuc tnh.
Phng php ny bao trm c nhiu thng tin, tuy nhin kt qu hay tha.
+ M hnh quan h: Xut pht t danh sch cc thuc tnh ri n cc lc
quan h. Phng php ny i t di ln, kt qu l va cho nhng kt xut x l.
3.1 L thuyt thit k c s d liu quan h
Cc thc th: L vt th tn ti thc s kh n nh trong th gii thc mun
phn nh. Tp cc thc th cng loi hnh thnh ln kiu thc th.
Kiu thc th: L tp hp cc thc th c cng c trang bn cht
Cch biu din kiu thc th: Ngi s dng cc hnh ch nht bn trong ghi tn
thc th.
Tn thc th
Cc thuc tnh: thuc tnh l gi tr m t kha cnh no ca thc th. Thuc
tnh bao gm thuc tnh kha v thuc tnh m t.
- Thuc tnh kha gi l cc kiu thuc tnh cho php phn bit cc kiu thc th.
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


B
B
- Cc thuc tnh cn li khc kha l thuc tnh m t.
-Yu cu vi kiu thuc tnh: m bo gi tr l duy nht v l s ng. Cch
biu din:
Tn kiu thc
th Cc Thuc
tnh
Cc lin kt:
Lin kt: l s kt ni gia hai hay nhiu thc th phn nh nhiu s rng buc
v mt vt l.
Kiu lin kt: l tp hp cc lin kt c cng bn cht.
Cch biu din:
A
C th biu din bng cch khc:

C 3 loi lin kt:
- Lin kt 1-1: lin kt gia hai thc th A v B l 1 - 1 nu mi thc th kiu
A tng ng vi mt kiu thc th B v ngc li.
A
A

B

Website: http://www.docs. vn Email: Henhe@docs. vn Te/S: 0918.775.368


- Lin kt 1 - n: lin kt gia hai thc th A v B l 1 - n nu mi kiu thc th
A tng ng vi nhiu kiu thc th thuc B. Nhng mi thc th thuc B ch
tng ng vi mt kiu thc th A.
B
- Lin kt n - n: lin kt gia hai thc th A v B l n - n nu mi kiu thc th
A tng ng vi mt hoc nhiu kiu thc th thuc B v ngc li.

3.2 Mt s thc th
3.2.1 Pht hin thc th






3.2.2. Pht hin kiu lin kt

A n n B


1 .Nhm
thuc 3.Khch
hng 5.Thuc
bn 7.Phiu
nhp 9.Nhn
vin 11.User
13.Phiu hu
15.NUC sn
xut 17.T
thuc
2.Danh mc thuc
4.Ho n bn
6.Phiu chi 8.Thuc
nhp 10.Nh cung
cp 12.n v tnh
14.Thuc hu 16.T
vn
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368



Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


Phiu nhp
Phiu hy

Thc th trung gian l Chi tit ho n ph v lin kt nhiu -

nhiu

Danh mc Thuc
-> Thc th trung gian l Chi tit phiu nhp ph v lin kt nhiu -

nhiu
Danh mc Thuc
- Thc th trung gian l Thuc Hy ph v lin kt nhiu - nhiu
3.2.3 Pht hin thuc tnh
1 .DM_NhomThuoc(Manhom, Tennhom,MoTa)
2. Bang_danh
mucThuoc(DMT_Ma,MaNhom,MaNCC, DMTTen, DMT ThanhPhan,

Website: http://www.docs. vn Email : Henhe@docs. vn Te! : 0918.775.368


DMT_ChiDinh,DMT_ChongChiDinh,DMT_Cachdung,DMT_HanDung,DM
T_NSX,
MaTu , Madonvitinh,DMT_GhiChu)
3. DM_KhachHang(Makh, Tenkh, Diachi, Dienthoai, Email,ghichu)
4. HD_BanThuoc(HDB_Ma,Makh,HDB_NgayBan,HDB_GioBan,NV_
Ma,HDB_TongTien,HDB_ThanhToan)
5. HD_ChiTietHDB(HDB_Ma,DMT_Ma,HDB_SoLuongBan,HDB_Don
GiaBan)
6. P
hieuThu(PT_Ma,HDB_Ma, NV_MA,PT_Ngaythu, PT SoTien, PT_Ghichu,Makh)
8. NhanVien(NV_Ma,NV_HoTen,NV_CMND,NV_Ngaysinh,NV_Que Quan,
NV_DCLienHe,NV_Tel,NV Email)
9. PhieuNhapThuoc(PNH_SoPhieu,MaNCC,NV_Ma,PNH_NgayNhap,P
NH_G ioNhap ,PNH_Nguoi G i ao,PNH_Tongtien,PNH_D aThanhT an)
10. ChiTiet_PhieuNhap(PNH_SoPhieu,DMT_Ma,PNH_ngaysanxuat,
PNH_NgayHetHanPNH_Soluongnhap,PNH_DonGia,PNH_soluongcon)
11. P
hieuChi(PC_SoPhieu,
P
N_SoPhieu,NV_Ma ,PC_Ngaychi, ,PC_ Sotien,PC_ Ghichu)
12. DM_NhaCC(NCC_Ma,NCC_Ten,NCC_DaiDien,NCC_DiaChi,N
CC
_DienThoai,NCC_Wcbsite,NCC_MaSoThue,NCC_SoDKKD,NCC_TaiKhoan,NC
_NGayBD)
13. Ph
ieuHuy(Sophieuhuy, NV_Ma, Ngayhuy, Tongtien)
3.2.4.3.Bng NhanVien lu tr mi thng tin chi tit v cc nhn vin
ca ca hng
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


14. CT_ThuocHuy(Sophieuhuy, DMT Ma, Soluonghuy)
15. NSD(Manv, TenDN, Matkhau, Quyenhan)
16. TuThuoc(MaTu,TenTu)
17. DonViTinh(Madvitinh, Dvtinh,MoTa)
3.2.4 Thit k cc bang CO s d liu
Da trn s lin kt gia cc thc th lin kt v m hnh phn r chc nng ca h
thng, chng ta tin hnh thit k c th l xc nh cc Table (
bng CSDL) ca chng trnh
3.2.4. .Bng DM KhachHang lu tr thng tin v cc khch
hng giao dch vi ca hng

3.2.4.2. Bng DMNCC lu tr thng tin chi tit v nh cung
cap, chuyn cung cp cc mt hng cho ca hng.

Tn trng Kiu trng rng M t
Makhach Text 4 M khch hng
Tenkhach Text 30 Tn khch hng
Diachi Text 50 a ch khch
Dienthoai Number

in thoi khch hng
Email Text 50 Email ca khch hng
Tn trng Kiu trcmg rng M t
NCC_Ma Text 4 M nh cung cp
NCCTen Text 30 Tn nh cung cp
NCCDiachi Text 50 a ch ca nh cung cp
NCC_Dien Thoai Number

S in thoai nh cung cp
NCCSODKKD Number

S Fax ca nh cung cp
NCC_Email Text 50 Email ca nh cung cp
NCCMaSoThue Text 12 M s thu nh cung cp
NCCTTTaiKhoan Text 12 Ti khon nh cung cp
NCCNgayBD Date/Time

NGy bt u cung cp
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368



3.2.4.4. Bng DM NhomThuoc lu tr thng tin v cc nhm Thuc

Tn trcmg Kiu trng rng M t
NV_Ma Text 10 M nhn vin
NVHoTen Text 30 Tn nhn vin
NV_NgaySinh Date/Time

Ngy sinh nhn vin
NVQQuan Text 100 Qu qun nhn vin
NV DiaChiLHe Text 100 a ch ca nhn vin
NVTel Number 1 in thoi ca nhn vin
NV_Email Text 25 Hm th ca nhn vin
Tn trng Kiu trng rng M t
Manhom Text 5 M nhm Thuc
Tennhom Text 30 Tn nhm thuc
MoTa Text 50 M t
3.2.4.5.Bng DonViTinh lu tr thng tin v n v tnh ca Thuc
Tn trng Kiu trng rng M t
Madonvtinh Text 5 M n v tnh
Donvitinh Text 10 Tn n v tnh
3.2.4.6.Bng.DM_Thuoc lu tr chi tit cc thng tin v cc loi
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368




Thuc hin c ca ca hng
Tn trng Kiu trng rng M t
DMTMa Text 5 M Thuc
MaNhom Text 5 M nhm Thuc
DMTTen Text 30 Tn Thuc
DMT ThanhPhan Text 100 Thnh phn Thuc
DMTChiDinh Text 100 Ch nh Thuc
DMTChongChiDinh Text 100 Chng ch nh
DMTCachdung Text 100 Cch dng v liu dng
DMTHanDung Date/Time

Hn dng trong bao lu
MaTu Text 5 Ch thuc
Madonvitinh Text 5 n v Tinh
Manuoc Text 5 Nc sn xut
MaNCC Text 5 Nh cung cp
DMTGhiChu Text 100 Ghi ch
DMTSODK Number

S ng k ca Thuc
3.2.4.7.Bng HD_BanThuoc lun tr thng tin chi tit v cc ho n bn Thuc
Tn trng Kiu trng rng M t
HDB_Ma
Auto number

S ho n bn Thuc
MaKh Text 5 M khch hng
NV_Ma Text 5
Ngy lp ho n
HDB NgayBan
Datetime

M nhn vin lp ho n
HDB GioBan Datetime

Hn tr n tin
HDBTongTien
Number

Tng tin Thuc
HDB DaThanhToan Number

3.2.5.1 l.ChiTiet PhieuNhap lu tr chi tit thng tin v cc Thuc
nhp
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368



3.2.4.9. Bng PhieuThu lu tr thng tin v cc khon phi thu
ca ca hng

3.2.4.10. Bng PhieuNhapThuoc lu tr thng tin v loi Thuc nhp
ca ca hng

Tn trng Kiu trng rng M t
HDB Ma Number

S ho n bn Thuc
DMTMa Text 5 M Thuc bn
HDBSoLuongBan Number

S lng Thuc bn
HDBDonGiaBan Number

Gi bn
Tn trng Kiu trng rng M t
PTMA Auto number

S phiu thu
HDBMa Number

S ho on bn Thuc
NV_Ma Text 5
M nhn vin thu tin
Makh Text 5 Khch khch hng
PTsoTien Number

S tin thu
PTNgy Thu Date Time

Ngy Thu
PT Ghi Chu Text 100 Ghi ch v phiu thu
Tn trng Kiu trng rng M t
PNHSoPhieu Auto Number

S phiu nhp Thuc
Makh Text 5 M khch hng
NCC Ma Text 5 M nh cung cp
NV_Ma Text 5 M nhn vin nhn hng
PNH_Ngaynhap Datetime

Ngy nhp Thuc
PNHGioNhap Datetime

Gi nhp
PNH_TongTien Number

Tng tin nhp
PNHDaThanhToan Number

SO tin thanh ton
3.2.4.8.Being ChiTiet HDB I ll'll tr thng tin chi tit v hng bn ghi
trong ha n bn hng
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368



3.2.5.12.Bng PhieuChi lu tr thng tin v cc khon phi chi ca ca
hng

Tn trng Kiu trng rng M t
PCSoPhieu AutoNumber

S phiu chi
PNHSoPhieu Number

S phiu nhp Thuc
PC_NgayChi Datetime

Ngy chi tin
NV_Ma Text 5 M nhn vin
PCSoTien Number

S tin chi
PCGhiChu Text 100 Ghi ch
Tn trng Kiu trng rng M t
PC_SoPhieu AutoNumber

S phiu chi
PNHSoPhieu Number

S phiu nhp Thuc
PC_NgayChi Datetime

Ngy chi tin
NV_Ma Text 5 M nhn vin
PCSoTien Number

S tin chi
PCGhiChu Text 100 Ghi ch
3.2.5.13.Bng PhieuHuy lu tr thng tin v phiu hu hng
Tn trmg Kiu trng rng M t
Sophieuhuy nt 4 S phiu hu
NV_Ma Text 5 M nhn vin lp phiu
Ngayhuy Datetime

Ngy lp phiu hu
Tongtien Float

Tng s tin Thuc hu
3.2.5. 4.Bng ThuocHuy lu tr thng tin chi tit v hng cn hu
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368





Tn trng Kiu trng rng M t
Sophieuhuy Number

S phiu hu Thuc
DMTMa Text 5 M hng cn hu
Soluonghuy Number

S lng Thuc cn hu
3.2.5.15.Bng TuThuoc lu tr thng tin v ch thuc
Tn trng Kiu trng rng M t
MaTu Text 5 M t thuc
TenTu Text 30 Tn t thuc
MoTa Text 100 M T
3.2.5.16.Bng Nsd lu tr thng tin v ngi s dng
Tn trng Kiu trng rng M t
NV_ma Text 5 M nhn vin
TenDN Text 30 Tn ng nhp ca nv
MatKhau Text 10 Mt khu truy cp
QuyenHan Number

Quyn hn
MoTa Text 50 M T
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



CHNG 4.CC CNG c s DNG V THIT K GIAO DIN
4.1. Cccng c s dng
4.1.1. Lp trnh bng visual Basic.
4.1.1. . Gii thiu v Visual Basic
Visual Basic l mt sn phm ca Microsoft v l mt chng trnh 32 bit ch
chy trn nn Window 95 tr nn .
Visual Basic l mt ngn ng lp trnh theo kiu hng i tng
C th thy ngay c thao tc khi thit k .
Cho php chnh sa d dng .
Form
inh ngha:Form l mt mu thit k dng trong chng trnh.
Gii thch:khi thit k mt chng trnh tc l to ra mt hay nhiu ca s cho

DM_NhomTh
DM_Thuoc
PhieuHuy
3.3.6.Biu quan h
Website: http://www.docs. vn Email : Henhe@docs. vn Te! : 0918.775.368


chng trnh .Mt chng trnh Windows ban u thng c mt ca s chnh v
trong qu trnh lm vic c th pht trin thm nhiu ca s con.Khi gi Visual Basic,
lun c sn mt form cho thit k .
Proiect:Khi thit k mt chng trnh bang Visual Basic lun phi qua hai bc
chnh:
a. Thit k giao din
Tc l thit k hnh dn ca form, b tr cc control trn nh th no .
Website: http://www.docs. vn Email: Henhe@docs. vn Te/S: 0918.775.368


Dng cc lnh ca Visual Basic quy nh cch ng s cho mi form v cho mi
control.Khi vit Form nh vy tc l to ln mt d n bao gm tt c cc yu t
to nn chng trnh .Mi d n bao gm nhiu Form , mi Form s to thnh mt File
trn a .Ngoi ra cn to ra mt vi Form cha m lnh ring x l mt s thao tc
c bit , mt File na dng qun l ton b d n chng trnh .Nh vy , mt
Project bao gm:
Mt File *.FRM cho mi Form thit k.
Mt File Binary *.FRM cho mi Form thit k m c cc control c cc d
liu c bit.
Cc File*.Bas cho cc m lnh.
Mt File*.RES cha resourse(ti nguyn ) cho d n .Ti nguyn y l
cc Bitmap,icon...dng trong chng trnh .
Mt File duy nht *.VBM cho ton b d n.
Ngoi ra vi cc chng trnh cao cp cn c File*.VBX,*.OCX.
4.1.1.2. tng v cch s dng i tng
a. i tng (Object)
Visual Basic l mt ngn ng lp trnh kiu i tng , lm vic vi Visual
Basic chnh l lm vic vi cc i tng .
c im ca cc i tng trong chng trnh :
Mi i tng u c mt tn phn bit.
Mi i tng u c nhiu c tnh , cc c tnh ny c th gi
l property(thuc tnh ) ca i tng .
Mi i tng c th c nhiu hot ng v cc hot ng ny gi l
Method(phng thc) ca n.
Truy xut i tng. Truy xut i tng tc l t gi tr cho cc
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


Property cho i tng ,hay gi phng thc hot ng cho cc
i tng hot ng .Bt c khi no truy xut i tng u c vit
theo c php sau:
<Tn i tng >.<Tn Property hay Method>
b.Vit lnh cho i tng
Khi t mt i tng ln form th lc u n cha hot ng .Ta cn phi vit
lnh cho n lm vic .
Double Click cho i tng .
Ca s lnh khin ra ,Khi hy vit lnh cho i tng ny .
S dng ca s vit m lnh .
Mi phn m lnh cho mt s kin xy ra trn mt i tng u c hai dng
u tin l Sub v cui cng l END Sub.cn phi gi nguyn hai dng ny v vit m
lnh vo gia hai dng .
Ca s lnh cng ging nh bt k mt ca s son tho no dng trn
Window
Visual Basic c c im t kim tra c php khi vit m lnh .Khi vit xong
mt dng lnh v qua mt dng khc th Visual Basic t ng kim tra cu
lnh va vit ,nu sai th s bo cn li th t ng i ch thng , ch hoa
cho chng trnh c r rng.
Mi dng lnh trong Visual Basic u phi c vit trn mt dng , khng
c ngt gia dng na chng.
c. Bin
Khi nim:Bin c dng lu tam thi cc gi tr tnh ton trong qu trnh
x l chng trnh .
Khi x l mt chng trnh lun cn phi lun tr mt gi tr no tnh ton , so
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


snh hay tnh ton chng vi nhau v thc hin cc tc v khc nhau da vo cc kt qu
so snh hay tnh ton trn chng.Visual Basic hay bt c mt ngn ng lp trnh no khc
u dng cc bin chng trnh lu gi cc gi tr . Cc gi tr lu tr trong cc
bin c th c cc gi tr khc nhau , c th l mt dng ch hay mt con s ...Dng gi
tr gi l kiu d liu .
Mt bin c c trng bng mt ci tn.Bin khng c sn trong chng
trnh.Mun s dng bin phi to ra n gi l khai bo.
Cch khai bo bin v s dng bin , thi gian sng .
Khai bo bin trong chng trnh bng mt trong cc dng lnh nh sau :
DIM/Static/Public/Global<Tn bin> as <kiu d liu >.
Khai bo vi t' kho Dim, Static dng khai bo cho nhng lnh cc b
trong Sub hoc Function m thi .Khai bo vi t kho Public v
Global(khai bo bin ton cc ) dng khai bo cc bin dng chung
trong ton b chng trnh , ch ta co th khai bo trong Modul hoc trong
General ca Form m thi, ta khng th khai bo t kho ny trong sub hoc
trong Function.
i vi bin cc b th thi gian sng ca n ch nm trong sub hoc
Function m n c khai bo m thi.i vi bin ton cc th thi gian sng ca n
l ton b thi gian khi chng trnh ang chy .
4. .1.3. Cc kin d liu trong Visual Basic.
Khi khai bo mt bin trong chng trnh tc l nh ra mt khong b
nh lu gi tr, khong thi gian ln hay nh tu thuc vo bin khai bo kiu
g.Khi dng bin trong chng trnh , iu quan trng l xc nh kiu bin cho ph
hp vi cc gi tr m ta t vo.Visual Basic cho php khai bo kiu d liu chun nh
sau:
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



4.1.1.4. Cc ton t Ton t tnh ton:
+ cng hai s vi nhau
Tr hai s vi nhau
* nhn hai s vi nhau
/ chia, tr v kiu s thc
\ chia ly nguyn
mod chia ly d
A
ly lu tha
Cc ton t so snh:
cc ton t so snh dng so snh hai gi tr no v lun tr v kiu
Byte 1 byte 0 n 255
Integer 2 byte -32768 n 32768
Long 4 byte -2.1.4.483.684 ti 2.14.483.674
Single 4 byte
-3,402823E38 ti - l,401298E-45 -l,401298E-45 ti
3,402823E38
Double 8 byte
-1/79769E308 ti -4.94065 E-324 4,94065E-324 ti
1/79769E308
Current 8 byte
-9223337203685477,5808 ti 22337203685477
Boolean 2 byte True v False
String 1 Byte c th ln n 2 m 31 k t mi k t
Date 8 byte

Variant 16 Byte

Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368



Cc ton t lun l:cc ton t lun l lun tr v cc gi tr lun l v cc s
hng cng l kiu lun l .
Boolean , tc l ch tr v hai gi tr True hay False.
Ton t ngha
> So snh xem s th nht ln hn s th hai hay khng
< So snh xem s th nht nh hn s th hai hay khng
= So sanh xem s th nht bng s th hai hay khng
>= So sanh s th nht c ln hn hoc bng s th hai
<= So snh s th nht c nh hn hoc bng s th hai
<> So snh xem s th nht c khc s th hai hay khng
Ton t ngha
And Tr v gi tr true nu c hai s hng u l True v ngc li
Or
Tr v gi tri true nu mt trong hai l True, tr v False nu c hai l False
Not
Tr v Tnie nu s hng l False v tr v False nu s hng l True
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


4.1.1.5.Cdc kien cau true
CaulenhlF:
Cu phap 1:
If<bieu thuc logic> Then
end if Cu
phap 2:
If<bieu thuc logic> Then
Else
End If
Cau true Select...ease
Y nghia:La mot cau true chon lua theo mot bien hay mot dieu kien nao do .Cau
true nay sir dung trong truong hop can xet nhieu dieu kien chon lua xay ra tren mot
bien nao do
Cu phap:
Select case<Bien hay bieu thuc dieu kien >
Case<gia tri 1>
<Cau lenh 1 >
Case<Gia tri n>
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


<Cu lnh n>
[Case Else
<cu lnh Else>]
End select
Cu trc For...Next.
ngha:L mt cu trc lp vi s bc lp c nh .cu trc ny thng c s
dng khi bn bit trc s vng lp . cu trc ny cu lnh c thc hin cho n khi
ht s bc lp .
C php:
For Counter=Start To End [Step step]
<Cu lnh>
[Exit For]
<Cu lnh>
Next[Counter]
Trong :
-CountenBin m kiu s nguyn .
-Start:Gi tr bt u ca Counter.
-End:Gi tr kt thc ca Counter.
Step:Bc nhy sau mi ln lp
Cu trc ca Do..while
Y ngha:L mt cu trc thc hin cho n khi biu thc iu kin thc s c
tho mn . iu kin ny khi gp iu kin tho mn th vng
lp dng.Neu cu lnh sai th b qua cc cu lnh v thc hin cc lnh pha di dng
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


Loop.
C php:
Do while <iu kin>
<Cu lnh >
[Exit Do]
<Cu lnh >
Loop
Hoc c th dng c php Do
<Cu lnh >
[Exit Do]
<cu lnh > loop Until <iu
kin>
Cu trc With rmha:
Cu lnh With cho php truy cp n thuc tnh ca i tng m khng cn
phi gi y tn i tng v tn thuc tnh .
C php:
With i tng
.Thuc tnh l=Thuc tnh
.Thuc tnh 2=Thuc tnh
End with
4.1.1.6. Th tc
Trong qu trnh vit mt chng trnh , i khi c mt on lnh no c vit i
vit li nhiu ln ging nhau , iu ny va tn cng li va lm cho chng trnh qu di
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


.Trong trng hp ny cho hp l c th nh ring on m ny mt ch no
trong chng trnh ,t cho n mt ci tn , khi cn thc hin on m ch cn gi
tn ca n.on m
ny nh ring v gi qua tn ca n gi l th tc hay Modul trong chng trnh .
Cch nh ngha mt th tc .
Mt th tc trc khi mun s dng phi nh ngha n.Dng t kho Sub khai
bo th tc ny .
Private/Public Sub<tn th tc>
Cc lnh m th tc cn thc hin End
Sub Kt thc th tc
Nu khai bo t kho Public , th tc ny c th c gi s dng trong bt k
form no trong chng trnh .
Neu khai bo bng t khoa Private, th tc ch c th dng c trong Form cha
n.
Th tc truyn tham s.
C php:
Prvate/Public<Tn th tc >(<tn tng trng cho tham s > As
<kiu>...)
Tu thuc mun n nhn bao nhiu tham s ta s khai bo by nhiu tn tham s
trong du ngoc v ngn cch chng bng du phay , khi gi th tc ny sau tn n bn
cng phi ngoc v ghi cc gi tr tham s tng ng vi tham s m n nhn
Thm modul vo chng trnh :
i khi trong chng trnh cn nh ngha nhiu th tc c th dng x l chung
cho cc cng vic no , ta nn to cc th tc ny thnh cc file ring .Sau ny nu vit
,mt chng trnh khc cn nhng th tc nh th ny ta c th ly ra dng m khng cn
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


vit li .
thm modul vo Project
+ Chn menu Project/Add module
+ Ca s vit lnh mi hin ra
+Vit tt c cc th tc dng trong ca s ny
+Khi lun Project, File ny cng c lun vi phn ui .BAS
-Cc th tc trong file module thng c dng chung trong bt k phn no ca
Project , v vy khi khai bo khng cn dng t kha Private hay public khai bo m
n gin ch khai bo bng sub v end sub
-Cc bin dng chung phi khai bo Global nu khng ch truy xut c trong file
Module m thi
e thm mt File Module ta vo trong Project hin thi :
+ Chn menu Project/add file
+ Chon file >BAS thch hp trn Dialog
Tham s th tc trong th tc
Khi nh ngha mt th tc , nu phi truyn vo th tc ny mt s gi tr lm
vic , cn nh ngha thm nhng tham s cho n .Cc tham s c truyn vo th tc
c hai dng :dng truyn tham tr v dng truyn tham chiu .
ByVal Quy inh tham s truyn theo kiu tham tr
Byref Quy nh tham s truyn theo kiu tham chiu
Khi mt tham s truyn theo kiu tham chiu bn phi lun lun truyn vo cho n
mt bin ch khng c truyn mt gi tr c th .
4.1. . 7.HM (Function)
Cng ging nh th tc nhng Hm tr v mt gi tr kt qu cn th tc th
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


khng.V vy khi ni n mt Hm th iu quan trng chng ta cn quan tm l n tr v
cho ta ci g .
nh ngha mt Hm mi dng c php sau :
[Private/Public] Function tn hm (tham so AS kiu ...) As <kiu
tr v >
Tn hm =Gi tr tr v End
Function
4.1.1.8. HNG(Constant)
Trong mt chng trnh c mt s ga tr m ta dng khng i trong sut qu trnh
chng trnh thc hin .Cc gi tr na thng c nh ngha thnh cc hng
(Contstant)
Cch khai bo hng trong chng trnh .
[Public/Private] Const<Tn hng >[As kiu ]=<Gi tr c>
v d Public const so=5
4.1.2. H qun tr CO s d liu Microsoft Access
4.1.2.1. Gii thiu chung v Access
Microsft Access tr thnh phn mm CSDL lin tc pht trin , th hin bc
ngot quan trng v s d dng trong vic s dng , nhiu ngi b cun ht vo vic
to cc CSDL hu ch ca ring mnh v cc ng dng CSDL hon chnh.
Hin nay , Microsoft Acces tr thnh mt sn phm phn mm mnh , d dng,
n gin khi lm vic .Chng ta hy xem xt li ch ca vic s dng phn mm pht
trin ng dng CSDL nh Microsoft Access
H CSDL:Theo nh ngha n gin nht, mt CSDL l mt tp hp cc bn ghi v
tp c t chc cho mt mc ch c th .
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


Hu ht cc h qun tr CSDL hin nay u lu gi v x l thng tin bng m hnh
qun tr CSDL quan h .T quan h bt ngun t' thc t l mi bn ghi trong CSDL
cha cc thng tin lin quan n mt ch duy nht .Ngoi ra , cc d liu ca hai
nhm thng tin c th ghp li thnh mt ch th duy nht da trn cc gi tr d liu
quan h .Trong mt h qun tr CSDL tt c cc d liu y c qun l theo cc bng ,
bng lun tr thng tin v mt ch th . Thm ch khi s dng mt trong nhng phng
tin ca mt h CSDL rt ra thng tin t' mt bng hay nhiu bng khc(thng c
gi l truy vn ) da trn kt qu ca mt truy vn khc
Cc kh nng ca mt h CSDL l cho chng t quyn kim sot hon ton bng
cch nh ngha d liu , lm vic vi d liu v chia s d liu vi ngi khc .
Mt h CSDL c 3 kh nng chnh :nh ngha d liu , x l d liu v kim sot
d liu .
Ton b chc nng trn nm trn tnh nng mnh m ca Microsoft Access
a. inh ngha d liu :
Xc nh CSDL no s c lu gi trong CSDL loi ca d liu v mi quan h
gia cc d liu .
b. X l d liu :
Nhiu cch x l d liu l cc bng, cc truy vn , cc mu biu ,cc bo co,cc
macro v module ca Access.
4.1.2.2. Bng(Table)
Bng l mt i tng c nh ngha v c dng lu d liu .Mi bng cha
cc thng tin v mt ch th xc nh .Mi bng gm cc trng (field) hay cn gi l
cc ct (column) lu tr cc loi d liu khc nhau v cc bn ghi(record) hay cn gi l
cc hng (Row) lu tr tt c cc thng tin v mt c th xc nh ca mt ch th .C
th ni mt kho c bn (PrimaryXgm mt hoc nhiu trng hp) v mt hoc nhiu
ch mc (index) cho mi bng gip tng tc truy cp d liu .
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


a. t kho chnMPrimary Key)
Mi bng trong mt CSDL quan h u phi c mt kho c bn v xc nh kho
c bn trong Microsoft Access tu theo tng tnh cht quan trng ca bng hay tng
CSDL m ta chon kho chnh cho ph php:M bng ch Design, chn mt hoc
nhiu trng mun nh ngha l kho .Dng chut bm vo nt Primary Key trn thanh
cng c .
b. inh ngha kho trn quan h
Sau khi nh ngha kho xong hai hay nhiu bng c quan h th nn bo cho Access
bit cch thc quan h gia cc bng .Nu lm nh vy , Access s bit lin kt tt c cc
bng mi khi s dng chng sau ny trong cc truy vn , biu mu hay bo co
Cc tnh nng tin tin ca Microsoft Access:
+ Phng tin Table wizard gip nh ngha cc bng
+ Php inh ngha ho cc mi quan h
+ Cc mt n nhp liu cho trng t ng thm cc k hiu nh dng vo cc
d liu .
+ C kh nng lu gi cc trng Null cng nh cc trng trng trong CSDL
+ Cc quy tc hp l ca bng c kh nng kim tra tnh hp l ca mt trng da
trn cc trng khc.
+Cng c ring to ch mc
Cc tnh nng tin tin ca truy vn trong Access
+ Phng thc ti u truy vn Rushmore(T Foxpro)
+ Phng tin Query Wizard gip thit k cc truy vn
+ Truy xut cc thuc tnh ct :quy cc nh dng cc v tr thp phn
+ C kh nng lu gi d liu kiu trnh by bng d liu hoc truy vn
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


+ Cc cng c to truy van (Query build) kh dng trn nhiu vng.
+ Kh nng nh ngha cc kt ni kh dng c ci thin .
+ H tr cc truy vn Union v cc truy vn th cp (trong SQL)
+ Ca s son tho SQL c ci thin .
+ Tng s trng c th cp nht c trong mt truy vn kt ni
4.1.2.3. Ma li Biu (Form)
Mu biu l i tng c thit k ch yu dng nhp hoc hin th d liu
hoc iu kin vic thc hin mt ng dng .Cc mu biu c dng trnh by hon
ton theo mun cc d liu c truy xut t cc bng hoc cc truy vn
4.1.2.4. Bo co
Bo co l mt i tng c thit k nh quy cch , tnh ton , in v tng hp
cc d liu c chn
4.2. THIT K GIAO DIN CHNG TRNH
4.2.1. Mt s Modul chnh ca chng trnh
4.2.2. M so Form chnh ca chng trnh
Form ng nhp: Khi bt u vo chng trnh ngi s dng phi nhp chnh xc
tn v mt m ng nhp (c phn bit ch hoa ch thng).

r ------------------------------ : -----------------------
Bi- ng nhp h thong


KO
ANG NHP



Tn ag uhp: admin



Mt khu: \
xxxxx





aag nhp Thot

L ...................... . ]
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


Form Menu Chnh :Cho ngi s dng nhn mt cch tng qu nht v giao din
ca chng trnh qun l sinh vin .H thng menu ny c phn thnh 6 menu chnh l
:Qun l h thng , Qun l danh mc ,Qun l kho
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


;rj Lp ho
n bn
thuc 1||phiu
tr thuc
^]Tuvn
khch h...
hng , Qun l bn hng , Qun l thu chi , Thng k bo co. Form ny c thit k
giao din di y:
Phn Mm qun l thuc Ty
Qun h thong Thng lin danh mc Qun l kho hng Qun nhn vin Chc nng Tia Cu Qun l bn Thuc Qun l bo co Ti gip h thng

PII i Q3B L Y1WC
n hn l.11


C'
Form Lp Ho n bn hng :Form ny c thit k nhm gip ngi bn hng
c th thun tin vic lp ho n bn hng cho khch hng , ng thi lu tr y
cc thng tin trong qu trnh giao dch bn thuc vi khch hng nu khch hng khng
thanh ton th h thng s bt nhp vo hn tr .Form ny c thit k nh hnh di
y:
t IQ

t t 0
Danh mc Kho Hng Bn Hng QLThuchi Thngk Tr gip Thot
i
H
thng


Phiu xut hng
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368








5/14/2007 1 0:09:48 PM
5/15/2007 5:51:36 AM
5/15/2007 5:52:09 AM
5/15/2007 5:59:32 AM
5/18/2007 6:06:48 AM
5/18/2007 S:33:5 AM
Thanh ton 0 T ng lin 6,600.0004
VND >
Blngch c sau trieu sau tram nghtn)
Form Damh Mc Khch hng : Cp nht chi tit v khch hng giao dch
mua bn vi ca hng ,Trong Form ny ngi s dng c th thao tc lun chuyn
gia hai ch nh l X l danh mc (nhp , sa , xo ) v Tm kim thng tin
v khch hng vi t kha nhp t Textbox.Form ny c thit k nh sau :
HQ n bn liiig
Chi tit phiu bn hng
Nhm Thuc T n
thuc
n gi
M ll
Thcra
S lng
n V
tnh
a
Thm KH
Khch hng I khOOI
Ngy bn 18/05/; Gi
bn 06:33:50
s phiu Khch hng Nhn vin bn Ngy bn S lng I an gi
125 kh02 NV001 5/13/2008 10:15:51 AM
MT01
MT04
200000
20000 129 kh02 NV001 5/14/2007 1 0:09:48 PM
Da n h mu c b a n a n
Website: http://www.docs. vn Email : Henhe@docs. vn Te/ 0918.775.368


ME khch n^ khOOI
a cl i<^i
Thoi Email Ghi
eii
bJ _______ L
thf
t
ti
Thiig Till v Khch Hiig


Tin Khidi Hti |Dang dinh Quang
dong du-gia lam -ha noi
dangquang9@yahoo. (
|dsag

Form Nh cung cp :Tng t nh form cp nht Danh mc khch

hng
% Dnnh Mu Doi I Nhrt (-UMI1 Cnp

DANH MUC AI L - NH CUNG CP


c<xn**>! -ir
0rrfi ikh ttt ly r+t c-it'
MSoh cta.t).
.llftartAcunflcAn
ncc 01 hoirg r- n
!
(tang cyurtog
L dign
I Tim xly






Li-L


Makh T enkh Diachi
khOOI Dang dinh Quang dong du-gia
lam kh002 Hoang xuan Vu Long Bien-
Hanoi

J
T o mri Lu Sa
m
Hu b
&
Xo
Thoat
H

Ho abn .-iun^ of> nta fttmg op
7An abA op M mA lb 1
Doa b*u tib6 oSp
r,,!
'
w
SA <jnag k kinh doa&h 1
Puou p*' f*> WV-. 1**
Dt tho*v 7n Hgy btt cteu -ult .y|> 12/25/2006
>.
lj
^ V <M m/r* s

La chn
3r a I
Tm kim X l danh mc
- Tm kim thng
tin- Hin th |tatca
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


S phiu |G2
Nhn vin I dang dinh quang I
IP I
Huy
b
sa
Form Phiu nhp Hng :Gip ngi s dng c th kim tra nhng mt hng
nhp ca ca hng ,ng thi c th nhp mi v in trc tip ra cc ho n
nhp ca ca hng .

Danh sch phiu nhp lilig












Xo In Phiu

Form Danh mc Thuc :Lit k chi tit cc thng tin chi tit v cc loi
Thuc c s dng trong ca hng .Ngi s dng cng c th thao tc
trc tip nh :Nhp sa xo , Tm kim hay in danh sch cc thuc .
Phiu nhp hng Nh cung cp I dang
dinh qun< -T Ngy nhp |16/05/2007
Chi tit phiu nhp
hng Nhm Thuc I
S lng
n gi
% r,| 1
sa Xoi 1 Thm 1

GI nhp
Ngi giao
a
Thm NCC
Ngy sn xut I Hyi $[) D S lng _________ n TnThuc pnh sophiei pnh NqaNhap pnh_ G ioN hp
82 5/16/2007 3:09:36 AM 5/16/2007 3:09
MT01
5/16/2007 3:09:36 AM
5/16/2007 3:18:43 AM
5/16/2007 3:2411 AM
5/16/2007 3:28:55 AM
5/18/2007 3:30:12 AM
5/16/2007 3:32:44 AM
5/16/2007 3:34:32 AM
5/16/2007 3:35:22 AM
5/16/2007 3:40:30 AM
5/16/2007 3:42:08 AM
5/16/2007 3:42:51 AM
5/16/2007 3:47:44 AM
5^16/2007 3:59:05 AM
5/16/2007 4:08:35 AM
Ngy sn xut r
Ngy ht hn
n V lnh
M t
T ng tin
Thanh
ton
120 12(VND> CnN
Hn tr ~f -1
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368



Code cua Modul chinh
'Option Explicit
Public list As Listltem
Public 1 As Columns
Public rs As New ADODB.Recordset
Public str As String
Public strSQL As String
Global Cn As New ADODB.Connection
'Public rs As New ADODB.Recordset
Public Login As Boolean
Public Users TenDN As String
Public Users QuyenTC As Integer
Public Users HoTen As String

Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


Public Users_MaNV As String Public strlever As String
Public strTK As String
Public flag Update As Integer' 1: Them moi; 2: Sua
' Ket noi CSDL
Sub ConnectDB()
On Error Resume Next
Dim strDB As String
strDB = App.Path & "\database\Thuoc.mdb"
Cn.CursorLocation = adUseClient
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & strDB & ";Persist Security Info=False"
Cn.Open
If Err <> 0 Then
Call errShow("L9i! Khng kOt nei -ic vii CSDL", Err.Description)
End If
End Sub
Sub Main()
frmWelCome.Show 1
'frmSplashscr.Show 1
ConnectDB
' frmmain.Show 1 frmlogin.Show 1 End Sub
' Mo bang va truy xuat DL
Public Function getRecordSet(SQL_tem As String) As ADODB.Recordset
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


On Error Resume Next
If getRecordSet Is Nothing Then Set getRecordSet = New ADODB. Recordset
If getRecordSet.State = adStateOpen Then getRecordSet.Close
getRecordSet.Open SQLtem, Cn, adOpenDynamic, adLockOptimistic,
adCmdText
If Err.Number <> 0 Then
Call errShow("L9i! Khng truy xuEt -ic d+ liOu!", Err.Description)
End If
End Function
'Update du lieu
Public Function execSQL(SQL_tem As String)
On Error Resume Next
Cn.Execute (SQL tem)
If Err.Number <> 0 Then
Call errShow("Li! Khng cp nht -c cK liu!", Err.Description)
End If
End Function
Public Function getSingleValue(strSQL As String) As String
Dim RsTemp As New ADODB.Recordset getSingleValue =
""
RsTemp.Open strSQL, Cn, adOpenForwardOnly If Not RsTemp.EOF
Then
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


If Not IsNull(RsTemp.Fields(0). Value) Then
getSingleValue = RsTemp.Fields(0).Value End If
End If
RsTemp.Close
End Function
' Hien thi thong bao loi
Sub errShow(errUser, errSQL)
MsgBox errUser & Chi tiet loi: " & errSQL, vbExclamation, "Thong bao"
End
End Sub
Function Gia_tri(strTen_cot As String, strTenbang As String, strDieukien As
String) As String
Dim sql As String
Dim rsGT As ADODB.Recordset
strSQL = "SELECT " & strTen cot & " FROM " & strTen bang & " WHERE
" & strDieu_kien
Set rsGT = getRecordSet(strSQL)
Giatri = rsGT(O)
End Function
Public Sub CloseDB()
On Error GoTo Loi
Cn.Close
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


Loi:
Set Cn = Nothing End sub.
Code Menu chinh ca chng trnh :
Dim PreWith As Long, PreHeight As Long Dim mitem
Private Sub CmdIcon_Click()
If ListFunct.View = lvwlcon Then
ListFunct.View = IvwList Else
ListFunct.View = lvwlcon End
If End Sub
Private Sub CmdMenu_Click(Index As Integer)
Dim i As Integer For i = 0 To 6
CmdMenu(i).BackColor = &HC0C0FF Next
CmdMenu(Index).BackColor = &H80000018
ListFunct.Listltems.Clear
ListFunct. Icons = ImageListl (Index)
ListFunct.Smalllcons = ImageListl (Index)
For i = 1 To ImageListl (Index).Listlmages.count
If ImageListl (Index).Listlmages.Item(i).Tag <> "un" Then
Set mitem
ListFunct.Listltems. Add(Key:=ImageListl (Index). Listlmages.Item(i). Key,
Text:=ImageListl (Index). Listlmages.Item(i). Key,
Icon:=ImageListl (Index).Listlmages. Item(i).Key,
SmallIcon:=ImageListl (Index). Listlmages.Item(i). Key)
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


End If
Next i
exitt:
End Sub
Private Sub Command7_Click() frmSplashscr.Show
1
End Sub
Private Sub Command9_Click()
If MsgBoxC'B'n ca ch%c ch
3
An tho.t khng ?", vbYesNo, "Thng B,o") =
vbYes Then
End
End If
End Sub
Private Sub Form_Load()
PreWith = Me. Width PreHeight = Me.Height CmdMenu_Click (0) nextx:
End Sub
Private Sub Cmdtho
j
t_Click(Index As Integer)
End
End Sub
Private Sub ListFunct_DblClick()
Dim rs As Recordset Set rs = New Recordset
If CmdMenu(2).BackColor = &H80000018 Then
Select Case ListFunet.Selectedltem.Index
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


Case 1
frmSplashscr.Show 1
Case 2
MsgBox ("Choc nng njxy ch-a -ic cjni dMEt") End
Select Exit Sub End If
If CmdMenu(l).BackColor = &H80000018 Then Select
Case ListFunct.Selectedltem.Index Case 1
frmtracuudauthuoc.Show 1 Case
2
frmPhieuNhap.Show 1 Case 3
frmthuochethan.Show 1 End Select Exit Sub End If
If CmdMenu(0).BackColor = &H80000018 Then Select
Case ListFunct.Selectedltem.Key Case "Danh moc
thuec"
frmDMThuoc.Show 1 Case
"Danh mc nhm thuc" frmdm
nhom thuoc. Show 1 Case "Danh
Mc nh|x cung cp"
frmDLNhaCC.Show 1 Case
"Danh mc Kh^h H|j,ng"
frmdmkhachhang.Show 1 Case
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


"
_,
n v> tnh" fnndvt.Show 1
Case "Nuc s^n xut"
frmNuocsx.Show 1 End Select
Exit Sub
End If
If CmdMenu(5).BackColor = &H80000018 Then
Select Case ListFunct.Selectedltem.Key Case "Cu
Hxnh Ch-^ng Trxnh"
MsgBox ("Ch0C rfng n|xy ch-a -c C|ni
Case "Cp Quyn"
MsgBox ("Choc n"ng nLiy ch-a -ic C|ni ^Et")
Case "Thay aei mt khu" frm Admin. Show 1
Case "Ng-i S Dng" frmsd.Show 1
Case "Nhm S Dng"
MsgBox ("Ch0c n"ng n|xy ch-a -c CLii Case
"B Kt Ni CSDL" mnudisconectClick Case
"Kt ni CSDL mnuconectClick End Select
Exit Sub
End If
If CmdMenu(3).BackColor = &H80000018 Then
Select Case ListFunct.Selectedltem.Key
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


Case "Lp ho n bn thuc"
frmHDBanThuoc.Show 1
Case "Mn tr sch"
End Select Exit Sub End If
If CmdMenu(4).BackColor = &H80000018 Then Select
Case ListFunct.Selectedltem.Key Case "Thns; k doanh
thu"
frmbcdt.Show 1 End
Select Exit Sub End If End
Sub
Private Sub ListFunct_KeyPress(KeyAscii As Integer)
IfKeyAscii= 13 Then ListFunctDblClick End If End Sub
Private Sub MDIForm_Load()
CmdMenu Click (3)
Me. Status Bari .Panels(2).Text = UsersHoTen Me. tmr Active.
Interval = 500 Me.tmrActive.Enabled = True Private Sub
mnhdsnv_Click() frmnsd.Show 1 End Sub
Private Sub mnuconect_Click()
If Cn.State <> adStateOpen Then ConnectDB
Frame2. Enabled = True
ListFunct.Enabled = True
Website: http://www.docs. vn Email: lienhe@docs. vn Te! 0918.775.368


CmdMenu(5).Visible = True End If End
Sub
Private Sub mnudisconect_Click()
Dim Msg As String
Dim response If Cn.State =
adStateOpen Then
Msg = "Khng kOt nei v^io CSDL?"
response = MsgBox(Msg, vbQuestion + vbOKCancel, "Thng
If response = vbOK Then Cn.Close
CmdMenuClick 0 Frame2. Enabled = False ListFunct.Enabled =
False End If End If End Sub
Private Sub mnuphieunhap_Click()
frmPhieuNhapThuoc.Show 1 End Sub
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


Private Sub tmrActive_Timer()
Static nDot As Integer nDot = nDot + 1
Me.StatusBarl.Panels(l).Text = Me.StatusBarl.Panels(l).Text & " * " If nDot
= 37 Then Me.StatusBarl .Panels(l).Text = "" nDot = 0 End If
End Sub
KT LUN V HNG PHT TRIN
Vi chng trnh Qun l ca hng thuc ny s gip cho Ca hng thuc
Kim Anh d dng qun l cc hot ng kinh doanh mt cch c hiu qu, nm bt
dc Tnh hnh nhp v bn Thuc, thng k c sc mua ca khch hng, bit
c nhu cu mua hng ca khch hng, bit c loi thuc no ht hn va s
lung cn t t ngi qun l a ra yu cu nhp thuc kp thi ,Gip ngi
dng c th t vn cho khch hng mt cch chnh xc
Tm li, chng trnh Qun l Ca hng thuc c xy dng mt cch
tng i hon chnh, p ng c nhiu nhu cu truy vn thng tin nhanh chng
v gii quyt c vic t chc c s d liu nht qun, d dng cho vic lu tr
thng tin. Tuy nhin vn cn mt s nhc im v thiu st Em s c gng hon
thin trong cc phin bn ti. Rt mong nhn c s quan tm v gp ca qu
Thy C v cc bn.
HNG PHT TRIN
Chng trnh Qun l Ca hng Thuc Kim Anh hin c thit k c th
sn sng b sung thm cc chc nng cn thiu, cc chc nng qun l mi ang v
s xy ra trong tng lai nh:
- Chc nng qun l Thuc theo h thng m vch
- Chng trnh s c s dng trn mng c th bn hng trc tuyn , v
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


c th giao thuc n tn ni khch hng yu cu
- nh hng thng mi in t khi Cng ty xy dng website bn hng qua
mng.
- Qun l Nhn s trong ca hng (nh tnh tin lng, chm cng cho Nhn
vin qua hh thng th t).
Trong tng lai chng trnh Qun l Ca hng ny sau khi c b xung
thm cc chc nng cn nh trn th s c th p dng cho cc cng Ty hay ca
hng bn Thuc ln
Trong cc phin bn ti Em s khng ngng nng cp chng trnh Qun l
ca hng Thuc ny lm cho chng trnh ngy cng c hon thin hn, i vo
thc t hn na, p ng kp thi nhu cu ngy cng pht trin ca X hi.
TI LIU THAM KHO
1. Phn tch v thit k h thng thng tin
Nguyn Vn Ba - NXB i Hc Quc Gia HN
2. Microsoft Visual Basic - Lp trnh CO s d liu 6.0 Nguyn Th Ngc Mai
- NXB Lao ng X Hi
3. Nhp mn c s d liu quan h
L Tin Vng - NXB Thng K
MC LC
LI N U ................................................................................................................. 1
CHNG 1 .KHO ST SO B V XC LP D N .............................................. 3
1.1 .KHO ST S B CA HNG THUC KM ANH ........................................ 3
1.1.1 .Qu trnh hnh thnh v pht trin ca ca hng thuc Kim Anh .................. 3
1.1.2.Hng pht trin ca ca hng ....................................................................... 3
2.2.3.1 Bieu do luong dir lieu chirc nang cap nhat thong tin 21
Website: http://www.docs. vn Email: Henhe@docs. vn Tel W: 0918.775.368


1.2. QU TRNH HOT NG CA CA HNG THUC KIM
ANH
(KHO ST CHI TIT) ............................................................................................. 3
1.2.1 .Hot ng bn hng ........................................................................................ 3
1.2.1 .Qu trnh nhp hng ....................................................................................... 5
1.2.3 .Qun l cng n ............................................................................................. 6
1.2.4.Thng k .......................................................................................................... 6
1.3. NH GI HIN TRNG CA CA HNG THUC KIM ANH .......... 6
1.3.1. u ......................................................................................................... im 6
1.3.2. Nhc ............................................................................................. im 7
1.4 S CP THIT XY DNG BI TON QUN L: ....................................... 8
CHNG 2 ................................................................................................................... 10
PHN TCH V THIT K H THNG .................................................................... 10
2.1. PHN ................................................................... TCH V CHC NNG 10
2.1.1. ............................................................................................................ P
hung php phn tch ............................................................................................. 10
2.1.2. Biu .......................................................... phn cp chc nng(BPC) 11
2.1.3. M ................................................................................ t cc chc nng 13
2.2. BIU
LUNG D LIU - BLD (DATA FLOW DIAGRAM=DFD) .............. 15
2.2.1 .BLD mc ng cnh (mc 0) ......................................................................... 17
2.2. BLD MC NH (MC 1).................................................................................... 18
2.2.3. BLD .................................................................... mc di nh (mc 2) 19
Bieu do luong dir lieu chirc nang quan ly kho hang
22
2.2.3.3.50 do chirc nang quan ly Ban Thuoc ................................................. 23
2.2.3.1 Bieu do luong dir lieu chirc nang cap nhat thong tin 21
Website: http://www.docs. vn Email: Henhe@docs. vn Tel W: 0918.775.368


2.2.3.4.50 do chuc nang quan ly Thu chi ......................................................... 24
2.2.3.5.50 do chuc nang quan ly bao cao ......................................................... 25
CHUGNG 3 PHAN TICH THIET KE CO SCf DU LIEU ..................................... 26
3.1 LY THUYET THIET KE CO SO DlTLIEU QUAN HE .............................. 27
3.2 MOT SO THlfC THE ....................................................................................... 29
3.2.1 Phat hien thirc the ........................................................................................ 29
3.2.2. Phat hien kieu lien ket ................................................................................. 29
3.2.3 Phat hien thuoc tinh ..................................................................................... 30
3.2.4 Thiet ke cae bang eo so du lieu ................................................................... 32
3.2.4.1. Bang DM_KhachHang luu tru thong tin ve cae khaeh hang
giao dich
voi cua hang ...................................................................................................... 32
3.2.4.2. Bang DM NCC luu tru
-
thong tin chi tiet ve nha eung cap,
chuyen
eung cap cae mat hang cho cua hang ................................................................ 32
3.2.4.3. Bang NhanVien luu tru moi thong tin chi tiet ve cac nhan
vien cua
eira hang ............................................................................................................ 33
3.2.4.4. Bang DM_NhomThuoc liru tru thong tin ve cae nhom Thuoc ..... 33
3.2.4.5. BangDonViTinh luu tru thong tin ve don vi tinh cua
Thuoc 33
3.2.4.6. Bang.DM_Thuoc luu trir chi tiet cae thong tin
ve cac loai Thuoc hien
eo cua cua hang ................................................................................................. 34
3.2.4.8. Bang ChiTiet_HDB luu trir thong tin chi tiet ve hang ban
ghi trong
hoa don ban hang .............................................................................................. 35
3.2.4.9. Bang PhieuThu luu trir thong tin ve cac khoan phai thu ciia
cua hang 35
2.2.3.1 Bieu do luong dir lieu chirc nang cap nhat thong tin 21
Website: http://www.docs. vn Email: Henhe@docs. vn Tel W: 0918.775.368


3.2.4.10. Bang PhieuNhapThuoc luu tru thong tin ve loai Thuocnhap cua
eira hang ............................................................................................................ 35
3.2.5.11 .ChiTiet PhieuNhap lu tr chi tit thng tin v cc Thucnhp ........ 36
3.2.5.12.Bng PhieuChi lu tr thng tin v cc khonphi chi ca ca
hng ..................................................................................................................... 36
3.2.5.13 .Bng PhieuHuy lu tr thng tin v phiu hu hng ........................... 36
3.2.5.14. BngThuocHuy lu tr thng tin chi tit v hng cn hu
37
3.2.5.15. BngTuThuoc lun tr thng tn v ch thuc
37
3.2.5.16. BngNsdlu tr thng tin v ngi s dng
37
3.3.6.Biu quan h ............................................................................................. 38
CHNG 4.CC CNG c s DNG V THIT K GIAO DIN ................ 39
4.1. CCCNG C S DNG
39
4.1.1. Lptrnh bng visual Basic
39
4.1.1.1. Giithiu v Visual Basic
39
4.1.1.2. itng v cch s dng i tng
40
4.1.1.3. Cckiu d liu trong Visual Basic
43
4.1.1.4. Ccton t
43
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


4.1.1.5. Cckiu cu trc
45
4.1.1.6. Th ................................................................................................ tc
48
4.1.1.7. HM ................................................................................. (Function)
50
4.1.1.8. HNG(Constant ........................................................... )
50
4.1.2. Hqun tr c s d liu Microsoft Access
51
4.1.2.1. Giithiu chung v Access
51
4.1.2.2. Bng(Table............................................................................. )
52
4.1.2.3. Mu ...................................................................... Biu(Form)
54
4.1.2.4. Bo ............................................................................................... co
54
4.2. THITK GIAO DIN CHNG TRNH
54
4.2.1 .Mt s Modul chnh ca chng trnh .......................................................... 54
4.2.2. Mts Form chnh ca chng trnh
54
4.2.2. Mts Code chnh s dng trong chng trnh
59
Website: http://www.docs. vn Emai!: lienhe@docs. vn Te! 0918.775.368


TI LU THAM KHO ........................................................................................... 73