示例#1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $contribuyentes = Contribuyente::all();
     foreach ($contribuyentes as $contr) {
         $nuevasCanceladas = [];
         $listSat = ArchivoSat::where(function ($q) use($contr) {
             $q->where('rfc_emisor', '=', $contr)->orWhere('rfc_receptor', '=', $contr);
         })->lists('uuid');
         $archivosEmpresa = ArchivoEmpresa::where(function ($q) use($contr) {
             $q->where('rfc_emisor', '=', $contr)->orWhere('rfc_receptor', '=', $contr);
         })->whereNotIn('uuid', $listSat)->get();
         $archivosSat = ArchivoSat::whereIn('uuid', $listSat)->get();
         $archivos = $archivosSat->merge($archivosEmpresa);
         foreach ($archivos as $datos) {
             $servidorSat = new ConsultarSat($datos->uuid, $datos->rfc_emisor, $datos->rfc_receptor, $datos->total);
             $servidorSat->hacerPeticion();
             if ($servidorSat->fueCanceladaRecientemente()) {
                 $nuevasCanceladas[] = array('uuid' => $datos->uuid, 'contribuyente' => $contr->nombre, 'rfc' => $contr->rfc);
             }
         }
     }
 }