-
Notifications
You must be signed in to change notification settings - Fork 0
/
ERP-System.cpp
314 lines (279 loc) · 7.71 KB
/
ERP-System.cpp
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#include<iostream>
#include<string>
using namespace std;
class item
{
private:
int product_code;
string item_name;
int cost_price;
int selling_price;
int quantity;
public:
void setProductCode(int icode)
{
product_code=icode;
}
void setItemName(string iname)
{
item_name=iname;
}
void setCostPrice(int icprice)
{
cost_price=icprice;
}
void setSellPrice(int isprice)
{
selling_price=isprice;
}
void setQuantity(int ique)
{
quantity=ique;
}
void displaySearchItem()
{
cout<<"\n\tProduct Code : "<<product_code<<"\n\t Product Name : "<<item_name<<"\n\t Product Selling Price : "<<selling_price<<"\n\t Product Cost Price : "<<cost_price<<"\n\t Quantity Of Products : "<<quantity;
}
void ViewItem()
{
cout<<"\n\t"<<product_code<<"\t"<<item_name<<"\t"<<selling_price<<"\t"<<quantity;
}
};
class inventory : public item
{
protected:
item products[10];
};
class customer
{
private:
int CustomerID;
string CustomerName;
int CustomerContactNumber;
string CustomerAddress;
public :
void setcustomerId(int cid)
{
CustomerID=cid;
}
void setcustomerName(string cname)
{
CustomerName=cname;
}
void setcustomerContactNumber(int ccn)
{
CustomerContactNumber=ccn;
}
void setcustomerAddress(string caddress)
{
CustomerAddress=caddress;
}
void displayCustomer()
{
cout<<"\n\tCustomer Id : "<<CustomerID<<"\n\tCustomer Name : "<<CustomerName<<"\n\tCustomer's Contact Number : "<<"\n\tCustomer's Address : "<<CustomerAddress<<endl;
}
};
class allCustomers
{
protected:
customer customers[10];
};
class store : public inventory, public allCustomers
{
public:
int itemCounter=0;
int customerCounter=0;
void cases()
{
int flag=0;
do
{
int option;
storeDetails();
cout<<"\n1.Create Bill : To Create BILL...\n2.Add Item : To Add New Item In Inventory...\n3.Update Item : To Update Existing Item In Inventory...\n4.Search Item : To Search Any Particular Item From Inventory...\n5.Add Customer : Add New Customer...\n6.Search Customer : Search A Particular Customer...\n7.All Customer : To Display All Customer...\n";
cout<<"Select Option : ";
cin>>option;
switch(option)
{
case 1:
bill();
break;
case 2:
addItem();
break;
case 3:
updateItem();
break;
case 4:
searchItem();
break;
case 5:
addCustomer();
break;
case 6:
searchCustomers();
break;
case 7:
displayAllCustomers();
break;
default :
cout<<"You've Selected Invalid Option"<<endl;
}
}
while(flag!=1);
}
void storeDetails()
{
cout<<"\n\n\t\t\tMafatLal Market\n\t\t 420-ChorBazaar Of India\n\t\t Contact Number : 99525-52420\n";
}
void displayItem()
{
cout<<"\n\tCode\tName\tPrice\tAvailable Que.";
for(int j=0; j<itemCounter; j++)
products[j].ViewItem();
}
void bill()
{
displayItem();
}
void addItem()
{
string itemName;
int itemSellingPrice;
int itemCostPrice;
int itemQuantity;
cout<<"Enter Item Name : ";
cin>>itemName;
cout<<"Enter Item Selling Price (Single Unit): ";
cin>>itemSellingPrice;
cout<<"Enter Item Cost Price (Single Unit): ";
cin>>itemCostPrice;
cout<<"Enter Item Quantity : ";
cin>>itemQuantity;
products[itemCounter].setProductCode(itemCounter);
products[itemCounter].setItemName(itemName);
products[itemCounter].setSellPrice(itemSellingPrice);
products[itemCounter].setCostPrice(itemCostPrice);
products[itemCounter].setQuantity(itemQuantity);
itemCounter++;
}
void updateItem()
{
string updateItemName;
int updateItemSellingPrice;
int updateItemCostPrice;
int updateItemQuantity;
int updateOption;
int selectItemNumber;
cout<<"Enter Product Code : ";
cin>>selectItemNumber;
cout<<"\n\n1.Update Name\n\t2.Update Selling Price\n\t3.Update Cost Price\n\t4.Update Item Quantity";
cout<<"Select Option : ";
cin>>updateOption;
switch(updateOption)
{
case 1:
{
cout<<"Update Item Name : ";
cin>>updateItemName;
products[selectItemNumber].setItemName(updateItemName);
}
break;
case 2:
{
cout<<"Update Item Selling Price (Single Unit): ";
cin>>updateItemSellingPrice;
products[selectItemNumber].setSellPrice(updateItemSellingPrice);
}
break;
case 3:
{
cout<<"Update Item Cost Price (Single Unit): ";
cin>>updateItemCostPrice;
products[selectItemNumber].setCostPrice(updateItemCostPrice);
}
break;
case 4:
{
cout<<"Update Item Quantity : ";
cin>>updateItemQuantity;
products[selectItemNumber].setQuantity(updateItemQuantity);
}
break;
default :
cout<<"You've Selected Invalid Option"<<endl;
}
}
void searchItem()
{
int sItemCode,flagSearch=0;
cout<<"Enter Product Code (Item Code) : ";
cin>>sItemCode;
for(int i=0; i<itemCounter; i++)
{
if(sItemCode==i)
{
flagSearch=1;
break;
}
}
if(flagSearch==1)
{
products[sItemCode].displaySearchItem();
}
else
{
cout<<"\n\n\t\t404-Product(Item) Not Found...";
}
}
void addCustomer()
{
string customerName;
int customerContactNumber;
string customerAddress;
cout<<"Enter Customer Name : ";
cin>>customerName;
cout<<"Enter Customer's Contact Number : ";
cin>>customerContactNumber;
cout<<"Enter Customer's Address : ";
cin>>customerAddress;
customers[customerCounter].setcustomerId(customerCounter);
customers[customerCounter].setcustomerName(customerName);
customers[customerCounter].setcustomerContactNumber(customerContactNumber);
customers[customerCounter].setcustomerAddress(customerAddress);
customerCounter++;
}
void displayAllCustomers()
{
for(int i=0; i<customerCounter; i++)
{
customers[i].displayCustomer();
}
}
void searchCustomers()
{
int scID,flagCustomerSearch=0;
cout<<"Enter Customer ID : ";cin>>scID;
for(int i=0; i<customerCounter; i++)
{
if(scID==i)
{
flagCustomerSearch=1;
break;
}
}
if(flagCustomerSearch==1)
{
customers[scID].displayCustomer();
}
else
{
cout<<"\n\n\t\t404-Customer Not Found...";
}
}
};
main()
{
store manager;
manager.cases();
}