1. Trang chủ
  2. » Tài Chính - Ngân Hàng

Website quản lý nhà hàng khách sạn

68 464 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 68
Dung lượng 38,37 MB

Nội dung

Ludnvdn tOt nghiQp: Website i nhd hdns khdchcAc xY nlEu vA vlEr rAr CSDL Co So Dt LiEu MCD Model Conceptual Data MLD Model Logical Data NH-KS Nhi hdng - Kh6ch s4nPHP Hypertext Preprocess

Trang 1

TRTI0NG DAr Hoc rAv o0

2^A^

KHOA LUAN TOT NGHIE,P DAI HQC

Sinh viOn thyc hiEn

NguySn Thanh Phong

C6n b0 hucrng dAnThS Nguy6n Chi Cucmg

C6n bQ phAn biQn

ThS Le Thi Thu Lan

Khod luQn dugc b6o vQ tpi: HOi d6ng ch6m 1u6n vdn t6t nghiQp BO m6n

Khoa K! ThuAt C6ng Nghq, trudng D4i hqc Tdy D6 vio

ngdy th6ng ndm

CO ttr6 tim hi6u kh6a luQn tpi:

Thu viQn: Trudrng D4i hgc Tdy D6

Trang 2

Ludn vdn tOt nghiQp: Website quan ti nhd hang kluich sqn

LC}I CAM ON

EAu ti6n t6i xin chdn thinh gtri lcri cim crn d6n Ban gi6m hiQu truong DaiHgc TAy D6, quy thAy cO d6 tpn tinh day b6o, truydn d4t ki6n thric, ctng nhukinh nghiQm quy b6u cho t6i su6t thoi gian hgc t4p tAi trucrng.

on thdy c6 trong Khoa K! Thuat - COng Nghe d6 t4o mqi di€u kiQn thuQn lgi

ngudi d5 nu6i d4y, dQng vi6n vi trng hQ t6i d6n ngdy h6m nay.

Xin cim crn t6t ci anh chi, b4n bC da nhiQt tinh chia sd kinh nghiQm, ki6nthric, girip t10 t6i trong su6t nhimg nim hgc t4i trucrng.

Sinh vi6n thgc hiQn

L.003664

Trang 3

Ludn vdn t6t nghiQp: Website quan t! nhd hdng khdch sqn

NHaN XEr CUe cno UEN HI/ONG DAN

sE EE

p -Cdn Tho,ngdy .th6ng .nf,m 2012Gi6o vi6n Huri,ng Dfin

a

Trang 4

Ludn vdn tdt nghiQp: Website qudn l! nhd hdng khdch sqnNHaN XEr CUA GIAO UeN PHAN B|EN

-<x EB

&) -Cdn Tho,ngey th6ng ndm 2Ol2Gi6o vi6n Phin Bi6n

Trang 5

LuQn vdn t6t nghiQp: Website quan ly nhd hdng khdch sgn

Trang 6

Ludn vdn t1t nghiQp: Website quan l'j nhd hdng khdch sgn

Trang 7

Ludnvdn tiit nghiQp: Website qudn $ nhd hdr.ty!\4ch jgn

Trang 8

Ludn vdn tiit nghiQp: Website qudn $ nhd hdng khdch sgn

DANH MUC HJNH

Fnnh 2.1 - Yi ds b6ng trong MySQL 17

fnnh 2.2 - Ky hiQu thpc th6 18

Fnnh 2.3 - Yi du m6i tet frq,p 18

fnnh 2.4 - Yi du thuQc tinh 19

fnnh 2.5 -8ins0 19

Fnnh 2.6 - Yi dr,r kho6 ctia thuc th6 19

Fnnh 2.7 - Plrr.1 thuQc him gifia hai thuc th€ 20

Fnnh 2.8 - Li0n quan giiia php thuQc him voi bin s6 20

Hinh 3.1 - MO hinh thgc tfr0 tet hqp 33

Hinh 3.2 - M0 hinh 1u4n 1y 35

fnnh 3.3 - Luu d6 dlng nh{p 46

Fnnh 3.4 - Luu dO th6m dir liQu 46

Fnnh 3.5 - Luu d6 sira dt liQu 47

Innh 3.6 - Luu d6 xo6 dU liQu 4j Hinh 3.7 - Giao diQn chinh trOn trang ngudi dirng 48

Hinh 3.8 - Giao diQn tim kitim tr6n rrang nguoi dung 49

Hinh 3.9 - Giao diQn dat phong - budc 1 50

Hinh 3.10 - Giao di€n d[t phong - budc 2 50

Hinh 3.11 - Giao di€n dflt phdng - bu6c 3 51

Hinh 3.12 - Giao di0n d4t m6n 5n - budc 1 5l Hinh 3.13 - Giao diQn d[t m6n dn - budc 2 52

Hinh 3.14 - Giao di6n chinh trOn trang quan tr! 52

Hinh 3.15 - Giao di6n quin ly thenh vi6n 53

Hinh 3.16 - Giao di€n quin ly chric vg 54

Hinh 3.17 - Giao diQn qu6n ly nh6m ngucri dung 54

Hinh 3.18 - Giao diQn quin ly lopi phong 55

Hinh 3.19 - Giao dien quin ly chi tii5t phong 55

Hinh 3.20 - Giao diQn quin ly s6nh 56

Hinh 3.21 - Giao diQn quin ly chi ti6t bdn 6n 56

Trang 9

LuQn vdn tiit nghiQp: Website qudl li nhd hans khdch sqn

Hinh 3.22 - Giao diQn qu6n ly lo4i m6n 4n 57

Hinh 3.23 - Giao diqn qu6n ly chi tir5t m6n dn 57

Hinh 3.24 - Giao diQn quan ly lo4i dich vu 58

Hinh 3.25 - Giao diQn quin ly chi titit dich vu 58

Hinh 3.26 - Giao diQn quan ly thdng tin d4t phong 59

Hinh 3.21 - Giao diqn quin ly th6ng tin dat bdn 6n 59

Hinh 3.28 - Giao diQn quin ly quy <linh ca 60

Hinh 3.29 - Giao diQn quin ly lich ldm viQc 60

Hinh 3.30 - Giao diQn quin ly tin tr?c 61

Hinh 3.31 - Giao diQn b6o ciio th6ng kC trang chti 61

Hinh 3.32 - Ho6 dcrn d{t phong 62

Hinh 3.33 - Ho5 don dat bdn 6n vd m6n dn 63

Trang 10

Ludnvdn tOt nghiQp: Website i nhd hdns khdch

cAc xY nlEu vA vlEr rAr

CSDL Co So Dt LiEu

MCD Model Conceptual Data

MLD Model Logical Data

NH-KS Nhi hdng - Kh6ch s4nPHP Hypertext Preprocessor

SQL Structured Query Language

I

E

Trang 11

TOM rAr

Ngny nay, viQc c6c dich vp NH-KS dang mo rQng quy m6, img dgng c6ngnghQ th6ng tin vio viQc qu6n lf, qu6ng c6o vd giao dfch ngay tr6n m4ng Internet

de ff0 thenh mQt hiQn tuqng quen thuQc N6 gr_rip qu6 trinh kinh doanh cria

NH-KS dugc trd nOn quy mO vd tiQn lgi, giao ti6p d€ ddng vdi kh6ch hdng ttr xa.

Chinh vi vQy, OC tai "Website Qudn Li Nhd hdng - Khdch sgz" dugc dua

ctng nhu qu6 trinh kinh doanh, ti6p nhfln dcrn tlat h*g cria kh6ch hang tu mqinoi, ddng thdi de tii img dung c6ng nghQ anh 3D tiOn ti6n vio viQc qu6ng c6o Vithi5 viQc quan lf tfr6 nien sg chuy6n nghiQp vd tuong t6c tryc quan hcrn th6ng qua

ngudn m& PFIP, vi hQ quan trf co s0 dfr liQu MySQL

Trang 12

Today, the restaurant and hotel services ,re expanding; applying

Internet has become so popular It helps the process of restaurant - hotel business

become large - scale and convenience; the communication with remote clients iseasier.

Therefore, the subject "Website Management Restaurant and Hotel" was

born for the purpose of building a website system to ensure the restaurant - hotelmanagement and business By this Website, personnel management as well as

business process, or receiving orders from everywhere even application of

advanced 3D imaging into the advertising are not difficult problems Besides,

this management is also more professional and more highly interactive through

the Internet Website system is built based on the PFIP programming language and MySQL database management system.

Trang 13

GHI PONG 1: TONG QUAN

1.1 Dar VAn sE

Ngny nay khoa hgc c6ng nghQ tl6 di vdo mgi linh vuc cta doi s6ng x6 hOi.

Nhi6u linh vgc ch4m ph6t tri6n n6u kh6ng 6p dpng c6ng nghQ mcri,.vi v|y ?pdUng c6ng nghQ th6ng tin vio c6c nghiQp vp quin ly, kinh doanh ld di0u tat yeu.

ViQc 6p dUng c6ng nghQ th6ng tin d5 girip cdc ho4t dQng cta con ngudi trd n6n

Trong qu6 trinh ho4t dQng vi kinh doanh, mOt NH-KS kh6ng thti chi ti6n

cho thu6, ciic m6n 5n cho dtin c6c dcrn dat hing, vi c6c con s6 kh6ng cO ainn

vi li0n tqc thay d6i, nhu cAu kh6ch hang ngiy chng cao, ngdy nay viQc m-ua sim

cfing nhu thu6 mu6n ngay t4i nhi khOng cdn qu6 xa la D€ tl6p img nhu cdu cflng

nhu ph6t tri0n thi khdng th0 b6 qua linh v.uc kinh doanh th6ng qua mAng Internet

ddy ti€m n6ng.

Van de d{tra d tl6y ld cAn c6 mQt Website quan ly qud trinh ho4t dQng,

kinh doanh cira NH-KS, qu6ng c6o th6ng qua 6nh 3D, ti€p nhfln vi xri ly rlcrn il[t

Do d6, hQ th6ng "Website Qurtn U Nhd hdng - Khdch sgn" dugc t4o raitC gifp c6c NH-KS gini quy6t cic vdn de trOn.

LICH St.P cAt OUYET VAr.r sE

D6 c6 nhiOu hQ th6ng Website dugc c6c NH-KS xdy dUng vir dua vdo ho4t

.lr+ x6c trong c6c khdu xir lj, tinh kha.dunS vd mric rtQ thu hrit chua cao Vdn

d0 t6n t4i ld ldm sao d€ t4o ra mQt hQ th6ng Website qu6n l1i t6t c6 vC qu6 trinh

ho4t dQng cfing nhu kinh doanh cira NH-KS, thu htit sg quan tdm th6ng qua c6c

PHAM VI DE TAI

Oe tai nhim xdy dpg dugc mQt hQ th6ng Website c6 kh6 ndng quin lf

nhin vi6n, c6c s6n phAm kinh doanh, titip nhfln vd xir ly circ rlcrn ttflt h].ng qua

anh 3D s6ng dQng, ngodi ra cdn cung c6p c6c th6ng k0 quan tro.ng vdi qu6 trinhkinh doanh qua mAng cria NH-KS

C6c chric ning chffi cria hQ th6ng:

Quin lf nh0n viOn, qu6n lf phdng cho thu6, bhn dn, m6n 6n, dich vU

ca nhdt dinh

Ddng tin tric l6n Website th6ng qua giao dien thdn thiQn.

1.3

Trang 14

LuQnvdn t6t nghiQp:

- Cdc c6ng cg cAn thitit cho viQc quin lf.

Th6ng k0 b6o c6o theo ngdy, tuAn, th6ng vd n6m.

- Ngodi ra cdn c6.mQt sO tinh ndng nhu: binh chqn trang web, d6m luqt truy cflp,

tim ki6m s6n phAm.

1.4 HUONG GIAI QUYET

1.4.1 VC ty thuy6t

- Tim hi,5u quy trinh qu6n ly cria mQt NH-KS

Trang 15

cHr/oNG 2: C0 So lY rnuYEr

2.1 r6ruo euAN vE sol

2.1.1 Dinh nghia

SQL le c6ng cr,r sri dpng OC tO chric, quin.lli vd truy xu6t dt.liQu dugc

luu trfr trong cdc co sO dt liEu SQL lir mQt hQ th6ng ng6n ngir bao gdm tQp c6c

cdu lQnh sri dgng d€ tucrng t6c vdi co sd dt liQu quan hQ.

2.1.2 Cdc loqi ciu lQnh

- Thao tdc dfr liQu: SELECT, INSERT, UPDATE, TRUNCATE

- Dinh nghia dt liQu: CREATE TABLE, DROP TABLE, ALTER VIEW,

- Ei0u khi6n truy c{p: GRANT, REVOKE

- Lap trinh: DECLARE, OPEN, FETCH, CLOSE, EXECUTE

C6c cdu lQnh cria SQL cl6u dugc Uat eAu boi c6c tir lQnh, ld mQt tir kh6acho bitit chtic nlng cria cdu lQnh ching han (SELECT, DEIiETE, COMMIT, )

Sau tri lQnh le mQnh dC ctia c6c cdu lenh MOi mQt mQnh d0 trong cdu lQnh ctng

du-o c Uat OAu bcri mQt tu kh6a (ching h4n FROM, WHERE, )

Vi dp:

SELECT TEN_PHONG

FROM PHONG

WHERE MA_PHONG_'P_1'

2.1.3 Qui tic s& dgng t6n trong SQL

C6c d6i tuqng trong co sd dt liQu dpa tr€n SQL duqc x6c dinh th6ng qua

t6n cria dOi tuqng TOn oia cic dOi tuqng li duy nh6t trong m6i co s& dfr liQu.

trong ccy s0 dt liQu quan hQ th tOn bdng vi t6n cQt.

Trong c6c co sd dir liQu lcrn v6i nhi6u ngucri sir dpng, khi ta chi dfnh t6n

tri co s& dir liQu niy cho ph6p nhirng ngudi dtng kh6c nhau t4o ra nhirng bing

trDng tOn v6i nhau md kh6ng gdy ra xung dQt vA t6n N6u trong mQt cdu lQnh

SQL ta cAn chi d6n mQt b6ng do mQt nguoi drrg kh6c so hiru (hi6n nhi6n ln phniducvc ph6p) thi tOn ctra b6ng phii duqc vi6t sau t6n cria ngucri s& hiru vi ph0n

MQt sd eOi tuqng co sd dir liQu khdc (khung nhin, thri tgc, ham), viQc sri

dUng t6n cfing tuong tg nhu e6i vcri bing

Trang 16

LuQn vdn tiit nghiQp: Website qudn $ nhd bq49

kh4ch-{g!-Ta c6 th€ sir dUng t6n cQt mQt c6ch binh thuong trong cdc cdu lQnh SQL

c6ch nhau bOi d6u ch5m.

Vi dU: Vi dp minh ho4 cho viQc sir dUng t6n bing vh t6n cQt trong cdu lQnh SQL:

SELECT ma-phong,ten-phong,ten-loai-phong

FROM dbo.phong,dbo loai-phong

WHERE phong.ma-loai-phong = loai-phong.ma-loai-phong

2.1.4 MQt s6 kieu dO li6u trong SQL

Bdng 2.1- Cdc kiAu dfr liQu trong SQL

Char Ki6u chu6i v6i clQ dni c6 A-.,tlinh

Nchar Ki€u chu6i v6i rtO dni cO dinh, h6 trq UNICODE

Varchar Ki6u chu6i v6i 116 dii chinh xdc

Nvarchar Kii5u chu6i v6i rtO ddi chinh x6c h6 ffq UNICODE

Integer so neuyon c6 si6 tri tir -231 a6n z3l - t

Float SO thuc c6 siiltri tt -1.79E+308 d€n 1.79E+308

Real So thuc c6 giltri rt 3.4A8+ 38 d6n 3.40E + 38

Numeric Ki0u s6 voi dO chinh x6c cd dinh

Datetime Ki€u nedv eid (chinh x6c di5n phdn tram cria gi6v)

Bit Ki€u bit (c6 siltri 0 ho4c 1)

Money Ki€u tiAn tO

Image Dt liQu kitiu chu6i vcri itQ ddi ltu (tOi da 2,147,483,647 ki fit)

Varbinary Dfi liQu nhi phan vdi t10 dii chffi x6c (t6i da 8000 bytes)

2.1.5 Vai trd cia SQL

Bin thdn SQL kh6ng ph6i li mQt hQ quin tri co s0 dt liQu, n6 kh6ng thO

t6n tpi clQc lap SQL thyc sg ld mQt phAn cria hQ quan trf ccy s& dt liQu, n6 xu6thi.En trone c6c hQ qu6n tri co sd dO liQu vdi vai trb ng6n ngir vi li c6ng cp giao

ti6p gita nguoi sri dpng vd hQ quin tri co s& dfr liQu.

Trong hdu hiit c6c hQ quin tri co s& dii liQu quan hQ, SQL c6 nhtng vai trdnhu sau:

Trang 17

Ludnvdn t6t nghi€p: Website qudn $ nhd hdng khdch sqn

qua c6c trinh tiQn ich d€ gbi cdc y6u cdu duoi d4ng c6c cdu lenh SQL d0n co s&

d[ lieu vd nh{n ktit qui tri v€ tri co s0 dir liqu

trinh img dUng giao ti€p vdi co sd dfr liQu.

> SQL ld ng6n ngft qudn tri co sd dit li€u: Th6ng qua SQL, ngudi quan tri co s0

dir liQu c6 th€ quan ly dugc co s& dir ligu, ttfnh nghia circ c6u truc luu trfr dfr

> SQL ld ngbn ngit cho cdc h€ thiing khdcMchu (client/server): Trong c6c hQ ,i

th6ng co so dt li€u kh6ch/chti, SQL dugc sti dgng nhu ld c6ng cg d€ giao ti€pgiira c6c trinh img dUng phia m6y kh6ch vdi m6y chri co so dt liQu.

> SQL ld ng6n ngit truy cQp dir liQu ffAn Internet: Cho d6n nay, hAu h€t cdc mdy

chri Web cfrng nhu chc mby chri trOn Internet sri dpng SQL vdi vai trd ld ng6n

ngfi <t€ tucrng t5c voi dir lieu trong c6c co sd dt liQu.

> SQL ld ngbn ngit co so d{t liQu phdn tdn: D6i voi cdc hQ quin tri ccr s0 dt liQu

phan ti{n, m6i mQt he th6ng sir dpng SQL dC giao tiilp vor cdc hQ th6ng kh6c tr6n

2.2 rinn nrEu vE HE euAN TR! csDL MyseL

MySQL la he quin tri CSDl(database management System) dang

client/server, li hQ qunq tri go sO dtr liQu m6 ngu6n mo ph6 bi6n nh6t thi5 gioi vn

MySQL r6t thfch hgrp cho cdc img dUng c6c ffuy cap CSDL trOn Internet

MySQL c6 mQt si| ddc tinh sau:

) Cho ph6p qu6n tri mQt he CSDL lon (l€n d6n vii tega byte), c6 t6c elO xri ly dt

lieu nhanh d6p ung yOu cAu v0 thdi gian.

) Cho ph6p nhi6u nguoi c[ng khai th6c trong mQt thcri ttii5m A6i vcri mQt CSDL

) Ki6n ftric storage-engine cho ph6p c6c chuy6n gia co sd dfi lieu c6u hinh m6y

chri co s0 dt liQu MySQL tlac trung cho c6c img dgng ttac thi Di tmg dpng li

mQt he th6ng xri lf giao dlch t6c rlO cao hay website dung lugng l6n phpc vp

hang triQu yOu cAu m6i ngiy, MySQL c6 th6 d6p img khi n[ng xri ly nhirng ddih6i khat khe nh6t cria b6t ki he th6ng nlLo V6i c6c tiQn ich tii t6c rtQ cao, d{c biQt

b0 nhd caches, vd c6c co ch6 xri ly ndng cao khiic, MySQL dua ra tdt ch c6c vflkhf cAn phii c6 cho ciic hQ th6ng doanh nghiQp kh6 tinh ngiy nay.

> H6 trg trong viQc trii5n khai CSDL phin tdn vd ph6t tritin img dpng trOnInternet

Trang 18

Lugn vdn tiit nghiep: Website qudn ly nhd hdng khdch sgn

F Ngdy nay gan h6n vdi MySQL ld ng6n ngCr 16p trinh PHP nhu mQt bg d6i

2.2.1 C5u tr6c co s& dO ligu

trOn mi viQc quin tri co so dfr liQu c6 m6t s6 d{c di6m sau:

+ O€ Client khai th6c CSDL trudc hi5t phii thUc hi€n ttit nOi d6n Server quin tr!CSDL d6.

+ Chi thUc hiQn khai th6c vor cdc CSDL c6 t6n trong danh s6ch c6c CSDL mi

+ Kh6ng c6 c6c phucrng thric m& CSDL tr.uc ti6p tu t4p tin

+ Khi ila ktit nOl ai5n Seryer, Client chi thgc hiqn dugc quyen khai th6c theo quy

dinh de dfnh sEn trong CSDL (phto quye.r trong CSDL)

mQt co sd dft liQu c6 ft nh6t 2 t4p tin

2.2.2 Bing (Table)

Table (bdng dir liQu) li mQt thenh phAn co bin cria CSDL, mQt CSDL

du-o c tfriet te tir mQt ho{c nhi€u bing dt li€u, m6i bang dir lieu dugc c6u tnic tri

c6c hdng vd cQt dir liqu, m6i hAng dung m6 ti mQt d6i tuqrrg, v6n d6, sg kiQn,

c6 ctng ki€u (data type) Ngodi c6c hing, cQt bing cdn c6 c6c kh6a, 1i6n k6t,

Hinh 2.1 - Vi dat bdng trong MySQL

C6c thOng tin c6n quan tOm khi thi6t k6 mQt bing ld:

- Ki6u dU liQu trong b6ng.

Trang 19

LuQnvdn t6t nghiQp: Website qudn $ nhd hdng khdcT;g4

- Cic cQt, ki€u dir liQu tuong tmg (vd d9 dei n6u cAn rhi60

- CQt nio cho ph6p gi6 tri NULL (ld gi6 tri md phAn dfr liQu thuQc hing, cQt

x5c tlinh kl,6rg dugc gdn gi6 tri nio, vi vQy ndn} phAn ttr c6 ctng gi6 tri NULL

li kh6ng bing nhau).

- Gi6tr! ngAm dinh Ge gi6 rimi khi chua nhQp vho n6 nhfln gi6 tri ndy)

- Chi muc [Index], kh6a chinh, kh6a ngo4i

2.s cAc KHAr NIEM eHAN ricn vA THtEr KE H[ rn6xc

?og x6y dpg tr6n nhfrng kh6i niQm: thgc th6, mOi t<6t hgrp, thu6c tinh vd

mQt sd kh6i niQm li6n quan.

Kli hiQu:

.<tts utrc utE

Hinh 2.2 - Ki hiQu thtrc the

, ]u16i t<6t trgp gitra c6c thuc th6: li phAn tri trong m6 hinh tuolg img vdi mQt

sO m6i quan hQ giira c6c thgc th6 tham gia vio quan hQ d6 thuQc td chric trong

qu6 trinh md hinh h6a.

Vi ds:

mO hinh tucrng img vdi mQt tt{c tinh cria mQt lcrp d6i tuqng ho{c mQt m6i quan

hQ gifia c6c i16i tuqng thuQc t6 chric trong viic m6 hinh h6a.

Hinh 2.3 - Vt dat miii kAt hqp

Trang 20

LuQn vdn t6t nghiQp: Website qudn $ nhd hdngkh4ihlq"

vdo m6i k€t hqrp C6 giltri bing 0 ho[c 1.

Bdn sii tiii da:ln sO lAn t6i da md mQt thuc thi5 c6 th6 tham gia vdo mOi tethqrp C6 gi6 tri bing t ho{c n.

2.3.6 Kh6a

Kh6a crto thrgc th6: l(h6acta mdt thuc thO li m6t t\hu6c tinh holc m6t sO

thuQc tinh cria thtr! thi5, sao cho vdi m6i gia tri

"tu.aritrO iirn "ay,;6,i";

mQt vi chi mQt th€ hien ctra thuc th6.

Vi dp:

Hinh 2.6 - Vi du khod cila thqc th€

t{oAilos STT-I{D :-G_t-r\P

so_sEHn

.TIT-E 1:.{T

Trang 21

Ludn vdn t6t nghiQp: Website quan li nhd hdng khdch sgn

- Kho6 cria thyc th€ thuong ghi dAu tiOn trong danh s6ch c6c thuQc tinh vd dugc

Kh6a cfia mQt mat *At hqp: Kh6a ctra m6t m6i k6t hgp nhQn dugc bing

th6 hiQn ctra m6i k€t hqp d6.

- Kh6a cria mQt mOi trit hgp thucrng ghi du6i d4ng kCt hqp c6c thuQc tffi kh6a

Hinh 2.7 - Phu thu)c hdm giii hai thuc th€

hdm gitra thuc th6 ngutin va ttr,,rc mc Aicrr"tr,i;t.ht niu* 16.,ri,rru.irrA

x -i , a.

ngu6n il6i v6i m6i k0t hqrp d6 le (1, 1).

V( dg: HOA DON vd KHACH HANG

Hinh 2.8 - LiAn quan giiia phlt thuQc hdm voi bdn sii

- M6i HoA DON x6c dfnh duy nh6t m6t KHACH HANG

2.4 rim nrEu vE ruc6n NGO pHp

PHP la mQt ng6n ngfr lflp trinh kich bin hay mQt lopi m6 lOnh chir yiSu

dugc dungd,S ph6t tri6n c5c img dung vi6t cho mey chir, m6 ngudn mo, dtng cho

Trang 22

LuAn vdn tdt nghiQp: Website qudn U nhd hdng khdch sgn .

ph6 bi€n nhdt thO gidi

2.4.1 Mgt sO fieu d0u liQu duqc xiy d1rng sin

B6n ki6u th6ng thuong ld : boolean , interger, foating-point number

(float), string.

Hai ki6u phric t4p li : m6ng (arry) vd i16i tugng ld (object) Vd cu6i ctng

li hai kiOu d{t biQt : Resource vd Null Lo4i dir liQu cria bi0n th6ng thuongkh6ng dugc g6n boi ngudi lQp trrnJr mlL dugc quyi5t dinh tai thoi gian ch4y cria

PHP , php thQc vdo ngt cinh mi bi6n dugc dtng

- Boolean

DAy ld ki€u dcrn gi6n nh6t MQt ki€u boolean bi6u thi I gi|tri that N6 c6

tfre n True hay False Cri ph6p dC chi ilinh I gi|tri boolean, c6 th0 sri dung tu

kh6a True hay li False Ci hai di6u kh6ng phdn biet cht hoa hay chir thudng

Vi du:

$vietm=True; llgdngi6 tritrue cho bi(in $vietm

Chf y : -l dugc xem li True, gi6ng nhu c6c gi6 tri kh6c 0 Lh6c (kC c6 sO

Cf ph6p integer c6 thO dugc chi dinh trong co s6.10, co sd thpp lpc ph6n

hay ccr s6 bat phdn, t[y chgn di tru6c boi dAu - huy + n6u sri dpng v6i co s6 Uat

phdn, phii theo thri ty v6i 0 dung trudc, cbn d6i v6i sO thflp lpc phdn thi 0x

Kich thudc cta ki6u dtr liQu ndy li 32bit, vd PHP kh6ng h6 trq kieu

unsigned interger Ni5u chi dinh mOt s6 vugt qua biOn cria kii5u dU liQu integer,

n6 sE dugc xem nhu ki6u float Tucrng tu nhu vfy, khi thuc hiQn mQt ph6p to6n

, ,(.

mh k6t qu6 tr6 v€ li mQt s6 vuqt qua bi6n cta ki6u integer thi ki€u float sE dugc

tri v0.

Trang 23

Tuy nhiOn c6 mQt l6i trong PHP mi khdng ph6i bao gio diOu ndy ctng

dirng, nO ii6n quan d6n c5c sO 6m Ching hqn khi thUc hien -50000*$mi11ion, kiSt

gla sq h,429496728 Tuy nhi6n khi c6 hai toan tri diOu li s6 ducrng thi kh6ng c6

C6 the dugc chi dinh bing c6ch sri dgng I trong c6c cri ph5p sau:

Ld nhirng chu6i c6c ki t.u.

Trong PHP mQt ki tU cflng tucrng tp nhu 1 byte do d6 c6 chinh xdc 256 ki

Ming ledanh s6ch c6c phAn tri c6 ctng ki6u dt liQu M6ng c6 th6 lI m6ng

1 chi6u hay nhi0u chi6u

Trang 24

LuQnvdn t\t

"shieptWrbtit" q" ry

2.4.2 C6c tu kh6a

Bdng 2.2 - Mlt si| tir khod trong PHP

Abstract default Foreach Obiect sizeof unsafe

Bool louble Implicit Override string virtual

2.4.g.Hing vd Biiln

Gi6ng nhu trong to6n hgc, mQt h[ng s6 x6c tlinh mQt gi6t;ri duy nhAt th6ngqua t6n cria hing s6, trong Tin hgc cfing vQy MQt hing s6 x6c tlinh mQt gi6 tri

_ duy nh6t ffong todn bQ chucrng trinh Nguoi ta c6 th6 st dUng eiilffi ndy th6ng

" Tuong tU d6i v6i bi6n MQt bitin trong lQp rinh dugc sir dgng AC tuu trfr mQt

gi6 tri ndo d6 th6ng qua t6n bi6n Nguoi ta ggi n6 li bi6n vi n6 kh6ng nhu hang

sO (gi[ nguy6n gi6 trf trong toan bQ qu6 trinh chay chucrng trinh), nguoi ta c6 th6

thay d6i gi6 tri cfia biiSn s6 th6ng qua c6c ph6p gan.

D6 t4o di6u kiQn d6 dhng trong qu6 trinh phdn tich dt liQu, PHP quy ctfnh U6t ty tt ndo c6 d6u $ & tru6c dAu ln tOn cria bitin

Vi ds:

Quy t6c dAt t6n bi6n th mQt chu6i cdc ky tg chi bao g6m c6c chir s6, chtr c6i

(a 2) vd d6u g4ch dudi ( _ ) Va PHP quy dinh phdn biQt c6c bi6n chfr hoa vd

, MOt tli6m cdn luu y kh6c li kh6ng dugc dit t6n bi6n bat d6u bing c6c chir sO (0

Trang 25

Do quy dinh c6c chu6i ky tU c6 chria d6u $ o tru6c ld mOt tOn bi6n, nOn PHP

DC gdn gi6 tri cho cdc bitin, sri dung c6u lQnh gdrr nhu sau:

$t0n_bi€n = gi6 tric6n gdn.

Vi ds:

$nam-sinh=1980;

$ho_ten="NTP";

2.4.4 Lua ki6u vi 6p ki6u dO liQu

fdt ch c6c bit5n PHP i10u c6 ki6u dO liqu riOng Ki0u dir 1i0u cira bi6n sedugc ty dQng x6c dinh boi gi6 tri dat vdo bi6n

i ^ ^

mQt chu6i, PHP se tinh to6n chu6i nhu ld s6 Di6u ndy dugc bi6t d6n vdi t6n ggi

"chuy€n kiAu chudi (String conversion)", rfllc dt gi6 tri chu6i cria n6 c6 th6

kh6ng cAn ph6i thay d6i

+ Chi nhirng chu6i Uat AAu li mQt sdu c6c chir s6 N6u chu6i Uat aAu mQt gi6

tri sd hqp lQ, chuSi ndy se dugc x6c dinh nhu gi6 tri cta n6, trong truong hgp

kh6c n6 se tri vA 0 VO: chu6i "35 tu0i" sE dugc udc lugng 1A 35, nhrmg chu6i

"tu6i 35" se chi x6c dinh gi6 tri 0.

+ MQt chu6i se chi dugc x6c dlnh nhu ld mQt gi6 tri ki0u double n6u gi6 tri

ki6u double dugc miOu ti bao g6m todn b0 chu6i Chu6i "3.4","-4.2" se dugc

udc luqng nhu gi6 tri thUc 3.4 vi -4.2 N6u mQt kf qr kh6ng phii ld ky tU ki0u s6

thgc dugc dua vdo chu6i, gi6 tri cria chu6i il6 sC dugc udc lugng nhu ld mQt s6nguy6n Chu6i "3.4 dollar" sC thinh s5 nguyOn 3.

$a=11 .2lt $ald ki6u thUc

$a=(int)$d/ bdy gio, $ a li ki6u nguy6n, gi6 tri = 11.

$a= (double) $all bdy gio $a l4i trcr vd ki€u thUc = 11.0.

$S= (string)$a// $b h gi6 tri ki6u chudi =" 1 1".

Ngoii t&, chring ta cdn du-o c ph6p 6p ki6u (array) vi (object),(integer) tuurg ducng vdi (int); (fload) vd (real) tucrng duong viri (double)

2.4.5 Mgt s6 hdm tiQn ich

gi6 tri: "integer", "double", "string", "array", "object", "class", "unknown typg"

Vf dU: echo(gettype($name));

Trang 26

LuQn vdn t& nghiQp: Website qudn l'i nhd hdng khdch sgn

$ten-bien Ki€u dt 1i0u du-ry c vitit duoi d4ng mQt chu6i vd c6 th6 c6 mQt trong

khdng dugc d[t, gi6 tri false sC du-o c tri vd, cdn n6u thenh cdng n6 sC trA v€ gi6

settype($a,"integer"); l/bdy gid n6 th mQt sO nguy6n c6 gi6triT

mQt gi6 tri nio do hay chua Ntiu bi6n d6 dA c6 gi6 tri, him tri v0 true Trong

trucrng hqp ngucr c lpi, hlm tri vC gi6 tri false;

nh6 bi chi6m dung cria bi6n d6.

nhi0u nh6nh (case) Lenh re nh6nh ld mQt trong nhimg cdu lQnh quan treng nh6t

kiQn chi dinh ld dring.

- Trong PHP, lQnh re nh6nh c6 d4ng sau:

if (dieu kiQn) {

c6ng viQc cAn lim

Trang 27

- Nhtmg ni5u nhi6u hcrn mQt ddng lQnh, ta phii dua chring vdo cflp d6u ngoflc{ }:

if ($name=-"Sinh")

t

)

- Di€u kiQn cria lenh if ph6i ld mQt bi€u thric logic (boolean), c6 th€ ld t6ng

if ("false" )

if (($name-="sinh") && ($puts=="test"))

Doan lQnh tAn c6 thd vidt tuong duong voi:

- Cdu lqnh rE nh6nh dAy dri:

Ntiu bi€u thric di6u kien c6 ei6rifalse (sai), PHP cho ph6p chring ta chi dinh

Trang 28

- C0u 10nh switch: CAu lQnh nny se dugc sri dpng OC ti6m tra khi mu6n xem

true) vi vdng l{p for (x6c ilinh sO t6n lAp lai)

- Vdng 14p while:Vdng lap while li mQt d4ng vdng lflp don gian nh6t, cdu

trfc cira n6 g6n gi6ng nhu lQnh if:

while (dieu kien)

Trang 29

Ludnvdn 6t nghiQp: Website

- Vdng lflp do while: Vdng lflp niy gi6ng nhu vdng lflp while, nhung thay vi

ki€m tra di0u kiQn vdo hic dAu cria do4n lQnh cAn 14p, thi n6 14i ki6m tra gi6 tri

tli6u kien vio cu6i vbng lap DiAu niy c6 nghia li n6 lu6n lu6n thUc hiqn doan

lQnh cAn l{p ft nh6t mgt lAn:

do

{ Doqn (kh6i) cdu lQnh cAn lap

) while (rli€u kipn);

- Vdng l{p for: Vdng l{p for, c6 f nghia ln lflp vdi sd Dn dinh tru6c, c6 c6u

truc nhu sau:

for ( $bii5n = gi6-tri_dAu; $bitin < (hay q=) gi6-tri-k6t_thric; tang_bii5n_ili5m) {

Trang 30

echo ("Gi6 tri cria bi6n \$i li: ".$i);

)

2.4.7 Ming(Array)

Ld mQt danh s6ch c6c phAn tri c6 cing ki6u dir lieu Ming c6 th6 ld m6ngmQt chi6u hay nhi6u chi€u M6ng c6 2 thinh phAn li chi muc (key) vi gi6 tri.Chi mpc c6 th6 ld sO nguy6n ho{c ld chu6i C6 th€ khoi tpo ming bing c6c c6ch

Y Mdng m\t chiiu kdt hqp: chric ndng ctra n6 cfrng gi6ng nhu m6ng mQt chi6u c6

chi mgc, ngo4i tru viQc n6 c6 th6m mQt ming chi mgc dugc dung tl0 chi dinh

2.4.8.Todn tt}

To6n tu dugc ki hiQu bang mQt bi€u tugng dung dC thqc hiQn mQt henh

dQng Cdc ki6u dii liQu co b6n cria PHP nhu ki6u nguy6n h6 tro r6t nhi6u cdc todn

Trong ngOn.ngir PHP, d6u ngo{c tlyOc st dgng $C tlay AOi ttni tp xy lf,

di6u niyctng gi6ng trong tinh toan ttai s6 Khi d6 mu6n ki5t qu6 36 cho bi6n $a

c6 th6 viOt:

ga=(5+7)*3;

Trang 31

LuQn vdn ttit nghiQp: Website quan ly nhd hanS khdch sqn

Bdng 2.3 - Thu tU wu ti1n cdc phdp todn trong PHP

I Fhip t,":do s* [:aa ix) x"y f(x) a[x] x++ x-new typeaf

sizesf checked unrhscked

T16;

+ - I * ++x -x {T}x Trai

{j {liuru }re s > <: >= is T16i

5c, iaanr lrflu ==!= Fhsi

s Phel: t*an l*gir

Chfng ta c6 th6 sir dpng mQt s6 d6u chri thfch sau trong PHP:

ll ddng v6n b6n chf thfch (chi 6p dUng trOn mQt ddng)

/* Do4n vdn bin chri thich */ (nim trong cqp l* vh *i

Vi du:

<?php

echo("Xin chio c6c ban"); llHi}nthi ldi gi6i thiQu 16n mdn hinh

/* Hi6n thi bin so y6u lf lich

Mgt ham sE dugc x5c dinh boi tOn hdm vi c6c tham s6 d6u vio 1i0n quan

Chring ta c6 so dd sau:

ThamsO eAuvio 1 |

i

Trang 32

LuQn vdn tiit nghiQp: Website qudn t! nhd hdng khdch ssn

Tham sO dAu vdo 2 |

Tham sO Aiu vdo 3 | -> ten hdm > ktit qui tri v€ sau khi gqi him

Xdy dmg mQt him trong PHP: Cri ph6p cdi dpt mQt him c6 th6 dugc t6m

function ten_ham (thamsol, thamso2, , thamson)

{

ll do1n chuong trinh xri ly dfi li€u b6n trong him

return gia_tri;

)

Trang 33

LuQn vdn t1t nghiQp: Website qljan ti nhd hang khdch sqn

cHuoNG 3: NQI DUNG VA rEr OUA NGHIEN Ct/U

3.1 TET OUA DIEU TRA THU THAP THONG TIN

vu di d6i de phUc vp c6c phdng duo c thu6, ngoli ra cdn phii nam th6ng tin v€bdn An, vd m6n 6n it€ phpc vp kh6ch himg, th6ng tin nhdn vi6n, ho4t ctQng kinh

He th6ng quin tri c6 3 t16i tuqng t6c dQng: Admin, quin If, nhhn vi6n

nhu, hg tOn, ngdy sinh, dia chi, gi6i tinh U6i nhan viOn se c6 mQt chric vu tuthdi gian nio

Vt6i ptrOng se thuQc vdo mQt lo4i phdng nio d6, vd c6 c6c th6ng tin ccr bin

, x.

nhu gi6 mdi ngiy thu6, sO giudmg, tr4ng th6i

Khi kh6ch hdng dat phdng hay bdn 5n, m6n 6n th6ng qua mAng Internet

Phi6u d{t se dugc xri lli khi kh6ch hhng di5n x6c nhfln thdng tin d[t, qu6n ly

(hay admin) ld nguoi c6 quyiin xir ly c6c don dat hang N6u sau hai ngdy mdkh6ch hdng khdng dtfn x6c nhQn thi phi6u d[t sE bi tl6nh d6u (c6 tfr6 Ui hriy b6 do

ngucri qudn l1i hay admin) Ngohi ra quin ly (admin) c6 th€ xuSt h6a rlcrn khi

kh6ch hing yOu cdu.

Ntiu hai kh6ch hdng cung d{t mQt phdng, ctng ngiy d6n nhfin phdng, vi

phitiu dAt v6n cdn trong thoi gian cho ph6p (hai ngdy) thi kh6ch hang nio dAt ti€ntru6c sE dugc uu ti6n, niSu chua kh6ch hang ndo dAt ti€n tru6c thi ai d6n trudc sE

dugc uu ti6n nhfln phdng, cdn kh6ch hlng cdn lai se dugc b6o vh c6 th6 bi huf

phi6u d4t d6 Tuong tU d6i vdi kh6ch hdng rlpt bdn [n

HA"g ngay quan lf phii b6o c6o, th6ng kC vA c6c don dAt hang qua m4ng,

tinh hinh nhan vi6n

Trang 34

Ludnvdn t6t nghiQp:

9.2 GIAI PHAP PHAN TICH VA THIET KE CAC TU6 HiruTI

3.2.1 MO hinh quan niQm dii, liQu (MCD)

Ngày đăng: 04/05/2017, 15:26

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w