-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_inventry.cpp
119 lines (105 loc) · 3.79 KB
/
show_inventry.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
#include"stdafx.h"
#include"Header.h"
#include"global_variables.h"
#include"function_define.h"
#include"structs.h"
extern struct bill b[100];
void show_inventry()
{
int epagerow = 20, spagerow = 0;
char cho;
do {
int stopflag = 0;
system("CLS");
clean();
read();
text(15 on 8);
cout << "\n\n\n " << endl;
string str(coldstore);
int spaces = str.length();
cout << " ";
cout << "\r";
for (int i = 0; i < 60 - (spaces / 2); i++)
{
cout << " ";
}cout << coldstore << endl; cout << " ";
text(0 on 8);
cout << "\r\t\t\t\t\t\t\t INVENTRY" << endl;
text(15);
text(15 on 4); cout << "\nP_ID ";
text(15 on 9); cout << "P_NAME ";
text(0 on 8); cout << "P_QUANTITY ";
text(0 on 14); cout << "P_BYING PRICE ";
text(0 on 13); cout << "P_SALE PRICE ";
text(0 on 11); cout << "P_SALED ";
text(0 on 10); cout << "P_PROFIT " << endl; text(15);
cout << "=======================================================================================================================" << endl;
for (int i = spagerow; i <= epagerow; i++)
{
if (pid[i + 1] == 0)
{
stopflag = 1;
//cout << "good\n";
}
if (pid[i]>0)
{
invcounter = 1;
if (pprofit[i] <= 0)
{
cout << "\t\t\t\t\t\t\t\t\t\t\t\t\t"; text(0 on 12); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << pprofit[i] << "$"; text(15);
}
else
{
cout << "\t\t\t\t\t\t\t\t\t\t\t\t\t"; text(0 on 10); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << pprofit[i] << "$"; text(15);
}
cout << "\r\t\t\t\t\t\t\t\t\t\t\t"; text(0 on 11); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << psaled[i]; text(15);
cout << "\r\t\t\t\t\t\t\t\t\t"; text(0 on 13); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << psprice[i]; text(15);
cout << "\r\t\t\t\t\t\t\t"; text(0 on 14); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << pbprice[i]; text(15);
cout << "\r\t\t\t\t\t"; text(0 on 8); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << pquantity[i]; text(15);
cout << "\r\t"; text(15 on 9); cout << " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; cout << pname[i]; text(15);
cout << "\r"; text(15 on 4); cout << " \b\b\b\b\b\b\b\b"; cout << pid[i] << endl; text(15);
}
}
cout << "=======================================================================================================================" << endl;
//options:
if (invcounter == 1)
{
do
{
cout << "PRESS (N) FOR NEXT RECORD, (P) FOR PREVIOUS RECORD, (E) TO EDIT RECORD:";
cho = getch();
if (cho == 'e' || cho == 'E')
{
for (int i = 0; i< 45; i++)
{
cout << " \b\b";
}
edit_inventry();
}
else if (cho == 'N'&& epagerow != 100 && stopflag != 1 || cho == 'n'&& epagerow != 100 && stopflag != 1)
{
spagerow = spagerow + 20;
epagerow = epagerow + 20;
}
else if (cho == 'p'&& spagerow != 0 || cho == 'P'&& spagerow != 0)
{
spagerow = spagerow - 20;
epagerow = epagerow - 20;
}
else if (cho == 27)
{
start();
}
else
{
cout << "\r";
}
} while (cho != 'P'&& cho != 'p' && cho != 'e'&& cho != 'E' && cho != 'N' && cho != 'n' &&cho != 27);
}
else
{
cout << "INVENTRY IS EMPTY. (PRESS ANT KEY)";
getch();
}
} while (TRUE);
}