forked from kevin2000141/TubesDasPro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF2.pas
More file actions
130 lines (117 loc) · 3.29 KB
/
F2.pas
File metadata and controls
130 lines (117 loc) · 3.29 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
unit F2;
interface
uses uDef, sysutils;
const
NMax = 100;
var
a,b,e,f: Text;
c,d: array[1..NMax] of Text;
i,j : Integer;
S:String;
{ Deklarasi Fungsi/Prosedur }
procedure exit( var FEInventoriBahanMentah: Ainventori;
var FEInventoriBahanOlahan: Ainventori;
var FEResep: Aresep;
var NInvBM: Integer;
var NInvBO: Integer;
var NResep: Integer;
var NSim: Integer);
implementation
procedure exit( var FEInventoriBahanMentah: Ainventori;
var FEInventoriBahanOlahan: Ainventori;
var FEResep: Aresep;
var NInvBM: Integer;
var NInvBO: Integer;
var NResep: Integer;
var NSim: Integer);
var
temp : AnsiString;
begin
assign (e, 'Resep.txt');
reset (e);
for i:=1 to NSim do
begin
S:='InvBahanMentah.txt';
Insert (IntToStr(i),s,15);
assign (c[i], s);
reset (c[i]);
NInvBM[i]:=1;
while not(eof(c[i])) do
begin
readln (c[i], temp);
temp := shorten(temp);
FEInventoriBahanMentah[i,NInvBM[i]].nama:=copy(temp, 1, (pos('|',temp) -1));
delete(temp,1,(pos('|',temp)));
DefaultFormatSettings.ShortDateFormat := 'dd/mm/yyyy';
DefaultFormatSettings.DateSeparator := '/';
FEInventoriBahanMentah[i,NInvBM[i]].tanggal:=StrToDate(copy(temp, 1, (pos('|',temp) -1)));
delete(temp,1,(pos('|',temp)));
FEInventoriBahanMentah[i,NInvBM[i]].jumlah:=StrToInt(temp);
NInvBM[i]:=NInvBM[i] + 1;
end;
NInvBM[i]:= NInvBM[i] - 1;
close(c[i]);
{for j:=1 to NInvBM[i] do
begin
writeln (FEInventoriBahanMentah[i,j].nama, ' ', DateToStr(FEInventoriBahanMentah[i,j].tanggal), ' ', FEInventoriBahanMentah[i,j].jumlah);
end;
writeln();}
S:='InvBahanOlahan.txt';
Insert (IntToStr(i),s,15);
assign (d[i], s);
reset (d[i]);
NInvBO[i]:=1;
while not(eof(d[i])) do
begin
readln (d[i], temp);
temp := shorten(temp);
FEInventoriBahanOlahan[i,NInvBO[i]].nama:=copy(temp, 1, (pos('|',temp) -1));
delete(temp,1,(pos('|',temp)));
DefaultFormatSettings.ShortDateFormat := 'dd/mm/yyyy';
DefaultFormatSettings.DateSeparator := '/';
FEInventoriBahanOlahan[i,NInvBO[i]].tanggal:=StrToDate(copy(temp, 1, (pos('|',temp) -1)));
delete(temp,1,(pos('|',temp)));
FEInventoriBahanOlahan[i,NInvBO[i]].jumlah:=StrToInt(temp);
NInvBO[i]:=NInvBO[i] + 1;
end;
NInvBO[i]:= NInvBO[i] - 1;
close(d[i]);
{for j:=1 to NInvBO[i] do
begin
writeln (FEInventoriBahanOlahan[i,j].nama, ' ', DateToStr(FEInventoriBahanOlahan[i,j].tanggal), ' ', FEInventoriBahanOlahan[i,j].jumlah);
end;
writeln();}
end;
NResep:=1;
while not(eof(e)) do
begin
readln (e, temp);
temp := shorten(temp);
FEResep[NResep].nama:=copy(temp, 1, (pos('|',temp) -1));
delete(temp,1,(pos('|',temp)));
FEResep[NResep].harga:=StrToInt(copy(temp, 1, (pos('|',temp) -1)));
delete(temp,1,(pos('|',temp)));
FEResep[NResep].n:=StrToInt(copy(temp, 1, (pos('|',temp) -1)));
delete(temp,1,(pos('|',temp)));
for i:=1 to (FEResep[NResep].n - 1) do
begin
FEResep[NResep].bahan[i]:=(copy(temp, 1, (pos('|',temp) -1)));
delete(temp,1,(pos('|',temp)));
end;
FEResep[NResep].bahan[FEResep[NResep].n]:=temp;
NResep:=NResep+1;
end;
NResep:=NResep-1;
{for i:=1 to NResep do
begin
write(FEResep[i].nama, ' ', FEResep[i].harga, ' ', FEResep[i].n);
for j:=1 to FEResep[NResep].n do
begin
write(' ', FEResep[i].bahan[j]);
end;
writeln();
end;
writeln();}
close(e);
end;
end.