예제 #1
0
 /**
  * reenviar tarea de officetrack
  * POST /api/reenviarot
  * @param  int  gestion_id
  * @return Response
  */
 public function postReenviarot()
 {
     if (Input::has('gestion_id')) {
         Input::replace(array('buscar' => Input::get('gestion_id'), 'tipo' => 'g.id'));
         $result = Gestion::getCargar();
         $resultDos = array();
         if ($result['rst'] == '1') {
             $datos = $result['datos'][0];
             $resultDos['fh_agenda'] = $datos->fh_agenda;
             $resultDos['codactu'] = trim($datos->codactu . ' ');
             $resultDos['fecha_registro'] = trim($datos->fecha_registro . ' ');
             $resultDos['nombre_cliente'] = trim($datos->nombre_cliente . ' ');
             $resultDos['act_codmotivo_req_catv'] = trim($datos->codmotivo_req_catv . ' ');
             $resultDos['orden_trabajo'] = trim($datos->orden_trabajo . ' ');
             $resultDos['fftt'] = trim($datos->fftt . ' ');
             $resultDos['dir_terminal'] = trim($datos->dir_terminal . ' ');
             $resultDos['inscripcion'] = trim($datos->inscripcion . ' ');
             $resultDos['mdf'] = trim($datos->mdf . ' ');
             $resultDos['segmento'] = trim($datos->segmento . ' ');
             $resultDos['clase_servicio_catv'] = trim($datos->clase_servicio_catv . ' ');
             $resultDos['total_averias'] = trim($datos->total_averias . ' ');
             $resultDos['zonal'] = trim($datos->zonal . ' ');
             $resultDos['llamadastec15dias'] = trim($datos->llamadastec15dias . ' ');
             $resultDos['quiebre'] = trim($datos->quiebre . ' ');
             $resultDos['lejano'] = trim($datos->lejano . ' ');
             $resultDos['distrito'] = trim($datos->distrito . ' ');
             $resultDos['averia_m1'] = trim($datos->averia_m1 . ' ');
             $resultDos['telefono_codclientecms'] = trim($datos->telefono_codclientecms . ' ');
             $resultDos['area2'] = trim($datos->area2 . ' ');
             $resultDos['eecc_final'] = trim($datos->eecc_zona . ' ');
             $resultDos['gestion_id'] = trim($datos->id . ' ');
             $resultDos['estado'] = trim($datos->estado . ' ');
             $resultDos['velocidad'] = trim($datos->veloc_adsl . ' ');
             $resultDos['cr_observacion'] = trim($datos->observacion . ' ');
             //$resultDos['reenviar'] =trim( $datos->reenviar.' ');
             $resultDos['actividad'] = trim($datos->actividad . ' ');
             $resultDos['tecnico_id'] = trim($datos->tecnico_id . ' ');
             $resultDos['coordinado2'] = trim($datos->coordinado . ' ');
             $resultDos['direccion_instalacion'] = trim($datos->direccion_instalacion . ' ');
             $resultTres = Helpers::ruta('officetrack/procesarot', 'POST', $resultDos, false);
             return Response::json($resultTres);
         } else {
             return Response::json($result);
         }
     }
 }
예제 #2
0
 public function postBandejaexcel()
 {
     $gestion = Gestion::getCargar();
     if (Input::has('imagen')) {
         $objPHPExcel = new PHPExcel();
         $objPHPExcel->getProperties()->setCreator("Jorge Salcedo")->setLastModifiedBy("Jorge Salcedo")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Reporte de Problemas")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
         $az = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ', 'CA', 'CB', 'CC', 'CD', 'CE', 'CF', 'CG', 'CH', 'CI', 'CJ', 'CK', 'CL', 'CM', 'CN', 'CO', 'CP', 'CQ', 'CR', 'CS', 'CT', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DA', 'DB', 'DC', 'DD', 'DE', 'DF', 'DG', 'DH', 'DI', 'DJ', 'DK', 'DL', 'DM', 'DN', 'DO', 'DP', 'DQ', 'DR', 'DS', 'DT', 'DU', 'DV', 'DW', 'DX', 'DY', 'DZ');
         $objPHPExcel->getDefaultStyle()->getFont()->setName('Bookman Old Style');
         $objPHPExcel->getDefaultStyle()->getFont()->setSize(8);
         $valorinicial = 1;
         $azpos = 0;
         foreach ($gestion['datos'] as $data) {
             //Encabezado
             if ($valorinicial == 1) {
                 foreach ($data as $key => $val) {
                     $objPHPExcel->getActiveSheet()->setCellValue($az[$azpos] . $valorinicial, $key);
                     $azpos++;
                 }
             }
             $valorinicial++;
             $azpos = 0;
             //Datos
             foreach ($data as $val) {
                 $val = str_replace(array("\r\n", "\n", "\n\n", "\t", "\r"), array("", "", "", "", ""), $val);
                 $objPHPExcel->getActiveSheet()->setCellValue($az[$azpos] . $valorinicial, $val);
                 $azpos++;
             }
         }
         $objPHPExcel->getActiveSheet()->setTitle('PSI');
         $objPHPExcel->setActiveSheetIndex(0);
         $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
         $objWriter->save('reporte/u743/PSI_' . date("Y-m-d_H-i-s") . '.xlsx');
         $zipfile = new Zipfile();
         $zipfile->add_dir("reporte/");
         $ruta = "reporte/u743/";
         $zipfile->carpeta = array();
         $zipfile->archivo = array();
         $zipfile->listar_directorios_ruta($ruta);
         $carpeta = $zipfile->carpeta;
         $archivo = $zipfile->archivo;
         for ($i = 0; $i < count($carpeta); $i++) {
             $zipfile->add_dir(str_replace("reporte/u743/", "reporte/", $carpeta[$i]));
             //$zipfile->add_dir( $carpeta[$i] );
         }
         for ($i = 0; $i < count($archivo); $i++) {
             $zipfile->add_file($archivo[$i], str_replace("reporte/u743/", "reporte/", $archivo[$i]));
             //$zipfile->add_file($archivo[$i],$archivo[$i] );
         }
         header("Content-type: application/octet-stream");
         header("Content-disposition: attachment; filename=bandeja.zip");
         echo $zipfile->file();
         exit;
     } else {
         $filename = Helpers::convert_to_file_excel('Bandeja_' . date("Ymd_His"));
         header('Content-Type: application/octet-stream; charset=utf-8;');
         header('Content-Disposition: attachment; filename=' . $filename);
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header("Content-Transfer-Encoding: binary");
         header('Pragma: public');
         $n = 1;
         foreach ($gestion['datos'] as $data) {
             //Encabezado
             if ($n == 1) {
                 foreach ($data as $key => $val) {
                     echo $key . "\t";
                 }
                 echo "\r\n";
             }
             //Datos
             foreach ($data as $val) {
                 $val = str_replace(array("\r\n", "\n", "\n\n", "\t", "\r"), array("", "", "", "", ""), $val);
                 echo $val . "\t";
             }
             echo "\r\n";
             $n++;
         }
     }
     //
 }
예제 #3
0
 public function norealizadoOfsc()
 {
     $save["aid"] = $activityId;
     $actu = \Gestion::getCargar($codactu);
     $actuObj = $actu["datos"][0];
     $actuArray = (array) $actuObj;
     $actuArray['estado_agendamiento'] = "3-0";
     $actuArray['gestion_id'] = $actuObj->id;
     $actuArray['estado'] = 5;
     $actuArray['motivo'] = 4;
     $actuArray['submotivo'] = 6;
     unset($actuArray["fecha_agenda"]);
     unset($actuArray["horario_id"]);
     unset($actuArray["dia_id"]);
     unset($actuArray["tecnico"]);
     unset($actuArray["tecnico_id"]);
     unset($actuArray["celula_id"]);
     Input::replace($actuArray);
     $save = $this->_gestionMovimientoController->postRegistrar();
     $datos = array();
     $datos['aid'] = $activityId;
     $datos['envio_ofsc'] = 4;
     $datos['gestion_id'] = $save['gestion_id'];
     $datos['gestion_movimiento_id'] = $save['gestion_movimiento_id'];
     $datos['estado_ofsc_id'] = 4;
     GestionMovimiento::OfscUpdate($datos);
 }
예제 #4
0
 public function postEnvioofsc()
 {
     $datos = array();
     $datos['hf'] = explode("||", Input::get('hf'));
     $datos['fecha'] = $datos['hf'][0];
     $datos['bucket'] = $datos['hf'][1];
     $datos['slot'] = $datos['hf'][2];
     //time slot
     $datos['horas'] = explode("-", $datos['hf'][3]);
     $datos['empresa_id'] = Input::get('empresa_id');
     $datos['codactu'] = Input::get('codactu');
     $sla = false;
     $slaInicio = "0000-00-00 00:00";
     //retorno de transaccion
     $save = array("rst" => 2, "msj" => "Sin reultados.", "error" => "", "gestion_id" => 0);
     $inbound = new Inbound();
     $gestionId = "";
     $codactu = $datos['codactu'];
     //"35268199"; //
     $date = $datos['fecha'];
     //date("Y-m-d"); //
     $bucket = $datos['bucket'];
     //"BK_PRUEBAS_TOA";
     $tini = trim($datos['horas'][0]);
     //"09:00"
     $tend = trim($datos['horas'][1]);
     //"13:00"
     $tobooking = date("Y-m-d H:i");
     $slot = $datos['slot'];
     //"AM"
     $cuadrante = "Something";
     $techTp = "NULL";
     $techBb = "NULL";
     $techTv = "NULL";
     $wzKey = "";
     $wtLabel = "";
     $wType = "";
     $accTech = "COAXIAL";
     $businessType = "";
     $phone = array(0 => "", 1 => "");
     //Datos de la actuacion
     $actu = \Gestion::getCargar($codactu);
     //Existe la actuacion
     if (isset($actu["datos"][0])) {
         $actuObj = $actu["datos"][0];
         $actuArray = (array) $actuObj;
         $actuArray['noajax'] = "ok";
         //Motivo/Submotivo
         $actuArray['gestion_id'] = $actuObj->id;
         $actuArray['motivo'] = 1;
         $actuArray['submotivo'] = 1;
         $actuArray['estado'] = 2;
         //GestionID
         $gestionId = $actuObj->id;
         //Tipo de actividad: tabla "actividaes_tipos"
         $actTipo = DB::table('actividades_tipos')->select('nombre', 'label', 'sla', 'duracion')->where('id', '=', $actuArray['actividad_tipo_id'])->first();
         //Duracion en minutos
         $duration = $actTipo->duracion;
         //Quiebre grupo
         $quiebreGrupo = DB::table('quiebre_grupos')->select('nombre')->where('id', '=', $actuArray['quiebre_grupo_id'])->first();
         //Negocio por texto
         if (strpos($actuArray['tipo_averia'], "catv") > 0) {
             $businessType = "CATV";
         }
         if (strpos($actuArray['tipo_averia'], "adsl") > 0) {
             $businessType = "ADSL";
         }
         if (strpos($actuArray['tipo_averia'], "bas") > 0) {
             $businessType = "BASICA";
         }
         $wtLabel = $actTipo->label;
         $wType = $actTipo->nombre;
         //Telefonos de contacto
         $phoneArray = explode("|", $actuArray['fonos_contacto']);
         if (isset($phoneArray[0])) {
             $phone[0] = $phoneArray[0];
         }
         if (isset($phoneArray[1])) {
             $phone[1] = $phoneArray[1];
         }
         //Si no hay telefono de contacto
         if (strlen(trim($actuArray['fonos_contacto'])) < 6) {
             $phone = array("0000000", "0000000");
         }
         //Datos XY Web
         $actuArray['x'] = $actuArray['coord_x'];
         $actuArray['y'] = $actuArray['coord_y'];
         //Facilidades técnicas
         $ffttController = new \FfttController();
         $val = new stdClass();
         $val->fftt = $actuArray['fftt'];
         $val->tipoactu = $actuArray['tipo_averia'];
         $ffttArray = $ffttController->getExplodefftt($val);
         if ($ffttArray["tipo"] == 'catv') {
             $wzKey = $ffttArray["nodo"] . "_" . $ffttArray["troba"];
         } else {
             $wzKey = $ffttArray["mdf"] . "_" . $ffttArray["armario"];
         }
         //Parche: datos no concuerdan -> enumeration
         if ($actuArray['segmento'] == "NO-VIP") {
             $actuArray['segmento'] = "N";
         }
         //Homologacion de campos
         $dataOfsc = array("bucket" => $datos['bucket'], "actividad" => strtolower($actuObj->actividad), "date" => $date, "type" => "update_activity", "external_id" => $bucket, "start_time" => $tini, "end_time" => $tend, "appt_number" => $actuArray['codactu'], "customer_number" => $actuArray['inscripcion'], "worktype_label" => $wtLabel, "time_slot" => $slot, "time_of_booking" => $tobooking, "duration" => $duration, "name" => $actuArray['nombre_cliente'], "phone" => $phone[0], "email" => "", "cell" => $phone[1], "address" => $actuArray['direccion_instalacion'], "city" => "Lima", "state" => "Lima", "zip" => "LIMA 05", "language" => "1", "reminder_time" => "15", "time_zone" => "19", "coordx" => $actuArray['coord_x'], "coordy" => $actuArray['coord_y'], "XA_CREATION_DATE" => $tobooking, "XA_SOURCE_SYSTEM" => "PSI", "XA_CUSTOMER_SEGMENT" => $actuArray['segmento'], "XA_CUSTOMER_TYPE" => "", "XA_CONTACT_NAME" => "", "XA_CONTACT_PHONE_NUMBER_2" => "", "XA_CONTACT_PHONE_NUMBER_3" => "", "XA_CONTACT_PHONE_NUMBER_4" => "", "XA_CITY_CODE" => "", "XA_DISTRICT_CODE" => $actuArray['codigo_distrito'], "XA_DISTRICT_NAME" => $actuArray['distrito'], "XA_ZONE" => $actuArray['zonal'], "XA_QUADRANT" => $cuadrante, "XA_WORK_ZONE_KEY" => $wzKey, "XA_RURAL" => "", "XA_RED_ZONE" => "", "XA_WORK_TYPE" => $wType, "XA_APPOINTMENT_SCHEDULER" => "CLI", "XA_USER" => "", "XA_REQUIREMENT_NUMBER" => $actuArray['codactu'], "XA_NUMBER_SERVICE_ORDER" => $actuArray['orden_trabajo'], "XA_CHANNEL_ORIGIN" => "", "XA_SALES_POINT_CODE" => "", "XA_SALES_POINT_DESCRIPTION" => "", "XA_COMMERCIAL_VALIDATION" => "", "XA_TECHNICAL_VALIDATION" => "", "XA_WEB_UNIFICADA" => "", "XA_ORDER_AREA" => "", "XA_COMMERCIAL_PACKET" => "", "XA_COMPANY_NAME" => $actuArray['empresa'], "XA_GRUPO_QUIEBRE" => $quiebreGrupo->nombre, "XA_QUIEBRES" => $actuArray['quiebre'], "XA_BUSINESS_TYPE" => $businessType, "XA_PRODUCTS_SERVICES" => "", "XA_CURRENT_PRODUCTS_SERVICES" => "", "XA_EQUIPMENT" => "", "XA_NOTE" => $actuArray['observacion'], "XA_TELEPHONE_TECHNOLOGY" => $techTp, "XA_BROADBAND_TECHNOLOGY" => $techBb, "XA_TV_TECHNOLOGY" => $techTv, "XA_ACCESS_TECHNOLOGY" => $accTech, "XA_HFC_ZONE" => "", "XA_HFC_NODE" => "", "XA_HFC_TROBA" => "", "XA_HFC_AMPLIFIER" => "", "XA_HFC_TAP" => "", "XA_HFC_BORNE" => "", "XA_REQUIREMENT_TYPE" => "", "XA_REQUIREMENT_REASON" => "", "XA_CATV_SERVICE_CLASS" => "", "XA_MDF" => $actuArray['mdf'], "XA_CABLE" => "", "XA_CABINET" => "", "XA_BOX" => "", "XA_TERMINAL_ADDRESS" => "", "XA_TERMINAL_LINKHTTP" => "", "XA_ADSLSTB_PREFFIX" => "NULL", "XA_ADSLSTB_MOVEMENT" => "NULL", "XA_ADSL_SPEED" => "", "XA_ADSLSTB_SERVICE_TYPE" => "", "XA_PENDING_EXTERNAL_ACTION" => "", "XA_SMS_1" => $actuArray['sms1'], "XA_DIAGNOSIS" => "", "XA_TOTAL_REPAIRS" => $actuArray['total_averias']);
         //Envio por SLA
         if (Input::get('agdsla') == 'sla' and Input::get('slaini') != '') {
             $sla = true;
             $slaInicio = strtotime(Input::get('slaini'));
             $slaDay = $actTipo->sla * 3600;
             $slaFin = $slaInicio + $slaDay;
             $dataOfsc["sla_window_start"] = date("Y-m-d H:i", $slaInicio);
             $dataOfsc["sla_window_end"] = date("Y-m-d H:i", $slaFin);
             $dataOfsc["date"] = date("Y-m-d", $slaInicio);
         }
         //Campos adicionales para averia
         if (strtolower($actuObj->actividad) == 'averia') {
             $dataOfsc["XA_DIAGNOSIS"] = "SB_01";
         }
         /**
          * Guardar en tablas de gestion
          * - gestiones
          * - gestiones_detalles
          * - gestiones_movimientos
          * - ultimos_movimientos
          */
         $actuArray['fecha_agenda'] = $date;
         $horario = Horario::where('horario', '=', $slot)->first();
         if ($horario != NULL and $horario != '') {
             $actuArray['horario_id'] = $horario->id;
             $actuArray['dia_id'] = date("N", strtotime($date));
         }
         $actuArray['estado_agendamiento'] = "1-1";
         unset($actuArray["tecnico"]);
         unset($actuArray["tecnico_id"]);
         unset($actuArray["celula_id"]);
         Input::replace($actuArray);
         $save = $this->_gestionMovimientoController->postRegistrar();
         unset($actuArray["fecha_agenda"]);
         unset($actuArray["horario_id"]);
         unset($actuArray["dia_id"]);
         $actuArray['estado_agendamiento'] = "3-0";
         $actuArray['motivo'] = 2;
         $actuArray['submotivo'] = 18;
         $actuArray['estado'] = 7;
         if ($save["rst"] == 1) {
             //Crear actividad en OFSC
             /*if ( $dataOfsc['date']==0 ) {
                   $dataOfsc['date']=date("Y-m-d",strtotime(Input::get('slaini')) );
               }*/
             $response = $inbound->createActivity($dataOfsc, $sla);
             $report = $response->data->data->commands->command->appointment->report;
             $resultBool = true;
             /**
              * $report->message:
              * 
              * El mensaje de respuesta puede ser un arreglo
              * o un único mensaje.
              * Se valida la respuesta para cada mensaje recibido.
              */
             if (is_array($report->message)) {
                 foreach ($report->message as $val) {
                     if ($val->result == 'warning') {
                         $save["error"][] = $val->description;
                     }
                     if ($val->result == 'error') {
                         $save["error"][] = $val->description;
                     }
                 }
             } else {
                 if ($report->message->result == 'error') {
                     $resultBool = false;
                     $save["error"][] = $report->message->description;
                 }
             }
             //$result = $report->message->result;
             //Retorno OK
             if ($resultBool) {
                 //Appointment id
                 $aid = $response->data->data->commands->command->appointment->aid;
                 $datosofsc = array();
                 $datosofsc['aid'] = $aid;
                 $datosofsc['gestion_id'] = $save['gestion_id'];
                 $datosofsc['envio_ofsc'] = 2;
                 if ($sla == false) {
                     $datosofsc['envio_ofsc'] = 1;
                 }
                 $datosofsc['gestion_movimiento_id'] = $save['gestion_movimiento_id'];
                 GestionMovimiento::ActOfscAid($datosofsc);
                 $save["msj"] = "Registro y envío a OFSC correcto.";
                 $save["aid"] = $aid;
             }
             //Retorno ERROR
             if (!$resultBool) {
                 $errArray['type'] = $report->message->type;
                 $errArray['code'] = $report->message->code;
                 $errArray['desc'] = $report->message->description;
                 Input::replace($actuArray);
                 $save = $this->_gestionMovimientoController->postRegistrar();
                 $save["rst"] = 2;
                 $save["msj"] = "No se pudo enviar a OFSC. " . $report->message->description;
             }
         }
     }
     return json_encode($save);
 }
예제 #5
0
 public function postCargar()
 {
     if (Request::ajax()) {
         return Response::json(Gestion::getCargar());
     }
 }