He Thong Thong Tin Ke Toan 4

download He Thong Thong Tin Ke Toan 4

of 53

  • date post

    10-Jul-2015
  • Category

    Documents

  • view

    162
  • download

    0

Embed Size (px)

Transcript of He Thong Thong Tin Ke Toan 4

TRNG I HC NHA TRANG KHOA K TON TI CHNH B MN KIM TON

BI GINGH THNG THNG TIN K TON 4 (ACCESS K TON)

Ging vin ging dy

ThS. Nguyn Thnh Cng Ng Xun Ban Bi Mnh Cng Th Ly Phm nh Tun

Lu hnh ni b

1

MC LC Phn 1: KHI QUT V MICROSOFT ACCESS _______________ 21. Chng trnh Access __________________________________________________2 2. Khi ng___________________________________________________________2 3. To mi tp Access ___________________________________________________3 4. Mi trng lm vic___________________________________________________4 5. M tp tn ti _____________________________________________________5 6. Thot khi Access ____________________________________________________5 Phn 2: XY DNG C S D LIU____________________________________6 1. Khi nim v c s d liu Access _______________________________________6 2. Lin kt cc bng d liu _______________________________________________9 Phn 3: _____________________________________________________________17 XY DNG CHNG TRNH K TON TRN MS ACCESS 1. t vn , gii thiu mc tiu chng trnh xy dng ______________________17 2. H thng d liu_____________________________________________________17 2.1. Bng dat_tblBDMTKTongHop ______________________________________17 2.2. Bng dat_tblBDMTK ______________________________________________18 2.3. Bng dat_KyKeToan_______________________________________________18 2.4. Bng dat_tblSoDauKy _____________________________________________19 2.5. Bng dat_tblNgiepVu ______________________________________________20 2.6. Bng dat_tblSoKTMay _____________________________________________22 2.7. Bng dat_tblCompanyInfo __________________________________________23 3. Xy dng mi quan h gia cc bng ____________________________________24 4. To Form khi ng v xy dng cc query c s __________________________24 4.1. To Form khi ng cho chng trnh _________________________________24 4.2. Xy dng cc query c s___________________________________________26 4.2.1. Query Qry_0_SoDuDK: _________________________________________26 4.2.2. Query QrySoKTMay_TenTKNoCo: ________________________________27 4.2.3. Query QrySoKTMay:____________________________________________27 4.2.4. Query QrySoKTMay_TKTH ______________________________________28 4.2.5. Query QryBDMTK: _____________________________________________29 5. Xy dng cc s sch k ton __________________________________________32 5.1. Bng tng hp chi ti 131: __________________________________________32 5.2. Bng tng hp chi tit TKxx: ________________________________________35 5.3. Nht k chung: ___________________________________________________36 5.4. S chi tit chi ph: _________________________________________________37 5.5. S Ci:__________________________________________________________39 5.6. Bng tng hp chi tit cc TK: _______________________________________41 5.7. Phiu thu: _______________________________________________________43 5.8. Phiu nhp xut kho:_______________________________________________46 BI TP NG DNG: ________________________________________________50 TI LIU THAM KHO: _____________________________________________52

2

Phn 1. KHI QUT V MICROSOFT ACCESS1. CHNG TRNH ACCESS 1.1 Tp cha Chng trnh Access Mi mt tp Chng trnh thng c mt ui qui nh, v d cc tp Chng trnh C c ui l .C, tp Chng trnh Pascal c ui l PAS, tp Chng trnh Foxpro c ui l .PRG.Mt tp Chng do Access to ra c ui l .MDB 1.2 Mt h Chng trnh do Access to ra (h Chng trnh Access) Chng trnh Access gi l mt Database (CSDL). Trong cc ngn ng truyn thng nh C, Pascal, Foxpro, mt h Chng trnh gm cc tp Chng trnh v cc tp d liu c t chc mt cch ring bit. Nhng trong Access ton b Chng trnh v d liu c cha trong mt tp duy nht c ui .MDB. nh vy thut ng h Chng trnh hay CSDL c hiu l t hp bao gm c Chng trnh v d liu. ngn gn nhiu khi ta gi l Chng trnh thay cho thut ng h Chng trnh. nh vy di y khi ni n Chng trnh hay h chng trnh hay CSDL th cng c ngha l mt h phn mm gm c Chng trnh v d liu do Access to ra. 2. KHI NG M lnh Start / Programs / Microsoft office/ Microsoft office access ca Window; Sau khi chn xong ta c mi trng access nh sau:

Sau chn File/ New hoc biu tng New trn mn hnh

3

Chn Blank Access database bt u to mt tp Access mi (to mi tp) Hoc Access database wizard, page, and project to mt CSDL theo mu c sn (khng trnh by trong gio trnh ny); Hoc file/ open m tp Access tn ti lm vic tip. 3. TO MI TP ACCESS Mt d n Access (Access project) l mt hoc nhiu tp Access nhm gii quyt mt cng vic ln no . Khun kh gio trnh ny ch trnh by nhng d n c 1 tp. Tp Access c phn m rng *.MDB (ngoi ra nhng tp c phn m rng *.DBE cng m c nhng ch c th thc thi ch khng chnh sa c cu trc). C 5 thnh phn chnh trn mt tp: Tables ni cha ton b cc bng d liu Queries ni cha ton b cc truy vn d liu c thit k; Forms ni cha cc mu giao din phn mm; Reports ni cha cc mu bo co c thit k; Macro ni cha cc Macro lnh phc v d n; Modules ni cha cc khai bo, cc th vin chng trnh con phc v d n. Thng thng mi tp Access cn phi lm vic trn tt c cc thnh phn trn. bt u to mt tp mi, chn mc Blank Access database, tip theo nhn OK, hp thoi sau xut hin yu cu chn ni (th mc) lu tr v t tn tp Chu trnh doanh thu:

4

Chn th mc trn a, ni s lu tp Chu trnh doanh thu

G tn tp cn lu

Hy chn ni lu tr hp Save in; g vo tn tp mc File Name; nhn ghi li thit lp. n y sn sng s dng tp Access va khai bo.

Creat

4. MI TRNG LM VIC Sau khi mt tp Access c m, mi trng lm vic trn Access xut hin vi nhng thnh phn nh sau:

H thng thc n (menu) v cc thanh cng c (Toolbar)- ni thc hin cc lnh khi cn

Ca s tp Access ang lm vic bao gm 7 phn chnh: Tables, Queries, Forms, Reports, Pages, Macros v Modules. lm vic trn tng phn ny trong cc chng tip theo.

5

5. M TP TN TI Mi tp Access phi to mi duy nht mt ln, c m ra lm vic v ghi li trong nhng ln tip theo. m mt tp Access tn ti lm vic, lm nh sau: Bc 1: T mi trng Access gi thc n:File | Open (hoc nhn nt trn thanh cng c), hp thoi Open xut hin:

Bc 2: Tm n tp Access cn m trn hp thoi Open bng cch: Tm n th mc ni cha tp Access cn m hp Look in; Tip theo chn tp Access cn m trn danh sch v nhn nt Open hoc Enter. n y ca mn hnh lm vic Access vi tp va m xut hin tip tc lm vic. 6. THOT KHI ACCESS Khi khng lm vic vi Access, hy ra lnh thot khi Access bng mt trong cc cch: M thc n File | Exit; Nhn t hp phm nng Alt + F4; Hoc s dng nt Close trn ca s Access ang m.

6

Phn 2. XY DNG C S D LIUXy dng CSDL l cng vic quan trng u tin trong ton b qui trnh pht trin mt ng dng trn Access. Mt CSDL c thit k v xy dng tt s l nhng thun li, nhng t tin u tin bc vo mt qui trnh pht trin ng dng; nhng tri li s l mt thm ha cho d n ang pht trin: s thng xuyn gp phi nhng kh khn phi chnh sa li CSDL v ti t hn, d n c th phi thc hin li t u do vic thit k CSDL qu km. Trong phn ny s trnh by cc khi nim cng nh cc k nng c th tip cn v xy dng c cc h CSDL trn Acces, c th l: To cu trc cc bng d liu; Thit lp thuc tnh LookUp; Thit lp quan h v cc thuc tnh m bo ton vn d liu; Nhp d liu cho CSDL; c bit l qui trnh xy dng mt CSDL Access. 1. Cc khi nim v CSDL Access 1.1. CSDL Access CSDL Access l mt i tng bao gm tp hp cc bng d liu, cc kt ni gia cc bng c thit k mt cch ph hp phc v lu tr d liu cho mt ng dng qun l d liu no . V d: CSDL Chu trnh doanh thu ti cng ty KIJ bao gm tp hp cc bng d liu: VANPHONG, NHANVIEN, KHACHHANG, HANGHOA, HOADON, CHITIETHOADON, c kt ni vi nhau mt cch ph hp phc v lu tr d liu cho ng dng qun l hc sinh mt trng hc. Ton b cu trc CSDL qun l hc sinh trn Access c m t nh sau:

7

1.2 Bng d liu Bng d liu (Tables) l mt phn quan trng nht ca CSDL; L ni lu tr nhng d liu tc nghip cho ng dng. Mt CSDL c th c rt nhiu bng, cc bng phi c thit k sao cho c th lu tr c y d liu cn thit, m bo gim ti a tnh trng gy d tha d liu (d tha d liu c hiu n gin l tnh trng lu tr nhng d liu khng cn thit trn mt s bng. Tc hi ca hin tng ny s gy: sai lch d liu tc nghip v lm tng dung lng d liu khng cn thit); gim ti a dung lng CSDL c th, ng thi to mi trng lm vic thun li cho vic pht trin ng dng trong cc bc tip theo. Mt bng d liu trn Access bao gm cc thnh phn: Tn bng, cc trng d liu, trng kho, tp hp cc thuc tnh cn thit cho mi trng d liu v tp hp cc bn ghi. M t mt bng d liu trong trng thi Datasheet (nhp, xem, s d liu):

Mi dng l mt bn ghi (record) Bn ghi c bit cui cng gi l EOF

Mi ct l mt trng d liu (field)

M t mt bng d liu trong trng thi Design view (ang thit k cu trc):

8

Tp hp cc thuc tnh ca trng d liu

Tn bng Mi bng c mt tn gi. Tn bng thng c t sau khi to xong cu trc ca bng, tuy nhin cng c th i li tn bng trn ca s Database nh i tn tp d liu trn ca s Windows Explorer. Khng nn s dng du cch (Space), cc k t c bit hoc ch ting Vit c du trong tn bng. Trng d liu (Field) Mi ct d liu ca bng s tng ng vi mt trng d liu. Mi trng d liu s c mt tn gi v tp hp cc thuc tnh miu t trng d liu v d nh: kiu d liu, trng kho, ln, nh dng, .. Mi trng d liu phi c nh kiu d liu. Trong Access, trng d liu c th nhn mt trong cc kiu d liu sau: TT 1 2 3 4 5 6 7 8 9 Kiu d liu Number Autonumber Text Yes/No Date/time Currentcy Memo Hyperlink Ole Objects ln Tu thuc bin c th 4 bytes Tu thuc di xu 1 bytes 8 bytes Sing Lu tr S: s thc, s nguyn theo nhiu kiu S nguyn t ng c nh s Xu k t Kiu logic Lu tr ngy, gi Lu tr d liu km k hiu tin t Tu thuc gi tr kiu ghi nh Tu thuc di xu Lu tr cc siu lin kt Tu thuc kiu d m thanh, hnh nh, ho. liu

9

Bn ghi (Record) Mi dng d liu ca bng c gi mt bn ghi. Mi bng c mt con tr bn ghi. Con tr bn ghi ang nm bn ghi no, ngi dng c th sa c d liu bn ghi . c bit, bn ghi trng cui cng ca mi bng c gi EOF. Trng kho (Primary key) Trng kho c tc dng phn bit gi tr cc bn ghi trong cng mt bng vi nhau. Trng kho c th ch 01 trng, cng c th c to t tp hp nhiu trng (gi b trng kho). V d: Bng BANGVANPHONG ca CSDL chu trnh doanh thu, trng kho l msvanphong. V mi vn phng c th nhiu trng c gi tr ht nhau, nhng m vn phng th duy nht. Bng NHANVIEN trng msnhanvien s l trng kha v khng th tn ti 2 nhn vin o trong bng ny trng msnhanvien 2. Lin kt c