(activity.date_start+1)",$db); while ($myrow = mysql_fetch_row($result)) { $status=$myrow[0]; if($status != 'Completed') { sendmail($emailaddress,$emailaddress,"test mail","Not completed task",$mailserver,$mailuname,$mailpwd,""); } } } //Big Deal Alert $sql = "select active from notificationscheduler where schedulednotificationid=2"; $result = mysql_query($sql); $activevalue = mysql_fetch_row($result); if($activevalue[0] == 1) { $result = mysql_query("SELECT sales_stage,amount FROM potential",$db); while ($myrow = mysql_fetch_row($result)) { $amount=$myrow[1]; $stage = $myrow[0]; if($stage == 'Closed Won' && $amount > 10000) { sendmail($emailaddress,$emailaddress,"Big Deal Closed Successfully!","Time to Party! Big Deal Closed!!!!",$mailserver,$mailuname,$mailpwd,""); } } } //Pending tickets $sql = "select active from notificationscheduler where schedulednotificationid=3"; $result = mysql_query($sql); $activevalue = mysql_fetch_row($result); if($activevalue[0] == 1) { $result = mysql_query("SELECT status,ticketid FROM troubletickets",$db); while ($myrow = mysql_fetch_row($result)) { $status=$myrow[0]; $ticketid = $myrow[1]; if($status != 'Completed') { echo 'mail sent'; sendmail($emailaddress,$emailaddress,"test mail","Ticket number ".$ticketid ." yet to be closed",$mailserver,$mailuname,$mailpwd,""); } } } //Too many tickets related to a particular account/company causing concern $sql = "select active from notificationscheduler where schedulednotificationid=4"; $result = mysql_query($sql); $activevalue = mysql_fetch_row($result); if($activevalue[0] == 1) { $result = mysql_query("SELECT status,troubletickets.ticketid FROM troubletickets where status!='Completed'",$db); while ($myrow = mysql_fetch_row($result)) { $status=$myrow[0]; $ticketid = $myrow[1]; echo 'mail sent'; sendmail($emailaddress,$emailaddress,"Too many pending tickets","Too many pending tickets ".$ticketid ." too many pending tickets",$mailserver,$mailuname,$mailpwd,""); } } //Support Starting $sql = "select active from notificationscheduler where schedulednotificationid=5"; $result = mysql_query($sql); $activevalue = mysql_fetch_row($result); if($activevalue[0] == 1) { $result = mysql_query("SELECT start_date FROM products",$db); while ($myrow = mysql_fetch_row($result)) { $status=$myrow[0]; sendmail($emailaddress,$emailaddress,"Support starting","Support Starting ".$ticketid ."Congratulations! Your support starts from today",$mailserver,$mailuname,$mailpwd,""); } } //Support ending $sql = "select active from notificationscheduler where schedulednotificationid=6"; $result = mysql_query($sql); $activevalue = mysql_fetch_row($result); if($activevalue[0] == 1) { $result = mysql_query("SELECT expiry_date from products",$db); while ($myrow = mysql_fetch_row($result)) { $status=$myrow[0]; sendmail($emailaddress,$emailaddress,"Support Ending","Support Ending ".$ticketid ." Renew support please",$mailserver,$mailuname,$mailpwd,""); } } ?>