I am working on an ordering system for my company utilizing Open Cart.
Everything is being done in PHP and HTML.
I am trying to modify the invoice page to include a signature line at the bottom of the printed invoice. Invoices can stretch to multiple pages depending on the number of lines/items, and they can also be batched so that one document to be printed has multiple invoices (using a loop). I am not a web developer, and have hit the end of my abilities to get this part of the project done. Please give me pointers or pseudo code samples.
Footer Code:
<style type="text/css">
.picklistCheck{
width:15px;
height:15px;
border:1px solid #c7c7c7;
margin:0 auto;
border-radius:2px;
box-shadow:inset 0px 0px 2px rgba(0,0,0,0.1);
font-size:14pt;
}
.signature{
border-bottom-style:solid;
font-size:14pt;
page-break-after:always;
}
td{
font-size:14pt;
}
</style>
<?php
foreach ($orders as $order) {
?>
//<div>orders go here </div>
<?php
}
include ("footer.php");
?>
Every time your logic decides to put a page break in the invoice, tell it to insert the following code also:
Create a footer.php file with the simple html you want to place in the footer. The above code assumes that
your scriptandfooter.phpare in same directory.EDIT: To answer your comment,
The
IncludePHP.net will behave exactly like you actually copy-pasted all the code directly instead of including it. But every include file should have its own<?php ?>tags where-ever required. Without<?php ?>tags, Control will just output whatever it sees there.Footer.php can be a simple HTML-only file:
You could also name it footer.html, but if later, in future, you decide to put some dynamic data in footer, it will be very difficult to change
.htmlto.phpin all include lines written in various files.Example of Dynamic Footer:
Of course it is just a simple example.
In a html page, you could force a div by using the following CSS code in an external linked .css file:
position:fixed;&bottom:0px;is here doing the trick. It is forcing this"footer" divto stick to bottom always, even if page is scrolled or something. Like the way Facebook sticks its header menu to top & chat bar to bottom. You can also define left, right propertiesUpdate: Ok, based on your comments, here is the sample code:
In CSS Style section, use:
All properties are self-explanatory.
Text-alignmakes the text center-aligned.Widthis making this div.signature100% wide on page. It is required to put the div with equal margins on both sides.Marginis saying put0pxmargin on top & bottom sides andautoon both left & right side.Positionmakes it fixed on viewport/page.Bottomsays keep0pxfrom bottom.In body of page, use this code:
It simply assigns whatever properties you defined in CSS Styling to
signaturediv. Obviously you need to wrap this snippet into your logic, which decides when to echo/introduce thesignaturediv. Also, $who_authorized & $who_printed needs to hold some value.For any block bigger than 3 lines, I always come out (
?>) of PHP parser/control and simply write HTML as desired. Then, when required, I again enter PHP (<?php)If you want to go with
include, you can omit the last 6 lines( starting from?>& ending with<!--//signature-->from my code and simply put this line there.This option also requires you to create a file named
footer.phpin the same directory and insert the following html code in it.