Hello,
I'm using fpdf library to generate pdf invoice. I manage to view the pdf invoice for one item row only. below is the code:
$qry = "SELECT
invitems.itemId,
invitems.invoiceId,
invitems.itemNumber,
invitems.ChargesID,
invitems.itemDesc,
invitems.itemAmountO,
invitems.itemAmountP,
invitems.discountAmount,
charges.ChargesTitle,
invitems.itemqty
FROM
invitems
LEFT JOIN charges ON invitems.ChargesID = charges.ChargesID
WHERE invoiceId = ".$invoiceId."
ORDER BY itemNumber ASC";
$result = mysqli_query($mysqli, $qry) or die('-3'.mysqli_error());
$rows = mysqli_fetch_assoc($result);
$description = $rows['ChargesTitle'];
$quantity = $rows['itemqty'];
$Official = $rows['itemAmountO'];
$Professional = $rows['itemAmountP'];
$discountAmount = $rows['discountAmount'];
$discount = number_format($Professional, 2, '.', '') * $quantity *(($discountAmount)/100);
$itemAmount = number_format($Official, 2, '.', '') + number_format($Professional, 2, '.', '');
$lineTotal = ($itemAmount * $quantity) - ($discount);
The code for sending data to pdf library
//Add items
$invoice->addItem($description,$quantity,$Official,$Professional,$discount,$lineTotal);
My Question is how can I fetch all invoice items using arrary or foreach.
Best regards.