#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <string.h>
void inpbrg();
void lapbrg();
void inpnil();
void lapnil();
void inpobt();
void lapobt();
void inpgjkry();
void lapgjkry();
main ()
{
int pil;
pil=0;
while(pil !=9)
{
clrscr();
printf("\t\t\t\n\n\n");
printf("\t\t\t\tMENU UTAMA\n");
printf("\t\t\t\t----------\n\n\n");
printf("\t\t\t ________________________________________\n");
printf("\t\t\t|1.| INPUT DATA BARANG |\n");
printf("\t\t\t|2.| LAPORAN DATA BARANG |\n");
printf("\t\t\t|3.| INPUT DATA NILAI MAHASISWA |\n");
printf("\t\t\t|4.| LAPORAN DATA NILAI MAHASISWA |\n");
printf("\t\t\t|5.| INPUT DATA OBAT |\n");
printf("\t\t\t|6.| LAPORAN DATA OBAT |\n");
printf("\t\t\t|7.| INPUT DATA GAJI KARYAWAN |\n");
printf("\t\t\t|8.| LAPORAN DATA GAJI KARYAWAN |\n");
printf("\t\t\t|9.| EXIT |\n");
printf("\t\t\t|__|____________________________________|\n\n");
printf("\t\t\tMASUKKAN PILIHAN :");scanf("%i",&pil);fflush(stdin);
if (pil==1)
{
inpbrg();
continue;
}
else
if (pil==2)
{
lapbrg();
continue;
}
else
if (pil==3)
{
inpnil();
continue;
}
else
if (pil==4)
{
lapnil();
continue;
}
else
if (pil==5)
{
inpobt();
continue;
}
else
if (pil==6)
{
lapobt();
continue;
}
else
if (pil==7)
{
inpgjkry();
continue;
}
else
if (pil==8)
{
lapgjkry();
continue;
}
else
if (pil==9)
{
exit;
}
}
}
FILE*fbrg;
struct
{
char nob[5],nmb[25],jebrg[3];
}Rbrg;
void inpbrg()
{
char dsb,td;
fbrg=fopen("dbrg.dat","a");
if (fbrg==NULL)
{
printf("FIle Data Tidak Dapat Diaktifkan ! ");
getch ();
exit(1);
}
td='Y';
while(td=='Y' || td=='y')
{
clrscr ();
printf("\t\t\t\n\n");
printf("\t\t\tWELCOME TO PROGRAM OF INPUT\n");
printf("\t\t\t PLEASE INPUT YOUR DATA\n\n\n");
printf("\t\t\t Input Data Obat\n");
printf("\t\t\t _______________\n\n\n");
printf("\tNomor Barang :");gets(Rbrg.nob);
printf("\tNama Barang :");scanf("%s",&Rbrg.nmb);fflush(stdin);
printf("\tJenis Barang [A1/A2/A3] :");scanf("%s",&Rbrg.jebrg);fflush(stdin);
printf("\t_________________________\n\n");
printf("\tDATA SUDAH BENAR [Y/T]?");scanf("%c",&dsb);fflush(stdin);
if (dsb=='Y' || dsb=='y')
{
fwrite(&Rbrg,sizeof(Rbrg),1,fbrg);
}
else
{
printf("\tDATA TIDAK DISIMPAN \n!");getch();
}
printf("\tTambah Data [Y/T] ?");scanf("%c",&td);fflush (stdin);
}
fclose(fbrg);
}
void lapbrg()
{
long int hs;
fbrg=fopen("dbrg.dat","r");
if (fbrg==NULL)
{
printf("FILE TIDAK BISA DIBUKA!");getch();
exit(1);
}
clrscr();
printf("\t\t\t\n\n\n");
printf("\t\t\tLAPORAN DATA BARANG\n");
printf("\t\t\t___________________\n\n\n");
printf("\t\t________________________________\n");
printf("\t\t| NOMOR | NAMA | HARGA |\n");
printf("\t\t| BARANG | BARANG | SATUAN |\n");
printf("\t\t|__________|_________|_________|\n");
/*|1234567890|123456789|123456789|*/
while(fread(&Rbrg,sizeof(Rbrg),1,fbrg)==1)
{
if ((strcmp(Rbrg.jebrg,"A1")==1) || (strcmp(Rbrg.jebrg,"a1")==1))
{
hs=10000;
}
else
if ((strcmp(Rbrg.jebrg,"A2")==1) || (strcmp(Rbrg.jebrg,"a2")==1))
{
hs=15000;
}
else
{
hs=20000;
}
printf("\t\t|%-10s|%-9s|%9li|\n",Rbrg.nob,Rbrg.nmb,hs);
}
printf("\t\t|__________|_________|_________|\n\n");
printf("\tDATA DITAMPILKAN ADALAH DATA DARI PROGRAM INPUT !\n\n\n\n\n");
printf("\tNOTE:\n");
printf("\t Data yang telah ditampilkan tidak dapat dirubah lagi !!\n");
printf("\t ____________________________________________________\n\n\n\n\n\n\n\n\n");
printf("\t\t\tRIANTO MAIJON SAPUTRA\n");
printf("\t\t\t 11101152610109\n");
printf("\t\t\t copyright\n");
getch();
fclose(fbrg);
}
FILE*fmhs;
struct
{
char nobp[16],nm[25];
int nuts,nuas;
}Rmhs;
void inpnil()
{
char dsb,td;
fmhs=fopen("dmhs.dat","w");
if (fmhs==NULL)
{
printf("FIle Data Tidak Dapat Diaktifkan ! ");
getch ();
exit(1);
}
td='Y';
while(td=='Y' || td=='y')
{
clrscr ();
printf("\t\t\n\n");
printf("\t\tWELCOME TO PROGRAM OF INPUT\n");
printf("\t\t PLEASE INPUT YOUR DATA\n\n\n");
printf("\t\tInput Data Nilai Algoritma\n");
printf("\t\t__________________________\n\n\n");
printf("\tNomor BP :");gets(Rmhs.nobp);
printf("\tNama :");gets(Rmhs.nm);
printf("\tNilai UTS :");scanf("%i",&Rmhs.nuts);fflush(stdin);
printf("\tNilai UAS :");scanf("%i",&Rmhs.nuas);fflush(stdin);
printf("\t__________________\n\n");
printf("\tDATA SUDAH BENAR [Y/T]?");scanf("%c",&dsb);fflush(stdin);
if (dsb=='Y' || dsb=='y')
{
fwrite(&Rmhs,sizeof(Rmhs),1,fmhs);
}
else
{
printf("\tDATA TIDAK DISIMPAN !\n");getch();
}
printf("\tTambah Data [Y/T] ?");scanf("%c",&td);fflush (stdin);
}
fclose(fmhs);
}
void lapnil()
{
float nr;
char ket[6];
fmhs=fopen("dmhs.dat","r");
if(fmhs==NULL)
{
printf("file tidak bisa dibuka!");
getch();
exit(1);
}
clrscr();
printf("\t\t\t\t\n\n\n");
printf("\t\t\t\tWELCOME TO PROGRAM OF REPORT \n\n\n\n\n");
printf("\tLaporan Data Nilai Algoritma\n");
printf("\t____________________________\n\n\n");
printf("\t_______________________________________________________________________\n");
printf("\t| NOMOR BP | NAMA | NILAI | NILAI | NILAI | KETERANGAN |\n");
printf("\t| | | UTS | UAS | RATA-RATA | |\n");
printf("\t|______________|_____________|_______|_______|___________|____________|\n");
/*|12345678901234|1234567890123|1234567|1234567|12345678901|123456789012|*/
while((fread(&Rmhs,sizeof(Rmhs),1,fmhs))==1)
{
nr=(Rmhs.nuts+Rmhs.nuas)/2;
if(nr>=55)
strcpy(ket,"LULUS");
else
strcpy(ket,"GAGAL");
printf("\t|%-14s|%-13s|%7i|%7i|%11.2f|%-12s|\n",Rmhs.nobp,Rmhs.nm,Rmhs.nuts,Rmhs.nuas,nr,ket);
}
printf("\t|______________|_____________|_______|_______|___________|____________|\n\n");
printf("\tData yang ditampilkan adalah data dari program input !! \n\n\n\n\n");
printf("\tNOTE:\n");
printf("\t Data yang telah tampil di laporan tidak dapat dirubah lagi !!\n");
printf("\t __________________________________________________________\n\n\n\n\n\n\n\n\n");
printf("\t\t\t\t RIANTO MAIJON SAPUTRA\n");
printf("\t\t\t\t 11101152610109\n");
printf("\t\t\t\t copyright\n");
getch();
fclose(fmhs);
}
FILE*fobat;
struct
{
char nob[5],nmob[25],jeob;
int job,hg;
}Robat;
void inpobt()
{
char dsb,td;
fobat=fopen("dobat.dat","w");
if (fobat==NULL)
{
printf("FIle Data Tidak Dapat Diaktifkan ! ");
getch ();
exit(1);
}
td='Y';
while(td=='Y' || td=='y')
{
clrscr ();
printf("\t\t\t\n\n");
printf("\t\t\tWELCOME TO PROGRAM OF INPUT\n");
printf("\t\t\t PLEASE INPUT YOUR DATA\n\n\n");
printf("\t\t\t Input Data Obat\n");
printf("\t\t\t _______________\n\n\n");
printf("\tNomor obat :");gets(Robat.nob);
printf("\tNama obat :");scanf("%s",&Robat.nmob);fflush(stdin);
printf("\tJenis obat [A/B/C] :");scanf("%c",&Robat.jeob);fflush(stdin);
printf("\tJumlah obat :");scanf("%i",&Robat.job);fflush(stdin);
printf("\tHarga satuan :");scanf("%i",&Robat.hg);fflush(stdin);
printf("\t___________________\n\n");
printf("\tDATA SUDAH BENAR [Y/T]?");scanf("%c",&dsb);fflush(stdin);
if (dsb=='Y' || dsb=='y')
{
fwrite(&Robat,sizeof(Robat),1,fobat);
}
else
{
printf("\tDATA TIDAK DISIMPAN \n!");getch();
}
printf("\tTambah Data [Y/T] ?");scanf("%c",&td);fflush (stdin);
}
fclose(fobat);
}
void lapobt()
{
float jeob;
char ket[25];
fobat=fopen("dobat.dat","r");
if(fobat==NULL)
{
printf("file tidak bisa dibuka!");
getch();
exit(1);
}
clrscr();
printf("\t\t\t\t\n\n\n");
printf("\t\t\t\tWELCOME TO PROGRAM OF REPORT\n\n\n\n");
printf("\tLAPORAN DATA OBAT \n");
printf("\t___________________\n\n\n");
printf("\t______________________________________________________________________\n");
printf("\t| NOMOR OBAT | NAMA OBAT | JUMLAH | HARGA | KETERANGAN |\n");
printf("\t| | | OBAT | SATUAN | |\n");
printf("\t|______________|_____________|_________|_________|___________________|\n");
/*|12345678901234|1234567890123|123456789|123456789|1234567890123456789|*/
while((fread(&Robat,sizeof(Robat),1,fobat))==1)
{
if(Robat.jeob=='A' || Robat.jeob=='a')
{
strcpy(ket,"OBAT KERAS");
}
else if (Robat.jeob=='B' || Robat.jeob=='b')
{
strcpy(ket,"OBAT KERAS TERBATAS");
}
else
strcpy(ket,"OBAT RINGAN");
printf("\t|%-14s|%-13s|%9i|%9i|%-19s|\n",Robat.nob,Robat.nmob,Robat.job,Robat.hg,ket);
}
printf("\t|______________|_____________|_________|_________|___________________|\n\n");
printf("\tDATA DITAMPILKAN ADALAH DATA DARI PROGRAM INPUT !\n\n\n");
printf("\tNOTE:\n");
printf("\t Data yang telah ditampilkan tidak dapat dirubah lagi !!\n");
printf("\t ____________________________________________________\n\n\n\n\n\n\n\n\n");
printf("\t\t\t\t RIANTO MAIJON SAPUTRA\n");
printf("\t\t\t\t 11101152610109\n");
printf("\t\t\t\t copyright\n");
getch();
fclose(fobat);
}
FILE*fkry;
struct
{
char nok[5],nk[25],kb;
int lk,jks;
}Rkry;
void inpgjkry()
{
char dsb,td;
fkry=fopen("dkry.dat","w");
if (fkry==NULL)
{
printf("File tidak Bisa dibuka !");getch();
exit (1);
}
td='y';
while(td=='y' || td=='Y')
{
clrscr ();
printf("\t\t\t\n\n");
printf("\t\t\tWELCOME TO PROGRAM OF INPUT \n");
printf("\t\t\t PLEASE INPUT YOUR DATA\n\n\n");
printf("\tInput data gaji karyawan \n");
printf("\t________________________ \n\n\n");
printf("\tNomor Karyawan :");gets(Rkry.nok);
printf("\tNama Karyawan :");gets(Rkry.nk);
printf("\tLama Kerja [tahun] :");scanf("%i",&Rkry.lk);fflush(stdin);
printf("\tJam Kerja Seminggu :");scanf("%i",&Rkry.jks);fflush(stdin);
printf("\tKode Bagian :");scanf("%c",&Rkry.kb);fflush(stdin);
printf("\t__________________\n\n");
printf("\tDATA SUDAH BENAR [Y/T]?");scanf("%c",&dsb);fflush(stdin);
if (dsb=='y' || dsb=='Y')
{
fwrite(&Rkry,sizeof(Rkry),1,fkry);
}
else
{
printf("\tData Tidak Disimpan !\n");getch();
}
printf("\tTambah Data [Y/T] ?");scanf("%c",&td);fflush(stdin);
}
fclose(fkry);
}
void lapgjkry()
{
long int gpj,gl,tgs;
char ket[20];
fkry=fopen("dkry.dat","r");
if(fkry==NULL)
{
printf("file tidak bisa dibuka!");
getch();
exit(1);
}
clrscr();
printf("\t\t\t\t\t\n\n\n");
printf("\t\t\t\t\tWELCOME TO PROGRAM OF REPORT\n\n\n\n\n");
printf("\tLAPORAN DATA GAJI PEGAWAI\n");
printf("\t_________________________\n\n\n");
printf("\t_______________________________________________________________________________________\n");
printf("\t| NOMOR | NAMA | GAJI/JAM | GAJI | TOTAL GAJI | KETERANGAN |\n");
printf("\t| KARYAWAN | KARYAWAN | (Rp) | LEMBUR(Rp) | SEMINGGU (Rp) | |\n");
printf("\t|_____________|____________|___________|____________|________________|________________|\n");
/*|1234567890123|123456789012|12345678901|123456789012|1234567890123456|1234567890123456|*/
while((fread(&Rkry,sizeof(Rkry),1,fkry))==1)
{
if (Rkry.lk<1)
gpj=10000;
else if
(Rkry.lk>=1 && Rkry.lk<=3)
gpj=15000;
else
gpj=20000;
if (Rkry.jks>40)
gl=(Rkry.jks-40)*(2*gpj);
else
gl=0;
tgs=(Rkry.jks*gpj)+gl;
if
(Rkry.kb=='A' || Rkry.kb=='a')
strcpy(ket,"BAGIAN KASIR");
else
if (Rkry.kb=='B' || Rkry.kb=='b')
strcpy(ket,"BAGIAN PELAYANAN");
else
strcpy(ket,"BAGIAN GUDANG");
printf("\t|%-13s|%-12s|%11li|%12li|%16li|%-16s|\n",Rkry.nok,Rkry.nk,gpj,gl,tgs,ket);
}
printf("\t|_____________|____________|___________|____________|________________|________________|\n\n");
printf("\tDATA DITAMPILKAN ADALAH DATA DARI PROGRAM INPUT !\n\n\n\n\n");
printf("\tNOTE:\n");
printf("\t Data yang telah ditampilkan tidak dapat dirubah lagi !!\n");
printf("\t ____________________________________________________\n\n\n\n\n\n\n\n\n");
printf("\t\t\t\t\tRIANTO MAIJON SAPUTRA\n");
printf("\t\t\t\t\t 11101152610109\n");
printf("\t\t\t\t\t copyright\n");
getch();
fclose(fkry);
}
Subscribe to:
Post Comments (Atom)
0 komentar:
Post a Comment