我现在在面板预览中有2个发票选项,并以PDF格式下载。我的预览发票模板工作正常,但PDF模板没有复制预览的确切模式。以下是我的预览发票代码,可以在另一个选项卡中查看并显示所有HTML文本
<?php
$countries = config_item('country_list');
?>
<style>
body{
font-family:Arial;
}
table{
font-size:12px;
width: 100%;
text-align: center;
}
table td, table th, table {
border-right: 2px solid #333;
padding: 10px 5px;
border-collapse: collapse;
}
table{
}
table.table thead tr th {
padding: 15px 0;
}
</style>
<div class="modal" id="modal-view-invoice" style=" width: 700px;
margin: 0 auto; background: #fff;
padding: 30px;">
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<div class="col-lg-6">
<?php $logo = get_siteconfig('logo');
if($logo != ''){
?>
<img src="<?php echo base_url().UPLOADSDIR.$logo;?>" width="50%"/>
<?php
}
?>
</div>
<div class="col-lg-6">
<span><h2 style="font-size:40px; line-height: 0;"><u><?php echo "ALI Usman Printers" ?></u><span style="float:right; font-size:14px">Bill/Cash Memo</span></h2></span>
<p style="font-size:14px;"><span style="float:right;">P-987/4, SAID PUR ROAD, RAWALPINDI. <b>Ph#: 5550531, Fax#: 5770376</b></span></p>
<h4 style="font-size: 20px; line-height: 45px; padding: 0 20px;">M/s: <?php echo $invoice_details['invoice_details']->client_name; ?><br></h4>
<div style=" border-bottom: 2px solid #333; ">
<div style=" display: inline-block; font-size:16px; width:33%">No. <?php echo $invoice_details['invoice_details']->invoice_number; ?></div>
<div style="display:inline-block; font-size:16px; width:32%; text-align:center;">BILL DATE: <? echo format_date($invoice_details['invoice_details']->invoice_date_created);?></div>
<div style="display:inline-block; font-size:16px; width:33%; text-align:right">DUE DATE: <? echo format_date($invoice_details['invoice_details']->invoice_due_date);?></div>
</div>
<table class="table">
<thead>
<tr style="border-bottom: 2px solid #333;" class="table_header" style="">
<th>S.<br>No.</th>
<th>QTY</th>
<th>DESCRIPTION</th>
<th>D.O.NO.</th>
<th>DELIVERY<br>DATE</th>
<th>ORDER<br>NO.</th>
<th>DATE</th>
<th>RATE</th>
<th style="border-right-color: #fff;">RUPEES</th>
<!-- <th>DESCRIPTION</th> -->
</tr>
</thead>
<tbody>
<?php
$i=1;
foreach ($invoice_details['invoice_items'] as $count=>$item)
{?>
<tr class="transaction-row">
<td><?php echo $i;?></td>
<td><?php echo $item['item_quantity'];?></td>
<td style="text-align:left;"><?php echo $item['item_description'];?></td>
<td><?php echo $item['DO'];?></td>
<td><?php echo format_date($item['DueDate']);?></td>
<td><?php echo $item['item_order'];?></td>
<td><?php echo format_date($item['Date']);?></td>
<td class="text-right"><?php echo format_amount($item['item_price']); ?></td>
<td style="border-right-color: #fff;" class="text-right"><?php echo format_amount($item['item_price']*$item['item_quantity']-$item['item_discount']); ?></td>
</tr>
<?php
$i++;
}
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td style="border-right-color: #fff;"> </td>
</tr>
<tr style="border-top: 2px solid #333;">
<td colspan="9" style=" border-color: #fff;text-align:right; padding: 10px 5px; background: #fff;"><span style="text-align:center; float:left; padding-top: 30px; "> <hr/> Signature</span><b style="font-size:18px">Total: <?php echo format_amount($invoice_details['invoice_totals']['item_total'] + $invoice_details['invoice_totals']['tax_total']);?></b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
&#13;
此代码以PDF格式下载发票。
@media print{
body{
font-family:Arial;
}
table{
font-size:12px;
width: 100%;
text-align: center;
}
table td, table th, table {
border-right: 2px solid #333;
padding: 10px 5px;
border-collapse: collapse;
}
table{
}
table.table thead tr th {
padding: 15px 0;
}
#modal-view-invoice{
width: 700px;
margin: 0 auto; background: #fff;
padding: 30px;
}
.h2-1{
font-size:40px; line-height: 0;
}
.h2-2{
font-size:20px;
}
.client-name{
font-size: 20px; line-height: 45px; border: 2px solid #333; padding: 0 20px;
}
.div-test{
border-bottom: 2px solid #333;
}
.div-test div{
display: inline-block; font-size:16px; width:33%;
}
.div-test div:nth-child(2){
display:inline-block; font-size:16px; width:32%; text-align:center;
}
.div-test div:nth-child(3){
display:inline-block; font-size:16px; width:33%; text-align:right
}
}
&#13;