Pascal/Turbo Pascal - proveedores(altas, bajas, modificaciones)

 
Vista:

proveedores(altas, bajas, modificaciones)

Publicado por DIANA.DIANITA (2 intervenciones) el 16/11/2013 21:30:38
HOLA!!! DISCULPA QUE MOLESTE ESTUVE VIENDO COMO HAN HECHO LO DEL COMERCIO. YO TENGO ALGO PARECIDO COMO PROPUESTA! ME SERVIRÁ SI LO MODIFICO? TENGO QUE REALIZAR "SEGÚN PROF" ARMAR SOBRE ALTAS BAJAS Y MODIFICACIONES COMO PARA UN RESTAURANTE, PROVEEDORES (CODIGO DE PROVEEDORES, NOMBRE DE PROVEEDOR, DIRECCION DE PROVEEDOR) Y QUE A SU VEZ VAYA REGISTRANDO LA CANTIDAD DE PRODUCTOS DE VENTA Y DISPONIBLES.... ME PODRIAS AYUDAR??? NO TENGO MUCHA IDEA DE COMO HACERLO. GRACIAS!!! ESPERO TU RESPUESTA!
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

proveedores(altas, bajas, modificaciones)

Publicado por ramon (2158 intervenciones) el 18/11/2013 17:39:22
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
{Algo así sirve}
 
 program restaurante;
  uses
    crt;
  const
     archi = 'producto.dat';
 
  type
    proveedor = record
         codipro : integer;
         nombrepro : string[80];
         direccionpro : string;
         producto : integer;
         cantidad : integer;
        end;
 
    almacen = record
        producto : integer;
        compra   : integer;
        stock    : integer;
       end;
 
    control = record
          prove : proveedor;
          alma  : almacen;
        end;
 
    var
      datos : control;
      f : file of control;
      inicio : integer;
 
  procedure guardar;
  begin
      assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      rewrite(f);
      seek(f,0);
      write(f,datos);
      close(f);
   end
 else
     begin
        seek(f,filesize(f));
        write(f,datos);
        close(f);
     end;
  end;
 
  function existeproveedor(nu : integer) : boolean;
  var
    b : longint;
    sal : boolean;
    tempo : control;
  begin
      if inicio > 0 then
      begin
      sal := false;
      assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       writeln('??? Error De Archivo Pulse Una Tecla ???');
       readkey;
   end
 else
    begin
       b := 0;
     repeat
         seek(f,b);
         read(f,tempo);
         if tempo.prove.codipro = nu then
         sal := true
       else
         b := b + 1;
     until (b > filesize(f) - 1) or (sal = true);
     close(f);
    end;
    existeproveedor := sal;
   end
  else
    existeproveedor := false;
  end;
 
  function existeproducto(nu : integer) : boolean;
  var
    b : longint;
    sal : boolean;
    tempo : control;
  begin
      if inicio > 0 then
      begin
      sal := false;
      assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       writeln('??? Error De Archivo Pulse Una Tecla ???');
       readkey;
   end
 else
    begin
       b := 0;
     repeat
         seek(f,b);
         read(f,tempo);
         if tempo.prove.producto = nu then
         sal := true
       else
         b := b + 1;
     until (b > filesize(f) - 1) or (sal = true);
     close(f);
    end;
      existeproducto := sal;
    end
  else
    existeproducto := false;
  end;
 
  procedure altas;
  var
    canti : integer;
  begin
     writeln('****** Entradas Productos ******');
     writeln;
     write('  Entre Codigo Proveedor      : ');
     readln(datos.prove.codipro);
     if existeproveedor(datos.prove.codipro) = false then
     begin
     write('  Entre Nombre Proveedor      : ');
     readln(datos.prove.nombrepro);
     write('  Entre Direccion Proveedor   : ');
     readln(datos.prove.direccionpro);
     write('  Entre Numero Del Producto   : ');
     readln(datos.prove.producto);
     write('  Entre Cantidad De Productos : ');
     readln(datos.prove.cantidad);
     end
   else
      begin
         write('  Entre Numero Del Producto   : ');
         readln(datos.prove.producto);
         write('  Entre Cantidad De Productos : ');
         readln(datos.prove.cantidad);
         if existeproducto(datos.prove.producto) = true then
         datos.prove.cantidad := datos.prove.cantidad + canti
       else
         datos.prove.cantidad := canti;
      end;
        datos.alma.producto := datos.prove.producto;
        datos.alma.compra := datos.prove.cantidad;
        datos.alma.stock := datos.alma.compra;
      guardar;
  end;
 
  procedure bajas;
  var
    prov : integer;
    tempor : file of control;
    ps, dd : longint;
  begin
     writeln('**** Vaja De Proveedor ****');
     writeln;
     write('   Entre Codigo Proveedor : ');
     readln(prov);
     assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       writeln('??? Error De Archivo Pulse Una Tecla ???');
       readkey;
   end
 else
    begin
     assign(tempor,'temporal.ttt');
     rewrite(tempor);
     dd := 0;
     for ps := 0 to filesize(f) - 1 do
     begin
     seek(f,ps);
     read(f,datos);
     if datos.prove.codipro <> prov then
     begin
        seek(tempor,dd);
        write(tempor,datos);
        dd := dd + 1;
     end;
   end;
      close(f);
      close(tempor);
      erase(f);
      rename(tempor,archi);
    end;
  end;
 
  procedure modificacion;
  var
    prove, canti, nupro : integer;
    cur : longint;
    enco : boolean;
  begin
     assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       writeln('??? Error De Archivo Pulse Una Tecla ???');
       readkey;
   end
 else
    begin
     writeln('*** Modificacion De Producto ***');
     writeln;
     write('   Entre Numero Proveedor : ');
     readln(prove);
     write('   Entre Numero Producto : ');
     readln(nupro);
     write('   Entre Numero Cantidad : ');
     readln(canti);
     cur := 0;
     enco := false;
    repeat
       seek(f,cur);
       read(f,datos);
       if (datos.prove.codipro = prove) and (datos.prove.producto = nupro) then
       begin
          datos.alma.compra := datos.alma.compra - canti;
          if datos.alma.compra <= 0 then
          datos.alma.stock := 0
        else
          datos.alma.stock := datos.alma.compra;
          seek(f,cur);
          write(f,datos);
          enco := true;
       end
     else
        cur := cur + 1;
    until (cur > filesize(f) - 1) or (enco = true);
    close(f);
  end;
 end;
 
  procedure verdatos_todos;
  var
    ww : longint;
    b : integer;
  begin
      assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       writeln('??? Error De Archivo Pulse Una Tecla ???');
       readkey;
   end
 else
    begin
       ww := 0;
       b := 1;
    repeat
    seek(f,ww);
    read(f,datos);
    writeln('  Codigo Producto     = ',datos.prove.codipro);
    writeln('  Nombre Proveedor    = ',datos.prove.nombrepro);
    writeln('  Direccion Proveedor = ',datos.prove.direccionpro);
    writeln('  Numero Producto     = ',datos.prove.producto);
    writeln('  Cantidad Comprada   = ',datos.prove.cantidad);
    writeln('  Cantidad Vendida    = ',datos.alma.compra);
    writeln('  Queda En Stock      = ',datos.alma.stock);
    writeln;
    writeln('  Pulse Una Tecla ');
    readkey;
    ww := ww + 1;
    until ww > filesize(f) - 1;
    writeln;
    writeln('  Fin De Fichero Pulse Una Tecla ');
    readkey;
    close(f);
    end;
  end;
 
  procedure menu;
  var
    salir : boolean;
    tev : char;
  begin
   assign(f,archi);
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      inicio := 0;
   end
 else
    begin
      inicio := 1;
      close(f);
    end;
     salir := false;
   repeat
        clrscr;
        writeln('  ****** Menu Jeneral ******');
        writeln;
        writeln('   1 = Entrada datos');
        writeln('   2 = Anular Proveedor');
        writeln('   3 = Modificacion Productos');
        writeln('   4 = Ver Todos Proveedores');
        writeln('   5 = Salir');
        writeln;
        writeln('  >>> Elija Opcion <<<');
        repeat
            tev := readkey;
        until tev in['1','2','3','4','5'];
        clrscr;
    case tev of
 '1' : altas;
 '2' : bajas;
 '3' : modificacion;
 '4' : verdatos_todos;
 '5' : salir := true;
   end;
   until salir = true;
  end;
 
 
   begin
      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
1
Comentar

proveedores(altas, bajas, modificaciones)

Publicado por DIANA.DIANITA (2 intervenciones) el 28/11/2013 15:53:22
MUCHAS GRACIAS RAMON.... ME SIRVIO DE MUCHOOO!!!!! GRACIASSSSSSSSSSSS!!!!!!!
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