Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE SUB Search ()
- DECLARE SUB main ()
- DECLARE SUB layout ()
- DECLARE SUB add ()
- DECLARE SUB Disp ()
- DECLARE SUB Srch ()
- DECLARE SUB Categry ()
- DECLARE SUB edit ()
- DECLARE SUB delete ()
- DECLARE SUB bye ()
- DIM ou AS STRING
- TOP:
- CLS
- ou = TIME$
- COLOR 7, 1
- INV:
- CALL main
- LOCATE 20, 28:
- PRINT "Enter your choice:: 1-7"; : INPUT C
- SELECT CASE C
- CASE 1
- CALL add
- CASE 2
- CALL Disp
- CASE 3
- CALL Search
- CASE 4
- CALL Categry
- CASE 5
- CALL edit
- CASE 6
- CALL delete
- CASE 7
- GOTO Bottom
- CASE ELSE
- CLS
- PRINT "Case invalid"
- GOTO INV
- END SELECT
- LOCATE 22, 25
- PRINT "Press any key to go to main menu"
- a$ = INPUT$(1)
- GOTO TOP
- Bottom:
- CALL bye
- END
- SUB add
- avg:
- COLOR 7, 1
- OPEN "Inv.TXT" FOR APPEND AS #1
- REDIM N(100)
- OPEN "Inv.TXT" FOR INPUT AS #2
- I = 1
- WHILE NOT EOF(2)
- INPUT #2, C, N$, C$, R, S, SQ, P
- N(I) = C
- I = I + 1
- WEND
- CLOSE #2
- CLS
- Wro:
- CALL layout
- LOCATE 6, 36: PRINT "Add Book"
- LOCATE 10, 25: PRINT "Enter Item Code"; : INPUT IC
- FOR j = 1 TO 100
- IF IC = N(j) THEN
- CLS
- LOCATE 10, 22: PRINT "Invalid Item Code.. TRY AGAIN!!"
- GOTO Wro
- END IF
- NEXT j
- LOCATE 11, 25: PRINT "Enter Book Name"; : INPUT N$
- LOCATE 12, 25: PRINT "Enter Book Category"; : INPUT C$
- LOCATE 13, 25: PRINT "Enter Received Quantity"; : INPUT R
- LOCATE 14, 25: PRINT "Enter Sold Quantity"; : INPUT S
- LOCATE 15, 25: PRINT "Enter Price"; : INPUT P
- SQ = R - S
- WRITE #1, IC, N$, C$, R, S, SQ, P
- CLOSE #1
- LOCATE 20, 23: PRINT "DO YOU WANT TO ADD MORE DATA(Y/N)?"; : INPUT CHECK$
- IF UCASE$(CHECK$) = "Y" THEN GOTO avg
- END SUB
- SUB bye
- COLOR 7, 1
- CLS
- LOCATE 6, 18: PRINT STRING$(44, CHR$(196))
- LOCATE 6, 17: PRINT CHR$(218)
- LOCATE 6, 62: PRINT CHR$(191)
- LOCATE 8, 20: PRINT STRING$(40, CHR$(196))
- LOCATE 8, 19: PRINT CHR$(218)
- LOCATE 8, 60: PRINT CHR$(191)
- FOR I = 7 TO 20
- LOCATE I, 17: PRINT CHR$(179)
- LOCATE I, 62: PRINT CHR$(179)
- IF I < 18 THEN
- LOCATE I + 2, 19: PRINT CHR$(179)
- LOCATE I + 2, 60: PRINT CHR$(179)
- END IF
- NEXT
- LOCATE 21, 17: PRINT CHR$(192)
- LOCATE 21, 18: PRINT STRING$(44, CHR$(196))
- LOCATE 21, 62: PRINT CHR$(217)
- LOCATE 19, 20: PRINT STRING$(40, CHR$(196))
- LOCATE 19, 19: PRINT CHR$(192)
- LOCATE 19, 60: PRINT CHR$(217)
- LOCATE 13, 20: PRINT STRING$(40, CHR$(196))
- COLOR 15 + 16
- LOCATE 7, 18: PRINT STRING$(44, CHR$(2))
- FOR I = 7 TO 19
- LOCATE I, 18: PRINT "*"
- LOCATE I, 61: PRINT "*"
- NEXT I
- LOCATE 20, 18: PRINT STRING$(44, CHR$(2))
- dtv = VAL(TIME$)
- dt = dtv - dtu
- COLOR 7
- LOCATE 10, 28: PRINT "Current Time:- "; TIME$
- LOCATE 13, 28: PRINT "Time Spent Logged in:"; dt; "secs"
- LOCATE 16, 30: PRINT "Logged off already?"
- LOCATE 18, 29: PRINT "Comeback for more soon ";
- END SUB
- SUB Categry
- oof:
- OPEN "Inv.txt" FOR INPUT AS #1
- LOCATE 20, 24: PRINT "Enter item category to be searched"; : INPUT SD$
- COLOR 7, 1
- CLS
- CALL layout
- LOCATE 6, 31: PRINT "Category:"; SD$
- FLAG = 0
- a = 11
- ch = 8
- WHILE NOT EOF(1)
- INPUT #1, C, N$, C$, R, S, SQ, P
- IF UCASE$(SD$) = UCASE$(C$) THEN
- LOCATE 10, 8: PRINT "Dew Code"
- LOCATE 10, 21: PRINT "Book Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 63: PRINT "Price"
- FLAG = 1
- IF ch MOD 8 = 0 THEN
- LOCATE 20, 24: PRINT "Press any key to view more datas"; : a$ = INPUT$(1)
- CLS
- CALL layout
- LOCATE 6, 35: PRINT "Display Items"
- LOCATE 10, 8: PRINT "Dew Code"
- LOCATE 10, 21: PRINT "Book Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 63: PRINT "Price"
- a = 11
- END IF
- LOCATE a, 10: PRINT C
- LOCATE a, 21: PRINT N$
- LOCATE a, 33: PRINT C$
- LOCATE a, 49: PRINT SQ
- LOCATE a, 64: PRINT SP
- a = a + 1
- ch = ch + 1
- END IF
- WEND
- CLOSE #1
- IF FLAG = 0 THEN LOCATE 15, 33: PRINT "DATA NOT FOUND"
- LOCATE 20, 28: PRINT "SEARCH ANOTHER DATA(Y/N)?"; : INPUT SE$
- IF UCASE$(SE$) = "Y" THEN GOTO oof
- END SUB
- SUB delete
- OPEN "Inv.TXT" FOR INPUT AS #1
- OPEN "NEW.TXT" FOR OUTPUT AS #2
- LOCATE 22, 22: PRINT "Enter the Code of item to be deleted"; : INPUT D
- COLOR 7, 1
- CLS
- CALL layout
- LOCATE 6, 35: PRINT "Delete Item"
- FLAG = 0
- WHILE NOT EOF(1)
- INPUT #1, C, N$, C$, R, S, SQ, P
- IF D = C THEN
- LOCATE 10, 8: PRINT "Dew Code"
- LOCATE 10, 21: PRINT "Book Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 63: PRINT "Price"
- LOCATE 11, 9: PRINT C
- LOCATE 11, 21: PRINT N$
- LOCATE 11, 33: PRINT C$
- LOCATE 11, 49: PRINT SQ
- LOCATE 11, 64: PRINT P
- FLAG = 1
- LOCATE 20, 20: PRINT "Are you sure to delete this record(Y/N)?"; : INPUT DI$
- IF UCASE$(DI$) <> "Y" THEN
- WRITE #2, C, N$, C$, R, S, SQ, P
- ELSE
- LOCATE 16, 33: PRINT "Record Deleted"
- END IF
- ELSE
- WRITE #2, C, N$, C$, R, S, SQ, P
- END IF
- WEND
- IF FLAG = 0 THEN LOCATE 15, 33: PRINT "DATA NOT FOUND"
- CLOSE #1, #2
- KILL "Inv.txt"
- NAME "NEW.TXT" AS "Inv.txt"
- END SUB
- SUB Disp
- OPEN "Inv.TXT" FOR INPUT AS #1
- COLOR 7, 1
- CLS
- CALL layout
- LOCATE 6, 35: PRINT "Books"
- LOCATE 10, 8: PRINT "Dew Code"
- LOCATE 10, 21: PRINT "Book Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 63: PRINT "Price"
- a = 11
- ch = 1
- WHILE NOT EOF(1)
- INPUT #1, C, N$, C$, R, S, SQ, P
- IF ch MOD 8 = 0 THEN
- LOCATE 20, 24: PRINT "Press any key to view more datas"; : a$ = INPUT$(1)
- CLS
- CALL layout
- LOCATE 6, 35: PRINT "Display Items"
- LOCATE 10, 8: PRINT "Item Code"
- LOCATE 10, 21: PRINT "Item Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 63: PRINT "Price"
- a = 11
- END IF
- LOCATE a, 10: PRINT C
- LOCATE a, 21: PRINT N$
- LOCATE a, 33: PRINT C$
- LOCATE a, 49: PRINT SQ
- LOCATE a, 64: PRINT P
- a = a + 1
- ch = ch + 1
- WEND
- CLOSE #1
- END SUB
- SUB edit
- OPEN "Inv.TXT" FOR INPUT AS #1
- OPEN "Inv.TXT" FOR INPUT AS #3
- OPEN "TEMP.TXT" FOR OUTPUT AS #2
- LOCATE 22, 15: PRINT "Enter code of item whose data is to be edited"; : INPUT E
- COLOR 7, 1
- FLAG = 0
- CLS
- CALL layout
- LOCATE 6, 35: PRINT "Edit Item"
- WHILE NOT EOF(1)
- INPUT #1, C, N$, C$, R, S, SQ, P
- IF E = C THEN
- FLAG = 1
- LOCATE 10, 8: PRINT "Book Code"
- LOCATE 10, 21: PRINT "Book Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 62: PRINT "Price"
- LOCATE 11, 9: PRINT C
- LOCATE 11, 21: PRINT N$
- LOCATE 11, 33: PRINT C$
- LOCATE 11, 49: PRINT SQ
- LOCATE 11, 64: PRINT P
- LOCATE 20, 20: PRINT "Do you want to edit this record(Y/N)?"; : INPUT ED$
- IF UCASE$(ED$) = "Y" THEN
- CLS
- DIM N(100)
- ctr = 1
- WHILE NOT EOF(3)
- INPUT #3, IC, N$, C$, R, S, SQ, P
- IF IC <> C THEN N(ctr) = IC
- ctr = ctr + 1
- WEND
- CLOSE #3
- here:
- CALL layout
- LOCATE 6, 35: PRINT "Edit Item"
- LOCATE 10, 25: PRINT "Enter Item Code"; : INPUT C
- FOR tt = 1 TO 100
- IF C = N(tt) THEN
- CLS
- LOCATE 10, 22: PRINT "Invalid item code.. TRY AGAIN!!"
- GOTO here
- END IF
- NEXT tt
- LOCATE 11, 25: PRINT "Enter Book Name"; : INPUT N$
- LOCATE 12, 25: PRINT "Enter Book Category"; : INPUT C$
- LOCATE 13, 25: PRINT "Enter Received Quantity"; : INPUT R
- LOCATE 14, 25: PRINT "Enter Sold Quantity"; : INPUT S
- LOCATE 15, 25: PRINT "Enter Price"; : INPUT P
- SQ = R - S
- WRITE #2, C, N$, C$, R, S, SQ, P
- LOCATE 18, 33: PRINT "DATA EDITED"
- ELSE
- WRITE #2, C, N$, C$, R, S, SQ, P
- END IF
- ELSE
- WRITE #2, C, N$, C$, R, S, SQ, P
- END IF
- WEND
- IF FLAG = 0 THEN LOCATE 15, 33: PRINT "Data Not Found"
- CLOSE
- KILL "Inv.TXT"
- NAME "TEMP.TXT" AS "Inv.TXT"
- END SUB
- SUB layout
- LOCATE 4, 6: PRINT CHR$(201)
- LOCATE 4, 73: PRINT CHR$(187)
- LOCATE 4, 7: PRINT STRING$(66, CHR$(205))
- LOCATE 6, 7: PRINT STRING$(66, CHR$(205))
- LOCATE 7, 30: PRINT "*"
- LOCATE 7, 51: PRINT "*"
- LOCATE 8, 30: PRINT STRING$(22, "*")
- LOCATE 9, 7: PRINT STRING$(66, CHR$(196))
- LOCATE 24, 7: PRINT STRING$(66, CHR$(205))
- FOR I = 4 TO 22
- LOCATE I, 6: PRINT CHR$(186)
- LOCATE I, 73: PRINT CHR$(186)
- NEXT I
- LOCATE 5, 6: PRINT CHR$(204)
- LOCATE 5, 73: PRINT CHR$(185)
- LOCATE 8, 73: PRINT CHR$(182)
- LOCATE 8, 6: PRINT CHR$(199)
- LOCATE 19, 6: PRINT CHR$(199)
- LOCATE 19, 7: PRINT STRING$(66, CHR$(196))
- LOCATE 19, 73: PRINT CHR$(182)
- LOCATE 21, 73: PRINT CHR$(185)
- LOCATE 21, 6: PRINT CHR$(204)
- LOCATE 23, 6: PRINT CHR$(200)
- LOCATE 23, 73: PRINT CHR$(188)
- LOCATE 21, 7: PRINT STRING$(66, CHR$(205))
- COLOR 7, 1: LOCATE 4, 25: PRINT "The Dewey/Library Management System"
- COLOR 7, 1
- END SUB
- SUB main
- CLS
- CALL layout
- LOCATE 6, 36: PRINT "Main Menu"
- LOCATE 8, 11: PRINT CHR$(210)
- LOCATE 19, 11: PRINT CHR$(208)
- FOR j = 9 TO 18
- LOCATE j, 11: PRINT CHR$(186)
- NEXT j
- FOR k = 1 TO 7
- a = k + 9
- LOCATE a, 7: PRINT k
- NEXT k
- LOCATE 10, 15
- PRINT "Add Book"
- LOCATE 11, 15
- PRINT "Display Books"
- LOCATE 12, 15
- PRINT "Search Book by Code"
- LOCATE 13, 15
- PRINT "Search Book by Category"
- LOCATE 14, 15
- PRINT "Edit Books"
- LOCATE 15, 15
- PRINT "Delete Book"
- LOCATE 16, 15
- PRINT "Exit"
- END SUB
- SUB Search
- agn:
- OPEN "Inv.TXT" FOR INPUT AS #1
- LOCATE 20, 24: PRINT "Enter item code to be searched"; : INPUT SE
- COLOR 7, 1
- CLS
- CALL layout
- FLAG = 0
- LOCATE 6, 31: PRINT "Item Code:"; SE
- a = 11
- WHILE NOT EOF(1)
- INPUT #1, C, N$, C$, R, S, SQ, P
- IF SE = C THEN
- LOCATE 10, 8: PRINT "Item Code"
- LOCATE 10, 21: PRINT "Item Name"
- LOCATE 10, 33: PRINT "Category"
- LOCATE 10, 46: PRINT "Stock Qty"
- LOCATE 10, 63: PRINT "Price"
- FLAG = 1
- LOCATE a, 10: PRINT C
- LOCATE a, 21: PRINT N$
- LOCATE a, 33: PRINT C$
- LOCATE a, 49: PRINT SQ
- LOCATE a, 64: PRINT P
- a = a + 1
- END IF
- WEND
- CLOSE #1
- IF FLAG = 0 THEN LOCATE 15, 33: PRINT "DATA NOT FOUND"
- LOCATE 20, 28: PRINT "SEARCH ANOTHER DATA(Y/N)?"; : INPUT SE$
- IF UCASE$(SE$) = "Y" THEN GOTO agn
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement