Edit file File name : cron_coupon_revenue_rpt.php Content :<?php include_once("include/config.php"); include_once("include/functions.php"); include_once("include/Sendmail.php"); ini_set('display_errors', 1); error_reporting(E_ALL); $genFlg = 1; if($genFlg == 1) { //Email notification $genDate1 = '2023-01-22'; $genDate2 = '2023-05-24'; $where.=" and date(o.order_date)>='".$genDate1."' and date(o.order_date)<='".$genDate2."' "; $cpReportSql = $obj->Query("SELECT count(*) as num_of_trans,sum(o.total_amount) as orderAmount,o.coupon_code, o.cp_source,cs.name FROM `tbl_order` o left join coupon_source as cs on cs.id=o.cp_source WHERE o.payment_status=1 and (o.discount_via !='') and o.coupon_code !='' $where group by o.coupon_code order by orderAmount desc "); $enq_message = ''; $enq_message .= "Coupon-Revenue-Report-".date("dMY_H:i")." <br/><br/>"; $enq_message .= "<table width='100%' border='1' cellspacing='1' cellpadding='0'> <tr> <td width='100%'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr style='background:#666; color:#fff' > <td width='23%' align='center'><h3>Coupon Code</h3></td> <td width='22%' align='center'><h3>Number Of Transaction</h3></td> <td width='10%' align='center'><h3>Order Amount</h3></td> </tr> <tr> <td><strong> </strong></td> <td> </td> <td> </td> </tr>"; while($result=$obj->fetchNextObject($cpReportSql)){ $noOfTransaction = $result->num_of_trans; $totalReveneu = $result->orderAmount; $couponCode = $result->coupon_code; $website_currency_symbol = "$"; $enq_message .= "<tr> <td align='center'>$couponCode</td> <td align='center'>$noOfTransaction</td> <td align='center'>$website_currency_symbol".$totalReveneu."</td> </tr>"; //selected_option_groups } $enq_message .= "</table> </td> </tr> </table>"; //echo $enq_message;die; $saveOrderItem=1; if($saveOrderItem) { $sendmail = new Sendemail(); $fromEmail = "hello@quicklly.com"; $fromName = "Quicklly.com"; $toEmail = "vivektalko@gmail.com"; $toName = "Coupon-Revenue-Report"; $emailBody = $enq_message; $replyTo = "hello@quicklly.com"; //$replyTo = "vivektalko@gmail.com"; $subject = "Coupon-Revenue-Report-".date("dMY_H:i"); //$bccEmailList="vivektalko@gmail.com"; // $bcc ="hello@quicklly.com,chinglifreshfarms@gmail.com,teammyvalue365@gmail.com"; //$sendmail->sendEmail($fromEmail, $fromName, $toEmail, $toName, $subject, $emailBody, $bcc, $replyTo); //Simple web mail $headers = "MIME-Version: 1.0"."\r\n"; $headers .= "Content-type:text/html;charset=windows-1254"."\r\n"; $headers .= "From: Quicklly.com <hello@quicklly.com> \r\n"; $headers .= "Bcc: $bccEmailList\r\n"; //@mail($toEmail, $subject, $emailBody, $headers); $sendmail->sendEmail($fromEmail, $fromName, $toEmail, $toName, $subject, $emailBody, $bcc, $replyTo); echo "Report sent successfully!"; } } else { echo "Report sent successfully2!"; } ?> Save