欧美日韩精品在线,国内精品久久久久久久久,一级毛片恃级毛片直播,清纯唯美亚洲综合欧美色

解析PHP CSS實現(xiàn)打印簡單數(shù)據(jù)報表功能_PHP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:解析PHP技術(shù):txtSQL安裝手冊中文版
txtsql的最大優(yōu)點之一是文檔很詳細(xì),可惜,我在網(wǎng)上找了半天也找不到中文版的文檔,所以只好自己動手,利人利已吧,不過自己的E文水平自己是很清楚的,希望大家看了不會笑掉大牙才好,還希

PHP CSS實現(xiàn)打印簡單數(shù)據(jù)報表功能

功能:實現(xiàn)打印日報表的功能,定義了專門的打印樣式,隱藏了不該打印的控件并實現(xiàn)了分頁打印功能,表名:rec 字段:rec_id,rec_po,rec_part,rec_plant,rec_vendor,rec_pur_um,rec_req_date,rec_req_qty,rec_rec_qty,rec_iqc_date,rec_notes

完整源代碼如下:

以下為引用的內(nèi)容:

<!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>Daily Report </title>
<style rel="stylesheet" type="text/css" media="all" />
body {
margin: 9px;
padding: 0;
color: black;
text-decoration: none;
font-size: 10pt;
font-family: "Courier New";
}

input {
font-family: Arial;
}

th {
font-weight: normal;
border-bottom: 1px solid black;
}

td {
font-size: 9pt;
font-family: "Courier New";
}

td.pod {
font-size: 11pt;
font-family: "Courier New";
}

th.pod {
font-size: 11pt;
font-family: "Courier New";
}

td.endline {
border-top: 1px solid black;
}

.left {
text-align: left;
}

.right {
text-align: right;
}

.center {
text-align: center;
}

.top {
vertical-align: top;
}

@media print {
.noprint { display: none; }
}
</style>
</head>
<body>

<?php

define ("SP10" ,'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
global re;
function db_link()
{
access_id = "root";
access_pwd = "831025";
db_name = "inv";
@ db = mysql_connect('localhost', access_id, access_pwd) or
die("Could not connect to database. Please contact with IT supporting team ASAP.");
mysql_query("SET NAMES 'GBK'");
mysql_select_db(db_name);
return db;
}
link=db_link();
?>

<table cellpadding="2" cellspacing="3">
<tr>
<td class="right">Program : </td>
<td>bom_report.php</td>
<td><?php echo SP10;?></td>
<td class="right">Date/Time : </td>
<td><?php echo date("Y-m-d").'/'.date("H:i:s");?></td>
</tr>
<tr>
<td class="right"> Plant : </td>
<td>SJ01</td>
<td><?php echo SP10;?></td>
<td class="right"> User Name : </td>
<td>liuxueping</td>
</tr>
<tr>
<td class="right"> Receiving Date : </td>
<td><?php echo date("Y-m-d").'/'.date("H:i:s");?></td>
<td><?php echo SP10;?></td>
<td class="right"> Page : </td>
<td>1</td>
</tr>
<tr><td>&nbsp;</td></tr>
<table>

<table cellpadding="2" cellspacing="3">
<tr>
<th class="header" > No. </th>
<th class="header" > Vendor </th>
<th class="header" > Part </th>
<th class="header" > Description </th>
<th class="header" > UM </th>
<th class="header" > Require Date </th>
<th class="header" > Require Qty </th>
<th class="header" > Deliver Qty </th>
<th class="header" > Receive Qty </th>
<th class="header" > IQC </th>
<th class="header" > Remark </th>
</tr>
<?php

rec_sql = "SELECT * FROM rec WHERE rec_plant = 'SJ01' ORDER BY rec_id DESC";
rec_res = mysql_query(rec_sql);
rec_num = mysql_num_rows(rec_res);

if(rec_num>0){
for (i = 0; i < rec_num; i ){
re ;
rec_row = mysql_fetch_array(rec_res);

part_sql = "SELECT pt_desc FROM part WHERE pt_part='".rec_row['rec_part']."' ";
part_res = mysql_query(part_sql);
part_row = mysql_fetch_array(part_res);

echo'<tr>
<td class="list center bom">'.(i 1).'</td>
<td class="list left bom">'.rec_row['rec_vendor'].'</td>
<td class="list left bom">'.rec_row['rec_part'].'</td>
<td class="list left bom">'.part_row['pt_desc'].'</td>
<td class="list left bom">'.rec_row['rec_pur_um'].'</td>
<td class="list left bom">'.substr(rec_row['rec_req_date'], 0, 10).'</td>
<td class="list right bom">'.number_format(rec_row['rec_req_qty'], 2).'</td>
<td class="list right bom">'.number_format(rec_row['rec_rec_qty'],2).'</td>
<td class="list right bom">'.number_format(rec_row['rec_rec_qty'],2).'</td>
<td class="list left bom">'.substr(rec_row['rec_iqc_date'], 0 ,10).'</td>
<td class="list left bom">'.rec_row['rec_notes'].'</td>
</tr>';

//每頁只打印10條記錄,如果記錄數(shù)是10的倍數(shù)后,顯示'***End of Report***'并開始打印下一頁
if(re == 0 and re != rec_num){
echo'
<tr>
<td colspan="11" class="center endline"> *** End of Report *** </td>
</tr>
</table>';
//下一頁開始打印
echo '
<p style="page-break-before:always;">&nbsp;</p>
<table cellpadding="2" cellspacing="3">
<tr>
<td class="right">Program : </td><td>bom_pro.php</td><td>'.SP10.'</td><td class="right">Date/Time : </td><td>'.date("Y-m-d").'/'.date("H:i:s").'</td>
</tr>
<tr>
<td class="right"> Plant : </td><td>SJ01</td><td>'.SP10.'</td><td class="right"> User Name : </td><td>lucas</td>
</tr>
<tr>
<td class="right"> Receiving Date : </td><td>'.date('Y-m-d').'</td><td>'.SP10.'</td><td class="right"> Page : </td><td>';echo re/10 1;echo'</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<table cellpadding="2" cellspacing="3">
<tr>
<th class="header" > No. </th>
<th class="header" > Vendor </th>
<th class="header" > Part </th>
<th class="header" > Description </th>
<th class="header" > UM </th>
<th class="header" > Require Date </th>
<th class="header" > Require Qty </th>
<th class="header" > Deliver Qty </th>
<th class="header" > Receive Qty </th>
<th class="header" > IQC </th>
<th class="header" > Remark </th>
</tr>';
}
}

echo'
<tr>
<td colspan="11" class="center endline"> *** End of Report *** </td>
</tr>
<tr>
<td>
<input type="button" class="noprint" name="print" value="Print" onclick="window.print()">
</td>
<td colspan="11" class="right">
<input type="button" class="noprint" name="close" value="Close Window" onclick="window.close()">
</td>
</tr>
</table>';
}
else{
echo'<script>alert("Have no records!")';
exit;
}
?>

分享:解析PHP上傳自動生成縮略圖及水印類
思路很大一部分是原創(chuàng)的,但也有一些是COPY網(wǎng)絡(luò)的,寫得不夠規(guī)范,還請各位大大不要見笑,同時給小弟些意見。 開始第一步: 創(chuàng)建文件夾,布局: annex:附件(該目錄下存放上傳的原圖片

來源:模板無憂//所屬分類:PHP教程/更新時間:2009-09-18
相關(guān)PHP教程