Ini adalah aplikasi untuk Logistik :
Program Logistik;
Uses Wincrt, windos;
Type BarangMasuk= record
Bnyk : array[1..5] of integer;
end;
Type BarangKeluar= record
Bnyk : array[1..5] of integer;
end;
Type DataBarang = Record
Bnyk : array[1..5] of integer;
End;
Const
Hari:array[0..6] of string[9] =
('Minggu', 'Senin','Selasa','Rabu','Kamis','Jumat','Sabtu');
Jns:array[1..5] of string[9] =
('Beras','Pakaian','Minyak','Mi','Jajan');
Satuan:array[1..5] of string[5]=
('Kg','Helai','Lt','Bngks','Bngks');
Var FileBrg : File Of DataBarang;
FileM : File Of BarangMasuk;
FileK : File Of BarangKeluar;
Data : DataBarang;
DtMasuk : BarangMasuk;
DtKeluar : BarangKeluar;
Pil,Ul : Char;
year, m, d, dow :word;
i : Integer;
TBnyk:array[1..5] of integer;
label awal;
procedure PadString(S: String; PadLen: Integer);
begin
Write(S, ' ':PadLen - Length(S));
end;
Procedure BukaFile;
Begin
Assign(FileBrg,'Brg.Dat');
{$I-};
Reset(FileBrg);
{$I+};
End;
Procedure BukaFileMasuk;
Begin
Assign(FileM,'BrgMasuk.Dat');
{$I-};
Reset(FileM);
{$I+};
End;
Procedure BukaFileKeluar;
Begin
Assign(FileK,'BrgKeluar.Dat');
{$I-};
Reset(FileK);
{$I+};
End;
Procedure MENU;
Begin
clrscr;
Gotoxy(34,1);write('MENU PILIHAN');
Gotoxy(34,2);write('============');
Gotoxy(27,4);write('1. Masukan Barang');
Gotoxy(27,5);write('2. Keluarkan Barang ');
Gotoxy(27,6);write('3. Tampilkan Data');
Gotoxy(27,10);write('9. Keluar(Exit)');
Gotoxy(32,12);write('Pilihan[1..9]:');Pil:=Readkey;
End;
{TAMBAH-------------------------TAMBAH}
Procedure Tambah;
Var Lagi : Char;
i,j, banyak : Integer;
Code, jenis, satuan : String;
label cek;
Begin
Lagi :='Y';
BukaFile;
If IOResult<>0 Then
Rewrite(FileBrg);
Repeat
Clrscr;
BukaFile;
If IOResult<>0 Then begin
Rewrite(FileM); end;
writeln(' MASUKAN BARANG ');
Writeln(' ==========================');
getDate(year,m,d,dow);
writeln(Hari[dow],' ', M:0, '-', d:0, '-', year:0);
writeln;
write('Nama Atau Jenis Barang : ');Readln(Jenis);
for j:=1 to Length(Jenis) do begin
Jenis[j]:=Upcase(jenis[j]);
end;
if Jenis='BERAS' then begin i:=1; end
else if Jenis='PAKAIAN' then begin i:=2; end
else if Jenis='MINYAK' then begin i:=3; end
else if Jenis='MI' then begin i:=4; end
else if Jenis='JAJAN' then begin i:=5; end
else begin Writeln('Jenis Barang Yang Akan Dimasukan, Tidak Boleh Masuk Ke Gudang');
goto cek;
end;
write('Banyak Barang : ');Readln(Banyak);
Data.Bnyk[i]:=Data.Bnyk[i]+Banyak;
write(FileBrg,Data);
close (FileBrg);
BukaFileMasuk;
If IOResult<>0 Then begin
Rewrite(FileM); end;
DtMasuk.Bnyk[i]:=DtMasuk.Bnyk[i]+Banyak;
write(FileM,DtMasuk);
close (FileM);
cek:
write('Mau Tambah Data Lagi [y/t]:');Lagi:=Upcase(Readkey);
Until Lagi <> 'Y';
Clrscr;
Writeln('Barang berhasil masuk tanggal ', M:0, '-', d:0, '-', year:0);
writeln;
Writeln(' ===================================');
Writeln('| NO | Jenis | Banyak Barang |');
Writeln(' ===================================');
for j:=1 to 4 do begin
Write('|',j:2,' | ');PadString(Jns[j],12);Writeln('| ',DtMasuk.Bnyk[j],' ':5,' |');
end;
Writeln(' ===================================');
Writeln;
Write('Tekan Tombol Apapun Untuk Melanjutkan');Readkey;
End;
{ENDTAMBAH-------------------------ENDTAMBAH}
{Keluar-------------------------------Keluar}
Procedure keluar;
Var FileBrgKluar : File Of DataBarang;
Lagi,Klr : Char;
Ada : Boolean;
i,j : Integer;
Banyak : Integer;
Jenis : String;
label
cek;
Begin
Ul :='Y';
Lagi :='Y';
Clrscr;
BukaFile;
If IOResult <> 0 Then begin
Write('Maaf Data Masih Kosong!');
Readkey;
end
else begin
Repeat
Writeln(' BARANG KELUAR ');
Writeln(' ==========================');
getDate(year,m,d,dow);
writeln(Hari[dow],' ', M:0, '-', d:0, '-', year:0);
writeln;
write('Jenis Barang : ');Readln(Jenis);
Read(FileBrg,Data);
for j:=1 to Length(Jenis) do begin
Jenis[j]:=Upcase(jenis[j]);end;
if Jenis='BERAS' then begin i:=1; end
else if Jenis='PAKAIAN' then begin i:=2; end
else if Jenis='MINYAK' then begin i:=3; end
else if Jenis='MI' then begin i:=4; end
else if Jenis='JAJAN' then begin i:=5; end
else begin Writeln('Jenis Barang Yang Akan Dikelurakan, Tidak Ada Di Gudang');
goto cek; end;
write('Berapa banyak : ');Readln(Banyak);
if Banyak>Data.Bnyk[i] then begin writeln('Barang Yang Diminta Tidak Cukup'); goto Cek; end
else begin
Data.Bnyk[i]:=Data.Bnyk[i]-Banyak;
write(FileBrg,Data);
close (FileBrg);
BukaFileKeluar;
If IOResult<>0 Then begin
Rewrite(FileK); end;
DtKeluar.Bnyk[i]:=DtKeluar.Bnyk[i]+Banyak;
write(FileK,DtKeluar);
close (FileK);
writeln(Jenis,' Keluar, Sebanyak ', Banyak);end;
Cek:
writeln('Mau Mengeluarkan Barang Lagi [Y/T]:');
Lagi:=Upcase(Readkey);
Until Lagi <> 'Y';
Clrscr;
Writeln('Barang berhasil masuk keluar', M:0, '-', d:0, '-', year:0);
writeln;
Writeln(' ===================================');
Writeln('| NO | Jenis | Banyak Barang |');
Writeln(' ===================================');
for j:=1 to 4 do begin
Write('|',j:2,' | ');PadString(Jns[j],12);Writeln('| ',DtKeluar.Bnyk[j],' ':5,' |');
end;
Writeln(' ===================================');
Writeln;
Write('Tekan Tombol Apapun Untuk Melanjutkan');Readkey;
End;
end;
{KELUAR END----------------------------------------------------KELUAR END}
Procedure Tampil;
Var j :Integer;
Begin
clrscr;
BukaFile;
If IOResult <> 0 Then begin
Write('Maaf Data Masih Kosong!');
Readkey;
end
Else
Begin
Writeln(' DATA BARANG ');
Writeln(' ===================================');
getDate(year,m,d,dow);
writeln(Hari[dow],' ', M:0, '-', d:0, '-', year:0);
writeln;
Writeln(' ===================================');
Writeln('| NO | Jenis | Banyak Barang |');
Writeln(' ===================================');
Read(FileBrg,Data);
for j:=1 to 4 do begin
Write('|',j:2,' | ');PadString(Jns[j],12);Writeln('| ',Data.Bnyk[j],' ':5,' |');
end;
Writeln(' ===================================');
Writeln;
Write('Tekan Tombol Apapun Untuk Melanjutkan');Readkey;
end;
end;
Begin
awal:
Repeat
Menu;
Case Pil Of
'1' : Tambah;
'2' : Keluar;
'3' : Tampil;
End;
Until (Pil='9');
DoneWinCrt;
End.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment