-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBill.h
87 lines (81 loc) · 2.05 KB
/
Bill.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
using namespace std;
class Bill: public Product
{
private :
char BID[5],Total[15];
fstream B;
public :
void SetBID(char *X) {
strcpy(BID, X);
}
char *GetBID() {
return BID;
}
void SetTotal(char *X) {
strcpy(Total, X);
}
char* GetTotal() {
return Total;
}
void AddBill(){
bool Found = false;
char Path[50];
cout << "|Enter Bill's ID : " ;cin.getline(BID,5);
strcpy(Path, "");
strcat(Path, BID);
strcat(Path, ".txt");
B.open(Path,ios::in);
if(B)
cout << "|The Bill is already Founded !" << endl;
else{
B.close();
B.open(Path,ios::app);
cout << "|the Bill Add Successfully !" << endl;
}
B.close();
}
void AddProBill(){
int counter = NumRec();
Product *arr = GetArrPro() , T;
bool Found = false;
char Path[50] , OP[2], X[0] ,TPID[5] , TQ[10];
cout << "|Enter Bill's ID : " ;cin.getline(BID,5);
strcpy(Path, "");
strcat(Path, BID);
strcat(Path, ".txt");
B.open(Path,ios::in);
if(B)
Found = true;
B.close();
if (Found)
{
B.open(Path,ios::app);
do{
bool Flag = false;
cout << "|Enter the product's ID : "; cin.getline(TPID, 5); T.SetPID(TPID);
cout << "|Enter the product's ID : "; cin.getline(TQ, 5);
for (int i = 0; i < counter; i++)
if (T == arr[i] &&atoi(arr[i].GetPQTY()) <= atoi(TQ)){
Flag = true;
}
if(Flag){
B << TPID << '|' << TQ << endl;
cout << "|The product Added successfully !" << endl;
}
else
cout << "|The product not found !" << endl;
cout << "|To Edit another Product Enter (Y|y) : "; cin.getline(X,2);
}while(X[0] == 'y' || X[0] == 'Y');
B.close();
}
else
{
cout << "The Bill not found " << endl;
}
}
};