This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.c
348 lines (327 loc) · 6.56 KB
/
main.c
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#include <process.h>
#include <assert.h>
//User defined Directive
#include "validation.h"
#include "saleMedicine.h"
#include "addNewMedicine.h"
#include "accounts.h"
#include "Expired.h"
COORD coord = {0, 0};
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
char main_manu();
void box();
void main_heading();
void todaySelling();
void frontAnimation();
void about();
int main()
{
static int i=0;
if(i==0)
{
frontAnimation();
i++;
}
system("cls");
char options = main_manu();
switch(options)
{
case '1':
{
system("cls");
box();
SaleHeading();
searchingMed();
break;
}
case '2':
{
system("cls");
box();
addNewMedHeading();
newMedForm();
break;
}
case '3':
{
system("cls");
box();
todaySelling();
break;
}
case '4':
{
system("cls");
box();
expiredTable();
ExpiredFile();
break;
}
case '5':
{
system("cls");
box();
medListHeading();
accounts_manu();
break;
}
case '6':
{
system("cls");
about();
break;
}
}
gotoxy(0,36);
// getch();
return 0;
}
void todaySelling()
{
gotoxy(33,3);
printf("TODAY SELLING");
gotoxy(32,5);
for(int i=1; i<=15; i++)
{
printf("%c",223);
}
gotoxy(2,5);
for(int i=1; i<=75; i++)
{
printf("%c",196);
}
for(int j=0; j<4; j++)
{
for(int i=0; i<=79; i+=15)
{
gotoxy(2+i,5+j);
printf("%c",179);
}
}
gotoxy(5,6);
printf("Buyer Name");
gotoxy(21,6);
printf("Medicine");
gotoxy(35,6);
printf("Quantity");
gotoxy(52,6);
printf("Price");
gotoxy(67,6);
printf("Date");
gotoxy(2,8);
for(int i=1; i<=75; i++)
{
printf("%c",196);
}
time_t ti = time(NULL);
struct tm *tm = localtime(&ti);
assert(strftime(bd.dataTime, sizeof(bd.dataTime), "%c", tm));
char day[30]="EveryDay/";
strncat(day,bd.dataTime,8);
for(int i=11; i<=14; i+=3)
{
day[i]='-';
}
strcat(day,".DAT");
FILE *fptoday;
fptoday=fopen(day,"r");
if(fptoday==NULL){
gotoxy(10,10);
printf("File not found..");
Sleep(3000);
main();
}
int counter=0;
while(fscanf(fptoday,"%s %s %d %f %s\n",bd.BuyerName,bd.medicineName,&bd.quantity,&bd.price,bd.dataTime)!=EOF)
{
gotoxy(4,10+counter);
printf("%s",bd.BuyerName);
gotoxy(20,10+counter);
printf("%s",bd.medicineName);
gotoxy(38,10+counter);
printf("%d",bd.quantity);
gotoxy(50,10+counter);
printf("%.2f",bd.price);
gotoxy(60,10+counter);
printf("%s",bd.dataTime);
counter++;
}
fclose(fptoday);
if(getche()){
main();
}
}
char main_manu()
{
char in;
box();
main_heading();
gotoxy(20,8);
printf("1 . Sale Medicines ");
gotoxy(20,10);
printf("2 . Add new Medicines ");
gotoxy(20,12);
printf("3 . Today Selling ");
gotoxy(20,14);
printf("4 . Expiry Days Remaining");
gotoxy(20,16);
printf("5 . Accounts");
gotoxy(20,18);
printf("6 . About");
enter:
gotoxy(20,22);
printf("Choose Option : ");
in=getche();
if(in=='1'||in=='2'||in=='3'||in=='4'||in=='5'||in=='6')
{
return in;
}
else
{
gotoxy(20,24);
printf("Wrong Input PRESS [1,2,3,4,5,6]");
goto enter;
}
}
void main_heading()
{
gotoxy(27,3);
printf("MEDICAL STORE MANAGEMENT");
gotoxy(27,5);
for(int i=1; i<=24; i++)
{
printf("%c",223);
}
}
void box()
{
gotoxy(0,0);
printf("%c",201);
for(int i=2; i<=79; i++)
{
printf("%c",205);
}
printf("%c",187);
for(int i=1; i<=35; i++)
{
gotoxy(0,i);
printf("%c",186);
}
gotoxy(0,36);
printf("%c",200);
for(int i=2; i<=79; i++)
{
printf("%c",205);
}
printf("%c",188);
for(int i=1; i<=35; i++)
{
gotoxy(79,i);
printf("%c",186);
}
}
void frontAnimation()
{
gotoxy(25,8);
// printf("WELCOME TO MEDICAL STORE");
for(int i =0; i<25; i++)
{
gotoxy(25+i,9);
printf("%c",219);
gotoxy(25+i,10);
printf("%c",219);
Sleep(i*3);
}
for(int i =0; i<13; i++)
{
for(int j=0; j<3; j++)
{
gotoxy(36+j,4+i);
printf("%c",219);
Sleep(i*3);
}
}
gotoxy(25,18);
char wel[]="WELCOME TO MEDICAL STORE";
for(int i=0; i<strlen(wel); i++)
{
printf("%c",wel[i]);
Sleep(40);
}
Sleep(500);
}
void about(){
box();
gotoxy(34,3);
char a[]="ABOUT US";
for(int i=0; i<strlen(a); i++)
{
printf("%c",a[i]);
Sleep(40);
}
for(int i=0; i<10; i++)
{
gotoxy(42-i,5);
printf("%c",223);
Sleep(40);
}
gotoxy(9,7);
printf("My Journey to keep you safe and more comfortable in your work.");
gotoxy(8,8);
for(int i=0; i<64; i++)
{
printf("%c",196);
}
gotoxy(10,10);
printf("This software allow you to easily manage your Medical store.");
gotoxy(9,11);
for(int i=0; i<62; i++)
{
printf("%c",196);
}
gotoxy(27,13);
printf("Provide Digital Records");
gotoxy(26,14);
for(int i=0; i<26; i++)
{
printf("%c",196);
}
gotoxy(34,17);
printf("DEVELOPER");
gotoxy(33,18);
for(int i=0; i<11; i++)
{
printf("%c",196);
}
gotoxy(30,19);
printf("NIKHIL KUMAR SINGH");
gotoxy(30,22);
printf("HOW MAY I HELP YOU");
gotoxy(29,23);
for(int i=0; i<20; i++)
{
printf("%c",196);
}
gotoxy(28,24);
printf("Contect No - 8349696112");
gotoxy(34,26);
printf("THANK YOU");
gotoxy(33,27);
for(int i=0; i<11; i++)
{
printf("%c",196);
}
if(_getch()){
main();
}
}