Postingan lainnya
Jumlah data numerik di report
Gan, ane mau buat jumlah di tabel tapi hasilnya seperti dibawah ini :
Ini script nya :
<!doctype html>
<html>
<head>
<title>Print Preview Cetak Berita Acara Kesehatan Produk Hewan</title>
</head>
<style type="text/css">
* {
margin:0;
padding:0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background:#ddd;
}
.page {
position:relative;
width:21cm;
min-height:29.7cm;
page-break-after: always;
margin:2.5cm auto;
background:#FFF;
padding:2.5cm;
box-shadow:0 2px 10px rgba(0,0,0,0.3);
-webkit-box-sizing: none;
-moz-box-sizing: none;
box-sizing: none;
page-break-after: always;
}
.page-landscape {
position:relative;
width:29.7cm;
min-height:19cm;
page-break-after: always;
margin:2.5cm;
background:#FFF;
padding:2.5cm;
box-shadow:0 2px 10px rgba(0,0,0,0.3);
-webkit-box-sizing: none;
-moz-box-sizing: none;
box-sizing: none;
page-break-after: always;
}
.footer {
position:absolute;
bottom:2.5cm;
left:2.5cm;
right:2.5cm;
width:auto;
height:30px;
}
.kanan {
float:right;
}
.page *, .page-landscape * {
font-family:arial;
font-size:11px;
}
.it-grid {
background:#FFF;
border-collapse:collapse;
border:1px solid #000;
}
.seri {
font-family:'Lucida Handwriting';
}
.it-grid th {
color:#000;
border:1px solid #000;
border-top:1px solid #000;
background:#C4BC96;
}
.it-grid tr:nth-child(even) { background:#f8f8f8; }
.it-grid td, .it-grid th {
padding:3px;
border:1px solid #000;
}
.it-cetak td {
padding:5px 5px;
}
h1, h2, h3, h4, h5, h6 {
font-weight:normal;
}
table {
border-collapse:collapse;
}
td{
padding:1px;
}
.f14 {
font-size:14pt;
}
.f12 {
font-size:12pt;
}
.line-bottom{
border-bottom:1px solid black;
}
.detail {
margin-top:10px;
margin-bottom:10px;
}
.detail td{
padding:5px;
font-size:12px;
}
.detail span{
border-bottom:1px solid black;
display:inline-block;
font-size:12px;
}
.cetakan{
font-size:12px;
line-height:1.5em;
}
.cetakan-judul{
font-size:16px;
line-height:1.5em;
}
.cetakan *{
font-size:14px;
line-height:1.5em;
}
.cetakan span {
border-bottom:1px solid black;
display:inline-block;
}
.full {
width:100%;
}
nip {
display:inline-block;
width:130px;
}
a {
text-decoration:none;
color:#006600;
}
ol {
margin-left:30px;
}
ol > li {
padding:10px;
}
table { page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
thead { display:table-header-group }
tfoot { display:table-footer-group }
@media print {
body {
background:#ddd;
}
.page {
height:10cm;
padding:1.7cm;
box-shadow:none;
margin:0;
}
@page {
size: A4;
margin: 0;
-webkit-print-color-adjust: exact;
}
.page-landscape {
height:5cm;
padding:0.5cm;
box-shadow:none;
margin:0;
}
.footer {
bottom:0.7cm;
left:0.7cm;
right:0.7cm;
}
thead {
display: table-header-group;
}
}
</style>
<body>
<?php
$id=$_GET['id'];
$sql = mysqli_query($koneksi, "SELECT kesehatan_hewan.*, master_provinsi.provinsi_nama, master_kokab.kokab_nama, master_kecam.nama_kecam, dokter_hewan.*, pangkat.* FROM kesehatan_hewan
LEFT JOIN master_provinsi ON kesehatan_hewan.provinsi_id = master_provinsi.provinsi_id
LEFT JOIN master_kokab ON kesehatan_hewan.kota_id = master_kokab.kota_id
LEFT JOIN master_kecam ON kesehatan_hewan.kecam_id = master_kecam.kecam_id
LEFT JOIN dokter_hewan ON kesehatan_hewan.DokterID = dokter_hewan.id
LEFT JOIN pangkat ON dokter_hewan.PangkatIDDokter = pangkat.PangkatID
WHERE kesehatan_hewan.id=".$id) or die(mysqli_error());
while($r=mysqli_fetch_array($sql)){
date_default_timezone_set('Asia/Jakarta');
$TglCek = $r['TglCek'];
$timestamp = strtotime($TglCek);
$hari = date('l', $timestamp);
$tgl = date('d', $timestamp);
$bln = date('F', $timestamp);
$thn = date('Y', $timestamp);
function terbilang($x) {
$x = abs($x);
$angka = array("", "Satu", "Dua", "Tiga", "Empat", "Lima",
"Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas");
$temp = "";
if ($x <12) {
$temp = " ". $angka[$x];
} else if ($x <20) {
$temp = terbilang($x - 10). " Belas";
} else if ($x <100) {
$temp = terbilang($x/10)." Puluh". terbilang($x % 10);
} else if ($x <200) {
$temp = " Seratus" . terbilang($x - 100);
} else if ($x <1000) {
$temp = terbilang($x/100) . " Ratus" . terbilang($x % 100);
} else if ($x <2000) {
$temp = " Seribu" . terbilang($x - 1000);
} else if ($x <1000000) {
$temp = terbilang($x/1000) . " Ribu" . terbilang($x % 1000);
} else if ($x <1000000000) {
$temp = terbilang($x/1000000) . " Juta" . terbilang($x % 1000000);
} else if ($x <1000000000000) {
$temp = terbilang($x/1000000000) . " Milyar" . terbilang(fmod($x,1000000000));
} else if ($x <1000000000000000) {
$temp = terbilang($x/1000000000000) . " Trilyun" . terbilang(fmod($x,1000000000000));
}
return $temp;
}
#function nama_hari($bln, $tgl, $thn) {
#$hari = array(1=>'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu','Minggu');
//mencari no hari berdasarkan tanggal
#$no_hari=date("N", mktime(0,0,0, $bln, $tgl, $thn));
//menerjemahkan berdasarkan index pada array hari
#return $hari[$no_hari];
#}
if($hari=='Sunday'){$hari = "Minggu";}
elseif($hari=='Monday'){$hari = "Senin";}
elseif($hari=='Tuesday'){$hari = "Selasa";}
elseif($hari=='Wednesday'){$hari = "Rabu";}
elseif($hari=='Thursday'){$hari = "Kamis";}
elseif($hari=='Friday'){$hari = "Jum'at";}
elseif($hari=='Saturday'){$hari = "Sabtu";}
if($bln=='January'){$bln = "Januari";}
elseif($bln=='February'){$bln = "Pebruari";}
elseif($bln=='March'){$bln = "Maret";}
elseif($bln=='April'){$bln = "April";}
elseif($bln=='May'){$bln = "Mei";}
elseif($bln=='June'){$bln = "Juni";}
elseif($bln=='July'){$bln = "Juli";}
elseif($bln=='August'){$bln = "Agustus";}
elseif($bln=='September'){$bln = "September";}
elseif($bln=='October'){$bln = "Oktober";}
elseif($bln=='November'){$bln = "Nopember";}
elseif($bln=='December'){$bln = "Desember";}
?>
<div class="content-wrapper">
<div class="panel-body">
<div class="page">
<table border="0" width="100%">
<tr>
<td width="10%"><img src="assets/img/logo.png" width="100%"></td>
<td width="90%"><b><center><font size="5px" class="cetakan-judul">PEMERINTAH KOTA CILEGON<br />
DINAS KETAHANAN PANGAN DAN PERTANIAN</font><br />
<font size="3px">Jl. Kubang Laban No. 56 Cilegon Telp. (0254) 390941</font></b></center>
</tr>
</table>
<hr width="100%" size="12px">
<font size="4px" class="cetakan"><center><u><b>SURAT KETERANGAN KESEHATAN HEWAN</b></u></center></font>
<font size="3px" class="cetakan"><center>Nomor : <?php echo $r['kode_peternakan']; ?> / <?php echo $r['no_surat']; ?> / PKH </center></font><br />
<font size="3px" class="cetakan">
<div align="justify"> Yang bertanda tangan di bawah ini, Petugas Kesehatan Masyarakat Veteriner pada Dinas Ketahanan Pangan dan Pertanian Kota Cilegon, dengan ini menerangkan bahwa pada hari <?php echo ($hari); ?> tanggal <?php echo terbilang($tgl); ?> bulan <?php echo ($bln); ?> tahun <?php echo terbilang($thn);?> telah memeriksa Produk Asal Hewan dengan rincian sebagai berikut: </div><br />
<table border="0">
<tr>
<td width="35%">Nama Pemilik </td>
<td width="10%" align="center">:</td>
<td width="55%"><?php echo $r['NamaPemilik']; ?> </td>
</tr>
<tr>
<td>Alamat Pemilik</td>
<td align="center">:</td>
<td><?php echo $r['AlamatPemilik']." ".$r['nama_kecam']." ".$r['kokab_nama']." - ".$r['provinsi_nama']; ?> </td>
</tr>
<tr>
<td>Daerah Asal Hewan </td>
<td align="center">:</td>
<td><?php echo $r['DaerahAsalHewan']; ?> </td>
</tr>
<tr>
<td>Daerah Asal Tujuan </td>
<td align="center">:</td>
<td><?php echo $r['DaerahTujuanHewan']; ?> </td>
</tr>
</table>
<br />
<?php } ?>
<table border="1" repeat="1" width="90%" align="center" class="cetakan">
<thead>
<th width="5%"><center>No.</center></th>
<th width="15%"><center>JENIS HEWAN</center></th>
<th width="10%"><center>JENIS KELAMIN</center></th>
<th width="10%"><center>UMUR <br />(Tahun / Bulan)</center></th>
<th width="10%"><center>WARNA</center></th>
<th width="10%"><center>JUMLAH <br />(ekor)</center></th>
<th width="15%"><center>KETERANGAN</center></th>
</thead>
<?php
$no=0;
$id=$_GET['id'];
$sql = mysqli_query($koneksi, "SELECT detail_kesehatan_hewan.*, kesehatan_hewan.* FROM detail_kesehatan_hewan
LEFT JOIN kesehatan_hewan ON detail_kesehatan_hewan.khid = kesehatan_hewan.id
WHERE detail_kesehatan_hewan.khid=".$id) or die(mysqli_error());
while($r=mysqli_fetch_array($sql)){
$no++;
$jumlah += $r['jumlah'];
?>
<tr>
<td><center><?php echo $no; ?></center></td>
<td><?php echo $r['jenis_hewan']; ?></td>
<td><center><?php echo $r['jk_hewan']; ?></center></td>
<td><center><?php echo $r['umur']; ?></center></td>
<td><center><?php echo $r['warna']; ?></center></td>
<td><center><?php echo $r['jumlah']; ?></center></td>
<td><center><?php echo $r['keterangan']; ?></center></td>
</tr>
<tr>
<td colspan="7"><b> JUMLAH TOTAL HEWAN YANG DI BAWA : <?php echo $jumlah; ?> (<?php echo terbilang($jumlah);?>) Ekor</b></td>
</tr>
<?php } ?>
</table>
<br />
<div align="justify">Berdasarkan PEMERIKSAAN FISIK menyatakan bahwa HEWAN tersebut SEHAT dan tidak menunjukkan tanda-tanda penyakit hewan menular.
</div><br />
<table border="0" align="center">
<tr>
<?php
$id=$_GET['id'];
$sql = mysqli_query($koneksi, "SELECT kesehatan_hewan.*, dokter_hewan.*, pangkat.* FROM kesehatan_hewan
LEFT JOIN dokter_hewan ON kesehatan_hewan.DokterID = dokter_hewan.id
LEFT JOIN pangkat ON dokter_hewan.PangkatIDDokter = pangkat.PangkatID
WHERE kesehatan_hewan.id=".$id) or die(mysqli_error());
while($r=mysqli_fetch_array($sql)){
date_default_timezone_set('Asia/Jakarta');
$TglCek = $r['TglCek'];
$timestamp = strtotime($TglCek);
$hari = date('l', $timestamp);
$tgl = date('d', $timestamp);
$bln = date('F', $timestamp);
$thn = date('Y', $timestamp);
if($hari=='Sunday'){$hari = "Minggu";}
elseif($hari=='Monday'){$hari = "Senin";}
elseif($hari=='Tuesday'){$hari = "Selasa";}
elseif($hari=='Wednesday'){$hari = "Rabu";}
elseif($hari=='Thursday'){$hari = "Kamis";}
elseif($hari=='Friday'){$hari = "Jum'at";}
elseif($hari=='Saturday'){$hari = "Sabtu";}
if($bln=='January'){$bln = "Januari";}
elseif($bln=='February'){$bln = "Pebruari";}
elseif($bln=='March'){$bln = "Maret";}
elseif($bln=='April'){$bln = "April";}
elseif($bln=='May'){$bln = "Mei";}
elseif($bln=='June'){$bln = "Juni";}
elseif($bln=='July'){$bln = "Juli";}
elseif($bln=='August'){$bln = "Agustus";}
elseif($bln=='September'){$bln = "September";}
elseif($bln=='October'){$bln = "Oktober";}
elseif($bln=='November'){$bln = "Nopember";}
elseif($bln=='December'){$bln = "Desember";}
?>
<td width="70%">
<?php
include 'assets/phpqrcode/qrlib.php';
$tempdir = "temp/"; //<-- Nama Folder file QR Code kita nantinya akan disimpan
if (!file_exists($tempdir))#kalau folder belum ada, maka buat.
mkdir($tempdir);
$kode_peternakan = $r['kode_peternakan'];
$no_surat = $r['no_surat'];
$pkh = "PKH";
$nama = "qrcode-kesehatan-hewan.png";
$namafile = $r['no_surat']."-".$nama;
$quality = 'H'; //ada 4 pilihan, L (Low), M(Medium), Q(Good), H(High)
$ukuran = 4; //batasan 1 paling kecil, 10 paling besar
$padding = 0;
$isi_teks = $kode_peternakan." / ".$no_surat." / ".$pkh;
QRCode::png($isi_teks,$tempdir.$namafile,$quality,$ukuran,$padding);
?>
<img src="temp/<?php echo $namafile; ?>">
</td>
<td width="5%"></td>
<td width="30%" align="center">Cilegon, <?php echo $tgl." ".$bln." ".$thn; ?><br />
Dokter Hewan Berwenang<br /><br /><br /><br />
<?php echo $r['NamaDokter']; ?> <br />
<?php echo $r['Pangkat']; ?> <br />
NIP. <?php echo $r['NIPDokter']; ?></td>
</tr>
<?php } ?>
</table>
</font>
</div>
</div>
</div>
</body>
</html>
Kira2 salahnya dimana yah gan?
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban