ÿþ<html> <head><title>#5(6)2#0@ H2+1*7-</title></head> <body bgcolor="#ffffff" link=#0000ff text=#a00f00> <img src="logo.jpg"> <hr> <table width=100% border=0> <tr><td><img src="tril.gif"></td> <center> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos.html">3#0</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos1.html">(6)21 +2</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos2.html">(6)2'2!@GDDI</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos3.html">(6)2#0@4!</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos4.html">--A#0C+!H</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos6.html">41I</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos7.html">3#8#1)2</a></font></center></td> </center> </tr> </table> <table width=100% border=2> <tr><td bgcolor="#ddffdd "><font face="MS SANS SERIF" color="#0000ff" size=0><b>5. 2#12#0....</b></font> </td> </tr></table> <hr> <pre> <font face="MS SANS SERIF"> <a href ="#menu">sorce B#A#!- menu.prg</a> <a href ="#initial">sorce B#A#!- initial.prg</a> <a href ="#mainjob">sorce B#A#!- mainjob.prg</a> <a href ="#apenjob">sorce B#A#!- apenjob.prg</a> <a href ="#editjob">sorce B#A#!- editjob.prg</a> <a href ="#deljob">sorce B#A#!- deljob.prg </a> <a href ="#rports">sorce B#A#!- rports.prg</a> </font> </pre> <a name = "menu"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- menu.prg</b></font> <pre> <font face="MS SANS SERIF"> #include"inkey.ch" *-- @5"B#A#!B" #0@7- 8I@7H- *-- B#A#!@!-#L6+1 0#4+2# *22-!4'@-#L *-- #+1*4111054 '4"2%1"B" *-- *H'-@!9@5"#1I*8I2"@!7H- 03/27/00 *-- 2+%1 Set Procedure to "Mainjob.prg" Set Procedure to "Apenjob.prg" Set Procedure to "Editjob.prg" Set Procedure to "Delejob.prg" Set Procedure to "Rports.prg" Set Procedure to "Allfunc.prg" Set procedure to "initial.prg" Set delimiters on set delimiters to "[]" Set Intensity On Set date format to "mm/dd/yy" Set Epoch to 1960 Set Escape Off Set cursor on Do Check_Password Restore From MemFile Additive Armain = 5 ; Arcm = Array(Armain) Arcm[1] = [ 2+%1 ] Arcm[2] = [ #1#8] Arcm[3] = [ #2"2 ] Arcm[4] = [ *#8 ] Arcm[5] = [ #0 ] Ars1 = 5 ; Arc1 = Array(Ars1) Arc1[1] = [1.1 @ H2+1*7- ] Arc1[2] = [1.2 7+1*7- ] Arc1[3] = [1.3 "@%42#@ H2 ] Arc1[4] = [1.4 #1*!2 4C+!H ] Arc1[5] = [1.5 #1+1*7-C+!H ] Ars2 = 6; Arc2 = Array(Ars2) Arc2[1] = [2.1 @4H!I-!9%  ] Arc2[2] = [2.2 AIDI-!9%  ] Arc2[3] = [2.3 %I-!9%  ] Arc2[4] = [2.4 #1#8-1#2B1* ] Arc2[5] = [2.5 Browse Data  ] Arc2[6] = [2.6 Sort Data  ] Ars3 = 7 ; Arc3 = Array(Ars3) Arc3[1]= [3.1 +1*7-  ] Arc3[2]= [3.2 *!2 4  ] Arc3[3]= [3.3 12  ] Arc3[4]= [3.4 @ H2-7+1*7-  ] Arc3[5]= [3.5 #2"#1-#2"H2"  ] Arc3[6]= [3.7 View Report  ] Arc3[7]= [3.6 Reports  ] Ars4 = 4 ; Arc4 = Array(Ars4) Arc4[1]= [4.1 H2"@4@7-  ] Arc4[2]= [4.2 +1 2)5  ] Arc4[3]= [4.3 "-#2"#1  ] Arc4[4]= [4.4 "-#2"H2"  ] Ars5 = 9 ; Arc5 = Array(Ars5) Arc5[1]= [5.1 Help ] Arc5[2]= [5.2 Screen Saver  ] Arc5[3]= [5.3 Security  ] Arc5[4]= [5.4 Log File  ] Arc5[5]= [5.5 Change Color  ] Arc5[6]= [5.6 Dos Shell ] Arc5[7]= [5.7 Restore Default] Arc5[8]= [5.8 Source Code  ] Arc5[9]= [5.9 Quit ] //----------------------------// Opt := Save_Opt := 1 Step1 := Step2 := 1 Toplmt = Opt Bottomlmt = Armain Allsub = 5 _Employee_Id = Space(5) filename = Space(8) input_id = "" progname := {"*!2 4","+1*7-","#0@ "," 7H-+1*7-","9IAH","12"} //-------- main file --------// File1 = "Member" File2 = "Books" File3 = "Name" File4 = "Types" File5 = "Author" File6 = "Employee" //----------------------------// Do screenmenu Do writemenu Do while lastkey() # 27 @0,27 Say time() color("+B/W") Inkey(0.2) If lastkey() # 0 Do Case Case lastkey() = 27 If Opt < 10 set color to 7/8 Cls ; quit Else If Opt >= 10 .and. Opt <= 10+Ars1 Opt = 1 Else If Opt >= 20 .and. Opt <= 20+Ars2 Opt = 2 Else If Opt >= 30 .and. Opt <= 30+Ars3 Opt = 3 Else If Opt >=40 .and. Opt <= 40+ars4 Opt = 4 Else if Opt >= 50 .and. Opt <= 50+ars5 Opt = 5 endif Endif Endif Endif Endif EndIf Case lastkey() = 4 // Key right // If Opt < 10 If Opt = 5 Opt = 1 Else Do pressDown EndIf Else If (Opt-mod(Opt,10))/10 = Allsub Opt = 11 Else Opt = (Opt-mod(Opt,10))+11 EndIf EndIf Case lastkey() = 19 If Opt < 10 If Opt = 1 Opt = 5 Else Do pressup EndIf Else // stArt at 11 to up // If (Opt-mod(Opt,10))/10 = 1 Opt = Allsub*10+1 Else Opt = (Opt-mod(Opt,10))-9 EndIf EndIf Case lastkey() = 24 Do pressdown Case lastkey() = 5 Do pressup Case lastkey() = 13 Do Case Case Opt = 1 Opt = 11 Case Opt = 2 Opt = 21 Case Opt = 3 Opt = 31 Case Opt = 4 Opt = 41 Case Opt = 5 Opt = 51 Case Opt >= 11 .and. Opt <= 10+Ars1 Save Screen to page1 Do Case Case Opt = 11 ; Do Renting Case Opt = 12 ; Do returning Case Opt = 13 ; Do CancelRnt Case Opt = 14 ; Do Apend_Mem Case Opt = 15 ; Sele 1 ; Use Books index Books Sele 2 ; Use Name index Name Sele 3 ; Use Types index Types Sele 4 ; Use Author index Author Do Apend_Books Endcase Restore screen From page1 Case Opt >=21 .and. Opt<=20+Ars2 Save Screen to page1 Do Case Case Opt = 21 ; Do Apend_Data Case Opt = 22 ; Do Upd_data Case Opt = 23 ; Do Del_Data Case Opt = 24 ; Do Upd_Bonus Case Opt = 25 ; Do BrwsData Case Opt = 26 EndCase Restore screen From page1 Case Opt >=31 .and. Opt<=30+Ars3 Save Screen to page1 Do Case Case Opt >= 31 .And. Opt <= 35 Do ReportSele With Opt Case Opt = 36 ; Do Viewreport Case Opt = 37 ; Do DbReport Endcase Restore Screen From page1 Case Opt >=41 .and. Opt<=40+Ars4 Save Screen to page1 Do Case Case Opt = 41 Case Opt = 42 Case Opt = 43 Case Opt = 44 Endcase Restore Screen From page1 Case Opt >=51 .and. Opt<=50+Ars5 Save Screen to page1 Do Case Case Opt = 51 Case Opt = 52 Case Opt = 53 Case Opt = 54 Case Opt = 55 Do ChangCol Case Opt = 56 Set color to "w/n" cls Set Cursor on Run command.com Case Opt = 57 Case Opt = 58 ; Do Sourceprg Case Opt = 59 ; Quit Endcase Restore Screen From page1 Endcase Endcase Do Case Case Opt < 10 Toplmt=1 ; Bottomlmt= Armain Case Opt >=11 .and. Opt<=10+Ars1 Toplmt=11 ; Bottomlmt=10+Ars1 Case Opt>=21 .and. Opt<=20+Ars2 Toplmt=21 ; Bottomlmt=20+Ars2 Case Opt>=31 .and. Opt<=30+Ars3 Toplmt=31 ; Bottomlmt=30+Ars3 Case Opt>=41 .and. Opt<=40+Ars4 Toplmt=41 ; Bottomlmt=40+Ars4 Case Opt>=51 .and. Opt<=50+Ars5 Toplmt=51 ; Bottomlmt=50+Ars5 Endcase Do Writemenu Keyboard Chr(0) Inkey() EndIf EndDo //----------------------- Control Section --------------------------// Procedure Pressdown If opt = bottomlmt opt = toplmt else opt++ EndIf Return Procedure Pressup If opt = toplmt opt = bottomlmt else opt-- EndIf Return //-------------------- End of Control section ------------------------// //----------------------- Writing Menu Section -------------------------// Procedure Writemenu Length = 0 Do Boxes_Scrn With 1,0,23,79,"W/N" Do Boxes_Line With 1,0,3,79,_Stscrncol for j=1 to armain @2,(j-1)*12+3 say arcm[j] Color(_StMntxt) next i = 0 do case case (opt-mod(opt,10))/10 = 1 ; Tempar = Arc1 ; i = ars1 ; Length = 20 case (opt-mod(opt,10))/10 = 2 ; Tempar = Arc2 ; i = ars2 ; Length = 23 case (opt-mod(opt,10))/10 = 3 ; Tempar = Arc3 ; i = ars3 ; Length = 23 case (opt-mod(opt,10))/10 = 4 ; Tempar = Arc4 ; i = ars4 ; Length = 24 case (opt-mod(opt,10))/10 = 5 ; Tempar = Arc5 ; i = ars5 ; Length = 19 endcase Col1 := (((opt-mod(opt,10))/10)-1)*12+2 Do Boxes_Scrn With 4,Col1+1,i+5,Col1+Length+2,_StShadcol Dispbox(3,Col1,i+4,Col1+Length+1,""$"9$ ",_Stscrncol) For j = 1 to i @ j+3,(((opt-mod(opt,10))/10)-1)*12+3 say Tempar[j] Color(_StMntxt) Next i = 4 set color to 14/6 If opt>10 @i+mod(opt,10)-1,(((opt-mod(opt,10))/10)-1)*12+3 say tempar[mod(opt,10)] Color(_StMseltxt) @2,(((opt-mod(opt,10))/10)-1)*12+3 say arcm[(opt-mod(opt,10))/10] Color(_StMseltxt) else @2,(mod(opt,10)-1)*12+3 say arcm[mod(opt,10)] Color(_StMseltxt) EndIf Return //------------------------- End Of Writing menu Section --------------// //--------------------------- Screen Section -------------------------// Procedure Screenmenu //--- 1'+1*7-5HA*8 set color to "/W" @0,0 Clear to 0,79 Setcolor("+B/W") @0,0 say "DOKFA Book Shop" // @0,65 say "Ver " @0,65 say "'15H " + DtoC(date()) // @0,69 say "10.01" color ("+r/w") //---- 1'+1*7-A%H2*8 set color to "/W" @24,0 Clear to 24,79 Setcolor("R/W") @24,59 Say "By Pratuang Fungfuang" Return Procedure Shadow Parameter X1,Y1,X2,Y2,fColor,bColor setcolor(bColor) @x1+1,y1+1 Clear to x2+1,y2+1 setcolor(fColor) @x1,y1 Clear to x2,y2 Return </pre> <hr> <a name = "initial"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- initial.prg</b></font> <pre> <font face="MS SANS SERIF"> Procedure Check_Password Set Status Off Set cursor on Check = .F. Nin := Count := 1 Passar = array(10) Set color to "w+/n" cls Do While Check = .F. .And. Count < 4 Use Password.dbf Nin = 1 _User = Space(15) _Pass = Space(10) Set color to "w+/n" @ 8,14 clear to 15,62 @ 8,14 to 15,62 Double Set color to "r/n" @ 10,15 say " Password protection " Set color to "bg+/n" @ 12,20 say "Your login name :" get _User Color "gr+/n" @ 13,20 say "Your password :" Get _Pass Color "R/R" Read Locate for Alltrim(_User) = Alltrim(Uname) if Found() if Alltrim(_Pass) = Alltrim(Pword) Check = .T. @14,20 say "Password is correct " Else @14,20 say "Password is Incorrect" Inkey(3) Count ++ Endif Else @14,20 say "Password is Incorrect" Inkey(3) Count ++ Endif If Count = 4 .and. Check = .F. cls @ 12,26 to 14,61 double Set color to "r/n" @13,30 say "#0041'@-C 3 '425" for i = 1 to 3 @13,48 say ltrim(str(4-i)) @13,56+i say"." Tone(1000) inkey(1) next Setcolor("W/N") Set cursor on cls quit endif Enddo close all Return </font> </pre> <hr> <a name = "mainjob"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- mainjob.prg</b></font> <pre> <font face="MS SANS SERIF"> ***************** * Rent Books * ***************** Proc renting local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() set procedure to "allfunc.prg" Set intensity on Set Escape on *-- #02(1'A# _Employee_id := "10004" _N_Rent_Id := Space(7) // *->for rent.dbf , rentdeta(il).dbf _Member_Id := Space(5) // *-> for member.dbf _Date_to_Rent := Date() _Date_to_Retu := Date() + 7 _Line := 10 _No := 0 _Total_Pay := " " *-- #02(AI!2I-!9%5HC ICB#A#!@ H2+1*7- Close Database Sele 1 ; Use Rent ; Copy Struct to Temp Sele 2 ; Use Rentdeta; Copy Struct to Temped Sele 3 ; Use Member Index Member ; Reindex Sele 4 ; Use Books Index Books ; Reindex Sele 5 ; Use Name Index Name ; Reindex Sele 6 ; Use Types Sele 7 ; Use Income Sele 8 ; Use Temp Sele 9 ; Use Temped *-- @#4H!B#A#! Begin -------------------------------------------------------* *- 1.@5"+I2-@ H2 Do Paintscreen Makescreen(1,0,23,79,1,"W+/B") Shw_Status(" Enter = @%7-+#7-A*  ESC = @!7H-@ H2@*#G+#7-"@%4#2"2#","N/W") Setcolor("W+/B") @ 2,8 Say "#+1*12 [ ]" @ 2,22 Say _Employee_Id Color("W+/R") @ Row()+1,8 Say "'15H@ H2 [ ]" @ Row()+1,8 Say "#+1*2#@ H2 [ ]" @ Row()+1,8 Say "#+1**!2 4 [ ]" @ Row(),34 Say " 7H--*8% [ ]" L_Cross(Row()+1,1,78,"R+/B") @ Row(),8 Say "#+1*+1*7- [ ]" L_Cross(Row()+1,1,78,"R+/B") @ Row(),8 Say "NO. #+1* 7H-+1*7- H2@ H2/'1" @ Row()+1,8 Say "--- -------- ------------------------------- ---------" *----------------------------------------------------------------------------------* Setcolor("/B") @ Row()+1,7 clear to 20,72 *----------------------------------------------------------------------------------* //-- 7I5H*3+#14!L#2"%0@-5"-+1*7-5H@ H2DC2#C I2#4 --// *----------------------------------------------------------------------------------* L_Cross(21,1,78,"R+/B") @ Row(),8 Say "#'!+1*7-5H@ H2 [ ] @%H! #'!H2@ H2 [ ].00 2" Color("GR+/B") *-- AI'15H!2@ H2 @3,22 Say str(Day(Date())) + " " + cMonth(Date()) + str(Year(Date())) color("BG+/R") *-- 2.3+#+1*@ H2--------------------------------------------------------* Sele Rent If Reccount() <= 0 _N_Rent_Id = "1000001" Else Goto Bottom _N_Rent_Id = Ltrim(Str(Val(Rent->Rentid)+1)) Endif @4,22 Say _N_Rent_Id color("BG+/R") *- #'*-I-!9%*!2 4 Setcolor("GR+/R") @ 5,22 Get _Member_Id Valid ChkID(_Member_Id,"Member",{[Memid],[Memna]},"",5,46) Color("GR+/R") Read If Lastkey() = 27 Close Database select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return Endif Shw_Status(" ESC = --","N/W") findlreturn(_Member_Id) Shw_Status(" Enter = @%7-+#7-A*  ESC = @!7H-@ H2@*#G+#7-"@%4#2"2#","N/W") *----------------------------------------------------------------------------------* Sele Temp Append Blank Replace Temp->Rentid with _N_Rent_Id ,; Temp->Memid with _Member_Id ,; Temp->Rentdate with Date() ,; Temp->Empid with _Employee_Id,; Temp->Rntstatus with .T. *--+!2"@+8 *20 .t. 7-"1!5+1*7-5H9@ H2D-"9H "17D!H+! @%5H"@G.F. *-- GH-@!7H-3+1*7-!27+!A%I' 6H@ GDI2D%L@ H2A%0@ H2%0@-5" *----------------------------------------------------------------------------------* Do While .t. Sele Books _Book_Id := Space(8) // *-> for books.dbf _Book_Name := " " _Rnt_price := " " _No++ _Line++ clear gets @7,22 Get _Book_Id Valid Selebook(7,30,17,70,_Book_Id) color("GR+/R") Read If Lastkey() =27 Exit Endif IF _No > 10 scrt = SaveScreen(12,2,20,78) RestScreen(11,2,19,78,scrt) oldcolr := Setcolor() _Line = 20 Setcolor("/B") @ 20,7 Clear To 20,72 Setcolor(oldcolr) EndIF *-- +2H2@ H2 Seek _Book_Id If found() _Rnt_price := Books->Rntprice _Total_pay = Ltrim(Str( Val(_Total_pay) + Val(_Rnt_price) )) *-- @%5H"*20+1*7- 2 .f.("1D!H9@ H2) @G .t.(9@ H2DA%I') Replace Books->status with .t. Endif *-- +2 7H-+1*7- Sele Name Seek Substr(_Book_Id,2,4) If Found() _Book_Name := Name->name Else Msgbox("D!H *. 7H-5I") Loop Endif @_Line,8 Say Ltrim(str(_No)) color("W+/B") @_Line,13 Say _Book_Id color("W+/B") @_Line,23 Say _Book_Name color("W+/B") @_Line,63 Say _Rnt_price Pict "9999" color("W+/B") @22,30 Say Padr(Ltrim(Str(_No)),3) Color("W+/R") @22,64 Say Padr(_Total_pay,6) Color("W+/R") *-- @-2+1*7-@%H!5H@ H2D@!7H-5I5IC*HTemp-D%L@ H2%0@-5"D'IH- Sele Temped Append Blank Replace Temped->Rentid With _N_Rent_Id ,; Temped->Bkid with _Book_Id,; Temped->RntStatus With .T. *-- +!2"@+8 .T. +!2"6'H2+1*7-@%H!5I3%19@ H2D EndDo *-- *4I*8#2"2#@ H2@7H-22#esc--!2%21 +#7---!2@!7H-@ H2+1*7- *-- -A%I' I-@-2 _No !2@ G@#20'H2C-A#5H@I2!2%9@ H2 _No0@G 1 *-- I2!52#@ H2+1*7--"H2I-" 1 @%H!_NoI-!5H2@4H!@G 2 @#262!'H20 *-- 1.16#2"2#@ H2 @#2016GH-@!7H-!52#@ H2+1*7--"H2I-" 1 @%H! *-- 2."@%4#2"2#1I+! @%5H"*20+1*7-%1-"H2@4! If _No >= 2 Saveoption := {} Saveoption := {"1.16#2"2#@ H2","2.D!H16"} Setcolor("W/R") Save_Opt := Alertnew("+1*7-9@ H2D "+Ltrim(Str(_No-1))+" @%H!",Saveoption,"W+/W") Do Case Case Save_Opt = 1 *-- 16#2"2#@ H2%AI!@ H2A%0@ H2%0@-5" Shw_Status("3%116#2"2#@ H2","W+/R") Sele Rent Append Blank Replace Rent->Rentid with Temp->Rentid,; Rent->Memid with Temp->Memid ,; Rent->Rentdate with Temp->Rentdate,; Rent->Rntstatus with Temp->Rntstatus,; Rent->Empid with Temp->Empid Sele Temped For _No = 1 to Reccount() Goto _No Sele Rentdeta Append Blank Replace Rentdeta->Rentid with Temped->Rentid,; Rentdeta->Bkid with Temped->Bkid,; Rentdeta->Rntstatus with Temped->Rntstatus Sele Temped Next _No Case Save_Opt = 2 Shw_Status("3%1"@%4#2"2#@ H2","W+/R") Sele Temped Goto Top correct_id = Array(reccount()) i := 1 Do while !eof() correct_id[i] = Temped->Bkid i++ skip Enddo close database Use books index books for i = 1 to len(correct_id) Sele books goto top Seek correct_id[i] Replace Books->Status with .F. next Endcase Endif Close Database select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return ********************* * Cancel Rent Books * ********************* Procedure CancelRnt *-- 1.@G+12- 7I5H32@4! *5@4!D'IH- local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() *-- #02(1'A# _N_Rent_Id := Space(7) // *->for rent.dbf , rentdeta(il).dbf _Member_Id := Space(5) // *-> for member.dbf _Date_to_Rent := Date() _Date_to_Retu := Date() + 7 _Line := 10 _No := 0 *-- 2. #02(AI!2I-!9%5HC ICB#A#!@ H2+1*7- Close Database Sele 1 ; Use Rent ; Copy Struct to Temp Sele 2 ; Use Rentdeta; Copy Struct to Temped Sele 3 ; Use Member Index Member ; Reindex Sele 4 ; Use Books Index Books ; Reindex Sele 5 ; Use Name Index Name ; Reindex * Sele 6 ; Use Memdebt // D!HC I *-- @#4H!B#A#! Begin -------------------------------------------------------* *- 3.@5"+I2-"@%4 Do Paintscreen Makescreen(1,0,23,79,1,"W+/B") Shw_Status(" Enter = @%7-+#7-A*  ESC = --22#"@%42#7+1*7-","N/W") Setcolor("W+/B") @2,8 Say "'15H [ ]" @3,8 Say "#+1**!2 4 [ ] 7H--*8% [ ]" Color("W+/B") @4,8 Say "I2 3#0 [ ] ." Color("W+/B") L_Cross(5,1,78,"R+/B") @6,5 Say "%31 #+1*@ H2 #+1*  *. 7H-+1*7- '15@ H2" Color("W+/B") @7,5 Say "---- ------- -------- ------------------------- ------" Color("W+/B") L_Cross(19,1,78,"R+/B") @2,22 Say PADC(str(Day(Date())) + " " + cMonth(Date()) + str(Year(Date())),18) color("G+/R") *-- 4. #1I-!9%*!2 4 @ 3,22 Get _Member_Id Valid ChkID(_Member_Id,"Member",{[Memid],[Memna]},"",3,42) Color("G+/R") Read If Lastkey() = 27 Close Database select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return Endif Setcolor("/R") @8,5 clear to 18,75 Shw_Status(" Enter = @%7-+#7-A*  ESC = --22#"@%42#7+1*7-","N/W") workscreen := Savescreen(8,5,18,75) Do While .T. // %9#1+1*7- DetailAr := {} detail := " " CanOpt := 0 ShwBookAr := nRecar := {} *-- D#1#8AI!@ H2A%0@ H2%0@-5"H- Fnd_Rnt_bk() // @ G@#G-#L5HD!H!52#@ H2+1*7- Sel_Can_Bk(DetailAr,_Member_Id) arraychoice := array(len(DetailAr)) *-- <#+1*@ H2!'15H@ H2~+!2"@%@#G-#L##+1*+1*7-$ 7H-+1*7-> For j = 1 to len(DetailAr) Detail = DetailAr[j] _ShowRntid = Substr(Detail,1,7) _ShowBkid = Substr(Detail,At("#",Detail)+1,( At("$",Detail)-(At("#",Detail)+1) )) _ShowName = Padr(Substr(Detail,At("$",Detail)+1),25) _ShowDRnt = Substr(Detail,At("!",Detail)+1,8) Arraychoice[j] = PadR(Alltrim(Str(j)),2) + " " + _ShowRntid + " " + _ShowBkid+ " " + _ShowName + " " + _ShowDRnt + " " Next j Setcolor("W/R") CanOpt := Achoice(8,5,18,75,Arraychoice) Do Case Case CanOpt > 0 nrecno := Substr(DetailAr[CanOpt],At("~",DetailAr[CanOpt])+1,( At("#",DetailAr[CanOpt])-(At("~",DetailAr[CanOpt])+1) )) nworkarea1 := Select() U_rnt(val(nrecno)) _ShowBkid = Substr(DetailAr[CanOpt],At("#",DetailAr[CanOpt])+1,( At("$",DetailAr[CanOpt])-(At("#",DetailAr[CanOpt])+1) )) Sele Books Seek _ShowBkid If Found() Replace Books->Status with .f. Endif Select(nworkarea1) Case CanOpt <= 0 Exit Endcase restscreen(8,5,18,75,workscreen) Enddo Close Database // Set Escape off select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return ***************** * Return Books * ***************** Procedure Returning *-- B#A#!2#7+1*7--*!2 4 @!7H-I-+!2"@%*!2 4A%I' B#A#!032# *-- 3#+1*DI+2'H2*!2 45IDII2H2@ H2+1*7-D'I+#7-D!H I2I2 *-- @G3'@4@H2D# 21IG3#+1**!2 4DI+2CAI!CAI!@ H2'H2 *-- *!2 45I!5#+1*@ H2C(#2"2#C) 5H"1D!HDI3 *-- +1*7-!27G0D3#+1*+1*7-2AI!@ H2%0@-5"#I-!1I+2 7H- *-- +1*7-2AI! 7H-!2I'" #'!6DI9'H2+1*7-AH%0@%H!I-@*5"H2#1 *-- @G3'@4@H2D# *-- 1.@G+12- 7I5H32@4! *5@4!D'IH- local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() Set intensity on Set Escape on *-- #02(1'A# _Employee_id := "10004" _N_Rent_Id := Space(7) // *->for rent.dbf , rentdeta(il).dbf _Member_Id := Space(5) // *-> for member.dbf _Date_to_Rent := Date() _Date_to_Retu := Date() + 7 _Line := 10 _No := 0 _SumRtn := 0 _Kachao_pay := "0" _Oldpay := "0" _Total_Pay := "0" *-- 2. #02(AI!2I-!9%5HC ICB#A#!@ H2+1*7- Close Database Sele 1 ; Use Rent ; Copy Struct to Temp Sele 2 ; Use Rentdeta; Copy Struct to Temped Sele 3 ; Use Member Index Member ; Reindex Sele 4 ; Use Books Index Books ; Reindex Sele 5 ; Use Name Index Name ; Reindex * Sele 6 ; Use Memdebt // D!HC I *-- @#4H!B#A#! Begin -------------------------------------------------------* *- 3.@5"+I2-@ H2 Do Paintscreen Makescreen(1,0,23,79,1,"W+/B") Shw_Status(" Enter = @%7-+#7-A*  ESC = @!7H-7@*#G+#7---22#7","N/W") Setcolor("W+/B") @2,8 Say "#+1*12 [ ] '15H7 [ ]" Color("W+/B") @3,8 Say "#+1**!2 4 [ ] 7H--*8% [ ]" Color("W+/B") @4,8 Say "I2 3#0 [ ] ." Color("W+/B") L_Cross(5,1,78,"R+/B") @6,5 Say "%31 #+1*@ H2 #+1*  *. 7H-+1*7- '15@ H2 H2@ H2" Color("W+/B") @7,5 Say "--- ------- -------- --------------------------- -------- -----" Color("W+/B") L_Cross(19,1,78,"R+/B") @20,3 Say "#'!+1*7-I2*H @%H! *H7 @%H! #'!H2#1 ." Color("W+/B") @21,49 Say "' H2@ H2I2 ." Color("W+/B") @22,49 Say "#'! H2"1I+! ." Color("W+/B") @21,48 Say "{" Color("R+/B") @21,52 say "}" Color("R+/B") @22,48 Say "{" Color("R+/B") @22,52 say "}" Color("R+/B") @2,22 Say _Employee_id Color("G+/R") @2,42 Say PADC(str(Day(Date())) + " " + cMonth(Date()) + str(Year(Date())),18) color("G+/R") *-- 4. #1I-!9%*!2 4 @ 3,22 Get _Member_Id Valid ChkID(_Member_Id,"Member",{[Memid],[Memna]},"",3,42) Color("G+/R") Read If Lastkey() = 27 Close Database select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return Endif *-- 5. #'*-+5II2 3#0-*!2 4 Use Memdebt Goto Top Locate For Memdebt->Memid = _Member_Id .and. VAL(Memdebt->Debting) > 0 If Found() _Oldpay := Memdebt->Debting Else _Oldpay := "-NONE-" Endif @4,22 Say PADL(Alltrim(_Oldpay)+".00",6) Color("G+/R") Setcolor("/R") @8,5 clear to 18,75 workscreen := Savescreen(8,5,18,75) Do While .T. // %9#1+1*7- DetailAr := {} Rentid_Ar:= {} //--> rent id array detail := " " RntOpt := 0 ShwBookAr := nRecar := {} *-- D#1#8AI!@ H2A%0@ H2%0@-5"H- Upd_Rtn_Bk() Sel_Rnt_Bk(DetailAr,_Member_Id) arraychoice := array(len(DetailAr)) *-- <#+1*@ H2!'15H@ H2~+!2"@%@#G-#L##+1*+1*7-$ 7H-+1*7-> For j = 1 to len(DetailAr) Detail = DetailAr[j] rprice = " " _ShowRnid = Substr(Detail,1,7) _ShowBkid = Substr(Detail,At("#",Detail)+1,( At("$",Detail)-(At("#",Detail)+1) )) _ShowName = Padr(Substr(Detail,At("$",Detail)+1),25) _ShowDRnt = Substr(Detail,At("!",Detail)+1,8) _Numdate = 0 If Date() >= ctod(_ShowDRnt) If Date() = ctod(_ShowDRnt) ; _Numdate = 1 ; Endif If Date() > ctod(_ShowDRnt) ; _NumDate = Date()-CtoD(_ShowDRnt) ; Endif Sele Books Seek _ShowBkid If found() rprice = Books->Rntprice Endif _Kachao = Alltrim(Str( _Numdate * Val(rPrice) )) +".00" Else _Kachao = "0.00" Endif Arraychoice[j] = PadL(Alltrim(Str(j)),2) + " " + _ShowRnid + " " + _ShowBkid+ " " + _ShowName + " " + _ShowDRnt + " " + PadL(_Kachao,6) Next j If _Oldpay = "-NONE-" _Oldpay = "0" Endif _Total_Pay := Alltrim(Str(Val(_Kachao_Pay)+Val(_Oldpay))) @20,21 Say Padl(Alltrim(Str(Len(Arraychoice))),3) Color("G+/R") @20,38 Say Padl(Alltrim(Str(_SumRtn)),3) color("G+/R") @20,68 Say Padl(Alltrim(_Kachao_Pay),3)+".00" Color("G+/R") @21,68 Say Padl(Alltrim(_Oldpay)+".00",6) Color("G+/R") @22,68 Say Padl(Alltrim(_Total_Pay),3)+".00" Color("G+/R") Setcolor("W/R") RntOpt := Achoice(8,5,18,75,Arraychoice) Do Case Case RntOpt > 0 nrecno := Substr(DetailAr[RntOpt],At("~",DetailAr[RntOpt])+1,( At("#",DetailAr[RntOpt])-(At("~",DetailAr[RntOpt])+1) )) _SumRtn ++ _Kachao := Substr(Arraychoice[RntOpt],-6,3) _Kachao_Pay := Alltrim(Str(Val(_Kachao_Pay)+Val(_Kachao))) _Total_Pay := Alltrim(Str(Val(_Kachao_Pay)+Val(_Oldpay))) nworkarea1 := Select() Upd_status(val(nrecno)) _ShowBkid = Substr(DetailAr[RntOpt],At("#",DetailAr[RntOpt])+1,( At("$",DetailAr[RntOpt])-(At("#",DetailAr[RntOpt])+1) )) Sele Books Seek _ShowBkid If Found() Replace Books->Status with .f. Endif Select(nworkarea1) Case RntOpt <= 0 Exit Endcase restscreen(8,5,18,75,workscreen) Enddo *-- @*#GA%I'I2!5H2#1C+I@GG@G*4#1D!H1I28A"H@%" If Val(_Total_Pay) > 0 If(Getmoney("H2#1A%0@4I2 3#0",_Total_Pay)) *-- I2H2"@4@5K"'1I@%" Use Income Go Top Locate For Income->Date = Date() .and. Income->Incid = "04" If Found() Replace Income->Incnet With Ltrim(Str(Val(Income->Incnet)+Val(_Total_Pay))) Else Append Blank Replace Income->Incid With "04",Income->Date With Date(),; Income->Incnet With Alltrim(Str(Val(_Total_Pay))) Endif *-- #1#8AI!+5II2 3#0-*!2 4 C+I@G 0 2 Sele Memdebt Goto Top Locate For Memdebt->Memid = _Member_Id If Found() Replace Memdebt->debting with "0" Endif *-- H2#11+5I#'!1DI@H21 3'@45HI-H2"1I+! *-- _Kachao_Pay + _Oldpay = _Total_Pay Else Sele Memdebt goto top Locate For memdebt->Memid = _Member_Id If Found() Replace Memdebt->debting with _Kachao_Pay Else Append Blank Replace Memdebt->Memid with _Member_Id Replace Memdebt->debting with _Kachao_Pay Endif Endif Endif Close Database // Set Escape off select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return </font> </pre> <hr> <a name = "apenjob"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- apenjob.prg</b></font> <pre> <font face="MS SANS SERIF"> #include "inkey.ch" Procedure Apend_Data //-- @4H!I-!9% --// local i ,AchOpt := 1 local text := "@4H!" Set Escape on set cursor on Close Database Set Wrap On Do Boxes_Scrn With 6,44,14,73,"N+/N" Do Boxes_Line With 5,43,13,72,"G/R" for i = 1 to Len(progname) *-- progname @G1'A#!22menu.prg --* @i+6,45 Prompt Ltrim(Str(i))+". "+text+"I-!9%"+progname[i] next i Setcolor("W+/R") @6,45 Say "I-2# ..." Setcolor("G/R") Menu to AchOpt Do Case Case AchOpt = 1 Do Apend_Mem Case AchOpt >= 2 .and. AchOpt <= 5 Sele 1 ; Use Books index Books ; Reindex Sele 2 ; Use Name index Name ; Reindex Sele 3 ; Use Types index Types ; Reindex Sele 4 ; Use Author index Author ; Reindex Do Case Case AchOpt = 2 Do Apend_Book Case AchOpt = 3 Do Apend_Type Case AchOpt = 4 Do Apend_Name Case AchOpt = 5 Do Apend_Authr Endcase Case AchOpt = 6 Do Apend_Emp Endcase Close Database Return * Procedure Apend_Mem local oldworkarea := select() local oldcolor := setcolor() local oldscreen := savescreen(0,0,24,79) set escape on Sele 1 ; Use Income Sele 2 ; Use Begwork Sele 3 ; use Member Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,11,19,74,"N+/N" Do Boxes_Line With 5,10,18,73,"N+/W" @ 6,30 Say " @4H!I-!9%*!2 4" Color("B/W") L_Cross(7,11,72,"N/W") L_Cross(16,11,72,"N/W") Do Memdetail With 8,13,"B/W" Me_screen := Savescreen(5,10,19,70) Do While .T. _Memid = space(5) _Memna = space(20) _Memsex = space(1) _Memage = 0 _Memadd = space(40) _Memtel = space(11) _Memstart = Date() _Memstop = Ltrim(str(month(Date())))+Alltrim("/")+Ltrim(str(Day(Date())))+Alltrim("/")+Ltrim(str(Year(Date())+1)) Asking = 0 Shw_Status(" Esc I2I-2#--22#@4H!*!2 4","R/W") Setcolor("B/W") Goto Bottom _Memid = Alltrim(Str(Val(Member->Memid)+1)) @ 8,32 Say _Memid Color("GR/B") @ 9,32 Get _Memna Color("GR/B") @ 10,32 Get _Memsex Pict "!X" Valid _Memsex $ "MF" color("GR/B") @ 11,32 Get _Memage Pict "@B" Color("GR/B") @ 12,32 Get _Memadd Color("GR/B") @ 13,32 Get _Memtel Pict "999-999999X" Color("GR/B") @ 14,32 Say _Memstart Color("GR/B") @ 15,32 Say CtoD(_Memstop) Color("GR/B") Read If lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif Endif If New_Save(17,13,"B/W,W+/R") Append Blank replace Memid with _Memid replace Memna with _Memna replace Memsex with Upper(_Memsex) replace Memage with _Memage replace Memadd with _Memadd replace Memtel with _Memtel replace Memstart with _Memstart Replace Memstop with CtoD(_Memstop) Save Screen to Page2 Sele Begwork GetMoney("H2*!1#*!2 4",Begwork->Memberpay) Sele Income Go Top Locate For Income->Date = Date() .and. Income->Incid = "01" If Found() Replace Income->Incnet With Ltrim(Str(Val(Income->Incnet)+Val(Begwork->Memberpay))) Else Append Blank Replace Income->Incid With "01",Income->Date With Date(),; Income->Incnet With Ltrim(Str(Val(Income->Incnet)+Val(Begwork->Memberpay))) Endif EndIf Sele Member Restscreen(5,10,19,70,Me_screen) EndDo select(oldworkarea) setcolor(oldcolor) restscreen(0,0,24,79,oldscreen) Return * Procedure Apend_Book //-- %0@5" +#7- @4H!I-!9%+1*7- --// local oldworkarea := select() local oldcolor := setcolor() local oldscreen := savescreen(0,0,24,79) Set escape on Set Cursor on Sele 5 ; Use Exp_deta Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 6,4,17,75,"N+/N" Do Boxes_Line With 5,3,16,74,"R/B" @6,35 Say "%0@5"+1*7-C+!H" Color("G+/B") L_Cross(7,4,73,"N/B") L_Cross(14,4,73,"N/B") @8,10 Say "'15H%0@5" [ ]" Color("W+/B") @row()+1,10 Say "#08#+1*#0@  [ ] [ ]" Color("W+/B") @row()+1,10 Say "#+1* 7H-+1*7- [ ] [ ]" Color("W+/B") @row()+1,10 Say "#+1*C+!H5H3+ [ ]" Color("W+/B") @row()+1,10 Say "#22+1*7- [ ] 2" Color("W+/B") @row()+1,10 Say "H2@ H2 [ ] 2" Color("W+/B") Bkregis_Scr := Savescreen(0,0,24,79) Do while .T. _Bkid = Space(8) nType = Space(1) nName = Space(4) nNo = Space(3) _Bkdate = Date() _Bkprice := _Rntprice := Space(3) Tmp := space(3) Asking := 0 Shw_Status("B#I-#+1*#0@ .. @4H!#0@ C+!HF2.. @%7-I-!9%Enter.. --ESC..", "N/W") @8,30 say _Bkdate color("R+/N") *-- 3+ hotkey *3+#1@4H!#0@  *Set key -1 to Apend_Type // Sele Types @9,30 Get nType Pict "@9" ; valid Chkid(nType,"Types",{[Typeid],[Typename]},"",9,39) color("W+/R") read if lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif endif // Sele name Shw_Status("B#I-#+1* 7H-.. @4H! 7H-C+!HF2.. @%7-I-!9%Enter.. --ESC..", "N/W") @10,30 Get nName Pict "@9" valid Chkid(nName,"Name",{[Nameid],[Name]},"",10,39) color("W+/R") read if lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif endif Sele Books Set Filter to Substr((Books->Bkid),1,5) = (nType+nName) Goto Bottom nNo := Ltrim(str(val(books->bkid)+1)) nNo := "000"+nNo nNo := Substr(nNo,-3,3) _Bkid := nType+nName+nNo @11,30 Say _Bkid color("W+/R") Shw_Status("B#I-#22+1*7-.. I2--ESC..", "N/W") @12,30 Get _Bkprice Pict "999" Valid !Empty(_Bkprice) color("W+/R") read _Rntprice := CalRprice(nType,Val(_Bkprice)) Shw_Status("H2*2!2#AID-1#2H2@ H2DI.. AHI2--ESC.. I2I-2#16I-!9% Enter", "N/W") @13,30 Get _Rntprice Pict "999" Valid !Empty(_Rntprice) color("W+/R") read if lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif endif If New_Save(15,10,"GR+/B,W+/R") Sele Books Append Blank Replace Books->Bkid With _Bkid,Books->Bkdate With _BkDate,; Books->Bkprice With _Bkprice,; Books->Rntprice With _Rntprice,; Books->Status With .F. Sele Exp_deta Append Blank Replace Exp_deta->Expid With "01",Exp_deta->Expdate with _Bkdate,; Exp_deta->Expnet With Exp_deta->Expnet+Val(Alltrim(_Bkprice)) Endif restscreen(0,0,24,79,Bkregis_Scr) EndDo select(oldworkarea) setcolor(oldcolor) restscreen(0,0,24,79,oldscreen) Set Cursor Off Return * Procedure Apend_Type local oldworkarea := select() local oldcolor := setcolor() local oldscreen := savescreen(0,0,24,79) local Ty_Screen Select Types Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 6,9,13,63,"N+/N" Do Boxes_Line With 5,8,12,62,"R/W" Asking = 0 _Typeid = Space(1) Setcolor("GR/G") Do TypeDetail With 8,19,"R/W" @6,21 Say " @4H!I-!9%#0@ +1*7-" Color "GR+/B" L_Cross(7,9,61,"N/W") L_Cross(10,9,61,"N/W") Ty_Screen := savescreen(5,8,13,63) Do While .T. If Reccount() > 0 Goto Bottom _Typeid = Ltrim(str(Val(Types->Typeid)+1)) else _Typeid = "1" Endif _Typename = Space(20) Shw_Status("I-I-!9%#0@ +1*7-.. --22#@4H!#0@  Esc..","N/W") @8 ,35 Say _Typeid Color("R+/B") @9 ,35 Get _Typename Valid !Empty(_Typename) Color("GR/B") Read If lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif Else If New_Save(11,11,"Gr/W,W+/R") Append Blank Replace Types->Typeid With _Typeid,; Types->Typename With _Typename EndIf EndIf restscreen(5,8,13,63,Ty_Screen) Enddo select(oldworkarea) setcolor(oldcolor) restscreen(0,0,24,79,oldscreen) Return * Procedure Apend_Name local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Na_Screen _Authrid = Space(3) Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 6,10,15,70,"N+/N" Do Boxes_Line With 5,9,14,69,"R/W" Do Namedetail With 8,12,"GR/W" @6,30 Say " @4H!I-!9% 7H-+1*7-" Color("B/W") L_Cross(7,10,68,"N/W") L_Cross(12,10,68,"N/W") Na_Screen := savescreen(5,9,15,70) Do While .T. Sele name Goto Bottom _Nameid = Ltrim(Str(Val(Name->Nameid)+1)) _Nametxt = Space(30) _AuthorId = Space(3) _Authorname = Space(15) Shw_Status("I-I-!9% 7H-+1*7-.. --22#@4H! 7H-+1*7- Esc..","N/W") @10,28 Say " " Color("+B/G") @11,28 Say " " Color("B/G") @8,28 Get _Nameid Pict "9999" Color("B/G") @9,28 Get _Nametxt Valid !Empty(_Nametxt) Color("B/G") read If Lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif Endif Sele Author Setcolor("B/G") @10,28 Get _Authorid Pict "999" Valid Chkid(_Authorid,"Author",{[Authrid],[Authrname]},"",11,28) color("B/G") Read If Lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif EndIf If New_Save(13,12,"Gr/W,W+/R") Sele Name Append Blank Replace Name->Nameid With _Nameid ,Name->Name With _Nametxt,; Name->Authrid With _AuthorId Endif restscreen(5,9,15,70,Na_Screen) Enddo select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Procedure Apend_Authr local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local auscreen Sele Author _AuthrId = Space(3) Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 6,10,13,70,"N+/N" Do Boxes_Line With 5,9,12,69,"R/W" Setcolor("R/G") @6,20 Say " @4H!I-!9%9IAH" L_Cross(7,10,68,"N/W") L_Cross(10,10,68,"N/W") Do AuthrDetail With 8,19,"R/W" auscreen := Savescreen(5,9,12,70) Do While .T. _AuthrName = Space(25) if Reccount() > 0 Go Bottom _AuthrId = Ltrim(Str(Val(Author->Authrid)+1)) Else _AuthrId = "101" Endif Shw_Status("I-I-!9%9IAH+1*7-.. --22#@4H!9IAH+1*7- Esc..","N/W") @8,35 Say _AuthrId Color("R/B") @9,35 Get _AuthrName Valid !Empty(_AuthrName) Color("R/B") Read If Lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif Endif If New_Save(11,12,"Gr/W,W+/R") Append Blank Replace Author->Authrid With _AuthrId , Author->Authrname With Alltrim(_AuthrName) EndIf Restscreen(5,9,12,70,auscreen) Enddo select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Procedure Apend_Emp local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Em_screen set escape on Use Employee Asking = 0 Do Boxes_Scrn With 1,0,24,79,"W/N" Do Boxes_Scrn With 6,10,18,70,"N+/N" Do Boxes_Line With 5,9,17,69,"R/W" @6,30 Say " @4H!I-!9%12" Color("B/W") Do Empdetail With 8,18,"B/W" L_Cross(7 ,10,68,"N/W") L_Cross(15,10,68,"N/W") Em_screen := Savescreen(5,9,18,70) Do While .T. _Empid = space(5) _Empna = space(30) _Empsex = space(1) _Empadd = space(30) _Emptel = space(11) _Salary = 0 _Empstart = Date() If Reccount() > 0 Go bottom _Empid = Alltrim(Str(Val(Empid)+1)) Else _Empid = "10001" Endif @ 8 ,35 Say _Empid color("R/B") @ 9 ,35 Get _Empna valid _Empna != nil color("R/B") @ 10,35 Get _Empsex Pict "!X" Valid _Empsex $ "MF" color("R/B") @ 11,35 Get _Empadd color("R/B") @ 12,35 Get _Emptel Pict "999-999999X" color("R/B") @ 13,35 Get _Salary pict "99999.99" color("R/B") @ 14,35 Say _Empstart color("R/B") Read If Lastkey() = 27 If CancelAsk("--B#A#!B"D!H16") exit Else Loop Endif Endif If New_Save(16,12,"Gr/W,W+/R") Append Blank replace Empid with _Empid replace Empna with _Empna replace Empsex with Upper(_Empsex) replace Empadd with _Empadd replace Emptel with _Emptel replace Salary with _Salary replace Empstart with _Empstart Endif restscreen(5,9,18,70,Em_screen) Enddo select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return </font> </pre> <hr> <a name = "editjob"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- editjob.prg</b></font> <pre> <font face="MS SANS SERIF"> #include "inkey.ch" Procedure Upd_Data //-- AIDI-!9% --// local i := 1 local text := "AID" Set Wrap On Do Boxes_Scrn With 6,44,14,73,"N+/N" Do Boxes_Line With 5,43,13,72,"G/R" for i = 1 to Len(progname) *-- progname @G1'A#!22menu.prg --* @i+6,45 Prompt Ltrim(Str(i))+". "+text+"I-!9%"+progname[i] next i Setcolor("W+/R") @6,45 Say "I-2# ..." Setcolor("G/R") Menu to UchOpt Do Case Case UchOpt = 1 Do Upd_Mem Case UchOpt = 2 Do Upd_Book Case UchOpt = 3 Do Upd_Type Case UchOpt = 4 Do Upd_Name Case UchOpt = 5 Do Upd_Authr Case UchOpt = 6 Do Upd_Emp Endcase Return * func deling() delete pack return Proc Upd_Mem local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Me_screen , rec , upd_status , Ask // set delimiters off set key -2 to deling set escape on rec := 1 upd_status := .f. del_status := .f. close database Sele 1 ; Use Member index Member ; Sort on Memid to Temp Select 2 ; Use Temp index Temp Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,11,19,70,"N+/N" Do Boxes_Line With 5,10,18,69,"N+/W" @ 5,30 Say " AIDI-!9%*!2 4" Color("R/B") Shw_Status(" Esc I2I-2#--22#AID.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Memdetail With 7,13,"B/W" L_Cross(16,11,68,"N/W") Me_screen := Savescreen(5,10,19,70) Do While .t. Goto rec @ 17,13 Say "AID5H : " color("B/W") @ 17,32 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG/N") @ 7,32 Say temp->Memid Color("BG+/N") @ 8,32 Get temp->Memna Valid !Empty(Temp->Memna) Color("BG/R") @ 9,32 Get temp->Memsex Pict "@A" ; valid Upper(temp->Memsex) = "M" .or. Upper(temp->Memsex) = "F" color("BG/R") @ 10,32 Get temp->Memage Pict "@B" Color("BG/R") @ 11,32 Get temp->Memadd Color("BG/R") @ 12,32 Get temp->Memtel Color("BG/R") @ 13,32 Get temp->Memstart Color("BG/R") @ 14,32 Get temp->Memstop Color("BG/R") Read If Updated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @17,11 clear to 17,68 If new_save(17,13,"B/W,W+/R") copy to Member Endif Endif exit Endif rec := CurRec() Restscreen(5,10,19,70,Me_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Upd_Book local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Bk_screen , rec , upd_status , Ask , name // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Books index Books ; Sort On Bkid To Temp Sele 2 ; Use Name index Name Sele 3 ; Use Temp Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,15,16,68,"N+/N" Do Boxes_Line With 5,14,15,67,"N+/W" @ 5,30 Say " AIDI-!9%+1*7-" Color("R/B") Shw_Status(" Esc I2I-2#--22#AID.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Bookdetail With 7,17,"B/W" L_Cross(13,15,66,"N/W") Bk_screen := Savescreen(5,14,16,68) Do While .t. Goto rec @ 14,17 Say "AID5H : " color("B/W") @ 14,34 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7 ,34 Say Temp->Bkid Color "BG+/N" Sele 2 Seek Substr(Temp->Bkid,2,4) If Found() Name = Name->Name Endif Sele 3 @ 8,34 Say Alltrim(Name) Color("BG+/N") @ 9,34 Get Temp->Bkdate Color("BG/R") @ 10,34 Get Temp->Bkprice Color("BG/R") @ 11,34 Get Temp->Rntprice Color("BG/R") @ 12,34 Get Temp->Status Color("BG/R") Read If Updated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @14,17 clear to 14,65 If new_save(14,17,"B/W,W+/R") copy to Books Endif Endif exit Endif rec := CurRec() Restscreen(5,14,16,68,Bk_screen) EndDo select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Upd_Type local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Ty_screen , rec , upd_status , Ask // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Types index Types; Sort On Typeid To Temp Sele 2 ; Use Temp Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 7,11,12,70,"N+/N" Do Boxes_Line With 6,10,11,69,"R/W" @ 6,25 Say " AIDI-!9%#0@ +1*7-" Color("R/B") Shw_Status(" Esc I2I-2#--22#AID.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do TypeDetail With 7,19,"B/W" L_Cross(9,11,68,"N/W") Ty_screen := Savescreen(6,10,12,70) Do While .t. Goto rec @ 10,19 Say "AID5H : " color("B/W") @ 10,35 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7,35 Say temp->Typeid Color("BG+/N") @ 8,35 Get temp->TypeName Color("BG/R") Read If Updated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @10,19 clear to 10,68 If new_save(10,19,"B/W,W+/R") copy to Types Endif Endif exit Endif rec := CurRec() Restscreen(6,10,12,70,Ty_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Upd_Name local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Na_screen , rec , upd_status , Ask , authrname // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Name index Name ; Sort On Nameid To Temp Sele 2 ; Use Author index Author Sele 3 ; Use Temp Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 7,15,14,70,"N+/N" Do Boxes_Line With 6,14,13,69,"R/W" @ 6,30 Say " AIDI-!9% 7H-+1*7-" Color("R/B") Shw_Status(" Esc I2I-2#--22#AID.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Namedetail With 7,19,"B/W" L_Cross(11,15,68,"N/W") Na_screen := Savescreen(6,14,14,70) Do While .t. Goto rec @ 12,19 Say "AID5H : " color("B/W") @ 12,35 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7,35 Get temp->Nameid Color("BG+/N") @ 8,35 Get temp->Name Color("BG/R") @ 9,35 Get temp->Authrid Color("BG/R") Sele 2 Seek temp->Authrid If Found() authrname := Author->Authrname Else authrname := "+29IAH#+1*5ID!H" Endif Sele 3 @10,35 Say " " color("/N") @10,35 Say authrname Color("BG+/N") Read If Updated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @12,19 clear to 12,68 If new_save(12,19,"B/W,W+/R") copy to Name Endif Endif exit Endif rec := CurRec() Restscreen(6,14,14,70,Na_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Upd_Authr local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local At_screen , rec , upd_status , Ask // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Author index Author ; Sort On Nameid To Temp Sele 2 ; Use Temp Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 7,15,13,70,"N+/N" Do Boxes_Line With 6,14,12,69,"R/W" @ 6,30 Say " AIDI-!9%9IAH" Color("R/B") Shw_Status(" Esc I2I-2#--22#AID.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Authrdetail With 7,19,"B/W" L_Cross(10,15,68,"N/W") At_screen := Savescreen(6,14,13,70) Do While .t. Goto rec @ 11,19 Say "AID5H : " color("B/W") @ 11,35 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7,35 Say temp->Authrid Color("BG/R") @ 8,35 Get temp->Authrname Color("BG/R") Read If Updated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @12,19 clear to 11,68 If new_save(11,19,"B/W,W+/R") copy to Author Endif Endif exit Endif rec := CurRec() Restscreen(6,14,13,70,At_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Upd_Emp local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Em_screen , rec , upd_status , Ask // set delimiters off set escape on rec := 1 upd_status := .f. del_status := .f. close database Sele 1 ; Use Employee index Employee ; Sort On Empid To Temp Select 2 ; Use Temp Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,11,18,70,"N+/N" Do Boxes_Line With 5,10,17,69,"N+/W" @ 5,30 Say " AIDI-!9%12" Color("R/B") Shw_Status(" Esc I2I-2#--22#AID.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Empdetail With 7,13,"B/W" @13,28 Say " " L_Cross(15,11,68,"N/W") Em_screen := Savescreen(5,10,18,70) Do While .t. Goto rec @ 16,13 Say "AID5H : " color("B/W") @ 16,28 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG/N") @ 7,28 Say temp->Empid Color("BG+/N") @ 8,28 Get temp->Empna Valid !Empty(Temp->Empna) Color("BG/R") @ 9,28 Get temp->Empsex Pict "@A" ; valid Upper(temp->Empsex) = "M" .or. Upper(temp->Empsex) = "F" color("BG/R") @ 10,28 Get temp->Empadd Color("BG/R") @ 11,28 Get temp->Emptel Color("BG/R") @ 12,28 Get temp->Empstart Color("BG/R") @ 13,28 Get temp->salary Color("BG/R") Read If Updated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @16,11 clear to 16,68 If new_save(16,13,"B/W,W+/R") copy to Employee Endif Endif exit Endif rec := CurRec() Restscreen(5,10,18,70,Em_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return Procedure SortData DbsFiles = array(ADIR("*.Dbf" )) ADIR("*.dbf",DbsFiles) Set color to "+BG/RB" Row1 = 4+Mod(Opt,10) Col1 = 19+Len(Arc2[1]) @Row1-1,Col1-1 to Row1+8,Col1+21 Double Dbchoice = Achoice(Row1,Col1,Row1+7,Col1+20,DbsFiles) msgerr = Alert("-- 1"I'"#11'@%7-5I12"1D!H@*#G",{"C+I- 1""}) Return </font> </pre> <hr> <a name = "deljob"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- deljob.prg </b></font> <pre> <font face="MS SANS SERIF"> #include "inkey.ch" Procedure Del_Data //-- %I-!9% --// local i := 1 local text := "%" local delstatus := .f. Set Wrap On Do Boxes_Scrn With 6,44,14,73,"N+/N" Do Boxes_Line With 5,43,13,72,"G/R" for i = 1 to Len(progname) *-- progname @G1'A#!22menu.prg --* @i+6,45 Prompt Ltrim(Str(i))+". "+text+"I-!9%"+progname[i] next i Setcolor("W+/R") @6,45 Say "I-2# ..." Setcolor("G/R") Menu to DchOpt Do Case Case DchOpt = 1 Do Del_Mem with delstatus Case DchOpt = 2 Do Del_Book with delstatus Case DchOpt = 3 Do Del_Type with delstatus Case DchOpt = 4 Do Del_Name with delstatus Case DchOpt = 5 Do Del_Authr with delstatus Case DchOpt = 6 Do Del_Emp with delstatus Endcase If delstatus If Final_Del_Confirm() Pack Else Recall All Endif delstatus = .f. Endif Return * Proc Del_Mem Parameter delstatus local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Me_screen , rec , upd_status , Ask // set delimiters off set escape on del_status := .f. close database Sele 1 ; Use Member index Member ; reindex Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,11,19,70,"N+/N" Do Boxes_Line With 5,10,18,69,"N+/W" @ 5,30 Say " %I-!9%*!2 4" Color("R/B") Shw_Status(" Esc I2I-2#--22#%.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Memdetail With 7,13,"B/W" L_Cross(16,11,68,"N/W") _Mid := Space(5) Do While .t. goto Top rec := GetIdValue(_Mid,"Member","Memid") if rec = 0 return endif Goto rec @ 17,13 Say "%5H : " color("B/W") @ 17,32 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG/N") @ 7,32 Say Memid Color("BG+/N") @ 8,32 Say Memna Color("BG/R") @ 9,32 Say Memsex color("BG/R") @ 10,32 Say Memage Color("BG/R") @ 11,32 Say Memadd Color("BG/R") @ 12,32 Say Memtel Color("BG/R") @ 13,32 Say Memstart Color("BG/R") @ 14,32 Say Memstop Color("BG/R") @17,11 clear to 17,68 If del_confirm(17,13,"B/W,W+/R") delete delstatus = .t. Endif enddo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return Proc Del_Book Parameter delstatus local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Bk_screen , rec , upd_status , Ask , name // set delimiters off set escape on set cursor on rec := 1 delstatus := .f. close database Sele 1 ; Use Books index Books ; Sort On Bkid To Temp Sele 2 ; Use Name index Name Sele 3 ; Use Rentdeta Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,15,16,68,"N+/N" Do Boxes_Line With 5,14,15,67,"N+/W" @ 5,30 Say " %I-!9%+1*7-" Color("R/B") Shw_Status(" Esc I2I-2#--22#%.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Bookdetail With 7,17,"B/W" L_Cross(13,15,66,"N/W") _bkid := Space(8) Do While .t. Select Books goto Top rec := GetIdValue(_bkid,"Books","bkid") if rec = 0 return endif Goto rec @ 14,17 Say "%5H : " color("B/W") @ 14,34 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7 ,34 Say Books->Bkid Color "BG+/N" Sele Name Seek Substr(Books->Bkid,2,4) If Found() Name = Name->Name Endif Select Books @ 8,34 Say Alltrim(Name) Color("BG+/N") @ 9,34 Say Books->Bkdate Color("BG/R") @ 10,34 Say Books->Bkprice Color("BG/R") @ 11,34 Say Books->Rntprice Color("BG/R") @ 12,34 Say Books->Status Color("BG/R") @14,17 clear to 14,66 If del_confirm(14,13,"B/W,W+/R") delete delstatus = .t. Endif enddo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return /* Proc Del_Type local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Ty_screen , rec , upd_status , Ask // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Types index Types; Sort On Typeid To Temp Sele 2 ; Use Temp Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 7,11,12,70,"N+/N" Do Boxes_Line With 6,10,11,69,"R/W" @ 6,25 Say " %I-!9%#0@ +1*7-" Color("R/B") Shw_Status(" Esc I2I-2#--22#%.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do TypeDetail With 7,19,"B/W" L_Cross(9,11,68,"N/W") Ty_screen := Savescreen(6,10,12,70) Do While .t. Goto rec @ 10,19 Say "%5H : " color("B/W") @ 10,35 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7,35 Say Typeid Color("BG+/N") @ 8,35 Say TypeName Color("BG/R") Read If Delated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @10,19 clear to 10,68 If new_save(10,19,"B/W,W+/R") copy to Types Endif Endif exit Endif rec := CurRec() Restscreen(6,10,12,70,Ty_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Del_Name local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Na_screen , rec , upd_status , Ask , authrname // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Name index Name ; Sort On Nameid To Temp Sele 2 ; Use Author index Author Sele 3 ; Use Temp Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 7,15,14,70,"N+/N" Do Boxes_Line With 6,14,13,69,"R/W" @ 6,30 Say " %I-!9% 7H-+1*7-" Color("R/B") Shw_Status(" Esc I2I-2#--22#%.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Namedetail With 7,19,"B/W" L_Cross(11,15,68,"N/W") Na_screen := Savescreen(6,14,14,70) Do While .t. Goto rec @ 12,19 Say "%5H : " color("B/W") @ 12,35 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7,35 Say Nameid Color("BG+/N") @ 8,35 Say Name Color("BG/R") @ 9,35 Say Authrid Color("BG/R") Sele 2 Seek Authrid If Found() authrname := Author->Authrname Else authrname := "+29IAH#+1*5ID!H" Endif Sele 3 @10,35 Say " " color("/N") @10,35 Say authrname Color("BG+/N") Read If Delated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @12,19 clear to 12,68 If new_save(12,19,"B/W,W+/R") copy to Name Endif Endif exit Endif rec := CurRec() Restscreen(6,14,14,70,Na_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Del_Authr local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local At_screen , rec , upd_status , Ask // set delimiters off set escape on rec := 1 upd_status := .f. close database Sele 1 ; Use Author index Author ; Sort On Nameid To Temp Sele 2 ; Use Temp Do Boxes_Scrn With 4,0,23,79,"W/N" Do Boxes_Scrn With 7,15,13,70,"N+/N" Do Boxes_Line With 6,14,12,69,"R/W" @ 6,30 Say " %I-!9%9IAH" Color("R/B") Shw_Status(" Esc I2I-2#--22#%.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Authrdetail With 7,19,"B/W" L_Cross(10,15,68,"N/W") At_screen := Savescreen(6,14,13,70) Do While .t. Goto rec @ 11,19 Say "%5H : " color("B/W") @ 11,35 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG+/N") @ 7,35 Say Authrid Color("BG/R") @ 8,35 Say Authrname Color("BG/R") Read If Delated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @12,19 clear to 11,68 If new_save(11,19,"B/W,W+/R") copy to Author Endif Endif exit Endif rec := CurRec() Restscreen(6,14,13,70,At_screen) EndDo // set delimiters on select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return * Proc Del_Emp local scrnsave := savescreen(0,0,24,79) local colosave := setcolor() local nworkarea:= select() local Em_screen , rec , upd_status , Ask // set delimiters off set escape on rec := 1 upd_status := .f. del_status := .f. close database Sele 1 ; Use Employee index Employee ; Sort On Empid To Temp Select 2 ; Use Temp Do Boxes_Scrn With 4,0,24,79,"W/N" Do Boxes_Scrn With 6,11,18,70,"N+/N" Do Boxes_Line With 5,10,17,69,"N+/W" @ 5,30 Say " %I-!9%12" Color("R/B") Shw_Status(" Esc I2I-2#--22#%.. PGUP+#7-PGDW I2I-2#@%7H-@#-#L","W+/R") Do Empdetail With 7,13,"B/W" @13,28 Say " " L_Cross(15,11,68,"N/W") Em_screen := Savescreen(5,10,18,70) Do While .t. Goto rec @ 16,13 Say "%5H : " color("B/W") @ 16,28 Say "#0@5" (" + Ltrim(Str(Recno())) + "/" + Ltrim(Str(Reccount())) + ")" Color("BG/N") @ 7,28 Say Empid Color("BG+/N") @ 8,28 Say Empna Valid !Empty(Empna) Color("BG/R") @ 9,28 Say Empsex Pict "@A" ; valid Upper(Empsex) = "M" .or. Upper(Empsex) = "F" color("BG/R") @ 10,28 Say Empadd Color("BG/R") @ 11,28 Say Emptel Color("BG/R") @ 12,28 Say Empstart Color("BG/R") @ 13,28 Say salary Color("BG/R") Read If Delated() upd_status := .t. Endif If lastkey() = 27 If upd_status setcolor("/W") @16,11 clear to 16,68 If new_save(16,13,"B/W,W+/R") copy to Employee Endif Endif exit Endif rec := CurRec() Restscreen(5,10,18,70,Em_screen) EndDo select(nworkarea) setcolor(colosave) restscreen(0,0,24,79,scrnsave) Return </font> </pre> <hr> <a name = "rports"></a> <li><font face="MS SANS SERIF" color="#ff0000" size=+1><b>sorce B#A#!- rports.prg</b></font> <pre> <font face="MS SANS SERIF"> Public StartId ,StopId ,StartDate ,StopDate Procedure ReportSele Parameter ROpt Ropt = Int(ROpt) T311 := "#2"2I-!9%+1*7-" T312 := "#2"2+1*7-*9 +2"(9@ H22@4 2 @7-)" T313 := "#2"2+1*7-I2*H" T314 := "#2"2+1*7-63+*HC'15I" T321 := "#2"2I-!9%*!2 4" T322 := "*!2 45H+!-2"8" T331 := "#2"2I-!9%12" T341 := "+1*7-5H9@ H2#03'1" T342 := "2#@ H2+1*7--*!2 4" T343 := "*!2 4I2*H+1*7-" T344 := "+1*7-5HI2*H" T343 := "#17+1*7-2*!2 4" T344 := "+1*7-5H63+7C'15I[All]" T345 := "+1*7-5H63+7C'15I[AH"1D!HDI7]" T347 := "#2"2*!2 4I2*H+1*7-" T373 := "#2"DI2+1*7-AH%0@%H!@%7-2!@7-" T381 := "2# 3#0+5IC+I#4)1 @#5"2!'15H 3#0" T411 := "2#H2"@4@7-12#03@7-" T431 := ""-#2"#1#03@7-" T432 := "3D#28#03@7-" T441 := ""-#2"H2"#03@7-" Ls1 = {T311,T312,T313,T314} Ls2 = {T321,T322} Ls3 = {T331} Ls4 = {T341,T342} Do Boxes_Scrn With 1,0,24,79,"N+/N" RoptStr = ("Ls"+ Substr(Ltrim(str(ROpt)),-1)) Do Boxes_Line With 6,15,9+Len(&RoptStr),64,"GR+/N" @7,35 Say "#2"2" Setcolor("R/N") ROptr = Achoice(8,18,7+Len(&RoptStr),63,&RoptStr) Do Case Case ROptr = 0 Return Case ROptr > 0 RProg = ("Report"+Substr(Ltrim(Str(Ropt)),2)+Ltrim(Str(Roptr))) Setcolor("/n") cls Do &Rprog Endcase Return Proc Report11 Sele 1 ; Use name index name ; reindex Sele 2 ; Use author index author ; reindex Sele 3 ; Use Types index Types ; reindex Sele 4 ; Use Books index Books ; reindex Shw_status("-05I3%1@#5"!#2"2..- | I2--22#3#2"2 ESC","W+/R") StartId := StopId := Nil Get2Id("I-#+1*+1*7-...",8) IF Empty(StartId) .Or. Empty(StopId) Close Database Return EndIF Select Books Set Filter to (Books->Bkid >= StartId .and. Books->Bkid <= StopId) Goto Top bookarr = {} Do While .Not. Eof() bookid := space(8) bookname := " " aname := " " bookid := books->bkid oworkarea := select() Sele name Goto Top Seek substr(books->bkid,2,4) if found() bookname := Substr(Name->Name,1,23) _authrid := Name->Authrid endif If !Empty(authrid) Select author Goto Top Seek _authrid If Found() aname := Author->authrname Endif Else aname := " " Endif select(oworkarea) AADD(bookarr,bookid + Space(1) + Padr(alltrim(bookname),27) + Space(1); + Padr(alltrim(aname),15) + space(1) + Padl(Books->Bkprice,3); + Space(4) + Padl(Books->Rntprice,3) + Space(4) + If(Books->Status,"T","F"); + Space(2) + DtoC(Books->Bkdate)) skip Enddo nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 21 ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 45 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 33 Set Printer To "Rport311.txt" Set Device To Printer Else Close Database Return EndIF Set color to i := 1 Line := 8 nPage := 1 Do Repthead11 with nPage Do While i <= Len(bookarr) @Line,1 Say bookarr[i] Line++ i++ IF nDevice = 1 .or. nDevice = 2 IF Mod(Line,LpP) = 0 nPage++ IF nDevice = 1 Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") Inkey(0) IF LastKey() = 27 Close Database Return EndIF @ 8,0 Clear Line := 8 Do Repthead11 with nPage Else Eject Do Repthead11 with nPage Line := 8 EndIF EndIF EndIf EndDo Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") Inkey(0) Close Database Return Proc Report12 Do R12_13_14 With 1 Return Proc Report13 Do R12_13_14 With 2 Return Proc Report14 Do R12_13_14 With 3 Return Proc R12_13_14 Parameter reptno Close Database Sele 1 ; Use name index name Sele 2 ; Use Rentdeta Sele 3 ; Use Rent // AI!@ H2 Findresult := i := 0 Namerept := txt := " " Do case case reptno = 1 ; txt = " +1*7-5H*!2 4D!HDI3!272@4 2 @7- " ;Namept = "Rport312.txt" Condition = "Rent->Rntstatus = .T. .And. date() - Rent->rentdate >= 60" case reptno = 2 ; txt = "  +1*7-I2*H11IAH+%1'163+*H " ; Namerept = "Rport313.txt" Condition = "Rent->Rntstatus = .T. .And. date() - Rent->rentdate >= 0" case reptno = 3 ; txt = "  +1*7-63+*HC'15I " ; Namerept = "Rport314.txt" Condition = "Rent->Rntstatus = .T. .And. date() = Rent->rentdate" Endcase Cls Shw_status("-05I3%1@#5"!#2"2..- | I2--22#3#2"2 ESC","W+/R") Set Filter to &Condition Goto Top rentidar = {} memid_datear = {} missingar = {} _Bkid := Space(8) _bkname := " " _rentdate := ctod(" / / ") Do While .Not. Eof() aadd(rentidar,Rent->Rentid) aadd(memid_datear,Rent->memid+" "+DtoC(Rent->Rentdate)) skip Enddo for i = 1 to len(rentidar) Sele 2 // AI! @ H2%0@-5" Set filter to rentidar[i] = Rentdeta->rentid Goto top Do While .Not. Eof() _bkid := Rentdeta->bkid nworkarea := select() Sele 1 // AI! 7H- Seek Substr(_bkid,2,4) IF Found() _Bkname := Name->Name Else _Bkname := "D!H 7H-+1*7-@%H!5I" Endif Select(nworkarea) Aadd(missingar,Rentdeta->bkid + " " +Padr(_Bkname,32) + " " + memid_datear[i]) Skip Enddo next nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 21 cls Setcolor("R/BG") @2,1 Clear to 22,76 @2,1 to 22,77 double ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 45 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 33 Set Printer To &Namerept Set Device To Printer Else Close Database Return EndIF i := 1 Line := 7 nPage := 1 Do Reptheadx with txt Do While i <= Len(missingar) @Line, 7 Say missingar[i] Line++ i++ IF nDevice = 1 .or. nDevice = 2 IF Mod(Line,LpP) = 0 nPage++ IF nDevice = 1 Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") // @ 24,1 Say "8H!C 9+I2H-D ESC---22##2"2 " Inkey(0) IF LastKey() = 27 Close Database Return EndIF @2,1 Clear to 22,76 @2,1 to 22,77 double Line := 7 Do Reptheadx with txt Else Eject Do Reptheadx with txt Line := 7 EndIF EndIF EndIf EndDo Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") // @ 24,1 Say " *4I*8AI! " Color "R" Inkey(0) Close Database Return Proc Report21 Sele 1 ; Use Member index Member ; reindex Shw_status("-05I3%1@#5"!#2"2..- | I2--22#3#2"2 ESC","W+/R") StartId := StopId := Nil Get2Id("I-#+1**!2 4...",5) IF Empty(StartId) .Or. Empty(StopId) Close Database Return EndIF nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 2 cls ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 3 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 3 Set Printer To "Rport321.txt" Set Device To Printer Else Close Database Return EndIF Set color to i := 1 Line := 7 nPage := 1 Do Repthead21 with nPage Set Filter to (Member->memid >= StartId .and. Member->memid <= StopId) Goto Top Do While .not. Eof() @ Line+1,2 Say Alltrim(Str(i)) @ Line+1,11 Say "#+1**!2 4 : "+ memid @ Line+1,31 Say " 7H--*8% : "+ memna @ Line+2,11 Say "@( : "+ If(Upper(Memsex)="M"," 2"","+ 4") @ Line+2,31 Say "-2"8 : "+ Alltrim(str(memage)) @ Line+3,11 Say "5H-"9H : "+ Alltrim(memadd) @ Line+4,11 Say "+!2"@%B#(1L : "+ memtel @ Line+5,11 Say "'15H*!1# : "+ DtoC(Memstart) @ Line+5,40 Say "'15H+!-2"8*!2 4 : "+ DtoC(Memstop) Line += 6 i++ IF nDevice = 1 .or. nDevice = 2 IF Mod(i-1,LpP) = 0 nPage++ IF nDevice = 1 Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") // @ 24,1 Say "8H!C 9+I2H-D ESC---22##2"2 " Inkey(0) IF LastKey() = 27 Close Database Return EndIF @ 8,0 Clear Line := 7 Do Repthead21 with nPage Else Eject Line := 7 Do Repthead21 with nPage EndIF EndIF EndIf Skip EndDo Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") // @ 24,1 Say " *4I*8AI! " Color "R" Inkey(0) Close Database Proc Report22 Close Database i := 0 Cls Shw_status("-05I3%1@#5"!#2"2..- | I2--22#3#2"2 ESC","W+/R") warning_member = {} Use member Do While .Not. Eof() if (Memstop -30) <= Date() aadd(warning_member,Member->memid+" "+Padr(Member->Memna,30) + " "+DtoC(Member->Memstart) + " " + DtoC(Member->memstop)) Endif skip Enddo nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 21 cls Setcolor("R/BG") @2,1 Clear to 22,76 @2,1 to 22,77 double ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 45 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 33 Set Printer To "Rport322.txt" Set Device To Printer Else Close Database Return EndIF i := 1 Line := 7 nPage := 1 Do Repthead22 Do While i <= Len(warning_member) @Line, 9 Say warning_member[i] Line++ i++ IF nDevice = 1 .or. nDevice = 2 IF Mod(Line,LpP) = 0 nPage++ IF nDevice = 1 Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") Inkey(0) IF LastKey() = 27 Close Database Return EndIF @2,1 Clear to 22,76 @2,1 to 22,77 double Line := 7 Do Repthead22 Else Eject Do Repthead22 Line := 7 EndIF EndIF EndIf EndDo Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") Inkey(0) Close Database Return Proc Report31 Sele 1 ; Use Employee index Employee ; reindex Shw_status("-05I3%1@#5"!#2"2..- | I2--22#3#2"2 ESC","W+/R") StartId := Employee->empid goto Bottom StopId := Employee->empid IF Empty(StartId) .Or. Empty(StopId) Close Database Return EndIF nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 2 cls ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 3 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 3 Set Printer To "Rport331.txt" Set Device To Printer Else Close Database Return EndIF Set color to i := 1 Line := 7 nPage := 1 Do Repthead31 with nPage Goto Top Do While .not. Eof() @ Line+1,2 Say Alltrim(Str(i)) @ Line+1,11 Say "#+1*12 : "+ empid @ Line+1,31 Say " 7H--*8% : "+ empna @ Line+2,11 Say "@( : "+ If(Upper(empsex)="M"," 2"","+ 4") @ Line+3,11 Say "5H-"9H : "+ Alltrim(empadd) @ Line+4,11 Say "+!2"@%B#(1L : "+ emptel @ Line+5,11 Say "'15H@I232 : "+ DtoC(empstart) Line += 6 i++ IF nDevice = 1 .or. nDevice = 2 IF Mod(i-1,LpP) = 0 nPage++ IF nDevice = 1 Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") // @ 24,1 Say "8H!C 9+I2H-D ESC---22##2"2 " Inkey(0) IF LastKey() = 27 Close Database Return EndIF @ 8,0 Clear Line := 7 Do Repthead31 with nPage Else Eject Line := 7 Do Repthead31 with nPage EndIF EndIF EndIf Skip EndDo Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") // @ 24,1 Say " *4I*8AI! " Color "R" Inkey(0) Close Database Proc report41 Sele 1 ; Use rent Sele 2 ; Use rentdeta Sele 3 ; Use Books index Books Sele 4 ; Use Name index Name i := j := 1 reptarr := {} rentidarr := {} Bookid := Space(8) _Nameid := Space(4) Bookname := " " Sele Rent Set Filter to Rent->Rentdate = Date() Goto Top Do While !Eof() Aadd(rentidarr,Rent->Rentid) skip Enddo condition := "Rentdeta->rentid = rentidarr[i]" For i = 1 to len(rentidarr) id := rentidarr[i] Sele Rentdeta Locate for &condition Do while found() Bookid = Rentdeta->Bkid _Nameid = Substr(Bookid,2,4) Sele Name Goto Top Seek _Nameid If Found() bookname = Name->Name Endif Aadd(reptarr,Padl(Alltrim(Str(j)),5)+Space(6)+ id + Space(8) ; + Bookid + Space(9) + bookname) Sele Rentdeta Skip Locate rest for &condition id := Space(7) j++ Enddo Next nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 21 ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 45 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 33 Set Printer To "Rport341.txt" Set Device To Printer Else Close Database Return EndIF Set color to i := 1 Line := 6 nPage := 1 Do Repthead41 with nPage For i = 1 to len(reptarr) @Line,1 Say reptarr[i] Line++ IF nDevice = 1 .or. nDevice = 2 IF Mod(Line,LpP) = 0 nPage++ IF nDevice = 1 // @24,1 Say "8H!C 9+I2H-D ESC---22##2"2 " Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") inkey(0) IF LastKey() = 27 Close Database Return EndIF @ 6,0 Clear Line := 6 Do Repthead41 with nPage Else Eject Do Repthead41 with nPage Line := 6 EndIF EndIF EndIf Next Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") Inkey(0) Close Database return Proc report42 Sele 1 ; Use rent Sele 2 ; Use rentdeta Sele 3 ; Use Books index Books Sele 4 ; Use Name index Name i := j := 1 reptarr := {} rentidarr := {} Memidarr := {} no := Space(1) Bookid := Space(8) _Nameid := Space(4) Bookname := " " Sele Rent Set Filter to Rent->Rentdate = Date() Goto Top Do While !Eof() Aadd(rentidarr,Rent->Rentid) Aadd(Memidarr,Rent->Memid) skip Enddo use Member index Member ; reindex For i = 1 to len(Memidarr) goto top Seek Memidarr[i] If found() Memidarr[i] += (Space(3)+Substr(Member->Memna,1,At(" ",Member->Memna)-1)) Endif next condition := "Rentdeta->rentid = rentidarr[i]" For i = 1 to len(rentidarr) id := Memidarr[i] j := 1 no := Alltrim(Str(i)) Sele Rentdeta Locate for &condition Do while found() Bookid = Rentdeta->Bkid _Nameid = Substr(Bookid,2,4) Sele Name Goto Top Seek _Nameid If Found() bookname = Name->Name Endif Aadd(reptarr,Padr(no,4)+Space(1)+ Padr(id,26) +; + Space(1) +Padr(Alltrim(Str(j)),3) + Bookid + Space(1) + bookname) Sele Rentdeta Skip Locate rest for &condition id := Space(7) no := Space(1) j++ Enddo Next cls nDevice := SelectOutput() IF nDevice = 1 //-- --2- 2 LpP = 21 ElseIF nDevice = 2 //-- --2#4I@-#L If Prn_Test() LpP = 45 Set Device to Printer Else Close Database Return Endif ElseIF nDevice = 3 //-- --2D%L LpP = 33 Set Printer To "Rport342.txt" Set Device To Printer Else Close Database Return EndIF Set color to i := 1 Line := 6 nPage := 1 Do Repthead42 with nPage For i = 1 to len(reptarr) @Line,1 Say reptarr[i] Line++ IF nDevice = 1 .or. nDevice = 2 IF Mod(Line,LpP) = 0 nPage++ IF nDevice = 1 // @24,1 Say "8H!C 9+I2H-D ESC---22##2"2 " Shw_Status("8H!C 9+I2H-D ESC---22##2"2 ","G+/R") inkey(0) IF LastKey() = 27 Close Database Return EndIF @ 6,0 Clear Line := 6 Do Repthead42 with nPage Else Eject Do Repthead42 with nPage Line := 6 EndIF EndIF EndIf Next Set Device To Screen Shw_Status(" *4I*8AI!  05I2#4!L#2"2@*#G*4I... 8H!C@7H---22##2"2 ","G+/R") Inkey(0) Close Database return </font> </pre> <hr> <table width=80% border=0> <tr> <center> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos.html">3#0</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos1.html">(6)21 +2</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos2.html">(6)2'2!@GDDI</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos3.html">(6)2#0@4!</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos4.html">--A#0C+!H</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos6.html">41I</a></font></center></td> <td bgcolor="#ddffdd"><center><font face="MS SANS SERIF" color="#0000ff" size=0><a href="bos7.html">3#8#1)2</a></font></center></td> </tr> </table> </center> <font face="MS SANS SERIF" color="#0000ff" size=0> |<a href="index.html"><b>%1+I2+%1</b></a>|<............>|<b>contact me at <a href=mailto:pratuang@yonok.zzn.com>pratuang@yonok.zzn.com</a></b>| </font> <br> <font face="ms sans serif" color="#ff0000" size=0> <marquee hspace=0 vspace=0 loop=infinite>--8 8H- 8A!H 8-2 -22#"L @7H-1(6)2A%09I@5H"'I-85H H'"*1*8C+I25I*3@#G%8%H'DI'"5..........</b> </font> </body> </html>