Académique Documents
Professionnel Documents
Culture Documents
cout<<"***************************************************************";
gotoxy(15,6);
cout<<"1. Cement Inward Entry";
gotoxy(15,8);
cout<<"2. Cement Outward Entry";
gotoxy(15,10);
cout<<"3. Cement Status Report";
gotoxy(15,12);
cout<<"4. Exit";
gotoxy(2,13);
cout<<"***************************************************************";
}
// class contain the data of cement stock
class cement
{
protected:
struct info
{
char flage;
long int R_challan;
int dd1,mm1,yy1;
char truck_no[15];
int dd2,mm2,yy2;
int qtt;
}f;
fstream file;
};
//class for inward cement data
class cement_in:public cement
{
public:
cement_in();
void get_inward() ;// to get the inward cement information
void inward_report() ;// to get inward cement report
int stock_in();
void stock_date();
};
//class cement_in close
//class for outward cement data
class cement_out:public cement
{
public:
cement_out();
void del_data();
//to get the data about delivery
void outward_report(); //to get the outward cement report
int stock_out();
//to get the total cement out
};
//function to get the inward cement entry
void cement_in :: get_inward()
{
file.seekp(0L,ios::end);
do
{
clrscr();
gotoxy(25,3);
cout<<"C E M E N T - I N W O R D - E N T R Y";
gotoxy(2,5);
cout<<"==========================================================
=====";
gotoxy(5,8);
cout<<"Receipt Challan No.: ";
gotoxy(5,10);
cout<<"Challan Date:";
gotoxy(5,12);
cout<<"Truck No.:";
gotoxy(5,14);
cout<<"Receipt Date:";
gotoxy(5,16);
cout<<"Quantity:";
gotoxy(22,16);
cout<<"M.T";
gotoxy(2,19);
cout<<"==========================================================
=====";
gotoxy(2,22) ;
cout<<"Enter the recieve challan no................";
turn:gotoxy(28,8);
cin>>f.R_challan;
if(f.R_challan>999999)
{
gotoxy(28,8);
cout<<"
";
gotoxy(2,22);
cout<<"aChallan no. should not greater then 6 dig.";
goto turn;
}
gotoxy(2,22);
cout<<"Enter the challan date.......................";
turn1:gotoxy(20,10);
cin>>f.dd1;
gotoxy(22,10);
cout<<"-";
gotoxy(23,10);
cin>>f.mm1;
gotoxy(25,10);
cout<<"-";
gotoxy(26,10);
cin>>f.yy1;
if(f.dd1>31||f.mm1>12||f.yy1>99)
{
gotoxy(20,10);
cout<<"
";
gotoxy(2,22);
cout<<"aEnter the valid date........................";
goto turn1;
}
gotoxy(2,22);
cout<<"Enter the truck no. ........................";
gotoxy(17,12);
cin>>f.truck_no;
gotoxy(2,22);
cout<<"Enter the recieving date......................";
// for putting recieving date
turn2:gotoxy(22,14);
cin>>f.dd2;
gotoxy(24,14);
cout<<"-";
gotoxy(25,14);
cin>>f.mm2;
gotoxy(27,14);
cout<<"-";
gotoxy(28,14);
cin>>f.yy2;
if(f.dd2>31||f.mm2>12||f.yy2>99)
{
gotoxy(22,14);
cout<<"
";
gotoxy(2,22);
cout<<"aPlease enter the valid date .................";
goto turn2;
}
// quantity of cement
gotoxy(2,22);
cout<<"Enter the cement quantity..";
gotoxy(15,16);
cin>>f.qtt;
f.flage=NULL;
file.write((char*)&f,sizeof(f));
gotoxy(2,22);
cout<<"Enter another .......................yes-1/no-0 :";
cin>>ans;
} while(ans==1);
}
//function for returning the total stock in store
int cement_in::stock_in()
{
int temp=0;
file.seekg(0L,ios::beg);
while(file.read((char*)&f,sizeof(f)))
{
if(f.flage!='*')
temp=temp+f.qtt;
}
file.clear();
return(temp);
}
void cement_in::inward_report()
{
gotoxy(28,2);
cout<<"I N W A R D - R E P O R T ";
gotoxy(28,3);
cout<<"-------------------------";
gotoxy(3,5);
cout<<"*********************************************************";
gotoxy(3,6);
cout<<"Challan No. Challan-Date Truck-No. Date of Receiv Quantity";
gotoxy(3,7);
cout<<"************************************************************";
file.seekg(0L,ios::beg);
while(file.read((char*)&f,sizeof(f)))
{
if(f.flage!='*')
cout<<"
"<<setw(10)<<f.R_challan<<setw(13)<<f.dd1<<"/"<<f.mm1<<"/"<<f.yy1
<<setw(12)<<f.truck_no<<setw(10)<<f.dd2<<"/"<<f.mm2<<"/"<<f.yy2<<setw(10)<
<f.qtt; delay(200);
}
cout<<"
********************************************************";
file.clear();
}
/* costructor of cement_in class which initialise the opening file cement.dat */
cement_in::cement_in()
{
file.open("cement.dat",ios::binary|ios::in|ios::out);
if(!file)
{
cout<<"ERROR" ;
getch();
}
}
// function of class delivery data , to get the entries of outward
cement
void cement_out::del_data()
{
file.seekp(0L,ios::end);
do
{
clrscr();
gotoxy(28,5);
cout<<"* O U T W A R D - E N T R Y *";
gotoxy(28,6);
cout<<"------------------------------";
gotoxy(3,8);
cout<<"*************************************************************";
gotoxy(3,9) ;
cout<<"Delivery Challan No.:";
gotoxy(3,11);
cout<<"Challan Date:";
gotoxy(3,13);
cout<<"Dlivery Truck No.:";
gotoxy(3,15);
cout<<"Date of Dispatch:";
gotoxy(3,17);
cout<<"Quantity:";
gotoxy(26,17);
cout<<"M.T.";
gotoxy(3,18);
cout<<"*************************************************************";
gotoxy(2,22);
cout<<"Enter the delivery challan no......";
turn:gotoxy(25,9);
cin>>f.R_challan;
if(f.R_challan>999999)
{
gotoxy(25,9);
cout<<"
";//to clear this line
gotoxy(2,22);
cout<<"aChallan no. should not greater then 6 dig.";
goto turn;
}
gotoxy(2,22);
cout<<"Enter the delivery challan date....";
turn1: gotoxy(25,11);
cin>>f.dd1;
//date of challan
gotoxy(27,11) ;
cout<<"-";
gotoxy(28,11);
cin>>f.mm1;
gotoxy(30,11);
cout<<"-";
gotoxy(31,11);
cin>>f.yy1;
if(f.dd1>31||f.mm1>12||f.yy1>99)
{
gotoxy(25,11);
cout<<"
";
gotoxy(2,22);
cout<<"aEnter the valid date........................";
goto turn1;
}
gotoxy(2,22);
cout<<"Enter the delivery truck no. .....";
gotoxy(25,13);
cin>>f.truck_no;
gotoxy(2,22);
cout<<"Enter the cement delivery date....";
turn2: gotoxy(25,15);
cin>>f.dd2;
//for date of deliver
gotoxy(27,15) ;
cout<<"-";
gotoxy(28,15);
cin>>f.mm2;
gotoxy(30,15);
cout<<"-";
gotoxy(31,15);
cin>>f.yy2;
if(f.dd2>31||f.mm2>12||f.yy2>99)
{
gotoxy(25,15);
cout<<"
";
gotoxy(2,22);
cout<<"aEnter the valid date........................";
goto turn2; //cursor again reset
}
gotoxy(2,22);
cout<<"Enter the delivard cement.Qtt.......";
gotoxy(20,17);
cin>>f.qtt;
f.flage=NULL;
file.write((char*)&f,sizeof(f));
gotoxy(2,22);
cout<<"aAdd more? Y/N..................";
cin>>a;
}while(a=='y'||a=='Y');
} //end of function
// function for outward cement menu display
void report_menu(void)
{
clrscr();
gotoxy(31,3);
cout<<" REPORT-MENU " ;
gotoxy(31,4);
cout<<"__________";
gotoxy(4,7);
cout<<"*************************************************************";
gotoxy(10,9);
cout<<"1.Daily Inward Cement Report.";
gotoxy(10,11);
cout<<"2.Daily Outward Cement Report.";
gotoxy(10,13);
cout<<"3.Stock.";
gotoxy(10,15);
cout<<"4.Exit.";
gotoxy(4,17);
cout<<"************************************************************
";
}
//function for outward cement report
void cement_out::outward_report()
{
gotoxy(30,3);
cout<<"O U T W A R D - R E P O R T";
gotoxy(3,6);
cout<<"**************************************************************";
gotoxy(3,7);
cout<<"Challan Chl_date Truck_no Dispatch_date Quantity ";
gotoxy(3,8);
cout<<"*************************************************";
file.seekg(0L,ios::beg);
while(file.read((char*)&f,sizeof(f)))
{
if(f.flage!='*')
cout<<endl<<setw(5)<<f.R_challan<<setw(10)<<f.dd1<<"/"<<f.mm1<<"/"<<f.yy1<<set
w(10);
cout<<f.truck_no<<setw(10)<<f.dd2<<"/"<<f.mm2<<"/"<<f.yy2<<setw(10)<<f.qtt<<set
w(12);
delay(200);
}
cout<<"
************************************************************";
file.clear();
cout<<endl<<"Press any key to continue......";
getch();
}
return(temp);
}
void stock_menu()
{
gotoxy(28,4);
cout<<"S T O C K - S T A T U S ";
gotoxy(28,5);
cout<<"***********************";
gotoxy(17,7);
cout<<"********************************************";
gotoxy(24,8);
cout<<"1.Stock Today.";
gotoxy(24,10);
cout<<"2.Stock At Recieve Date.";
gotoxy(17,11);
cout<<"********************************************";
}
void main()
{ for(int s=1000;s>100;s+50)
{
sound(s);
delay(50);
}
nosound();
textcolor(5);
clrscr();
long int passu;
gotoxy(20,10);
cout<<"Enter the password : ";
cin>>passu ;
if(passu==654321)
{
clrscr();
help();
do
{
cement_in obj1; //class objects
cement_out obj2;
clrscr();
show_menu();
cout<<endl<<"Enter your choice:";
cin>>choice;
switch(choice)
{
//for inward cement entry
case 1:
clrscr();
obj1.get_inward();
break;
// main choice
int q=obj2.stock_out();
gotoxy(50,5);
cout<<"Date:"<<__DATE__;
gotoxy(4,8);
cout<<"
aTotal present stock today :"<<p-q<<" M.T. ";
getch();
break;
case 2:
clrscr();
obj1.stock_date();
getch();
break;
}
} //internal switch closed
}
cout<<endl<<"
aDo you want to quit:-";
cin>>ch;
}while(ch!='y'&&ch!='Y');
textcolor(6);
}
/*if password is not correct*/
else
{
gotoxy(20,12);
cout<<"a Password is not correct" ;
gotoxy(20,13);
cout<<"a You are not authorised person";
getch();
}
}