ohctech_p8/minus_inventory_email.php
2024-10-16 19:18:52 +05:30

58 lines
1.6 KiB
PHP

<div id="DushantEmail">
<?php
include('includes/config/config.php');
include('includes/functions.php');
include('email_sender.php');
$eMailFlag = 1;
$sqlForMinus = "SELECT item_id, stock_qty , item_batch_no FROM item_stock WHERE stock_qty < 0";
$sqlQuery = mysqli_query($conn, $sqlForMinus);
if (mysqli_num_rows($sqlQuery) > 0) {
$html = "";
while ($row = mysqli_fetch_array($sqlQuery)) {
$stock_qty = $row['stock_qty'];
$html .= " ITEM ID " . $row['item_id'] . " STOCK QTY " . $stock_qty . " BATCH NO " . $row['item_batch_no'] . "<br>";
$eMailFlag = 0;
}
}
if ($eMailFlag == 0) {
$from = getConfigKey('email_username');
$host = getConfigKey('email_host');
$user = getConfigKey('email_username');
$pass = getConfigKey('email_password');
$port = getConfigKey('email_port');
$auth = getConfigKey('SMTP_AUTH');
$SMTPSecure = getConfigKey('SMTPSecure');
error_log('sender ' . getConfigKey('email_username'));
error_log('sender ' . getConfigKey('email_password'));
error_log('sender ' . $host);
error_log('sender ' . getConfigKey('email_port'));
error_log('sender ' . getConfigKey('SMTPSecure'));
$subject = 'Minus Inventory';
$message="<html>
<body>
<p>Hi,</p>
<p>items in minus stock Please Check Now</p>
<p>$html</p>
</body>
</html>";
$to = 'dushant@techsyneric.com,vaibhav@techsyneric.com';
$cc = 'sitaramsingh@techsyneric.com';
send_mail($to, $cc, $subject, $message, $remarks, $from, $host, $auth, $user, $pass, $port, $SMTPSecure);
}
?>
</div>