-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
2564 lines (1911 loc) · 95 KB
/
main.c
File metadata and controls
2564 lines (1911 loc) · 95 KB
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "defines.h"
/*
PROJETO DA DISCIPLINA DE LINGUAGEM DE PROGRAMACAO 1 DA UNIVERSIDADE ESTADUAL DA PARAIBA
@AUTHOR THIAGO HENRIQUE DOMINGOS DE SA
Minha ideia era criar TADs e usar ponteiros de struct(contidos na pasta OLD), mas devido a erros que para mim nao faziam sentido
como acessar structs incompletas(que para mim nao tinha nada errado) ou erros de include acusando redefinição de structs
decidi simplificar e utilizar structs normais e coloca-las neste mesmo arquivo.
Na parte de interface grafica utilizei a documentacao oficial da microsoft que pode ser encontrada em
https://msdn.microsoft.com/en/library/windows/desktop/ff818516(v=vs.85).aspx
A IDE utilizada foi o DEV-C++.
Ordem no arquivo:
1. estruturas
2. Funcoes da interface grafica
3. funcoes das funcionalidades
4. LRESULT CALLBACK WndProc (Aqui estao todas as funcionalidades)
5. MAIN(LOOP da janela principal)
*/
struct data{
int dia, mes, ano;
};
typedef struct data Data;
Data cria_data(int dia, int mes, int ano){
Data data;
data.dia = dia;
data.mes = mes;
data.ano = ano;
return data;
}
struct paciente{
char nome[100], endereco[100];
int cpf, id;
Data data;
};
typedef struct paciente Paciente;
Paciente cria_paciente(int id, char nome[100], Data data, long int cpf, char endereco[100]){
Paciente paciente;
strcpy(paciente.nome, nome);
paciente.data = data;
paciente.id = id;
paciente.cpf = cpf;
strcpy(paciente.endereco, endereco);
return paciente;
}
struct aluno{
char nome[100], curso[100];
long int cpf, matricula;
int idade;
};
typedef struct aluno Aluno;
Aluno cria_aluno(char nome[100],int idade, long int matricula, long int cpf, char curso[100]){
Aluno aluno;
strcpy(aluno.nome, nome);
aluno.idade = idade;
aluno.matricula = matricula;
aluno.cpf = cpf;
strcpy(aluno.curso, curso);
return aluno;
}
struct supervisor{
char nome[100], curso[100];
int id, codigo;
};
typedef struct supervisor Supervisor;
Supervisor cria_supervisor(int id, char nome[100], char curso[100], int codigo){
Supervisor supervisor;
supervisor.id = id;
supervisor.codigo = codigo;
strcpy(supervisor.nome, nome);
strcpy(supervisor.curso, curso);
return supervisor;
}
struct agendamento{
int codigo, codPaciente;
char nomePaciente[100];
Data data;
char area[20];
};
typedef struct agendamento Agendamento;
Agendamento cria_agendamento(Paciente paciente, Data data, char area[20],int codigo){
Agendamento agendamento;
agendamento.data = data;
agendamento.codigo = codigo;
strcpy(agendamento.area, area);
strcpy(agendamento.nomePaciente, paciente.nome);
agendamento.codPaciente = paciente.id;
return agendamento;
}
struct atendimento{
int codigoAtendimento, codigoAgendamento, codAluno, codSupervisor, codPaciente;
char nomeAluno[100], nomeSupervisor[100], nomePaciente[100], area[20];
Data dataAtendimento;
};
typedef struct atendimento Atendimento;
Atendimento cria_atendimento(int codigoAtendimento, Aluno aluno, Supervisor supervisor, Agendamento agendamento){
Atendimento atendimento;
atendimento.codigoAtendimento = codigoAtendimento;
strcpy(atendimento.area, agendamento.area);
//pega o nome e o cpf(id) do aluno
strcpy(atendimento.nomeAluno, aluno.nome);
atendimento.codAluno = aluno.cpf;
//pega o nome e o codigo(id) do paciente
strcpy(atendimento.nomePaciente, agendamento.nomePaciente);
atendimento.codPaciente = agendamento.codPaciente;
//pega o nome e o codigo do supervisor
strcpy(atendimento.nomeSupervisor, supervisor.nome);
atendimento.codSupervisor = supervisor.codigo;
//pega o codigo e a data do agendamento
atendimento.codigoAgendamento = agendamento.codigo;
atendimento.dataAtendimento = agendamento.data;
return atendimento;
}
const char g_szClassName[] = "CLINICA"; //nome da janela principal
//VARIAVEIS GLOBAIS PARA RECEBIMENTO DE DADOS E ESTRUTURAS
char lista[1000];
int posicoes[9];
Aluno alunos[1000];
Supervisor supervisores[1000];
Paciente pacientes[1000];
Agendamento agendamentos[1000];
Atendimento atendimentos[1000];
int posAluno, posSupervisor, posPaciente, posAgendamento, posAtendimento, pos = -1, pos2 = -1, pos3 = -1, carregou = 0;
int idPaciente = 1, idSupervisor = 1, idAgendamento = 1, idAtendimento = 1;
HWND hnome, hcurso, hcpf, hmatricula, hidade, hendereco, harea, hdia, hmes, hano, haluno, hidpaciente, hsupervisor, hidaluno, hidsupervisor, hconfirma, hcancela, hlistas, hid;
//cria uma janela cinza de dimensoes 1920x1080
void limpaTela(HWND hwnd){
CreateWindowW(L"static", L"", WS_VISIBLE | WS_CHILDWINDOW , 0, 0, 1920, 1080, hwnd, NULL, NULL, NULL);
}
//destroi todas as janelas editaveis
void destroiJanelas(){
DestroyWindow(hnome);
DestroyWindow(hcurso);
DestroyWindow(hmatricula);
DestroyWindow(hcpf);
DestroyWindow(hidade);
DestroyWindow(hcancela);
DestroyWindow(hconfirma);
DestroyWindow(hlistas);
DestroyWindow(hendereco);
DestroyWindow(hid);
DestroyWindow(harea);
DestroyWindow(hdia);
DestroyWindow(hmes);
DestroyWindow(hano);
DestroyWindow(haluno);
DestroyWindow(hsupervisor);
DestroyWindow(hidaluno);
DestroyWindow(hidsupervisor);
DestroyWindow(hidpaciente);
}
// FUNCOES PARA AS JANELAS DA INTERFACE GRAFICA
void janelaCriaAluno(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> CADASTRO DE ALUNO", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Curso:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcurso = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 80, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"CPF:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER , 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Matricula:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hmatricula = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Idade:", WS_VISIBLE | WS_CHILDWINDOW, 10, 170, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hidade = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 170, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 200, 100, 24, (HWND) hwnd, (HMENU) ALUNO_CRIAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 200, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaEditaAluno(HWND hwnd, Aluno aluno){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> EDITAR ALUNO", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hnome, aluno.nome);
CreateWindowW(L"static", L"Curso:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcurso = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 80, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hcurso, aluno.curso);
CreateWindowW(L"static", L"CPF:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER , 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
char cpf[11];
sprintf(cpf, "%ld", aluno.cpf);
SetWindowText(hcpf, cpf);
CreateWindowW(L"static", L"Matricula:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hmatricula = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
char mat[11];
sprintf(mat, "%ld", aluno.matricula);
SetWindowText(hmatricula, mat);
CreateWindowW(L"static", L"Idade:", WS_VISIBLE | WS_CHILDWINDOW, 10, 170, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hidade = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 170, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char idade[3];
sprintf(idade, "%d", aluno.idade);
SetWindowText(hidade, idade);
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 200, 100, 24, (HWND) hwnd, (HMENU) ALUNO_EDITAR, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 200, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaProcuraAluno(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> EDITAR ALUNO - PROCURA POR CPF", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o CPF do aluno:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 170, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 170, 90, 100, 24, (HWND) hwnd, (HMENU) ALUNO_PROCURAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 290, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaDeletaAluno(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> REMOVER ALUNO - PROCURA POR CPF", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o CPF do aluno:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 170, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 170, 90, 100, 24, (HWND) hwnd, (HMENU) ALUNO_REMOVE_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 290, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaCriaPaciente(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> CADASTRO DE PACIENTE", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 250, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Endereco:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hendereco = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 80, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"CPF:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER , 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Data Nasc:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hdia = CreateWindowW(L"edit", L"DIA", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
hmes = CreateWindowW(L"edit", L"MES", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 140, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
hano = CreateWindowW(L"edit", L"ANO", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 190, 140, 45, 24, (HWND) hwnd, NULL, NULL, NULL);
/*CreateWindowW(L"static", L"Data Nasc:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hidade = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 300, 24, (HWND) hwnd, NULL, NULL, NULL);*/
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 170, 100, 24, (HWND) hwnd, (HMENU) PACIENTE_CRIAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 170, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaProcuraPaciente(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> EDITAR PACIENTE - PROCURA POR CPF", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o CPF do paciente:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 180, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 180, 90, 100, 24, (HWND) hwnd, (HMENU) PACIENTE_PROCURAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 300, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaRemovePaciente(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> REMOVER PACIENTE - PROCURA POR CPF", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o CPF do paciente:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 180, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 180, 90, 100, 24, (HWND) hwnd, (HMENU) PACIENTE_REMOVE_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 300, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaEditaPaciente(HWND hwnd, Paciente paciente){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> EDITAR PACIENTE", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hnome, paciente.nome);
CreateWindowW(L"static", L"Endereco:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hendereco = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 80, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hendereco, paciente.endereco);
CreateWindowW(L"static", L"CPF:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcpf = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER , 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
char cpf[11];
sprintf(cpf, "%ld", paciente.cpf);
SetWindowText(hcpf, cpf);
CreateWindowW(L"static", L"Data:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hdia = CreateWindowW(L"edit", L"DIA", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char dia[4];
sprintf(dia, "%d", paciente.data.dia);
SetWindowText(hdia, dia);
hmes = CreateWindowW(L"edit", L"MES", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 140, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char mes[4];
sprintf(mes, "%d", paciente.data.mes);
SetWindowText(hmes, mes);
hano = CreateWindowW(L"edit", L"ANO", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 190, 140, 45, 24, (HWND) hwnd, NULL, NULL, NULL);
char ano[5];
sprintf(ano, "%d", paciente.data.ano);
SetWindowText(hano, ano);
/*CreateWindowW(L"static", L"Data Nasc:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hidade = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hidade, paciente.idade);*/
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 170, 100, 24, (HWND) hwnd, (HMENU) PACIENTE_EDITAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 170, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaCriaSupervisor(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> CADASTRO DE SUPERVISOR", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Curso:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcurso = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 80, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Cod. Sup.:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 100, 24, (HWND) hwnd, (HMENU) SUPERVISOR_CRIAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 140, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaProcuraSupervisor(hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> EDITAR SUPERVISOR - PROCURA POR ID", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID do supervisor:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 90, 100, 24, (HWND) hwnd, (HMENU) SUPERVISOR_PROCURAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 320, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaEditaSupervisor(HWND hwnd, Supervisor supervisor){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> EDITAR SUPERVISOR", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hnome, supervisor.nome);
CreateWindowW(L"static", L"Curso:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hcurso = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 80, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hcurso, supervisor.curso);
CreateWindowW(L"static", L"Cod. Sup.:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
char id[11];
sprintf(id, "%d", supervisor.codigo);
SetWindowText(hid, id);
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 100, 24, (HWND) hwnd, (HMENU) SUPERVISOR_EDITAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 140, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaRemoveSupervisor(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> REMOVER SUPERVISOR - PROCURA POR ID", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID do supervisor:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 50, 300, 24, hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 90, 100, 24, (HWND) hwnd, (HMENU) SUPERVISOR_REMOVE_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 320, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaAgendamentoProcuraPaciente(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> 1. CRIAR AGENDAMENTO - PROCURAR PACIENTE POR ID", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID do paciente:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 90, 100, 24, (HWND) hwnd, (HMENU) AGE_PROCURA_PAC_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 320, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaCriaAgendamento(HWND hwnd, Paciente paciente){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> 2. CRIAR AGENDAMENTO", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Paciente:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hnome, paciente.nome);
CreateWindowW(L"static", L"ID Pac.:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 80, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char id[4];
sprintf(id, "%d", paciente.id);
SetWindowText(hid, id);
CreateWindowW(L"static", L"Area:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
harea = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Data:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hdia = CreateWindowW(L"edit", L"DIA", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
hmes = CreateWindowW(L"edit", L"MES", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 140, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
hano = CreateWindowW(L"edit", L"ANO", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 190, 140, 45, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 180, 100, 24, (HWND) hwnd, (HMENU) AGE_CRIAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 180, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaCancelaAgendamento(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> CANCELAR AGENDAMENTO - PROCURAR AGENDAMENTO POR ID", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID do agendamento:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 90, 100, 24, (HWND) hwnd, (HMENU) AGE_CANCELA_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 320, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaListaAtendimentoAluno(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> LISTAR ATENDIMENTOS - POR NOME ALUNO", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 90, 100, 24, (HWND) hwnd, (HMENU) ATEN_LISTAR_ALUNO_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 240, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaListaAtendimentoArea(hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> LISTAR ATENDIMENTOS - POR AREA", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite a area:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
harea = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 90, 100, 24, (HWND) hwnd, (HMENU) ATEN_LISTAR_AREA_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 240, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaListaAtendimentoPaciente(hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> LISTAR ATENDIMENTOS - POR NOME PACIENTE", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite nome:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 90, 100, 24, (HWND) hwnd, (HMENU) ATEN_LISTAR_PACIENTE_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 240, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaCriaAtendimento(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> 1. CRIAR ATENDIMENTO - PROCURAR ALUNO, SUPERVISOR E AGENDAMENTO", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID do agendamento:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o CPF aluno:", WS_VISIBLE | WS_CHILDWINDOW, 10, 90, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
haluno = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 90, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID do supervisor:", WS_VISIBLE | WS_CHILDWINDOW, 10, 130, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hsupervisor = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 130, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 200, 170, 100, 24, (HWND) hwnd, (HMENU) ATENDIMENTO_CRIAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 320, 170, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaCriaAtendimento2(HWND hwnd, Agendamento agendamento, Aluno aluno, Supervisor supervisor){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> 2. CRIAR ATENDIMENTO", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 400, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Paciente:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hnome, agendamento.nomePaciente);
CreateWindowW(L"static", L"ID Pac.:", WS_VISIBLE | WS_CHILDWINDOW, 10, 80, 130, 24, hwnd, NULL, NULL, NULL);
hidpaciente = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 80, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char id[4];
sprintf(id, "%d", agendamento.codPaciente);
SetWindowText(hidpaciente, id);
CreateWindowW(L"static", L"Area:", WS_VISIBLE | WS_CHILDWINDOW, 10, 110, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
harea = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 110, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(harea, agendamento.area);
CreateWindowW(L"static", L"Data:", WS_VISIBLE | WS_CHILDWINDOW, 10, 140, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hdia = CreateWindowW(L"edit", L"DIA", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char dia[4];
sprintf(dia, "%d", agendamento.data.dia);
SetWindowText(hdia, dia);
hmes = CreateWindowW(L"edit", L"MES", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 140, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char mes[4];
sprintf(mes, "%d", agendamento.data.mes);
SetWindowText(hmes, mes);
hano = CreateWindowW(L"edit", L"ANO", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 190, 140, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char ano[4];
sprintf(ano, "%d", agendamento.data.ano);
SetWindowText(hano, ano);
CreateWindowW(L"static", L"Aluno:", WS_VISIBLE | WS_CHILDWINDOW, 10, 170, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
haluno = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 170, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(haluno, aluno.nome);
CreateWindowW(L"static", L"ID aluno:", WS_VISIBLE | WS_CHILDWINDOW, 10, 200, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hidaluno = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 200, 110, 24, (HWND) hwnd, NULL, NULL, NULL);
char id2[12];
sprintf(id2, "%ld", aluno.cpf);
SetWindowText(hidaluno, id2);
CreateWindowW(L"static", L"Supervisor:", WS_VISIBLE | WS_CHILDWINDOW, 10, 230, 130, 24, (HWND) hwnd, NULL, NULL, NULL);
hsupervisor = CreateWindowW(L"edit", L"DIA", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 230, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
SetWindowText(hsupervisor, supervisor.nome);
CreateWindowW(L"static", L"ID Sup.:", WS_VISIBLE | WS_CHILDWINDOW, 10, 260, 130, 24, hwnd, NULL, NULL, NULL);
hidsupervisor = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER | WS_DISABLED, 90, 260, 35, 24, (HWND) hwnd, NULL, NULL, NULL);
char id3[4];
sprintf(id3, "%d", supervisor.id);
SetWindowText(hidsupervisor, id3);
hconfirma = CreateWindowW(L"button", L"Confirmar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 90, 290, 100, 24, (HWND) hwnd, (HMENU) ATENDIMENTO_CRIAR_2_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 210, 290, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaAtendimentoCancelar(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
CreateWindowW(L"static", L">>>> CANCELAR ATENDIMENTO - PESQUISA POR ID", WS_VISIBLE | WS_CHILDWINDOW, 10, 20, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Digite o ID:", WS_VISIBLE | WS_CHILDWINDOW, 10, 50, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 50, 300, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Procurar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 120, 90, 100, 24, (HWND) hwnd, (HMENU) ATEN_CANCELAR_OK, NULL, NULL);
hcancela = CreateWindowW(L"button", L"Cancelar", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 240, 90, 100, 24, (HWND) hwnd, (HMENU) BOTAO_CANCEL, NULL, NULL);
}
void janelaLogin(HWND hwnd){
// POSICAO HORIZONTAL - POSICAO VERTICAL - LARGURA - ALTURA
//CreateWindowW(L"static", L"AREA DE LOGIN", WS_VISIBLE | WS_CHILDWINDOW, 220, 80, 600, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Username:", WS_VISIBLE | WS_CHILDWINDOW, 140, 122, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hnome = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 230, 120, 150, 24, (HWND) hwnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Password:", WS_VISIBLE | WS_CHILDWINDOW, 140, 152, 200, 24, (HWND) hwnd, NULL, NULL, NULL);
hid = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 230, 150, 150, 24, (HWND) hwnd, NULL, NULL, NULL);
hconfirma = CreateWindowW(L"button", L"Login", WS_VISIBLE | WS_CHILDWINDOW | WS_BORDER, 230, 180, 100, 24, (HWND) hwnd, (HMENU) LOGIN_OK, NULL, NULL);
}
void criaMenus(HWND hwnd){
//-------------- DEFINICAO DOS MENUS E SUBMENUS --------------//
HMENU hMenu = CreateMenu(); // Barra de menus
HMENU menuArquivo = CreateMenu(); // cria o menu arquivo
HMENU menuAtendimento = CreateMenu(); // cria o menu atendimento
HMENU menuAgendamento = CreateMenu(); // cria o menu agendamento
HMENU menuAluno= CreateMenu(); // cria o menu aluno
HMENU menuSupervisor = CreateMenu(); // cria o menu supervisor
HMENU menuPaciente= CreateMenu(); // cria o menu paciente
HMENU subMenuAtendimento = CreateMenu(); // cria o menu atendimento
//-------------- MENU DE ARQUIVO --------------//
AppendMenu(menuArquivo, MF_STRING, ARQUIVO_SALVAR, "Salvar");
AppendMenu(menuArquivo, MF_STRING, ARQUIVO_CARREGAR, "Carregar Arquivos");
AppendMenu(menuArquivo, MF_STRING, ARQUIVO_SAIR, "Sair");
//-------------- MENU DE ATENDIMENTO --------------//
// submenu listas
AppendMenu(subMenuAtendimento, MF_STRING, ATENDIMENTO_LISTAR_TUDO, "Listar todos os atendimentos");
AppendMenu(subMenuAtendimento, MF_STRING, ATENDIMENTO_LISTAR_ALUNO, "Listar por aluno");
AppendMenu(subMenuAtendimento, MF_STRING, ATENDIMENTO_LISTAR_AREA, "Listar por area");
AppendMenu(subMenuAtendimento, MF_STRING, ATENDIMENTO_LISTAR_PACIENTE, "Listar por paciente");
//termina sub menu lista
AppendMenu(menuAtendimento, MF_STRING, ATENDIMENTO_CRIAR, "Adicionar Atendimento");
//AppendMenu(menuAtendimento, MF_STRING, ATENDIMENTO_EDITAR, "Editar Atendimento");
AppendMenu(menuAtendimento, MF_STRING, ATENDIMENTO_CANCELAR, "Cancelar Atendimento");
AppendMenu(menuAtendimento, MF_POPUP, (UINT_PTR) subMenuAtendimento, "Listar Atendimentos");
//-------------- MENU DE AGENDAMENTO --------------//
AppendMenu(menuAgendamento, MF_STRING, AGENDAMENTO_CRIAR, "Adicionar Agendamento");
//AppendMenu(menuAgendamento, MF_STRING, AGENDAMENTO_EDITAR, "Editar Agendamento");
AppendMenu(menuAgendamento, MF_STRING, AGENDAMENTO_CANCELAR, "Cancelar Agendamento");
AppendMenu(menuAgendamento, MF_STRING, AGENDAMENTO_LISTAR, "Listar Agendamentos");
//-------------- MENU DE ALUNO --------------//
AppendMenu(menuAluno, MF_STRING, ALUNO_CRIAR, "Adicionar Aluno");
AppendMenu(menuAluno, MF_STRING, ALUNO_PROCURAR, "Editar Aluno");
AppendMenu(menuAluno, MF_STRING, ALUNO_REMOVER, "Remover Aluno");
AppendMenu(menuAluno, MF_STRING, ALUNO_LISTAR, "Listar Alunos");
//-------------- MENU DE PACIENTE --------------//
AppendMenu(menuPaciente, MF_STRING, PACIENTE_CRIAR, "Adicionar Paciente");
AppendMenu(menuPaciente, MF_STRING, PACIENTE_EDITAR, "Editar Paciente");
AppendMenu(menuPaciente, MF_STRING, PACIENTE_REMOVER, "Remover Paciente");
AppendMenu(menuPaciente, MF_STRING, PACIENTE_LISTAR, "Listar Pacientes");
//-------------- MENU DE SUPERVISOR --------------//
AppendMenu(menuSupervisor, MF_STRING, SUPERVISOR_CRIAR, "Adicionar Supervisor");
AppendMenu(menuSupervisor, MF_STRING, SUPERVISOR_EDITAR, "Editar Supervisor");
AppendMenu(menuSupervisor, MF_STRING, SUPERVISOR_REMOVER, "Remover Supervisor");
AppendMenu(menuSupervisor, MF_STRING, SUPERVISOR_LISTAR, "Listar Supervisores");
//-------------- MENUS PRINCIPAIS --------------//
AppendMenu(hMenu, MF_POPUP, (UINT_PTR) menuArquivo, "Arquivo");
AppendMenu(hMenu, MF_POPUP, (UINT_PTR) menuAtendimento, "Atendimento");
AppendMenu(hMenu, MF_POPUP, (UINT_PTR) menuAgendamento, "Agendamento");
AppendMenu(hMenu, MF_POPUP, (UINT_PTR) menuAluno, "Aluno");
AppendMenu(hMenu, MF_POPUP, (UINT_PTR) menuPaciente, "Paciente");
AppendMenu(hMenu, MF_POPUP, (UINT_PTR) menuSupervisor, "Supervisor");
SetMenu(hwnd, hMenu);
}
// ---------------------- FUNCOES DAS FUNCIONALIDADES ---------------------- //
//altera a string para lowercase(apenas para buscas e verificacoes)
char* lowerCase(char str[], int tam){
char min[tam];
int i;
for(i = 0; i < tam; i++){
min[i] = tolower(str[i]);
}
return min;
}
// retorna 1 se for invalida e 0 se for valida
int verificaData(int dia, int mes, int ano){
if(dia > 31 || mes > 12 || ano < 2018 || dia == 0 || mes == 0 || ano == 0){
return 1;
}
return 0;
}
void cancela(HWND hwnd){
int op = MessageBoxW(hwnd, L"Deseja realmente cancelar?", L"Aviso!", MB_YESNO | MB_ICONWARNING);
if(op == IDYES){
limpaTela(hwnd);
destroiJanelas();
}
}
void login(HWND hwnd){
int senha = 123, aux;
char username[10], senha2[10];
GetWindowText(hnome, username, 10);
GetWindowText(hid, senha2, 10);
aux = atoi(senha2);
if(strcmp(username, "") == 0|| strcmp(senha2, "") == 0){
MessageBoxW(hwnd, L"Preencha os campos em branco!", L"Aviso!", MB_OK | MB_ICONWARNING);
}else if(aux != senha || strcmp(username, "admin") != 0){
MessageBoxW(hwnd, L"Dado(s) incorretos. Tente novamente!", L"Aviso!", MB_OK | MB_ICONWARNING);
}else{
MessageBoxW(hwnd, L"Login efetuado com sucesso!", L"Sucesso!", MB_OK | MB_ICONINFORMATION);
limpaTela(hwnd);
destroiJanelas();
criaMenus(hwnd);
}
}
void salvar(HWND hwnd){
int op;
FILE* arquivo_pos;
FILE* arquivo_aluno;
FILE* arquivo_paciente;
FILE* arquivo_supervisor;
FILE* arquivo_agendamento;
FILE* arquivo_atendimento;
if(carregou == 0){
op = MessageBox(hwnd, "Nenhum arquivo foi carregado durante esta execucao. Deseja realmente salvar?", "Aviso!", MB_YESNO);
}
if(IDYES == op){
posicoes[0] = posAluno;
posicoes[1] = posSupervisor;
posicoes[2] = posPaciente;
posicoes[3] = posAgendamento;
posicoes[4] = posAtendimento;
posicoes[5] = idPaciente;
posicoes[6] = idSupervisor;
posicoes[7] = idAgendamento;
posicoes[8] = idAtendimento;
arquivo_pos = fopen("pos.bin", "w+b");
fwrite(posicoes, sizeof(int), 9, arquivo_pos);
fclose(arquivo_pos);
arquivo_aluno = fopen("alunos.bin", "w+b");
fwrite(alunos, sizeof(alunos[0]), 1000, arquivo_aluno);
fclose(arquivo_aluno);
arquivo_paciente = fopen("pacientes.bin", "w+b");
fwrite(pacientes, sizeof(pacientes[0]), 1000, arquivo_paciente);
fclose(arquivo_paciente);
arquivo_supervisor = fopen("supervisores.bin", "w+b");
fwrite(supervisores, sizeof(supervisores[0]), 1000, arquivo_supervisor);
fclose(arquivo_supervisor);
arquivo_agendamento = fopen("agendamentos.bin", "w+b");
fwrite(agendamentos, sizeof(agendamentos[0]), 1000, arquivo_agendamento);
fclose(arquivo_agendamento);
arquivo_atendimento = fopen("atendimentos.bin", "w+b");
fwrite(atendimentos, sizeof(atendimentos[0]), 1000, arquivo_atendimento);
fclose(arquivo_atendimento);
MessageBox(hwnd, "Arquivos salvos com sucesso!", "Sucesso!", MB_ICONINFORMATION);
}
}
void carregar(HWND hwnd){
FILE* arquivo_pos;
FILE* arquivo_aluno;
FILE* arquivo_paciente;
FILE* arquivo_supervisor;
FILE* arquivo_agendamento;
FILE* arquivo_atendimento;
arquivo_pos = fopen("pos.bin", "r+b");
fread(posicoes, sizeof(int), 9, arquivo_pos);
fclose(arquivo_pos);
posAluno = posicoes[0];
posSupervisor = posicoes[1];
posPaciente = posicoes[2];
posAgendamento = posicoes[3];
posAtendimento = posicoes[4];
idPaciente = posicoes[5];
idSupervisor = posicoes[6];
idAgendamento = posicoes[7];
idAtendimento = posicoes[8];
arquivo_aluno = fopen("alunos.bin", "r+b");
fread(alunos, sizeof(alunos[0]), posAluno, arquivo_aluno);
fclose(arquivo_aluno);
arquivo_paciente = fopen("pacientes.bin", "r+b");
fread(pacientes, sizeof(pacientes[0]), posPaciente, arquivo_paciente);
fclose(arquivo_paciente);
arquivo_supervisor = fopen("supervisores.bin", "r+b");
fread(supervisores, sizeof(supervisores[0]), posSupervisor, arquivo_supervisor);
fclose(arquivo_supervisor);
arquivo_agendamento = fopen("agendamentos.bin", "r+b");
fread(agendamentos, sizeof(agendamentos[0]), posAgendamento, arquivo_agendamento);
fclose(arquivo_agendamento);
arquivo_atendimento = fopen("atendimentos.bin", "r+b");
fread(atendimentos, sizeof(atendimentos[0]), posAgendamento, arquivo_atendimento);
fclose(arquivo_atendimento);
MessageBoxW(NULL, L"Arquivos carregados!", L"Carregamento", MB_ICONINFORMATION);
carregou = 1;
}
void fechaPrograma(HWND hwnd){
int op;
op = MessageBoxW(NULL, L"Deseja realmente sair do programa?", L"SAIR", MB_YESNO | MB_ICONWARNING);
if(op == IDYES)
DestroyWindow(hwnd);
}
void criaAtendimento(HWND hwnd) {
int id2, cpf2, idsup2, i;
char id[4], cpf[11], idsup[4];
GetWindowText(hid, id, 4);
GetWindowText(haluno, cpf, 11);
GetWindowText(hsupervisor, idsup, 4);
id2 = atoi(id);
cpf2 = atol(cpf);
idsup2 = atoi(idsup);
if (strcmp(id, "") == 0 || strcmp(cpf, "") == 0 || strcmp(idsup, "") == 0) {
MessageBoxW(hwnd, L"Preencha os campos em branco!", L"Aviso!", MB_OK | MB_ICONWARNING);
} else if (id2 == 0 || cpf2 == 0 || idsup2 == 0) {
MessageBoxW(hwnd, L"Digite apenas numeros!", L"Aviso!", MB_OK | MB_ICONWARNING);
} else {
for (i = 0; i < posAgendamento; i++) {
if (agendamentos[i].codigo == id2) {
pos = i;
break;
}
pos = -1;
}
for (i = 0; i < posAluno; i++) {
if (alunos[i].cpf == cpf2) {
pos2 = i;
break;
}
pos2 = -1;
}
for (i = 0; i < posSupervisor; i++) {
if (supervisores[i].id == idsup2) {
pos3 = i;
break;
}
pos3 = -1;
}
if (pos < 0) {
MessageBoxW(hwnd, L"Agendamento nao encontrado! Acesse o menu cadastro e faca o cadastro!", L"Aviso!", MB_OK | MB_ICONWARNING);
} else if (pos2 < 0) {
MessageBoxW(hwnd, L"Aluno nao encontrado! Acesse o menu cadastro e faca o cadastro!", L"Aviso!", MB_OK | MB_ICONWARNING);
} else if (pos3 < 0) {
MessageBoxW(hwnd, L"Supervisor nao encontrado! Acesse o menu cadastro e faca o cadastro!", L"Aviso!", MB_OK | MB_ICONWARNING);
} else {
MessageBoxW(hwnd, L"Aluno, agendamento e supervisor encontrados!", L"Sucesso!", MB_OK | MB_ICONINFORMATION);
limpaTela(hwnd);
destroiJanelas();
janelaCriaAtendimento2(hwnd, agendamentos[pos], alunos[pos2], supervisores[pos3]);
}
}
}
void criaAtendimento2(HWND hwnd) {
atendimentos[posAtendimento] = cria_atendimento(idAtendimento, alunos[pos], supervisores[pos], agendamentos[pos]);
int i, j;
for (i = 0; i < posAgendamento; i++) {
if (agendamentos[pos].codigo == agendamentos[i].codigo) {
for (j = i; j < posAgendamento - 1; j++) {
agendamentos[j] = agendamentos[j + 1];
}
}
}
posAtendimento++;
idAtendimento++;
posAgendamento--;
MessageBoxW(hwnd, L"Atendimento criado com sucesso!", L"Sucesso!", MB_OK | MB_ICONINFORMATION);
limpaTela(hwnd);
destroiJanelas();
}
void cancelaAtendimento(HWND hwnd) {
int op;
char id[4];
GetWindowText(hid, id, 4);
int id2;
id2 = atoi(id);
if (strcmp(id, "") == 0) {
MessageBoxW(hwnd, L"Preencha os campos em branco!", L"Aviso!", MB_OK | MB_ICONWARNING);
} else if (id2 == 0) {