if ($stmt->execute()) { $stmt->setFetchMode(PDO::FETCH_ASSOC); } while ($result = $stmt->fetch()) { $data[] = array($result['ComponentSpecs'], $result['Used_LineQuantity'], $result['Used_LineCost'], $result['Used_LineStatus'], $result['Used_LineDate'], $result['Used_LineSubTotal']); } date_default_timezone_set('America/Los_Angeles'); $pdf = new myPDF('L', 'mm', 'Letter'); $date = date("m/d/Y h:i A"); $pdf->date = $date; $header1 = array('Usage Order #', 'Used By', 'For Tool', 'Date', 'Notes', 'Status'); $header = array('Component Used', 'Quantity Used', 'Cost', 'Status', 'Date Used', 'Subtotal'); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetY(35); $pdf->BuildTable1($header1, $data1); $pdf->SetY(55); $pdf->BuildTable($header, $data); $pdf->Ln(6); $substring = " Total Subtotal: \$" . $subtotal . " "; $substrwidth = $pdf->GetStringWidth($substring); $substrX = 260 - $substrwidth; $pdf->SetX($substrX); $pdf->Cell($substrwidth, 6, $substring, 1, 1, 'C'); $tax = $subtotal * 0.075; $tax = round($tax, 2); $tax = number_format((double) $tax, 2, '.', ''); $taxstring = " Tax (7.5%): \$" . $tax . " "; $taxstrwidth = $pdf->GetStringWidth($taxstring); $taxstrX = 260 - $taxstrwidth; $pdf->SetX($taxstrX);