void CASSETTE :: DISPLAY(void) { MENU menu ; char filename[13] ; strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; char t1[10] ; int t2, cascode ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; gotoxy(5,5) ; cout <<"Enter code of the Cassette " ; gets(t1) ; t2 = atoi(t1) ; cascode = t2 ; if (cascode == 0) return ; clrscr() ; if (!FOUND_CODE(filename,cascode)) { gotoxy(5,5) ; cout <<"\7Record not found" ; getch() ; return ; } LINES line ; line.BOX(2,1,79,25,218) ; DISPLAY_RECORD(filename,cascode) ; gotoxy(5,24) ; cout <<"Press any key to continue..." ; getch() ; }
void CASSETTE :: LIST(void) { MENU menu ; char filename[13] ; strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; DISPLAY_LIST(filename) ; }
void CASSETTE :: DELETION(void) { MENU menu ; char t1[10], ch, filename[13] ; int t2, cascode, valid ; strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; do { valid = 1 ; do { clrscr() ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; gotoxy(5,5) ; cout <<"Enter code of the Cassette or <ENTER> for help " ; gets(t1) ; t2 = atoi(t1) ; cascode = t2 ; if (cascode == 0 && strlen(t1) != 0) return ; if (strlen(t1) == 0) DISPLAY_LIST(filename) ; } while (strlen(t1) == 0) ; if (!FOUND_CODE(filename,cascode)) { valid = 0 ; gotoxy(5,20) ; cout <<"\7Cassette code not found." ; getch() ; } } while (!valid) ; clrscr() ; gotoxy(72,1) ; cout <<"<0>=EXIT" ; DISPLAY_RECORD(filename,cascode) ; do { gotoxy(5,12) ; clreol() ; cout <<"Delete this Cassette Record (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; DELETE_RECORD(filename,cascode) ; gotoxy(5,20) ; cout <<"\7Record Deleted" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; }
void CASSETTE :: MODIFICATION(void) { MENU menu ; char t1[10], ch, filename[13] ; int t2, cascode, valid ; strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; do { valid = 1 ; do { clrscr() ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; gotoxy(5,5) ; cout <<"Enter code of the Cassette or <ENTER> for help " ; gets(t1) ; t2 = atoi(t1) ; cascode = t2 ; if (cascode == 0 && strlen(t1) != 0) return ; if (strlen(t1) == 0) DISPLAY_LIST(filename) ; } while (strlen(t1) == 0) ; if (!FOUND_CODE(filename,cascode)) { valid = 0 ; gotoxy(5,20) ; cout <<"\7Cassette code not found." ; getch() ; } } while (!valid) ; clrscr() ; gotoxy(72,1) ; cout <<"<0>=EXIT" ; DISPLAY_RECORD(filename,cascode) ; do { gotoxy(5,12) ; clreol() ; cout <<"Modify Cassette Name (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; char casname[36] ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER NAME OF THE CASSETTE" ; gotoxy(5,15) ; clreol() ; cout <<"Name : " ; gets(casname) ; if (casname[0] == '0') return ; if (strlen(casname) < 1 || strlen(casname) > 35) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter Correctly (Range: 1..35)" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; do { gotoxy(5,17) ; clreol() ; cout <<"Do you want to save (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; int recno ; recno = RECORDNO(filename,cascode) ; fstream file ; file.open(filename, ios::out | ios::ate) ; strcpy(name,casname) ; int location ; location = (recno-1) * sizeof(CASSETTE) ; file.seekp(location) ; file.write((char *) this, sizeof(CASSETTE)) ; file.close() ; gotoxy(5,20) ; cout <<"\7Record Modified" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; }
void CASSETTE :: ADDITION(void) { MENU menu ; char filename[13], casname[36], ch ; int cascode, valid ; do { strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; cascode = LASTCODE(filename) + 1 ; LINES line ; line.BOX(10,6,71,21,219) ; line.LINE_HOR(11,70,10,196) ; gotoxy(72,1) ; cout <<"<0>=EXIT" ; gotoxy(27,8) ; cout <<"ADDITION OF NEW CASSETTES" ; gotoxy(20,12) ; cout <<"Code # " <<cascode ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER NAME OF THE CASSETTE" ; gotoxy(20,14) ; cout <<" " ; gotoxy(20,14) ; cout <<"Name : " ; gets(casname) ; if (casname[0] == '0') return ; if (strlen(casname) < 1 || strlen(casname) > 35) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter Correctly (Range: 1..35)" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; do { gotoxy(20,17) ; cout <<" " ; gotoxy(20,17) ; cout <<"Do you want to save (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'Y') { char casstatus='A' ; int ccode=0 ; ADD_RECORD(filename,cascode,casname,casstatus,ccode) ; cascode++ ; } do { gotoxy(20,19) ; cout <<" " ; gotoxy(20,19) ; cout <<"Do you want to Add more (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; } while (ch == 'Y') ; }
void ISSUE_RETURN :: ISSUE(void) { MENU menu ; CUSTOMER cust ; CASSETTE cas ; char filename[13] ; strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; char t1[10] ; int t2, cascode, valid ; do { valid = 1 ; do { clrscr() ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; gotoxy(5,5) ; cout <<"Enter code of the Cassette or <ENTER> for help " ; gets(t1) ; t2 = atoi(t1) ; cascode = t2 ; if (cascode == 0 && strlen(t1) != 0) return ; if (strlen(t1) == 0) DISPLAY_LIST(filename) ; } while (strlen(t1) == 0) ; if (!CASSETTE::FOUND_CODE(filename,cascode)) { valid = 0 ; gotoxy(5,20) ; cout <<"\7Cassette code not found. Kindly choose another." ; getch() ; } if (valid && ISSUED(filename,cascode)) { valid = 0 ; gotoxy(5,20) ; cout <<"\7Cassette already issued. Kindly choose another." ; getch() ; } } while (!valid) ; clrscr() ; int ccode ; ccode = CUSTOMER::LASTCODE() + 1 ; char custname[26], custphone[10] ; int d1, m1, y1 ; struct date d; getdate(&d); d1 = d.da_day ; m1 = d.da_mon ; y1 = d.da_year ; gotoxy(5,2) ; cout <<"Date: " <<d1 <<"/" <<m1 <<"/" <<y1 ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; CASSETTE::DISPLAY_RECORD(filename,cascode) ; gotoxy(5,10) ; cout <<"Customer Code # " <<ccode ; gotoxy(5,12) ; cout <<"Name : " ; gotoxy(5,13) ; cout <<"Phone : " ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"Enter the name of the Customer" ; gotoxy(14,12) ; clreol() ; gets(custname) ; strupr(custname) ; if (custname[0] == '0') return ; if (strlen(custname) < 1 || strlen(custname) > 25) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly (Range: 1..25)" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"Enter Phone no. of the Customer" ; gotoxy(14,13) ; clreol() ; gets(custphone) ; if (custphone[0] == '0') return ; if ((strlen(custphone) < 7 && strlen(custphone) > 0) || (strlen(custphone) > 9)) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; UPDATE(filename,cascode,ccode,'N') ; EXTEND_DATE(d1,m1,y1,5) ; d1 = day ; m1 = mon ; y1 = year ; CUSTOMER::ADD_RECORD(ccode,custname,custphone,filename,cascode,d1,m1,y1) ; gotoxy(5,17) ; cout <<"\7CASSETTE ISSUED" ; gotoxy(5,19) ; cout <<"Date of Return : " <<d1 <<"/" <<m1 <<"/" <<y1 ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; }