예제 #1
0
 public function index()
 {
     $data = Infraction::all();
     $anexo = Anexo22::all();
     $infraccion = Infraction::lists('inf_description', 'id');
     return view('infraction.index')->with(["data" => $data, 'anexo' => $anexo, 'infra' => $infraccion]);
 }
 public function getFields()
 {
     $camposanx = '';
     $tabla = Input::get('table');
     $atributo = Input::get('attr');
     if ($atributo == 6) {
         $camposanx = Anexo22::all();
     }
     $campos = \DB::table('INFORMATION_SCHEMA.COLUMNS')->select('COLUMN_NAME as name')->where('TABLE_NAME', $tabla)->get();
     return \Response::json(['campos' => $campos, 'camposanx' => $camposanx]);
 }
예제 #3
0
 public function checkPedimento($referen, $valorOrigen)
 {
     if ($valorOrigen['entrada'] == 1) {
         $pk_referencia = $referen->pk_referencia;
         $tabla = 'optr02';
         $camposel1 = 'pk_factura';
         $camposel2 = 'pk_cove';
         $campow = 'pk_referencia';
     } else {
         $pk_referencia = $referen->folio_ds;
         $tabla = 'ds505';
         $camposel1 = 'NumeroFactura';
         $camposel2 = 'NumeroFactura';
         $campow = 'folio_ds';
     }
     //Recorrer campos del Anexo 22
     $anexo = Anexo22::all();
     foreach ($anexo as $anx) {
         //Checar validaciones por campo
         foreach ($anx->validations as $val) {
             $valid = $val->id;
             $camposbd = $anx->relationships->where('origin_id', $valorOrigen['entrada'])->first();
             $data = ["tabla" => $camposbd->table, "campos" => $camposbd->field, "attr_id" => $val->attribute_id, "data_val" => $val->val_data, "anx_id" => $anx->id, "entrada" => $valorOrigen['entrada'], "referencia" => $pk_referencia];
             $validacion = new Validation();
             $valor = $validacion->isValid($data);
             if ($valor == 0) {
                 if ($val->attribute_id == 9) {
                     $docum = 1;
                 } else {
                     $docum = 0;
                 }
                 $datos = ["res_referen" => $pk_referencia, "validations_id" => $valid, "res_document" => $docum, "res_company" => Session::get('empresa'), "res_user" => Session::get('usuario')];
                 $totalres = Result::where('res_referen', $pk_referencia)->where('validations_id', $valid)->count();
                 if ($totalres == 0) {
                     Result::create($datos);
                 }
             }
         }
     }
     $factura = \DB::connection('users')->table($tabla)->where($campow, $pk_referencia)->first();
     $cove = $this->checkCove($factura, $camposel1, $camposel2, $pk_referencia);
     echo $cove;
 }