Sabtu, 13 Juni 2020

Cetak Single PHP

Cetak Single:

INI JAVASCRIPTNYA:
<script type="text/javascript">
function PRINT(pk){
win=window.open('customer/print.php?pk='+pk,'win','width=1000, height=400, menubar=0, scrollbars=1, resizable=0, location=0, toolbar=0, username=0'); }
</script>

<script language="JavaScript">
function buka(url) {window.open(url, 'window_baru', 'width=800,height=600,left=320,top=100,resizable=1,scrollbars=1');}
</script>

INI CALLER NYA:
| <img src='ypathicon/print.png' alt='PRINT' OnClick="PRINT('<?php echo $status;?>')"> |




INI CODENYA:
<style type="text/css">body {width: 100%;} </style> 
<body OnLoad="window.print()" OnFocus="window.close()"> 
<?php
include "../konmysqli.php";
echo"<link href='../ypathcss/$css' rel='stylesheet' type='text/css' />";

$pk="";
$field="id_customer";
$TB="$tbcustomer";
$item="Customer";

$sql="select * from `$TB` order by `$field` asc";
if(isset($_GET["pk"])){
$pk=$_GET["pk"];
$sql="select * from `$TB` where `$field` ='$pk' order by `$field` asc";
}
?>


<h3><center>Laporan Data <?php echo $item;?> <?php echo $pk;?></h3>
 

<table width="98%" border="0">
  <tr>
    <th width="2%">No</td>
    <th width="50%">Nama Customer</td>
    <th width="10%">Status</td>
<th width="40%">Keterangan</td>
  </tr>
<?php  
 
  $jum=getJum($conn,$sql);
  $no=0;
if($jum > 0){
$arr=getData($conn,$sql);
foreach($arr as $d) {
$no++;
$id_customer=$d["id_customer"];
$nama_customer=$d["nama_customer"];
$alamat=$d["alamat"];
$telepon=$d["telepon"];
$email=$d["email"];
$username=$d["username"]
;$password=$d["password"];
$status=$d["status"];
$keterangan=$d["keterangan"];
$color="#cccccc";
if($no %2==1){$color="#dddddd";}

echo"<tr bgcolor='$color'>
<td>$no</td>
<td><b><a href='mailto:$email'>$nama_customer</b> ($id_customer)</a></br>
Alamat : <i>$alamat $telepon</i></td>
<td>$status</td>
<td>$keterangan</td>
</tr>";
}//while
}//if
else{echo"<tr><td colspan='7'><blink>Maaf, Data $item Belum Tersedia...</blink></td></tr>";}
?>

</table>

INI HASILNYA








Tidak ada komentar:

Posting Komentar

global_priv WARNING Selalu

 Jika muncul pesan kesalahan: Warning in .\libraries\classes\Dbal\DbiMysqli.php#209  mysqli::query(): (HY000/1034): Index for table 'glo...