#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
char acctype,ttype,cf;
float cb,amount,rs;
int ano;
struct bankmaster
{
int Accno;
char AccType;
char Aname[20];
char Add1[20];
char Add2[20];
int Phone;
char Occupation[10];
char Nationality[10];
float Income;
char OpenDate[20];
float CurrBalance;
char ChequeFac;
};
struct rdmaster
{
int Accno;
int NOM;
float ROI;
float AmountDe;
char MDate[20];
float Amount;
};
struct transaction
{
int Accno;
char AccType;
char Trdate[10];
char Trtype;
char TrRemark[30];
int ChequeNo;
int TokenNo;
char Payname[30];
float Amount;
};
struct petty_cash
{
float Amount;
};
void MainMenu();
void MasterMaintenance();
void Addition();
void Modification();
void Deletion();
void Transaction();
void Report();
void CustomerWiseReport();
void BankWiseReport();
void DailyReport();
void printline();
void View();
void Deposit();
void WithDrawl();
void main()
{
MainMenu();
getch();
}
void printline()
{
for(int i=0;i<80;i++)
printf("%c",'*');
printf("\n");
}
void MainMenu()
{
int ch,i;
MENU:
clrscr();
printline();
printf("\n\t\t\t MASTER MAINTENENCE MENU\n");
printline();
printf("\n\n\n\t\t\t\t 1. Master Maintenance");
printf("\n\t\t\t\t 2. Transaction");
printf("\n\t\t\t\t 3. Report ");
printf("\n\t\t\t\t 4. Exit ");
CHOICE:
printf("\n\n\n\n\n\t\t\t Enter Your Choice: ");
scanf("%d",&ch);
if(ch<1&&ch>4)
goto CHOICE;
switch(ch)
{
case 1:
MasterMaintenance();
break;
case 2:
Transaction();
break;
case 3:
Report();
break;
case 4:
exit(0);
break;
}
goto MENU;
}
void MasterMaintenance()
{
int ch,i;
MENU:
clrscr();
printline();
printf("\n\t\t\t\t MASTER MAINTENENCE \n");
printline();
printf("\n\t\t\t\t 1. Addition ");
printf("\n\t\t\t\t 2. Modification ");
printf("\n\t\t\t\t 3. Deletion ");
printf("\n\t\t\t\t 4. View ");
printf("\n\t\t\t\t 5. Privious Menu ");
CHOICE:
printf("\n\n\n\n\n\n\t\t\t\t Enter Your Choice : ");
scanf("%d",&ch);
if(ch<1||ch>5)
goto CHOICE;
switch(ch)
{
case 1:
Addition();
break;
case 2:
Modification();
break;
case 3:
Deletion();
break;
case 4:
View();
break;
case 5:
MainMenu();
}
goto MENU;
}
void Report()
{
int ch,i;
Menu:
clrscr();
printline();
printf("\n\t\t\t\t REPORT \n");
printline();
printf("\n 1. Customer Wise Report ");
printf("\n 2. Bankwise Report ");
printf("\n 3. Daily ");
printf("\n 4. Previous Menu ");
CHOICE:
printf("\n\n\n\t\t Enter Your Choice: ");
scanf("%d",&ch);
if(ch<1||ch>4)
goto CHOICE;
switch(ch)
{
case 1:
CustomerWiseReport();
break;
case 2:
BankWiseReport();
break;
case 3:
DailyReport();
break;
case 4:
MainMenu();
break;
}
goto Menu;
}
void CustomerWiseReport()
{
int no;
struct transaction ts;
FILE *TSF;
TSF=fopen("TS.DAT","rb+");
printf("\n Enter Your Account Number :");
scanf("%d",&no);
while(fread(&ts,sizeof(ts),1,TSF)!=NULL)
{
if(ts.Accno==no)
{
clrscr();
printf("\n\t\t\t CUSTOMER WISE REPORT\n");
printline();
getch();
printf("\n Account Number :%d",ts.Accno);
printf("\n Account Type :%c",'S');
printf("\n Trans Date :%s",ts.Trdate);
printf("\n Trans Type :%c",ts.Trtype);
printf("\n Transaction Remark :%s",ts.TrRemark);
printf("\n Cheneque Number :%d",ts.ChequeNo);
printf("\n Token Number :%d",ts.TokenNo);
printf("\n Payee Name :%s",ts.Payname);
printf("\n Amount :%f\n",ts.Amount);
printline();
getch();
}
}
fclose(TSF);
return;
}
void DailyReport()
{
int no;
char day[30];
struct transaction ts;
FILE *TSF;
TSF=fopen("TS.DAT","rb+");
printf("\n Enter Date :");
fflush(stdin);
gets(day);
while(fread(&ts,sizeof(ts),1,TSF)!=NULL)
{
if(strcmp(strupr(ts.Trdate),strupr(day))==0)
{
clrscr();
printline();
printf("\n\t\t\t DATE WISE REPORT\n");
printline();
printf("\n Account Number :%d",ts.Accno);
printf("\n Account Typer :%c",'C');
printf("\n Trans Type :%c",ts.Trtype);
printf("\n Transaction Remark :%s",ts.TrRemark);
printf("\n Cheneque Number :%d",ts.ChequeNo);
printf("\n Token Number :%d",ts.TokenNo);
printf("\n Payee Name :%s",ts.Payname);
printf("\n Amount :%f\n",ts.Amount);
printline();
getch();
}
}
fclose(TSF);
return;
}
void BankWiseReport()
{
int no;
char atype;
struct bankmaster bm;
FILE *BMF;
BMF=fopen("BMF.DAT","rb+");
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
printline();
printf("\n\t\t\t BANK WISE REPORT\n");
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Curent Balance :%f\n",bm.CurrBalance);
printline();
getch();
}
Report();
return;
}
void Addition()
{
struct bankmaster bm;
struct rdmaster rm;
FILE *BMF,*RDF;
char atype;
int sp=0;
BMF=fopen("BMF.DAT","ab+");
RDF=fopen("RDF.DAT","ab+");
clrscr();
printline();
printf("WELCOME TO ADDITION WINDOW\n");
printline();
printf("\n\n\n\n\n\n\n\n\n\t\t What Type of Account You Want Open [S/C/R] :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
clrscr();
if(atype=='S'||atype=='C')
{
printf("\n\n Enter The Account Number :");
scanf("%d",&bm.Accno);
printf("\n Enter The Account Type :%c",atype);
fflush(stdin);
bm.AccType=atype;
bm.AccType=toupper(bm.AccType);
printf("\n Enter the Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter Address 1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter Address 2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter Occuption :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Nationality :");
fflush(stdin);
gets(bm.Nationality);
printf("\n Enter Income :");
fflush(stdin);
scanf("%f",&bm.Income);
printf("\n Enter Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter Cheque Facility :");
fflush(stdin);
bm.ChequeFac=getchar();
bm.ChequeFac=toupper(bm.ChequeFac);
printf("\n Enter Current Balance :");
fflush(stdin);
scanf("%f",&bm.CurrBalance);
printline();
fwrite(&bm,sizeof(bm),1,BMF);
fflush(stdin);
puts("\n\t\t\t RECORDS ARE SUCCESSFULLY ADDED");
getche();
fclose(BMF);
}
else if(atype=='R')
{
printf("\n Enter The Account Number :");
scanf("%d",&bm.Accno);
sp=bm.Accno;
fflush(stdin);
printf("\n Enter The Account Type :%c",atype);
bm.AccType=toupper(atype);
printf("\n Enter the Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter Address 1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter Address 2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter Occuption :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Nationality :");
fflush(stdin);
gets(bm.Nationality);
printf("\n Enter Income :");
scanf("%f",&bm.Income);
printf("\n Enter Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter Cheque Facility :");
fflush(stdin);
bm.ChequeFac=getchar();
bm.ChequeFac=toupper(bm.ChequeFac);
printf("\n Enter Current Balance :");
scanf("%f",&bm.CurrBalance);
printline();
fwrite(&bm,sizeof(bm),1,BMF);
fclose(BMF);
fflush(stdin);
getch();
clrscr();
printf("\n\n\n\n\n Enter The Account Number :%d",sp);
rm.Accno=sp;
printf("\n Enter The Number of Month :");
scanf("%d",&rm.NOM);
printf("\n Enter The Rate of Interest :");
scanf("%f",&rm.ROI);
printf("\n Enter The Amount Deposited :");
scanf("%f",&rm.AmountDe);
printf("\n Enter The Maturity Date :");
fflush(stdin);
gets(rm.MDate);
printf("\n Enter The Maturity Amount :");
scanf("%f",&rm.Amount );
fwrite(&rm,sizeof(rm),1,RDF);
fflush(stdin);
printf("\n Record Is SuccessFully Added");
printline();
fclose(RDF);
}
return;
}
void Modification()
{
int no;
char atype;
struct bankmaster bm;
struct rdmaster rm;
FILE *BMF,*RDF;
BMF=fopen("BMF.DAT","rb+");
RDF=fopen("RDF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO MODIFICATION WINDOW\n");
printline();
printf("\n\n\n\n\n\n\t\t\t Enter Your Account Number :");
scanf("%d",&no);
printf("\n\t\t\t Enter Your Account Type :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
if(atype=='S'||atype=='C')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printf("\n YOUR ACCOUNT DETAILS ARE \n");
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address 1 :%s",bm.Add1);
printf("\n Address 2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occpution :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
clrscr();
printline();
printf("\n ENTER YOUR ACCOUNT DETAILS FOR TO MODIFY\n ");
printline();
printf("\n\n\n Enter The Account Number :");
scanf("%d",&bm.Accno);
printf("\n Enter The Account Type :");
fflush(stdin);
bm.AccType=toupper(getchar());
printf("\n Enter The Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter The Address1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter The Addess2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter The Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter The Occupation :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Your Nationality :");
fflush(stdin);
gets(bm.Nationality);
clrscr();
printf("\n\n\n\n Enter Yout Income :");
scanf("%f",&bm.Income);
printf("\n Enter The Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter The Cheque Facility :");
fflush(stdin);
bm.ChequeFac=toupper(getchar());
printf("\n Enter The Current Balance :");
scanf("%f",&bm.CurrBalance);
fflush(stdin);
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
puts("\n\n\n\t\t\t RECORD UPDATE SUCCESSFULLY");
getch();
}
}
fclose(BMF);
return;
}
else if(atype=='R')
{
while(fread(&rm,sizeof(rm),1,RDF)!=NULL)
{
if(rm.Accno==no)
{
printline();
printf("\n Account Number :%d",rm.Accno);
printf("\n No of Month :%d",rm.NOM);
printf("\n Rate of Interst :%f",rm.ROI);
printf("\n Amount Deposited :%f",rm.AmountDe);
printf("\n Maturity Date :%s",rm.MDate);
printf("\n Maturity Amount :%f",rm.Amount);
getch();
printf("\n Enter The Account Number :");
scanf("%d",&rm.Accno);
printf("\n Enter The No of Month :");
scanf("%d",&rm.NOM);
printf("\n Enter The Rate of Interst :");
scanf("%f",&rm.ROI);
printf("\n Enter The Amount Deposited :");
scanf("%f",&rm.AmountDe);
printf("\n Enter The Maturity Date :");
fflush(stdin);
gets(rm.MDate);
printf("\n Enter The Maturity Amount :");
scanf("%f",&rm.Amount);
fflush(stdin);
fseek(RDF,-36L,1);
fwrite(&rm,sizeof(rm),1,RDF);
puts("\n\n\n\t\t\t RECORD UPDATE SUCCESSFULLY");
getch();
}
}
fclose(RDF);
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address 1 :%s",bm.Add1);
printf("\n Address 2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occpution :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f",bm.CurrBalance);
getch();
fflush(stdin);
printf("\n Enter The Account Number :");
scanf("%d",&bm.Accno);
printf("\n Enter The Account Type :");
fflush(stdin);
bm.AccType=toupper(getchar());
printf("\n Enter The Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter The Address1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter The Addess2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter The Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter The Occupation :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Your Nationality :");
fflush(stdin);
gets(bm.Nationality);
printf("\n Enter Your Income :");
scanf("%f",&bm.Income);
printf("\n Enter The Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter The Cheque Facility :");
fflush(stdin);
bm.ChequeFac=toupper(getchar());
printf("\n Enter The Current Balance :");
scanf("%f",&bm.CurrBalance);
fflush(stdin);
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
puts("\n\n\n\t\t\t RECORD UPDATE SUCCESSFULLY");
getch();
fclose(BMF);
}
}
}
return;
}
void Deletion()
{
int no;
FILE *BMF,*TEMP,*RDF,*TEMP1;
char atype,flag;
struct bankmaster bm;
struct rdmaster rm;
TEMP=fopen("TEMP.DAT","wb+");
TEMP1=fopen("TEMP1.DAT","wb+");
BMF=fopen("BMF.DAT","rb+");
RDF=fopen("RDF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO DELETION WINDOW\n");
printline();
printf("\n\n\n\n\n\n\t\t\t Enter Your Account Number :");
scanf("%d",&no);
printf("\n\n\t\t\t Enter Your Account Type :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
if(atype=='S'||atype=='C')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
printline();
printf("\n\t\t\tYOUR ACCOUNT DETAILS ARE");
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
printf("\n CONFIRE TO DELETE THIS RECORD [Y/N]: ");
fflush(stdin);
flag=getchar();
if(toupper(flag)!='Y')
{
fwrite(&bm,sizeof(bm),1,TEMP);
continue;
}
}
else
{
fwrite(&bm,sizeof(bm),1,TEMP);
}
}
remove("BMF.DAT");
rename("TEMP.DAT","BMF.DAT");
remove("TEMP.DAT");
fclose(BMF);
return;
}
else if(atype=='R')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
printf("\n CONFIRE TO DELETE THIS RECORD [Y/N] :");
fflush(stdin);
flag=getchar();
if(toupper(flag)!='Y')
{
fwrite(&bm,sizeof(bm),1,TEMP);
continue;
}
}
else
{
fwrite(&bm,sizeof(bm),1,TEMP);
}
}
while(fread(&rm,sizeof(rm),1,RDF)!=NULL)
{
clrscr();
if(rm.Accno==no)
{
printline();
printf("\n Account Number :%d",rm.Accno);
printf("\n No of Month :%d",rm.NOM);
printf("\n Rater Of Interst :%f",rm.ROI);
printf("\n Amount Of Deposite :%f",rm.AmountDe);
printf("\n Maturity Date :%s",rm.MDate);
printf("\n Maturity Amount :%f\n",rm.Amount);
printline();
getch();
printf("\n CONFIRE TO DELETE THIS RECORD [Y/N]: ");
fflush(stdin);
flag=getchar();
if(toupper(flag)!='Y')
{
fwrite(&rm,sizeof(rm),1,TEMP1);
continue;
}
}
else
{
fwrite(&rm,sizeof(rm),1,TEMP1);
}
}
}
remove("BMF.DAT");
rename("TEMP.DAT","BMF.DAT");
remove("TEMP.DAT");
remove("RDF.DAT");
rename("TEMP1.DAT","RDF.DAT");
remove("TEMP1.DAT");
fclose(BMF);
fclose(RDF);
fclose(TEMP);
fclose(TEMP1);
return;
}
void View()
{
int no;
char atype;
struct bankmaster bm;
struct rdmaster rm;
FILE *BMF,*RDF;
BMF=fopen("BMF.DAT","rb+");
RDF=fopen("RDF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO VIEW WINDOW\n");
printline();
printf("\n\n\n\n\n\n\t\t\t Enter Your Account Number :");
scanf("%d",&no);
printf("\n\n\n\t\t\t Enter Your Account Type :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
if(atype=='S'||atype=='C')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
printline();
printf("\n\t\t\tYOUR ACCOUNT DETAILS ARE");
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Curent Balance :%f\n",bm.CurrBalance);
printline();
getch();
}
}
fclose(BMF);
return;
}
else if(atype=='R')
{
clrscr();
while(fread(&rm,sizeof(rm),1,RDF)!=NULL)
{
if(rm.Accno==no)
{
printline();
printf("\n Account Number :%d",rm.Accno);
printf("\n No of Month :%d",rm.NOM);
printf("\n Rate of Interst :%f",rm.ROI);
printf("\n Amount Deposited :%f",rm.AmountDe);
printf("\n Maturity Date :%s",rm.MDate);
printf("\n Maturity Amount :%f\n",rm.Amount);
printline();
getch();
}
}
fclose(RDF);
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
}
}
fclose(BMF);
}
return;
}
void Transaction()
{
struct transaction ts;
struct bankmaster bm;
FILE *TS,*BMF;
TS=fopen("TS.DAT","ab+");
BMF=fopen("BMF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO TRANSACTION WINDOW\n");
printf("*****************************************************************************");
printf("\n Enter Your Account Number :");
scanf("%d",&ano);
ts.Accno=ano;
printf("\n Enter Your Accout Type :");
fflush(stdin);
acctype=getchar();
acctype=toupper(acctype);
ts.AccType==acctype;
printf("\n Enter Your Trans Type :");
fflush(stdin);
ttype=getchar();
ttype=toupper(ttype);
ts.Trtype=ttype;
printf("\n Enter The Transation Date :");
fflush(stdin);
gets(ts.Trdate);
printf("\n Enter The Transfer Remark :");
fflush(stdin);
gets(ts.TrRemark);
printf("\n Enter The Cheque Number :");
scanf("%d",&ts.ChequeNo);
printf("\n Enter The Token Number :");
scanf("%d",&ts.TokenNo);
printf("\n Enter The Payee Name :");
fflush(stdin);
gets(ts.Payname);
printf("\n Enter The Amount :");
scanf("%f",&ts.Amount);
amount=ts.Amount;
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
if(bm.Accno==ano)
{
cb=bm.CurrBalance;
cf=bm.ChequeFac;
}
}
rs=cb-amount;
if( (acctype=='R'&&ttype=='I')||(acctype=='S'&&ttype=='D')||(acctype=='C'&&ttype=='D') )
{
fclose(BMF);
Deposit();
}
if(acctype=='S'&&ttype=='W')
{
if(rs>250&&cf=='Y')
{
fclose(BMF);
WithDrawl();
}
else if(rs>150&&cf=='N')
{
fclose(BMF);
WithDrawl();
}
}
if(acctype=='C'&&ttype=='W')
{
if(rs>500&&cf=='Y')
{
fclose(BMF);
WithDrawl();
}
else if(rs>250&&cf=='N')
{
fclose(BMF);
WithDrawl();
}
}
printline();
fwrite(&ts,sizeof(ts),1,TS);
fflush(stdin);
puts("\n\t\t RECORD IS SUCCESSFULLY TRANSACTIONED");
getch();
fclose(TS);
fclose(BMF);
return;
}
void Deposit()
{
FILE *BMF;
struct bankmaster bm;
BMF=fopen("BMF.DAT","rb+");
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
if(bm.Accno==ano)
{
bm.CurrBalance=cb+amount;
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
}
}
fclose(BMF);
return;
}
void WithDrawl()
{
FILE *BMF;
struct bankmaster bm;
BMF=fopen("BMF.DAT","rb+");
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
if(bm.Accno==ano)
{
bm.CurrBalance=cb-amount;
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
}
}
fclose(BMF);
return;
}
#include<stdlib.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
char acctype,ttype,cf;
float cb,amount,rs;
int ano;
struct bankmaster
{
int Accno;
char AccType;
char Aname[20];
char Add1[20];
char Add2[20];
int Phone;
char Occupation[10];
char Nationality[10];
float Income;
char OpenDate[20];
float CurrBalance;
char ChequeFac;
};
struct rdmaster
{
int Accno;
int NOM;
float ROI;
float AmountDe;
char MDate[20];
float Amount;
};
struct transaction
{
int Accno;
char AccType;
char Trdate[10];
char Trtype;
char TrRemark[30];
int ChequeNo;
int TokenNo;
char Payname[30];
float Amount;
};
struct petty_cash
{
float Amount;
};
void MainMenu();
void MasterMaintenance();
void Addition();
void Modification();
void Deletion();
void Transaction();
void Report();
void CustomerWiseReport();
void BankWiseReport();
void DailyReport();
void printline();
void View();
void Deposit();
void WithDrawl();
void main()
{
MainMenu();
getch();
}
void printline()
{
for(int i=0;i<80;i++)
printf("%c",'*');
printf("\n");
}
void MainMenu()
{
int ch,i;
MENU:
clrscr();
printline();
printf("\n\t\t\t MASTER MAINTENENCE MENU\n");
printline();
printf("\n\n\n\t\t\t\t 1. Master Maintenance");
printf("\n\t\t\t\t 2. Transaction");
printf("\n\t\t\t\t 3. Report ");
printf("\n\t\t\t\t 4. Exit ");
CHOICE:
printf("\n\n\n\n\n\t\t\t Enter Your Choice: ");
scanf("%d",&ch);
if(ch<1&&ch>4)
goto CHOICE;
switch(ch)
{
case 1:
MasterMaintenance();
break;
case 2:
Transaction();
break;
case 3:
Report();
break;
case 4:
exit(0);
break;
}
goto MENU;
}
void MasterMaintenance()
{
int ch,i;
MENU:
clrscr();
printline();
printf("\n\t\t\t\t MASTER MAINTENENCE \n");
printline();
printf("\n\t\t\t\t 1. Addition ");
printf("\n\t\t\t\t 2. Modification ");
printf("\n\t\t\t\t 3. Deletion ");
printf("\n\t\t\t\t 4. View ");
printf("\n\t\t\t\t 5. Privious Menu ");
CHOICE:
printf("\n\n\n\n\n\n\t\t\t\t Enter Your Choice : ");
scanf("%d",&ch);
if(ch<1||ch>5)
goto CHOICE;
switch(ch)
{
case 1:
Addition();
break;
case 2:
Modification();
break;
case 3:
Deletion();
break;
case 4:
View();
break;
case 5:
MainMenu();
}
goto MENU;
}
void Report()
{
int ch,i;
Menu:
clrscr();
printline();
printf("\n\t\t\t\t REPORT \n");
printline();
printf("\n 1. Customer Wise Report ");
printf("\n 2. Bankwise Report ");
printf("\n 3. Daily ");
printf("\n 4. Previous Menu ");
CHOICE:
printf("\n\n\n\t\t Enter Your Choice: ");
scanf("%d",&ch);
if(ch<1||ch>4)
goto CHOICE;
switch(ch)
{
case 1:
CustomerWiseReport();
break;
case 2:
BankWiseReport();
break;
case 3:
DailyReport();
break;
case 4:
MainMenu();
break;
}
goto Menu;
}
void CustomerWiseReport()
{
int no;
struct transaction ts;
FILE *TSF;
TSF=fopen("TS.DAT","rb+");
printf("\n Enter Your Account Number :");
scanf("%d",&no);
while(fread(&ts,sizeof(ts),1,TSF)!=NULL)
{
if(ts.Accno==no)
{
clrscr();
printf("\n\t\t\t CUSTOMER WISE REPORT\n");
printline();
getch();
printf("\n Account Number :%d",ts.Accno);
printf("\n Account Type :%c",'S');
printf("\n Trans Date :%s",ts.Trdate);
printf("\n Trans Type :%c",ts.Trtype);
printf("\n Transaction Remark :%s",ts.TrRemark);
printf("\n Cheneque Number :%d",ts.ChequeNo);
printf("\n Token Number :%d",ts.TokenNo);
printf("\n Payee Name :%s",ts.Payname);
printf("\n Amount :%f\n",ts.Amount);
printline();
getch();
}
}
fclose(TSF);
return;
}
void DailyReport()
{
int no;
char day[30];
struct transaction ts;
FILE *TSF;
TSF=fopen("TS.DAT","rb+");
printf("\n Enter Date :");
fflush(stdin);
gets(day);
while(fread(&ts,sizeof(ts),1,TSF)!=NULL)
{
if(strcmp(strupr(ts.Trdate),strupr(day))==0)
{
clrscr();
printline();
printf("\n\t\t\t DATE WISE REPORT\n");
printline();
printf("\n Account Number :%d",ts.Accno);
printf("\n Account Typer :%c",'C');
printf("\n Trans Type :%c",ts.Trtype);
printf("\n Transaction Remark :%s",ts.TrRemark);
printf("\n Cheneque Number :%d",ts.ChequeNo);
printf("\n Token Number :%d",ts.TokenNo);
printf("\n Payee Name :%s",ts.Payname);
printf("\n Amount :%f\n",ts.Amount);
printline();
getch();
}
}
fclose(TSF);
return;
}
void BankWiseReport()
{
int no;
char atype;
struct bankmaster bm;
FILE *BMF;
BMF=fopen("BMF.DAT","rb+");
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
printline();
printf("\n\t\t\t BANK WISE REPORT\n");
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Curent Balance :%f\n",bm.CurrBalance);
printline();
getch();
}
Report();
return;
}
void Addition()
{
struct bankmaster bm;
struct rdmaster rm;
FILE *BMF,*RDF;
char atype;
int sp=0;
BMF=fopen("BMF.DAT","ab+");
RDF=fopen("RDF.DAT","ab+");
clrscr();
printline();
printf("WELCOME TO ADDITION WINDOW\n");
printline();
printf("\n\n\n\n\n\n\n\n\n\t\t What Type of Account You Want Open [S/C/R] :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
clrscr();
if(atype=='S'||atype=='C')
{
printf("\n\n Enter The Account Number :");
scanf("%d",&bm.Accno);
printf("\n Enter The Account Type :%c",atype);
fflush(stdin);
bm.AccType=atype;
bm.AccType=toupper(bm.AccType);
printf("\n Enter the Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter Address 1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter Address 2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter Occuption :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Nationality :");
fflush(stdin);
gets(bm.Nationality);
printf("\n Enter Income :");
fflush(stdin);
scanf("%f",&bm.Income);
printf("\n Enter Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter Cheque Facility :");
fflush(stdin);
bm.ChequeFac=getchar();
bm.ChequeFac=toupper(bm.ChequeFac);
printf("\n Enter Current Balance :");
fflush(stdin);
scanf("%f",&bm.CurrBalance);
printline();
fwrite(&bm,sizeof(bm),1,BMF);
fflush(stdin);
puts("\n\t\t\t RECORDS ARE SUCCESSFULLY ADDED");
getche();
fclose(BMF);
}
else if(atype=='R')
{
printf("\n Enter The Account Number :");
scanf("%d",&bm.Accno);
sp=bm.Accno;
fflush(stdin);
printf("\n Enter The Account Type :%c",atype);
bm.AccType=toupper(atype);
printf("\n Enter the Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter Address 1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter Address 2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter Occuption :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Nationality :");
fflush(stdin);
gets(bm.Nationality);
printf("\n Enter Income :");
scanf("%f",&bm.Income);
printf("\n Enter Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter Cheque Facility :");
fflush(stdin);
bm.ChequeFac=getchar();
bm.ChequeFac=toupper(bm.ChequeFac);
printf("\n Enter Current Balance :");
scanf("%f",&bm.CurrBalance);
printline();
fwrite(&bm,sizeof(bm),1,BMF);
fclose(BMF);
fflush(stdin);
getch();
clrscr();
printf("\n\n\n\n\n Enter The Account Number :%d",sp);
rm.Accno=sp;
printf("\n Enter The Number of Month :");
scanf("%d",&rm.NOM);
printf("\n Enter The Rate of Interest :");
scanf("%f",&rm.ROI);
printf("\n Enter The Amount Deposited :");
scanf("%f",&rm.AmountDe);
printf("\n Enter The Maturity Date :");
fflush(stdin);
gets(rm.MDate);
printf("\n Enter The Maturity Amount :");
scanf("%f",&rm.Amount );
fwrite(&rm,sizeof(rm),1,RDF);
fflush(stdin);
printf("\n Record Is SuccessFully Added");
printline();
fclose(RDF);
}
return;
}
void Modification()
{
int no;
char atype;
struct bankmaster bm;
struct rdmaster rm;
FILE *BMF,*RDF;
BMF=fopen("BMF.DAT","rb+");
RDF=fopen("RDF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO MODIFICATION WINDOW\n");
printline();
printf("\n\n\n\n\n\n\t\t\t Enter Your Account Number :");
scanf("%d",&no);
printf("\n\t\t\t Enter Your Account Type :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
if(atype=='S'||atype=='C')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printf("\n YOUR ACCOUNT DETAILS ARE \n");
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address 1 :%s",bm.Add1);
printf("\n Address 2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occpution :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
clrscr();
printline();
printf("\n ENTER YOUR ACCOUNT DETAILS FOR TO MODIFY\n ");
printline();
printf("\n\n\n Enter The Account Number :");
scanf("%d",&bm.Accno);
printf("\n Enter The Account Type :");
fflush(stdin);
bm.AccType=toupper(getchar());
printf("\n Enter The Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter The Address1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter The Addess2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter The Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter The Occupation :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Your Nationality :");
fflush(stdin);
gets(bm.Nationality);
clrscr();
printf("\n\n\n\n Enter Yout Income :");
scanf("%f",&bm.Income);
printf("\n Enter The Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter The Cheque Facility :");
fflush(stdin);
bm.ChequeFac=toupper(getchar());
printf("\n Enter The Current Balance :");
scanf("%f",&bm.CurrBalance);
fflush(stdin);
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
puts("\n\n\n\t\t\t RECORD UPDATE SUCCESSFULLY");
getch();
}
}
fclose(BMF);
return;
}
else if(atype=='R')
{
while(fread(&rm,sizeof(rm),1,RDF)!=NULL)
{
if(rm.Accno==no)
{
printline();
printf("\n Account Number :%d",rm.Accno);
printf("\n No of Month :%d",rm.NOM);
printf("\n Rate of Interst :%f",rm.ROI);
printf("\n Amount Deposited :%f",rm.AmountDe);
printf("\n Maturity Date :%s",rm.MDate);
printf("\n Maturity Amount :%f",rm.Amount);
getch();
printf("\n Enter The Account Number :");
scanf("%d",&rm.Accno);
printf("\n Enter The No of Month :");
scanf("%d",&rm.NOM);
printf("\n Enter The Rate of Interst :");
scanf("%f",&rm.ROI);
printf("\n Enter The Amount Deposited :");
scanf("%f",&rm.AmountDe);
printf("\n Enter The Maturity Date :");
fflush(stdin);
gets(rm.MDate);
printf("\n Enter The Maturity Amount :");
scanf("%f",&rm.Amount);
fflush(stdin);
fseek(RDF,-36L,1);
fwrite(&rm,sizeof(rm),1,RDF);
puts("\n\n\n\t\t\t RECORD UPDATE SUCCESSFULLY");
getch();
}
}
fclose(RDF);
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address 1 :%s",bm.Add1);
printf("\n Address 2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occpution :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f",bm.CurrBalance);
getch();
fflush(stdin);
printf("\n Enter The Account Number :");
scanf("%d",&bm.Accno);
printf("\n Enter The Account Type :");
fflush(stdin);
bm.AccType=toupper(getchar());
printf("\n Enter The Accounter Name :");
fflush(stdin);
gets(bm.Aname);
printf("\n Enter The Address1 :");
fflush(stdin);
gets(bm.Add1);
printf("\n Enter The Addess2 :");
fflush(stdin);
gets(bm.Add2);
printf("\n Enter The Phone Number :");
scanf("%d",&bm.Phone);
printf("\n Enter The Occupation :");
fflush(stdin);
gets(bm.Occupation);
printf("\n Enter Your Nationality :");
fflush(stdin);
gets(bm.Nationality);
printf("\n Enter Your Income :");
scanf("%f",&bm.Income);
printf("\n Enter The Opening Date :");
fflush(stdin);
gets(bm.OpenDate);
printf("\n Enter The Cheque Facility :");
fflush(stdin);
bm.ChequeFac=toupper(getchar());
printf("\n Enter The Current Balance :");
scanf("%f",&bm.CurrBalance);
fflush(stdin);
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
puts("\n\n\n\t\t\t RECORD UPDATE SUCCESSFULLY");
getch();
fclose(BMF);
}
}
}
return;
}
void Deletion()
{
int no;
FILE *BMF,*TEMP,*RDF,*TEMP1;
char atype,flag;
struct bankmaster bm;
struct rdmaster rm;
TEMP=fopen("TEMP.DAT","wb+");
TEMP1=fopen("TEMP1.DAT","wb+");
BMF=fopen("BMF.DAT","rb+");
RDF=fopen("RDF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO DELETION WINDOW\n");
printline();
printf("\n\n\n\n\n\n\t\t\t Enter Your Account Number :");
scanf("%d",&no);
printf("\n\n\t\t\t Enter Your Account Type :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
if(atype=='S'||atype=='C')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
printline();
printf("\n\t\t\tYOUR ACCOUNT DETAILS ARE");
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
printf("\n CONFIRE TO DELETE THIS RECORD [Y/N]: ");
fflush(stdin);
flag=getchar();
if(toupper(flag)!='Y')
{
fwrite(&bm,sizeof(bm),1,TEMP);
continue;
}
}
else
{
fwrite(&bm,sizeof(bm),1,TEMP);
}
}
remove("BMF.DAT");
rename("TEMP.DAT","BMF.DAT");
remove("TEMP.DAT");
fclose(BMF);
return;
}
else if(atype=='R')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
printf("\n CONFIRE TO DELETE THIS RECORD [Y/N] :");
fflush(stdin);
flag=getchar();
if(toupper(flag)!='Y')
{
fwrite(&bm,sizeof(bm),1,TEMP);
continue;
}
}
else
{
fwrite(&bm,sizeof(bm),1,TEMP);
}
}
while(fread(&rm,sizeof(rm),1,RDF)!=NULL)
{
clrscr();
if(rm.Accno==no)
{
printline();
printf("\n Account Number :%d",rm.Accno);
printf("\n No of Month :%d",rm.NOM);
printf("\n Rater Of Interst :%f",rm.ROI);
printf("\n Amount Of Deposite :%f",rm.AmountDe);
printf("\n Maturity Date :%s",rm.MDate);
printf("\n Maturity Amount :%f\n",rm.Amount);
printline();
getch();
printf("\n CONFIRE TO DELETE THIS RECORD [Y/N]: ");
fflush(stdin);
flag=getchar();
if(toupper(flag)!='Y')
{
fwrite(&rm,sizeof(rm),1,TEMP1);
continue;
}
}
else
{
fwrite(&rm,sizeof(rm),1,TEMP1);
}
}
}
remove("BMF.DAT");
rename("TEMP.DAT","BMF.DAT");
remove("TEMP.DAT");
remove("RDF.DAT");
rename("TEMP1.DAT","RDF.DAT");
remove("TEMP1.DAT");
fclose(BMF);
fclose(RDF);
fclose(TEMP);
fclose(TEMP1);
return;
}
void View()
{
int no;
char atype;
struct bankmaster bm;
struct rdmaster rm;
FILE *BMF,*RDF;
BMF=fopen("BMF.DAT","rb+");
RDF=fopen("RDF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO VIEW WINDOW\n");
printline();
printf("\n\n\n\n\n\n\t\t\t Enter Your Account Number :");
scanf("%d",&no);
printf("\n\n\n\t\t\t Enter Your Account Type :");
fflush(stdin);
atype=getchar();
atype=toupper(atype);
if(atype=='S'||atype=='C')
{
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
printline();
printf("\n\t\t\tYOUR ACCOUNT DETAILS ARE");
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Curent Balance :%f\n",bm.CurrBalance);
printline();
getch();
}
}
fclose(BMF);
return;
}
else if(atype=='R')
{
clrscr();
while(fread(&rm,sizeof(rm),1,RDF)!=NULL)
{
if(rm.Accno==no)
{
printline();
printf("\n Account Number :%d",rm.Accno);
printf("\n No of Month :%d",rm.NOM);
printf("\n Rate of Interst :%f",rm.ROI);
printf("\n Amount Deposited :%f",rm.AmountDe);
printf("\n Maturity Date :%s",rm.MDate);
printf("\n Maturity Amount :%f\n",rm.Amount);
printline();
getch();
}
}
fclose(RDF);
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
clrscr();
if(bm.Accno==no)
{
printline();
printf("\n Account Number :%d",bm.Accno);
printf("\n Account Type :%c",bm.AccType);
printf("\n Accounter Name :%s",bm.Aname);
printf("\n Address1 :%s",bm.Add1);
printf("\n Address2 :%s",bm.Add2);
printf("\n Phone Number :%d",bm.Phone);
printf("\n Occupation :%s",bm.Occupation);
printf("\n Nationality :%s",bm.Nationality);
printf("\n Income :%f",bm.Income);
printf("\n Opening Date :%s",bm.OpenDate);
printf("\n Cheque Facility :%c",bm.ChequeFac);
printf("\n Current Balance :%f\n",bm.CurrBalance);
printline();
getch();
}
}
fclose(BMF);
}
return;
}
void Transaction()
{
struct transaction ts;
struct bankmaster bm;
FILE *TS,*BMF;
TS=fopen("TS.DAT","ab+");
BMF=fopen("BMF.DAT","rb+");
clrscr();
printline();
printf("\t\t\tWELCOME TO TRANSACTION WINDOW\n");
printf("*****************************************************************************");
printf("\n Enter Your Account Number :");
scanf("%d",&ano);
ts.Accno=ano;
printf("\n Enter Your Accout Type :");
fflush(stdin);
acctype=getchar();
acctype=toupper(acctype);
ts.AccType==acctype;
printf("\n Enter Your Trans Type :");
fflush(stdin);
ttype=getchar();
ttype=toupper(ttype);
ts.Trtype=ttype;
printf("\n Enter The Transation Date :");
fflush(stdin);
gets(ts.Trdate);
printf("\n Enter The Transfer Remark :");
fflush(stdin);
gets(ts.TrRemark);
printf("\n Enter The Cheque Number :");
scanf("%d",&ts.ChequeNo);
printf("\n Enter The Token Number :");
scanf("%d",&ts.TokenNo);
printf("\n Enter The Payee Name :");
fflush(stdin);
gets(ts.Payname);
printf("\n Enter The Amount :");
scanf("%f",&ts.Amount);
amount=ts.Amount;
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
if(bm.Accno==ano)
{
cb=bm.CurrBalance;
cf=bm.ChequeFac;
}
}
rs=cb-amount;
if( (acctype=='R'&&ttype=='I')||(acctype=='S'&&ttype=='D')||(acctype=='C'&&ttype=='D') )
{
fclose(BMF);
Deposit();
}
if(acctype=='S'&&ttype=='W')
{
if(rs>250&&cf=='Y')
{
fclose(BMF);
WithDrawl();
}
else if(rs>150&&cf=='N')
{
fclose(BMF);
WithDrawl();
}
}
if(acctype=='C'&&ttype=='W')
{
if(rs>500&&cf=='Y')
{
fclose(BMF);
WithDrawl();
}
else if(rs>250&&cf=='N')
{
fclose(BMF);
WithDrawl();
}
}
printline();
fwrite(&ts,sizeof(ts),1,TS);
fflush(stdin);
puts("\n\t\t RECORD IS SUCCESSFULLY TRANSACTIONED");
getch();
fclose(TS);
fclose(BMF);
return;
}
void Deposit()
{
FILE *BMF;
struct bankmaster bm;
BMF=fopen("BMF.DAT","rb+");
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
if(bm.Accno==ano)
{
bm.CurrBalance=cb+amount;
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
}
}
fclose(BMF);
return;
}
void WithDrawl()
{
FILE *BMF;
struct bankmaster bm;
BMF=fopen("BMF.DAT","rb+");
while(fread(&bm,sizeof(bm),1,BMF)!=NULL)
{
if(bm.Accno==ano)
{
bm.CurrBalance=cb-amount;
fseek(BMF,-114L,1);
fwrite(&bm,sizeof(bm),1,BMF);
}
}
fclose(BMF);
return;
}
No comments:
Post a Comment