QBASIC PROJECT WORK [SHOP]
Question:
S & L Food and Accessories is facing problems in maintaining the information of all the food items. So, they want to computerize their list of item to improve the management of their products. the system should maintain the information about the item code, item name, category, received quantity, sold quantity and price.
REM Main Menu
DECLARE SUB menu ()
Declare Sub outline()
DECLARE SUB Add ()
DECLARE SUB Display ()
DECLARE SUB Search ()
DECLARE SUB Srdept()
DECLARE SUB edit ()
DECLARE SUB Delete ()
DECLARE SUB Fin ()
TOP:
CLS
COLOR 15, 4
INV:
CALL menu
LOCATE 20, 28:
PRINT "Enter your choice:: 1-7";: INPUT C
SELECT CASE C
CASE 1
CALL Add
CASE 2
CALL Display
CASE 3
CALL Search
CASE 4
CALL Srdept
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 Fin
END
SUB Add
COLOR 15, 4
OPEN "SHOP.DAT" FOR APPEND AS #1
DIM N(100)
DO
OPEN "SHOP.DAT" 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 outline
LOCATE 6, 36: PRINT "Add Item"
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 Item Name";: INPUT N$
LOCATE 12, 25: PRINT "Enter Item 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
LOCATE 20, 23: PRINT "DO YOU WANT TO ADD MORE DATA(Y/N)?";: INPUT CHECK$
LOOP WHILE UCASE$(CHECK$) = "Y"
CLOSE #1
END SUB
SUB Delete
OPEN "SHOP.DAT" FOR INPUT AS #1
OPEN "NEW.DAT" FOR OUTPUT AS #2
LOCATE 22, 22: PRINT "Enter the Code of item to be deleted";: INPUT D
COLOR 15, 4
CLS
CALL outline
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 "Item Code"
LOCATE 10, 21: PRINT "Item 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 "SHOP.DAT"
NAME "NEW.DAT" AS "SHOP.DAT"
END SUB
SUB Display
OPEN "SHOP.DAT" FOR INPUT AS #1
COLOR 15, 4
CLS
CALL outline
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
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 outline
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 Search
AGN:
OPEN "SHOP.Dat" FOR INPUT AS #1
LOCATE 20, 24: PRINT "Enter item code to be searched";: INPUT Se
COLOR 15, 4
CLS
CALL outline
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
SUB Srdept
AGN:
OPEN "SHOP.Dat" FOR INPUT AS #1
LOCATE 20, 24: PRINT "Enter item category to be searched";: INPUT SD$
COLOR 15, 4
CLS
CALL outline
LOCATE 6, 31: PRINT "Category:"; SD$
Flag = 0
a = 11
ch = 1
WHILE NOT EOF(1)
INPUT #1, C, N$, C$, R, S, SQ, P
IF UCASE$(SD$) = UCASE$(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
IF ch MOD 8 = 0 THEN
LOCATE 20, 24: PRINT "Press any key to view more datas";: a$ = INPUT$(1)
CLS
CALL outline
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 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 AGN
END SUB
SUB Edit
OPEN "SHOP.DAT" FOR INPUT AS #1
OPEN "SHOP.DAT" FOR INPUT AS #3
OPEN "TEMP.DAT" FOR OUTPUT AS #2
LOCATE 22, 15: PRINT "Enter code of item whose data is to be edited";: INPUT E
COLOR 15, 4
FLAG = 0
CLS
CALL outline
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 "Item Code"
LOCATE 10, 21: PRINT "Item 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 outline
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 Item Name";: INPUT N$
LOCATE 12, 25: PRINT "Enter Item 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 "SHOP.DAT"
NAME "TEMP.DAT" AS "SHOP.DAT"
END SUB
SUB menu
CLS
CALL outline
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 Item"
LOCATE 11, 15
PRINT "Display Item"
LOCATE 12, 15
PRINT "Search Item by Code"
LOCATE 13, 15
PRINT "Search Item by Category"
LOCATE 14, 15
PRINT "Edit Item"
LOCATE 15, 15
PRINT "Delete Item"
LOCATE 16, 15
PRINT "Exit"
END SUB
SUB Fin
COLOR 15, 4
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, "*")
FOR i = 7 TO 19
LOCATE i, 18: PRINT "*"
LOCATE i, 61: PRINT "*"
NEXT i
LOCATE 20, 18: PRINT STRING$(44, "*")
COLOR 15
LOCATE 10, 33: PRINT "THANK YOU!!!"
LOCATE 12, 33: PRINT "VISIT AGAIN"
LOCATE 16, 26: PRINT "SUBMITTED BY: SARIKA SHRESTHA"
LOCATE 18, 28: PRINT "SUBMITTED TO: DEEPAK SIR"
END SUB
SUB outline
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 15 + 16: LOCATE 4, 25: PRINT "The S & L Food And Accessories"
COLOR 15, 4
END SUB
REM Main Menu
DECLARE SUB menu ()
Declare Sub outline()
DECLARE SUB Add ()
DECLARE SUB Display ()
DECLARE SUB Search ()
DECLARE SUB Srdept()
DECLARE SUB edit ()
DECLARE SUB Delete ()
DECLARE SUB Fin ()
TOP:
CLS
COLOR 15, 4
INV:
CALL menu
LOCATE 20, 28:
PRINT "Enter your choice:: 1-7";: INPUT C
SELECT CASE C
CASE 1
CALL Add
CASE 2
CALL Display
CASE 3
CALL Search
CASE 4
CALL Srdept
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 Fin
END
SUB Add
COLOR 15, 4
OPEN "SHOP.DAT" FOR APPEND AS #1
DIM N(100)
DO
OPEN "SHOP.DAT" 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 outline
LOCATE 6, 36: PRINT "Add Item"
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 Item Name";: INPUT N$
LOCATE 12, 25: PRINT "Enter Item 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
LOCATE 20, 23: PRINT "DO YOU WANT TO ADD MORE DATA(Y/N)?";: INPUT CHECK$
LOOP WHILE UCASE$(CHECK$) = "Y"
CLOSE #1
END SUB
SUB Delete
OPEN "SHOP.DAT" FOR INPUT AS #1
OPEN "NEW.DAT" FOR OUTPUT AS #2
LOCATE 22, 22: PRINT "Enter the Code of item to be deleted";: INPUT D
COLOR 15, 4
CLS
CALL outline
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 "Item Code"
LOCATE 10, 21: PRINT "Item 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 "SHOP.DAT"
NAME "NEW.DAT" AS "SHOP.DAT"
END SUB
SUB Display
OPEN "SHOP.DAT" FOR INPUT AS #1
COLOR 15, 4
CLS
CALL outline
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
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 outline
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 Search
AGN:
OPEN "SHOP.Dat" FOR INPUT AS #1
LOCATE 20, 24: PRINT "Enter item code to be searched";: INPUT Se
COLOR 15, 4
CLS
CALL outline
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
SUB Srdept
AGN:
OPEN "SHOP.Dat" FOR INPUT AS #1
LOCATE 20, 24: PRINT "Enter item category to be searched";: INPUT SD$
COLOR 15, 4
CLS
CALL outline
LOCATE 6, 31: PRINT "Category:"; SD$
Flag = 0
a = 11
ch = 1
WHILE NOT EOF(1)
INPUT #1, C, N$, C$, R, S, SQ, P
IF UCASE$(SD$) = UCASE$(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
IF ch MOD 8 = 0 THEN
LOCATE 20, 24: PRINT "Press any key to view more datas";: a$ = INPUT$(1)
CLS
CALL outline
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 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 AGN
END SUB
SUB Edit
OPEN "SHOP.DAT" FOR INPUT AS #1
OPEN "SHOP.DAT" FOR INPUT AS #3
OPEN "TEMP.DAT" FOR OUTPUT AS #2
LOCATE 22, 15: PRINT "Enter code of item whose data is to be edited";: INPUT E
COLOR 15, 4
FLAG = 0
CLS
CALL outline
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 "Item Code"
LOCATE 10, 21: PRINT "Item 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 outline
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 Item Name";: INPUT N$
LOCATE 12, 25: PRINT "Enter Item 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 "SHOP.DAT"
NAME "TEMP.DAT" AS "SHOP.DAT"
END SUB
SUB menu
CLS
CALL outline
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 Item"
LOCATE 11, 15
PRINT "Display Item"
LOCATE 12, 15
PRINT "Search Item by Code"
LOCATE 13, 15
PRINT "Search Item by Category"
LOCATE 14, 15
PRINT "Edit Item"
LOCATE 15, 15
PRINT "Delete Item"
LOCATE 16, 15
PRINT "Exit"
END SUB
SUB Fin
COLOR 15, 4
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, "*")
FOR i = 7 TO 19
LOCATE i, 18: PRINT "*"
LOCATE i, 61: PRINT "*"
NEXT i
LOCATE 20, 18: PRINT STRING$(44, "*")
COLOR 15
LOCATE 10, 33: PRINT "THANK YOU!!!"
LOCATE 12, 33: PRINT "VISIT AGAIN"
LOCATE 16, 26: PRINT "SUBMITTED BY: SARIKA SHRESTHA"
LOCATE 18, 28: PRINT "SUBMITTED TO: DEEPAK SIR"
END SUB
SUB outline
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 15 + 16: LOCATE 4, 25: PRINT "The S & L Food And Accessories"
COLOR 15, 4
END SUB
Comments