Guest User

Untitled

a guest
Oct 17th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.86 KB | None | 0 0
  1. if (mysqli_query($conn, $sql)) {
  2.  
  3. $query = "SELECT id FROM ncr_input ORDER BY id DESC LIMIT 1";
  4. $result = mysqli_query($conn, $query);
  5.  
  6. $row = mysqli_fetch_row($result);
  7.  
  8. $ncrnummer = $row[0];
  9.  
  10. for($i = 0; $i < count($_FILES['attachments']['name']); $i++)
  11. {
  12. $filetmp = $_FILES["attachments"]["tmp_name"][$i];
  13. $filename = $_FILES["attachments"]["name"][$i];
  14. $filepath = "images/".$filename;
  15.  
  16. move_uploaded_file($filetmp,$filepath);
  17.  
  18. $querypictureupload = "INSERT INTO file_upload (ncrnummer,filename) VALUES ('$ncrnummer','$filename')";
  19. $result = mysqli_query($conn, $querypictureupload);
  20. }
  21.  
  22. ob_start();
  23. $pdf = new FPDF();
  24.  
  25. $pdf->AddPage();
  26.  
  27. $pdf->Rect(10, 10, 190, 186, 'D');
  28.  
  29. $pdf->Image("sitephotos/Petrogaslogo.jpg",11,11,35,17.5,"JPG");
  30.  
  31. $pdf->SetFont("Helvetica", "B", 15);
  32. $pdf->Cell(0,20, "{$typencr}",1,1, 'C');
  33. $pdf->SetFont("Arial", "B", 10);
  34.  
  35. $pdf->Cell(47.5,10,"Brief description:", 1 ,0);
  36. $pdf->SetFont("Arial", "", 8);
  37. $pdf->Cell(47.5,10,"{$categorie}", 0 ,0);
  38.  
  39. $pdf->SetFont("Arial", "B", 10);
  40. $pdf->Cell(47.5,10,"Drawingnr:", 1 ,0);
  41. $pdf->SetFont("Arial", "", 8);
  42. $pdf->Cell(47.5,10,"{$tekeningnr}", 0 ,1);
  43.  
  44. $pdf->SetFont("Arial", "B", 10);
  45. $pdf->Cell(47.5,10,"P.G. reference:", 1 ,0);
  46. $pdf->SetFont("Arial", "", 8);
  47. $pdf->Cell(47.5,10,"{$projectnummer}", 0 ,0);
  48.  
  49. $pdf->SetFont("Arial", "B", 10);
  50. $pdf->Cell(47.5,10,"Contact person:", 1 ,0);
  51. $pdf->SetFont("Arial", "", 8);
  52. $pdf->Cell(47.5,10,"{$projectleider}", 0 ,1);
  53.  
  54. $pdf->SetFont("Arial", "B", 10);
  55. $pdf->Cell(47.5,10,"Project description:", 1 ,0);
  56. $pdf->SetFont("Arial", "", 8);
  57. $pdf->Cell(47.5,10,"{$projectnaam}", 0 ,0);
  58.  
  59. $pdf->SetFont("Arial", "B", 10);
  60. $pdf->Cell(47.5,10,"Department:", 1 ,0);
  61. $pdf->SetFont("Arial", "", 8);
  62. $pdf->Cell(47.5,10,"{$waargeconstateerd}", 0 ,1);
  63.  
  64. $pdf->SetFont("Arial", "B", 10);
  65. $pdf->Cell(190,10,"Description of Non - Conformity / Complaint:", 1 ,1);
  66. $pdf->SetFont("Arial", "", 8);
  67. $pdf->MultiCell(190,4, "{$omschrijvingprobleem}nn",0,1);
  68.  
  69. $pdf->SetFont("Arial", "B", 10);
  70. $pdf->Cell(190,10,"Analysis of the cause of Non - Conformity / Complaint:", 1 ,1);
  71. $pdf->SetFont("Arial", "", 8);
  72. $pdf->MultiCell(190, 4, "{$omschrijvingoorzaak}nn",0,1);
  73.  
  74. $pdf->SetFont("Arial", "B", 10);
  75. $pdf->Cell(47.5,10,"Deviation caused by:", 1 ,0);
  76. $pdf->SetFont("Arial", "", 8);
  77. $pdf->Cell(47.5,10,"{$veroorzaaktdoor}", 0 ,0);
  78.  
  79. $pdf->SetFont("Arial", "B", 10);
  80. $pdf->Cell(47.5,10,"Supplier:", 1 ,0);
  81. $pdf->SetFont("Arial", "", 8);
  82. $pdf->Cell(47.5,10,"{$klant}", 0 ,1);
  83.  
  84. $pdf->SetFont("Arial", "B", 10);
  85. $pdf->Cell(47.5,10,"Report by:", 1 ,0);
  86. $pdf->SetFont("Arial", "", 8);
  87. $pdf->Cell(47.5,10,"{$gerapporteerddoor}", 0 ,0);
  88.  
  89. $pdf->SetFont("Arial", "B", 10);
  90. $pdf->Cell(47.5,10,"Date:", 1 ,0);
  91. $pdf->SetFont("Arial", "", 8);
  92. $pdf->Cell(47.5,10,"-", 0 ,1);
  93.  
  94. $pdf->SetFont("Arial", "B", 10);
  95. $pdf->Cell(47.5,10,"Proposed disposition:", 1 ,0);
  96. $pdf->SetFont("Arial", "", 8);
  97. $pdf->Cell(47.5,10,"{$correctiemaatregelen}", 0 ,0);
  98.  
  99. $pdf->SetFont("Arial", "B", 10);
  100. $pdf->Cell(47.5,10,"Planned completion:", 1 ,0);
  101. $pdf->SetFont("Arial", "", 8);
  102. $pdf->Cell(47.5,10,"{$geplandedatumgereed}", 0 ,1);
  103.  
  104. $pdf->SetFont("Arial", "B", 10);
  105. $pdf->Cell(47.5,10,"Action by:", 1 ,0);
  106. $pdf->SetFont("Arial", "", 8);
  107. $pdf->Cell(47.5,10,"{$corractiedoor}", 0 ,0);
  108.  
  109. $pdf->SetFont("Arial", "B", 10);
  110. $pdf->Cell(47.5,10,"Estimated costs/hrs:", 1 ,0);
  111. $pdf->SetFont("Arial", "", 8);
  112. $pdf->Cell(47.5,10,"{$geschattekosten} / {$geschatteuren}", 0 ,1);
  113.  
  114. $pdf->SetFont("Arial", "B", 10);
  115. $pdf->Cell(190,10,"Approval QM ........ Approval others ........ Acceptance AI ........", 1 ,1);
  116.  
  117. $pdf->SetFont("Arial", "B", 10);
  118. $pdf->Cell(47.5,10,"Identify corrective action", 1 ,0);
  119. $pdf->SetFont("Arial", "", 12);
  120. $pdf->Cell(47.5,10,"String maken......", 0 ,1);
  121.  
  122. $pdf->SetFont("Arial", "B", 10);
  123. $pdf->Cell(190,10,"Reviewed by: Review date:", 1 ,1);
  124.  
  125. $pdf->SetFont("Arial", "B", 10);
  126. $pdf->Cell(190,10,"Verification QM ........ Verification others ........ Acceptance AI ........", 1 ,1);
  127.  
  128. $pdf->SetFont("Arial", "B", 10);
  129. $pdf->Cell(47.5,10,"Preventive action:", 1 ,0);
  130. $pdf->SetFont("Arial", "", 8);
  131. $pdf->Cell(47.5,10,"{$preventieveacties}", 0 ,1);
  132.  
  133. $pdf->SetFont("Arial", "B", 10);
  134. $pdf->Cell(47.5,10,"Status:", 1 ,0);
  135. $pdf->SetFont("Arial", "", 8);
  136. $pdf->Cell(47.5,10,"{$status}", 0 ,0);
  137.  
  138. $pdf->SetFont("Arial", "B", 10);
  139. $pdf->Cell(47.5,10,"Date closed", 1 ,0);
  140. $pdf->SetFont("Arial", "", 8);
  141. $pdf->Cell(47.5,10,"-", 0 ,1);
  142.  
  143. $pdf->AddPage();
  144.  
  145. $query1 = "SELECT filename FROM `file_upload` WHERE ncrnummer = '$ncrnummer'";
  146. $result1 = mysqli_query($conn, $query1);
  147.  
  148. while ($row = mysqli_fetch_assoc($result1)) {
  149. $image = $row['filename'];
  150. $pdf->Image("images/".$image,NULL , NULL ,100,85, "");
  151. $pdf->Cell(190, 3, "", 0, 1);
  152. }
  153.  
  154. $pdfdoc = $pdf->Output('', 'S');
  155. ob_end_flush();
  156.  
  157. $mail = new PHPMailer();
  158.  
  159. $mail->SMTPDebug = 0;
  160.  
  161. $mail->Host = "";
  162. $mail->isSMTP();
  163. $mail->SMTPAuth = "";
  164. $mail->Username = "";
  165. $mail->Password = "";
  166. $mail->Port = 25;
  167.  
  168. $mail->addAddress($projectleideremail);
  169. $mail->setFrom('');
  170. $mail->Subject = "NIEUWE NCR Project: {$projectnummer}";
  171. $mail->isHTML(true);
  172. $mail->Body = "DIT IS EEN TEST NCR";
  173. $mail->addStringAttachment($pdfdoc, 'NCR.pdf');
  174.  
  175. if ($mail->send()) {
  176. echo "<script>alert('Uw e-mail is verstuurd met een attachment')</script>";
  177. }
Add Comment
Please, Sign In to add comment