Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#applyCalls").click(function(){
- $.get("admin/processCalls.php");
- });
- include '../phpexcel2/Classes/PHPExcel.php';
- include '../phpexcel2/Classes/PHPExcel/IOFactory.php';
- date_default_timezone_set('Europe/Bucharest');
- $fisierInbound = "inbound.xls";
- $fisierOutbound = "outbound.xls";
- callsInbound();
- function callsInbound() {
- global $fisierInbound;
- global $current;
- global $con;
- $identify = PHPExcel_IOFactory::identify('daily/' . $fisierInbound);
- $objReader = PHPExcel_IOFactory::createReader($identify);
- $objReader->setReadDataOnly(true);
- $objPHPExcel = $objReader->load('daily/' . $fisierInbound);
- $worksheet = $objPHPExcel->setActiveSheetIndex(0);
- $query = mysqli_query($con, "SELECT * FROM users WHERE tip_user='agent' AND NOT (departament='online')");
- while($usr = mysqli_fetch_array($query)) {
- $data[] = $usr;
- }
- $worksheetTitle = $worksheet->getTitle();
- $highestRow = $worksheet->getHighestRow(); // e.g. 10
- $highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
- $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
- $dataCalls = $worksheet->getCellByColumnAndRow(2, 2)->getValue();
- $dataSubstr = substr($dataCalls, 53);
- echo $dataSubstr;
- foreach ($data as $db) {
- for ($row = 6; $row <= $highestRow; ++ $row) {
- $marca = $worksheet->getCellByColumnAndRow(3, $row)->getValue();
- $nr = $worksheet->getCellByColumnAndRow(4, $row)->getValue();
- if($db['marca'] == $marca) {
- mysqli_query($con, "INSERT INTO dailycalls(data, nr, departament, oras, tip, id_user)
- VALUES('$dataSubstr', '$nr', '" . $db['departament'] . "', '" . $db['oras'] . "', 'inbound', '" . $db['id'] . "')");
- }
- }
- }
- }
- $("#applyCalls").off('click', callServer).on('click', callServer);
- var callServer = function(){
- $.get("admin/processCalls.php");
- };
- $("#applyCalls").unbind("click").click(function(){$.get("admin/processCalls.php");});
- $("#applyCalls").click(function(event){
- event.stopPropagation()
- $.post("admin/processCalls.php");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement