Страница PDF 1
Страница PDF 2
Последние несколько недель я ломаю голову над этой проблемой.Всякий раз, когда я добавляю несколько элементов и генерирую pdf, результат, который я получаю, совсем не соответствует действительности, как показано на рисунке 2. Поэтому, пожалуйста, если кто-нибудь знает какое-либо решение для этого, я был бы признателен за их помощь.Также он ничего не печатает после 22 пунктов.Вот код print_invoice.php
<?php
include("dbcon.php");
//print_invoice.php
if(isset($_GET["pdf"]) && isset($_GET["id"]))
{
require_once 'pdf.php';
include('database_connection.php');
$output = '';
$statement = $connect->prepare("
SELECT * FROM tbl_order
WHERE order_id = :order_id
LIMIT 1
");
$statement->execute(
array(
':order_id' => $_GET["id"]
)
);
$result = $statement->fetchAll();
foreach($result as $row)
{
$output .= '
<table width="100%" border="1" cellpadding="5" cellspacing="0">
<tr>
<td colspan="2" style="font-size:12px">
<strong><h1 style="text-align:center;">DHAS AUTO</h1></strong>
<p style="text-align:center;">Swami Samarth Square, Pudalik Nagar Road, Aurangabad.</p>
<p class="owner_det" style="text-align:center;">Mob. 9823106368</p>
</td>
</tr>
<tr>
<td colspan="2" align="center" style="font-size:18px"><b>Invoice</b></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" cellpadding="5">
<tr>
<td width="65%">
To,
<br/>
Name : '.$row["order_receiver_name"].'<br/>
Address : '.$row["order_receiver_address"].'<br/>
Party GSTIN : '.$row["gstin"].'
</td>
<td width="35%">
<b>GSTIN-XXXXXXXXXX</b>
Invoice No. : '.$row["order_no"].'<br />
Invoice Date : '.$row["order_date"].'<br />
Payment mode: '.$row["paymode"].'<br />
</td>
</tr>
</table>
<br />
<table width="100%" border="1" cellpadding="5" cellspacing="0">
<tr>
<th>Sr No.</th>
<th>Item Name/Labour Charges</th>
<th>Quantity</th>
<th>Price</th>
<th>Amount</th>
<th colspan="2">IGST(%)</th>
<th colspan="2">CGST(%)</th>
<th colspan="2">SGST(%)</th>
<th rowspan="2">Total</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Rate</th>
<th>Amount</th>
<th>Rate</th>
<th>Amount</th>
<th>Rate</th>
<th>Amount</th>
</tr>
';
$statement = $connect->prepare(
"SELECT * FROM tbl_order_item
WHERE order_id = :order_id"
);
$statement->execute(
array(
':order_id' => $_GET["id"]
)
);
$item_result = $statement->fetchAll();
$count = 0;
foreach($item_result as $sub_row)
{
$count++;
$output .= '
<tr>
<td>'.$count.'</td>
<td>'.$sub_row["item_name"].'</td>
<td>'.$sub_row["order_item_quantity"].'</td>
<td>'.$sub_row["order_item_price"].'</td>
<td>'.$sub_row["order_item_actual_amount"].'</td>
<td>'.$sub_row["order_item_tax1_rate"].'</td>
<td>'.$sub_row["order_item_tax1_amount"].'</td>
<td>'.$sub_row["order_item_tax2_rate"].'</td>
<td>'.$sub_row["order_item_tax2_amount"].'</td>
<td>'.$sub_row["order_item_tax3_rate"].'</td>
<td>'.$sub_row["order_item_tax3_amount"].'</td>
<td>'.$sub_row["order_item_final_amount"].'</td>
</tr>
';
}
$output .= '
<tr>
<td align="right" colspan="11"><b>Total</b></td>
<td align="right"><b>'.$row["order_total_after_tax"].'</b></td>
</tr>
<tr>
<td align="right" colspan="11"><b>Amount :</b></td>
<td align="right">'.$row["order_total_before_tax"].'</td>
</tr>
<tr>
<td align="right" colspan="11">IGST</td>
<td align="right">'.$row["order_total_tax1"].'</td>
</tr>
<tr>
<td align="right" colspan="11">CGST</td>
<td align="right">'.$row["order_total_tax2"].'</td>
</tr>
<tr>
<td align="right" colspan="11">SGST</td>
<td align="right">'.$row["order_total_tax3"].'</td>
</tr>
<tr>
<td align="right" colspan="11"><b>Total tax Amount :</b></td>
<td align="right">'.$row["order_total_tax"].'</td>
</tr>
<tr>
<td align="right" colspan="11"><b>Total Amount : </b></td>
<td align="right">'.$row["order_total_after_tax"].'</td>
</tr>
';
$output .= '
</table>
</td>
</tr>
</table>
<div class="signs">
<p style="text-align:left;">Customer Signature:__________
<br>
<br>
Authorised Signature:__________</p>
</div>
';
}
$pdf = new Pdf();
$file_name = 'Invoice-'.$row["order_no"].' . '.$row["order_receiver_name"].' .pdf';
$pdf->loadHtml($output);
$pdf->render();
$pdf->stream($file_name, array("Attachment" => false));
}
?>
<html>
<head>
</head>
<style>
</style>
</html>