Pascal/Turbo Pascal - Programa en Pascal Ayuda

 
Vista:

Programa en Pascal Ayuda

Publicado por Eglis (1 intervención) el 23/07/2014 00:55:11
Buenas soy estudiante del centro metropolitano yo tambien copie el programa pero no me corre por favor ayudenme no se si lo copie bien o que me falta.program clínica “La Mejor”;
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
uses
    crt, dos;
 
  const
     patoA = 550;
     patoB = 430;
     patoC = 620;
     ingres = 500;
     archi = 'Datospac.dat';
 
  type
     menores = 0..18;
     adultos = 19..64;
     mayores = 65..107;
     string12 = string[12];
     paciente = record
           activo : boolean;
           cedula : longint;
           nombre : string[80];
           apells : string;
           numpac : longint;
           edad   : integer;
           sexo   : char;
           patolg : char;
          ingreso : real;
          tiempo  : integer;
          fechent : string[12];
          fechalt : string[12];
          total   : real;
        end;
 
var
 
  f : file of paciente;
  datos : paciente;
  año, mes, dia, sem : word;
 
  function guardardatos(dd : paciente) : boolean;
  var
    tt : longint;
    dt : paciente;
    err : boolean;
  begin
     guardardatos := false;
     assign(f,archi);
 {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       rewrite(f);
       seek(f,0);
       write(f,dd);
       close(f);
       guardardatos := true;
    end
else
    begin
        seek (f,filesize(f);
        write(f,dd);
        close(f);
        guardardatos := true;
    end;
  end;
 
  function diaingreso : string12;
  var
    comm, comd : string[2];
    coma : string[4];
  begin
      getdate(año,mes,dia,sem);
      str(año,coma);
      str(mes,comm);
      str(dia,comd);
      if length(comd) = 1 then
      insert('0',comd,1);
      if length(comm) = 1 then
      insert('0',comm,1);
      diaingreso := comd + '/' + comm + '/' + coma;
  end;
 
 Procedure entradapaciente;
  var
    tec : char;
  begin
     clrscr;
        writeln('***** Ingreso Paciente *****');
        writeln;
        with datos do
        begin
           activo := true;
           write(' Entre Nombre : ');
           readln(nombre);
           write(' Entre Apellidos : ');
           readln(apells);
           write(' Entre Num. Pacit. : ');
           readln(numpac);
           write(' Entre Edad : ');
           readln(edad);
           write(' Entre Sexo [F/M] : ');
           readln(sexo);
           write(' Entre Patol. [A/B/C] : ');
           readln(patolg);
           ingreso := ingres;
           fechent := diaingreso;
           writeln; writeln('>>> Acectar Datos [S/N] <<<');
           repeat
               tec := upcase(readkey);
           until tec in['S','N'];
          if tec = 'S' then
          begin
            if guardardatos(datos) = true then
            writeln(' Datos De Paciente Guardados ')
         else
            writeln(' Error El Numero Paciente Existe No Guardado ');
            writeln(' Pulse Una Tecla ');
          end;
      end;
  end;
 
  Procedure consultar(num : longint);
  var
    tt : longint;
    dto : paciente;
    si : boolean;
  begin
      si := false;
      tt := 0;
      assign(f,archi);
  {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       writeln(' Error Archivo No Encontrado Pulse Una Tecla');
       readkey;
    end
 else
    begin
       for tt := 0 to filesize(f) - 1 do
       begin
          seek(f,tt);
          read(f,dto);
          if dto.numpac = num then
          begin
              si := true;
              break;
          end;
       end;
         if si = true then
         begin
         with datos do
         begin
         writeln(' Nombre = ',nombre);
         writeln(' Apellidos = ',apells);
         writeln(' Numero Paciente = ',numpac);
         writeln(' Edad = ',edad);
         case edad of
      0..18 : writeln(' Categoria = Menor De Edad');
     19..64 : writeln(' Categoria = Adulto');
    65..107 : writeln(' Categoria = Mayor');
        end;
         writeln(' Patolojia = ',patolg);
         writeln(' Importe Ingreso = ',ingreso:0:2);
         writeln(' Fecha Ingreso = ',fechent);
        if fechalt <> ' ' then
         writeln(' Fecha Actual = ', fechalt)
      else
         writeln(' Fecha Actual = ',diaingreso);
         writeln(' Total Importe = ',total:0:2);
         writeln;
        end;
       end
    else
       writeln; (' El Paciente No Esta En Lista ');
     end
  else
     writeln (' Numero Paciente No Encontrado ');
     writeln (' Pulse Una Tecla');
     readkey;
end;
 
Procedure modificadatos(num : longint);
var
  mo, mdi : paciente;
  kk, jh : longint;
  term : boolean;
  deci : char;
 begin
    term := false;
    assign(f,archi);
 {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      writeln(' Error Archivo No Encontrado Pulse Una Tecla');
      readkey;
   end
else
    begin
       for jh := 0 to filesize(f) - 1 do
       begin
          seek(f,jh);
          read(f,mdi);
          if mdi.numpac = num then
          begin
              term := true;
              kk := jh;
              mo := mdi;
              break;
          end;
       end;
         if term = true then
         begin
           if mdi.activo = true then
           begin
           term := false;
           repeat
            clrscr;
         writeln(' ***** Menu Modificaciones *****');
         writeln;
         writeln(' N = Nombre');
         writeln(' A = Apellidos');
         writeln(' P = Num. Paciente');
         writeln(' E = Edad');
         writeln(' G = Patologia');
         writeln(' F = Fecha Ingreso');
         writeln(' S = Salir Y Guardar Cambios');
         writeln; writeln(' <<< Elija Opcion >>>');
         repeat
         deci := upcase(readkey);
         until deci in['N','A','P','E','G','F','S'];
         clrscr;
   case deci of
'N' : begin write(' Nombre : ');
       readln(mo.nombre);
     end;
'A' : begin
       write(' Apellidos : ');
       readln(mo.apells);
     end;
'P' : begin
       write(' Num. Paciente : ');
       readln(mo.numpac);
     end;
'E' : begin
       write(' Edad : ');
       readln(mo.edad);
     end;
'G' : begin
       write(' Patologia: ');
       readln(mo.patolg);
     end;
'F' : begin
       write(' Fecha Ingreso : ');
       readln(mo.fechent);
     end;
'S' : begin
       term := true;
     end;
   end;
   until term = true;
   mdi := mo;
   seek(f,kk);
   write(f,mdi);
  end;
 end;
   close(f);
 end;
end;
 
 
 
   Procedure eliminapaciente(num : longint);
   var
     bn, hh : longint;
   begin
     assign(f,archi);
   {$I-} reset(f); {$I+}
     if ioresult <> 0 then
     begin
        writeln(' Error Archivo No Encontrado Pulse Una Tecla');
        readkey;
     end
  else
      begin
         bn := 0;
         for hh := 0 to filesize(f) - 1 do
         begin
            seek(f,hh);
            read(f,datos);
            if datos.numpac <> num then
            begin
            end
         else
            begin
               datos.activo := false;
               seek(f,hh);
               write(f,datos);
            end;
          end;
           close(f);
       end;
     end;
 
    Procedure reportefinal(num : longint);
    var
      totl : real;
      pul : char;
      pos, tt : longint;
      sil : boolean;
      d, m, an : word;
      d1, m1, an1 : word;
      d3, m3, an3 : word;
      dar : string[2];
      ay : string[4];
      totaldias, error : integer;
    begin
        assign(f,archi);
     {$I-} reset(f); {$I+}
       if ioresult <> 0 then
       begin
          writeln(' Error Archivo No Encontrado Pulse Una Tecla');
          readkey;
        end
     else
         begin
         sil := false;
         for tt := 0 to filesize(f) - 1 do
         begin
             seek(f,tt);
             read(f,datos);
             if datos.numpac = num then
             begin
                sil := true;
                pos := tt;
                break;
             end;
         end;
           if sil = true then
           begin
              if datos.activo = true then
              begin
              writeln(' Entrada Fecha Alta Como [A]=Automatico O      [M]=Manual');
              repeat
                  pul := upcase(readkey);
              until pul in['A','M'];
              if pul = 'A' then
              datos.fechalt := diaingreso;
              if pul = 'M' then
              begin
                writeln(' Entre Fecha De Alta d/m/a¤o '); writeln;
                write(' Fecha : ');
                readln(datos.fechalt);
                if datos.fechalt[2] = '/' then
                insert('0',datos.fechalt,1);
                if datos.fechalt[5] = '/' then
                insert('0',datos.fechalt,4);
             end;
             dar := copy(datos.fechent,1,2);
             val(dar,d,error);
             dar := copy(datos.fechent,4,2);
             val(dar,m,error);
             ay := copy(datos.fechent,7,4);
             val(ay,an,error);
             dar := copy(datos.fechalt,1,2);
             val(dar,d1,error);
             dar := copy(datos.fechalt,4,2);
             val(dar,m1,error);
             ay := copy(datos.fechalt,7,4);
             val(ay,an1,error);
             d3 := 0; m3 := 0;
             an3 := 0;
             d3 := d1 - d;
             m3 := m1 - m;
             an3 := an1 - an;
             totaldias := (m3 * 30) + d3;
             if (datos.patolg = 'A') or (datos.patolg = 'a') then
             begin
                datos.total := (patoA * totaldias);
             end;
             if (datos.patolg = 'B') or (datos.patolg = 'b') then
             begin
                datos.total := (patoB * totaldias);
             end;
             if (datos.patolg = 'C') or (datos.patolg = 'c') then
             begin
                datos.total := (patoC * totaldias);
             end;
             datos.activo := false;
             clrscr;
             writeln(' ***** Reporte De Alta *****');
             writeln;
             writeln(' Fecha De Ingreso = ',datos.fechent);
             writeln(' Fecha De Alta = ',datos.fechalt);
             writeln(' Dias De Ingreso = ',totaldias);
             writeln(' Patologia = ',datos.patolg);
             writeln(' Total Importe = ',datos.total:0:2);
             writeln;
             writeln(' <<< Pulse Una Tecla >>>');
             readkey;
             seek(f,pos);
             write(f,datos);
             close(f);
          end
     else
         begin
           writeln(' El Paciente No Esta Activo ');
           writeln(' <<< Pulse Una Tecla >>>');
           readkey;
           close(f);
         end;
       end;
    end;
  end;
 
     Procedure menu;
     var
       tecla : char;
       sal : boolean;
       nnm : longint;
     begin
        sal := false;
     repeat
         clrscr;
         writeln(' ***** Menu General *****');
         writeln;
         writeln(' I = Incluir');
         writeln(' C = Consultar');
         writeln(' M = Modificar');
         writeln(' E = Eliminar');
         writeln(' R = Reporte Alta');
         writeln(' S = Salir');
         writeln;
         writeln(' <<< Elija Opcion >>>');
       repeat
           tecla := upcase(readkey);
       until tecla in['I','C','M','E','R','S'];
       clrscr;
     case tecla of
   'I' : entradapaciente;
   'C' : begin
           write(' Entre Num. Paciente : ');
           readln(nnm);
           consultar(nnm);
         end;
   'M' : begin
         write(' Entre Num. Paciente : ');
         readln(nnm); modificadatos(nnm);
         end;
   'E' : begin
            write(' Entre Num. Paciente : ');
            readln(nnm);
            eliminapaciente(nnm);
         end;
   'R' : begin
           write(' Entre Num. Paciente : ');
           readln(nnm);
           reportefinal(nnm);
         end;
   'S' : sal := true;
     end;
     until sal = true;
   end;
 
     begin
         clrscr;
         menu;
     end.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Programa en Pascal Ayuda

Publicado por ramon (2158 intervenciones) el 26/07/2014 22:42:44
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
{Tenia algunos fallos pero de escritura no de programa}
 
uses
    crt, dos;
 
  const
     patoA = 550;
     patoB = 430;
     patoC = 620;
     ingres = 500;
     archi = 'Datospac.dat';
 
  type
     menores = 0..18;
     adultos = 19..64;
     mayores = 65..107;
     string12 = string[12];
     paciente = record
           activo : boolean;
           cedula : longint;
           nombre : string[80];
           apells : string;
           numpac : longint;
           edad   : integer;
           sexo   : char;
           patolg : char;
          ingreso : real;
          tiempo  : integer;
          fechent : string[12];
          fechalt : string[12];
          total   : real;
        end;
 
var
 
  f : file of paciente;
  datos : paciente;
  ano, mes, dia, sem : word;
 
  function guardardatos(dd : paciente) : boolean;
  var
    tt : longint;
    dt : paciente;
    err : boolean;
  begin
     guardardatos := false;
     assign(f,archi);
 {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       rewrite(f);
       seek(f,0);
       write(f,dd);
       close(f);
       guardardatos := true;
    end
else
    begin
        seek (f,filesize(f));
        write(f,dd);
        close(f);
        guardardatos := true;
    end;
  end;
 
  function diaingreso : string12;
  var
    comm, comd : string[2];
    coma : string[4];
  begin
      getdate(ano,mes,dia,sem);
      str(ano,coma);
      str(mes,comm);
      str(dia,comd);
      if length(comd) = 1 then
      insert('0',comd,1);
      if length(comm) = 1 then
      insert('0',comm,1);
      diaingreso := comd + '/' + comm + '/' + coma;
  end;
 
 Procedure entradapaciente;
  var
    tec : char;
  begin
     clrscr;
        writeln('***** Ingreso Paciente *****');
        writeln;
        with datos do
        begin
           activo := true;
           write(' Entre Nombre : ');
           readln(nombre);
           write(' Entre Apellidos : ');
           readln(apells);
           write(' Entre Num. Pacit. : ');
           readln(numpac);
           write(' Entre Edad : ');
           readln(edad);
           write(' Entre Sexo [F/M] : ');
           readln(sexo);
           write(' Entre Patol. [A/B/C] : ');
           readln(patolg);
           ingreso := ingres;
           fechent := diaingreso;
           writeln; writeln('>>> Acectar Datos [S/N] <<<');
           repeat
               tec := upcase(readkey);
           until tec in['S','N'];
          if tec = 'S' then
          begin
            if guardardatos(datos) = true then
            writeln(' Datos De Paciente Guardados ')
         else
            writeln(' Error El Numero Paciente Existe No Guardado ');
            writeln(' Pulse Una Tecla ');
          end;
      end;
  end;
 
  Procedure consultar(num : longint);
  var
    tt : longint;
    dto : paciente;
    si : boolean;
  begin
      si := false;
      tt := 0;
      assign(f,archi);
  {$I-} reset(f); {$I+}
    if ioresult <> 0 then
    begin
       writeln(' Error Archivo No Encontrado Pulse Una Tecla');
       readkey;
    end
 else
    begin
       for tt := 0 to filesize(f) - 1 do
       begin
          seek(f,tt);
          read(f,dto);
          if dto.numpac = num then
          begin
              si := true;
              break;
          end;
       end;
         if si = true then
         begin
         with datos do
         begin
         writeln(' Nombre = ',nombre);
         writeln(' Apellidos = ',apells);
         writeln(' Numero Paciente = ',numpac);
         writeln(' Edad = ',edad);
         case edad of
      0..18 : writeln(' Categoria = Menor De Edad');
     19..64 : writeln(' Categoria = Adulto');
    65..107 : writeln(' Categoria = Mayor');
        end;
         writeln(' Patolojia = ',patolg);
         writeln(' Importe Ingreso = ',ingreso:0:2);
         writeln(' Fecha Ingreso = ',fechent);
        if fechalt <> ' ' then
         writeln(' Fecha Actual = ', fechalt)
      else
         writeln(' Fecha Actual = ',diaingreso);
         writeln(' Total Importe = ',total:0:2);
         writeln;
        end;
       end
    else
       writeln(' El Paciente No Esta En Lista ');
     end;
     writeln(' Pulse Una Tecla');
     readkey;
end;
 
Procedure modificadatos(num : longint);
var
  mo, mdi : paciente;
  kk, jh : longint;
  term : boolean;
  deci : char;
 begin
    term := false;
    assign(f,archi);
 {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      writeln(' Error Archivo No Encontrado Pulse Una Tecla');
      readkey;
   end
else
    begin
       for jh := 0 to filesize(f) - 1 do
       begin
          seek(f,jh);
          read(f,mdi);
          if mdi.numpac = num then
          begin
              term := true;
              kk := jh;
              mo := mdi;
              break;
          end;
       end;
         if term = true then
         begin
           if mdi.activo = true then
           begin
           term := false;
           repeat
            clrscr;
         writeln(' ***** Menu Modificaciones *****');
         writeln;
         writeln(' N = Nombre');
         writeln(' A = Apellidos');
         writeln(' P = Num. Paciente');
         writeln(' E = Edad');
         writeln(' G = Patologia');
         writeln(' F = Fecha Ingreso');
         writeln(' S = Salir Y Guardar Cambios');
         writeln; writeln(' <<< Elija Opcion >>>');
         repeat
         deci := upcase(readkey);
         until deci in['N','A','P','E','G','F','S'];
         clrscr;
   case deci of
'N' : begin write(' Nombre : ');
       readln(mo.nombre);
     end;
'A' : begin
       write(' Apellidos : ');
       readln(mo.apells);
     end;
'P' : begin
       write(' Num. Paciente : ');
       readln(mo.numpac);
     end;
'E' : begin
       write(' Edad : ');
       readln(mo.edad);
     end;
'G' : begin
       write(' Patologia: ');
       readln(mo.patolg);
     end;
'F' : begin
       write(' Fecha Ingreso : ');
       readln(mo.fechent);
     end;
'S' : begin
       term := true;
     end;
   end;
   until term = true;
   mdi := mo;
   seek(f,kk);
   write(f,mdi);
  end;
 end;
   close(f);
 end;
end;
 
 
 
   Procedure eliminapaciente(num : longint);
   var
     bn, hh : longint;
   begin
     assign(f,archi);
   {$I-} reset(f); {$I+}
     if ioresult <> 0 then
     begin
        writeln(' Error Archivo No Encontrado Pulse Una Tecla');
        readkey;
     end
  else
      begin
         bn := 0;
         for hh := 0 to filesize(f) - 1 do
         begin
            seek(f,hh);
            read(f,datos);
            if datos.numpac <> num then
            begin
            end
         else
            begin
               datos.activo := false;
               seek(f,hh);
               write(f,datos);
            end;
          end;
           close(f);
       end;
     end;
 
    Procedure reportefinal(num : longint);
    var
      totl : real;
      pul : char;
      pos, tt : longint;
      sil : boolean;
      d, m, an : word;
      d1, m1, an1 : word;
      d3, m3, an3 : word;
      dar : string[2];
      ay : string[4];
      totaldias, error : integer;
    begin
        assign(f,archi);
     {$I-} reset(f); {$I+}
       if ioresult <> 0 then
       begin
          writeln(' Error Archivo No Encontrado Pulse Una Tecla');
          readkey;
        end
     else
         begin
         sil := false;
         for tt := 0 to filesize(f) - 1 do
         begin
             seek(f,tt);
             read(f,datos);
             if datos.numpac = num then
             begin
                sil := true;
                pos := tt;
                break;
             end;
         end;
           if sil = true then
           begin
              if datos.activo = true then
              begin
              writeln(' Entrada Fecha Alta Como [A]=Automatico O      [M]=Manual');
              repeat
                  pul := upcase(readkey);
              until pul in['A','M'];
              if pul = 'A' then
              datos.fechalt := diaingreso;
              if pul = 'M' then
              begin
                writeln(' Entre Fecha De Alta d/m/a¤o '); writeln;
                write(' Fecha : ');
                readln(datos.fechalt);
                if datos.fechalt[2] = '/' then
                insert('0',datos.fechalt,1);
                if datos.fechalt[5] = '/' then
                insert('0',datos.fechalt,4);
             end;
             dar := copy(datos.fechent,1,2);
             val(dar,d,error);
             dar := copy(datos.fechent,4,2);
             val(dar,m,error);
             ay := copy(datos.fechent,7,4);
             val(ay,an,error);
             dar := copy(datos.fechalt,1,2);
             val(dar,d1,error);
             dar := copy(datos.fechalt,4,2);
             val(dar,m1,error);
             ay := copy(datos.fechalt,7,4);
             val(ay,an1,error);
             d3 := 0; m3 := 0;
             an3 := 0;
             d3 := d1 - d;
             m3 := m1 - m;
             an3 := an1 - an;
             totaldias := (m3 * 30) + d3;
             if (datos.patolg = 'A') or (datos.patolg = 'a') then
             begin
                datos.total := (patoA * totaldias);
             end;
             if (datos.patolg = 'B') or (datos.patolg = 'b') then
             begin
                datos.total := (patoB * totaldias);
             end;
             if (datos.patolg = 'C') or (datos.patolg = 'c') then
             begin
                datos.total := (patoC * totaldias);
             end;
             datos.activo := false;
             clrscr;
             writeln(' ***** Reporte De Alta *****');
             writeln;
             writeln(' Fecha De Ingreso = ',datos.fechent);
             writeln(' Fecha De Alta = ',datos.fechalt);
             writeln(' Dias De Ingreso = ',totaldias);
             writeln(' Patologia = ',datos.patolg);
             writeln(' Total Importe = ',datos.total:0:2);
             writeln;
             writeln(' <<< Pulse Una Tecla >>>');
             readkey;
             seek(f,pos);
             write(f,datos);
             close(f);
          end
     else
         begin
           writeln(' El Paciente No Esta Activo ');
           writeln(' <<< Pulse Una Tecla >>>');
           readkey;
           close(f);
         end;
       end;
    end;
  end;
 
     Procedure menu;
     var
       tecla : char;
       sal : boolean;
       nnm : longint;
     begin
        sal := false;
     repeat
         clrscr;
         writeln(' ***** Menu General *****');
         writeln;
         writeln(' I = Incluir');
         writeln(' C = Consultar');
         writeln(' M = Modificar');
         writeln(' E = Eliminar');
         writeln(' R = Reporte Alta');
         writeln(' S = Salir');
         writeln;
         writeln(' <<< Elija Opcion >>>');
       repeat
           tecla := upcase(readkey);
       until tecla in['I','C','M','E','R','S'];
       clrscr;
     case tecla of
   'I' : entradapaciente;
   'C' : begin
           write(' Entre Num. Paciente : ');
           readln(nnm);
           consultar(nnm);
         end;
   'M' : begin
         write(' Entre Num. Paciente : ');
         readln(nnm); modificadatos(nnm);
         end;
   'E' : begin
            write(' Entre Num. Paciente : ');
            readln(nnm);
            eliminapaciente(nnm);
         end;
   'R' : begin
           write(' Entre Num. Paciente : ');
           readln(nnm);
           reportefinal(nnm);
         end;
   'S' : sal := true;
     end;
     until sal = true;
   end;
 
     begin
         clrscr;
         menu;
     end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar