需要帮助从 mysql 债务创建简单的分类帐 &信用表? [英] Need help in creating simple ledger from mysql debt & credit tables?

查看:36
本文介绍了需要帮助从 mysql 债务创建简单的分类帐 &信用表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to create below customer ledger using above tables. Ledger should be ORDER by Date as i did in below in Ms word below. Please help(Using PHP) i tried inner join but nothing fruitful date make it more difficult for me.

推荐答案

为了打印表格,可以使用准备作为最终数组的数组进行类似的操作

to print the table it can be something similar to follow using the array prepared as final array

<!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>

这篇关于需要帮助从 mysql 债务创建简单的分类帐 &amp;信用表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆