I want to create a invoice as described in this post here .
I am able to do the edits here and get even the print. But I need some suggestion to store the same into Database. I am Good with MySQL, just a beginner in PHP, So can any one suggest me how to have multiple inserts. and storing the customer info in customer table, and order info in order table, and the relation between customer and Order in another. with reference to the above example.
Demo here.
They are 4 sections in the INVOICE system, Client Information, Invoice Information, Invoice Items and Items Total
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
this would be done automatically
I hope this helps
Thanks:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.