Advertisement
Guest User

Untitled

a guest
Oct 25th, 2018
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. <h2> Detail Pembelian </h2>
  2. <?php
  3. $ambil = $koneksi->query("SELECT * FROM pembelian JOIN pelanggan
  4. ON pembelian.id_pelanggan=pelanggan.id_pelanggan
  5. WHERE pembelian.id_pembelian='$_GET[id]'");
  6. $detail = $ambil->fetch_assoc();
  7. ?>
  8.  
  9.  
  10. <strong><?php echo $detail['nama_pelanggan']; ?></strong><br>
  11. <p>
  12. <?php echo $detail['telepon_pelanggan']; ?><br>
  13. <?php echo $detail['email_pelanggan']; ?>
  14. </p>
  15.  
  16. <p>
  17. Tanggal :<?php echo $detail['tanggal_pembelian']; ?><br>
  18. Total :<?php echo $detail['total_pembelian']; ?>
  19. </p>
  20.  
  21. <table class="table table-bordered">
  22. <thead>
  23. <tr>
  24. <th>No</th>
  25. <th>Nama Produk</th>
  26. <th>Harga</th>
  27. <th>Jumlah</th>
  28. <th>SubTotal</th>
  29. <tr>
  30. </thead>
  31. <tbody>
  32. <?php $nomor=1; ?>
  33. <?php $ambil=$koneksi->query("SELECT * FROM pembelian_produk JOIN produk ON
  34. pembelian_produk.id_produk=produk.id_produk
  35. WHERE pembelian_produk.id_pembelian='$_GET[id]'"); ?>
  36. <?php while($pecah=$ambil->fetch_assoc()){ ?>
  37. <tr>
  38. <td><?php echo $nomor; ?></td>
  39. <td><?php echo $pecah['nama_produk']; ?></td>
  40. <td><?php echo $pecah['harga_produk']; ?></td>
  41. <td><?php echo $pecah['jumlah']; ?></td>
  42. <td>
  43. <?php echo $pecah['harga_produk']*$pecah['jumlah']; ?>
  44. </td>
  45. </tr>
  46.  
  47. <?php $nomor++; ?>
  48. <?php } ?>
  49.  
  50. </tbody>
  51. </table>
  52.  
  53. <?php
  54. // Import PHPMailer classes into the global namespace
  55. // These must be at the top of your script, not inside a function
  56. require '../vendor/phpmailer/PHPMailer/src/Exception.php';
  57. require '../vendor/phpmailer/PHPMailer/src/PHPMailer.php';
  58. require '../vendor/phpmailer/PHPMailer/src/SMTP.php';
  59.  
  60. //Load Composer's autoloader
  61. require '../vendor/autoload.php';
  62.  
  63. $mail = new PHPMailer\PHPMailer\PHPMailer(); // Passing `true` enables exceptions
  64. try {
  65. //Server settings
  66. $mail->SMTPDebug = 2; // Enable verbose debug output
  67. $mail->isSMTP(); // Set mailer to use SMTP
  68. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  69. $mail->SMTPAuth = true; // Enable SMTP authentication
  70. $mail->Username = 'distrokutesting@gmail.com'; // SMTP username
  71. $mail->Password = 'Distrokutesting123'; // SMTP password
  72. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  73. $mail->Port = 465; // TCP port to connect to
  74. $mail->SMTPOptions = array(
  75. 'ssl' => array(
  76. 'verify_peer' => false,
  77. 'verify_peer_name' => false,
  78. 'allow_self_signed' => true
  79. )
  80. ); // TCP port to connect to
  81.  
  82.  
  83. $ambil = $koneksi->query("SELECT * FROM pembelian JOIN pelanggan
  84. ON pembelian.id_pelanggan=pelanggan.id_pelanggan
  85. WHERE pembelian.id_pembelian='$_GET[id]'");
  86. $detail = $ambil->fetch_assoc();
  87.  
  88. $sql = $koneksi->query("SELECT * FROM pembelian_produk JOIN produk ON
  89. pembelian_produk.id_produk=produk.id_produk
  90. WHERE pembelian_produk.id_pembelian='$_GET[id]'");
  91. $pecah = $sql->fetch_assoc();
  92.  
  93. //Recipients
  94. $mail->setFrom('distrokutesting@gmail.com', 'Mailer');
  95. $mail->addAddress($detail['email_pelanggan']); // Add a recipient
  96. //$mail->addAddress('ellen@example.com'); // Name is optional
  97. //$mail->addReplyTo('info@example.com', 'Information');
  98. //$mail->addCC('cc@example.com');
  99. //$mail->addBCC('bcc@example.com');
  100.  
  101. //Attachments
  102. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  103. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  104.  
  105. //Content
  106. $mail->isHTML(true); // Set email format to HTML
  107. $mail->Subject = 'PEMBERITAHUAN PEMBAYARAN';
  108. $mail->Body = "<p>By Abah</p>
  109. <p>Di Mohon untuk segera melakukan Pembayaran ke REKENING BANK Jateng 111-1021-0011 AN. Tim Magang Can Creative</p>
  110. <br><table border='3'>
  111. <tr>
  112. <th>Nama</th>
  113. <th>Produk</th>
  114. <th>No Telepon</th>
  115. <th>SubTotal</th>
  116. </tr>
  117. <tr>
  118. <td>".$detail['nama_pelanggan']."</td>
  119. <td>".$pecah['nama_produk']."</td>
  120. <td>".$detail['telepon_pelanggan']."</td>
  121. <td>".$detail['total_pembelian']."</td>
  122. </tr>
  123. </table>"
  124. ;
  125. $mail->AltBody = 'Di Mohon untuk segera melakukan Pembayaran ke REKENING BANK Jateng 111-1021-0011 AN. Tim Magang Can Creative ';
  126.  
  127. $mail->send();
  128. echo 'Message has been sent';
  129. } catch (Exception $e) {
  130. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  131. }
  132.  
  133.  
  134. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement