function parseFolder($location, $folder) { global $client; $paren_pos = strpos($folder, "("); if ($paren_pos || $folder[0] == '(') { $kv = substr($folder, $paren_pos); $res = array(); $keys = $client->parsekv($kv); $keytypes = explode(' ', $keys['list_type']); $types = array(); foreach ($keytypes as $keytype) { $type = array('name' => $keys["type_name.{$keytype}"], 'id' => $keytype, 'min_precision' => blankToZero($keys["type_min_precision.{$keytype}"]), 'scale' => blankToZero($keys["type_scale.{$keytype}"])); //$types[$keytype] = $type; $types[$type['name']] = $type; } ksort($types); $res['types'] = $types; $keylocs = explode(' ', $keys['list_loc']); $locs = array(); foreach ($keylocs as $keyloc) { $name = $keys["loc_name.{$keyloc}"]; if ($name != '') { if ($keyloc == $location) { $folder_name = $name; } $locs[$name] = $keyloc; //$locs[$keyloc] = $name; } } ksort($locs); $res['locs'] = $locs; $res['name'] = $folder_name; $res['loc'] = $location; return $res; } return FALSE; }
$querySLWTD = "\tSELECT \t\tcount(*) \n\t\t\t\t\t\tFROM \t\ttbl_cdr AS TC \n\t\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\t\tON\t\t\tTCR.ext = TC.userNumber \n\t\t\t\t\t\tWHERE \t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ) \n\t\t\t\t\t\tBETWEEN \t'" . $WTD . "'\tAND '" . $curDay . "'\n\t\t\t\t\t\tAND\t\t\tTC.answerIndicator = 'YES'\n\t\t\t\t\t\tAND\t\t\tTC.direction = 'Terminating'\n\t\t\t\t\t\tAND\t\t\tTIME_TO_SEC(TIMEDIFF(\tCONVERT_TZ( CONCAT( SUBSTR( TC.answerTime, 1, 4 ) , '-', SUBSTR( TC.answerTime, 5, 2 ) , '-', SUBSTR( TC.answerTime, 7, 2 ) , ' ', SUBSTR( TC.answerTime, 9, 2 ) , ':', SUBSTR( TC.answerTime, 11, 2 ) , ':', SUBSTR( TC.answerTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') )\n\t\t\t\t\t\t\t\t\t\t\t\t)) < " . $serviceLevel; $result = mysql_query($querySLWTD, $conn) or die('Query failed: ' . $querySLWTD . mysql_error()); while ($rows = mysql_fetch_array($result, MYSQL_NUM)) { $SLArr['WTD'] = blankToZero($rows[0] / $IBArr['WTD']) * 100; } /************** MTD *****************/ $querySLMTD = "\tSELECT \t\tcount(*) \n\t\t\t\t\t\tFROM \t\ttbl_cdr AS TC \n\t\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\t\tON\t\t\tTCR.ext = TC.userNumber \n\t\t\t\t\t\tWHERE \t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ) \n\t\t\t\t\t\tBETWEEN \t'" . $MTD . "'\tAND '" . $curDay . "'\n\t\t\t\t\t\tAND\t\t\tTC.answerIndicator = 'YES'\n\t\t\t\t\t\tAND\t\t\tTC.direction = 'Terminating'\n\t\t\t\t\t\tAND\t\t\tTIME_TO_SEC(TIMEDIFF(\tCONVERT_TZ( CONCAT( SUBSTR( TC.answerTime, 1, 4 ) , '-', SUBSTR( TC.answerTime, 5, 2 ) , '-', SUBSTR( TC.answerTime, 7, 2 ) , ' ', SUBSTR( TC.answerTime, 9, 2 ) , ':', SUBSTR( TC.answerTime, 11, 2 ) , ':', SUBSTR( TC.answerTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') )\n\t\t\t\t\t\t\t\t\t\t\t\t)) < " . $serviceLevel; $result = mysql_query($querySLMTD, $conn) or die('Query failed: ' . $querySLMTD . mysql_error()); while ($rows = mysql_fetch_array($result, MYSQL_NUM)) { $SLArr['MTD'] = blankToZero($rows[0] / $IBArr['MTD']) * 100; } /************** YTD *****************/ $querySLYTD = "\tSELECT \t\tcount(*) \n\t\t\t\t\t\tFROM \t\ttbl_cdr AS TC \n\t\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\t\tON\t\t\tTCR.ext = TC.userNumber \n\t\t\t\t\t\tWHERE \t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ) \n\t\t\t\t\t\tBETWEEN \t'" . $YTD . "'\tAND '" . $curDay . "'\n\t\t\t\t\t\tAND\t\t\tTC.answerIndicator = 'YES'\n\t\t\t\t\t\tAND\t\t\tTC.direction = 'Terminating'\n\t\t\t\t\t\tAND\t\t\tTIME_TO_SEC(TIMEDIFF(\tCONVERT_TZ( CONCAT( SUBSTR( TC.answerTime, 1, 4 ) , '-', SUBSTR( TC.answerTime, 5, 2 ) , '-', SUBSTR( TC.answerTime, 7, 2 ) , ' ', SUBSTR( TC.answerTime, 9, 2 ) , ':', SUBSTR( TC.answerTime, 11, 2 ) , ':', SUBSTR( TC.answerTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') )\n\t\t\t\t\t\t\t\t\t\t\t\t)) < " . $serviceLevel; $result = mysql_query($querySLYTD, $conn) or die('Query failed: ' . $querySLYTD . mysql_error()); while ($rows = mysql_fetch_array($result, MYSQL_NUM)) { $SLArr['YTD'] = blankToZero($rows[0] / $IBArr['YTD']) * 100; } print_r($IBArr); print_r($OBArr); print_r($AbndArr); print_r($spdToAnsrArr); print_r($inbndAHT); print_r($outboundAHT); print_r($SLArr); /************** Daily *****************/ $insertQuery = "INSERT \n\t\t\t\t\tINTO \ttbl_sqi_queue (`runDate` , `timePeriod` , `inbound` , `outbound` , `callsAbandoned` , `prcntAbandoned` , `speedToAnswer` , `inboundAHT` , `outboundAHT` , `serviceLevel`, tbl_queue_id )\n\t\t\t\t\tVALUES ('" . date('Y-m-d') . "','" . "Daily" . "','" . $IBArr['Daily'] . "','" . $OBArr['Daily'] . "','" . $AbndArr['Daily'] . "','" . $PrcntAbndArr['Daily'] . "', '" . $spdToAnsrArr['Daily'] . "', '" . $inbndAHT['Daily'] . "', '" . $outboundAHT['Daily'] . "', '" . $SLArr['Daily'] . "', '0');"; $result = mysql_query($insertQuery, $conn) or die('Query failed: ' . $insertQuery . mysql_error()); /************** WTD *****************/ $insertQuery = "INSERT \n\t\t\t\t\tINTO \ttbl_sqi_queue (`runDate` , `timePeriod` , `inbound` , `outbound` , `callsAbandoned` , `prcntAbandoned` , `speedToAnswer` , `inboundAHT` , `outboundAHT` , `serviceLevel`, tbl_queue_id )\n\t\t\t\t\tVALUES ('" . date('Y-m-d') . "','" . "WTD" . "','" . $IBArr['WTD'] . "','" . $OBArr['WTD'] . "','" . $AbndArr['WTD'] . "','" . $PrcntAbndArr['WTD'] . "', '" . $spdToAnsrArr['WTD'] . "', '" . $inbndAHT['WTD'] . "', '" . $outboundAHT['WTD'] . "', '" . $SLArr['WTD'] . "', '0');"; $result = mysql_query($insertQuery, $conn) or die('Query failed: ' . $insertQuery . mysql_error()); /************** MTD *****************/
function bagCheckUpdateHuntInformation($bagCheckInfo) { $blindList = $bagCheckInfo->getBlindList(); $blindIndex = 0; foreach ($blindList as $oneBlind) { // Blind Number $oldBlindNumLabel = generateOldIdAtBlind("BLIND_NUMBER", $blindIndex); $oldBlindNum = $_POST[$oldBlindNumLabel]; $newBlindNumLabel = generateNewIdAtBlind("BLIND_NUMBER", $blindIndex); $newBlindNum = $_POST[$newBlindNumLabel]; $oldBlindNum = blankToZero($oldBlindNum); $newBlindNum = blankToZero($newBlindNum); if ($oldBlindNum != $newBlindNum) { $oneBlind->setBlindNumber($newBlindNum); } // Number of Hunters $oldNumHuntersLabel = generateOldIdAtBlind("HUNTER_COUNT", $blindIndex); $oldNumHunters = $_POST[$oldNumHuntersLabel]; $newNumHuntersLabel = generateNewIdAtBlind("HUNTER_COUNT", $blindIndex); $newNumHunters = $_POST[$newNumHuntersLabel]; $oldNumHunters = blankToZero($oldNumHunters); $newNumHunters = blankToZero($newNumHunters); if ($oldNumHunters != $newNumHunters) { $oneBlind->setNumHunters($newNumHunters); } // Number of Cars $oldNumCarsLabel = generateOldIdAtBlind("CAR_COUNT", $blindIndex); $oldNumCars = $_POST[$oldNumCarsLabel]; $newNumCarsLabel = generateNewIdAtBlind("CAR_COUNT", $blindIndex); $newNumCars = $_POST[$newNumCarsLabel]; $oldNumCars = blankToZero($oldNumCars); $newNumCars = blankToZero($newNumCars); if ($oldNumCars != $newNumCars) { $oneBlind->setNumCars($newNumCars); } // Number of Hours $oldNumHoursLabel = generateOldIdAtBlind("NUM_HOURS", $blindIndex); $oldNumHours = $_POST[$oldNumHoursLabel]; $newNumHoursLabel = generateNewIdAtBlind("NUM_HOURS", $blindIndex); $newNumHours = $_POST[$newNumHoursLabel]; $oldNumHours = blankToZero($oldNumHours); $newNumHours = blankToZero($newNumHours); if ($oldNumHours != $newNumHours) { $oneBlind->setNumHours($newNumHours); } $blindIndex++; } }