$r = mysqli_fetch_assoc($res); if ($pdf->getY() > $pdf->getPageHeight() - 56.5) { $pdf->rollbackTransaction(true); $pdf->AddPage(); $pdf->setY(100); } $pdf->Cell(6, 8, $i, 0, 0, 'L'); $pdf->MultiCell(190, 8, $r['Term'], 0, 'L', 0, 1, '', '', true, 0, false, true, 8, 'M', true); $i++; } } if ($previewok == '0') { if ($poid != '') { $po->setValue('poid', $poid); } $po->savePurchaseOrder(); $poid = $po->getValue('poid'); $i = 0; $j = count($description); while ($i < $j) { if ($description[$i] != '') { if (isset($poitemid[$i])) { $po->setValue('poitemid', $poitemid[$i]); } else { $po->setValue('poitemid', ''); } $po->setValue('poid', $poid); $po->setValue('description', $description[$i]); $po->setValue('itemqty', $itemqty[$i]); $po->setValue('price', $price[$i]); $po->setValue('discount', $discount[$i]);