Print di Kertas 1/2 Continuous Form

M. Saiful A. Rachman · Mar 13, 2013
Mohon maaf teman-teman dan bang ellyx mau tanya nich... saya punya masalah ketika akan print. yang jadi permasalahan yaitu... 1/2 kertas quarto continuous form agar bisa muat banyak dan huruf besar-besar, maka margin atas bawah kanan kiri seminim mungkin. dan bisa kah bentuknya di tetapkan.. misalnya untuk 1/2 halaman quarto continuous form maximum bisa memuat 5 item barang (jadi walau 1 barang hasil print nya tetap seperti 5 barang..jadi yang lainnya kosong hanya ada 1 item yang ke print-intinya bentuk tabel nya tetap semaksimum 1/2 quarto walau isinya cuma ada 1 barang ), jika lebih menggunakan 1 halaman quarto... berikut scrip yang sudah saya buat..
<? session_start();
$nama = $_SESSION['username'];
 ?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
<? include "koneksi.php"; ?>
<script type="text/javascript">

function printpage()

{

window.print()

}

</script>
<link rel="shortcut icon" href="images/kent.ico" >
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>

<?php
include "koneksi.php";
$id=$_POST['id1'];

$sql = mysql_query("SELECT * FROM penjualan WHERE id_penjualan = $id");
$hasil = mysql_fetch_array($sql);
$idc = $hasil['id_costumer'];
$ids = $hasil['id_sales'];
$costumer = mysql_query("SELECT * FROM costumer WHERE id_costumer = $idc ");
$hasilc = mysql_fetch_array($costumer);
$sales = mysql_query("SELECT * FROM sales WHERE id_sales = $ids ");
$hasils = mysql_fetch_array($sales);
?>

<body>
<div id="wrapper">
<div id="divso">
	<table id="so">
		<tr>
			<td colspan="3" align="center"><font size="3"><b>Sales Order</b></font></td>
		</tr>
		<tr>
			<td height="20" align="center"><font size="2">No : <b><? echo $hasil['no_so'] ?></b></font></td>
		</tr>
	</table>
</div>
<div id="batas"></div>
<div id="divco">
   <form method="post">
	<table id="company" height="118" cellspacing="0" cellpadding="0" vspace="0">
		<tr class="company">
			<td width="100" height="19">Company</td>
			<td width="25">:</td>
			<td width="250" colspan="4"><? echo $hasilc['nama_costumer']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Address</td>
			<td>:</td>
			<td colspan="4"><? echo $hasilc['alamat']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Attention</td>
			<td>:</td>
			<td colspan="4"><? echo $hasilc['attention']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Position</td>
			<td>:</td>
			<td colspan="4"><? echo $hasilc['posisi']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Telp.</td>
			<td>:</td>
			<td><? echo $hasilc['telepon']; ?></td>
			<td width="47">&nbsp;Fax.</td>
			<td width="7">:</td>
			<td width="243"><? echo $hasilc['fax']; ?></td>
		</tr>
		<tr>
			<td height="19">&nbsp;</td>
		</tr>
	</table>
   </form>
</div>
<div id="divsa">
	<table id="sales" height="118" cellspacing="0" cellpadding="0" vspace="0">
		<tr>
			<td height="19">Date</td>
			<td>:</td>
			<?
				$date=date('Y-m-d');
			?>
			<td><? echo $date ?></td>
		<tr>
			<td width="100" height="19">Sales</td>
			<td width="25">:</td>
			<td width="250"><? echo $hasils['nama_sales']; ?></td>
		</tr>
		<tr>
			<td height="19">DO No.</td>
			<td>:</td>
			<td><? echo $hasil['no_do']; ?></td>
		</tr>
		<tr>
			<td height="19">PO No.</td>
			<td>:</td>
			<td><? echo $hasil['no_po']; ?></td>
		</tr>
		<tr>
			<td height="19">Delivery Date</td>
			<td>:</td>
			<td><? echo $hasil['tgl_do']; ?></td>
		</tr>
		<tr>
			<td height="19">Pay Terms</td>
			<td>:</td>
			<td><? echo $hasil['payterms']; ?> Hari</td>
		</tr>
	</table>
   </form>
</div>

<div id="clearnir"></div>
<div id="batas"></div>
<div id="divcon">
	<table id="content" border="1" bordercolordark="#000000" cellspacing="0" cellpadding="0" vspace="0">
		<tr align="center" >
			<td width="24" rowspan="3" >No</td>
			<td width="123" rowspan="3">Model</td>
			<td colspan="12">Quantity(pairs)</td>
			<td width="62" rowspan="3">Pair</td>
			<td width="64" rowspan="3">Size</td>
			<td width="68" rowspan="3">Disc %</td>
			<td width="163" rowspan="3">Rekamarks</td>
		</tr>
		<tr align="center">
			<td width="34">3</td>
			<td width="34">4</td>
			<td width="34">5</td>
			<td width="34">6</td>
			<td width="34">6E</td>
			<td width="44">6</td>
			<td width="34">7</td>
			<td width="34">8</td>
			<td width="34">9</td>
			<td width="34">10</td>
			<td width="34">11</td>
			<td width="34">12</td>
		</tr>
		<tr align="center">
			<td>36</td>
			<td>37</td>
			<td>38</td>
			<td>39</td>
			<td>40</td>
			<td>39/40</td>
			<td>41</td>
			<td>42</td>
			<td>43</td>
			<td>44</td>
			<td>45</td>
			<td>46</td>
		</tr>
		<tr>
		<? $no = 1 ?>
		<? 
			$subpenjualan = mysql_query("SELECT * FROM sub_penjualan WHERE id_penjualan = $id"); 
				while($hasilsp = mysql_fetch_array($subpenjualan)){
					$idb = $hasilsp['id_barang'];
					$barang = mysql_query("SELECT * FROM barang WHERE id_barang = $idb");
					$hasilb = mysql_fetch_array($barang); 
		?>
			<td height="22" align="center"><? echo $no++ ?></td>
			<td align="center"><? echo $hasilb['kode_barang'] ?></td>
			<td align="center">
			<? 
				if($hasilsp['qty3']==0){
				echo "-";
				}else{
				echo $hasilsp['qty3']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty4']==0){
				echo "-";
				}else{
				echo $hasilsp['qty4']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty5']==0){
				echo "-";
				}else{
				echo $hasilsp['qty5']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty639']==0){
				echo "-";
				}else{
				echo $hasilsp['qty639']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty6e']==0){
				echo "-";
				}else{
				echo $hasilsp['qty6e']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty6']==0){
				echo "-";
				}else{
				echo $hasilsp['qty6']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty7']==0){
				echo "-";
				}else{
				echo $hasilsp['qty7']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty8']==0){
				echo "-";
				}else{
				echo $hasilsp['qty8']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty9']==0){
				echo "-";
				}else{
				echo $hasilsp['qty9']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty10']==0){
				echo "-";
				}else{
				echo $hasilsp['qty10']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty11']==0){
				echo "-";
				}else{
				echo $hasilsp['qty11']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty12']==0){
				echo "-";
				}else{
				echo $hasilsp['qty12']; } 
			?>
			</td>
			<td align="center"><? echo $hasilsp['jumlah'] ?></td>
			<td align="center">
			<? 
				if($hasilsp['size']==0){
				echo "-";
				}else{
				echo $hasilsp['size']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['discountp']==0){
				echo "-";
				}else{
				echo $hasilsp['discountp']; } 
			?>&nbsp;%
			</td>
			<td align="center"><? echo $hasilsp['remarks'] ?></td>
		</tr>
		<? } ?>
	</table>
   </form>
</div>
<div id="batas"></div>
<div id="divfoot">
	<table border="1" bordercolor="black" id="footer"  cellspacing="0" cellpadding="0" vspace="0">
		<tr>
			<td valign="top" align="center" width="232" style="border-bottom-style:none">Dibuat</td>
			<td valign="top" align="center" width="232" style="border-bottom-style:none">Sales</td>
			<td  align="center" width="232" style="border-bottom-style:none">Mengetahui<br />Vice Director</td>
			<td valign="top" align="center" width="232" style="border-bottom-style:none">Disetujui</td>
			<td valign="top" align="center" width="238" style="border-bottom-style:none">Mengetahui</td>
		</tr>
		<tr>
			<td valign="bottom" height="33" style="border-top-style:none;"><center><? echo $nama ?></center></td>
			<td valign="bottom" style="border-top-style:none"><center><? echo $hasils['nama_sales']; ?></center></td>
			<td valign="bottom" style="border-top-style:none">&nbsp;</td>
			<td valign="bottom" style="border-top-style:none">&nbsp;</td>
			<td valign="bottom" style="border-top-style:none">&nbsp;</td>
		</tr>
		<tr>
			<td height="15" style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
		</tr>
	</table>
</div>
<div id="batas"></div>
<div id="divprnt">
	<table id="print">
		<tr>
			<td align="center"><input type="button" onclick="printpage(this.type='hidden')" value="Print"></td>
		</tr>
	</table>
</div>
</div>

</body>
</html>
Silahkan login untuk menjawab!
0
Loading...
M. Saiful A. Rachman · Mar 13, 2013 · 0 Suka · 0 Tidak Suka
tambahan... ini css nya
/*----------- Wrapper -------- */
#wrapper{
	width:1060px;
	margin-top: 0px;
	margin-bottom: 0px;
	margin-right:auto;
	margin-left:auto;
	border: #000 2px solid;
	background-color: #FFF;
	overflow: scroll;
}
/*----------- End -------- */

/*----------- Tb_Company -------- */
#wrapper #divco #company{
	width:500px;
	border:thin solid #000000;
	font-family: Tahoma;
	font-weight:bold;
	font-size: 12px;
	padding-left: 3px;
}
#wrapper #divco {
	float: left;
	width: 500px;
	padding-left: 20px
}
/*----------- End -------- */

/*----------- Tb_Sales -------- */
#wrapper #divsa #sales{
	width:490px;
	border:thin solid #000000;
	font-family: Tahoma;
	font-weight:bold;
	font-size: 12px;
	padding-left: 3px;
}
#wrapper #divsa {
	float: right;
	width: 490px;
	padding-right: 20px;
}
/*----------- End -------- */

/*----------- Clear -------- */
#wrapper #clearnir {
	clear: both;
}
/*----------- End -------- */

/*----------- Tb_SO -------- */
#wrapper #divso {
	width: 1000px;
	margin-right:auto;
	margin-left:auto;
}
#wrapper #divso #so {
	width: 1000px;
	margin-right: auto;
	margin-left: auto;
	font-family: Tahoma;
	font-weight:bold;

}
/*----------- End -------- */

/*----------- Tb_Content -------- */
#wrapper #divcon {
	width: 1000px;
	margin-right:auto;
	margin-left:auto;
	padding-left:10px;
	padding-right:10px
}
#wrapper #divcon #content {
	width: 1000px;
	font-family: Tahoma;
	font-weight:bold;
	margin-right:auto;
	margin-left:auto;
	border: thin solid black;
	font-size: 12px;
}
/*----------- End -------- */

/*----------- Tb_Batas -------- */
#wrapper #batas {
	height: 4px;
	width: 1000px;
}
/*----------- End -------- */

/*----------- Tb_Footer -------- */
#wrapper #divfoot {
	width: 1000px;
	margin-right:auto;
	margin-left:auto;
	padding-left:10px;
	padding-right:10px
}
#wrapper #divfoot #footer {
	width: 1000px;
	font-family: Tahoma;
	font-weight:bold;
	font-size: 12px;
}
/*----------- End -------- */

/*----------- Tb_Print -------- */
#wrapper #divprnt {
	width: 1000px;
	margin-right:auto;
	margin-left:auto;
}
#wrapper #divprnt #print {
	width: 1000px;
	margin-right:auto;
	margin-left:auto;
}
/*----------- End -------- */

/*----------- Button -------- */
button {
	font-family: Tahoma;
	font-weight:bold
	color:#565656;
	background-color:#f5f5f5;
    border:1px solid #dedede;
	cursor:pointer;
	font-weight:bold;
}
/*----------- End -------- */
#hasil:hover {
	color:#666666;
}
0
Loading...
Ellyx Christian · Mar 14, 2013 · 0 Suka · 0 Tidak Suka
saat ini print standard tidak memiliki kemampuan seperti itu. Tidak ada fungsi scale printer yang bisa dipake secara native di browser. Mungkin http://stackoverflow.com/questions/5717800/print-scale-by-css bisa membantu.