php将html导出为pdf,关于php:将HTML表导出为PDF

include 'dbFunctions.php';

include 'menu.php';

include 'css.php';

$user_id=$_SESSION['user_id'];

$acc_id = $_POST['acc_id'];

$period = $_POST['period'];

$sort = $_POST['sort'];

$type = $_POST['type'];

$total_debit = 0;

$total_credit = 0;

$date = date("l jS \of F Y h:i:s A")

?>

#table

{

font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;

width:100%;

border-collapse:collapse;

}

#table td, #table th

{

font-size:1em;

border:1px solid #000000;

padding:3px 7px 2px 7px;

}

#table th

{

font-size:1.1em;

text-align:left;

padding-top:5px;

padding-bottom:4px;

background-color:#0080FF;

color:#ffffff;

}

#table tr.alt td

{

color:#000000;

background-color:#A9E2F3;

}

Transaction History

echo $date ."" ."";

$query ="SELECT account_number FROM account WHERE account_id ='$acc_id' AND user_id= '$user_id'"; // where date=$period

$result = mysqli_query($link, $query) or die(mysqli_error($link));

while ($row = mysqli_fetch_array($result)) {

$acc_num = $row ['account_number'];

?>

RP INTERNET BANKING ACCOUNT <?php echo $acc_num ?>

}

?>

DateTransaction CodeReferenceDebit
(Withdrawal)Credit
(Deposit)

if ($period == 'current'){

$query1 ="SELECT * FROM transaction WHERE account_id ='$acc_id' AND user_id= '$user_id' AND MONTH(CURDATE())= MONTH(date)";

}

else if ($period == 'current_first'){

$query1 ="SELECT * FROM transaction WHERE account_id ='$acc_id' AND user_id= '$user_id' AND date BETWEEN CURRENT_DATE - INTERVAL 2 MONTH AND CURRENT_DATE";

}

else if ($period == 'current_second'){

$query1 ="SELECT * FROM transaction WHERE account_id ='$acc_id' AND user_id= '$user_id' AND date BETWEEN CURRENT_DATE - INTERVAL 3 MONTH AND CURRENT_DATE";

}

if($type == 'credit'){

$query1 .=" AND debit IS NULL";

}

else if ($type == 'debit'){

$query1 .=" AND credit IS NULL";

}

else if ($type == 'both'){

$query1 .="";

}

if ($sort == 'latest'){

$query1 .=" ORDER BY date DESC";

}

else if ($sort == 'earliest'){

$query1 .=" ORDER BY date ASC";

}

else if ($sort == 'codes'){

$query1 .=" ORDER BY transaction_code ASC";

}

$result1 = mysqli_query( $link, $query1 ) or die( mysqli_error( $link ) );

while ($row1 = mysqli_fetch_array($result1))

{

$date1 = $row1['date'];

$trans_code = $row1['transaction_code'];

$reference = $row1['reference'];

$debit = $row1['debit'];

$credit = $row1['credit'];

$total_debit += $debit;

$total_credit += $credit;

$date = new DATETIME($date1);

?>

<?php echo $date->format('d-m-Y'); ?><?php echo $trans_code ?><?php echo $reference ?>

if ($debit != NULL) {

echo"S$" ."" . $debit;

}

?>

if ($credit != NULL) {

echo 'S$' . ' ' . $credit;

}

?>

}

?>

Total:

echo 'S$' . ' ' . $total_debit;

}

?>

echo 'S$' . ' ' . $total_credit;

}

?>

Back

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值