我正在尝试打印发票页面,页面的内容是动态的,我只需要签名,页脚应在最后一页的末尾(如果使用a4尺寸打印)。 尝试了固定的功能,也无法工作@page对我不起作用我想放在最后一页的每件事都固定在div一侧,如果可能的话,请给我工作示例
我也尝试过固定的和绝对的@page:last
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?php echo $invoice['invoicenumber_prefix']."-".$invoice['invoice_number'];?></title>
<style>
* { margin: 0; padding: 0; }
body {
font: 12px/1.4 Helvetica, Arial, sans-serif;
padding:0;
height:100%;
}
#page-wrap { width: 800px; margin: 0 auto; }
textarea { border: 0; font: 14px Helvetica, Arial, sans-serif; overflow: hidden; resize: none; }
table { border-collapse: collapse; }
table td, table th { border: 1px solid black; padding: 5px; }
#header { height: 15px; width: 100%; margin: 20px 0; background: #222; text-align: center; color: white; font: bold 15px Helvetica, Sans-Serif; text-decoration: uppercase; letter-spacing: 20px; padding: 8px 0px; }
#address { width: 250px; height: 150px; float: left; }
#customer { overflow: hidden; }
#logo { text-align: right; float: right; position: relative; border: 1px solid #fff; max-width: 540px; overflow: hidden; }
#customer-title { font-size: 20px; font-weight: bold; float: left; }
#meta { margin-top: 1px; width: 100%; float: right; }
#meta td { text-align: right; }
#meta td.meta-head { text-align: left; background: #eee; }
#meta td textarea { width: 100%; height: 20px; text-align: right; }
#items { clear: both; width: 100%; margin: 30px 0 0 0; border: 1px solid black; }
th { background: #eee; }
#items textarea { width: 80px; height: 50px; }
#items tr.item-row td { vertical-align: top; }
#items td.description { width: 300px; }
#items td.item-name { width: 175px; }
#items td.description textarea, #items td.item-name textarea { width: 100%; }
/*#items td.total-line { border-right: 0; text-align: right; }
#items td.total-value { border-left: 0; padding: 10px; }
#items td.total-value textarea { height: 20px; background: none; }*/
#items td.balance { background: #eee; }
#items td.blank { border: 0; }
#terms { text-align: center; margin: 20px 0 0 0; }
#terms h5 { text-transform: uppercase; font: 13px Helvetica, Sans-Serif; letter-spacing: 10px; border-bottom: 1px solid black; padding: 0 0 8px 0; margin: 0 0 8px 0; }
#terms textarea { width: 100%; text-align: center;}
.insideitems { border: 0px solid black; padding: 5px; }
@media print {
html,
body {
margin:0;
padding:0;
height:100%;
}
#page-wrap {
min-height:100%;
position:relative;
}
.printheader{
padding:10px;
background:#5ee;
}
.printcontent{
padding:10px;
padding-bottom:80px; /* Height of the footer element */
}
.printfooter {
width:100%;
height:80px;
position:absolute;
bottom:0;
left:0;
background:#ee5;
}
}
</style>
</head>
<body>
<div id="page-wrap">
<div class="printheader">
<table width="100%">
<tbody><tr>
<td style="border: 0; text-align: left" width="62%">
<span style="font-size: 18px; color: #2f4f4f"><strong><?=$this->LogedInUser['branch']['name']?></strong></span>
<br><?=$this->LogedInUser['branch']['address']?><br>
E: <?=$this->LogedInUser['branch']['email']?><br>P: <?=$this->LogedInUser['branch']['phone']?><br>
</td>
<td style="border: 0; text-align: right" width="62%"><div id="logo">
<img id="image" style="max-width: 100px;" src="<?php echo base_url();?>uploads/branchlogo/<?php echo $this->LogedInUser['branch']['logo'];?>" alt="logo">
</div></td>
</tr>
</tbody></table>
<hr>
<br>
<div style="clear:both"></div>
</div>
<div class="printcontent">
<div id="customer">
<table id="meta">
<tbody>
<tr>
<td rowspan="3" style="border: 1px solid white; border-right: 1px solid black; text-align: left" width="62%">
<strong>Invoiced To</strong> <br>
<?php echo $invoice['print_name'];?> <br>
<?php echo $customer['address'];?> <br>
Phone: <?php echo $customer['phone'];?> <br>
Email: <?php echo $customer['email'];?> <br>
</td>
<td class="meta-head">INVOICE #</td>
<td><?php echo $invoice['invoicenumber_prefix']."-".$invoice['invoice_number'];?></td>
</tr>
<tr>
<td class="meta-head">Client Order No</td>
<td><?php echo $customer['strn'];?></td>
</tr>
<tr>
<td class="meta-head">Invoice Date</td>
<td><?php echo $invoice['invoice_date'];?></td>
</tr>
<tr>
<td colspan="3" style="border: 1px solid white; border-right: 0px solid black; text-align: left" width="100%">
<b>Remarks:</b><?php echo $invoice['remarks'];?></td>
</tr>
</tbody>
</table>
</div>
<br>
<?php if($invoice['tickets']){?>
<table style="border-bottom: 1px solid black;">
<caption style="text-align: left;"><b>Ticket(s)</b></caption>
<tr>
<th width="5%">S. No</th>
<th width="15%">Passenger Name</th>
<th width="10%">Departure Date</th>
<th width="10%">PNR</th>
<th width="10%">Ticket Number</th>
<th width="10%">Sector</th>
<th width="15%">Gross</th>
<th width="10%">PSF</th>
<th width="15%">Net Amount</th>
</tr>
<?php
$srno = $totalamount = 0;
foreach ($invoice['tickets'] as $key => $t) { //print_r($t);
?>
<tr>
<td class="insideitems"><?php echo ++$srno; ?></td>
<td class="insideitems"><?php echo strtoupper($t['pax_name']); ?></td>
<td class="insideitems"><?php echo $t['route_date']; ?></td>
<td class="insideitems"><?php echo $t['pnr']; ?></td>
<td class="insideitems"><?php echo $t['ticket_number']; ?></td>
<td class="insideitems"><?php echo strtoupper($t['route_ori']."-".$t['route_dest']); ?>
<?php echo ($t['route_ori1'])?"-".strtoupper($t['route_ori1'])."-".strtoupper($t['route_dest1']):''; ?>
<?php echo ($t['route_ori2'])?"<BR>".strtoupper($t['route_ori2'])."-".strtoupper($t['route_dest2']):''; ?>
<?php echo ($t['route_ori3'])?"-".strtoupper($t['route_ori3'])."-".strtoupper($t['route_dest3']):''; ?>
</td>
<td class="insideitems">
<?php
$vat = 0;
foreach ($t['cfs'] as $cfs){
if($cfs['chargefieldtype'] == 5) $vat += $cfs['ammount'];
}
echo number_format($t['customer_payable'] - $vat,2);
$totalamount+=$t['customer_payable'];?> <?php echo $customer['currencycode'];?>
</td>
<td class="insideitems"><?php echo number_format($vat,2); ?> <?php echo $customer['currencycode'];?></td>
<td class="insideitems"><?php echo number_format($t['customer_payable'],2); ?> <?php echo $customer['currencycode'];?></td>
</tr>
<?php if($t['conjtickets']){
foreach ($t['conjtickets'] as $conjticket){ ?>
<tr>
<td class="insideitems">CNJ</td>
<td class="insideitems"><?php echo strtoupper($t['pax_name']); ?></td>
<td class="insideitems"><?php echo $t['route_date']; ?></td>
<td class="insideitems"><?php echo $t['pnr']; ?></td>
<td class="insideitems"><?php echo $conjticket['ticket_number']; ?></td>
<td class="insideitems"><?php echo strtoupper($conjticket['ori']."-".$conjticket['dest']); ?>
<?php echo ($conjticket['ori1'])?"-".strtoupper($conjticket['ori1'])."-".strtoupper($conjticket['dest1']):''; ?>
<?php echo ($conjticket['ori2'])?"<BR>".strtoupper($conjticket['ori2'])."-".strtoupper($conjticket['dest2']):''; ?>
<?php echo ($conjticket['ori3'])?"-".strtoupper($conjticket['ori3'])."-".strtoupper($conjticket['dest3']):''; ?>
</td>
<td class="insideitems"> </td>
<td class="insideitems"></td>
<td class="insideitems">0.00 <?php echo $customer['currencycode'];?></td>
</tr>
<?php } } }?>
<caption style="caption-side: bottom; text-align: right;">Tickets Total: <?php echo number_format($totalamount,2);?> <?php echo $customer['currencycode'];?></caption>
</table>
<?php }if($invoice['hotels']){?>
<table style="border-bottom: 1px solid black;">
<caption style="text-align: left;"><b>Accomodation(s)</b></caption>
<tr>
<th width="10%">Hotel</th>
<th rowspan="2" width="10%">Reference No.</th>
<th colspan="2" width="10%">Room View</th>
<th rowspan="2" width="15%">Passenger Name</th>
<th colspan="2" width="40%">Remarks</th>
<th rowspan="2" width="15%">Net Amount</th>
</tr>
<tr>
<th>Room</th>
<th>Quantity</th>
<th>Nights</th>
<th>Check In</th>
<th>Check Out</th>
</tr>
<?php $srno = $totalamount = 0;
foreach ($invoice['hotels'] as $key => $t) { ?>
<tr>
<td style="border-bottom: 1px solid gray;" class="insideitems"><?php echo $t['hotelname'];?></td>
<td rowspan="2" class="insideitems"><?php echo $t['hotel_v_number'];?></td>
<td style="border-bottom: 1px solid gray;" colspan="2" class="insideitems"><?php echo $t['roomviewname'];?></td>
<td rowspan="2" class="insideitems"><?php
echo strtoupper($t['pax'][0]['paxname']); echo (count($t['pax']) > 1)? '+'.count($t['pax']):''; ?>
</td>
<td style="border-bottom: 1px solid gray;" colspan="2" class="insideitems"><?php echo $t['remarks'];?></td>
<td rowspan="2" class="insideitems">
<?php echo number_format($t['customer'],2); $totalamount +=$t['customer'];?> <?php echo $customer['currencycode'];?>
</td>
</tr>
<tr>
<td class="insideitems"><?php echo $t['roomname'];?></td>
<td class="insideitems"><?php echo ($t['room_qty'])?$t['room_qty']:$t['bed_qty'];?></td>
<td class="insideitems"><?php echo $t['nights'];?></td>
<td class="insideitems"><?php echo $t['check_in'];?></td>
<td class="insideitems"><?php echo $t['check_out'];?></td>
</tr>
<?php }?>
<caption style="caption-side: bottom; text-align: right;">Hotels Total: <?php echo number_format($totalamount,2);?> <?php echo $customer['currencycode'];?></caption>
</table>
<?php }if($invoice['transports']){?>
<table style="border-bottom: 1px solid black;">
<caption style="text-align: left;"><b>Transportation(s)</b></caption>
<tr>
<th width="5%">S. No</th>
<th width="10%">Reference No.</th>
<th width="15%">Passenger Name</th>
<th width="15%">Transporter</th>
<th width="10%">Vehicle</th>
<th width="10%">Track</th>
<th width="20%">Remarks</th>
<th width="15%">Net Amount</th>
</tr>
<?php $srno = $totalamount = 0;
foreach ($invoice['transports'] as $key => $t) { //print_r($t); ?>
<tr>
<td class="insideitems"><?php echo ++$srno;?></td>
<td class="insideitems"><?php echo $t['ref_no'];?></td>
<td class="insideitems"><?php
echo strtoupper($t['pax'][0]['paxname']); echo (count($t['pax']) > 1)? '+'.count($t['pax']):''; ?>
</td>
<td class="insideitems"><?php echo $t['transportername'];?></td>
<td class="insideitems"><?php echo $t['vehiclename'];?></td>
<td class="insideitems"><?php echo strtoupper($t['sectorname']);?></td>
<td class="insideitems"><?php echo $t['remarks'];?></td>
<td class="insideitems"><?php echo number_format($t['customer_payable'],2); $totalamount +=$t['customer_payable'];?> <?php echo $customer['currencycode'];?></td>
</tr>
<?php }?>
<caption style="caption-side: bottom; text-align: right;">Transport Total: <?php echo number_format($totalamount,2);?> <?php echo $customer['currencycode'];?></caption>
</table>
<?php }if($invoice['visas']){ ?>
<table style="border-bottom: 1px solid black;">
<caption style="text-align: left;"><b>Visa(s)</b></caption>
<tr>
<th width="10%">Reference No.</th>
<th width="10%">Passenger Name</th>
<th width="5%">Child</th>
<th width="5%">Infant</th>
<th width="5%">Adult</th>
<th width="20%">Remarks</th>
<th width="10%">Visa Type</th>
<th width="10%">Gross</th>
<th width="10%">PSF</th>
<th width="15%">Net Amount</th>
</tr>
<?php $srno = $totalamount = 0;
foreach ($invoice['visas'] as $key => $t) { ?>
<tr>
<td class="insideitems"><?php echo $t['visa_no'];?></td>
<td class="insideitems"><?php
echo strtoupper($t['pax'][0]['paxname']); echo (count($t['pax']) > 1)? '+'.count($t['pax']):''; ?>
</td>
<td class="insideitems">0</td>
<td class="insideitems">0</td>
<td class="insideitems"><?php echo count($t['pax']); ?></td>
<td class="insideitems"><?php echo $t['remarks'];?></td>
<td class="insideitems"><?php echo $t['visatypename'];?></td>
<td class="insideitems">
<?php $vat = 0;
foreach ($t['cfs'] as $cfs){
if($cfs['chargefieldtype'] == 5) $vat += $cfs['ammount'];
}
echo number_format($t['customer_payable'] - $vat,2);
$totalamount +=$t['customer_payable'];?> <?php echo $customer['currencycode'];?>
</td>
<td class="insideitems"><?php echo number_format($vat,2); ?> <?php echo $customer['currencycode'];?></td>
<td class="insideitems"><?php echo number_format($t['customer_payable'],2); ?> <?php echo $customer['currencycode'];?></td>
</tr>
<?php }?>
<caption style="caption-side: bottom; text-align: right;">Visa Total: <?php echo number_format($totalamount,2);?> <?php echo $customer['currencycode'];?></caption>
</table>
<?php }if($invoice['others']){ ?>
<table style="border-bottom: 1px solid black;">
<caption style="text-align: left;"><b>Other Service(s)</b></caption>
<tr>
<th width="10%">Reference No.</th>
<th width="15%">Passenger Name</th>
<th width="15%">Vendor</th>
<th width="25%">Remarks</th>
<th width="10%">Gross</th>
<th width="10%">PSF</th>
<th width="15%">Net Amount</th>
</tr>
<?php $srno = $totalamount = 0;
foreach ($invoice['others'] as $key => $t) { ?>
<tr>
<td class="insideitems"><?php echo $t['ref_no'];?></td>
<td class="insideitems"><?php
echo strtoupper($t['pax'][0]['paxname']); echo (count($t['pax']) > 1)? '+'.count($t['pax']):''; ?>
</td>
<td class="insideitems"><?php echo $t['vendorname'];?></td>
<td class="insideitems"><?php echo $t['remarks'];?></td>
<td class="insideitems">
<?php $vat = 0;
foreach ($t['cfs'] as $cfs){
if($cfs['chargefieldtype'] == 5) $vat += $cfs['ammount'];
}
echo number_format($t['customer_payable'] - $vat,2);
$totalamount +=$t['customer_payable'];?> <?php echo $customer['currencycode'];?>
</td>
<td class="insideitems"><?php echo number_format($vat,2); ?> <?php echo $customer['currencycode'];?></td>
<td class="insideitems"><?php echo number_format($t['customer_payable'],2); ?> <?php echo $customer['currencycode'];?></td>
</tr>
<?php }?>
<caption style="caption-side: bottom; text-align: right;">Genral Amount Total: <?php echo number_format($totalamount,2);?> <?php echo $customer['currencycode'];?></caption>
</table>
<?php }if($invoice['insurances']){ ?>
<table style="border-bottom: 1px solid black;">
<caption style="text-align: left;"><b>Insurance(s)</b></caption>
<tr>
<th width="10%">Reference No.</th>
<th width="15%">Passenger Name</th>
<th width="15%">Vendor</th>
<th width="25%">Remarks</th>
<th width="10%">Gross</th>
<th width="10%">PSF</th>
<th width="15%">Net Amount</th>
</tr>
<?php $srno = $totalamount = 0;
foreach ($invoice['insurances'] as $key => $t) { ?>
<tr>
<td class="insideitems"><?php echo $t['policy_no'];?></td>
<td class="insideitems"><?php
echo strtoupper($t['pax'][0]['paxname']); echo (count($t['pax']) > 1)? '+'.count($t['pax']):''; ?>
</td>
<td class="insideitems"><?php echo $t['insurancecompany'];?></td>
<td class="insideitems"><?php echo $t['remarks'];?></td>
<td class="insideitems">
<?php $vat = 0;
foreach ($t['cfs'] as $cfs){
if($cfs['chargefieldtype'] == 5) $vat += $cfs['ammount'];
}
echo number_format($t['customer_payable'] - $vat,2);
$totalamount += $t['customer_payable'];?> <?php echo $customer['currencycode'];?>
</td>
<td class="insideitems"><?php echo number_format($vat,2); ?> <?php echo $customer['currencycode'];?></td>
<td class="insideitems"><?php echo number_format($t['customer_payable'],2); ?> <?php echo $customer['currencycode'];?></td>
</tr>
<?php }?>
<caption style="caption-side: bottom; text-align: right;">Insurance Total: <?php echo number_format($totalamount,2);?> <?php echo $customer['currencycode'];?></caption>
</table>
<?php }?>
<table id="items">
<tbody>
<tr>
<td width="70%" rowspan="3"><?php echo $this->auth->number_to_word($invoice['customer_total']); ?> <?php echo $customer['currencytitle'];?></td>
<td width="15%" class="total-line">Invoice Total</td>
<td width="15%" class="total-value"><div id="subtotal"><?php echo number_format($invoice['customer_total']);?> <?php echo $customer['currencycode'];?></div></td>
</tr>
<tr>
<td width="15%" class="total-line">Invoice Paid</td>
<td width="15%" class="total-value"><div id="subtotal">0 <?php echo $customer['currencycode'];?></div></td>
</tr>
<tr>
<td class="total-line balance">Grand Total</td>
<td class="total-value balance"><div class="due"><?php echo number_format($invoice['customer_total']);?> <?php echo $customer['currencycode'];?></div></td>
</tr>
</tbody>
</table>
<br>
<br>
<table width="100%">
<tr>
<td style="text-align: center; border: 0px;" width="20%"><?php echo $LogedInUser['first_name'];?></td>
<td style="border: 0px;" width="5%"> </td>
<td style="border: 0px;" width="20%"> </td>
<td style="border: 0px;" width="5%"> </td>
<td style="border: 0px;" width="20%"> </td>
<td style="border: 0px;" width="5%"> </td>
<td style="border: 0px;" width="20%"> </td>
</tr>
<tr>
<th style="border: 0px; border-top: 1px solid black;">Prepared By</th>
<td style="border: 0px;"> </td>
<th style="border: 0px; border-top: 1px solid black;">Checked By</th>
<td style="border: 0px;"> </td>
<th style="border: 0px; border-top: 1px solid black;">Approved By</th>
<td style="border: 0px;"> </td>
<th style="border: 0px; border-top: 1px solid black;">Received By</th>
</tr>
</table>
</div>
<!-- related transactions -->
<!-- end related transactions -->
<div class="printfooter" id="terms">
<h5><!--Terms--></h5>
<p><?php echo $LogedInUser['branch']['invoice_footer'];?></p>
</div>
</div>
</body></html>
页脚部分应该在最后一页