SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.kara-indonesia.com'; // Specify main and backup SMTP servers $mail->Port = 587; // TCP port to connect to $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'noreplay@kara-indonesia.com'; // SMTP username $mail->Password = 'September2018'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); //Recipients $mail->setFrom('noreplay@kara-indonesia.com', 'Kara Island'); $mail->addAddress($email); //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Summary Report'; $mail->Body = ''; $mail->Body .= ""; $mail->Body .= "
"; } $db = null; $mail->Body .= ""; $mail->Body .= ""; $db = getDB(); $sql4 = "select ItemName, SUM(Qnty) as Total, ROUND(UnitPrice, 0) as UnitPrice, ROUND(Discount1, 0) as Discount1 from vwPenjualan where TransDate ='".date_format($dates, 'Y-m-d')."' AND WHSID='".$WHSID."' AND Status = 1 GROUP By ItemName, UnitPrice, Discount1"; $stmt4 = $db->prepare($sql4); $stmt4->execute(); while ($row4 = $stmt4->fetch()){ $ItemName = strtolower($row4[0]); $TotalItemSales += $row4[1] * $row4[2]; $TotalDiscountSales += $row4[1] * $row4[3]; $mail->Body .= ""; if($row4[3] > 0){ $mail->Body .= ""; } } $db = null; $mail->Body .= ""; $mail->Body .= ""; $db = getDB(); $sql3 = "select SUM(Discount) as TotalDiscount, SUM(PPDAmount+PPNAmount) as TotalPajak, SUM(Pembelian) as Total, SUM(GrandTotal) as GrandTotal from vwPenjualanHdr where TransDate ='".date_format($dates, 'Y-m-d')."' AND WHSID='".$WHSID."'"; $stmt3 = $db->prepare($sql3); $stmt3->execute(); $row3 = $stmt3->fetch(); $GrandTotal = number_format($row3[3]); $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= ""; $db = null; $mail->Body .= ""; $mail->Body .= ""; $db = getDB(); $sql5 = "EXEC spSalesSummaryCashier @dari ='".date_format($dates, 'Y-m-d')."', @WHSID='".$WHSID."'"; $stmt5 = $db->prepare($sql5); $stmt5->execute(); while ($row5 = $stmt5->fetch()){ $ItemName = strtolower($row5[0]); $mail->Body .= ""; if($row5[1] != 0 ){ $mail->Body .= ""; } if($row5[3] != 0 ){ $mail->Body .= ""; } if($row5[5] != 0 ){ $mail->Body .= ""; } if($row5[7] != 0 ){ $mail->Body .= ""; } if($row5[9] != 0 ){ $mail->Body .= ""; } } $db = null; $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= ""; $db = getDB(); $sql6 = "select Payment, SUM(GrandTotal) as Total from vwPenjualanHdr where TransDate ='".date_format($dates, 'Y-m-d')."' AND WHSID='".$WHSID."' GROUP By Payment "; $stmt6 = $db->prepare($sql6); $stmt6->execute(); while ($row6 = $stmt6->fetch()){ $mail->Body .= ""; } $db = null; $mail->Body .= ""; $mail->Body .= ""; $mail->Body .= "
Summary Report
"; $db = getDB(); $sql = "select * from tblMstWarehouse where WHSID='".$WHSID."'"; $stmt0 = $db->prepare($sql); $stmt0->execute(); while ($row0 = $stmt0->fetch()) { $mail->Body .= "".$row0[1]."
Cashier :
"; $db = getDB(); $sql = "select CreatedBy from vwPenjualanHdr where TransDate = '".date_format($dates, 'Y-m-d')."' and WHSID='".$WHSID."' Group by CreatedBy"; $stmt = $db->prepare($sql); $stmt->execute(); while ($row = $stmt->fetch()) { $mail->Body .= $row[0] . "
"; } $db = null; $mail->Body .= "Date :". date_format($dates, 'd-m-Y') ."
From "; $db = getDB(); $sql1 = "select top 1 created_date from pos_tbl_transaksi_saldo WHERE tanggal='".date_format($dates, 'Y-m-d')."' ORDER BY created_date asc "; $stmt1 = $db->prepare($sql1); $stmt1->execute(); while ($row1 = $stmt1->fetch()) { $jam1 = date_create($row1[0]); $mail->Body .= date_format($jam1, 'h:i:sa') . " to " .date("h:i:sa"); } $db = null; $db = getDB(); $mail->Body .= "
ITEM SALESQuantity
". number_format($row4[1]) ."x ".ucfirst($ItemName) . " ". number_format($row4[2]) . "
Discount ". number_format($row4[1]) ."x (". number_format($row4[3]) . ")
TOTAL ITEM SALES". number_format($TotalItemSales) ."
REVENUETotal
Total Penjualan ". number_format($row3[2]) . "
Total Discount (". number_format($row3[0]) . ")
Total Pajak ". number_format($row3[1]) . "
TOTAL REVENUE ". number_format($row3[3]) . "
CASHIER
".ucfirst($ItemName) . "
". number_format($row5[1]) . " CASH ". number_format($row5[2]) . "
". number_format($row5[3]) . " DEBIT ". number_format($row5[4]) . "
". number_format($row5[5]) . " CREDIT ". number_format($row5[6]) . "
". number_format($row5[7]) . " DIGITAL PAYMENT ". number_format($row5[8]) . "
". number_format($row5[9]) . " VOUCHER ". number_format($row5[10]) . "
TOTAL CASHIER". $GrandTotal ."
PAYMENT
". $row6[0] . "". number_format($row6[1]) . "
TOTAL PAYMENT". $GrandTotal ."

Download aplikasi Point Of Sale Kara Island

"; //$mail->Body = $some_page_contents; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInf