-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAGAZZIN.PAS
executable file
·173 lines (166 loc) · 4.8 KB
/
MAGAZZIN.PAS
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
Program magazzino;
uses CRT;
const max=2;
type cent=1..100;
prezzi= record
p5:real;
p4:real;
p3:real;
p2:real;
p1:real;
end;
art= record
codice:cent;
descrizione:string;
prezVendita:real;
prezAcquisto:prezzi;
prezUltimoAcq:real;
reparto:string;
quantAttuale:word;
end;
var articoli:array[1..max] of art;
i,op:integer;
trovato:boolean;
procedure ValTotale;
var s,a,m:real;
begin
s:=0;
for i:=1 to max do
begin
a:=articoli[i].prezAcquisto.p5+
articoli[i].prezAcquisto.p4+
articoli[i].prezAcquisto.p3+
articoli[i].prezAcquisto.p2+
articoli[i].prezAcquisto.p1;
s:=s+a;
end;
m:=s/(max*5);
writeln;
writeln('IL VALORE TOTALE DEL MAGAZZINO E'': ',m:0:2);
end;
procedure ValProdotto;
var cod:cent;
v:real;
begin
writeln;
write('Inserire il codice del prodotto (1-100): ');
readln(cod);
writeln;
i:=0;
trovato:=false;
repeat
i:=i+1;
if articoli[i].codice=cod then
begin
trovato:=true;
v:=articoli[i].prezUltimoAcq*articoli[i].quantAttuale;
writeln('Il valore del prodotto con codice ',cod,' Š ',v:0:2);
end;
until (i=max) or trovato;
if not(trovato) then writeln('L''articolo con codice ',cod,' non esiste');
end;
procedure TuttoReparto;
var rep:string;
begin
writeln;
write('Inserire il nome del reparto: ');
readln(rep);
i:=0;
trovato:=false;
repeat
i:=i+1;
if articoli[i].reparto=rep then
begin
writeln;
trovato:=true;
writeln('Codice articolo: ',articoli[i].codice);
writeln('Descrizione: ',articoli[i].descrizione);
writeln('Prezzo dell''anno scorso: ',articoli[i].prezAcquisto.p1:0:2);
writeln;
end;
until i=max;
writeln;
if not(trovato) then writeln('Non esistono articoli nel reparto ',rep);
end;
begin
clrscr;
for i:=1 to max do
begin
textcolor(9);
writeln(' -------------------------------------------');
textcolor(10);
writeln(' MAGAZZINO');
textcolor(9);
writeln(' -------------------------------------------');
textcolor(7);
writeln;
textcolor(4);
writeln('Articolo nø ',i,'---');
writeln;
with articoli[i] do
begin
textcolor(6); write('Codice (1-100): ');
textcolor(7); readln(codice);
textcolor(6); write('Descrizione: ');
textcolor(7); readln(descrizione);
textcolor(6); write('Prezzo di vendita: ');
textcolor(7); readln(prezVendita);
with articoli[i].prezAcquisto do
begin
textcolor(6); write('Prezzo di acquisto di 5 anni fa: ');
textcolor(7); readln(p5);
textcolor(6); write('Prezzo di acquisto di 4 anni fa: ');
textcolor(7); readln(p4);
textcolor(6); write('Prezzo di acquisto di 3 anni fa: ');
textcolor(7); readln(p3);
textcolor(6); write('Prezzo di acquisto di 2 anni fa: ');
textcolor(7); readln(p2);
textcolor(6); write('Prezzo di acquisto dell''anno scorso: ');
textcolor(7); readln(p1);
end;
textcolor(6); write('Prezzo ultimo di acquisto: ');
textcolor(7); readln(prezUltimoAcq);
textcolor(6); write('Reparto: ');
textcolor(7); readln(reparto);
textcolor(6); write('Quantit… in giacenza attuale: ');
textcolor(7); readln(quantAttuale);
end;
readln;
clrscr;
end;
repeat
clrscr;
textcolor(9); write(' --- ');
textcolor(10); write('MENU ');
textcolor(9); write('---');
writeln;
writeln;
textcolor(7);
textcolor(white); write(' 1:');
textcolor(7); write(' Calcolo del valore totale del magazzino');
writeln;
textcolor(white); write(' 2: ');
textcolor(7); write('Calcolo del valore di un prodotto');
writeln;
textcolor(white); write(' 3: ');
textcolor(7); write('Visualizzazione della descrizione e del prezzo dell''anno scorso');
writeln;
write(' degli articoli di un reparto');
writeln;
writeln;
textcolor(red); write('Selezionare l''operazione desiderata: ');
textcolor(white);
readln(op);
until (op>0) and (op<4);
writeln;
writeln('--------- Operazione ',op,' ---------');
case op of
1: ValTotale;
2: ValProdotto;
3: TuttoReparto;
end;
textcolor(8);
writeln;
writeln('PREMERE UN TASTO PER USCIRE...');
readln;
end.