gpt4 book ai didi

php - 在从 mysql 债务和信用表创建简单分类帐方面需要帮助吗?

转载 作者:行者123 更新时间:2023-11-30 23:55:52 24 4
gpt4 key购买 nike

enter image description here

如何使用上面的表格创建下面的客户分类帐。分类帐应该按日期排序,就像我在下面的 Ms word 中所做的那样。请帮助(使用 PHP)我尝试了内部连接,但没有什么富有成果的日期让我更难。 enter image description here

最佳答案

要打印表格,它可以类似于使用准备为最终数组的数组来遵循

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>
<h1>Customer Ledger(<?php echo $rearrangedFinalData[0]['customer'] ?>)</h1>
<table>
<tr>
<td>Date</td>
<td>Invoice No</td>
<td>Debit</td>
<td>Credit</td>
<td>Balance</td>
</tr>
<?php
//initialize balance as per your requirement
$balance = 0;
foreach($rearrangedFinalData AS $row) {
?>
<tr>
<td><?php echo $row['date'] ?></td>
<td><?php echo $row['invoice'] ?></td>
<td><?php echo $row['debit'] > 0 ? $row['debit'] : '' ?></td>
<td><?php echo $row['credit'] > 0 ? $row['credit'] : '' ?></td>
<td><?php echo $balance = ($balance + $row['debit'] - $row['credit']) ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>

关于php - 在从 mysql 债务和信用表创建简单分类帐方面需要帮助吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33819464/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com