$oStatus to SCHED$extra2', wDate='".date("Ymd")."', tStart='', tEnd='', wStart='', wEnd='', tagLine='', locked='1'", "wDate=''");//, "linkRef='' by ".getEmployeeName($_SESSION['user']['empNo'])." } else if ($oStatus['status'] == "SCHED" and $oStatus['assignto'] != $_REQUEST['empNo'] and $_REQUEST['role'] == "LEAD") { sqlUpdate("headers", "assignto = '".$_REQUEST['empNo']."'", "tid = '".$_SESSION['jobRef']."'"); sqlRecycle("logents", "eType='s', linkRef='".$_SESSION['jobRef']."', empNo='".$_SESSION['user']['empNo']."', note='JOB REASSIGNED TO ".getEmployeeName($_REQUEST['empNo'])." BY SCHEDULE', wDate='".date("Ymd")."', tStart='', tEnd='', wStart='', wEnd='', tagLine='', locked='1'", "wDate=''"); } sqlRecycle("logents", "eType='s', linkRef='".$_SESSION['jobRef']."', empNo='".$_SESSION['user']['empNo']."', note='CALL [".getEmployeeName($_REQUEST['empNo']).": ".$_REQUEST['schDate'].": ".$_REQUEST['schwStart']."-".$_REQUEST['schwEnd']."] SCHEDULED', wDate='".date("Ymd")."', tStart='', tEnd='', wStart='', wEnd='', tagLine='', locked='1'", "wDate=''");//, "linkRef='' by ".getEmployeeName($_SESSION['user']['empNo'])." } // re-get a list of all work scheduled for BEFORE today $q = "wDate < '".date("Ymd")."' and wDate != ''"; $sList = sqlSelect("schedule", $q); if ($sList['n']) { // we have calls to cancel; while ($s = mysql_fetch_assoc($sList['r'])) { // for each call, make a system comment about the cancelation $q = "eType='s', "; $q .= "linkRef='".$s['linkRef']."', "; $q .= "pl_lName='', "; $q .= "pl_fName='', "; $q .= "pl_address='', "; $q .= "pl_city='', "; $q .= "pl_pc='', "; $q .= "empNo='1', "; $q .= "wDate='".date("Ymd")."', "; $q .= "tStart='".date("Hi")."', "; $q .= "wStart='', "; $q .= "kmStart='0.0', "; $q .= "wEnd='', "; $q .= "tEnd='', "; $q .= "kmEnd='0.0', "; $q .= "tagLine='', "; $q .= "note='SCHEDULED CALL [".getEmployeeName($s['empNo']).": ".$s['wDate'].": ".$s['wStart']."-".$s['wEnd']."] DELETED [STALE]', "; $q .= "locked='1'"; $r = sqlInsert("logents", $q); // delete the scheduled call $r = sqlUpdate("schedule", "linkRef='', wDate='', tStart='', wStart='', wEnd='', tEnd='', empNo=0, role='', task='', lName='', fName='', city='', oType=''", "tid='".$s['tid']."'"); } } // look for orders with a status of "SCHED" that don't actually HAVE a schedule $swo = sqlSelect("headers", "status='SCHED'", "", "", "tid"); if (false and $swo['n']) { while ($wo = mysql_fetch_assoc($swo['r'])) { $sch = sqlSelect("schedule", "linkRef='".$wo['tid']."' and wDate != ''"); // are there any dates scheduled? if ($sch['n'] == 0) // nope! { // there are no scheduled days left; if status is "SCHED", change it to "READY" sqlUpdate("headers", "status='READY'", "tid='".$wo['tid']."'"); // make a system comment about the change $q = "eType='s', "; $q .= "linkRef='".$wo['tid']."', "; $q .= "pl_lName='', "; $q .= "pl_fName='', "; $q .= "pl_address='', "; $q .= "pl_city='', "; $q .= "pl_pc='', "; $q .= "empNo='1', "; $q .= "wDate='".date("Ymd")."', "; $q .= "tStart='".date("Hi")."', "; $q .= "wStart='', "; $q .= "kmStart='0.00', "; $q .= "wEnd='', "; $q .= "tEnd='', "; $q .= "kmEnd='0.00', "; $q .= "tagLine='', "; $q .= "note='STATUS changed from SCHED to READY; no work scheduled', "; $q .= "locked='1'"; $r = sqlInsert("logents", $q); } } } if ($_REQUEST['sp'] == "options") $_SESSION['instance']['enableNav'] = false; // reset password if (!empty($_REQUEST['passwrd1'])) { if ($_REQUEST['passwrd1'] == $_REQUEST['passwrd2']) { sqlUpdate("employees", "password = '".md5(strtolower($_REQUEST['passwrd1']))."'", "empNo='".$_REQUEST['empNo']."'"); unset($_REQUEST['passwrd1']); unset($_REQUEST['passwrd2']); } else $msgs[] = "Passwords do not match Please try again"; } if (array_key_exists("sync", $_REQUEST)) { foreach ($_REQUEST['sync'] as $v) $sync += $v; $_SESSION['user']['sync'] = $sync; // update "employees" sqlUpdate("employees", "sync='".$_SESSION['user']['sync']."'", "empNo='".$_REQUEST['empNo']."'"); } // process login if (!empty($_REQUEST['loginName'])) include 'modules/login.php'; // fix paging if (!empty($_REQUEST['p'])) { $_SESSION['current']['lastpage'] = $_SESSION['current']['p']; $_SESSION['current']['p'] = $_REQUEST['p']; } if (empty($_SESSION['current']['p'])) $_SESSION['current']['p'] = "signin"; if (!empty($_REQUEST['sp'])) { $_SESSION['current']['lastsubpage'] = $_SESSION['history'][$_SESSION['current']['p']]['sp']; $_SESSION['history'][$_SESSION['current']['p']]['sp'] = $_REQUEST['sp']; } else if (empty($_SESSION['history'][$_SESSION['current']['p']]['sp'])) { $_SESSION['history'][$_SESSION['current']['p']]['sp'] = $defaults[$_SESSION['current']['p']]; } if (!$_SESSION['user']['isFake'] and !empty($_SESSION['user']['empNo'])) // a user is logged in - touch their login data { $r = sqlUpdate("logins", "touch='".date("YmdHis")."',activity='".$_SESSION['current']['p']."->".$_SESSION['history'][$_SESSION['current']['p']]['sp']."'", "tid = '".$_SESSION['user']['sessionTid']."'", false); } ?>