mas ak pny mslh nich dengan print out menggunakan select option
yg mna tiap select option mempunyai halaman berbeda2
help me pleaseeee
print.php
<?php
session_start();
include 'conf.php';
$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';
$sql1 = "SELECT i.kode,i.description, DATE_FORMAT(i.tgl,'%e %b %Y'),
DATE_FORMAT(i.tgl,'%d'),c.nama_client,c.alamat1,c.kota,DATE_FORMAT(i.tgl_kirim,'%e %b %Y')
FROM t_salesorder i, t_client c
WHERE c.id=i.cust_id AND i.id='$id'";
$res1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_row($res1);
$tgl = stripslashes($row1[2]);
$thn = stripslashes($row1[3]);
$nama = stripslashes($row1[4]);
$alamat = stripslashes($row1[5]);
$kota = stripslashes($row1[6]);
$tgl_kirim= stripslashes($row1[7]);
$description = stripslashes($row1[1]);
$sql = "SELECT kode_brg,qty,unit,harga,sales_code,prod_code,nama_produk,np_detail FROM t_salesorderdetail WHERE id_so='$id'";
$res = mysql_query($sql) or die (mysql_error());
$data= array();
$i = 0;
while ($row = mysql_fetch_array($res)){
$data[$i] = $row;
$i++;
}
//print_r($data);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Cetak Faktur</title>
<link rel="shortcut icon" href="images/ico/logo.gif" />
<link href="../../../style/style.css" rel="stylesheet" type="text/css" />
<link href="../../../script/ui/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<link href="../../../script/vtip.css" rel="stylesheet" type="text/css" />
<script src="../../../script/jquery.js"></script>
<script src="../../../script/jquery.currency.js"></script>
<script src="../../../script/main.js"></script>
<style>
body{
background:none;
margin:10px;
}
th,td{padding:3px}
.style1 {color: #FFFFFF}
</style>
<script language="javascript">
// var winref = window.open('print4.php?&id=<?php echo $id ?>','windowName','width=400,height=400');
/*function print(){
var select=document.getElementById('select').value;
window.open('print4.php?id=<?php echo $id ?>&select='+select,'windowName','width=780,height=400');
} */
function print(){
var select=document.getElementById('select').value;
var select=1;
var select=2;
if (select == 1 );
{
window.open('print4.php?id=<?php echo $id ?>&select='+select,'windowName','width=780,height=400');
}else {
window.open('print3.php?id=<?php echo $id ?>&select='+select,'windowName','width=780,height=400');
}
}
</script>
</head>
<body>
<form action='' method='post'>
<table width="80%" border="0" align="center" cellpadding="1" bordercolor="#CCCCCC" bgcolor="#FFFFFF" style="border-collapse:collapse; border-bottom-color:#000000; border-bottom-style:inherit; border:double">
<tr>
<td width="10%" height='100' align='center' valign='middle'>
<select name="select" id="select">
<option value="1">Asli</option>
<option value="2">Copy</option>
<option value="3">Produksi</option>
</select>
<button type='button' value="Print" onclick="print()"><img src='images/ico/print.png' align='left' /> Cetak<br />
Sekarang</button><?php // <input type="button" value="Print Popup" onclick="if (window.print) winref.print()">
?></td>
<td width="90%" height='100' align='right' valign='top'>
<table width='300' border='0' cellpadding='1' cellspacing='1'>
<tr height='23'><td>Bandung, <?php echo $tgl; ?></td></tr>
<tr height='23'>
<td style='padding-right:10px'>Kepada Yth : <?php echo $nama; ?></td>
</tr>
<tr height='23'>
<td style='padding-right:10px'><?php echo $alamat; ?></td>
</tr>
<tr height='23'>
<td style='padding-right:10px'><?php echo $kota; ?></td>
</tr>
</table> </td>
</tr>
<tr>
<td align='left' colspan='2'>
<table width='1008' border='1' align="center" cellpadding='0' cellspacing='0' style="border-collapse:collapse; border:solid 1px #000">
<tr height='25'>
<th rowspan="2" bgcolor="#999999"><span class="style1">No</span></th>
<th rowspan="2" bgcolor="#999999"><span class="style1">Kode Barang</span></th>
<th colspan="2" bgcolor="#999999"><span class="style1">Code</span></th>
<th rowspan="2" bgcolor="#999999"><span class="style1">Nama Produk</span></th>
<th rowspan="2" bgcolor="#999999"><span class="style1">Qty</span></th>
<th rowspan="2" bgcolor="#999999"><span class="style1">Units</span></th>
<th rowspan="2" bgcolor="#999999"><span class="style1">Harga</span></th>
<th rowspan="2" bgcolor="#999999"><span class="style1">Subtotal</span></th>
</tr>
<tr height='25'>
<th bgcolor="#999999"><span class="style1">Sales</span></th>
<th bgcolor="#999999"><span class="style1">Prod</span></th>
</tr>
<?php
$sub = 0;
foreach($data as $row)
//for ($i=0;$i<soListNumber;$i++)
{
?>
<tr height='25'>
<td width='37' align="center"><?php echo $i++; ?></td>
<td width='188'><?php echo ($row['kode_brg']); ?><br /></td>
<td width='48' align='center'><?php echo $row['sales_code']; ?><br /></td>
<td width='66' align='center'><?php echo $row['prod_code']; ?><br /></td>
<td width='171' align='right'><?php echo $row['nama_produk']; ?><br /><?php echo $row['np_detail']; ?></td>
<td width='57' align='right'><?php echo $row['qty']; ?><br /></td>
<td align='center' width='81'><?php echo $row['unit']; ?><br /></td>
<td align='right' width='170' style='padding-right:5px'><?php echo "Rp. ".number_format($row['harga'],2 , ',' , '.'); ?> <br /></td>
<td align='right' width='170' style='padding-right:5px'><?php echo "Rp. ".number_format($row['harga']*$row['qty'],2 , ',' , '.'); ?><br /></td>
</tr>
<?php
$sub += ($row[1]*$row[3]);
}
?>
</table>
<br>
<table width='891' border='0' align="center" cellpadding='0' cellspacing='0'>
<tr height='25'>
<td colspan='4' rowspan='3'>
<table border='0'>
<tr height='70'>
<td width="78" align='center' valign='bottom'>
Marketing<br>
<br><br><br />(............) </td>
<td width="48" align='center' valign='bottom'> </td>
<td width="96" align='center' valign='bottom'>
Menyetujui<br>
<br><br>
<br />(...........) </td>
</tr>
</table> </td>
<td width="236"> </td>
<td width="251" align='right' style='padding-right:5px'>Total</td>
<td width="168" align='right' style='padding-right:5px'><?php echo "Rp. ".number_format($sub,2 , ',' , '.'); ?></td>
</tr>
<tr height='25'>
<td> </td>
<td align='right' style='padding-right:5px'>Tgl Kirim</td>
<td align='right' style='padding-right:5px'><?php echo $tgl_kirim; ?></td>
</tr>
</table> </td>
</tr>
<tr>
<td align='left' colspan='2'> </td>
</tr>
<tr>
<td align='left'> </td>
<td>
<input type="button" value="Kembali" class="buttonStyle" onclick="window.location='Indexso.php'" style="color:#0066FF; background-color:#00FF00"/></td>
</tr>
</table>
</form>
</body>
</html>
print3.php
<?php
include 'conf.php';
$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';
$select=$_REQUEST['select']?$_REQUEST['select']:'';
/*switch ($select){
case 1:$jenis="ASLI";
break;
case 2:$jenis="COPY";
break;
case 3:$jenis="MEMO <br>PRODUKSI";
break;
}*/
$sql1 = "SELECT i.kode,i.description, DATE_FORMAT(i.tgl,'%e %b %Y'),
c.nama_client,c.kode_client,c.alamat1,c.kota,DATE_FORMAT(i.tgl_kirim,'%e %b %Y')
FROM t_salesorder i, t_client c
WHERE c.id=i.cust_id AND i.id='$id'";
$res1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_row($res1);
$tgl = stripslashes($row1[2]);
$kode_client = stripslashes($row1[4]);
$nama = stripslashes($row1[3]);
$kode = stripslashes($row1[0]);
$tgl_kirim= stripslashes($row1[7]);
$description = stripslashes($row1[1]);
$sql = "SELECT kode_brg,sales_code,prod_code,nama_produk,qty,unit,harga,np_detail FROM t_salesorderdetail WHERE id_so='$id'";
$res = mysql_query($sql) or die (mysql_error());
$data= array();;
$i = 0;
while ($row = mysql_fetch_row($res)){
$data[$i] = $row;
$i++;
}
//print_r($data);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
th,td{padding:3px}
body{ font-size:14px; font-weight:normal; font-family:Arial}
.style3 {
font-size: 16px;
font-family: "Berlin Sans FB";
}
.style5 {
font-size: 13px;
font-family: "Berlin Sans FB";
}
.style18 {font-family: Calibri; font-weight: bold; font-size: 11px; }
.style23 {font-size: 10px}
.style24 {
font-family: "AvantGarde Md BT";
font-size: 14px;
}
.style25 {font-size: 11px; font-family: Calibri;}
.style26 {font-family: "Berlin Sans FB"; font-size: 10; }
.style32 {font-size: 18px}
.style34 {font-family: Arial; font-size: 12px; font-style: italic; }
.style35 {font-size: 13px}
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="2">
<tr>
<td scope="row">
<table width="100%" border="0" cellpadding="0">
<tr>
<td width="267" class="style24 style32" scope="row">VIARA Plastics</td>
<td colspan="3"> </td>
<td width="80"> </td>
</tr>
<tr>
<td scope="row"><span class="style3">Sales Order</span></td>
<td width="240" style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $tgl?></span></td>
<td width="441" style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode?></span></td>
<td width="441" > </td>
<td rowspan="2" align="center"><strong class="style3">MEMO<br />
PRODUKSI</strong></td>
</tr>
<tr>
<td scope="row"><span class="style5">Customer</span></td>
<td style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode_client; ?></span></td>
<td style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $nama; ?></span></td>
<td > </td>
</tr>
</table>
</td>
</tr>
<tr>
<td scope="row">
<table width="70%" border="1" cellpadding="0" style="border:1px solid #000; border-collapse:collapse">
<tr>
<td width="3%" rowspan="2" align="center" scope="row" style="padding-top:20px"><span class="style26">No.</span></td>
<td width="17%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" >Kode Barang</span></td>
<td colspan="2" align="center"><span class="style26">Code</span></td>
<td width="25%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" style="padding-top:20px">Nama Produk</span></td>
<td width="7%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Qty</span></td>
<td width="5%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Units</span></td>
<?php if ($select==1 || $select ==2){
?>
<?php } ?>
</tr>
<tr>
<td width="5%" align="center"><span class="style26">Sales</span></td>
<td width="5%" align="center"><span class="style26">Prod</span></td>
</tr>
<?php
$i=1;
$total = 0;
foreach($data as $row)
{
?>
<tr>
<td align="center" width="3%"><em><?php echo $i; ?></em></td>
<td width="17%" ><em><?php echo $row[0]; ?></em></td>
<td align="center"width="5%" ><em><?php echo $row[1]; ?></em></td>
<td align="center"width="5%" ><em><?php echo $row[2]; ?></em></td>
<td width="25%" ><em><?php echo $row[3]; ?><br />
<?php echo $row[7]; ?></em></td>
<td align="right" width="7%"><em><?php echo $row[4]; ?></em></td>
<td align="center" width="5%"><em><?php echo $row[5]; ?></em></td>
<?php if ($select==1 || $select ==2){
?><?php } ?>
</tr>
<?php
$i++;
$total += ($row[4]*$row[6]);
}
?>
</table>
</td>
</tr>
<tr>
<td scope="row">
<table width="100%" border="0" cellpadding="0">
<tr>
<td width="25%"> </td>
<td width="22%"> </td>
<?php if ($select==3){
?> <td width="23%"> </td>
<?php } ?>
<td align="right">
<table width="163" border="0" cellpadding="1">
<tr> <?php if ($select==1 || $select ==2) { ?>
<td width="70"><span class="style18"><span class="style35">TOTAL Rp</span>.</span></td>
<td width="83" align="right" style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><?php echo number_format($total,0 , ',' , '.'); ?></em></td>
<?php }?></tr>
<tr>
<td><span class="style25"><span class="style5">Tgl Kirim </span></span><span class="style18">:</span></td>
<td style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><strong><?php echo $tgl_kirim; ?></strong></em></td>
</tr>
</table> </td>
</tr>
<tr>
<td align="center" class="style26">Marketing</td>
<td align="center"><span class="style26">Menyetujui</span></td>
<?php if ($select==3){
?> <td align="center"><span class="style26">PPIC</span></td>
<?php } ?>
<td rowspan="2" align="right"><textarea cols="30" rows="5" style="border:solid 1px #000000; border-collapse:collapse">Keterangan :<?php echo $description ?> </textarea> </td>
</tr>
<tr height="100">
<td align="center"><br /><br />(....................................)</td>
<td align="center"><br /><br />(....................................)</td>
<?php if ($select==3){
?> <td align="center"><br /><br />(....................................)</td><?php } ?>
</tr>
</table>
</td>
</tr>
<tr>
<td scope="row"><span class="style23"></span></td>
</tr>
</table>
</body>
</html>
<script>
window.print();
</script>
prin4.php
<?php
include 'conf.php';
$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';
$select=$_REQUEST['select']?$_REQUEST['select']:'';
switch ($select){
case 1:$jenis="ASLI";
break;
case 2:$jenis="COPY";
break;
/*case 3:$jenis="MEMO <br>PRODUKSI";
break;
*/
}
$sql1 = "SELECT i.kode,i.description, DATE_FORMAT(i.tgl,'%e %b %Y'),
c.nama_client,c.kode_client,c.alamat1,c.kota,DATE_FORMAT(i.tgl_kirim,'%e %b %Y')
FROM t_salesorder i, t_client c
WHERE c.id=i.cust_id AND i.id='$id'";
$res1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_row($res1);
$tgl = stripslashes($row1[2]);
$kode_client = stripslashes($row1[4]);
$nama = stripslashes($row1[3]);
$kode = stripslashes($row1[0]);
$tgl_kirim= stripslashes($row1[7]);
$description = stripslashes($row1[1]);
$sql = "SELECT kode_brg,sales_code,prod_code,nama_produk,qty,unit,harga,np_detail FROM t_salesorderdetail WHERE id_so='$id'";
$res = mysql_query($sql) or die (mysql_error());
$data= array();;
$i = 0;
while ($row = mysql_fetch_row($res)){
$data[$i] = $row;
$i++;
}
//print_r($data);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
th,td{padding:3px}
body{ font-size:14px; font-weight:normal; font-family:Arial}
.style3 {
font-size: 16px;
font-family: "Berlin Sans FB";
}
.style4 {
font-size: 20px;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
}
.style5 {
font-size: 13px;
font-family: "Berlin Sans FB";
}
.style18 {font-family: Calibri; font-weight: bold; font-size: 11px; }
.style23 {font-size: 10px}
.style24 {
font-family: "AvantGarde Md BT";
font-size: 14px;
}
.style25 {font-size: 11px; font-family: Calibri;}
.style26 {font-family: "Berlin Sans FB"; font-size: 10; }
.style32 {font-size: 18px}
.style34 {font-family: Arial; font-size: 12px; font-style: italic; }
.style35 {font-size: 13px}
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="2">
<tr>
<td scope="row">
<table width="100%" border="0" cellpadding="0">
<tr>
<td width="267" class="style24 style32" scope="row">VIARA Plastics</td>
<td colspan="3"> </td>
<td width="80"> </td>
</tr>
<tr>
<td scope="row"><span class="style3">Sales Order</span></td>
<td width="240" style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $tgl?></span></td>
<td width="441" style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode?></span></td>
<td width="441" > </td>
<td rowspan="2" align="center"><span class="style4">
<?php echo $jenis
?></span></td>
</tr>
<tr>
<td scope="row"><span class="style5">Customer</span></td>
<td style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode_client; ?></span></td>
<td style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $nama; ?></span></td>
<td > </td>
</tr>
</table>
</td>
</tr>
<tr>
<td scope="row">
<table width="100%" border="1" cellpadding="0" style="border:1px solid #000; border-collapse:collapse">
<tr>
<td width="3%" rowspan="2" align="center" scope="row" style="padding-top:20px"><span class="style26">No.</span></td>
<td width="17%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" >Kode Barang</span></td>
<td colspan="2" align="center"><span class="style26">Code</span></td>
<td width="25%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" style="padding-top:20px">Nama Produk</span></td>
<td width="7%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Qty</span></td>
<td width="5%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Units</span></td>
<?php if ($select==1 || $select ==2){
?>
<td width="10%" rowspan="2" align="center"><span class="style26">Harga <br />
per Unit</span></td>
<td width="15%" rowspan="2" align="center"><span class="style26">Subtotal <br />
(Rp.)</span></td>
<?php } ?>
</tr>
<tr>
<td width="5%" align="center"><span class="style26">Sales</span></td>
<td width="5%" align="center"><span class="style26">Prod</span></td>
</tr>
<?php
$i=1;
$total = 0;
foreach($data as $row)
{
?>
<tr>
<td align="center" width="3%"><em><?php echo $i; ?></em></td>
<td width="17%" ><em><?php echo $row[0]; ?></em></td>
<td align="center"width="5%" ><em><?php echo $row[1]; ?></em></td>
<td align="center"width="5%" ><em><?php echo $row[2]; ?></em></td>
<td width="25%" ><em><?php echo $row[3]; ?><br />
<?php echo $row[7]; ?></em></td>
<td align="right" width="7%"><em><?php echo $row[4]; ?></em></td>
<td align="center" width="5%"><em><?php echo $row[5]; ?></em></td>
<?php if ($select==1 || $select ==2){
?><td align="right" width="10%"><em><?php echo number_format($row[6],0 , ',' , '.'); ?></em></td>
<td align="right" width="15%"><em><?php echo number_format($row[4]*$row[6],0 , ',' , '.'); ?></em></td>
<?php } ?>
</tr>
<?php
$i++;
$total += ($row[4]*$row[6]);
}
?>
</table>
</td>
</tr>
<tr>
<td scope="row">
<table width="100%" border="0" cellpadding="0">
<tr>
<td width="25%"> </td>
<td width="22%"> </td>
<?php if ($select==3){
?> <td width="23%"> </td>
<?php } ?>
<td align="right">
<table width="163" border="0" cellpadding="1">
<tr> <?php if ($select==1 || $select ==2) { ?>
<td width="70"><span class="style18"><span class="style35">TOTAL Rp</span>.</span></td>
<td width="83" align="right" style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><?php echo number_format($total,0 , ',' , '.'); ?></em></td>
<?php }?></tr>
<tr>
<td><span class="style25"><span class="style5">Tgl Kirim </span></span><span class="style18">:</span></td>
<td style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><strong><?php echo $tgl_kirim; ?></strong></em></td>
</tr>
</table> </td>
</tr>
<tr>
<td align="center" class="style26">Marketing</td>
<td align="center"><span class="style26">Menyetujui</span></td>
<?php if ($select==3){
?> <td align="center"><span class="style26">PPIC</span></td>
<?php } ?>
<td rowspan="2" align="right"><textarea cols="30" rows="5" style="border:solid 1px #000000; border-collapse:collapse">Keterangan :<?php echo $description ?> </textarea> </td>
</tr>
<tr height="100">
<td align="center"><br /><br />(....................................)</td>
<td align="center"><br /><br />(....................................)</td>
<?php if ($select==3){
?> <td align="center"><br /><br />(....................................)</td><?php } ?>
</tr>
</table>
</td>
</tr>
<tr>
<td scope="row"><span class="style23"></span></td>
</tr>
</table>
</body>
</html>
<script>
window.print();
</script>