Pascal/Turbo Pascal - Ayuda con programa ABM en Registros (Urgente pls)

 
Vista:
sin imagen de perfil

Ayuda con programa ABM en Registros (Urgente pls)

Publicado por German (1 intervención) el 13/05/2014 19:08:18
hola a todos, tengo un problema con un programa de registros de ABM en pascal, no logro que guarde correctamente el archivo o que lo imprima bien, en realidad no se que parte es la que no funciona.

les dejo el archivo, si alguien puede ayudarme les agradecería.

cuando agrego un producto, proveedor o realizo una venta AL PARECER lo hace bien, pero al consulta la lista correspondiente, no imprime nada en pantalla mas que los titulos, registros vacios y con valores 0.
algunos procedimientos son:

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
Procedure Mostrar_ventas;
var
	fila, cant: integer;
 
begin
		clrscr;
		fila:=4;
	Writeln('**************************Listado de Ventas********************************|');
	Writeln('||CV||    ||Fecha||    ||Producto||    ||Cantidad Vendida||    Monto Total||');
	seek (archventas,0);
	cant:=0;
if filesize(archventas) <> 0 then
begin
 
   While cant <= filesize(archventas) do
      begin
           write('|');gotoxy(4,fila);write(cant+1);gotoxy(8,fila);write('|');
           write('|');gotoxy(10,fila);write(vent.fecha);gotoxy(20,fila);write('|');
           write('|');gotoxy(26,fila);write(vent.codproduc_venta);gotoxy(38,fila);write('|');
           write('|');gotoxy(46,fila);write(vent.cant_venta);gotoxy(54,fila);writeln('|');
      fila:=fila+1;
	  cant:=cant+1;
      end;
end
else
begin
	clrscr;
	write ('No hay archivos');
end;
   Writeln('******************************************************************************');
	readkey;
	close (archventas);
	reset (archventas);
end;

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
Procedure Vender;
begin
		clrscr;
		reset (archprod);
		reset (archventas);
		MUESTRA_PROD;
		reset (archprod);
		seek (archventas,filesize(archventas));
		GOTOXY (23,7); Write ('***Registrar Venta***');
 
		GOTOXY (23,11); Write ('Codigo del producto: ');                                 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
		READ (vent.codproduc_venta);
 
		GOTOXY (23,13); Write ('Fecha (dd/mm/aa): ');
		READ (vent.fecha);
 
 
		GOTOXY (23,15); Write ('Cantidad a Vender: ');
		READ (vent.cant_venta);
 
		seek (archprod,vent.codproduc_venta + 1);
 
		vent.Monto_total:= vent.cant_venta * prod.presuni;
 
		prod.Stock:= prod.Stock - vent.cant_venta;
 
		write (archventas,vent);
		write (archprod,prod);
		close(archprod);
		close(archventas);
end;

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
Procedure ALTA_PROVEEDORES;
VAR
		aux:char;
		   BEGIN
                clrscr;
                GOTOXY (20,7); Writeln ('**Dar de alta nuevo Proveedor**');
				GOTOXY (20,8); Writeln ('Esta seguro que quiere AGREGAR PROVEEDOR?');
				GOTOXY (20,9); Write   ('Precione cualquier tecla para continuar o "N" para salir:');
				read (aux);
				if (aux <> 'n') then
					begin
						clrscr;
						writeln;
						MUESTRA_PROV;
						seek (archprov,filesize(archprov));
						GOTOXY (23,4); Writeln ('**Dar de alta nuevo Proveedor**');
 
						GOTOXY (23,8); Write ('Ingrese Nombre: ');
						Readln (prov.Nom_prov);
 
						GOTOXY (23,10); Write ('Ingrese Direccion: ');
						Readln (prov.Direc_prov);
 
						GOTOXY (23,12); Write ('Ingrese Telefono: ');
						Readln (prov.Tel_prov);
 
						Write (archprov,prov); (*Guarda en el archivo*)
						close (archprov);
						reset(archprov);
					end;
			end;
 
Procedure BAJA_PROV;
Var (*Variables locales*)
        Cod_baja: integer; (* Variable independiente*)
        aux: char;
Begin
		 clrscr;
         gotoxy (20,7);Writeln ('**Dar de baja a Proveedor**');
         gotoxy (20,8); Write ('¿Esta seguro que quiere dar de baja el proveedor? Precione cualquier tecla para continuar o "N" para salir:');
 
                 read(aux);
                 if(aux<>'N')then
				 begin
					 clrscr;
					 MUESTRA_PROV;
					 gotoxy (22,5);write ('**Dar de baja a Proveedor**');
					 gotoxy(22,6);write ('Codigo:');
					 readln (cod_baja);
 
					 seek (archprov,cod_baja+1);
 
					 prov.Status:='B';
                 end;
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

Ayuda con programa ABM en Registros (Urgente pls)

Publicado por ramon (2158 intervenciones) el 15/05/2014 00:18:08
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
{Mira tu programa retocado un poco tienes que mejorarlo todo vía }
 
program CREA_ARCHIVO;
 
uses crt, dos;
const
   camino : string[28] = 'C:\FPC\2.0.2\bin\i386-win32\';
 
Type
Productos = record
Marca: string[25];
Talle: string [3];
Sexo:char;
Stock: integer;
Presuni: real;
Codprov_prod: integer;
Status: char;
end;
 
Proveedores = record
Nom_prov: string[25];
Direc_prov: string[30];
Tel_prov: integer;
Status: char;
end;
 
Ventas=record
fecha:String[8];
codproduc_venta:integer;
cant_venta:integer;
Monto_total:real;
end;
 
var
prod:productos;
archprod:FILE OF Productos; (*Hace referencia al conjunto de registro*)
 
prov:Proveedores;
archprov: FILE OF proveedores;
 
vent:Ventas;
archventas:File of Ventas;
 
tallesv:array[1..5]of string[3];
opcion: integer;
{/////////////////////////////////////////////////////////////// para borrar y volver a crear los arch
/////////////////////////////////////////////////////////////// para borrar y volver a crear los arch
//Procedure Abrir_Archivo;
//begin
//Assign (archprod,'C:/archprod.dat'); (*Asigna la logica a la fisica*)
//Assign (archprov, 'C:/archprov.dat'); 
//Assign (archventas,'C:/archventa.dat');
//Rewrite (archprod);
//Rewrite (archprov);
//Rewrite (archventas);
//end;
////////////////////////////////////////////////////////////////}
Procedure Abrir_Archivo;
begin
  {$I-}
   {Asigna el nombre de un fichero externo a una
    variable de tipo fichero}
   Assign(archprod,camino + 'Productos.dat'); (*Asigna la logica a la fisica*)
   {Abre un fichero existente tanto para lectura como escritura}
   Reset(archprod); (*Abre para solo lectura*)
 
   Assign(archprov, camino + 'Proveedores.dat');
   Reset(archprov);
 
   Assign(archventas,camino + 'Ventas.dat');
   Reset(archventas);
  {$I+}
 
If IoResult<>0 Then
	begin
	Rewrite (archprod);
	Rewrite (archprov);
	Rewrite (archventas);
	end;
 
tallesv[1]:='S';
tallesv[2]:='M';
tallesv[3]:='L';
tallesv[4]:='X';
tallesv[5]:='XXL';
 
end;
 
 
Procedure TALLE_PROD; (*Muestra la lista de marcas de los productos*)
Var
i:integer;
 
Begin
writeln ('|======== |');
writeln ('| TALLES  |');
writeln ('|======== |');
 
For i:=1 to 5 do(* Recorre el vector*)
  Begin
  writeln ('|',i,'-',tallesv[i],'|');
  end;
writeln ('|========|');
end;
 
Procedure MUESTRA_PROD; (*Muestra el codigo y el nombre de proveedores*)
var
cant:integer;
BEGIN
cant:=0;
writeln('|==========|');
writeln('|  MARCAS  |');
writeln('|==========|');
 if filesize(archprod) <> 0 then
begin
 While  cant <= filesize(archprod) - 1 do
   begin
        SEEK(archprod,cant);
        read(archprod,prod);
	writeln('|',cant+1,'-',prod.Marca,'|');
	cant:=cant+1;
    end;
end;
writeln('|==========|');
end;
 
Procedure MUESTRA_PROV; (*Muestra el codigo y el nombre de proveedores*)
var
cant:integer;
BEGIN
cant:=0;
writeln('|==========|');
writeln('|PROVEEDOR |');
writeln('|==========|');
if filesize(archprov) <> 0 then
begin
 WHILE cant <= filesize(archprov) - 1 do
   begin
      SEEK(archprov,cant);
      read(archprov,prov);
	writeln('|',cant+1,'-',prov.Nom_prov,'|');
	cant:=cant+1;
   end;
end;
 writeln('|==========|');
end;
 
Procedure ALTA_PRODUCTOS;
VAR
		aux:char;
		i:integer;
		   BEGIN
                clrscr;
                GOTOXY (20,7); Writeln ('**Dar de alta nuevo Producto**');
				GOTOXY (20,8); Writeln ('Esta seguro que quiere AGREGAR PRODUCTO?');
				GOTOXY (20,9); Write   ('Precione cualquier tecla para continuar o "N" para salir:');
				read (aux);
				if (aux <> 'n') then
				begin
				 clrscr;
				 TALLE_PROD;
				 writeln;
				 MUESTRA_PROD;
				 writeln;
				 MUESTRA_PROV;
				 GOTOXY (23,4); Writeln ('**Dar de alta nuevo Producto**');
 
				 seek (archprod,filesize(archprod));
 
				 GOTOXY (23,8); Write ('Ingrese Marca: ');
				 Readln (prod.Marca);
 
				 GOTOXY (23,10); Write ('Ingrese Talle: ');
				 Readln (i); (*Guarda en i lo que se escribe en pantalla*)
				 prod.Talle:=tallesv[i];
 
				 GOTOXY (23,12); Write ('Ingrese Sexo: ');
				 Readln (prod.Sexo);
 
				 GOTOXY (23,14); Write ('Ingrese cantidad: ');
				 Readln (prod.Stock);
 
				 GOTOXY (23,16); Write ('Ingrese precio por unidad: ');
				 Readln (prod.Presuni);
 
				 GOTOXY (23,18); Write ('Ingrese codigo del proveedor: ');
				 Readln (prod.Codprov_prod);
 
				 Write(archprod,prod); (*Guarda en el archivo*)
		           end;
 
			end;
 
Procedure BAJA_PROD;
Var (*Variables locales*)
        Cod_baja: integer; (* Variable independiente*)
        aux: char;
Begin
  clrscr;
         gotoxy (20,7);Writeln ('**Dar de baja a Producto**');
         gotoxy (20,8); Write ('Esta seguro que quiere dar de baja el ',
         'producto? Precione cualquier tecla para continuar o "N" para salir:');
 
                 read(aux);
                 if(aux<>'N')then
                 begin
                 clrscr;
                 MUESTRA_PROD;
                 gotoxy (22,5);write ('**Dar de baja a Producto**');
                 gotoxy(22,6);write ('Codigo:');
                 readln (cod_baja);
 
		 seek (archprod,cod_baja+1);
                 prod.Status:='B';
	      end;
            readln;
     End;
 
 
Procedure Mod_Prod;
var
   Cod_modif:integer;
   Campo_modif, i:integer;
   aux:char;
 
Begin
  clrscr;
  Gotoxy(20,7);writeln('**Modificar Producto**');
     Gotoxy(20,8);write(' ¿Esta seguro que quiere moificar? Precione cualquiere tecla para continuar o "N" para salir');
     read(aux);
     if(aux<>'N')then
     begin
         clrscr;
         Campo_modif:=0;
         MUESTRA_PROD;
         Gotoxy (24,7); write('**Datos del producto**');
         Gotoxy (24,9); write('Codigo:');
         readln(Cod_modif);
                 clrscr;
                 MUESTRA_PROD;
		 seek (archprod,cod_modif+1);
                 Gotoxy(24,7);write('**Datos del Producto**');
                 Gotoxy(24,10);write('Marca:',prod.Marca);
                 Gotoxy(24,11);write('Talle:',prod.Talle);
                 Gotoxy(24,12);write('Cantidad:',prod.Stock);
                 Gotoxy(24,13);write('Precio:',prod.Presuni:3:2);
                 Gotoxy(24,14);write('Codigo Proveedor:',prod.Codprov_prod);
 
                 Gotoxy(24,17);write('Elija el dato a editar');
                 Gotoxy(24,19);write('1-Marca');
                 Gotoxy(24,20);write('2-Talle');
                 Gotoxy(24,21);write('3-Cantidad');
                 Gotoxy(24,22);write('4-Precio');
                 Gotoxy(24,23);write('5-Codigo Proveedor');
                 Gotoxy(24,24);write('6-Cancelar y volver al menu');
 
                 Gotoxy(24,25);write('Opcion: ');
 
                 case Campo_modif of
 
                            1:begin
                                  clrscr;
                                  Gotoxy (20,8);write('Ingrese nueva marca: ');
                                  read(prod.Marca);
                                  write (archprod,prod);
                                  end;
                            2:begin
                                  clrscr;
                                  Gotoxy (20,9);write('Ingrese nuevo talle: ');
                                  read (i);
                                  prod.Talle:= tallesv [i];
                                  write (archprod,prod);
                                  end;
                            3:begin
                                  clrscr;
                                  Gotoxy (20,7);write('Ingrese nueva cantidad: ');
                                  read(prod.Stock);
                                  write (archprod,prod);
                                  end;
                            4:begin
                                  clrscr;
                                  Gotoxy (20,7);write('Ingrese nuevo precio: ');
                                  read(prod.Presuni);
                                  write (archprod,prod);
                                  end;
                            5:begin
                                  clrscr;
                                  Gotoxy (20,7);write('Ingrese codigo de proveedor: ');
                                  read(prod.Codprov_prod);
                                  write (archprod,prod);
			      end;
                            6:begin
                                  clrscr;
                                  Gotoxy (20,7);write('Volver al menu...');readln;
                                  readln;
                                  end;
                                end;
 
                    end;
              end;
 
{////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////}
 
Procedure ALTA_PROVEEDORES;
VAR
		aux:char;
		   BEGIN
                clrscr;
                GOTOXY (20,7); Writeln ('**Dar de alta nuevo Proveedor**');
				GOTOXY (20,8); Writeln ('Esta seguro que quiere AGREGAR PROVEEDOR?');
				GOTOXY (20,9); Write   ('Precione cualquier tecla para continuar o "N" para salir:');
				read (aux);
				if (aux <> 'n') then
				begin
				 clrscr;
				 writeln;
				 MUESTRA_PROV;
				 seek (archprov,filesize(archprov));
				 GOTOXY (23,4); Writeln ('**Dar de alta nuevo Proveedor**');
 
				 GOTOXY (23,8); Write ('Ingrese Nombre: ');
				 Readln (prov.Nom_prov);
 
				 GOTOXY (23,10); Write ('Ingrese Direccion: ');
				 Readln (prov.Direc_prov);
 
				 GOTOXY (23,12); Write ('Ingrese Telefono: ');
				 Readln (prov.Tel_prov);
 
				 Write (archprov,prov); (*Guarda en el archivo*)
			    end;
			end;
 
  Procedure BAJA_PROV;
  Var (*Variables locales*)
        Cod_baja: integer; (* Variable independiente*)
        aux: char;
  Begin
		 clrscr;
         gotoxy (20,7);Writeln ('**Dar de baja a Proveedor**');
         gotoxy (20,8); Write ('Esta seguro que quiere dar de baja el',
         ' proveedor? Precione cualquier tecla para continuar o "N" para salir:');
 
                 read(aux);
                 if(aux<>'N')then
		 begin
		  clrscr;
		  MUESTRA_PROV;
		  gotoxy (22,5);write ('**Dar de baja a Proveedor**');
		  gotoxy(22,6);write ('Codigo:');
		  readln (cod_baja);
 
		  seek (archprov,cod_baja+1);
 
		  prov.Status:='B';
                 end;
     End;
 
 
Procedure Mod_Prov;
var
   Cod_modif:integer;
   Campo_modif:integer;
   aux:char;
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

Ayuda con programa ABM en Registros (Urgente pls)

Publicado por ramon (2158 intervenciones) el 15/05/2014 00:19:35
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
{Resto}
 
Begin
  clrscr;
  Gotoxy(20,7);writeln('**Modificar Proveedor**');
     Gotoxy(20,8);write(' ¿Esta seguro que quiere moificar? Precione cualquiere tecla para continuar o "N" para salir');
     read(aux);
     if(aux<>'N')then
     begin
         clrscr;
         MUESTRA_PROV;
         Gotoxy (24,7); writeln('**Datos del proveedor**');
         Gotoxy (24,9); write('Codigo:');
         readln(Cod_modif);
 
                 clrscr;
                 MUESTRA_PROV;
		 seek (archprov,cod_modif+1);
                 Gotoxy(24,7);write('**Datos del Proveedor**');
                 Gotoxy(24,10);write('Nombre:',prov.Nom_prov);
                 Gotoxy(24,11);write('Direccion:',prov.Direc_prov);
                 Gotoxy(24,12);write('Telefono:',prov.Tel_prov);
 
                 Gotoxy(24,17);write('Elija el dato a editar');
                 Gotoxy(24,19);write('1-Nombre');
                 Gotoxy(24,20);write('2-Direccion');
                 Gotoxy(24,21);write('3-Telefono');
                 Gotoxy(24,22);write('4-Cancelar y volver al menu');
 
                 Gotoxy(24,25);write('Opcion: ');
                 Read (Campo_modif);
 
                 case Campo_modif of
 
                            1:begin
                                  clrscr;
                                  Gotoxy (20,8);write('Ingrese nuevo nombre: ');
                                  read(prov.Nom_prov);
                                  write (archprov,prov);
                                  end;
                            2:begin
                                  clrscr;
                                  Gotoxy (20,9);write('Ingrese nueva direccion: ');
                                  read (archprov,prov);
				  write (archprov,prov);
                                  end;
                            3:begin
                                  clrscr;
                                  Gotoxy (20,7);write('Ingrese nuevo telefono: ');
                                  read(prov.Tel_prov);
                                  write (archprov,prov);
                                  end;
                            4:begin
                                  clrscr;
                                  Gotoxy (20,7);write('Volver al menu...');readln;
                                  clrscr;
                                  end;
				end;
 
 
    end;
end;
{////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////}
Procedure Vender;
begin
		clrscr;
		reset (archprod);
		reset (archventas);
		MUESTRA_PROD;
		reset (archprod);
		seek (archventas,filesize(archventas));
		GOTOXY (23,7); Write ('***Registrar Venta***');
 
		GOTOXY (23,11); Write ('Codigo del producto: '); {/////////////////////////////////////////
                /////////////////////////////////////////////////////////////
                /////}
		READ (vent.codproduc_venta);
 
		GOTOXY (23,13); Write ('Fecha (dd/mm/aa): ');
		READ (vent.fecha);
 
 
		GOTOXY (23,15); Write ('Cantidad a Vender: ');
		READ (vent.cant_venta);
 
		seek (archprod,vent.codproduc_venta + 1);
 
		vent.Monto_total:= vent.cant_venta * prod.presuni;
 
		prod.Stock:= prod.Stock - vent.cant_venta;
 
		write (archventas,vent);
		write (archprod,prod);
    end;
 
{///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////}
 
Procedure Listar_PROD;
 var
        fila, cant: integer;
 
 Begin
       clrscr;
       fila:=4;
       Writeln ('============================================================================');
       writeln ('||Codigo||   ||Marca||   ||Talle||    ||Stock||   ||Precio||   ||Proveedor||');
       Writeln ('============================================================================');
	   cant:=0;
   if filesize(archprod) <> 0 then
    begin
         while cant <= filesize(archprod) - 1 do
         begin
              SEEK(archprod,cant);
              read(archprod,prod);
	      if prod.status<>'B'then
	      begin
	        Writeln('||');gotoxy(5,fila);write(cant+1);
		gotoxy(15,fila);write(prod.Marca);
		gotoxy(29,fila);write(prod.Talle);
		gotoxy(40,fila);write(prod.Stock);
		gotoxy(53,fila);write(prod.Presuni:3:2);
		gotoxy(65,fila);write(prod.Codprov_prod);gotoxy(75,fila); Writeln('||');
		fila:=fila+1;
		cant:=cant+1;
		end;
          end;
       end;
       writeln ('============================================================================');
       Readkey;
   end;
 
   Procedure Listar_PROV;
    var
        fila, cont: integer;
 
 Begin
       clrscr;
       fila:=4;
       Writeln ('=======================================================');
       writeln ('||Codigo||   ||Nombre||   ||Direccion||    ||Telefono||');
       Writeln ('=======================================================');
	   cont:=0;
     if filesize(archprov) <> 0 then
     begin
		 while cont <= filesize(archprov) - 1 do
         begin
              seek(archprov,cont);
              read(archprov,prov);
	      if prov.status<>'B'then
              begin
	        Write('||');gotoxy(5,fila);write(cont+1);
		Write('||');gotoxy(15,fila);write(prov.Nom_prov);
		Write('||');gotoxy(28,fila);write(prov.Direc_prov);
		Write('||');gotoxy(45,fila);write(prov.Tel_prov);gotoxy(53,fila);write         ('||');
		fila:=fila+1;
		cont:=cont+1;
	      end;
         end;
   end
else
begin
	clrscr;
	write ('No hay archivos');
   end;
       writeln ('=======================================================');
       Readkey;
       end;
 
 
 
{///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////}
Procedure Mostrar_ventas;
var
	fila, cant: integer;
 
begin
		clrscr;
		fila:=4;
	Writeln('**************************Listado de Ventas********************************|');
	Writeln('||CV||    ||Fecha||    ||Producto||    ||Cantidad Vendida||    Monto Total||');
	cant:=0;
   if filesize(archventas) <> 0 then
   begin
 
   While cant <= filesize(archventas) - 1 do
      begin
           seek(archventas,cant);
           read(archventas,vent);
           write('|');gotoxy(4,fila);write(cant+1);gotoxy(8,fila);write('|');
           write('|');gotoxy(10,fila);write(vent.fecha);gotoxy(20,fila);write('|');
           write('|');gotoxy(26,fila);write(vent.codproduc_venta);gotoxy(38,fila);write('|');
           write('|');gotoxy(46,fila);write(vent.cant_venta);gotoxy(54,fila);writeln('|');
          fila:=fila+1;
	  cant:=cant+1;
      end;
     end
  else
     begin
	clrscr;
	write ('No hay archivos');
    end;
   Writeln('******************************************************************************');
	readkey;
   end;
 
      Procedure Cerrar;
	begin
	  close(archventas);
	  close(archprov);
	  close (archprod);
	end;
 
    Procedure MENU_PRINCIPAL;
    Begin
      clrscr;
     textcolor(yellow);
     (*OPCION:=0;*)
     gotoxy (20,4);writeln('|============================|');
     gotoxy(20,5);writeln  ('|          MODA SHOP         |');
     gotoxy(20,6);writeln  ('|============================|');
     gotoxy(20,7);writeln  ('|1. VENDER PRODUCTO.         |');
     gotoxy(20,8);writeln  ('|2. PRODUCTOS.               |');
     gotoxy(20,9);writeln  ('|3. PROVEEDORES.             |');
     gotoxy(20,10);writeln ('|4. CONSULTAR VENTAS.        |');
     gotoxy(20,11);writeln ('|5. SALIR.                   |');
     gotoxy(20,12);writeln ('|============================|');
     gotoxy(20,13);writeln ('|Ingrese su Opcion:          |');
     gotoxy (20,14);writeln('|============================|');
     gotoxy(43,13);
 end;
 
 Procedure MENU_PRODUCTO;
 var
	aux:integer;
 Begin
   REPEAT
     clrscr;
     textcolor(yellow);
     gotoxy (20,4);writeln ('|============================|');
     gotoxy(20,5);writeln  ('|       MENU PRODUCTOS       |');
     gotoxy(20,6);writeln  ('|============================|');
     gotoxy(20,7);writeln  ('|1. Agregar Productos.       |');
     gotoxy(20,8);writeln  ('|2. Eliminar Productos.      |');
     gotoxy(20,9);writeln  ('|3. Modificar Datos.         |');
     gotoxy(20,10);writeln ('|4. Consultar Productos.     |');
     gotoxy(20,11);writeln ('|5. Volver al Menu Principal.|');
     gotoxy(20,12);writeln ('|============================|');
     gotoxy(20,13);writeln ('|Ingrese su Opcion:          |');
     gotoxy (20,14);writeln('|============================|');
     gotoxy(43,13);
	read (aux);
	Case aux of
		1:ALTA_PRODUCTOS;
 
		2:BAJA_PROD;
 
		3:Mod_Prod;
 
		4:Listar_PROD;
 
		5:aux:=6;
	end;
    Until aux=6;
 
   end;
 
   Procedure MENU_PROVEEDORE;
   var
	aux:integer;
    Begin
     REPEAT
       clrscr;
       textcolor(yellow);
       gotoxy (20,4);writeln ('|============================|');
       gotoxy(20,5);writeln  ('|      MENU PROVEEDORES      |');
       gotoxy(20,6);writeln  ('|============================|');
       gotoxy(20,7);writeln  ('|1. Agregar Proveedor        |');
       gotoxy(20,8);writeln  ('|2. Eliminar Proveedor       |');
       gotoxy(20,9);writeln  ('|3. Modificar Datos.         |');
       gotoxy(20,10);writeln ('|4. Consultar Proveedores.   |');
       gotoxy(20,11);writeln ('|5. Volver al Menu Principal |');
       gotoxy(20,12);writeln ('|=========================== |');
       gotoxy(20,13);writeln ('|Ingrese su Opcion:          |');
       gotoxy (20,14);writeln('|=========================== |');
       gotoxy(43,13);
	read (aux);
	Case aux of
		1:ALTA_PROVEEDORES;
 
		2:BAJA_PROV;
 
		3:Mod_Prov;
 
		4:Listar_PROV;
 
		5:aux:=6;
	 end;
   Until aux=6;
 
   end;
 
 
   BEGIN
      Abrir_Archivo;
      REPEAT
          Menu_Principal;
	  read (opcion);
 
      case opcion of
 
   1: Vender;
 
   2: Menu_Producto;
 
   3: MENU_PROVEEDORE;
 
   4: Mostrar_ventas;
 
   5: opcion:=6;
   end;
   until opcion=6;
   writeln;
   Cerrar;
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