%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php error_reporting(E_ALL); date_default_timezone_set("Asia/Calcutta"); //ini_set('display_errors', '1'); define('DB_SERVER', "admissions.cluster-custom-c8m5zlhotfbm.ap-south-1.rds.amazonaws.com"); define('DB_USERNAME', "shardezone_user"); define('DB_PASSWORD', "7se%;pr*/A24AyTw"); define('DB_DATABASE', "shardaac_ezone_2022_db"); define('COMPANY', "ShardaTech pvt ltd."); /* Connect to MySQL and select the database. */ $conn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if (!$conn) { mysqli_connect_error(); } mysqli_set_charset($conn, "utf8"); $attendanceDate = date("Y-m-d", strtotime("-2 day")); $records = getallRecords($conn,$attendanceDate); $ttrecords = getallTotalRecords($conn,$attendanceDate); //echo count($records).'-'.count($ttrecords).'-'.$attendanceDate; // Send Confirmation Email sendAlertEmail(count($records), count($ttrecords), $attendanceDate); $currentAttendance = date('d-M-y',strtotime($attendanceDate)); echo 'Total Records =>' . count($records) . '<br/>'; echo '<br>'; exit(); /* * Function : getallTotalRecords * Description : * Date: * Created By: */ function getallTotalRecords($conn,$days_ago) { //$days_ago = date("Y-m-d", strtotime("-2 day")); $sql = "select * from doctors_attendance_staging_tbl where date_in like'".$days_ago."%'"; $result = mysqli_query($conn, $sql); $results = array(); while($row = mysqli_fetch_array($result)) { $results[$row['das_id']] = $row; } return $results; } /* * Function : getallRecords * Description : * Date: * Created By: */ function getallRecords($conn,$days_ago) { //$days_ago = date("Y-m-d", strtotime("-2 day")); $sql = "select * from doctors_attendance_staging_tbl where ppsoft_status ='P' and date_in like'".$days_ago."%'"; $result = mysqli_query($conn, $sql); $results = array(); while($row = mysqli_fetch_array($result)) { $results[$row['das_id']] = $row; } return $results; } /* * Function : sendAlertEmail */ function sendAlertEmail($totalrecords, $ttrecords, $attendanceDate) { $to_emails = 'puneet.gujarati@sharda.ac.in, amit.verma@sharda.ac.in, ajay.sharma1@sharda.ac.in, brijesh.chaturvedi@sharda.ac.in'; //$to_emails = 'amit.verma@sharda.ac.in'; $subject = 'Successful Execution: Doctor Attendance Cronjob - '.date('Y-m-d H:i:s'); $message = emailTemplate($totalrecords, $ttrecords, $attendanceDate); $resp = send_email_pepipost($to_emails, $subject, $message); return $resp; } function getAPIEmailResponse( $data='') { $url = 'https://shardahospital.org/search/sendEmailtoAll'; $data = json_encode($data); //print_r($data); $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array( "Content-Type: application/json", ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); //for debug only! curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($curl); return $response; } /* * Function : send_email_pepipost * Description : Send Email */ function send_email_pepipost($to_emails, $subject, $message, $fromname='', $fromemail='', $replyto=''){ $fromname=$fromname?$fromname:'Ezone Cronjob Alert'; $fromemail=$fromemail?$fromemail:'alerts@shardauniversity.com'; //Change This Email ID; $replyto=$replyto?$replyto:'noreply@sharda.ac.in'; //Change the Email ID; //$to_emails = 'amit.verma@shardatech.org'; if(!$to_emails){ return; } if(is_string($to_emails)){ $to_emails=explode(",", $to_emails); } foreach($to_emails as $to){ $d=array ( 'personalizations' => array (0 => array ('recipient' => $to)), 'from' => array ('fromEmail' => $fromemail, 'fromName' => $fromname), 'replyToId'=>$replyto, 'subject' => $subject, 'content' => $message, ); $email_jason_data=json_encode($d); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.pepipost.com/v2/sendEmail", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $email_jason_data, CURLOPT_HTTPHEADER => array( "api_key: c77184012dcf9bd5cd1886b4e0a2bb89", // "api_key: aab3f77715e90569034f0c6e5d912714", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } // else { // echo $response; // } // die; } //EOF //EOF } /* * Function : emailTemplate * */ function emailTemplate($totalrecords=0, $ttrecords=0, $attendanceDate='') { $template=''; $template.='<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>Sharda E-Zone</title> <style type="text/css"> #outlook a {padding:0;} body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} .ExternalClass {width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;} img {outline:none; text-decoration:none;border:none; -ms-interpolation-mode: bicubic;} a img {border:none;} .image_fix {display:block;} p {margin: 0px 0px !important;} table td {border-collapse: collapse;} table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; } a {color: #1d83aa;text-decoration: none;text-decoration:none!important;} /*STYLES*/ table[class=full] { width: 100%; clear: both; } /*IPAD STYLES*/ @media only screen and (max-width: 640px) { a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #33b9ff; pointer-events: none; cursor: default; } .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] { text-decoration: default; color: #33b9ff !important; pointer-events: auto; cursor: default; } table[class=devicewidth] {width: 440px!important;text-align:center!important;} table[class=devicewidth] td{text-align:center!important;} table[class=devicewidth] td.left{text-align:left!important;} table[class=devicewidthinner] {width: 420px!important;text-align:center!important;} img[class=banner] {width: 440px!important;height:177px!important;} img[class=colimg2] {width: 440px!important;height:177px!important;} } /*IPHONE STYLES*/ @media only screen and (max-width: 480px) { a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #ffffff; /* or whatever your want */ pointer-events: none; cursor: default; } .mobile_link a[href^="tel"], .mobile_link a[href^="sms"] { text-decoration: default; color: #ffffff !important; pointer-events: auto; cursor: default; } table[class=devicewidth] {width: 350px!important;text-align:center!important;} table[class=devicewidthinner] {width: 350px!important;text-align:center!important;} img[class=banner] {width: 350px!important;height:140px!important;} img[class=colimg2] {width: 350px!important;height:140px!important;} td[class="padding-top15"]{padding-top:15px!important;} .full-width{ width:100% !important; text-align:center !important; } .full-width img{ margin:0 auto !important; } } @media only screen and (min-width:481px) and (max-width:599px) { table[class=wrapper] { width: 100% !important; } table[class=main_table] { width: 100% !important; } td[class=pad_side] { padding-left: 14px !important; padding-right: 14px !important; } td[class=hide], br[class=hide] { display: none !important; } img[class=full_img] { width: 100% !important; height: auto !important; } td[class=text], td[class=black], td[class=black2], td[class=red], td[class=white], td[class=white1], td[class=white2], td[class=grey] { text-align: center !important; } td[class=pad_bottom] { padding-bottom: 20px !important; } td[class=pad_top] { padding-top: 20px !important; } td[class=fix_height] { height: 20px !important; } td[class=video] img { width: 100% !important; height: auto !important; } } @media only screen and (max-width:480px) { table[class=wrapper] { width: 100% !important; } table[class=main_table] { width: 100% !important; } td[class=pad_side] { padding-left: 14px !important; padding-right: 14px !important; } td[class=hide], br[class=hide] { display: none !important; } img[class=full_img] { width: 100% !important; height: auto !important; } td[class=text], td[class=black], td[class=black2], td[class=red], td[class=white], td[class=white1], td[class=white2], td[class=grey] { text-align: center !important; } td[class=pad_bottom] { padding-bottom: 20px !important; } td[class=pad_top] { padding-top: 20px !important; } td[class=fix_height] { height: 20px !important; } td[class=video] img { width: 100% !important; height: auto !important; } } </style> </head> <body> <!-- Start of header --> <table width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="header"> <tbody> <tr> <td align="center"> <table width="650" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth"> <tbody> <tr> <td width="100%" align="center"> <table bgcolor="#fff" width="650" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth" style="border-left: 1px solid #e1e1e1; border-right: 1px solid #e1e1e1"> <tbody> <!-- Spacing --> <tr> <td height="5" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> <tr> <td> <!-- logo --> <table width="100" align="left" border="0" cellpadding="0" cellspacing="0" class="devicewidth"> <tbody> <tr> <td width="160" height="60" align="center"> <div class="imgpop" align="center"><a target="_blank" href="http://ezone.sharda.ac.in/" title="Sharda E-Zone"><img src="https://www.sharda.ac.in/attachments/site_logo/logo22.png" alt="Sharda E-Zone" border="0" height="50" style="display:block; border:none; outline:none; text-decoration:none;" /></a></div> </td> </tr> </tbody> </table> <!-- end of logo --> </td> </tr> <!-- Spacing --> <tr> <td height="5" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td> </tr> <!-- Spacing --> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <!-- End of Header --> <table width="650" bgcolor="#fff" border="0" cellspacing="0" cellpadding="0" class="wrapper" align="center" mc:repeatable mc:variant="Right IMAGE + Left(TITLE + DESC + READ MORE)" style="table-layout:fixed;font-family:Arial, sans-serif; border-left: 1px solid #e1e1e1; border-right: 1px solid #e1e1e1; border-bottom: 1px solid #e1e1e1"> <tr> <td height="15" style="line-height:1px;font-size:1px;"> </td> </tr> <tr> <td class="pad_side"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="left" class="wrapper"> <tr> <td align="center" valign="top"> <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td height="1" style="line-height:1px;font-size:1px;" class="fix_height"> </td> </tr> <tr> <td valign="top"> <div class="padding" style="padding: 0 0;font-size:14px;color:#414141;text-align:left;line-height:22px;"> <p style="text-transform:uppercase;font-size:18px;padding:5px 0 15px 0;font-weight:bold;">Dear All,</p> <p>We are pleased to inform you that the cronjob, <b>Doctor Attendance Cronjob</b>, executed successfully as scheduled. This email serves as confirmation that the task was completed without any issues.</p> </div> <div class="padding" style="font-size:14px;color:#000000;text-align:left;line-height:22px;"> <p style="padding: 10px 0;"> Here are the details of the successful execution:<br/><br/> Cronjob Name: Doctor Attendance Cronjob<br/> Execution Date/Time: '.date("Y-m-d H:i:s").'<br/> Attendance Date/Time: <b style="font-size:18px;color:#FF0000;">'.$attendanceDate.'</b><br/> Task Description: Total Ezone Records <b style="font-size:18px;color:#FF0000;">'.$ttrecords.'</b> in the Ezone<br/> Task Description: Total <b style="font-size:18px;color:#0000FF;">'.$totalrecords.'</b> records push to peoplesoft<br/> Server/Environment: Ezone </p> </div> <div class="padding" style="font-size:14px;color:#414141;text-align:left;line-height:22px;"><p style="padding: 10px 0">The successful completion of this cronjob signifies that the desired operations have been carried out as intended, ensuring the smooth functioning of our systems and processes.</p> <p style="padding: 10px 0">If you have any questions or concerns regarding this cronjob or its execution, please feel free to reach out to us. We are here to assist you and provide any necessary information.</p> <p style="padding: 10px 0">Thank you for your attention, and please don\'t hesitate to contact us if you require further assistance.</p> </div> <div class="padding" style="font-size:14px;color:#414141;text-align:left;line-height:22px;padding-top:20px;"> <p>Best regards,<br/> Team Ezone </p> </div> </td> </tr> <tr> <td height="30"></td> </tr> <tr> <td align="center" style="font-weight: bold; border: 1px solid #ebebeb; padding: 4px 10px;font-size: 16px;">Visit Website to Explore <a href="https://ezone.sharda.ac.in/ezone-2022/"><span style="color: #00a3e4">https://ezone.sharda.ac.in</span></a></td> </tr> <tr> <td height="15" style="line-height:1px;font-size:1px;" class="fix_height"> </td> </tr> </table> </td> <td width="0" class="hide"> </td> </tr> </table> </td> </tr> </table> <!-- end of footer --> </body> </html>'; return $template; }