program nota_belanja;
uses wincrt;
type nota = record
kode : string;
nama_barang : string;
harga : real;
banyak : byte;
end;
var belanja : array[1..20] of nota;
kata,grs : string;
x,y,i,j : byte;
jum_harga,total_harga : real;
begin
clrscr;
grs := '========================================================================';
kata := 'Nota Belanja Barang Toko ABADI Jl.Riwa-riwi No.123 Surabaya';
x := round ((78-length(kata))/2);
gotoxy(x,2);writeln(kata);
x := round ((78-length(grs))/2);
gotoxy(x,3);write(grs);
gotoxy(x,4);write('Tanggal Pembelian:');
readln;
gotoxy(x,5);write('Nama Pembeli:');
readln;
gotoxy(x,6);write('Alamat:');
readln;
gotoxy(x,7);write(grs);
gotoxy(x,8);writeln('| No | Kode | Nama Barang | Harga Satuan | Jumlah | Jumlah Harga |');
gotoxy(x,9);write(grs);
i := 0;
total_harga := 0;
repeat
i := i+1;
gotoxy(x,9+i);write('|',i);
gotoxy(x+5,9+i);write('|');
gotoxy(x+9,9+i);readln(belanja[i].kode);
if belanja[i].kode <> '' then
begin
gotoxy(x+13,9+i);write(' |');
gotoxy(x+15,9+i);readln(belanja[i].nama_barang);
gotoxy(x+32,9+i);write('|');
gotoxy(x+33,9+i);readln(belanja[i].harga);
gotoxy(x+33,9+i);writeln(belanja[i].harga:10:2);
gotoxy(x+48,9+i);write('|');
gotoxy(x+50,9+i);readln(belanja[i].banyak);
gotoxy(x+57,9+i);write('|');
jum_harga := belanja[i].harga*belanja[i].banyak;
gotoxy(x+58,9+i);writeln(jum_harga:10:2);
gotoxy(x+72,9+i);writeln('|');
total_harga := total_harga + jum_harga;
end;
until
belanja[i].nama_barang='';
j := i-1;
gotoxy(x,10+j);write(grs);
gotoxy(x,10+j+1);write('Total Belanja (Rp) --------------------------------------:');
gotoxy(x+58,10+j+1);write(total_harga:10:2);
gotoxy(x+72,10+j+1);write('|');
gotoxy(x,12+j);write(grs);
end.