2

我想按照这里的这篇文章中的描述创建一张发票。

我可以在这里进行编辑甚至打印。但我需要一些建议将其存储到数据库中。我对 MySQL 很好,只是 PHP 的初学者,所以任何人都可以建议我如何进行多个插入。并将客户信息存储在customer表中,将订单信息存储在order表中,并将customer和Order之间的关系存储在另一个表中。参考上面的例子。

演示在这里。

4

1 回答 1

6

它们是 INVOICE 系统中的 4 个部分,客户信息、发票信息、发票项目和项目总计

Invoice Information

$mysqli = new mysqli ( $dbHost, $dbUser, $dbPass, $dbName ); // Replace with
                                                             // relevant
                                                             // information
$result = $mysqli->query ( "SELECT * FROM invoiceInfo" );
$invoice = $result->fetch_assoc ();



<div id="page-wrap">
    <textarea id="header">INVOICE</textarea>
    <div id="identity">

        <textarea id="address">   
<?php echo $invoice['address']?>
</textarea>

        <div id="logo">

            <div id="logoctr">
                <a href="javascript:;" id="change-logo" title="Change logo">Change
                    Logo</a> <a href="javascript:;" id="save-logo" title="Save changes">Save</a>
                | <a href="javascript:;" id="delete-logo" title="Delete logo">Delete
                    Logo</a> <a href="javascript:;" id="cancel-logo"
                    title="Cancel changes">Cancel</a>
            </div>

            <div id="logohelp">
                <input id="imageloc" type="text" size="50" value="" /><br /> (max
                width: 540px, max height: 100px)
            </div>
            <img id="image" src="images/aviation/logo2.png" alt="logo" />

        </div>

    </div>

Customer Information

$result = $mysqli->query ( "SELECT *  FROM clientTable WHERE clientID = '{$invoice['clientID']}' " );
$clientInfo = $result->fetch_assoc ();
$totalPayment = 0;


<div id="customer">

    <textarea id="customer-title"><?php echo $clientInfo['clientName']?>

Address:  <?php echo $clientInfo['clientAddress'] ?>  </textarea>

    <table id="meta">
        <tr>
            <td class="meta-head">Invoice #</td>
            <td><textarea>000123</textarea></td>
        </tr>
        <tr>

            <td class="meta-head">Date</td>
            <td><textarea id="date"><?php echo date("Y-m-d g:i:s",time())?></textarea></td>
        </tr>
        <tr style="display: none">
            <td class="meta-head">Total Payment</td>
            <!-- <td><div class="due">-N-<?php echo $totalPayment ?></div></td>  -->
            <td><div>-N-<?php echo $totalPayment ?></div></td>
        </tr>

    </table>

</div>

Invoice Items

<?php
    $result = $mysqli->query ( "SELECT *  FROM itemTable WHERE clientID = '{$invoice['clientID']}' " );

    while ( $item = $result->fetch_assoc () ) {

        ?>
    <tr class="item-row">
        <td class="item-name"><div class="delete-wpr">
                <textarea><?php echo $item['name'] ?></textarea>
                <a class="delete" href="javascript:;" title="Remove row">X</a>
            </div></td>
        <td class="description"><textarea>
    <?php echo $item['description']?>
    </textarea></td>

        <td><textarea class="cost">-N-<?php echo $item['unit'] ?></textarea></td>
        <td><textarea class="qty"><?php echo $item['quantity'] ?></textarea></td>
        <td><span class="price">-N-<?php echo $item['prize'] ?></span></td>
    </tr>
    <?php
    }
?>

Item Total这将自动完成

我希望这有帮助

谢谢 :)

于 2012-04-07T21:51:07.680 回答