کد PHP:
	
// کلاس هاي مورد استفاده در سيستم #include <iostream.h>#include <fstream.h>#include <process.h>#include <string.h>#include <stdio.h>#include <ctype.h>#include <conio.h>#include <dos.h>#include <stdlib.h>#include <iomanip.h>#include <graphics.h>
typedef char option[15];const int ROW = 10, COL = 10;
int scan;     int ascii;
// نمايش منوي اصليoption a[]= {             "new Kala      ",             "Buy  List     ",             "Daily Sales   ",             "Sales Report  ",                         "Exit"        };
// توابع ساخت صفحه نمايش class main_menu{    int i,done;
    public:        void normalvideo(int x,int y,char *str);        void reversevideo(int x,int y,char *str);        void box(int x1,int y1,int x2,int y2);        char menu();        void control_menu();        void help(void);};
/* کلاس ساخت شکل  - مربع  */class shape{    public:        void line_hor(int, int, int, char);        void line_ver(int, int, int, char);        void box(int, int, int, int, char);};
 class kala{    public:        void new_kala(void);                  void add_to_file(int, char t_Cass_name[30], char t_Comp_name[30], int, int, int, int, float);        void display_list(void)  ;         void delete_kala(int);             int last_kala_code(void);          char *return_name(int);            char *return_address(int);         int recordno(int);        void display(int);          
    private:                 int kala_code;              char Cass_name[30];            char Comp_name[30];            int tot_kala;            int dd, mm, yy;            float price;      }; class account{    public:        void new_account(void);          void close_account(void);        void clear(int, int);          void Display_sales(void);        int last_kala_code(void);         float sales_status(int m1, int y1, float cod1, float cod2, float cod3);    private:        void add_to_file(int, char tP_name[30], char tP_address[30],int, int, int, int);         void delete_account(int); // Function to delete 
             int kala_code;        // kala code          char P_name[30];    // Person Name        char P_address[30];    // Person Address        int No_cass;        // Number of kala        int dd, mm, yy;     // To store the system date };
    void main_menu::normalvideo(int x,int y,char *str){   gotoxy(x,y);   cprintf("%s",str);}
 void main_menu::reversevideo(int x,int y,char *str){    textcolor(5+143);    textbackground(WHITE);    gotoxy(x,y);    cprintf("%s",str);    textcolor(GREEN);    textbackground(BLACK);}
void main_menu::box(int x1,int y1,int x2,int y2){     for(int col=x1;col<x2;col++)     {           gotoxy(col,y1);           cprintf("%c",196);           gotoxy(col,y2);           cprintf("%c",196);     }
     for(int row=y1;row<y2;row++)     {           gotoxy(x1,row);           cprintf("%c",179);           gotoxy(x2,row);           cprintf("%c",179);     }     gotoxy(x1,y1);     cprintf("%c",218);     gotoxy(x1,y2);     cprintf("%c",192);     gotoxy(x2,y1);     cprintf("%c",191);     gotoxy(x2,y2);     cprintf("%c",217);}
// Displaying the main menu of Commodity systemchar main_menu::menu(){    clrscr();
    textcolor(22);    box(20, 6, 65, 20);    box(18, 4, 67, 22);    textcolor(5+143);    gotoxy(36, 5);    textbackground(BLUE);    cprintf("M U S I C");    textbackground(BLACK);    textcolor(22);    for(i = 1; i < 9; i++)        normalvideo(32, i+10, a[i]);    reversevideo(32, 10, a[0]);    i = done = 0;    _setcursortype(_NOCURSOR);    do    {        int key = getch();
        switch (key)        {            case 00:                key = getch();
                switch (key)                {                    case 72:                        normalvideo(32, i+10, a[i]);                        i--;                        if (i == -1)                            i = 8;                        reversevideo(32,i+10, a[i]);                        break;                    case 80:                        normalvideo(32, i+10, a[i]);                        i++;                        if (i == 9)                            i = 0;                        reversevideo(32, i+10, a[i]);                        break;                }                break;            case 13:                done = 1;        }    } while (!done);
    _setcursortype(_NOCURSOR);    return(i+49);}
/* The function main_menu() is used to display the main menu system */void main_menu::control_menu(){
    char choice;    kala cas;    account a;    balance bal;    other oth;
    do    {        choice = menu();        clrscr();
        switch (choice)        {            case '1':                _setcursortype(_NORMALCURSOR);                box(3, 1, 75, 24);                box(5, 2, 73, 23);
                cas.new_kala(); // New kala                  break;            case '2':                box(3, 1, 75, 24);                box(5, 2, 73, 23);                kala ini;                ini.display_list();                  break;            case '3':                box(3, 1, 75, 24);                box(5, 2, 73, 23);
                 _setcursortype(_NORMALCURSOR);
                a.new_account();                  break;            case '4':                box(3, 1, 75, 24);                box(5, 2, 73, 23);
                account a;                _setcursortype(_NORMALCURSOR);                a.Display_sales(); // Displays the sales kala                break;                     case '0' :exit(0);           }      } while (choice != 8);}
/* Function to draw horizontal line ............. menu*/void shape::line_hor(int column1, int column2, int row, char c){    for (column1; column1 <= column2; column1++)    {        gotoxy(column1, row);        cout << c;    }}
/* Function to draw vertical line ......... menu */void shape::line_ver(int row1, int row2, int column, char c){    for (row1; row1 <= row2; row1++)    {        gotoxy(column, row1);        cout << c;    }}
/* Function for drawing boxes for menu */void shape::box(int column1, int row1, int column2, int row2, char c){    char ch = 218;    char c1, c2, c3, c4;    char l1 = 196, l2 = 179;    if (c == ch)    {        c1 = 218;        c2 = 191;        c3 = 217;        c4 = 217;        l1 = 196;        l2 = 179;    }    else    {        c1 = c;        c2 = c;        c3 = c;        c4 = c;        l1 = c;        c2 = c;    }
    gotoxy(column1, row1);    cout << c1;    gotoxy(column2, row1);    cout << c2;    gotoxy(column1, row2);    cout << c3;    gotoxy(column2, row2);    cout << c4;    column1++;    column2--;    line_hor(column1, column2, row1, l1); //Horizontal line    line_hor(column1, column2, row2, l1);    column1--;    column2++;    row1++;    row2--;    line_ver(row1, row2, column1, l2); // Vertical line    line_ver(row1, row2, column2, l2);}
 void main_menu::help(void){    clrscr();
    setbkcolor(7);    settextstyle(7,HORIZ_DIR,5);    outtextxy(70,20,"Welcome to Commodity Shop");    settextstyle(2,HORIZ_DIR,5);    outtextxy(60,100, "This project your can keep record of daily Commodity kala ");    delay(2); 
    outtextxy(60,160, "-In first option    : you can enter new kala information");    delay(2);    outtextxy(60,190, "-In second option   : you can see the list of all the kala");    delay(2);    outtextxy(60,220,"-In third option     : you can sales the kala ");    delay(2);    outtextxy(60,250, "-in fourth optiion  : you can see the sales status  ");    delay(2);     outtextxy(60,400, "-And last option is Quit (Exit From Commodity  shop)");    delay(2);
    settextstyle(7,HORIZ_DIR,4);    outtextxy(80,420,"Press any key to continue...");    getch();
}
 void kala::display(int t_kala_code){    fstream file;    file.open("kala.dat", ios::in);    file.seekg(0, ios::beg);     while (file.read((char *)this, sizeof(kala)))    {        if (t_kala_code == kala_code)        {            gotoxy(8, 5);            cout << "Account no. " << kala_code;            gotoxy(10, 8);            cout << "Name : ";            puts(Cass_name);            gotoxy(10, 9);            cout << "Comany Name : ";            puts(Comp_name);
            gotoxy(10, 10);            cout << "Price : " << setw(15)                            << setprecision(2)                            << setiosflags(ios::left)                             << setiosflags(ios::showpoint)                        << setiosflags(ios::fixed)                            << price;            break;        }    }
    file.close();}
 
int kala::last_kala_code(void){    fstream file;    file.open("kala.dat", ios::in);    file.seekg(0, ios::beg);    int tcount = 0;    int count = 0;
     while (file.read((char *)this, sizeof(kala)))    {        tcount = kala_code;        count = count + tcount;    }
    file.close();    return count;}
 
int account::last_kala_code(void){    fstream file;    file.open("Person.dat", ios::in);    file.seekg(0, ios::beg);    int tcount = 0;    int count = 0;     while (file.read((char *)this, sizeof(account)))    {        tcount = kala_code;        count = count + tcount;    }    file.close();    return count;}
 
int balance::give_balance(int t_kala_code){    fstream file;    file.open("Tbal.dat", ios::in);    file.seekg(0, ios::beg);    int t_balance = 0;
         while (file.read((char *)this, sizeof(balance)))    {        if (file.eof())            break;
        if (kala_code == t_kala_code)        {            t_balance = kala_bal;            break;        }    }    file.close();    return t_balance;}
// Function to return the kala pricefloat balance::return_price(int t_kala_code){    float t_price = 0.0;    fstream file;    file.open("Tbal.dat", ios::in);    file.seekg(0, ios::beg);
     while (file.read((char *)this, sizeof(balance)))    {        if (file.eof())            break;
        if (kala_code == t_kala_code)        {            t_price = price;            break;        }    }    file.close();    return t_price;}
 void kala::add_to_file(int t_kala_code, char t_Cass_name[30],char t_Comp_name[30], int t_cas, int tdd, int tmm, int tyy, float t_price){    kala_code = t_kala_code;    strcpy(Cass_name, t_Cass_name);    strcpy(Comp_name, t_Comp_name);    tot_kala = t_cas;    dd = tdd;    mm = tmm;    yy = tyy;    price = t_price;
    fstream file;
         file.open("kala.dat", ios::out|ios::app);    file.write((char *)this, sizeof(kala));    file.close();}
 void kala::delete_kala(int t_kala_code){    fstream file;    file.open("kala.dat", ios::in);    fstream temp;    temp.open("TEMP.dat", ios::out);    file.seekg(0,ios::beg);
         while (!file.eof())    {        file.read((char *)this, sizeof(kala));        if (file.eof())            break;        if (kala_code != t_kala_code)            temp.write((char *)this, sizeof(kala));    }
    file.close();    temp.close();    file.open("kala.dat", ios::out);    temp.open("TEMP.dat", ios::in);    temp.seekg(0, ios::beg);
         while (!temp.eof())    {        temp.read((char *)this, sizeof(kala));        if (temp.eof())            break;        if (kala_code != t_kala_code)            file.write((char *)this, sizeof(kala));    }
    file.close();    temp.close();} 
void account::add_to_file(int t_kala_code, char tP_name[30],char tP_address[30],int tNo_cass, int d1, int m1, int y1){
    kala_code = t_kala_code;    strcpy(P_name, tP_name);    strcpy(P_address, tP_address);    No_cass = tNo_cass;    dd = d1;    mm = m1;    yy = y1;
    fstream file;
     file.open("person.dat", ios::out|ios::app);    file.write((char *)this, sizeof(account));    file.close();}
 void account::delete_account(int t_kala_code){    fstream file;    file.open("person.dat", ios::in);    fstream temp;    temp.open("TEMP.dat", ios::out);      file.seekg(0, ios::beg);     
     while (!file.eof())    {        file.read((char *)this, sizeof(account));        if (file.eof())            break;        if (kala_code != t_kala_code)            temp.write((char *)this, sizeof(account));    }
    file.close();    temp.close();    file.open("person.dat", ios::out);    temp.open("TEMP.dat", ios::in);    temp.seekg(0, ios::beg);
     while (!temp.eof())    {        temp.read((char *)this, sizeof(account));        if (temp.eof())            break;        if (kala_code != t_kala_code)            file.write((char *)this, sizeof(account));    }
    file.close();    temp.close();}
 void other::add_to_file(int tO_code, char tNat_Expen[30],int d1, int m1,  int y1, float tamount){    O_code = tO_code;    strcpy(Nat_Expen, tNat_Expen);    dd = d1;    mm = m1;    yy = y1;    amount = tamount;
    fstream file;
     file.open("other.dat", ios::out|ios::app);    file.write((char *)this, sizeof(other));    file.close();}
 void kala::display_list(void){    clrscr();    int flag;    float tot_price = 0.0, tot_balance = 0.0;    fstream file;    gotoxy(25,2);
    cout << "List of kala in Commodity Shop";    gotoxy(25, 3);    cout << "===============================";    int d1, m1, y1;    struct date d;             getdate(&d);    d1 = d.da_day;    m1 = d.da_mon;    y1 = d.da_year;    gotoxy(62, 3);    cout << "Date: " << d1 << "/" << m1 << "/" << y1;    gotoxy(1, 4);    for (int j = 1; j <= 79; j++)        cout << "=";
    gotoxy(1, 5);    cout << "Code #";    gotoxy(9, 5);    cout << "kala Name";    gotoxy(34, 5);    cout << "Company Name";    gotoxy(55, 5);    cout << "Qty";    gotoxy(61, 5);    cout << "Price";    gotoxy(72, 5);    cout << "Total";    gotoxy(1, 6);    for (j = 1; j <= 79; j++)        cout << "=";
    file.open("kala.dat", ios::in);    file.seekg(0,ios::beg);    int row = 7;
     while (file.read((char *)this, sizeof(kala)))    {        tot_price = 0.0;        flag = 0;        delay(2);        gotoxy(3, row);        cout << kala_code;        gotoxy(9, row);        puts(Cass_name);        gotoxy(34, row);        puts(Comp_name);        gotoxy(55, row);        cout << tot_kala;
        gotoxy(61, row);        cout <<  setw(15)            << setprecision(2)            << setiosflags(ios::left)            << setiosflags(ios::showpoint)            << setiosflags(ios::fixed)            << price;
        tot_price = tot_kala * price;
        gotoxy(72, row);        cout <<  setw(15)            << setprecision(2)            << setiosflags(ios::left)            << setiosflags(ios::showpoint)            << setiosflags(ios::fixed)            << tot_price;
        tot_balance = tot_balance + tot_price;
        row++;        if (row > 23)        {            flag = 1;            row = 6;            gotoxy(4, 24);            cout << "Press any key to continue.... ";            getch();            clrscr();        }    }
    gotoxy(1, row);    for (j = 1; j <= 79; j++)        cout << "=";    row++;    gotoxy(3, row);    cout << "Total price of kala is : ";
    gotoxy(72, row);    cout << setw(15)        << setprecision(2)        << setiosflags(ios::left)        << setiosflags(ios::showpoint)        << setiosflags(ios::fixed)        << tot_balance;
    file.close();    if (!flag)    {        gotoxy(4, 24);        cout << "Press any key to continue...";        getch();    }    getch();}
 void account::Display_sales(void){    clrscr();    int flag;    fstream file;
    int tkala_code;    int xdd, xmm, xyy;    clrscr();    gotoxy(10, 8);    cout << "Enter the kala Code ";    gotoxy(10, 9);    cout <<"As 1 or 2 or 3 ";    gotoxy(10, 11);    cout << "Enter the date " ;    gotoxy(30, 9);    cin >> tkala_code;    gotoxy(30, 11);    cin >> xdd;    gotoxy(32, 11);    cout << "-";    gotoxy(33, 11);    cin >> xmm;    gotoxy(35, 11);    cout << "-";    gotoxy(36, 11);    cin >> xyy;    if (tkala_code < 1)    {        gotoxy(5, 23);        cout << "Your entry is not valid";        getch();        return;    }    else        if (tkala_code > 3)        {            gotoxy(5, 23);            cout << "Your entry is not valid";            getch();            return;        }
    clrscr();    gotoxy(25, 2);    cout << "Sales Report in Commodity Shop";    gotoxy(25, 3);    cout << "==========================";    int d1, m1, y1;    struct date d;             getdate(&d);    d1 = d.da_day;    m1 = d.da_mon;    y1 = d.da_year;    gotoxy(62, 3);    cout << "Date: " << d1 << "/" << m1 << "/" << y1;    gotoxy(1, 5);    for (int j = 1; j <= 79; j++)        cout << "=";
    gotoxy(1, 6);    cout << "Code #";    gotoxy(9, 6);    cout << "Name";    gotoxy(34, 6);    cout << "Address";    gotoxy(55, 6);    cout << "Qty";    gotoxy(61, 6);    cout << "Date";
    gotoxy(1, 7);    for (j = 1; j <= 79; j++)        cout << "=";    file.open("Person.dat", ios::in);    file.seekg(0,ios::beg);    int row = 8;
    // Reads all the records to display      while (file.read((char *)this, sizeof(account)))    {        if ((tkala_code == kala_code) && (xmm == mm) && (xyy == yy))        {            flag = 0;            delay(2);            gotoxy(3, row);            cout << kala_code;            gotoxy(9, row);            puts(P_name);            gotoxy(34, row);            puts(P_address);            gotoxy(55, row);            cout << No_cass;
            gotoxy(61, row);            cout << dd << "-" << mm << "-" << yy;            ++row;            if (row > 23)            {                flag = 1;                row = 6;                gotoxy(4, 24);                cout << "Press any key to continue.... ";                getch();                clrscr();            }        }    }
    ++row;
    gotoxy(1, row);    for (j = 1; j <= 79; j++)        cout << "=";    row++;
    file.close();    if (!flag)    {        gotoxy(4, 24);        cout << "Press any key to continue...";        getch();    }    getch();}
void account::clear(int col, int row){    for (int j = col; j <= 79; j++)    {        gotoxy(j, row);        cout << " ";    }}
char *kala::return_name(int t_kala_code){    fstream file;    file.open("kala.dat", ios::in);    file.seekg(0, ios::beg);    char t_Cass_name[30];
    // Return the name to display                      if found    while (file.read((char *)this, sizeof(kala)))    {        if (kala_code == t_kala_code)        {            strcpy(t_Cass_name, Cass_name);            break;        }    }    file.close();    return t_Cass_name;}
char *kala::return_address(int t_kala_code){    fstream file;    file.open("kala.dat", ios::in);    file.seekg(0, ios::beg);    char t_Comp_name[30];
    while (file.read((char *)this, sizeof(kala)))    {        if (kala_code == t_kala_code)        {            strcpy(t_Comp_name, Comp_name);            break;        }    }    file.close();    return t_Comp_name;} float account::sales_status(int m1, int y1, float cod1, float cod2, float cod3){    fstream file;    file.open("Person.dat", ios::in);    file.seekg(0,ios::beg);     float ts = 0.0;    float gts = 0.0;    while (file.read((char *)this, sizeof(account)))    {        if ((m1 == mm) && (y1 == yy))        {            if (kala_code == 1)                ts = No_cass * cod1;            else                if (kala_code == 2)                    ts = No_cass * cod2;                else                    ts = No_cass * cod3;            gts = gts + ts;            ts = 0;        }    }    file.close();    return gts;}
 float other::other_status(int m1, int y1){    fstream file;    file.open("other.dat", ios::in);    file.seekg(0,ios::beg);         float goth = 0.0;    while (file.read((char *)this, sizeof(other)))    {        if ((m1 == mm) && (y1 == yy))        {            goth = goth + amount;        }    }    file.close();    return goth;}  void kala::new_kala(void){    char ch;    int i, valid;    clrscr();
         account a;    balance bal;    kala ini;
    shape s;    s.box(2, 1, 79, 25, 218);    s.box(25, 2, 54, 4, 219);
    gotoxy(65, 2);    cout << "<0>=Exit";
    gotoxy(3,3);    for (i = 1; i<= 76; i++)        cprintf(" ");    textbackground(BLACK);    textcolor(BLACK+BLINK);    textbackground(WHITE);    gotoxy(30, 3);    cprintf("Add New kala");    textcolor(LIGHTGRAY);    textbackground(BLACK);    int d1, m1, y1;            struct date d;        
    getdate(&d);            d1 = d.da_day;    m1 = d.da_mon;    y1 = d.da_year;
 
    char c_code[10];
    int t_kala_code;    char t_Cass_name[30];    char t_Comp_name[30];    int t_cas;    int tdd, tmm, tyy;    float t_price;
    t_kala_code = ini.last_kala_code();
     if (t_kala_code == 0)    {        ini.add_to_file(t_kala_code, "abc", "xyz", 1, 1, 1, 1, 1.1);        ini.delete_kala(t_kala_code);        bal.add_to_file(t_kala_code, 0, 0, 0, 0, 0.0);        bal.delete_balance(t_kala_code);    }
    gotoxy(4, 6);    cout << "Date: " << d1 << '/' << m1 << '/' << y1;
    gotoxy(5, 8);    cout << "kala Code # ";    gotoxy(5, 10);    cout << "kala Name : ";    gotoxy(5, 12);    cout << "Company Name : ";    gotoxy(5, 14);    cout << "Total kala: ";    gotoxy(5, 16);    cout << "Individual kala price : ";    gotoxy(5, 18);    cout << "Enter the Date ";
    // Steps to enter the kala code either 1 - 2 - 3.    do    {        a.clear(22, 8);        a.clear(5, 23);                 gotoxy(5, 23);        cout << "Enter kala Code either 1/2/3 ";        valid = 1;        gotoxy(22, 8);        gets(c_code);        t_kala_code = atoi(c_code);
        if (t_kala_code <= 0)        {            valid = 0;            a.clear(5, 23);            gotoxy(5, 23);            cprintf("\7Should not other than 1, 2, 3");            getch();            gotoxy(5, 23);            cout << "Enter kala Code either 1/2/3 ";
        }    } while (!valid);    a.clear(5, 23);
     do    {        a.clear(22, 10);        a.clear(5, 23);        gotoxy(5, 23);        cout << "Enter Name of the kala";        valid = 1;        gotoxy(22, 10);        gets(t_Cass_name);        strupr(t_Cass_name);        if (t_Cass_name[0] == '0')            return;        if (strlen(t_Cass_name) == 0 || strlen(t_Cass_name) > 25)        {            valid = 0;            gotoxy(5, 23);            cprintf("\7kala Name should not greater than 25");            getch();        }    }while (!valid);    a.clear(5, 23);
     do    {        a.clear(22, 12);        a.clear(5, 23);        gotoxy(5, 23);        cout << "Enter Company Name ";        valid = 1;        gotoxy(22, 12);        gets(t_Comp_name);        strupr(t_Comp_name);        if (t_Comp_name[0] == '0')            return;        if (strlen(t_Comp_name) == 0 || strlen(t_Comp_name) > 25)        {            valid = 0;            gotoxy(5, 23);            cprintf("\7Company Name should not greater than 25");            getch();        }    }while (!valid);    a.clear(5, 23);
     do    {        a.clear(22, 14);        a.clear(5, 23);        gotoxy(5, 23);        cout << "Enter Total number of kala buy";        valid = 1;        gotoxy(22, 14);        gets(c_code);        t_cas = atoi(c_code);        if (t_cas == 0)        {            valid = 0;            a.clear(5, 23);            gotoxy(5, 23);            cprintf("\7Enter valid kala number");            getch();            gotoxy(5, 23);            cout << "Enter Total number of kala buy";
        }    }while (!valid);    a.clear(5, 23);
     do    {        a.clear(35, 16);        a.clear(5, 23);        gotoxy(5, 23);        cout << "Enter individual kala price";        valid = 1;        gotoxy(35, 16);        gets(c_code);        t_price = atof(c_code);        if (t_price <= 0)        {            valid = 0;            gotoxy(5, 23);            cprintf("\7Enter valid price for kala");            getch();        }    }while (!valid);    a.clear(5, 23);
     a.clear(22, 18);    a.clear(5, 23);    gotoxy(5, 23);    cout << "Enter date on which the kala is buy";    valid = 1;    gotoxy(22, 18);    cin >> tdd;    gotoxy(25, 18);    cout << "-";    gotoxy(26, 18);    cin >> tmm;    gotoxy(28, 18);    cout << "-";    gotoxy(29, 18);    cin >> tyy;    a.clear(5, 23);
    do    {        a.clear(5, 20);        valid = 1;        gotoxy(5, 20);        cout << "Do you want to save the record <Y/N>: ";        ch = getche();        if (ch == '0')            return;        ch = toupper(ch);    }while (ch != 'N' && ch != 'Y');
    if (ch == 'N')        return;
     ini.add_to_file(t_kala_code, t_Cass_name, t_Comp_name,        t_cas, tdd, tmm, tyy, t_price);
    bal.add_to_file(t_kala_code, t_cas, tdd, tmm, tyy, t_price);}
  void account::new_account(void){    char ch;    int i, valid;    clrscr();    balance bal;
    shape s;    s.box(2, 1, 79, 25, 218);    s.box(25, 2, 54, 4, 219);
    gotoxy(65, 2);    cout << "<0>=Exit";
    gotoxy(3,3);    for (i = 1; i<= 76; i++)        cprintf(" ");    textbackground(BLACK);    textcolor(BLACK+BLINK);    textbackground(WHITE);    gotoxy(30, 3);    cprintf("Sales of kala");    textcolor(LIGHTGRAY);    textbackground(BLACK);    int d1, m1, y1;    struct date d;             getdate(&d);    d1 = d.da_day;    m1 = d.da_mon;    y1 = d.da_year;    int t_kala_code;
    int C_bal = 0;    float t_price;    char c_code[2];    char tP_name[30];    // Person Name    char tP_address[30];    // Person Address    int tNo_cass;        // Number of kala
    t_kala_code = last_kala_code();     if (t_kala_code == 0)    {        add_to_file(t_kala_code, "xxxx", "xxxxx", 1, 1, 1, 1);        delete_account(t_kala_code);    }
    gotoxy(5, 6);    cout << "Date: " << d1 << '/' << m1 << '/' << y1;    gotoxy(5, 8);    cout << "kala Code ";    gotoxy(5, 10);    cout << "Name of Person : ";    gotoxy(5, 12);    cout << "Address : ";
    gotoxy(5, 14);    cout << "Total kala : ";
    // Steps to enter the kala code either 1 - 2 - 3.    do    {        clear(22, 8);        clear(5, 23);                 gotoxy(5, 23);        cout << "Enter kala Code either 1/2/3 ";        valid = 1;        gotoxy(22, 8);        gets(c_code);        t_kala_code = atoi(c_code);
        if (t_kala_code <= 0)        {            valid = 0;            clear(5, 23);            gotoxy(5, 23);            cprintf("\7Should not other than 1, 2, 3");            getch();            gotoxy(5, 23);            cout << "Enter kala Code either 1/2/3 ";        }        else        {            C_bal = bal.give_balance(t_kala_code);            t_price = bal.return_price(t_kala_code);            if (C_bal > 0)            {                gotoxy(40, 8);                cout << "Total kala in Shop : " << C_bal;                break;            }            else            {                cout << "There is no kala in shop";                return;            }        }    } while (!valid);    clear(5, 23);
     do    {        clear(22, 10);        clear(5, 23);        gotoxy(5, 23);        cout << "Enter Name of the Person";        valid = 1;        gotoxy(22, 10);        gets(tP_name);        strupr(tP_name);        if (tP_name[0] == '0')            return;        if (strlen(tP_name) == 0 || strlen(tP_name) > 25)        {            valid = 0;            gotoxy(5, 23);            cprintf("\7Name should not greater than 25");            getch();            clear(5, 23);        }
    }while (!valid);    clear(5, 23);
     do    {        clear(22, 12);        clear(5, 23);        gotoxy(5, 23);        cout << "Enter Name of the Person";        valid = 1;        gotoxy(22, 12);        gets(tP_address);        strupr(tP_address);        if (tP_address[0] == '0')            return;        if (strlen(tP_address) == 0 || strlen(tP_address) > 25)        {            valid = 0;            gotoxy(5, 23);            cprintf("\7Address should not greater than 25");            getch();            clear(5, 23);        }
    }while (!valid);    clear(5, 23);
    do    {        clear(22, 14);        clear(5, 23);        gotoxy(5, 23);        cout << "No. of kala ";        valid = 1;        gotoxy(22, 14);        cin >> tNo_cass;        if (tNo_cass > C_bal)        {            valid = 0;            gotoxy(5, 23);            cprintf("\7The availability of kala is not sufficient");            getch();        }    }while (!valid);    clear(5, 23);
    do    {        clear(5, 17);        valid = 1;        gotoxy(5, 17);        cout << "Do you want to save the record <Y/N>: ";        ch = getche();        if (ch == '0')            return;        ch = toupper(ch);    }while (ch != 'N' && ch != 'Y');
    if (ch == 'N')        return;
     add_to_file(t_kala_code, tP_name, tP_address, tNo_cass, d1, m1,  y1);
    bal.Update_balance(t_kala_code, tNo_cass, d1, m1, y1, t_price);} int kala::recordno(int t_kala_code){    fstream file;    file.open("kala.dat", ios::in);    file.seekg(0, ios::beg);    int count = 0;
     while (file.read((char *)this, sizeof(kala)))    {        count++;        if (t_kala_code == kala_code)            break;    }    file.close();    return count;} void account::close_account(void){    clrscr();    char t_acc[10];    int t, t_kala_code;    gotoxy(71, 1);    cout << "<0>=Exit";    gotoxy(5, 5);    cout << "Enter the account no. ";    gets(t_acc);    t = atoi(t_acc);    t_kala_code = t;    if (t_kala_code == 0)        return;    clrscr();    kala ini;    balance bal;
    if (!bal.give_balance(t_kala_code))    {        gotoxy(5, 5);        cout << "\7Account not found ";        getch();        return;    }    gotoxy(71, 1);    cout << "<0>=Exit";    gotoxy(3, 3);    textbackground(WHITE);    for (int i = 1; i <= 76; i++)        cprintf(" ");    textbackground(BLACK);    textcolor(BLACK+BLINK);    textbackground(WHITE);    gotoxy(30, 3);    cprintf("Close account screen");    textcolor(LIGHTGRAY);    textbackground(BLACK);    int d1, m1, y1;    struct date d;    getdate(&d);    d1 = d.da_day;    m1 = d.da_mon;    y1 = d.da_year;    gotoxy(5, 6);    cout << "Date: " << d1 << "/" << m1 << "/" << y1;    char ch;
    ini. display(t_kala_code);
    do    {        clear(5, 15);        gotoxy(5, 15);        cout << "Close this account <y/n?? ";        ch = getche();        if (ch == '0')            return;        ch = toupper(ch);    }while (ch != 'N' && ch != 'Y');
    if (ch == 'N')        return;
     ini.delete_kala(t_kala_code);    delete_account(t_kala_code);    gotoxy(5, 20);    cout << "\7Account Deleted";    gotoxy(5, 23);    cout << "Press any key to continue...";    getch();}
 void main(void){    main_menu  m_menu;    int gdriver = DETECT, gmode, errorcode;    initgraph(&gdriver, &gmode, "");
    m_menu.help();    closegraph();    m_menu.control_menu();} 
 
                        
علاقه مندی ها (Bookmarks)