#include
#include
#include
#include
#include
//#include
#include
externfloatvattax=0;
classhead
{
charIname[50][50];
charcname[50];
protected:
inttotalitems;
floatQty[3];
floatprice[3];
intvatprice[3];
voidinput(void);
voidoutput(void);
};
classvat:publichead
{
floatvats;
public:
voidvatcal(void);
voidoutputs(void);
};
//inputcustomernameanditemdetails
voidhead::input(void)
{
cout<<"EnterCustomerName:";
cin>>cname;
cout<<"Howmanyitems"<
cin>>totalitems;
for(inti=0;i
{
cout<<"\nEnterItemName"<
gets(Iname[i]);
cout<<"Cost:"<
cin>>price[i];
cout<<"Quantity:";
cin>>Qty[i];
price[i]=Qty[i]*price[i];
}
}
voidhead::output(void)
{
inta;
ifstreaminfile("COUNT.TXT");
infile>>a;
ofstreamoutfile("COUNT.TXT");
a+=1;
outfile<
outfile.close();
chartmpbuf[128],timebuf[26],ampm[]="AM";
time_tltime;
struct_timebtstruct;
structtmtoday,gmt,xmas={0,0,12,25,11,93};
errno_terr;
//Displayoperatingsystem-styledateandtime.
_strtime_s(tmpbuf,128);
printf("OStime:\t\t\t\t%s\n",tmpbuf);
_strdate_s(tmpbuf,128);
printf("OSdate:\t\t\t\t%s\n",tmpbuf);
structdated;
getdate(&d);
printf("Date:%d",d.da_day);
printf("/%d",d.da_mon);
printf("/%d\t\t\t",d.da_year);
structtimet;
gettime(&t);
printf("Time:%2d:%02d:%02d\nBillNo:%d\n",t.ti_hour,t.ti_min,t.ti_sec,a);
intday,mon,year,hour,min,sec;
day=d.da_day;mon=d.da_mon;year=d.da_year;
hour=t.ti_hour;min=t.ti_min;sec=t.ti_sec;
char*mer[4];
if(hour>12)
{
hour=hour-12;
*mer="P.M.";
}
else
{
*mer="A.M.";
}
{ofstreamoutfile("HIS.TXT",ios::app);
outfile<
outfile<<"————————————————————————"<
cout<<"Nameofitem\tQuantity\tPrice\n";
for(inti=0;i
{
outfile<<"Name:"<
cout<
}
outfile<<"————————————————————————"<
outfile.close();
}
}
voidvat::vatcal(void)
{
input();
for(inti=0;i
{
vatprice[i]=price[i]+(0.1*price[i]);
vattax=vattax+(0.1*price[i]);
}
}
voidvat::outputs(void)
{
output();
floatcash=0,sum=0,qty=0;
for(inti=0;i
{
sum+=vatprice[i];
qty+=Qty[i];
//vattax+=vatprice[i];
}
cout<<"Total:————————————————————————";
cout<<"\n\t\tTax:Rupees:"<
cout<<"\n\t\tQuantity="<
cout<<"\n******************************************************************************";
pay:
cout<<"\nTransactionDetails\n";
cout<<"\nTotalcashgiven:Rupees:";
cin>>cash;
if(cash>=sum)
cout<<"Totalcashrepaid:Rupees:"<
else
{cout<<"Cashgivenislessthantotalamount!!!";
getch();
gotopay;
}
}
voidclrscr()
{
system("cls");
}
voidmain()
{
vatobj;
charopt,ch;
start:
clrscr();
cout<<"****************************\n********SalesInventory*************\n********************************************\nPleaseEnterNumber1toenternewsalesRecordorenter2toviewsalesrecords…";
cout<<"\n1.AddNewsalesRecord\t\n2.\tToviewpreviousentries\n3.\tExit\n";
cout<<"Enteryouroption:";
cin>>opt;
switch(opt)
{
//purchaseitem
case’1′:clrscr();
obj.vatcal();
cout<<"ItemsEnteredSuccessfully…\nPressanykeytocontinue……..";
getch();
clrscr();
obj.outputs();
getch();
gotostart;
//viewitemdetails
case’2′:clrscr();
ifstreamfin;
fin.open("HIS.TXT",ios::in);
while(fin.get(ch))
{
cout<
}
fin.close();
getch();
gotostart;
//closeapplication
case’3′:cout<<"\nThanksforusingSalesInventory\n";
//delay(1000);
exit(0);
}
getch();
}