<?php
require 'sendMessage.php';
include '.\connectsale.php';
$query = "
SELECT 'LCS' COMPANY_CODE,
pl.productlevelcode AS STORE_ID,
DATE_FORMAT(ot.SaleDate, '%d-%b-%Y') AS BUSINESS_DATE,
IF (ot.salemode = 1, 'DI', 'TA') AS CHANNEL_TYPE,
FORMAT(SUM(ot.receiptsaleprice ),2) AS GROSS_SALES,
FORMAT (SUM(ot.receiptdiscount),2) AS DISCOUNT,
FORMAT (SUM(ot.transactionvat),2) AS SALES_TAX,
FORMAT (SUM(ot.receiptsaleprice - ot.transactionvat),2) AS NET_SALES,
SUM(ot.nocustomer) AS CUSTOMER,
COUNT(*) AS DOCKET
FROM ordertransaction ot,
productlevel pl
WHERE ot.shopid = pl.productlevelid
AND ot.saledate = '2021-11-24'
AND ot.receiptid <> 0
AND ot.transactionstatusid = 2
GROUP BY pl.productlevelid,
pl.productlevelcode,
ot.saledate,
ot.salemode
ORDER BY ot.saledate,
productlevelcode,
ot.salemode;
";
$result_query = mysqli_query($condb,$query);
$arrBubble = [];
foreach ($result_query as $row) {