#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main ()
{
//====================================
string name, discount2, trick;
string serv1, serv2, serv3;
string serv1b, serv2b, serv3b;
char srv1, srv2, srv3;
char cnfirm, cnfirm2, cnfirm3, cnfirmx;
int confirmy;
int mon1=0, mon2=0, mon3=0;
int times1=0, times2=0, times3=0;
int total1, total2, total3;
int totalx, totaly, discount;
//----admin----------------
int tpatient=0, tincome=0, tfiling=0, tcleaning=0, txray=0;
startover:
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY |
FOREGROUND_BLUE | FOREGROUND_BLUE );
cout<<"###############################################################################"<<endl;
cout<<"###### ########################"<<endl;
cout<<"###### MY DENTAL CLINIC SYSTEM ########################"<<endl;
cout<<"###### ########################"<<endl;
cout<<"###############################################################################"<<endl<<endl;
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY |
FOREGROUND_YELLOW | FOREGROUND_YELLOW );
cout<<"*******************************************************************************"<<endl<<endl;
cout<<"-----------------------------"<<endl;
cout<<"| ! | Press Enter to start"<<endl;
cout<<"-----------------------------"<<endl<<endl;
getline(cin,trick);
cout<<"Patient name: ";
getline(cin,name);
cout<<"please chose one service number ony on the menu below"<<endl;
cout<<"[1] --> Filing (RM 100)"<<endl;
cout<<"[2] --> Cleaning (RM 75)"<<endl;
cout<<"[3] --> X-Ray (RM 130)"<<endl<<endl;
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY |
FOREGROUND_BLUE | FOREGROUND_GREEN );
enterback:
cout<<"So, your number of service: "<<endl;
//-----------------
cout<<"-----------------------------------------------------------------"<<endl;
cout<<"-->--[1] --> Filing (RM 100)"<<endl;
next00:
cout<<" Do you want this service? (Y/N)";
cin>>srv1;
if (srv1=='y'||srv1=='Y')
{
mon1=100;
}
else if (srv1=='n'||srv1=='N')
{
times1=0;
goto next1;
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto next00;
}
cout<<" Please enter the number of how many times the service needed :";
cin>>times1;
cout<<endl;
//-----------------
next1:
cout<<"-----------------------------------------------------------------"<<endl;
cout<<"-->--[2] --> Cleaning (RM 75)"<<endl;
next01:
cout<<" Do you want this service? (Y/N)";
cin>>srv2;
if (srv2=='y'||srv2=='Y')
{
mon2=75;
}
else if (srv2=='n'||srv2=='N')
{
times2=0;
goto next2;
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto next01;
}
cout<<" Please enter the number of how many times the service needed :";
cin>>times2;
cout<<endl;
//-----------------
next2:
cout<<"-----------------------------------------------------------------"<<endl;
cout<<"-->--[3] --> X-Ray (RM 130)"<<endl;
next02:
cout<<" Do you want this service? (Y/N)";
cin>>srv3;
if (srv3=='y'||srv3=='Y')
{
mon3=130;
}
else if (srv3=='n'||srv3=='N')
{
times3=0;
goto next3;
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto next02;
}
cout<<" Please enter the number of how many times the service needed :";
cin>>times3;
cout<<endl;
//-----------------
next3:
cout<<endl;
cout<<"================================================================="<<endl;
cout<<"| | OK confirm? |"<<endl;
cout<<"| === | [Y] Yes |"<<endl;
cout<<"| === | [N] No, I want to repeat the service order again |"<<endl;
confirmback:
cout<<"| | Answer (Y/N): ";cin>>cnfirm;
cout<<"================================================================="<<endl;
if (cnfirm=='y'||cnfirm=='Y')
{
cout<<"OK here we go..."<<endl;
goto calc;
}
else if (cnfirm=='n'||cnfirm=='N')
{
cout<<"Alright... ";
goto enterback;
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto confirmback;
}
//================================================
calc:
total1=mon1*times1;
total2=mon2*times2;
total3=mon3*times3;
totalx=total1+total2+total3;
if (totalx>=150)
{
discount2="15%";
discount=totalx*15/100;
}
else
{
discount2="0%";
discount=0;
}
totaly = totalx-discount;
//=== for stats =========
tpatient=tpatient++;
tincome=tincome+totaly;
tfiling=tfiling+times1;
tcleaning=tcleaning+times2;
txray=txray+times3;
//=== for stats =========
cout<<endl<<endl;
cout<<"*******************************************************************************"<<endl<<endl;
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY | // Set Text color
FOREGROUND_GREEN | FOREGROUND_GREEN );// | // Text color.
//BACKGROUND_INTENSITY | // Set Background color
//BACKGROUND_BLACK | BACKGROUND_BLACK | BACKGROUND_BLACK ); // Bg COLOR.
cout<<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX DENTAL CLINIC SYSTEM XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX WELCOME XX"<<endl;
cout<<"XX Patient name: "<<name<<" "<<endl;
cout<<"XX XX"<<endl;
cout<<"XX Name of service -Price (RM)- -Service taken- -Total-"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX [1] --> Filing RM 100 "<<times1<<" "<<total1<<""<<endl;
cout<<"XX [2] --> Cleaning RM 75 "<<times2<<" "<<total2<<""<<endl;
cout<<"XX [3] --> X-Ray RM 130 "<<times3<<" "<<total3<<""<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX price before discount: RM "<<totalx<<endl;
cout<<"XX discount: "<<discount2<<endl;
cout<<"XX Amount of discount: RM "<<discount<<endl;
cout<<" TOTAL: RM "<<totaly<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"DENTAL thank you and come again! DENTAL"<<endl;
cout<<"DENTAL DENTAL"<<endl;
cout<<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"<<endl<<endl<<endl;
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY | // Set Text color
FOREGROUND_BLUE | FOREGROUND_GREEN );// | // Text color.
//BACKGROUND_INTENSITY | // Set Background color
//BACKGROUND_BLACK | BACKGROUND_BLACK | BACKGROUND_BLACK ); // Bg COLOR.
cout<<"Do you want to enter new patient's service?"<<endl;
cout<<"================================================================="<<endl;
cout<<"| #### | Done! |"<<endl;
cout<<"| # # | |"<<endl;
cout<<"| # | Do you want to enter new patient's service? |"<<endl;
cout<<"| o | |"<<endl;
confirmback2:
cout<<"| | Answer (Y/N): ";cin>>cnfirm2;
cout<<"================================================================="<<endl;
if (cnfirm2=='y'||cnfirm2=='Y')
{
cout<<"OK here we start again... "<<endl;
goto startover;
}
else if (cnfirm2=='n'||cnfirm2=='N')
{
//====start=================
cout<<"================================================================="<<endl;
cout<<"| #### | Closing |"<<endl;
cout<<"| # # | |"<<endl;
cout<<"| # | Do you want to make the closing statistics now? |"<<endl;
cout<<"| o | |"<<endl;
confirmback3:
cout<<"| | Answer (Y/N): ";cin>>cnfirm3;
cout<<"================================================================="<<endl;
if (cnfirm3=='y'||cnfirm3=='Y')
{
cout<<"OK here we go... ";
goto closing;
}
else if (cnfirm3=='n'||cnfirm3=='N')
{
cout<<"Alright... ";
goto endprogram;
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto confirmback3;
}
//====end===================
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto confirmback2;
}
closing:
cout<<"*******************************************************************************"<<endl<<endl;
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY | // Set Text color
FOREGROUND_GREEN | FOREGROUND_GREEN );// | // Text color.
//BACKGROUND_INTENSITY | // Set Background color
//BACKGROUND_BLACK | BACKGROUND_BLACK | BACKGROUND_BLACK ); // Bg COLOR.
cout<<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX DENTAL CLINIC SYSTEM XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX Good day Admin! XX"<<endl;
cout<<"XX Statistics for today: XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"XX Num. of patient : "<<tpatient<<endl;
cout<<"XX Num. of Filing service done : "<<tfiling<<endl;
cout<<"XX Num. of Cleaning service done : "<<tcleaning<<endl;
cout<<"XX Num. of X-Ray service done : "<<txray<<endl;
cout<<"XX XX"<<endl;
cout<<"XX Total income for today : RM"<<tincome<<endl;
cout<<"XX XX"<<endl;
cout<<"XX XX"<<endl;
cout<<"DENTAL DENTAL"<<endl;
cout<<"DENTAL DENTAL"<<endl;
cout<<"HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"<<endl<<endl<<endl;
endprogram:
SetConsoleTextAttribute(
GetStdHandle( STD_OUTPUT_HANDLE ),
FOREGROUND_INTENSITY | // Set Text color
FOREGROUND_BLUE | FOREGROUND_GREEN );// | // Text color.
//BACKGROUND_INTENSITY | // Set Background color
//BACKGROUND_BLACK | BACKGROUND_BLACK | BACKGROUND_BLACK ); // Bg COLOR.
cout<<"Do you want to enter new patient's service?"<<endl;
cout<<"================================================================="<<endl;
cout<<"| #### | Done! |"<<endl;
cout<<"| # # | |"<<endl;
cout<<"| # | Do you want to exit now? |"<<endl;
cout<<"| o | |"<<endl;
confirmbackx:
cout<<"| | Answer (Y/N): ";cin>>cnfirmx;
cout<<"================================================================="<<endl;
if (cnfirmx=='y'||cnfirmx=='Y')
{
goto totalend;
}
else if (cnfirmx=='n'||cnfirmx=='N')
{
//====start=================
cout<<"================================================================="<<endl;
cout<<"| #### | Before return |"<<endl;
cout<<"| # # | |"<<endl;
cout<<"| # | Do you want to add more new record or start |"<<endl;
cout<<"| o | fresh record for this clinic? |"<<endl;
confirmbacky:
cout<<"| | [ 1 ] --> add more new record |"<<endl;
cout<<"| | [ 2 ] --> start fresh record |"<<endl;
cout<<"| | [ 3 ] --> I change my mind, I want to exit |"<<endl;
cout<<"| | Answer (1/2/3): ";cin>>confirmy;
cout<<"================================================================="<<endl;
if (confirmy==1||confirmy==1)
{
cout<<"OK here we go... "<<endl;
goto startover;
}
else if (confirmy==2||confirmy==2)
{
cout<<"Alright, please wait... "<<endl;
Sleep(2000);
system("cls");
goto startover;
}
else if (confirmy==3||confirmy==3)
{
cout<<"OK, ";
goto totalend;
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter 1 for yes |"<<endl;
cout<<"| | and 2 and for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto confirmbacky;
}
//====end===================
}
else
{
cout<<"==============================================================="<<endl;
cout<<"| | Error!! |"<<endl;
cout<<"| ! | Sorry, please enter Y and y for yes |"<<endl;
cout<<"| | and N and n for no. |"<<endl;
cout<<"==============================================================="<<endl;
goto confirmbackx;
}
totalend:
cout<<"then... ";
system ("pause");
return 0;
}